annotate ppe/chara_state9.cc @ 66:f27a6af6514c

SchedRegister, game_task.h etc...
author tkaito
date Thu, 17 Feb 2011 10:56:56 +0900
parents 978097c6427a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "task_base.h"
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "task_object.h"
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 SchedDefineTask1(State9, state9);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 static int
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 state9(SchedTask *smanager, void *rbuf, void *wbuf)
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 {
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
34
7aaaaf5dde40 add new task.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
10 int count = *(int*)smanager->get_input(rbuf, 1);
33
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 int length;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 if(p->s <= 2)
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 {
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 length = 2;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 smanager->set_outputSize(4, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 smanager->setup_outputData();
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 int *w_count = (int*)smanager->get_output(wbuf, 1);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 4);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 sprite->flag = true;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 sprite->length = length;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 p->s += 0.05;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 p->y -= 12;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 count++;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 *w_count = count;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 DefSpriteEx(54, 16*4, 32*4, &sprite->data[0]);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 PutSpriteEx(54, (p->x * 4), (p->y * 4), p->s, p->s, 1, &sprite->data[1]);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
66
f27a6af6514c SchedRegister, game_task.h etc...
tkaito
parents: 57
diff changeset
34 p->state_task = State9;
33
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 *q = *p;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 return 0;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 }
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 length = 4;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 smanager->set_outputSize(4, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 smanager->setup_outputData();
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 int *w_rinkx = (int*)smanager->get_output(wbuf, 2);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 int *w_rinky = (int*)smanager->get_output(wbuf, 3);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 4);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 sprite->flag = true;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 sprite->length = length;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 count++;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 DefSpriteEx(54, 16, 32, &sprite->data[0]);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 PutSpriteEx(54, p->x, p->y, p->s, p->s, 1, &sprite->data[1]);
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 *w_rinkx = p->x;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 *w_rinky = p->y;
66
f27a6af6514c SchedRegister, game_task.h etc...
tkaito
parents: 57
diff changeset
56 Putenemy(5, *w_rinkx - 16, *w_rinky - 16, 1, 0, State10, &sprite->data[2]);
f27a6af6514c SchedRegister, game_task.h etc...
tkaito
parents: 57
diff changeset
57 Putenemy(5, *w_rinkx - 16, *w_rinky - 16, -1, 0, State10, &sprite->data[3]);
33
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 p->dt1 = 8192;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59
66
f27a6af6514c SchedRegister, game_task.h etc...
tkaito
parents: 57
diff changeset
60 p->state_task = State11;
33
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 *q = *p;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 return 0;
39e643fc4f90 moving stage1.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 }