Mercurial > hg > old > magoroku_racing
annotate schedule.c @ 95:b0249b856488
change_ps2util
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 May 2011 18:13:40 +0900 |
parents | cb6c6de125dc |
children | 0b65ca27f113 |
rev | line source |
---|---|
0 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <string.h> | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
4 #include <stdbool.h> |
91 | 5 #include "libps2.h" |
6 #include "ps2util.h" | |
0 | 7 #include "field.h" |
8 #include "car.h" | |
9 #include "gSprite.h" | |
10 #include "gFont.h" | |
11 #include "game.h" | |
12 #include "controler.h" | |
13 #include "camera.h" | |
91 | 14 #include "carNode.h" |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
15 //#include "light.h" |
0 | 16 #include "title_scene.h" |
17 #include "game_time.h" | |
45 | 18 #include "schedule.h" |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
19 #include "game.h" |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
20 |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
21 |
0 | 22 |
62 | 23 #ifdef LINDA |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
24 bool linda_update(int p, Game *game); |
62 | 25 #else |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
26 #define linda_update(change_state, game) true |
62 | 27 #endif |
0 | 28 |
88 | 29 #define MAXCAR 3 // 選択可能機体 |
30 #define MAXFIELD 2 // 選択可能コース | |
31 #define MAXRAP 3 // ラップ数 | |
0 | 32 #define SP_SEL_CAR 50 |
33 #define SP_SEL_COURSE 80 | |
4 | 34 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
35 |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
36 static void set_schedule(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
37 static void sche_game_init(Game *game); |
95 | 38 //static void sche_game_wait(Game *game); |
39 //static void sche_game_wait_ready(Game *game); | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
40 static void sche_game_opening(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
41 static void sche_game_select_car(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
42 static void sche_game_select_course(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
43 static void sche_game_ready(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
44 static void sche_game_main_init(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
45 static void sche_game_main_ready(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
46 static void sche_game_main(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
47 //static void sche_game_main_pause(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
48 static void sche_game_main_goal(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
49 static void sche_game_main_finish(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
50 static void sche_game_main_finish2(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
51 |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
52 |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
53 |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
54 |
20 | 55 /* timer */ |
56 static int start_time,time_count; | |
57 static int RUNNIG=0; | |
58 char raptime[10]; | |
0 | 59 |
60 static int ranking = 0; | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
61 //static LIGHT l; |
0 | 62 |
63 static int i=0; | |
64 | |
62 | 65 static void (*sche_func_assumption)(); |
66 static void (*sche_func)() = &sche_game_init; | |
58 | 67 static int change_state = 0; |
68 static void | |
69 set_schedule_assumption(void *_func) | |
11 | 70 { |
58 | 71 sche_func_assumption = _func; |
72 change_state = 1; | |
73 } | |
74 | |
75 static void | |
62 | 76 unset_schedule() |
77 { | |
78 change_state = 0; | |
79 } | |
80 | |
81 static void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
82 set_schedule(Game *game) |
58 | 83 { |
84 sche_func = sche_func_assumption; | |
85 change_state = 0; | |
11 | 86 } |
0 | 87 |
88 static void | |
2 | 89 graphic_init() |
0 | 90 { |
91 | 91 gSprite_Init(); // グラフィック関連の初期化 |
88 | 92 gFont_Init(); // フォント関連の初期化 |
0 | 93 } |
94 | |
95 static void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
96 play_init(Game *game) |
0 | 97 { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
98 game->jiki = car_init(game->car_id); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
99 carNode_append(game->jiki); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
100 field_init(game->course_id); |
0 | 101 } |
102 | |
103 static void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
104 game_env_init(Game *game) |
0 | 105 { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
106 game->car_id = 1; |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
107 game->course_id = 1; |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
108 game->camera_type = 0; |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
109 game->rap = 1; |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
110 game->jiki = NULL; |
0 | 111 |
112 ranking = 0; | |
113 | |
114 wait_init(); | |
95 | 115 |
0 | 116 } |
117 | |
118 | |
119 | |
2 | 120 void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
121 sche_game_init(Game *game) |
2 | 122 { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
123 game_env_init(game); |
2 | 124 graphic_init(); |
125 camera_init(); | |
8 | 126 |
46 | 127 #ifdef LINDA |
95 | 128 //sche_func = &sche_game_wait; |
129 //set_schedule_assumption(sche_game_wait); | |
46 | 130 #else |
58 | 131 set_schedule_assumption(sche_game_opening); |
46 | 132 #endif |
2 | 133 } |
134 | |
44 | 135 /** |
88 | 136 * 通信対戦専用 |
137 * 全ユーザが接続するまで待つ | |
95 | 138 * ・・・だったんだけど、現在 linda を切っているため worning が出る。 |
139 * ので cut する。 | |
44 | 140 */ |
95 | 141 /* |
44 | 142 static void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
143 sche_game_wait(Game *game) |
44 | 144 { |
145 gFont_SetString("WAITING...", 200, 100); | |
62 | 146 set_schedule_assumption(sche_game_wait_ready); |
44 | 147 } |
95 | 148 */ |
44 | 149 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
150 |
44 | 151 /** |
88 | 152 * 通信対戦専用 |
153 * 全ユーザの接続を確認したら呼び出す | |
95 | 154 * こいつも、linda がないので cut |
44 | 155 */ |
95 | 156 /* |
44 | 157 static void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
158 sche_game_wait_ready(Game *game) |
44 | 159 { |
160 gFont_SetString("CONNECT OK!!", 170, 300); | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
161 if (game->play_id == 1) { |
44 | 162 gFont_SetString(" PUSH START ", 170, 400); |
91 | 163 //if (pad.st != 1) { goto WAIT_READY; } |
44 | 164 } |
165 | |
62 | 166 set_schedule_assumption(sche_game_opening); |
44 | 167 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
168 //WAIT_READY: |
44 | 169 return; |
170 } | |
95 | 171 */ |
44 | 172 |
2 | 173 void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
174 sche_game_opening(Game *game) |
2 | 175 { |
176 static int blink_count = 0; | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
177 if (game->play_id==1){ |
2 | 178 if (blink_count < 35) { |
179 gFont_SetString("PUSH START !!", 170, 380); | |
180 } | |
20 | 181 blink_count = (blink_count > 70) ? 0 : blink_count + 1; |
44 | 182 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
183 // if (pad.st != 1) { goto OPENING; } |
2 | 184 } |
185 | |
62 | 186 |
58 | 187 set_schedule_assumption(sche_game_select_car); |
44 | 188 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
189 //OPENING: |
44 | 190 return; |
2 | 191 |
192 /* | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
193 if (game->play_id == 1) { |
2 | 194 if (title_scene() < 0){ |
195 } | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
196 } else if (game->play_id == 2) { |
2 | 197 if (i==0){ |
198 title_init_call(); | |
199 i=1; | |
200 } | |
201 } | |
202 */ | |
203 } | |
204 | |
205 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
206 sche_game_select_car(Game *game) |
2 | 207 { |
208 if (i==1){ | |
209 title_finish_call(); | |
210 i=2; | |
211 } | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
212 // gSprite_PutSpriteEx(SP_SEL_CAR+game->car_id, 190, 200, 1.5, 1.5); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
213 // gSprite_PutSprite(24, 460, 300); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
214 // gSprite_PutSprite(25, 120, 300); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
215 // gFont_SetString("SELECT CAR", 180, 50); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
216 /* |
2 | 217 if (pad.right == 1) { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
218 game->car_id = |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
219 (game->car_id > MAXCAR-1) ? 1 : game->car_id + 1 |
2 | 220 } |
221 if (pad.left == 1) { | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
222 game->car_id = |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
223 (game->car_id < 2) ? MAXCAR : game->car_id - 1 |
2 | 224 } |
44 | 225 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
226 if (game->play_id == 1) |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
227 if (pad.circle != 1) { goto SELECT_CAR; } |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
228 */ |
62 | 229 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
230 set_schedule_assumption(sche_game_select_course); |
44 | 231 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
232 //SELECT_CAR: |
44 | 233 return; |
2 | 234 } |
235 | |
236 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
237 sche_game_select_course(Game *game) |
2 | 238 { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
239 // gSprite_PutSpriteEx(SP_SEL_COURSE+game->course_id, 190, 200, 1.7, 1.8); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
240 // gSprite_PutSprite(24, 460, 300); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
241 // gSprite_PutSprite(25, 120, 300); |
2 | 242 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
243 // gFont_SetString("SELECT COURSE", 150, 50); |
44 | 244 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
245 if (game->play_id == 1) { |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
246 /* if (pad.right == 1) { |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
247 game->course_id = |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
248 (game->course_id > MAXFIELD-1) ? 1 : game->course_id + 1; |
44 | 249 goto SELECT_COURSE; |
250 } | |
251 if (pad.left == 1) { | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
252 game->course_id = |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
253 (game->course_id < 2) ? MAXFIELD : game->course_id - 1; |
44 | 254 goto SELECT_COURSE; |
255 } | |
46 | 256 |
257 if (pad.circle != 1) { goto SELECT_COURSE; } | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
258 */ |
2 | 259 } |
44 | 260 |
68 | 261 set_schedule_assumption(sche_game_ready); |
44 | 262 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
263 //SELECT_COURSE: |
44 | 264 return; |
265 | |
2 | 266 } |
267 | |
268 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
269 sche_game_ready(Game *game) |
2 | 270 { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
271 static int blink_count = 0;// |
2 | 272 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
273 gSprite_PutSprite(27+game->play_id,265,10); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
274 gSprite_PutSpriteEx(SP_SEL_CAR+game->car_id, 50, 120, 1.5, 1.5); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
275 gSprite_PutSpriteEx(SP_SEL_COURSE+game->course_id, 340, 120, 1.7, 1.8); |
2 | 276 |
88 | 277 /* 点滅 */ |
2 | 278 if (blink_count < 35) { |
279 gFont_SetString("GAME START !!", 170, 380); | |
280 } | |
281 blink_count = (blink_count > 70) ? 0 : blink_count + 1; | |
282 | |
62 | 283 set_schedule_assumption(sche_game_main_init); |
52 | 284 |
285 /* | |
286 if (pad.st == 1) { | |
58 | 287 set_schedule_assumption(sche_game_main_init); |
2 | 288 } |
289 if (pad.cross > 0) { | |
58 | 290 set_schedule_assumption(sche_game_select_car); |
2 | 291 } |
52 | 292 */ |
2 | 293 } |
294 | |
295 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
296 sche_game_main_init(Game *game) |
2 | 297 { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
298 if (!game->jiki) |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
299 play_init(game); |
2 | 300 RUNNIG=0; |
52 | 301 |
72 | 302 set_schedule_assumption(sche_game_main_ready); |
303 } | |
304 | |
305 static void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
306 sche_game_main_ready(Game *game) |
72 | 307 { |
75 | 308 gFont_SetString("Loading....", 180, 100); |
58 | 309 set_schedule_assumption(sche_game_main); |
2 | 310 } |
311 | |
72 | 312 static void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
313 sche_game_main(Game *game) |
2 | 314 { |
315 | |
316 /** begin: dispaly RAP TIME **/ | |
317 if(RUNNIG==0){ | |
318 start_time = game_time_get_msec(); | |
319 RUNNIG=1; | |
320 } | |
321 | |
322 time_count = game_time_get_msec() - start_time; | |
323 game_time_set_raptime(raptime,time_count); | |
324 gFont_SetString("TIME",300,20); | |
325 gFont_SetString(raptime,400,20); | |
326 /** end: dispaly RAP TIME **/ | |
327 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
328 // light_init(&l); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
329 // set_light(&l); |
2 | 330 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
331 car_update(game->jiki); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
332 field_update(game->jiki); |
91 | 333 camera_update(game,game->jiki->body->transfer); |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
334 // carNode_draw(); |
20 | 335 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
336 gFont_SetStringInt(game->rap, 50, 100); |
2 | 337 |
88 | 338 /* スピードメーター */ |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
339 gSprite_DefSprite(23, 1, 1,(int)(106.0*(game->jiki->speed/game->jiki->speed_max)), 34); |
2 | 340 gSprite_PutSprite(23, 400, 400); |
341 /* km/h */ | |
342 gSprite_PutSprite(26, 470, 350); | |
343 /* Rap */ | |
344 gSprite_PutSprite(27, 80, 100); | |
345 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
346 if (game->rap > MAXRAP) { |
2 | 347 ranking = 1; |
58 | 348 set_schedule_assumption(sche_game_main_goal); |
2 | 349 } |
350 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
351 gFont_SetStringInt((int)(100.0*game->jiki->speed), 380, 350); |
20 | 352 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
353 /* |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
354 if ((pad.right > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) { |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
355 car_swerve(game->jiki, 1); |
2 | 356 } |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
357 if ((pad.left > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) { |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
358 car_swerve(game->jiki, -1); |
2 | 359 } |
360 if (pad.circle > 0) { | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
361 car_accelerate(game->jiki, 1); |
2 | 362 } |
363 if (pad.cross > 0) { | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
364 car_accelerate(game->jiki, -1); |
2 | 365 } |
20 | 366 |
2 | 367 if (pad.r1 == 1) { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
368 game->camera_type = !game->camera_type; |
2 | 369 } |
370 if (pad.st == 1) { | |
58 | 371 set_schedule_assumption(sche_game_main_pause); |
2 | 372 } |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
373 */ |
2 | 374 } |
375 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
376 /* |
2 | 377 void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
378 sche_game_main_pause(Game *game) |
2 | 379 { |
26 | 380 static int select = 0; |
381 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
382 field_update(game->jiki); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
383 // carNode_draw(); |
2 | 384 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
385 if (game->play_id == 1) { |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
386 // 選択マーク |
26 | 387 gSprite_PutSprite(17, 100, 190+select*100); |
2 | 388 |
389 gFont_SetString("BACK TO GAME", 200, 200); | |
390 gFont_SetString("GO TO TITLE", 200, 300); | |
391 } else { | |
392 gFont_SetString("Pause ...", 200, 200); | |
393 } | |
394 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
395 |
2 | 396 if (pad.circle == 1) { |
26 | 397 if (select == 0) { |
58 | 398 set_schedule_assumption(sche_game_main); |
2 | 399 } else { |
58 | 400 set_schedule_assumption(sche_game_main_finish); |
2 | 401 } |
27 | 402 } else if (pad.st == 1) { |
58 | 403 set_schedule_assumption(sche_game_main); |
27 | 404 } else if (pad.up == 1 || pad.down == 1) { |
26 | 405 select = !select; |
2 | 406 } |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
407 |
2 | 408 } |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
409 */ |
2 | 410 |
411 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
412 sche_game_main_goal(Game *game) |
2 | 413 { |
414 /** dispaly TOTAL TIME **/ | |
415 game_time_set_raptime(raptime,time_count); | |
416 | |
417 gFont_SetString("TOTAL TIME",150,20); | |
418 gFont_SetString(raptime,400,20); | |
419 gFont_SetString("GOAL !!", 220, 150); | |
420 | |
421 #ifdef LINDA | |
422 if (ranking == 1) | |
423 gFont_SetString("You WIN!!", 200, 250); | |
424 else | |
425 gFont_SetString("You Lose...", 200, 250); | |
426 #endif | |
427 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
428 car_update(game->jiki); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
429 field_update(game->jiki); |
91 | 430 carNode_draw(); |
431 camera_update(game,game->jiki->body->transfer); | |
432 | |
433 if (true){//pad.st == 1) { | |
58 | 434 set_schedule_assumption(sche_game_main_finish); |
2 | 435 } |
91 | 436 |
2 | 437 } |
438 | |
439 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
440 sche_game_main_finish(Game *game) |
2 | 441 { |
30 | 442 field_destroy(); |
443 carNode_destroy(); | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
444 game_env_init(game); |
30 | 445 |
58 | 446 set_schedule_assumption(sche_game_main_finish2); |
30 | 447 } |
448 | |
449 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
450 sche_game_main_finish2(Game *game) |
30 | 451 { |
2 | 452 gFont_SetString("GAME OVER ...", 200, 200); |
453 | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
454 /* |
2 | 455 if (pad.st == 1) { |
58 | 456 set_schedule_assumption(sche_game_opening); |
2 | 457 } |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
458 */ |
2 | 459 } |
3 | 460 |
461 | |
462 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
463 schedule(Game *game) |
3 | 464 { |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
465 sche_func(game); |
3 | 466 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
467 if (linda_update(change_state, game) == true){ |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
468 set_schedule(game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
469 } |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
470 else{ |
62 | 471 unset_schedule(); |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
472 } |
58 | 473 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
474 // wait_sync(game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
475 // swap_dbuff(); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
476 // sjoy_poll(); |
3 | 477 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
478 // ps2util_sprite_Draw(); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
479 // gSprite_Draw_Reset(); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
480 // gFont_Draw_Reset(); |
3 | 481 } |