wok-current diff foobillard/stuff/05_foul_explanation @ rev 10927
ntop-man: Fixed path to copy man pages to.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Wed Aug 17 12:52:36 2011 +0000 (2011-08-17) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/foobillard/stuff/05_foul_explanation Wed Aug 17 12:52:36 2011 +0000 1.3 @@ -0,0 +1,262 @@ 1.4 +Index: foobillard-3.0a/src/billard3d.c 1.5 +=================================================================== 1.6 +--- foobillard-3.0a.orig/src/billard3d.c 2006-10-12 16:44:17.000000000 +0200 1.7 ++++ foobillard-3.0a/src/billard3d.c 2006-10-12 16:44:31.000000000 +0200 1.8 +@@ -331,6 +331,8 @@ 1.9 + static textObj * winner_name_text_obj; 1.10 + static textObj * winner_text_obj; 1.11 + 1.12 ++textObj * last_fault_text; 1.13 ++ 1.14 + #ifndef _WIN32 1.15 + 1.16 + enum optionType 1.17 +@@ -3322,6 +3324,13 @@ 1.18 + if( player[act_player].text != 0 ){ 1.19 + textObj_draw( player[act_player].text ); 1.20 + } 1.21 ++ /* last fault */ 1.22 ++ if (strcmp("x", last_fault_text->str)!=0) { 1.23 ++ glTranslatef(0.0, 70.0, 0.0); 1.24 ++ textObj_draw(last_fault_text); 1.25 ++ glTranslatef(0.0,-70.0,0.0); 1.26 ++ } 1.27 ++ 1.28 + glTranslatef(0,30,0); 1.29 + if (gametype==GAME_8BALL){ 1.30 + switch(player[act_player].half_full){ 1.31 +@@ -5197,6 +5206,9 @@ 1.32 + } 1.33 + DPRINTF("created winner text obj's\n"); 1.34 + 1.35 ++ 1.36 ++ last_fault_text = textObj_new( "x", options_help_fontname, 20 ); 1.37 ++ 1.38 + init_menu(); 1.39 + 1.40 + sys_set_timer(frametime_ms, Idle_timer); /* assure a framerate of max 50 fps (1frame/20ms) */ 1.41 +Index: foobillard-3.0a/src/evaluate_move.c 1.42 +=================================================================== 1.43 +--- foobillard-3.0a.orig/src/evaluate_move.c 2006-10-12 16:44:22.000000000 +0200 1.44 ++++ foobillard-3.0a/src/evaluate_move.c 2006-10-12 16:44:31.000000000 +0200 1.45 +@@ -4,6 +4,9 @@ 1.46 + ** Copyright (C) 2001 Florian Berger 1.47 + ** Email: harpin_floh@yahoo.de, florian.berger@jk.uni-linz.ac.at 1.48 + ** 1.49 ++** Small changes to output a reason why the last shot was a fault by 1.50 ++** Thorsten Gunkel <tgunkel-lists@tgunkel.de> 1.51 ++** 1.52 + ** This program is free software; you can redistribute it and/or modify 1.53 + ** it under the terms of the GNU General Public License Version 2 as 1.54 + ** published by the Free Software Foundation; 1.55 +@@ -108,11 +111,12 @@ 1.56 + 1.57 + /* wenn fremde kugel zuerst angespielt -> foul */ 1.58 + first_ball_hit=BM_get_1st_ball_hit(); 1.59 +- if( player[act_player].half_full == BALL_FULL ){ 1.60 +- if ( first_ball_hit>8 && first_ball_hit<16 ) foul=1; 1.61 +- } 1.62 +- if( player[act_player].half_full == BALL_HALF ){ 1.63 +- if ( first_ball_hit>0 && first_ball_hit<8 ) foul=1; 1.64 ++ if( 1.65 ++ ( player[act_player].half_full == BALL_FULL && first_ball_hit>8 && first_ball_hit<16 ) || 1.66 ++ ( player[act_player].half_full == BALL_HALF && first_ball_hit>0 && first_ball_hit<8 ) 1.67 ++ ){ 1.68 ++ foul=1; 1.69 ++ textObj_setText(last_fault_text, "First ball hit was not one of yours"); 1.70 + } 1.71 + 1.72 + /* erst an 2. stelle, da oben kein foul bei break */ 1.73 +@@ -146,7 +150,10 @@ 1.74 + } 1.75 + } 1.76 + } 1.77 +- if(eigene_da) foul=1; 1.78 ++ if(eigene_da){ 1.79 ++ foul=1; 1.80 ++ textObj_setText(last_fault_text, "You hit the 8-Ball too soon"); 1.81 ++ } 1.82 + } 1.83 + 1.84 + /* wenn angespielte kugel im strafraum */ 1.85 +@@ -154,6 +161,7 @@ 1.86 + in_strafraum(BM_get_1st_ball_hit_pos()) && 1.87 + !BM_get_non_strafraum_wall_hit_before_1st_ball(in_strafraum) ){ 1.88 + foul=1; 1.89 ++ textObj_setText(last_fault_text, "You hit a ball not behind the head string"); 1.90 + } 1.91 + 1.92 + /* wenn eigene rein naechster */ 1.93 +@@ -169,7 +177,10 @@ 1.94 + } 1.95 + 1.96 + 1.97 +- if( BM_get_balls_hit()==0 ) foul=1; 1.98 ++ if( BM_get_balls_hit()==0 ){ 1.99 ++ foul=1; 1.100 ++ textObj_setText(last_fault_text, "No Ball hit"); 1.101 ++ } 1.102 + 1.103 + /* wenn weisse rein */ 1.104 + if( BM_get_white_out() ){ 1.105 +@@ -177,6 +188,7 @@ 1.106 + foul=1; 1.107 + balls.ball[0].in_game=1; 1.108 + balls.ball[0].in_hole=0; 1.109 ++ textObj_setText(last_fault_text, "White ball potted"); 1.110 + } 1.111 + 1.112 + /* wenn foul */ 1.113 +@@ -188,6 +200,8 @@ 1.114 + balls.ball[0].w=vec_xyz(0.0,0.0,0.0); 1.115 + balls.ball[0].r=vec_xyz(0.0,-TABLE_L/4.0,0.0); 1.116 + // balls.ball[0].r=vec_xyz(x,y,0.0); 1.117 ++ } else { 1.118 ++ textObj_setText(last_fault_text, "x"); 1.119 + } 1.120 + 1.121 + /* if 8 out */ 1.122 +@@ -221,6 +235,7 @@ 1.123 + else 1.124 + { 1.125 + player[(act_player==1)?0:1].winner=1; 1.126 ++ textObj_setText(last_fault_text, "8 ball potted too soon"); 1.127 + } 1.128 + 1.129 + } 1.130 +@@ -277,9 +292,15 @@ 1.131 + nextplayer=0; 1.132 + } 1.133 + 1.134 +- if( BM_get_balls_hit()==0 ) foul=1; 1.135 +- 1.136 +- if( BM_get_1st_ball_hit()!=minball ) foul=1; 1.137 ++ if( BM_get_balls_hit()==0 ){ 1.138 ++ textObj_setText(last_fault_text, "No Ball hit"); 1.139 ++ foul=1; 1.140 ++ } else { 1.141 ++ if( BM_get_1st_ball_hit()!=minball ){ 1.142 ++ textObj_setText(last_fault_text, "First ball hit was not the lowest"); 1.143 ++ foul=1; 1.144 ++ } 1.145 ++ } 1.146 + 1.147 + /* wenn weisse rein */ 1.148 + if( BM_get_white_out() ){ 1.149 +@@ -287,6 +308,7 @@ 1.150 + nextplayer=1; 1.151 + pballs->ball[0].in_game=1; 1.152 + pballs->ball[0].in_hole=0; 1.153 ++ textObj_setText(last_fault_text, "White ball is potted"); 1.154 + } 1.155 + 1.156 + /* wenn foul - weisse platzieren */ 1.157 +@@ -297,6 +319,8 @@ 1.158 + pballs->ball[0].v=vec_xyz(0.0,0.0,0.0); 1.159 + pballs->ball[0].w=vec_xyz(0.0,0.0,0.0); 1.160 + pballs->ball[0].r=vec_xyz(0,-TABLE_L/4.0,0.0); 1.161 ++ } else { 1.162 ++ textObj_setText(last_fault_text, "x"); 1.163 + } 1.164 + 1.165 + fprintf(stderr,"foul:%d, nextplayer:%d, BM_get_ball_out(9):%d\n",foul,nextplayer,BM_get_ball_out(9)); 1.166 +@@ -409,6 +433,7 @@ 1.167 + act_penalty =MAX(act_penalty,(BM_get_1st_ball_hit()<=7?BM_get_1st_ball_hit():4)); 1.168 + spot_snooker_ball(pballs,0); 1.169 + player[other_player].place_cue_ball=1; 1.170 ++ textObj_setText(last_fault_text, "White ball is potted"); 1.171 + } 1.172 + 1.173 + switch(st.to_play) 1.174 +@@ -420,6 +445,11 @@ 1.175 + foul=1; 1.176 + act_penalty=MAX(act_penalty,b1hit); 1.177 + printf("EVAL foul 1\n"); 1.178 ++ if( BM_get_balls_hit()==0 ){ 1.179 ++ textObj_setText(last_fault_text, "No Ball hit"); 1.180 ++ } else { 1.181 ++ textObj_setText(last_fault_text, "First ball hit was not a red one"); 1.182 ++ } 1.183 + } 1.184 + i=1; 1.185 + while((ball_out=BM_get_nth_ball_out(i++))>=0) 1.186 +@@ -434,6 +464,11 @@ 1.187 + act_penalty=MAX(act_penalty,ball_out); 1.188 + foul=1; 1.189 + printf("EVAL foul 2\n"); 1.190 ++ if (BM_get_white_out()){ 1.191 ++ textObj_setText(last_fault_text, "White ball potted"); 1.192 ++ } else { 1.193 ++ textObj_setText(last_fault_text, "Potted ball was not a red one"); 1.194 ++ } 1.195 + } 1.196 + } 1.197 + for(i=2;i<8;i++) 1.198 +@@ -449,6 +484,11 @@ 1.199 + foul=1; 1.200 + printf("EVAL foul 3\n"); 1.201 + act_penalty=MAX(act_penalty,7); 1.202 ++ if( BM_get_balls_hit()==0 ){ 1.203 ++ textObj_setText(last_fault_text, "No Ball hit"); 1.204 ++ } else { 1.205 ++ textObj_setText(last_fault_text, "First ball hit was not a colored one"); 1.206 ++ } 1.207 + } 1.208 + color_to_pot=b1hit; 1.209 + i=1; 1.210 +@@ -464,6 +504,11 @@ 1.211 + foul=1; 1.212 + printf("EVAL foul 4\n"); 1.213 + act_penalty=MAX(act_penalty,ball_out==1?7:ball_out); 1.214 ++ if (BM_get_white_out()){ 1.215 ++ textObj_setText(last_fault_text, "White ball potted"); 1.216 ++ } else { 1.217 ++ textObj_setText(last_fault_text, "Potted ball was not a colored one"); 1.218 ++ } 1.219 + } 1.220 + } 1.221 + if(red_balls_are_in_game) 1.222 +@@ -490,6 +535,11 @@ 1.223 + printf("EVAL foul 5\n"); 1.224 + act_penalty=MAX(act_penalty,b1hit); 1.225 + act_penalty=MAX(act_penalty,color_to_pot); 1.226 ++ if( BM_get_balls_hit()==0 ){ 1.227 ++ textObj_setText(last_fault_text, "No Ball hit"); 1.228 ++ } else { 1.229 ++ textObj_setText(last_fault_text, "First ball hit was not the correct one"); 1.230 ++ } 1.231 + } 1.232 + i=1; 1.233 + while((ball_out=BM_get_nth_ball_out(i++))>=0) 1.234 +@@ -505,6 +555,11 @@ 1.235 + printf("EVAL foul 6\n"); 1.236 + act_penalty=MAX(act_penalty,b1hit); 1.237 + act_penalty=MAX(act_penalty,color_to_pot); 1.238 ++ if (BM_get_white_out()){ 1.239 ++ textObj_setText(last_fault_text, "White ball potted"); 1.240 ++ } else { 1.241 ++ textObj_setText(last_fault_text, "Potted ball was not the correct one"); 1.242 ++ } 1.243 + } 1.244 + } 1.245 + if(!foul && act_score>0) st.to_play++; 1.246 +@@ -528,6 +583,7 @@ 1.247 + { 1.248 + player[act_player].score += act_score ; 1.249 + printf("EVAL no foul\n"); 1.250 ++ textObj_setText(last_fault_text, "x"); 1.251 + } 1.252 + if(act_score==0 || foul) 1.253 + { 1.254 +Index: foobillard-3.0a/src/evaluate_move.h 1.255 +=================================================================== 1.256 +--- foobillard-3.0a.orig/src/evaluate_move.h 2006-10-12 16:44:24.000000000 +0200 1.257 ++++ foobillard-3.0a/src/evaluate_move.h 2006-10-12 16:44:31.000000000 +0200 1.258 +@@ -31,6 +31,7 @@ 1.259 + BallsType * pballs, int * pqueue_view, float * pXque ); 1.260 + #endif 1.261 + 1.262 ++extern textObj * last_fault_text; 1.263 + 1.264 + void evaluate_last_move_8ball ( struct Player * player, int * actual_player, 1.265 + BallsType * pballs, int * pqueue_view, float * pXque );