diff spe/chara_state27.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_state27.cc	Sat Jan 15 19:13:03 2011 +0900
+++ b/spe/chara_state27.cc	Fri Jan 21 22:18:28 2011 +0900
@@ -1,12 +1,27 @@
-#include "chara_state27.h"
-#include "tobject.h"
+#include "task_base.h"
+#include "task_object.h"
 
-SchedDefineTask(STATE27);
+SchedDefineTask1(State27, state27);
 
 static int
-run(SchedTask *smanager, void *rbuf, void *wbuf)
+state27(SchedTask *smanager, void *rbuf, void *wbuf)
 {
+    int length = 1;
     CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
+    int count = *(int*)smanager->get_input(rbuf, 1);
+    int rinkx = *(int*)smanager->get_input(rbuf, 2);
+    int rinkf1 = *(int*)smanager->get_input(rbuf, 3);
+
+    smanager->set_outputSize(4, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
+    smanager->setup_outputData();
+
+    CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
+    int *w_count = (int*)smanager->get_output(wbuf, 1);
+    int *w_rinkx = (int*)smanager->get_output(wbuf, 2);
+    int *w_rinkf1 = (int*)smanager->get_output(wbuf, 3);
+    ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 4);
+    sprite->flag = true;
+    sprite->length = length;
 
     if((p->dt2 > 50) && (p->dt2 < 60) && (p->x > -24) && (p->y > -24))
     {
@@ -49,15 +64,25 @@
 	}
     }
     count++;
-    PutSprite(count, p->x - 32, p->y, 6);
+    PutSprite(count, p->x - 32, p->y, 6, &sprite->data[0]);
     if(rinkf1 == 12)
     {
 	p->dt2 = 0;
 	rinkf1 = 0;
 	rinkx = 0;
+
 	p->task = STATE25;
+	*q = *p;
+	*w_count = count;
+	*w_rinkx = rinkx;
+	*w_rinkf1 = rinkf1;
 	return 0;
     }
     p->dt2++;
+
+    *q = *p;
+    *w_count = count;
+    *w_rinkx = rinkx;
+    *w_rinkf1 = rinkf1;
     return 0;
 }