diff TaskDandy.cc @ 57:978097c6427a

bug fix.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Sat, 29 Jan 2011 22:43:17 +0900
parents 2c33aa6a4a37
children e0018f39f7e1
line wrap: on
line diff
--- a/TaskDandy.cc	Sat Jan 29 02:46:41 2011 +0900
+++ b/TaskDandy.cc	Sat Jan 29 22:43:17 2011 +0900
@@ -31,6 +31,7 @@
 #include "Character_state.h"
 #include "property.h"
 #include "collision_task.h"
+#include "state_task.h"
 #include "StateList.h"
 #include "Cheat.h"
 #include "debug_db.h"
@@ -108,7 +109,7 @@
 static int get_option(int argc, char *argv[]);
 static int opening(int gamef);
 static int dandy_closing(int gamef);
-static int dandy_main_loop(int gamef);
+static int dandy_main_loop(int gamef, HTaskPtr next);
 static int dandy_main_init(int gamef);
 extern int init(TaskManager *manager, int argc, char *argv[]);
 extern void task_initialize();
@@ -128,7 +129,7 @@
     case 0:    gamef= dandy_main_init(gamef); break;
     case 1:    gamef= gamesyokika(gamef); break;
     case 2:    gamef= opening(gamef); break;
-    case 3:    gamef= dandy_main_loop(gamef); break;
+    case 3:    gamef= dandy_main_loop(gamef, next); break;
     case 4:    gamef= dandy_closing(gamef); break;
     }
     return next;
@@ -322,7 +323,7 @@
 
 
 static int
-dandy_main_loop(int gamef)
+dandy_main_loop(int gamef, HTaskPtr next)
 {
 	if ((pad[0].l1 != 0) && (pad[0].r1 != 0) &&
 	    (pad[0].l2 != 0) && (pad[0].r2 != 0)) {
@@ -353,15 +354,22 @@
 	outofwindow();
 	// timeprof_end(timeprof_move);
 
+	HTaskPtr state_next = create_next();
+
 	state_update();
 
 	HTaskPtr update = collision_update();
 	HTaskPtr reflect = collision_reflect();
+
 	collision_detect();
+
+	next->wait_for(state_next);
+	next->wait_for(reflect);
+
+	state_next->spawn();
 	update->spawn();
 	reflect->spawn();
 
-
 	//charpatern();
 	//bosguage();
     
@@ -374,11 +382,11 @@
 	obj_draw();
 	gamef = game_pause(gamef);
 
+	KeyAssign(runmode, t_buff, joy, pad);
+
 	filpcount++;
 	count = 0;
 
-	KeyAssign(runmode, t_buff, joy, pad);
-
 	return gamef;
 }