wok annotate foobillard/stuff/05_foul_explanation @ rev 9522

Update smplayer build depends.
author Christopher Rogers <slaxemulator@gmail.com>
date Thu Apr 07 08:43:43 2011 +0000 (2011-04-07)
parents
children
rev   line source
slaxemulator@7500 1 Index: foobillard-3.0a/src/billard3d.c
slaxemulator@7500 2 ===================================================================
slaxemulator@7500 3 --- foobillard-3.0a.orig/src/billard3d.c 2006-10-12 16:44:17.000000000 +0200
slaxemulator@7500 4 +++ foobillard-3.0a/src/billard3d.c 2006-10-12 16:44:31.000000000 +0200
slaxemulator@7500 5 @@ -331,6 +331,8 @@
slaxemulator@7500 6 static textObj * winner_name_text_obj;
slaxemulator@7500 7 static textObj * winner_text_obj;
slaxemulator@7500 8
slaxemulator@7500 9 +textObj * last_fault_text;
slaxemulator@7500 10 +
slaxemulator@7500 11 #ifndef _WIN32
slaxemulator@7500 12
slaxemulator@7500 13 enum optionType
slaxemulator@7500 14 @@ -3322,6 +3324,13 @@
slaxemulator@7500 15 if( player[act_player].text != 0 ){
slaxemulator@7500 16 textObj_draw( player[act_player].text );
slaxemulator@7500 17 }
slaxemulator@7500 18 + /* last fault */
slaxemulator@7500 19 + if (strcmp("x", last_fault_text->str)!=0) {
slaxemulator@7500 20 + glTranslatef(0.0, 70.0, 0.0);
slaxemulator@7500 21 + textObj_draw(last_fault_text);
slaxemulator@7500 22 + glTranslatef(0.0,-70.0,0.0);
slaxemulator@7500 23 + }
slaxemulator@7500 24 +
slaxemulator@7500 25 glTranslatef(0,30,0);
slaxemulator@7500 26 if (gametype==GAME_8BALL){
slaxemulator@7500 27 switch(player[act_player].half_full){
slaxemulator@7500 28 @@ -5197,6 +5206,9 @@
slaxemulator@7500 29 }
slaxemulator@7500 30 DPRINTF("created winner text obj's\n");
slaxemulator@7500 31
slaxemulator@7500 32 +
slaxemulator@7500 33 + last_fault_text = textObj_new( "x", options_help_fontname, 20 );
slaxemulator@7500 34 +
slaxemulator@7500 35 init_menu();
slaxemulator@7500 36
slaxemulator@7500 37 sys_set_timer(frametime_ms, Idle_timer); /* assure a framerate of max 50 fps (1frame/20ms) */
slaxemulator@7500 38 Index: foobillard-3.0a/src/evaluate_move.c
slaxemulator@7500 39 ===================================================================
slaxemulator@7500 40 --- foobillard-3.0a.orig/src/evaluate_move.c 2006-10-12 16:44:22.000000000 +0200
slaxemulator@7500 41 +++ foobillard-3.0a/src/evaluate_move.c 2006-10-12 16:44:31.000000000 +0200
slaxemulator@7500 42 @@ -4,6 +4,9 @@
slaxemulator@7500 43 ** Copyright (C) 2001 Florian Berger
slaxemulator@7500 44 ** Email: harpin_floh@yahoo.de, florian.berger@jk.uni-linz.ac.at
slaxemulator@7500 45 **
slaxemulator@7500 46 +** Small changes to output a reason why the last shot was a fault by
slaxemulator@7500 47 +** Thorsten Gunkel <tgunkel-lists@tgunkel.de>
slaxemulator@7500 48 +**
slaxemulator@7500 49 ** This program is free software; you can redistribute it and/or modify
slaxemulator@7500 50 ** it under the terms of the GNU General Public License Version 2 as
slaxemulator@7500 51 ** published by the Free Software Foundation;
slaxemulator@7500 52 @@ -108,11 +111,12 @@
slaxemulator@7500 53
slaxemulator@7500 54 /* wenn fremde kugel zuerst angespielt -> foul */
slaxemulator@7500 55 first_ball_hit=BM_get_1st_ball_hit();
slaxemulator@7500 56 - if( player[act_player].half_full == BALL_FULL ){
slaxemulator@7500 57 - if ( first_ball_hit>8 && first_ball_hit<16 ) foul=1;
slaxemulator@7500 58 - }
slaxemulator@7500 59 - if( player[act_player].half_full == BALL_HALF ){
slaxemulator@7500 60 - if ( first_ball_hit>0 && first_ball_hit<8 ) foul=1;
slaxemulator@7500 61 + if(
slaxemulator@7500 62 + ( player[act_player].half_full == BALL_FULL && first_ball_hit>8 && first_ball_hit<16 ) ||
slaxemulator@7500 63 + ( player[act_player].half_full == BALL_HALF && first_ball_hit>0 && first_ball_hit<8 )
slaxemulator@7500 64 + ){
slaxemulator@7500 65 + foul=1;
slaxemulator@7500 66 + textObj_setText(last_fault_text, "First ball hit was not one of yours");
slaxemulator@7500 67 }
slaxemulator@7500 68
slaxemulator@7500 69 /* erst an 2. stelle, da oben kein foul bei break */
slaxemulator@7500 70 @@ -146,7 +150,10 @@
slaxemulator@7500 71 }
slaxemulator@7500 72 }
slaxemulator@7500 73 }
slaxemulator@7500 74 - if(eigene_da) foul=1;
slaxemulator@7500 75 + if(eigene_da){
slaxemulator@7500 76 + foul=1;
slaxemulator@7500 77 + textObj_setText(last_fault_text, "You hit the 8-Ball too soon");
slaxemulator@7500 78 + }
slaxemulator@7500 79 }
slaxemulator@7500 80
slaxemulator@7500 81 /* wenn angespielte kugel im strafraum */
slaxemulator@7500 82 @@ -154,6 +161,7 @@
slaxemulator@7500 83 in_strafraum(BM_get_1st_ball_hit_pos()) &&
slaxemulator@7500 84 !BM_get_non_strafraum_wall_hit_before_1st_ball(in_strafraum) ){
slaxemulator@7500 85 foul=1;
slaxemulator@7500 86 + textObj_setText(last_fault_text, "You hit a ball not behind the head string");
slaxemulator@7500 87 }
slaxemulator@7500 88
slaxemulator@7500 89 /* wenn eigene rein naechster */
slaxemulator@7500 90 @@ -169,7 +177,10 @@
slaxemulator@7500 91 }
slaxemulator@7500 92
slaxemulator@7500 93
slaxemulator@7500 94 - if( BM_get_balls_hit()==0 ) foul=1;
slaxemulator@7500 95 + if( BM_get_balls_hit()==0 ){
slaxemulator@7500 96 + foul=1;
slaxemulator@7500 97 + textObj_setText(last_fault_text, "No Ball hit");
slaxemulator@7500 98 + }
slaxemulator@7500 99
slaxemulator@7500 100 /* wenn weisse rein */
slaxemulator@7500 101 if( BM_get_white_out() ){
slaxemulator@7500 102 @@ -177,6 +188,7 @@
slaxemulator@7500 103 foul=1;
slaxemulator@7500 104 balls.ball[0].in_game=1;
slaxemulator@7500 105 balls.ball[0].in_hole=0;
slaxemulator@7500 106 + textObj_setText(last_fault_text, "White ball potted");
slaxemulator@7500 107 }
slaxemulator@7500 108
slaxemulator@7500 109 /* wenn foul */
slaxemulator@7500 110 @@ -188,6 +200,8 @@
slaxemulator@7500 111 balls.ball[0].w=vec_xyz(0.0,0.0,0.0);
slaxemulator@7500 112 balls.ball[0].r=vec_xyz(0.0,-TABLE_L/4.0,0.0);
slaxemulator@7500 113 // balls.ball[0].r=vec_xyz(x,y,0.0);
slaxemulator@7500 114 + } else {
slaxemulator@7500 115 + textObj_setText(last_fault_text, "x");
slaxemulator@7500 116 }
slaxemulator@7500 117
slaxemulator@7500 118 /* if 8 out */
slaxemulator@7500 119 @@ -221,6 +235,7 @@
slaxemulator@7500 120 else
slaxemulator@7500 121 {
slaxemulator@7500 122 player[(act_player==1)?0:1].winner=1;
slaxemulator@7500 123 + textObj_setText(last_fault_text, "8 ball potted too soon");
slaxemulator@7500 124 }
slaxemulator@7500 125
slaxemulator@7500 126 }
slaxemulator@7500 127 @@ -277,9 +292,15 @@
slaxemulator@7500 128 nextplayer=0;
slaxemulator@7500 129 }
slaxemulator@7500 130
slaxemulator@7500 131 - if( BM_get_balls_hit()==0 ) foul=1;
slaxemulator@7500 132 -
slaxemulator@7500 133 - if( BM_get_1st_ball_hit()!=minball ) foul=1;
slaxemulator@7500 134 + if( BM_get_balls_hit()==0 ){
slaxemulator@7500 135 + textObj_setText(last_fault_text, "No Ball hit");
slaxemulator@7500 136 + foul=1;
slaxemulator@7500 137 + } else {
slaxemulator@7500 138 + if( BM_get_1st_ball_hit()!=minball ){
slaxemulator@7500 139 + textObj_setText(last_fault_text, "First ball hit was not the lowest");
slaxemulator@7500 140 + foul=1;
slaxemulator@7500 141 + }
slaxemulator@7500 142 + }
slaxemulator@7500 143
slaxemulator@7500 144 /* wenn weisse rein */
slaxemulator@7500 145 if( BM_get_white_out() ){
slaxemulator@7500 146 @@ -287,6 +308,7 @@
slaxemulator@7500 147 nextplayer=1;
slaxemulator@7500 148 pballs->ball[0].in_game=1;
slaxemulator@7500 149 pballs->ball[0].in_hole=0;
slaxemulator@7500 150 + textObj_setText(last_fault_text, "White ball is potted");
slaxemulator@7500 151 }
slaxemulator@7500 152
slaxemulator@7500 153 /* wenn foul - weisse platzieren */
slaxemulator@7500 154 @@ -297,6 +319,8 @@
slaxemulator@7500 155 pballs->ball[0].v=vec_xyz(0.0,0.0,0.0);
slaxemulator@7500 156 pballs->ball[0].w=vec_xyz(0.0,0.0,0.0);
slaxemulator@7500 157 pballs->ball[0].r=vec_xyz(0,-TABLE_L/4.0,0.0);
slaxemulator@7500 158 + } else {
slaxemulator@7500 159 + textObj_setText(last_fault_text, "x");
slaxemulator@7500 160 }
slaxemulator@7500 161
slaxemulator@7500 162 fprintf(stderr,"foul:%d, nextplayer:%d, BM_get_ball_out(9):%d\n",foul,nextplayer,BM_get_ball_out(9));
slaxemulator@7500 163 @@ -409,6 +433,7 @@
slaxemulator@7500 164 act_penalty =MAX(act_penalty,(BM_get_1st_ball_hit()<=7?BM_get_1st_ball_hit():4));
slaxemulator@7500 165 spot_snooker_ball(pballs,0);
slaxemulator@7500 166 player[other_player].place_cue_ball=1;
slaxemulator@7500 167 + textObj_setText(last_fault_text, "White ball is potted");
slaxemulator@7500 168 }
slaxemulator@7500 169
slaxemulator@7500 170 switch(st.to_play)
slaxemulator@7500 171 @@ -420,6 +445,11 @@
slaxemulator@7500 172 foul=1;
slaxemulator@7500 173 act_penalty=MAX(act_penalty,b1hit);
slaxemulator@7500 174 printf("EVAL foul 1\n");
slaxemulator@7500 175 + if( BM_get_balls_hit()==0 ){
slaxemulator@7500 176 + textObj_setText(last_fault_text, "No Ball hit");
slaxemulator@7500 177 + } else {
slaxemulator@7500 178 + textObj_setText(last_fault_text, "First ball hit was not a red one");
slaxemulator@7500 179 + }
slaxemulator@7500 180 }
slaxemulator@7500 181 i=1;
slaxemulator@7500 182 while((ball_out=BM_get_nth_ball_out(i++))>=0)
slaxemulator@7500 183 @@ -434,6 +464,11 @@
slaxemulator@7500 184 act_penalty=MAX(act_penalty,ball_out);
slaxemulator@7500 185 foul=1;
slaxemulator@7500 186 printf("EVAL foul 2\n");
slaxemulator@7500 187 + if (BM_get_white_out()){
slaxemulator@7500 188 + textObj_setText(last_fault_text, "White ball potted");
slaxemulator@7500 189 + } else {
slaxemulator@7500 190 + textObj_setText(last_fault_text, "Potted ball was not a red one");
slaxemulator@7500 191 + }
slaxemulator@7500 192 }
slaxemulator@7500 193 }
slaxemulator@7500 194 for(i=2;i<8;i++)
slaxemulator@7500 195 @@ -449,6 +484,11 @@
slaxemulator@7500 196 foul=1;
slaxemulator@7500 197 printf("EVAL foul 3\n");
slaxemulator@7500 198 act_penalty=MAX(act_penalty,7);
slaxemulator@7500 199 + if( BM_get_balls_hit()==0 ){
slaxemulator@7500 200 + textObj_setText(last_fault_text, "No Ball hit");
slaxemulator@7500 201 + } else {
slaxemulator@7500 202 + textObj_setText(last_fault_text, "First ball hit was not a colored one");
slaxemulator@7500 203 + }
slaxemulator@7500 204 }
slaxemulator@7500 205 color_to_pot=b1hit;
slaxemulator@7500 206 i=1;
slaxemulator@7500 207 @@ -464,6 +504,11 @@
slaxemulator@7500 208 foul=1;
slaxemulator@7500 209 printf("EVAL foul 4\n");
slaxemulator@7500 210 act_penalty=MAX(act_penalty,ball_out==1?7:ball_out);
slaxemulator@7500 211 + if (BM_get_white_out()){
slaxemulator@7500 212 + textObj_setText(last_fault_text, "White ball potted");
slaxemulator@7500 213 + } else {
slaxemulator@7500 214 + textObj_setText(last_fault_text, "Potted ball was not a colored one");
slaxemulator@7500 215 + }
slaxemulator@7500 216 }
slaxemulator@7500 217 }
slaxemulator@7500 218 if(red_balls_are_in_game)
slaxemulator@7500 219 @@ -490,6 +535,11 @@
slaxemulator@7500 220 printf("EVAL foul 5\n");
slaxemulator@7500 221 act_penalty=MAX(act_penalty,b1hit);
slaxemulator@7500 222 act_penalty=MAX(act_penalty,color_to_pot);
slaxemulator@7500 223 + if( BM_get_balls_hit()==0 ){
slaxemulator@7500 224 + textObj_setText(last_fault_text, "No Ball hit");
slaxemulator@7500 225 + } else {
slaxemulator@7500 226 + textObj_setText(last_fault_text, "First ball hit was not the correct one");
slaxemulator@7500 227 + }
slaxemulator@7500 228 }
slaxemulator@7500 229 i=1;
slaxemulator@7500 230 while((ball_out=BM_get_nth_ball_out(i++))>=0)
slaxemulator@7500 231 @@ -505,6 +555,11 @@
slaxemulator@7500 232 printf("EVAL foul 6\n");
slaxemulator@7500 233 act_penalty=MAX(act_penalty,b1hit);
slaxemulator@7500 234 act_penalty=MAX(act_penalty,color_to_pot);
slaxemulator@7500 235 + if (BM_get_white_out()){
slaxemulator@7500 236 + textObj_setText(last_fault_text, "White ball potted");
slaxemulator@7500 237 + } else {
slaxemulator@7500 238 + textObj_setText(last_fault_text, "Potted ball was not the correct one");
slaxemulator@7500 239 + }
slaxemulator@7500 240 }
slaxemulator@7500 241 }
slaxemulator@7500 242 if(!foul && act_score>0) st.to_play++;
slaxemulator@7500 243 @@ -528,6 +583,7 @@
slaxemulator@7500 244 {
slaxemulator@7500 245 player[act_player].score += act_score ;
slaxemulator@7500 246 printf("EVAL no foul\n");
slaxemulator@7500 247 + textObj_setText(last_fault_text, "x");
slaxemulator@7500 248 }
slaxemulator@7500 249 if(act_score==0 || foul)
slaxemulator@7500 250 {
slaxemulator@7500 251 Index: foobillard-3.0a/src/evaluate_move.h
slaxemulator@7500 252 ===================================================================
slaxemulator@7500 253 --- foobillard-3.0a.orig/src/evaluate_move.h 2006-10-12 16:44:24.000000000 +0200
slaxemulator@7500 254 +++ foobillard-3.0a/src/evaluate_move.h 2006-10-12 16:44:31.000000000 +0200
slaxemulator@7500 255 @@ -31,6 +31,7 @@
slaxemulator@7500 256 BallsType * pballs, int * pqueue_view, float * pXque );
slaxemulator@7500 257 #endif
slaxemulator@7500 258
slaxemulator@7500 259 +extern textObj * last_fault_text;
slaxemulator@7500 260
slaxemulator@7500 261 void evaluate_last_move_8ball ( struct Player * player, int * actual_player,
slaxemulator@7500 262 BallsType * pballs, int * pqueue_view, float * pXque );