diff spe/chara_state22.cc @ 49:f4140672ef9f

fix.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 21 Jan 2011 22:18:28 +0900
parents c330ded6d728
children cfd42ee2ad28
line wrap: on
line diff
--- a/spe/chara_state22.cc	Sat Jan 15 19:13:03 2011 +0900
+++ b/spe/chara_state22.cc	Fri Jan 21 22:18:28 2011 +0900
@@ -1,39 +1,41 @@
-#include "chara_state22.h"
-#include "tobject.h"
+#include "task_base.h"
+#include "task_object.h"
 
-SchedDefineTask(STATE22);
+SchedDefineTask1(State22, state22);
 
 static int
-run(SchedTask *smanager, void *rbuf, void *wbuf)
+state22(SchedTask *smanager, void *rbuf, void *wbuf)
 {
+    int rand = (int)smanager->get_param(0);
+
     CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
 
-      int sf;
-
-      sf = rand() % 4;
+      int sf = rand % 4;
       if((sf == 0) || (sf == 1))
       {
 	  p->x = -35;
-	  p->y = rand() % (120 - 35);
-	  p->vx = (rand() % 4 + 1);
-	  p->vy = rand() % 3 + 1;
+	  p->y = rand % (120 - 35);
+	  p->vx = (rand % 4 + 1);
+	  p->vy = rand % 3 + 1;
 	  p->task = STATE23;
       }
       if((sf == 2))
       {
-	  p->x = rand() % 290;
+	  p->x = rand % 290;
 	  p->y = -30;
-	  p->vx = rand() % 3 - 1;
-	  p->vy = (rand() % 4 + 1);
+	  p->vx = rand % 3 - 1;
+	  p->vy = (rand % 4 + 1);
 	  p->task = STATE23;
       }
       if(sf == 3)
       {
 	  p->x = 320;
-	  p->y = rand() % (120 - 35);
-	  p->vx = (rand() % 4 + 1) * -1;
-	  p->vy = rand() % 3 -1;
+	  p->y = rand % (120 - 35);
+	  p->vx = (rand % 4 + 1) * -1;
+	  p->vy = rand % 3 -1;
 	  p->task = STATE23;
       }
+
+      smanager->swap();
       return 0;
 }