comparison schedule.c @ 62:d71fbefaa9a9

*** empty log message ***
author gongo
date Thu, 09 Nov 2006 02:58:37 +0000
parents 4f977a556ba7
children e6a6dde71701
comparison
equal deleted inserted replaced
61:39162caa4587 62:d71fbefaa9a9
16 #include "light.h" 16 #include "light.h"
17 #include "title_scene.h" 17 #include "title_scene.h"
18 #include "game_time.h" 18 #include "game_time.h"
19 #include "schedule.h" 19 #include "schedule.h"
20 20
21 #ifdef LINDA
22 extern Bool linda_update(int);
23 #else
24 #define linda_update(int) TRUE
25 #endif
21 26
22 #define MAXCAR 3 // 選択可能機体 27 #define MAXCAR 3 // 選択可能機体
23 #define MAXFIELD 2 // 選択可能コース 28 #define MAXFIELD 2 // 選択可能コース
24 #define MAXRAP 3 // ラップ数 29 #define MAXRAP 3 // ラップ数
25 #define SP_SEL_CAR 50 30 #define SP_SEL_CAR 50
51 static int ranking = 0; 56 static int ranking = 0;
52 static LIGHT l; 57 static LIGHT l;
53 58
54 static int i=0; 59 static int i=0;
55 60
56 static void* (*sche_func_assumption)(); 61 static void (*sche_func_assumption)();
57 static void* (*sche_func)() = &sche_game_init; 62 static void (*sche_func)() = &sche_game_init;
58 static int change_state = 0; 63 static int change_state = 0;
59 static void 64 static void
60 set_schedule_assumption(void *_func) 65 set_schedule_assumption(void *_func)
61 { 66 {
62 sche_func_assumption = _func; 67 sche_func_assumption = _func;
63 change_state = 1; 68 change_state = 1;
69 }
70
71 static void
72 unset_schedule()
73 {
74 change_state = 0;
64 } 75 }
65 76
66 static void 77 static void
67 set_schedule() 78 set_schedule()
68 { 79 {
122 */ 133 */
123 static void 134 static void
124 sche_game_wait() 135 sche_game_wait()
125 { 136 {
126 gFont_SetString("WAITING...", 200, 100); 137 gFont_SetString("WAITING...", 200, 100);
127 if (game.linda_exec() == TRUE) 138 set_schedule_assumption(sche_game_wait_ready);
128 set_schedule_assumption(sche_game_wait_ready);
129 } 139 }
130 140
131 /** 141 /**
132 * 通信対戦専用 142 * 通信対戦専用
133 * 全ユーザの接続を確認したら呼び出す 143 * 全ユーザの接続を確認したら呼び出す
139 if (game.play_id == 1) { 149 if (game.play_id == 1) {
140 gFont_SetString(" PUSH START ", 170, 400); 150 gFont_SetString(" PUSH START ", 170, 400);
141 if (pad.st != 1) { goto WAIT_READY; } 151 if (pad.st != 1) { goto WAIT_READY; }
142 } 152 }
143 153
144 if (game.linda_exec() == TRUE) 154 set_schedule_assumption(sche_game_opening);
145 set_schedule_assumption(sche_game_opening);
146 155
147 WAIT_READY: 156 WAIT_READY:
148 return; 157 return;
149 } 158 }
150 159
159 blink_count = (blink_count > 70) ? 0 : blink_count + 1; 168 blink_count = (blink_count > 70) ? 0 : blink_count + 1;
160 169
161 if (pad.st != 1) { goto OPENING; } 170 if (pad.st != 1) { goto OPENING; }
162 } 171 }
163 172
164 if (game.linda_exec() == TRUE) 173
165 set_schedule_assumption(sche_game_select_car); 174 set_schedule_assumption(sche_game_select_car);
166 175
167 OPENING: 176 OPENING:
168 return; 177 return;
169 178
202 } 211 }
203 212
204 if (game.play_id == 1) 213 if (game.play_id == 1)
205 if (pad.circle != 1) { goto SELECT_CAR; } 214 if (pad.circle != 1) { goto SELECT_CAR; }
206 215
207 if (game.linda_exec() == TRUE) 216
208 set_schedule_assumption(sche_game_select_course); 217 set_schedule_assumption(sche_game_select_course);
209 218
210 SELECT_CAR: 219 SELECT_CAR:
211 return; 220 return;
212 } 221 }
235 } 244 }
236 245
237 if (pad.circle != 1) { goto SELECT_COURSE; } 246 if (pad.circle != 1) { goto SELECT_COURSE; }
238 } 247 }
239 248
240 if (game.linda_exec() == TRUE) 249
241 set_schedule_assumption(sche_game_ready); 250 set_schedule_assumption(sche_game_ready);
242 251
243 SELECT_COURSE: 252 SELECT_COURSE:
244 return; 253 return;
245 254
258 if (blink_count < 35) { 267 if (blink_count < 35) {
259 gFont_SetString("GAME START !!", 170, 380); 268 gFont_SetString("GAME START !!", 170, 380);
260 } 269 }
261 blink_count = (blink_count > 70) ? 0 : blink_count + 1; 270 blink_count = (blink_count > 70) ? 0 : blink_count + 1;
262 271
263 if (game.linda_exec() == TRUE) 272 set_schedule_assumption(sche_game_main_init);
264 set_schedule_assumption(sche_game_main_init);
265 273
266 /* 274 /*
267 if (pad.st == 1) { 275 if (pad.st == 1) {
268 set_schedule_assumption(sche_game_main_init); 276 set_schedule_assumption(sche_game_main_init);
269 } 277 }
431 { 439 {
432 sche_func(); 440 sche_func();
433 441
434 if (linda_update(change_state) == TRUE) 442 if (linda_update(change_state) == TRUE)
435 set_schedule(); 443 set_schedule();
444 else
445 unset_schedule();
436 446
437 wait_sync(); 447 wait_sync();
438 swap_dbuff(); 448 swap_dbuff();
439 sjoy_poll(); 449 sjoy_poll();
440 450