wok-current rev 7500
Add foobillard. An OpenGL billard game for Linux.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Sat Dec 04 02:40:57 2010 +0000 (2010-12-04) |
parents | 4fe0fd2676eb |
children | 4321f1d3889f |
files | foobillard/receipt foobillard/stuff/03_bugfixes foobillard/stuff/05_foul_explanation foobillard/stuff/06_show_ball_to_hit foobillard/stuff/foobillard.desktop foobillard/stuff/foobillard.png foobillard/stuff/snooker_draw.patch foobillard/stuff/snooker_reset.patch |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/foobillard/receipt Sat Dec 04 02:40:57 2010 +0000 1.3 @@ -0,0 +1,40 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="foobillard" 1.7 +VERSION="3.0a" 1.8 +CATEGORY="games" 1.9 +SHORT_DESC="An OpenGL billiard game for Linux." 1.10 +MAINTAINER="slaxemulator@gmail.com" 1.11 +DEPENDS="libsdl freetype libpng mesa libglu-mesa" 1.12 +BUILD_DEPENDS="libsdl-dev freetype-dev libpng-dev libglu-mesa mesa-dev zlib-dev" 1.13 +TARBALL="$PACKAGE-$VERSION.tar.gz" 1.14 +WEB_SITE="http://foobillard.sourceforge.net/" 1.15 +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL" 1.16 + 1.17 +# Rules to configure and make the package. 1.18 +compile_rules() 1.19 +{ 1.20 + cd $src 1.21 + sed -i -e 's/-lXaw//' -e 's/-lXi//' src/Makefile.in 1.22 + patch -p1 < ../stuff/03_bugfixes 1.23 + patch -p1 < ../stuff/05_foul_explanation 1.24 + patch -p1 < ../stuff/06_show_ball_to_hit 1.25 + patch -p0 < ../stuff/snooker_reset.patch 1.26 + patch -p0 < ../stuff/snooker_draw.patch 1.27 + 1.28 + ./configure \ 1.29 + --prefix=/usr \ 1.30 + --infodir=/usr/share/info \ 1.31 + --mandir=/usr/share/man \ 1.32 + $CONFIGURE_ARGS && 1.33 + make && make DESTDIR=$PWD/_pkg install 1.34 +} 1.35 + 1.36 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.37 +genpkg_rules() 1.38 +{ 1.39 + mkdir -p $fs/usr/share 1.40 + cp -a $_pkg/usr/bin $fs/usr 1.41 + cp -a $_pkg/usr/share/foobillard $fs/usr/share 1.42 +} 1.43 +
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/foobillard/stuff/03_bugfixes Sat Dec 04 02:40:57 2010 +0000 2.3 @@ -0,0 +1,36 @@ 2.4 +Index: foobillard-3.0a/src/ball.c 2.5 +=================================================================== 2.6 +--- foobillard-3.0a.orig/src/ball.c 2006-10-12 16:42:39.000000000 +0200 2.7 ++++ foobillard-3.0a/src/ball.c 2006-10-12 16:42:48.000000000 +0200 2.8 +@@ -1821,6 +1821,7 @@ 2.9 + } else if( options_cuberef && cuberef_binds!=0 ){ 2.10 + glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, cuberef_binds[i]); 2.11 + #ifdef GL_VERTEX_PROGRAM_NV 2.12 ++#ifdef USE_BALL_FRESNEL 2.13 + { 2.14 + myvec cam_pos2; 2.15 + // cam_pos2=vec_scale(vec_unit(vec_diff(cam_pos,balls.ball[i].r)),BALL_D/2.5); 2.16 +@@ -1829,6 +1830,7 @@ 2.17 + BALL_D/2.0,BALL_D/2.5,0,0 ); 2.18 + } 2.19 + #endif 2.20 ++#endif 2.21 + draw_ball(&balls.ball[i],cam_pos,cam_FOV,win_width,0); 2.22 + }else{ 2.23 + draw_ball(&balls.ball[i],cam_pos,cam_FOV,win_width,0); 2.24 +Index: foobillard-3.0a/src/evaluate_move.c 2.25 +=================================================================== 2.26 +--- foobillard-3.0a.orig/src/evaluate_move.c 2006-10-12 16:42:43.000000000 +0200 2.27 ++++ foobillard-3.0a/src/evaluate_move.c 2006-10-12 16:42:48.000000000 +0200 2.28 +@@ -385,6 +385,11 @@ 2.29 + int ball_out; 2.30 + int other_player=(act_player==1)?0:1; 2.31 + int b1hit = BM_get_1st_ball_hit(); if (b1hit>=8) b1hit=1; 2.32 ++ if(st.to_play==SN_DONE) 2.33 ++ { 2.34 ++ BM_reset_move_info(); 2.35 ++ return; 2.36 ++ } 2.37 + 2.38 + if( player[act_player].place_cue_ball ) player[act_player].place_cue_ball=0; 2.39 + printf("EVAL start\n");
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/foobillard/stuff/05_foul_explanation Sat Dec 04 02:40:57 2010 +0000 3.3 @@ -0,0 +1,262 @@ 3.4 +Index: foobillard-3.0a/src/billard3d.c 3.5 +=================================================================== 3.6 +--- foobillard-3.0a.orig/src/billard3d.c 2006-10-12 16:44:17.000000000 +0200 3.7 ++++ foobillard-3.0a/src/billard3d.c 2006-10-12 16:44:31.000000000 +0200 3.8 +@@ -331,6 +331,8 @@ 3.9 + static textObj * winner_name_text_obj; 3.10 + static textObj * winner_text_obj; 3.11 + 3.12 ++textObj * last_fault_text; 3.13 ++ 3.14 + #ifndef _WIN32 3.15 + 3.16 + enum optionType 3.17 +@@ -3322,6 +3324,13 @@ 3.18 + if( player[act_player].text != 0 ){ 3.19 + textObj_draw( player[act_player].text ); 3.20 + } 3.21 ++ /* last fault */ 3.22 ++ if (strcmp("x", last_fault_text->str)!=0) { 3.23 ++ glTranslatef(0.0, 70.0, 0.0); 3.24 ++ textObj_draw(last_fault_text); 3.25 ++ glTranslatef(0.0,-70.0,0.0); 3.26 ++ } 3.27 ++ 3.28 + glTranslatef(0,30,0); 3.29 + if (gametype==GAME_8BALL){ 3.30 + switch(player[act_player].half_full){ 3.31 +@@ -5197,6 +5206,9 @@ 3.32 + } 3.33 + DPRINTF("created winner text obj's\n"); 3.34 + 3.35 ++ 3.36 ++ last_fault_text = textObj_new( "x", options_help_fontname, 20 ); 3.37 ++ 3.38 + init_menu(); 3.39 + 3.40 + sys_set_timer(frametime_ms, Idle_timer); /* assure a framerate of max 50 fps (1frame/20ms) */ 3.41 +Index: foobillard-3.0a/src/evaluate_move.c 3.42 +=================================================================== 3.43 +--- foobillard-3.0a.orig/src/evaluate_move.c 2006-10-12 16:44:22.000000000 +0200 3.44 ++++ foobillard-3.0a/src/evaluate_move.c 2006-10-12 16:44:31.000000000 +0200 3.45 +@@ -4,6 +4,9 @@ 3.46 + ** Copyright (C) 2001 Florian Berger 3.47 + ** Email: harpin_floh@yahoo.de, florian.berger@jk.uni-linz.ac.at 3.48 + ** 3.49 ++** Small changes to output a reason why the last shot was a fault by 3.50 ++** Thorsten Gunkel <tgunkel-lists@tgunkel.de> 3.51 ++** 3.52 + ** This program is free software; you can redistribute it and/or modify 3.53 + ** it under the terms of the GNU General Public License Version 2 as 3.54 + ** published by the Free Software Foundation; 3.55 +@@ -108,11 +111,12 @@ 3.56 + 3.57 + /* wenn fremde kugel zuerst angespielt -> foul */ 3.58 + first_ball_hit=BM_get_1st_ball_hit(); 3.59 +- if( player[act_player].half_full == BALL_FULL ){ 3.60 +- if ( first_ball_hit>8 && first_ball_hit<16 ) foul=1; 3.61 +- } 3.62 +- if( player[act_player].half_full == BALL_HALF ){ 3.63 +- if ( first_ball_hit>0 && first_ball_hit<8 ) foul=1; 3.64 ++ if( 3.65 ++ ( player[act_player].half_full == BALL_FULL && first_ball_hit>8 && first_ball_hit<16 ) || 3.66 ++ ( player[act_player].half_full == BALL_HALF && first_ball_hit>0 && first_ball_hit<8 ) 3.67 ++ ){ 3.68 ++ foul=1; 3.69 ++ textObj_setText(last_fault_text, "First ball hit was not one of yours"); 3.70 + } 3.71 + 3.72 + /* erst an 2. stelle, da oben kein foul bei break */ 3.73 +@@ -146,7 +150,10 @@ 3.74 + } 3.75 + } 3.76 + } 3.77 +- if(eigene_da) foul=1; 3.78 ++ if(eigene_da){ 3.79 ++ foul=1; 3.80 ++ textObj_setText(last_fault_text, "You hit the 8-Ball too soon"); 3.81 ++ } 3.82 + } 3.83 + 3.84 + /* wenn angespielte kugel im strafraum */ 3.85 +@@ -154,6 +161,7 @@ 3.86 + in_strafraum(BM_get_1st_ball_hit_pos()) && 3.87 + !BM_get_non_strafraum_wall_hit_before_1st_ball(in_strafraum) ){ 3.88 + foul=1; 3.89 ++ textObj_setText(last_fault_text, "You hit a ball not behind the head string"); 3.90 + } 3.91 + 3.92 + /* wenn eigene rein naechster */ 3.93 +@@ -169,7 +177,10 @@ 3.94 + } 3.95 + 3.96 + 3.97 +- if( BM_get_balls_hit()==0 ) foul=1; 3.98 ++ if( BM_get_balls_hit()==0 ){ 3.99 ++ foul=1; 3.100 ++ textObj_setText(last_fault_text, "No Ball hit"); 3.101 ++ } 3.102 + 3.103 + /* wenn weisse rein */ 3.104 + if( BM_get_white_out() ){ 3.105 +@@ -177,6 +188,7 @@ 3.106 + foul=1; 3.107 + balls.ball[0].in_game=1; 3.108 + balls.ball[0].in_hole=0; 3.109 ++ textObj_setText(last_fault_text, "White ball potted"); 3.110 + } 3.111 + 3.112 + /* wenn foul */ 3.113 +@@ -188,6 +200,8 @@ 3.114 + balls.ball[0].w=vec_xyz(0.0,0.0,0.0); 3.115 + balls.ball[0].r=vec_xyz(0.0,-TABLE_L/4.0,0.0); 3.116 + // balls.ball[0].r=vec_xyz(x,y,0.0); 3.117 ++ } else { 3.118 ++ textObj_setText(last_fault_text, "x"); 3.119 + } 3.120 + 3.121 + /* if 8 out */ 3.122 +@@ -221,6 +235,7 @@ 3.123 + else 3.124 + { 3.125 + player[(act_player==1)?0:1].winner=1; 3.126 ++ textObj_setText(last_fault_text, "8 ball potted too soon"); 3.127 + } 3.128 + 3.129 + } 3.130 +@@ -277,9 +292,15 @@ 3.131 + nextplayer=0; 3.132 + } 3.133 + 3.134 +- if( BM_get_balls_hit()==0 ) foul=1; 3.135 +- 3.136 +- if( BM_get_1st_ball_hit()!=minball ) foul=1; 3.137 ++ if( BM_get_balls_hit()==0 ){ 3.138 ++ textObj_setText(last_fault_text, "No Ball hit"); 3.139 ++ foul=1; 3.140 ++ } else { 3.141 ++ if( BM_get_1st_ball_hit()!=minball ){ 3.142 ++ textObj_setText(last_fault_text, "First ball hit was not the lowest"); 3.143 ++ foul=1; 3.144 ++ } 3.145 ++ } 3.146 + 3.147 + /* wenn weisse rein */ 3.148 + if( BM_get_white_out() ){ 3.149 +@@ -287,6 +308,7 @@ 3.150 + nextplayer=1; 3.151 + pballs->ball[0].in_game=1; 3.152 + pballs->ball[0].in_hole=0; 3.153 ++ textObj_setText(last_fault_text, "White ball is potted"); 3.154 + } 3.155 + 3.156 + /* wenn foul - weisse platzieren */ 3.157 +@@ -297,6 +319,8 @@ 3.158 + pballs->ball[0].v=vec_xyz(0.0,0.0,0.0); 3.159 + pballs->ball[0].w=vec_xyz(0.0,0.0,0.0); 3.160 + pballs->ball[0].r=vec_xyz(0,-TABLE_L/4.0,0.0); 3.161 ++ } else { 3.162 ++ textObj_setText(last_fault_text, "x"); 3.163 + } 3.164 + 3.165 + fprintf(stderr,"foul:%d, nextplayer:%d, BM_get_ball_out(9):%d\n",foul,nextplayer,BM_get_ball_out(9)); 3.166 +@@ -409,6 +433,7 @@ 3.167 + act_penalty =MAX(act_penalty,(BM_get_1st_ball_hit()<=7?BM_get_1st_ball_hit():4)); 3.168 + spot_snooker_ball(pballs,0); 3.169 + player[other_player].place_cue_ball=1; 3.170 ++ textObj_setText(last_fault_text, "White ball is potted"); 3.171 + } 3.172 + 3.173 + switch(st.to_play) 3.174 +@@ -420,6 +445,11 @@ 3.175 + foul=1; 3.176 + act_penalty=MAX(act_penalty,b1hit); 3.177 + printf("EVAL foul 1\n"); 3.178 ++ if( BM_get_balls_hit()==0 ){ 3.179 ++ textObj_setText(last_fault_text, "No Ball hit"); 3.180 ++ } else { 3.181 ++ textObj_setText(last_fault_text, "First ball hit was not a red one"); 3.182 ++ } 3.183 + } 3.184 + i=1; 3.185 + while((ball_out=BM_get_nth_ball_out(i++))>=0) 3.186 +@@ -434,6 +464,11 @@ 3.187 + act_penalty=MAX(act_penalty,ball_out); 3.188 + foul=1; 3.189 + printf("EVAL foul 2\n"); 3.190 ++ if (BM_get_white_out()){ 3.191 ++ textObj_setText(last_fault_text, "White ball potted"); 3.192 ++ } else { 3.193 ++ textObj_setText(last_fault_text, "Potted ball was not a red one"); 3.194 ++ } 3.195 + } 3.196 + } 3.197 + for(i=2;i<8;i++) 3.198 +@@ -449,6 +484,11 @@ 3.199 + foul=1; 3.200 + printf("EVAL foul 3\n"); 3.201 + act_penalty=MAX(act_penalty,7); 3.202 ++ if( BM_get_balls_hit()==0 ){ 3.203 ++ textObj_setText(last_fault_text, "No Ball hit"); 3.204 ++ } else { 3.205 ++ textObj_setText(last_fault_text, "First ball hit was not a colored one"); 3.206 ++ } 3.207 + } 3.208 + color_to_pot=b1hit; 3.209 + i=1; 3.210 +@@ -464,6 +504,11 @@ 3.211 + foul=1; 3.212 + printf("EVAL foul 4\n"); 3.213 + act_penalty=MAX(act_penalty,ball_out==1?7:ball_out); 3.214 ++ if (BM_get_white_out()){ 3.215 ++ textObj_setText(last_fault_text, "White ball potted"); 3.216 ++ } else { 3.217 ++ textObj_setText(last_fault_text, "Potted ball was not a colored one"); 3.218 ++ } 3.219 + } 3.220 + } 3.221 + if(red_balls_are_in_game) 3.222 +@@ -490,6 +535,11 @@ 3.223 + printf("EVAL foul 5\n"); 3.224 + act_penalty=MAX(act_penalty,b1hit); 3.225 + act_penalty=MAX(act_penalty,color_to_pot); 3.226 ++ if( BM_get_balls_hit()==0 ){ 3.227 ++ textObj_setText(last_fault_text, "No Ball hit"); 3.228 ++ } else { 3.229 ++ textObj_setText(last_fault_text, "First ball hit was not the correct one"); 3.230 ++ } 3.231 + } 3.232 + i=1; 3.233 + while((ball_out=BM_get_nth_ball_out(i++))>=0) 3.234 +@@ -505,6 +555,11 @@ 3.235 + printf("EVAL foul 6\n"); 3.236 + act_penalty=MAX(act_penalty,b1hit); 3.237 + act_penalty=MAX(act_penalty,color_to_pot); 3.238 ++ if (BM_get_white_out()){ 3.239 ++ textObj_setText(last_fault_text, "White ball potted"); 3.240 ++ } else { 3.241 ++ textObj_setText(last_fault_text, "Potted ball was not the correct one"); 3.242 ++ } 3.243 + } 3.244 + } 3.245 + if(!foul && act_score>0) st.to_play++; 3.246 +@@ -528,6 +583,7 @@ 3.247 + { 3.248 + player[act_player].score += act_score ; 3.249 + printf("EVAL no foul\n"); 3.250 ++ textObj_setText(last_fault_text, "x"); 3.251 + } 3.252 + if(act_score==0 || foul) 3.253 + { 3.254 +Index: foobillard-3.0a/src/evaluate_move.h 3.255 +=================================================================== 3.256 +--- foobillard-3.0a.orig/src/evaluate_move.h 2006-10-12 16:44:24.000000000 +0200 3.257 ++++ foobillard-3.0a/src/evaluate_move.h 2006-10-12 16:44:31.000000000 +0200 3.258 +@@ -31,6 +31,7 @@ 3.259 + BallsType * pballs, int * pqueue_view, float * pXque ); 3.260 + #endif 3.261 + 3.262 ++extern textObj * last_fault_text; 3.263 + 3.264 + void evaluate_last_move_8ball ( struct Player * player, int * actual_player, 3.265 + BallsType * pballs, int * pqueue_view, float * pXque );
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/foobillard/stuff/06_show_ball_to_hit Sat Dec 04 02:40:57 2010 +0000 4.3 @@ -0,0 +1,255 @@ 4.4 +Index: foobillard-3.0a/src/billard.c 4.5 +=================================================================== 4.6 +--- foobillard-3.0a.orig/src/billard.c 2006-10-12 16:45:04.000000000 +0200 4.7 ++++ foobillard-3.0a/src/billard.c 2006-10-12 16:45:23.000000000 +0200 4.8 +@@ -31,6 +31,8 @@ 4.9 + void * (*billard_malloc)( size_t size ) = malloc; 4.10 + void (*billard_free)( void * ptr ) = free; 4.11 + 4.12 ++SnookerState snooker_state={SN_PLAY_RED}; 4.13 ++ 4.14 + void setfunc_create_scene( void (*func)( BallsType * balls ) ) 4.15 + { 4.16 + create_scene=func; 4.17 +Index: foobillard-3.0a/src/billard.h 4.18 +=================================================================== 4.19 +--- foobillard-3.0a.orig/src/billard.h 2006-10-12 16:45:05.000000000 +0200 4.20 ++++ foobillard-3.0a/src/billard.h 2006-10-12 16:45:23.000000000 +0200 4.21 +@@ -76,9 +76,30 @@ 4.22 + #define BALL_HALF 2 4.23 + #define BALL_ANY 0 4.24 + 4.25 ++typedef enum 4.26 ++{ 4.27 ++ SN_PLAY_RED, 4.28 ++ SN_PLAY_ANY_COLOR, 4.29 ++ SN_PLAY_YELLOW, 4.30 ++ SN_PLAY_GREEN, 4.31 ++ SN_PLAY_BROWN, 4.32 ++ SN_PLAY_BLUE, 4.33 ++ SN_PLAY_PINK, 4.34 ++ SN_PLAY_BLACK, 4.35 ++ SN_DONE 4.36 ++} 4.37 ++SnookerBallToPlay; 4.38 ++ 4.39 ++typedef struct 4.40 ++{ 4.41 ++ SnookerBallToPlay to_play; 4.42 ++} 4.43 ++SnookerState; 4.44 ++ 4.45 + #ifndef BILLARD_C 4.46 + extern void (*create_scene)( BallsType * balls ); 4.47 + extern void (*create_walls)( BordersType * walls ); 4.48 ++extern SnookerState snooker_state; 4.49 + #endif 4.50 + 4.51 + void create_0hole_walls( BordersType * walls ); /* carambol */ 4.52 +Index: foobillard-3.0a/src/billard3d.c 4.53 +=================================================================== 4.54 +--- foobillard-3.0a.orig/src/billard3d.c 2006-10-12 16:45:08.000000000 +0200 4.55 ++++ foobillard-3.0a/src/billard3d.c 2006-10-12 16:45:23.000000000 +0200 4.56 +@@ -829,6 +829,7 @@ 4.57 + player[act_player].place_cue_ball=1; 4.58 + human_player_roster.player[0].cue_ball=0; human_player_roster.player[1].cue_ball=0; 4.59 + human_player_roster.player[act_player].place_cue_ball=1; 4.60 ++ snooker_state.to_play=SN_PLAY_RED; 4.61 + } 4.62 + } 4.63 + 4.64 +@@ -1787,6 +1788,7 @@ 4.65 + /* score text */ 4.66 + for(i=0;i<2;i++){ 4.67 + char str[256]; 4.68 ++ char *color; 4.69 + switch(gametype){ 4.70 + case GAME_8BALL: strcpy(str,"0"); break; 4.71 + case GAME_9BALL: 4.72 +@@ -1805,7 +1807,44 @@ 4.73 + sprintf( str, "%d", player[i].score ); 4.74 + break; 4.75 + case GAME_SNOOKER: 4.76 +- sprintf( str, "%c%03d %s", (player[i].score<0)?'-':'+', abs(player[i].score), player[i].snooker_on_red ? "red":"col" ); 4.77 ++ switch(snooker_state.to_play) 4.78 ++ { 4.79 ++ case SN_PLAY_RED: 4.80 ++ color="red"; 4.81 ++ break; 4.82 ++ case SN_PLAY_ANY_COLOR: 4.83 ++ color="color"; 4.84 ++ break; 4.85 ++ case SN_PLAY_YELLOW: 4.86 ++ color="yellow"; 4.87 ++ break; 4.88 ++ case SN_PLAY_GREEN: 4.89 ++ color="green"; 4.90 ++ break; 4.91 ++ case SN_PLAY_BROWN: 4.92 ++ color="brown"; 4.93 ++ break; 4.94 ++ case SN_PLAY_BLUE: 4.95 ++ color="blue"; 4.96 ++ break; 4.97 ++ case SN_PLAY_PINK: 4.98 ++ color="pink"; 4.99 ++ break; 4.100 ++ case SN_PLAY_BLACK: 4.101 ++ color="black"; 4.102 ++ break; 4.103 ++ case SN_DONE: 4.104 ++ color=""; 4.105 ++ break; 4.106 ++ } 4.107 ++ if(i==act_player) 4.108 ++ { 4.109 ++ sprintf( str, "%.3d %s", player[i].score, color); 4.110 ++ } 4.111 ++ else 4.112 ++ { 4.113 ++ sprintf( str, "%.3d", player[i].score); 4.114 ++ } 4.115 + break; 4.116 + } 4.117 + textObj_setText( player[i].score_text, str ); 4.118 +Index: foobillard-3.0a/src/evaluate_move.c 4.119 +=================================================================== 4.120 +--- foobillard-3.0a.orig/src/evaluate_move.c 2006-10-12 16:45:12.000000000 +0200 4.121 ++++ foobillard-3.0a/src/evaluate_move.c 2006-10-12 16:45:23.000000000 +0200 4.122 +@@ -30,26 +30,6 @@ 4.123 + 4.124 + #define MAX(x,y) ((x)>(y)?(x):(y)); 4.125 + 4.126 +-typedef enum 4.127 +-{ 4.128 +- SN_PLAY_RED, 4.129 +- SN_PLAY_ANY_COLOR, 4.130 +- SN_PLAY_YELLOW, 4.131 +- SN_PLAY_GREEN, 4.132 +- SN_PLAY_BROWN, 4.133 +- SN_PLAY_BLUE, 4.134 +- SN_PLAY_PINK, 4.135 +- SN_PLAY_BLACK, 4.136 +- SN_DONE 4.137 +-} 4.138 +-SnookerBallToPlay; 4.139 +- 4.140 +-typedef struct 4.141 +-{ 4.142 +- SnookerBallToPlay to_play; 4.143 +-} 4.144 +-SnookerState; 4.145 +- 4.146 + 4.147 + void spot_snooker_ball(BallsType *balls,int nr); 4.148 + 4.149 +@@ -400,7 +380,6 @@ 4.150 + #define act_player (*pact_player) 4.151 + #define IS_RED(x) ( x==1 || x>=8 ) 4.152 + int red_balls_are_in_game=0; 4.153 +- static SnookerState st={SN_PLAY_RED}; 4.154 + int color_to_pot; 4.155 + int i; 4.156 + int act_score=0; 4.157 +@@ -409,7 +388,7 @@ 4.158 + int ball_out; 4.159 + int other_player=(act_player==1)?0:1; 4.160 + int b1hit = BM_get_1st_ball_hit(); if (b1hit>=8) b1hit=1; 4.161 +- if(st.to_play==SN_DONE) 4.162 ++ if(snooker_state.to_play==SN_DONE) 4.163 + { 4.164 + BM_reset_move_info(); 4.165 + return; 4.166 +@@ -417,7 +396,7 @@ 4.167 + 4.168 + if( player[act_player].place_cue_ball ) player[act_player].place_cue_ball=0; 4.169 + printf("EVAL start\n"); 4.170 +- printf("EVAL to_play=%d\n",st.to_play); 4.171 ++ printf("EVAL to_play=%d\n",snooker_state.to_play); 4.172 + printf("EVAL b1hit=%d\n",b1hit); 4.173 + for(i=0;i<pballs->nr;i++){ 4.174 + if( IS_RED(pballs->ball[i].nr) && pballs->ball[i].in_game ){ 4.175 +@@ -436,7 +415,7 @@ 4.176 + textObj_setText(last_fault_text, "White ball is potted"); 4.177 + } 4.178 + 4.179 +- switch(st.to_play) 4.180 ++ switch(snooker_state.to_play) 4.181 + { 4.182 + case SN_PLAY_RED: 4.183 + color_to_pot=1; 4.184 +@@ -476,7 +455,7 @@ 4.185 + if( BM_get_ball_out(i)) 4.186 + spot_snooker_ball(pballs,i); 4.187 + } 4.188 +- st.to_play=SN_PLAY_ANY_COLOR; 4.189 ++ snooker_state.to_play=SN_PLAY_ANY_COLOR; 4.190 + break; 4.191 + case SN_PLAY_ANY_COLOR: 4.192 + if(b1hit==1) 4.193 +@@ -512,9 +491,9 @@ 4.194 + } 4.195 + } 4.196 + if(red_balls_are_in_game) 4.197 +- st.to_play=SN_PLAY_RED; 4.198 ++ snooker_state.to_play=SN_PLAY_RED; 4.199 + else 4.200 +- st.to_play=SN_PLAY_YELLOW; 4.201 ++ snooker_state.to_play=SN_PLAY_YELLOW; 4.202 + 4.203 + for(i=2;i<8;i++) 4.204 + { 4.205 +@@ -528,7 +507,7 @@ 4.206 + case SN_PLAY_BLUE: 4.207 + case SN_PLAY_PINK: 4.208 + case SN_PLAY_BLACK: 4.209 +- color_to_pot=st.to_play; 4.210 ++ color_to_pot=snooker_state.to_play; 4.211 + if(b1hit!=color_to_pot) 4.212 + { 4.213 + foul=1; 4.214 +@@ -562,9 +541,9 @@ 4.215 + } 4.216 + } 4.217 + } 4.218 +- if(!foul && act_score>0) st.to_play++; 4.219 ++ if(!foul && act_score>0) snooker_state.to_play++; 4.220 + 4.221 +- for(i=st.to_play;i<8;i++) 4.222 ++ for(i=snooker_state.to_play;i<8;i++) 4.223 + { 4.224 + if( BM_get_ball_out(i)) 4.225 + spot_snooker_ball(pballs,i); 4.226 +@@ -590,13 +569,13 @@ 4.227 + printf("EVAL next player\n"); 4.228 + if(red_balls_are_in_game) 4.229 + { 4.230 +- st.to_play=SN_PLAY_RED; 4.231 ++ snooker_state.to_play=SN_PLAY_RED; 4.232 + } 4.233 + else 4.234 + { 4.235 +- if(st.to_play<=SN_PLAY_ANY_COLOR) 4.236 ++ if(snooker_state.to_play<=SN_PLAY_ANY_COLOR) 4.237 + { 4.238 +- st.to_play=SN_PLAY_YELLOW; 4.239 ++ snooker_state.to_play=SN_PLAY_YELLOW; 4.240 + } 4.241 + } 4.242 + player[act_player].queue_view=*pqueue_view; 4.243 +@@ -605,11 +584,11 @@ 4.244 + *pqueue_view=player[act_player].queue_view; 4.245 + } 4.246 + 4.247 +- player[act_player].snooker_on_red=st.to_play==SN_PLAY_RED; 4.248 +- player[act_player].snooker_next_color=st.to_play; 4.249 +- printf("EVAL to_play=%d\n",st.to_play); 4.250 ++ player[act_player].snooker_on_red=snooker_state.to_play==SN_PLAY_RED; 4.251 ++ player[act_player].snooker_next_color=snooker_state.to_play; 4.252 ++ printf("EVAL to_play=%d\n",snooker_state.to_play); 4.253 + 4.254 +- if(st.to_play==SN_DONE) 4.255 ++ if(snooker_state.to_play==SN_DONE) 4.256 + { 4.257 + int other_player; 4.258 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/foobillard/stuff/foobillard.desktop Sat Dec 04 02:40:57 2010 +0000 5.3 @@ -0,0 +1,9 @@ 5.4 +[Desktop Entry] 5.5 +Name=Foobillard 5.6 +Comment=A 3D billiards game using OpenGL 5.7 +Exec=foobillard 5.8 +Icon=foobillard.png 5.9 +Terminal=false 5.10 +Type=Application 5.11 +Categories=Game;SportsGame; 5.12 +StartupNotify=false
6.1 Binary file foobillard/stuff/foobillard.png has changed
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/foobillard/stuff/snooker_draw.patch Sat Dec 04 02:40:57 2010 +0000 7.3 @@ -0,0 +1,48 @@ 7.4 +Index: src/evaluate_move.c 7.5 +=================================================================== 7.6 +--- src/evaluate_move.c (revision 6) 7.7 ++++ src/evaluate_move.c (working copy) 7.8 +@@ -602,6 +602,11 @@ 7.9 + player[act_player].winner=0; 7.10 + player[other_player].winner=1; 7.11 + } 7.12 ++ if(player[act_player].score==player[other_player].score) { 7.13 ++ player[act_player].winner=1; 7.14 ++ player[other_player].winner=1; 7.15 ++ } 7.16 ++ 7.17 + } 7.18 + 7.19 + printf("EVAL done\n"); 7.20 +Index: src/billard3d.c 7.21 +=================================================================== 7.22 +--- src/billard3d.c (revision 6) 7.23 ++++ src/billard3d.c (working copy) 7.24 +@@ -1760,8 +1760,17 @@ 7.25 + options_gamemode==options_gamemode_tournament && 7.26 + (player[0].winner || player[1].winner) ) 7.27 + { 7.28 +- tournament_evaluate_last_match( &tournament_state ); 7.29 +- tournament_state.wait_for_next_match=1; 7.30 ++ if ( player[0].winner == player[1].winner ) 7.31 ++ { // Draw 7.32 ++ restart_game_common(); 7.33 ++ player[act_player].winner=0; 7.34 ++ player[other_player].winner=0; 7.35 ++ } 7.36 ++ else 7.37 ++ { 7.38 ++ tournament_evaluate_last_match( &tournament_state ); 7.39 ++ tournament_state.wait_for_next_match=1; 7.40 ++ } 7.41 + } 7.42 + } else { 7.43 + int old_cueball_ind; 7.44 +@@ -3654,6 +3663,7 @@ 7.45 + create_walls( &walls ); 7.46 + create_scene( &balls ); 7.47 + g_shot_due=1; 7.48 ++ snooker_state.to_play=SN_PLAY_RED; 7.49 + } 7.50 + 7.51 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/foobillard/stuff/snooker_reset.patch Sat Dec 04 02:40:57 2010 +0000 8.3 @@ -0,0 +1,11 @@ 8.4 +--- src/billard3d.c 2010-02-27 04:01:40.000000000 -0600 8.5 ++++ src/billard3d.c 2010-02-27 04:02:59.000000000 -0600 8.6 +@@ -1219,6 +1219,8 @@ 8.7 + printf("tournament_state_setup_next_match 7\n"); 8.8 + queue_view=player[act_player].queue_view; 8.9 + printf("tournament_state_setup_next_match 8\n"); 8.10 ++ snooker_state.to_play = SN_PLAY_RED; 8.11 ++ printf("tournament_state_setup_next_match 9\n"); 8.12 + } 8.13 + 8.14 + void create_players_text()