annotate ppe/chara_state501.cc @ 70:cee55c8365e9 default tip

fix
author Kazuma
date Thu, 19 May 2016 18:52:26 +0900
parents c122e3d2302e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "task_base.h"
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "task_object.h"
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 SchedDefineTask1(State501, state501);
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 static int
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 state501(SchedTask *smanager, void *rbuf, void *wbuf)
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 {
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 int length;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 p->x += p->vx;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 p->y += p->vy;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 if(p->dt1 % 32 == 1)
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 {
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 length = 1;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 smanager->setup_outputData();
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 1);
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 sprite->flag = true;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 sprite->length = length;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 Puttama(11, p->x, p->y, &sprite->data[0]);
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 }
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 p->dt1++;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 *q = *p;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 return 0;
c122e3d2302e add all state task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 }