Mercurial > hg > old > magoroku_racing.bad
comparison Magoroku.cc @ 113:8c96cadde050
after game_team
author | Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 09 Jun 2011 18:07:46 +0900 |
parents | 5106d8d12ded |
children | 3ffda5b493c2 31dd5c07f7c1 |
comparison
equal
deleted
inserted
replaced
112:5106d8d12ded | 113:8c96cadde050 |
---|---|
1 //magoroku 関係ココから | |
1 #include "Magoroku.h" | 2 #include "Magoroku.h" |
2 #include "SgoexCerium.h" | 3 |
3 #include <stdio.h> | 4 #include <stdio.h> |
4 #include <stdlib.h> | 5 #include <stdlib.h> |
5 #include <string.h> | 6 #include <string.h> |
7 #include <stdbool.h> | |
8 #include "libps2.h" | |
9 #include "ps2util.h" | |
10 #include "field.h" | |
11 #include "car.h" | |
12 #include "gSprite.h" | |
13 #include "gFont.h" | |
14 #include "game.h" | |
15 #include "controler.h" | |
16 #include "camera.h" | |
17 #include "carNode.h" | |
18 #include "car.h" | |
19 #include "light.h" | |
20 #include "title_scene.h" | |
21 #include "game_time.h" | |
22 #include "schedule.h" | |
23 #include "game.h" | |
24 | |
25 #include "mytype.h" | |
26 #include "linda.h" | |
27 | |
28 #include "sjoy.h" | |
29 //magoroku 関係ココまで | |
30 | |
31 #include "SgoexCerium.h" | |
6 #include <ctype.h> | 32 #include <ctype.h> |
7 #include <math.h> | 33 #include <math.h> |
8 #include <time.h> | 34 #include <time.h> |
9 #include <SDL.h> | 35 #include <SDL.h> |
10 #include "SDL_opengl.h" | 36 #include "SDL_opengl.h" |
11 | 37 |
12 //#include "object.h" | 38 //#include "tree_controll.h" |
13 #include "libps2.h" | |
14 | |
15 #include "tree_controll.h" | |
16 #include "xml.h" | 39 #include "xml.h" |
17 #include "profile.h" | 40 #include "profile.h" |
18 #include "syokika.h" | 41 //#include "syokika.h" |
19 #include "sankaku.h" | 42 //#include "sankaku.h" |
20 | |
21 //#include "sgoex.h" | |
22 #include "controler.h" | |
23 | 43 |
24 #include "sound.h" | 44 #include "sound.h" |
25 #include <stdbool.h> | 45 //#include "bom.h" |
26 #include "bom.h" | 46 //#include "count2.h" |
27 #include "count2.h" | 47 //#include "tokuten.h" |
28 #include "tokuten.h" | 48 //#include "tama.h" |
29 #include "schedule.h" | 49 //#include "debug.h" |
30 #include "tama.h" | 50 //#include "trace.h" |
31 #include "debug.h" | |
32 #include "trace.h" | |
33 #include "LoadSprite.h" | 51 #include "LoadSprite.h" |
34 #include <SDL_mixer.h> | 52 #include <SDL_mixer.h> |
35 #include "error.h" | 53 #include "error.h" |
36 #include "matrix_calc.h" | 54 #include "matrix_calc.h" |
37 | 55 |
38 #include "Character.h" | 56 //#include "Character.h" |
39 #include "Character_state.h" | 57 //#include "Character_state.h" |
40 | 58 |
41 static int use_keybord = 0; | 59 |
42 // static int cdp[20] = { 16, 16, 16, 17, 18, 0 }; | |
43 static int i; | |
44 | |
45 static int rswait = 0; | |
46 static int cf = 0; | |
47 static int cc = 0; | |
48 | |
49 static int test_mode = 0; | |
50 static const char *test_object = "" ; | |
51 | 60 |
52 //static SDL_Surface *screen; | 61 //static SDL_Surface *screen; |
53 // static Uint32 background; | 62 // static Uint32 background; |
54 // static char *pad_trace_file; | 63 // static char *pad_trace_file; |
55 | 64 |
56 extern void schedule(); | 65 extern void schedule(); |
57 extern void tokuten(); | 66 extern void tokuten(); |
58 extern void padCheck(); | 67 extern bool padCheck(SDL_Joystick *joy); |
59 extern void keybord(); | 68 extern bool keybord(void); |
60 static int gamesyokika(int gamef); | 69 static int gamesyokika(int gamef); |
61 static int game_pause(int); | 70 static int game_pause(int); |
62 //static char *pad_trace_file; | 71 //static char *pad_trace_file; |
63 | 72 |
64 /** | 73 /** |
100 application() { | 109 application() { |
101 return new Magoroku(); | 110 return new Magoroku(); |
102 } | 111 } |
103 | 112 |
104 | 113 |
105 static int opening(int gamef); | 114 //Magoroku の初期化など |
106 static int dandy_closing(int gamef); | 115 /* timer */ |
107 static int dandy_main_loop(int gamef); | 116 static int start_time,time_count; |
108 static int dandy_main_init(int gamef); | 117 static int RUNNIG=0; |
118 char raptime[10]; | |
119 | |
120 static int ranking = 0; | |
121 static LIGHT l; | |
122 static int i=0; | |
123 | |
124 // schedule.ccで使用してる | |
125 void linda_env_init( void ); | |
126 | |
127 | |
128 //Magoroku の処理 | |
129 static void set_schedule(Game *game); | |
130 static void sche_game_init(Game *game); | |
131 static void sche_game_opening(Game *game); | |
132 static void sche_game_select_car(Game *game); | |
133 static void sche_game_select_course(Game *game); | |
134 static void sche_game_ready(Game *game); | |
135 static void sche_game_main_init(Game *game); | |
136 static void sche_game_main_ready(Game *game); | |
137 static void sche_game_main(Game *game); | |
138 static void sche_game_main_pause(Game *game); | |
139 static void sche_game_main_goal(Game *game); | |
140 static void sche_game_main_finish(Game *game); | |
141 static void sche_game_main_finish2(Game *game); | |
142 | |
143 | |
109 extern int init(TaskManager *manager, int argc, char *argv[]); | 144 extern int init(TaskManager *manager, int argc, char *argv[]); |
110 extern void task_initialize(); | 145 extern void task_initialize(); |
111 static void TMend(TaskManager *manager); | 146 static void TMend(TaskManager *manager); |
147 | |
112 | 148 |
113 //class Application の中の virtual bool app_loop( return 1 だけの関数?) を継承 | 149 //class Application の中の virtual bool app_loop( return 1 だけの関数?) を継承 |
114 bool | 150 bool |
115 Magoroku::app_loop(Viewer *viewer){ | 151 Magoroku::app_loop(Viewer *viewer){ |
116 // don't use allExecute | 152 // don't use allExecute |
117 return 0; | 153 return 0; |
118 }; | 154 }; |
119 | 155 |
120 //ゲームの分岐に使用 | 156 //ゲームの分岐に使用(コールバック) |
121 static int gamef = 0; | 157 //static int gamef = 0; |
158 static void (*sche_func_assumption)(Game*); | |
159 static void (*sche_func)(Game*) = &sche_game_init; | |
160 static int change_state = 0; | |
122 | 161 |
123 /* | 162 /* |
124 ゲームの分岐。magoroku の schedule の処理と同等と考えてオッケーかな? | 163 ゲームの分岐。magoroku の schedule の処理と同等と考えてオッケーかな? |
125 */ | 164 */ |
126 HTaskPtr | 165 HTaskPtr |
127 Magoroku::application_task(HTaskPtr next, Viewer* viewer){ | 166 Magoroku::application_task(HTaskPtr next, Viewer* viewer){ |
128 // printf("gamef = %d\n",gamef); | 167 // printf("gamef = %d\n",gamef); |
129 switch (gamef) { | 168 schedule(&game); |
130 case 0: gamef= dandy_main_init(gamef); break; | |
131 case 1: gamef= gamesyokika(gamef); break; | |
132 case 2: gamef= opening(gamef); break; | |
133 case 3: gamef= dandy_main_loop(gamef); break; | |
134 case 4: gamef= dandy_closing(gamef); break; | |
135 } | |
136 return next; | 169 return next; |
137 }; | 170 }; |
138 | 171 |
139 | 172 |
140 | 173 |
190 } | 223 } |
191 } | 224 } |
192 */ | 225 */ |
193 | 226 |
194 | 227 |
195 /* | 228 |
196 初期化の処理 | 229 |
197 初期化成功で return 1 だから、次の処理にいくっぽい | 230 static void |
231 set_schedule(Game *game) | |
232 { | |
233 sche_func = sche_func_assumption; | |
234 change_state = 0; | |
235 } | |
236 | |
237 static void | |
238 graphic_init() | |
239 { | |
240 gSprite_Init(); // グラフィック関連の初期化 | |
241 gFont_Init(); // フォント関連の初期化 | |
242 } | |
243 | |
244 static void | |
245 play_init( Game *game ) | |
246 { | |
247 game->jiki = car_init(game->car_id); | |
248 carNode_append(game->jiki); | |
249 field_init(game->course_id); | |
250 } | |
251 | |
252 // 適当に自作 :miya | |
253 void linda_env_init( void ) | |
254 { | |
255 printf("linda_env_init\n"); | |
256 } | |
257 | |
258 static void game_env_init ( Game *game ) | |
259 { | |
260 game->car_id = 1; | |
261 game->course_id = 1; | |
262 game->camera_type = 0; | |
263 game->rap = 1; | |
264 game->jiki = NULL; | |
265 | |
266 ranking = 0; | |
267 | |
268 wait_init(); | |
269 linda_env_init(); | |
270 } | |
271 | |
272 | |
273 | |
274 void | |
275 sche_game_init(Game *game) | |
276 { | |
277 game_env_init(game); | |
278 graphic_init(); | |
279 camera_init(); | |
280 | |
281 #ifdef LINDA | |
282 //sche_func = &sche_game_wait; | |
283 //set_schedule_assumption(sche_game_wait); | |
284 #else | |
285 set_schedule_assumption(sche_game_opening); | |
286 #endif | |
287 } | |
288 | |
289 /** | |
290 * 通信対戦専用 | |
291 * 全ユーザが接続するまで待つ | |
292 * ・・・だったんだけど、現在 linda を切っているため worning が出る。 | |
293 * ので cut する。 | |
294 */ | |
295 | |
296 /* linda を使用しないのでカットした | |
297 static void | |
298 sche_game_wait(Game *game) | |
299 { | |
300 gFont_SetString("WAITING...", 200, 100); | |
301 set_schedule_assumption(sche_game_wait_ready); | |
302 } | |
198 */ | 303 */ |
199 static int | 304 |
200 dandy_main_init(int gamef) | 305 |
201 { | 306 /** |
202 //Timeprof timeprof_move; | 307 * 通信対戦専用 |
203 //timeprof_move = timeprof_new(); | 308 * 全ユーザの接続を確認したら呼び出す |
204 dbg_init("/dev/stdout"); | 309 * こいつも、linda がないので cut |
205 | 310 */ |
206 /** | 311 /* |
207 * timeprof があるんだけどね | 312 static void |
208 */ | 313 sche_game_wait_ready(Game *game) |
209 //xml file 読み込む | 314 { |
210 droot->createFromXMLfile("xml/character.xml"); | 315 gFont_SetString("CONNECT OK!!", 170, 300); |
211 droot->createFromXMLfile("xml/font.xml"); | 316 if (game->play_id == 1) { |
212 droot->createFromXMLfile("xml/effect.xml"); | 317 gFont_SetString(" PUSH START ", 170, 400); |
213 droot->createFromXMLfile("xml/boss.xml"); | 318 if (pad.st != 1) { goto WAIT_READY; } |
214 | 319 } |
215 LightSysSwitch(droot); | 320 |
216 | 321 set_schedule_assumption(sche_game_opening); |
217 | 322 |
218 init_sprite(0,0,0,0); | 323 WAIT_READY: |
219 | 324 return; |
220 __debug("syokikaが呼びだされました\n"); | 325 } |
221 joy=SDL_JoystickOpen(0); | 326 */ |
222 if(!joy) { | 327 |
223 fprintf(stderr,"failed to open joystick 0\n"); | 328 |
224 use_keybord = 1; | 329 void |
225 } | 330 sche_game_opening(Game *game) |
226 | 331 { |
227 /** | 332 static int blink_count = 0; |
228 * sound.c に移しました | 333 if (game->play_id==1){ |
229 * 代わりに InitSdlMixer(void); を使います。 | 334 if (blink_count < 35) { |
230 * まあ中身一緒なんだけどね | 335 gFont_SetString("PUSH START !!", 170, 380); |
231 */ | 336 } |
232 /** | 337 blink_count = (blink_count > 70) ? 0 : blink_count + 1; |
233 if (Mix_OpenAudio(MIX_DEFAULT_FREQUENCY,MIX_DEFAULT_FORMAT,2,1024) < 0) { | 338 |
234 fprintf(stderr,"failed to initialize SDL_mixer.\n"); | 339 if (pad.st != 1) { goto OPENING; } |
235 SDL_Quit(); | 340 } |
236 exit(-1); | 341 |
237 } | 342 |
238 */ | 343 set_schedule_assumption(sche_game_select_car); |
239 | 344 |
240 // SDL_mixer とかいろいろ初期化 | 345 OPENING: |
241 // もし Init に失敗したら | 346 return; |
242 // 以後の Mixer 関連の関数を呼び出しても | 347 |
243 // 中では何も行われないとかいう小細工を入れました。 | 348 |
244 InitSdlMixer(); | 349 if (game->play_id == 1) { |
245 | 350 if (title_scene() < 0){ |
246 // 音楽ファイルの読み込み | 351 } |
247 LoadSdlMixer(); | 352 } else if (game->play_id == 2) { |
248 | 353 if (i==0){ |
249 // ボリューム調整 | 354 title_init_call(); |
250 InitVolume(); | 355 i=1; |
356 } | |
357 } | |
358 | |
359 | |
360 } | |
361 | |
362 void | |
363 sche_game_select_car(Game *game) | |
364 { | |
365 if (i==1){ | |
366 title_finish_call(); | |
367 i=2; | |
368 } | |
369 gSprite_PutSpriteEx(SP_SEL_CAR+game->car_id, 190, 200, 1.5, 1.5); | |
370 gSprite_PutSprite(24, 460, 300); | |
371 gSprite_PutSprite(25, 120, 300); | |
372 gFont_SetString("SELECT CAR", 180, 50); | |
373 | |
374 if (pad.right == 1) { | |
375 game->car_id = | |
376 (game->car_id > MAXCAR-1) ? 1 : game->car_id + 1; | |
377 } | |
378 if (pad.left == 1) { | |
379 game->car_id = | |
380 (game->car_id < 2) ? MAXCAR : game->car_id - 1; | |
381 } | |
382 | |
383 if (game->play_id == 1) | |
384 if (pad.circle != 1) { goto SELECT_CAR; } | |
385 | |
386 | |
387 set_schedule_assumption(sche_game_select_course); | |
388 | |
389 SELECT_CAR: | |
390 return; | |
391 } | |
392 | |
393 void | |
394 sche_game_select_course(Game *game) | |
395 { | |
396 gSprite_PutSpriteEx(SP_SEL_COURSE+game->course_id, 190, 200, 1.7, 1.8); | |
397 gSprite_PutSprite(24, 460, 300); | |
398 gSprite_PutSprite(25, 120, 300); | |
399 | |
400 gFont_SetString("SELECT COURSE", 150, 50); | |
401 | |
402 if (game->play_id == 1) { | |
403 if (pad.right == 1) { | |
404 game->course_id = | |
405 (game->course_id > MAXFIELD-1) ? 1 : game->course_id + 1; | |
406 goto SELECT_COURSE; | |
407 } | |
408 if (pad.left == 1) { | |
409 game->course_id = | |
410 (game->course_id < 2) ? MAXFIELD : game->course_id - 1; | |
411 goto SELECT_COURSE; | |
412 } | |
413 | |
414 if (pad.circle != 1) { goto SELECT_COURSE; } | |
415 } | |
416 | |
417 set_schedule_assumption(sche_game_ready); | |
418 | |
419 SELECT_COURSE: | |
420 return; | |
421 | |
422 } | |
423 | |
424 void | |
425 sche_game_ready(Game *game) | |
426 { | |
427 static int blink_count = 0;// | |
428 | |
429 gSprite_PutSprite(27+game->play_id,265,10); | |
430 gSprite_PutSpriteEx(SP_SEL_CAR+game->car_id, 50, 120, 1.5, 1.5); | |
431 gSprite_PutSpriteEx(SP_SEL_COURSE+game->course_id, 340, 120, 1.7, 1.8); | |
251 | 432 |
252 // 音出しテスト | 433 /* 点滅 */ |
253 PlaySdlMixer(-1, BGM); | 434 if (blink_count < 35) { |
254 | 435 gFont_SetString("GAME START !!", 170, 380); |
255 if(!(init_chara_list(1024))){ | 436 } |
256 __debug("failed to init_chara_list\n"); | 437 blink_count = (blink_count > 70) ? 0 : blink_count + 1; |
257 } | 438 |
258 | 439 set_schedule_assumption(sche_game_main_init); |
259 __debug("finished init_chara_list\n"); | 440 |
260 | 441 |
261 return 1; | 442 if (pad.st == 1) { |
262 } | 443 set_schedule_assumption(sche_game_main_init); |
263 | 444 } |
264 | 445 if (pad.cross > 0) { |
265 //メインループ | 446 set_schedule_assumption(sche_game_select_car); |
266 static int | 447 } |
267 dandy_main_loop(int gamef) | 448 |
268 { | 449 } |
450 | |
451 void | |
452 sche_game_main_init(Game *game) | |
453 { | |
454 if (!game->jiki) | |
455 play_init(game); | |
456 RUNNIG=0; | |
457 | |
458 set_schedule_assumption(sche_game_main_ready); | |
459 } | |
460 | |
461 static void | |
462 sche_game_main_ready(Game *game) | |
463 { | |
464 gFont_SetString("Loading....", 180, 100); | |
465 set_schedule_assumption(sche_game_main); | |
466 } | |
467 | |
468 static void | |
469 sche_game_main(Game *game) | |
470 { | |
471 //flip | |
472 | |
473 /** begin: dispaly RAP TIME **/ | |
474 if(RUNNIG==0){ | |
475 start_time = game_time_get_msec(); | |
476 RUNNIG=1; | |
477 } | |
478 | |
479 time_count = game_time_get_msec() - start_time; | |
480 game_time_set_raptime(raptime,time_count); | |
481 gFont_SetString("TIME",300,20); | |
482 gFont_SetString(raptime,400,20); | |
483 /** end: dispaly RAP TIME **/ | |
484 | |
485 // light_init と init_lightの書き間違え? | |
486 init_light(&l); | |
487 set_light(&l); | |
488 | |
489 car_id_update(game, game->jiki); | |
490 | |
491 field_update(game->jiki); | |
492 camera_update(game,game->jiki->body->transfer); | |
493 carNode_draw(); | |
494 | |
495 gFont_SetStringInt(game->rap, 50, 100); | |
496 | |
497 /* スピードメーター */ | |
498 gSprite_DefSprite(23, 1, 1,(int)(106.0*(game->jiki->speed/game->jiki->speed_max)), 34); | |
499 gSprite_PutSprite(23, 400, 400); | |
500 /* km/h */ | |
501 gSprite_PutSprite(26, 470, 350); | |
502 /* Rap */ | |
503 gSprite_PutSprite(27, 80, 100); | |
504 | |
505 if (game->rap > MAXRAP) { | |
506 ranking = 1; | |
507 set_schedule_assumption(sche_game_main_goal); | |
508 } | |
509 | |
510 gFont_SetStringInt((int)(100.0*game->jiki->speed), 380, 350); | |
511 | |
512 | |
513 if ((pad.right > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) { | |
514 car_swerve(game->jiki, 1); | |
515 } | |
516 if ((pad.left > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) { | |
517 car_swerve(game->jiki, -1); | |
518 } | |
519 if (pad.circle > 0) { | |
520 car_accelerate(game->jiki, 1); | |
521 } | |
522 if (pad.cross > 0) { | |
523 car_accelerate(game->jiki, -1); | |
524 } | |
525 | |
526 if (pad.r1 == 1) { | |
527 game->camera_type = !game->camera_type; | |
528 } | |
529 if (pad.st == 1) { | |
530 set_schedule_assumption(sche_game_main_pause); | |
531 } | |
532 | |
533 //S-dandy の obj てきな | |
534 } | |
535 | |
536 | |
537 void | |
538 sche_game_main_pause(Game *game) | |
539 { | |
540 static int select = 0; | |
541 | |
542 field_update(game->jiki); | |
543 carNode_draw(); | |
544 | |
545 if (game->play_id == 1) { | |
546 // 選択マーク | |
547 gSprite_PutSprite(17, 100, 190+select*100); | |
269 | 548 |
270 | 549 gFont_SetString("BACK TO GAME", 200, 200); |
271 if ((pad.l1 != 0) && (pad.r1 != 0) && | 550 gFont_SetString("GO TO TITLE", 200, 300); |
272 (pad.l2 != 0) && (pad.r2 != 0)) { | 551 } else { |
273 gamef = gamesyokika(gamef); | 552 gFont_SetString("Pause ...", 200, 200); |
274 } | 553 } |
275 | 554 |
276 if (pad.se != 0) { | 555 |
277 gamef = 4; | 556 if (pad.circle == 1) { |
278 } | 557 if (select == 0) { |
279 flip(); | 558 set_schedule_assumption(sche_game_main); |
280 | |
281 //SDL_FillRect(screen, NULL, background); | |
282 | |
283 schedule(); | |
284 enemyfaste = count; | |
285 | |
286 // timeprof_begin(timeprof_move); | |
287 //Move(); //enemy move | |
288 collision_detect(); | |
289 outofwindow(); | |
290 // timeprof_end(timeprof_move); | |
291 state_update(); | |
292 asteroidi = 0; | |
293 //charpatern(); | |
294 //bosguage(); | |
295 | |
296 if (jiki.bf == true) { | |
297 Player(0); | |
298 count++; | |
299 PutSprite(count, jiki.x, jiki.y, jiki.ch); | |
300 } | |
301 | |
302 Putbom(); | |
303 tokuten(); | |
304 | |
305 count++; | |
306 //PutSprite(count, 0, 960 - 96, 10); | |
307 /*インフレゲージ */ | |
308 count++; | |
309 //PutSprite(count, 0, 0, 48); | |
310 | |
311 obj_draw(); | |
312 gamef = game_pause(gamef); | |
313 | |
314 if (use_keybord) { | |
315 keybord(); | |
316 } else { | |
317 padCheck(joy); | |
318 } | |
319 filpcount++; | |
320 count = 0; | |
321 | |
322 return gamef; | |
323 } | |
324 | |
325 static int | |
326 dandy_closing(int gamef) | |
327 { | |
328 | |
329 //_______________________________________________ | |
330 // SDL_mixerの後始末 | |
331 Mix_CloseAudio(); | |
332 Mix_HaltMusic(); | |
333 FreeSdlMixer() ; | |
334 //_______________________________________________ | |
335 return 0; | |
336 } | |
337 | |
338 | |
339 static int | |
340 gamesyokika(int gamef) | |
341 { | |
342 laser_lv3[0].r = 62; | |
343 laser_lv3[0].r = 62; | |
344 for (i = 0; i < 3; i++) { | |
345 tlv3[i].y = -1; | |
346 } | |
347 filpcount = 0; | |
348 stage = 0; | |
349 //for (i = 0; i < 300; i++) | |
350 //enemy[i].f = false; | |
351 jiki.zanki = 3; | |
352 jiki.x = 60; | |
353 jiki.y = 200; | |
354 jiki.ch = 3; | |
355 jiki.point = 0; | |
356 jiki.bf = false; | |
357 jiki.muteki = 120; | |
358 enemycount = 0; | |
359 lg.stg = 4096; | |
360 pg.stg = 4096; | |
361 infg.stg = 0; | |
362 infg_level = 0; | |
363 //kyeenemyno = -1; | |
364 fastebos = 0; | |
365 jiki.ccount = 99; | |
366 p_extend = 200000; | |
367 pad.up=0; | |
368 pad.down=0; | |
369 pad.right=0; | |
370 pad.left=0; | |
371 pad.st=0; | |
372 pad.se=0; | |
373 | |
374 SoundStop(); | |
375 SoundPlay(7); | |
376 gamef = 2; | |
377 flip(); | |
378 return gamef; | |
379 } | |
380 | |
381 static int | |
382 opening(int gamef) | |
383 { | |
384 if(use_keybord == 1) { | |
385 keybord(); | |
386 } else { | 559 } else { |
387 padCheck(joy); | 560 set_schedule_assumption(sche_game_main_finish); |
388 } | 561 } |
389 | 562 } else if (pad.st == 1) { |
390 count = 1; | 563 set_schedule_assumption(sche_game_main); |
391 | 564 } else if (pad.up == 1 || pad.down == 1) { |
392 PutSprite(count, 700, 480, 53); // put `push start' string on screen. | 565 select = !select; |
393 count++; | 566 } |
394 PutSprite(count, 224, 776, 119); // put `super dandy' | 567 |
395 count++; | 568 } |
396 // PutSprite(count, 200, 64, 190); | 569 |
397 // PutSpriteEx(count, 8192, 8192, 0); | 570 |
398 PutSpriteEx(190, 800, 264, 2, 2, 5); | 571 void |
399 count++; | 572 sche_game_main_goal(Game *game) |
400 PutSprite(count, 396, 432, 191); | 573 { |
401 //PutSpriteEx(count, 8192, 8192, 0); | 574 /** dispaly TOTAL TIME **/ |
402 count++; | 575 game_time_set_raptime(raptime,time_count); |
403 PutSprite(count, 640, 640, 192); | 576 |
404 //PutSpriteEx(count, 8192, 8192, 0); | 577 gFont_SetString("TOTAL TIME",150,20); |
405 | 578 gFont_SetString(raptime,400,20); |
406 if (pad.st > 1) { | 579 gFont_SetString("GOAL !!", 220, 150); |
407 jiki.bf = true; | 580 |
408 | 581 #ifdef LINDA |
409 //CdPlay(1,&cdp[0],0); | 582 if (ranking == 1) |
410 SoundStop(); | 583 gFont_SetString("You WIN!!", 200, 250); |
411 SoundPlay(0); | 584 else |
412 | 585 gFont_SetString("You Lose...", 200, 250); |
413 gamef = 3; | 586 #endif |
414 pad.st = 1; | 587 |
415 } else if ((pad.se > 0) && (pad.st > 0)) { | 588 |
416 gamef = 2; | 589 // 宣言では引数が二つだったから、第一引数に game を入れてみた |
417 } | 590 car_update(game, game->jiki); |
418 flip(); | 591 field_update(game->jiki); |
419 return gamef; | 592 carNode_draw(); |
420 } | 593 camera_update(game,game->jiki->body->transfer); |
421 | 594 |
422 static int | 595 if (pad.st == 1) { |
423 game_pause(int gamef) | 596 set_schedule_assumption(sche_game_main_finish); |
424 { | 597 } |
425 gamef = 3; | 598 |
426 if (jiki.zanki != 0 && jiki.bf != false) { | 599 } |
427 if (pad.se == 1) { | 600 |
428 //Mix_Pause(BGM); | 601 void |
429 PauseSdlMixer(BGM); | 602 sche_game_main_finish(Game *game) |
430 while(1){ | 603 { |
431 if(use_keybord == 1) { | 604 field_destroy(); |
432 keybord(); | 605 carNode_destroy(); |
433 } else { | 606 game_env_init(game); |
434 padCheck(joy); | 607 |
435 } | 608 set_schedule_assumption(sche_game_main_finish2); |
436 if(pad.st == 0) | 609 } |
437 continue; | 610 |
438 pad.up=0; | 611 void |
439 pad.down=0; | 612 sche_game_main_finish2(Game *game) |
440 pad.right=0; | 613 { |
441 pad.left=0; | 614 gFont_SetString("GAME OVER ...", 200, 200); |
442 pad.se=0; | 615 |
443 pad.st=0; | 616 |
444 //Mix_Resume(BGM); | 617 if (pad.st == 1) { |
445 ResumeSdlMixer(BGM); | 618 set_schedule_assumption(sche_game_opening); |
446 break; | 619 } |
447 } | 620 |
448 } | 621 } |
449 } | |
450 if (jiki.zanki == 0) { | |
451 // RECT *recp; | |
452 if ((jiki.ccount > 0) && (cf == 0)) { | |
453 cf = 1; | |
454 count++; | |
455 //cgcg(2); | |
456 PutSprite(count, 480, 480, 110); | |
457 count++; | |
458 //cgcg(1); | |
459 } | |
460 if ((jiki.ccount > 0) && (cf == 1)) { | |
461 //スタートを押すまでココで止まり続けるから、これは最初のスタート画面か? | |
462 while (1) { | |
463 if (pad.st > 0) { | |
464 cf = 0; | |
465 jiki.ccount--; | |
466 jiki.zanki = 3; | |
467 enemycount++; | |
468 cc = 0; | |
469 for (i = 0; i < 4; i++) { | |
470 clear_result[i] = 0; | |
471 } | |
472 goto f; | |
473 } | |
474 cc++; | |
475 if (29 - cc / 60 < 20) { | |
476 cc = 0; | |
477 cf = 3; | |
478 break; | |
479 } | |
480 SDL_Delay(100); | |
481 PutSprite(1, 640, 640, 29 - CC / 60); | |
482 // PutSpriteEx(1, 409 * ((cc % 60) + 1), 409 * ((cc % 60) + 1), 0); | |
483 | |
484 padCheck(joy); | |
485 flip(); // THIS IS NOT CORRECT | |
486 } | |
487 } | |
488 IF (rswait > 60 * 6) { | |
489 cf = 0; | |
490 rswait = 0; | |
491 gamef = gamesyokika(gamef); | |
492 } | |
493 rswait++; | |
494 count++; | |
495 //cgcg(1); | |
496 PutSprite(1, 480, 480, 19); | |
497 return gamef; | |
498 } | |
499 if (jiki.bf == false) { | |
500 f: | |
501 if (rswait < 80) { | |
502 rswait++; | |
503 return gamef; | |
504 } else { | |
505 rswait = 0; | |
506 jiki.x = 60; | |
507 jiki.y = 200; | |
508 jiki.bf = true; | |
509 | |
510 pad.st = 0; | |
511 lg.stg = 4096; | |
512 pg.stg = 4096; | |
513 laser_lv3[0].r = 62; | |
514 tlv3[0].r = 0; | |
515 tlv3[0].y = -1; | |
516 return gamef; | |
517 // sb_size = -1; | |
518 } | |
519 } | |
520 return gamef; | |
521 } | |
522 | |
523 | |
524 | |
525 /* end */ |