diff options
Diffstat (limited to 'extra/foobillard/05_foul_explanation')
-rw-r--r-- | extra/foobillard/05_foul_explanation | 262 |
1 files changed, 262 insertions, 0 deletions
diff --git a/extra/foobillard/05_foul_explanation b/extra/foobillard/05_foul_explanation new file mode 100644 index 000000000..af89c5e95 --- /dev/null +++ b/extra/foobillard/05_foul_explanation @@ -0,0 +1,262 @@ +Index: foobillard-3.0a/src/billard3d.c +=================================================================== +--- foobillard-3.0a.orig/src/billard3d.c 2006-10-12 16:44:17.000000000 +0200 ++++ foobillard-3.0a/src/billard3d.c 2006-10-12 16:44:31.000000000 +0200 +@@ -331,6 +331,8 @@ + static textObj * winner_name_text_obj; + static textObj * winner_text_obj; + ++textObj * last_fault_text; ++ + #ifndef _WIN32 + + enum optionType +@@ -3322,6 +3324,13 @@ + if( player[act_player].text != 0 ){ + textObj_draw( player[act_player].text ); + } ++ /* last fault */ ++ if (strcmp("x", last_fault_text->str)!=0) { ++ glTranslatef(0.0, 70.0, 0.0); ++ textObj_draw(last_fault_text); ++ glTranslatef(0.0,-70.0,0.0); ++ } ++ + glTranslatef(0,30,0); + if (gametype==GAME_8BALL){ + switch(player[act_player].half_full){ +@@ -5197,6 +5206,9 @@ + } + DPRINTF("created winner text obj's\n"); + ++ ++ last_fault_text = textObj_new( "x", options_help_fontname, 20 ); ++ + init_menu(); + + sys_set_timer(frametime_ms, Idle_timer); /* assure a framerate of max 50 fps (1frame/20ms) */ +Index: foobillard-3.0a/src/evaluate_move.c +=================================================================== +--- foobillard-3.0a.orig/src/evaluate_move.c 2006-10-12 16:44:22.000000000 +0200 ++++ foobillard-3.0a/src/evaluate_move.c 2006-10-12 16:44:31.000000000 +0200 +@@ -4,6 +4,9 @@ + ** Copyright (C) 2001 Florian Berger + ** Email: harpin_floh@yahoo.de, florian.berger@jk.uni-linz.ac.at + ** ++** Small changes to output a reason why the last shot was a fault by ++** Thorsten Gunkel <tgunkel-lists@tgunkel.de> ++** + ** This program is free software; you can redistribute it and/or modify + ** it under the terms of the GNU General Public License Version 2 as + ** published by the Free Software Foundation; +@@ -108,11 +111,12 @@ + + /* wenn fremde kugel zuerst angespielt -> foul */ + first_ball_hit=BM_get_1st_ball_hit(); +- if( player[act_player].half_full == BALL_FULL ){ +- if ( first_ball_hit>8 && first_ball_hit<16 ) foul=1; +- } +- if( player[act_player].half_full == BALL_HALF ){ +- if ( first_ball_hit>0 && first_ball_hit<8 ) foul=1; ++ if( ++ ( player[act_player].half_full == BALL_FULL && first_ball_hit>8 && first_ball_hit<16 ) || ++ ( player[act_player].half_full == BALL_HALF && first_ball_hit>0 && first_ball_hit<8 ) ++ ){ ++ foul=1; ++ textObj_setText(last_fault_text, "First ball hit was not one of yours"); + } + + /* erst an 2. stelle, da oben kein foul bei break */ +@@ -146,7 +150,10 @@ + } + } + } +- if(eigene_da) foul=1; ++ if(eigene_da){ ++ foul=1; ++ textObj_setText(last_fault_text, "You hit the 8-Ball too soon"); ++ } + } + + /* wenn angespielte kugel im strafraum */ +@@ -154,6 +161,7 @@ + in_strafraum(BM_get_1st_ball_hit_pos()) && + !BM_get_non_strafraum_wall_hit_before_1st_ball(in_strafraum) ){ + foul=1; ++ textObj_setText(last_fault_text, "You hit a ball not behind the head string"); + } + + /* wenn eigene rein naechster */ +@@ -169,7 +177,10 @@ + } + + +- if( BM_get_balls_hit()==0 ) foul=1; ++ if( BM_get_balls_hit()==0 ){ ++ foul=1; ++ textObj_setText(last_fault_text, "No Ball hit"); ++ } + + /* wenn weisse rein */ + if( BM_get_white_out() ){ +@@ -177,6 +188,7 @@ + foul=1; + balls.ball[0].in_game=1; + balls.ball[0].in_hole=0; ++ textObj_setText(last_fault_text, "White ball potted"); + } + + /* wenn foul */ +@@ -188,6 +200,8 @@ + balls.ball[0].w=vec_xyz(0.0,0.0,0.0); + balls.ball[0].r=vec_xyz(0.0,-TABLE_L/4.0,0.0); + // balls.ball[0].r=vec_xyz(x,y,0.0); ++ } else { ++ textObj_setText(last_fault_text, "x"); + } + + /* if 8 out */ +@@ -221,6 +235,7 @@ + else + { + player[(act_player==1)?0:1].winner=1; ++ textObj_setText(last_fault_text, "8 ball potted too soon"); + } + + } +@@ -277,9 +292,15 @@ + nextplayer=0; + } + +- if( BM_get_balls_hit()==0 ) foul=1; +- +- if( BM_get_1st_ball_hit()!=minball ) foul=1; ++ if( BM_get_balls_hit()==0 ){ ++ textObj_setText(last_fault_text, "No Ball hit"); ++ foul=1; ++ } else { ++ if( BM_get_1st_ball_hit()!=minball ){ ++ textObj_setText(last_fault_text, "First ball hit was not the lowest"); ++ foul=1; ++ } ++ } + + /* wenn weisse rein */ + if( BM_get_white_out() ){ +@@ -287,6 +308,7 @@ + nextplayer=1; + pballs->ball[0].in_game=1; + pballs->ball[0].in_hole=0; ++ textObj_setText(last_fault_text, "White ball is potted"); + } + + /* wenn foul - weisse platzieren */ +@@ -297,6 +319,8 @@ + pballs->ball[0].v=vec_xyz(0.0,0.0,0.0); + pballs->ball[0].w=vec_xyz(0.0,0.0,0.0); + pballs->ball[0].r=vec_xyz(0,-TABLE_L/4.0,0.0); ++ } else { ++ textObj_setText(last_fault_text, "x"); + } + + fprintf(stderr,"foul:%d, nextplayer:%d, BM_get_ball_out(9):%d\n",foul,nextplayer,BM_get_ball_out(9)); +@@ -409,6 +433,7 @@ + act_penalty =MAX(act_penalty,(BM_get_1st_ball_hit()<=7?BM_get_1st_ball_hit():4)); + spot_snooker_ball(pballs,0); + player[other_player].place_cue_ball=1; ++ textObj_setText(last_fault_text, "White ball is potted"); + } + + switch(st.to_play) +@@ -420,6 +445,11 @@ + foul=1; + act_penalty=MAX(act_penalty,b1hit); + printf("EVAL foul 1\n"); ++ if( BM_get_balls_hit()==0 ){ ++ textObj_setText(last_fault_text, "No Ball hit"); ++ } else { ++ textObj_setText(last_fault_text, "First ball hit was not a red one"); ++ } + } + i=1; + while((ball_out=BM_get_nth_ball_out(i++))>=0) +@@ -434,6 +464,11 @@ + act_penalty=MAX(act_penalty,ball_out); + foul=1; + printf("EVAL foul 2\n"); ++ if (BM_get_white_out()){ ++ textObj_setText(last_fault_text, "White ball potted"); ++ } else { ++ textObj_setText(last_fault_text, "Potted ball was not a red one"); ++ } + } + } + for(i=2;i<8;i++) +@@ -449,6 +484,11 @@ + foul=1; + printf("EVAL foul 3\n"); + act_penalty=MAX(act_penalty,7); ++ if( BM_get_balls_hit()==0 ){ ++ textObj_setText(last_fault_text, "No Ball hit"); ++ } else { ++ textObj_setText(last_fault_text, "First ball hit was not a colored one"); ++ } + } + color_to_pot=b1hit; + i=1; +@@ -464,6 +504,11 @@ + foul=1; + printf("EVAL foul 4\n"); + act_penalty=MAX(act_penalty,ball_out==1?7:ball_out); ++ if (BM_get_white_out()){ ++ textObj_setText(last_fault_text, "White ball potted"); ++ } else { ++ textObj_setText(last_fault_text, "Potted ball was not a colored one"); ++ } + } + } + if(red_balls_are_in_game) +@@ -490,6 +535,11 @@ + printf("EVAL foul 5\n"); + act_penalty=MAX(act_penalty,b1hit); + act_penalty=MAX(act_penalty,color_to_pot); ++ if( BM_get_balls_hit()==0 ){ ++ textObj_setText(last_fault_text, "No Ball hit"); ++ } else { ++ textObj_setText(last_fault_text, "First ball hit was not the correct one"); ++ } + } + i=1; + while((ball_out=BM_get_nth_ball_out(i++))>=0) +@@ -505,6 +555,11 @@ + printf("EVAL foul 6\n"); + act_penalty=MAX(act_penalty,b1hit); + act_penalty=MAX(act_penalty,color_to_pot); ++ if (BM_get_white_out()){ ++ textObj_setText(last_fault_text, "White ball potted"); ++ } else { ++ textObj_setText(last_fault_text, "Potted ball was not the correct one"); ++ } + } + } + if(!foul && act_score>0) st.to_play++; +@@ -528,6 +583,7 @@ + { + player[act_player].score += act_score ; + printf("EVAL no foul\n"); ++ textObj_setText(last_fault_text, "x"); + } + if(act_score==0 || foul) + { +Index: foobillard-3.0a/src/evaluate_move.h +=================================================================== +--- foobillard-3.0a.orig/src/evaluate_move.h 2006-10-12 16:44:24.000000000 +0200 ++++ foobillard-3.0a/src/evaluate_move.h 2006-10-12 16:44:31.000000000 +0200 +@@ -31,6 +31,7 @@ + BallsType * pballs, int * pqueue_view, float * pXque ); + #endif + ++extern textObj * last_fault_text; + + void evaluate_last_move_8ball ( struct Player * player, int * actual_player, + BallsType * pballs, int * pqueue_view, float * pXque ); |