Mercurial > hg > Members > koba > t_dandy
comparison TaskDandy.cc @ 48:6cfd912a602d
fix trace.*
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 20 Jan 2011 18:51:54 +0900 |
parents | f5e112bffe26 |
children |
comparison
equal
deleted
inserted
replaced
47:f5e112bffe26 | 48:6cfd912a602d |
---|---|
34 | 34 |
35 static int use_keybord = 0; | 35 static int use_keybord = 0; |
36 //static int cdp[20] = { 16, 16, 16, 17, 18, 0 }; | 36 //static int cdp[20] = { 16, 16, 16, 17, 18, 0 }; |
37 static int i; | 37 static int i; |
38 | 38 |
39 static int gamef = 0; | |
39 static int rswait = 0; | 40 static int rswait = 0; |
40 static int cf = 0; | 41 static int cf = 0; |
41 static int cc = 0; | 42 static int cc = 0; |
42 | |
43 //static SDL_Surface *screen; | |
44 // static Uint32 background; | |
45 // static char *pad_trace_file; | |
46 | 43 |
47 extern void schedule(); | 44 extern void schedule(); |
48 extern void tokuten(); | 45 extern void tokuten(); |
49 extern void Pad(); | 46 extern void Pad(); |
50 extern void keybord(); | 47 extern void keybord(); |
82 | 79 |
83 TaskManager *tmanager; | 80 TaskManager *tmanager; |
84 | 81 |
85 static int screen_w; | 82 static int screen_w; |
86 static int screen_h; | 83 static int screen_h; |
87 static int gamef; | |
88 | 84 |
89 MainLoopPtr | 85 MainLoopPtr |
90 Dandy::init(Viewer *sgroot_, int w, int h) | 86 Dandy::init(Viewer *sgroot_, int w, int h) |
91 { | 87 { |
92 screen_w = w; | 88 screen_w = w; |
116 Dandy::app_loop(Viewer *viewer){ | 112 Dandy::app_loop(Viewer *viewer){ |
117 // don't use allExecute | 113 // don't use allExecute |
118 return 0; | 114 return 0; |
119 }; | 115 }; |
120 | 116 |
121 | |
122 HTaskPtr | 117 HTaskPtr |
123 Dandy::application_task(HTaskPtr next, Viewer* viewer){ | 118 Dandy::application_task(HTaskPtr next, Viewer* viewer){ |
124 // printf("gamef = %d\n",gamef); | |
125 switch (gamef) { | 119 switch (gamef) { |
126 case 0: gamef= dandy_main_init(gamef); break; | 120 case 0: gamef= dandy_main_init(gamef); break; |
127 case 1: gamef= gamesyokika(gamef); break; | 121 case 1: gamef= gamesyokika(gamef); break; |
128 case 2: gamef= opening(gamef); break; | 122 case 2: gamef= opening(gamef); break; |
129 case 3: gamef= dandy_main_loop(gamef); break; | 123 case 3: gamef= dandy_main_loop(gamef); break; |
149 TMend(TaskManager *manager) | 143 TMend(TaskManager *manager) |
150 { | 144 { |
151 printf("game end\n"); | 145 printf("game end\n"); |
152 } | 146 } |
153 | 147 |
154 static int light_sysswitch = 1; | 148 static int light_sysswitch = 0; |
155 static int light_num = 4; | 149 static int light_num = 4; |
156 | 150 |
157 static void | 151 static void |
158 _LightSysSwitch(Viewer *sgroot) { | 152 _LightSysSwitch(Viewer *sgroot) { |
159 if (light_sysswitch == 1) { | 153 if (light_sysswitch == 1) { |
160 sgroot->OffLightSysSwitch(); | 154 sgroot->OnLightSysSwitch(); |
161 for (int i = 0; i < light_num; i++) { | 155 for (int i = 0; i < light_num; i++) { |
162 SceneGraphPtr light = sgroot->getLight(i); | 156 SceneGraphPtr light = sgroot->getLight(i); |
163 sgroot->OnLightSwitch(i); | 157 sgroot->OnLightSwitch(i); |
164 light->xyz[0] = screen_w / 2; | 158 light->xyz[0] = screen_w / 2; |
165 light->xyz[1] = screen_h / 2; | 159 light->xyz[1] = screen_h / 2; |
172 | 166 |
173 | 167 |
174 static void | 168 static void |
175 print_usage() | 169 print_usage() |
176 { | 170 { |
177 printf("usage: exe_file [-h|-help|--help][-capture filename][-trace filename]\n"); | 171 printf("usage: ./exe_file [-h|-help|--help][-capture filename][-trace filename]\n"); |
178 } | 172 } |
179 | 173 |
180 | 174 |
181 static int | 175 static int |
182 get_option(int argc, char *argv[]) | 176 get_option(int argc, char *argv[]) |
234 } else if(runmode == 2) { | 228 } else if(runmode == 2) { |
235 PadfileRead(t_buff); | 229 PadfileRead(t_buff); |
236 } | 230 } |
237 first = t_buff; | 231 first = t_buff; |
238 } | 232 } |
239 | 233 |
240 sgroot->createFromXMLfile("xml/character.xml"); | 234 sgroot->createFromXMLfile("xml/character.xml"); |
241 sgroot->createFromXMLfile("xml/font.xml"); | 235 sgroot->createFromXMLfile("xml/font.xml"); |
242 sgroot->createFromXMLfile("xml/effect.xml"); | 236 sgroot->createFromXMLfile("xml/effect.xml"); |
243 sgroot->createFromXMLfile("xml/boss.xml"); | 237 sgroot->createFromXMLfile("xml/boss.xml"); |
244 | 238 |
285 __debug("failed to init_chara_list\n"); | 279 __debug("failed to init_chara_list\n"); |
286 } | 280 } |
287 | 281 |
288 __debug("finished init_chara_list\n"); | 282 __debug("finished init_chara_list\n"); |
289 | 283 |
284 //state と TaskID の関連付け | |
290 initStateList(); | 285 initStateList(); |
291 | 286 |
292 return 1; | 287 return 1; |
293 } | 288 } |
294 | 289 |
324 if ((pad[0].l1 != 0) && (pad[0].r1 != 0) && | 319 if ((pad[0].l1 != 0) && (pad[0].r1 != 0) && |
325 (pad[0].l2 != 0) && (pad[0].r2 != 0)) { | 320 (pad[0].l2 != 0) && (pad[0].r2 != 0)) { |
326 gamef = gamesyokika(gamef); | 321 gamef = gamesyokika(gamef); |
327 } | 322 } |
328 | 323 |
329 if (pad[0].quit != 0) { | 324 if (pad[0].quit == 1) { |
330 gamef = 4; | 325 gamef = 4; |
331 } | 326 } |
332 flip(); | 327 flip(); |
333 | |
334 //SDL_FillRect(screen, NULL, background); | |
335 | 328 |
336 schedule(); | 329 schedule(); |
337 enemyfaste = count; | 330 enemyfaste = count; |
338 | 331 |
339 if (jiki.bf == TRUE) { | 332 if (jiki.bf == TRUE) { |
345 Putbom(); | 338 Putbom(); |
346 tokuten(); | 339 tokuten(); |
347 | 340 |
348 asteroidi = 0; | 341 asteroidi = 0; |
349 // timeprof_begin(timeprof_move); | 342 // timeprof_begin(timeprof_move); |
350 //Move(); //enemy move | |
351 outofwindow(); | 343 outofwindow(); |
352 // timeprof_end(timeprof_move); | 344 // timeprof_end(timeprof_move); |
353 state_update(); | 345 state_update(); |
354 collision_detect(); | 346 collision_detect(); |
355 //charpatern(); | |
356 //bosguage(); | 347 //bosguage(); |
357 | 348 |
358 count++; | 349 //count++; |
359 //PutSprite(count, 0, 960 - 96, 10); | 350 //PutSprite(count, 0, 960 - 96, 10); |
360 /*インフレゲージ */ | 351 /*インフレゲージ */ |
361 count++; | 352 //count++; |
362 //PutSprite(count, 0, 0, 48); | 353 //PutSprite(count, 0, 0, 48); |
363 | 354 |
364 obj_draw(); | 355 obj_draw(); |
365 gamef = game_pause(gamef); | 356 gamef = game_pause(gamef); |
366 | 357 |
367 KeyAssign(runmode, t_buff, joy, pad); | 358 KeyAssign(runmode, t_buff, joy, pad); |
359 | |
360 filpcount++; | |
361 count = 0; | |
368 | 362 |
369 return gamef; | 363 return gamef; |
370 } | 364 } |
371 | 365 |
372 static int | 366 static int |
427 pad[0].st=0; | 421 pad[0].st=0; |
428 pad[0].se=0; | 422 pad[0].se=0; |
429 | 423 |
430 SoundStop(); | 424 SoundStop(); |
431 SoundPlay(7); | 425 SoundPlay(7); |
426 | |
432 gamef = 2; | 427 gamef = 2; |
433 flip(); | 428 flip(); |
429 | |
434 return gamef; | 430 return gamef; |
435 } | 431 } |
436 | 432 |
437 static int | 433 static int |
438 opening(int gamef) | 434 opening(int gamef) |
457 //PutSpriteEx(count, 8192, 8192, 0); | 453 //PutSpriteEx(count, 8192, 8192, 0); |
458 count++; | 454 count++; |
459 PutSprite(count, 640, 640, 192); | 455 PutSprite(count, 640, 640, 192); |
460 //PutSpriteEx(count, 8192, 8192, 0); | 456 //PutSpriteEx(count, 8192, 8192, 0); |
461 | 457 |
462 if (pad[0].st > 1) { | 458 if ((pad[0].st > 1)||(runmode == 2)) { |
463 jiki.bf = TRUE; | 459 jiki.bf = TRUE; |
464 | 460 |
465 //CdPlay(1,&cdp[0],0); | 461 //CdPlay(1,&cdp[0],0); |
466 SoundStop(); | 462 SoundStop(); |
467 SoundPlay(0); | 463 SoundPlay(0); |
879 Pad(joy); | 875 Pad(joy); |
880 } | 876 } |
881 t_buff = CapturePad(t_buff, pad); | 877 t_buff = CapturePad(t_buff, pad); |
882 break; | 878 break; |
883 case 2: | 879 case 2: |
884 t_buff = TracePad(t_buff, pad); | 880 t_buff = TracePad(t_buff, pad); |
885 break; | 881 break; |
886 } | 882 } |
887 } | 883 } |
888 | 884 |
889 /* end */ | 885 /* end */ |