wok-next view foobillard/stuff/05_foul_explanation @ rev 18704

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