annotate spe/chara_state500.cc @ 60:cfd42ee2ad28

change makefile, spe/task. adjust scale api. worked on ps3-ppe.
author yutaka@localhost.localdomain
date Sun, 06 Feb 2011 17:16:43 +0900
parents f4140672ef9f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
1 #include "task_base.h"
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
2 #include "task_object.h"
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
3 #include "Sankaku.h"
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
5 SchedDefineTask1(State500, state500);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 static int
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
8 state500(SchedTask *smanager, void *rbuf, void *wbuf)
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 {
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
10 int rand = (int)smanager->get_param(0);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
11
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
13 int count = *(int*)smanager->get_input(rbuf, 1);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
14
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
15 int length = 4;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
16 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
17 smanager->setup_outputData();
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
18
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
19 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
20 sprite->flag = true;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
21 sprite->length = 2;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 p->s = 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 p->dt2++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 p->dt2 %= 512;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 p->dt1++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 count++;
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
29 DefSpriteEx(100, 16, 16, &sprite->data[0]);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
30 PutSpriteEx(100, p->x + 16, p->y + 16, 2, 2, p->dt1, &sprite->data[1]);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
32 int num = 5 + p->dt2 / 8;
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
33 if (num != 0) {
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
34 if (p->dt1 % num == 1) {
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
35 sprite->length = 3;
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
36
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
37 if (rand % 2 == 1)
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
38 Putenemy(24, p->x, p->y,
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
39 (rand % 5 + 0.5) * (rand % 2 ==
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
40 1 ? -1 : 1),
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
41 (rand % 5 + 0.5) * (rand % 2 ==
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
42 1 ? -1 : 1), STATE501, &sprite->data[2]);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
43 else
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
44 Putenemy(rand % 2 + 1, p->x,
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
45 p->y,
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
46 (int) Mycos(p->dt1 / 4) * 4 /
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
47 SANKAKU,
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
48 (int) -Mysin(p->dt1 / 4) * 4 /
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
49 SANKAKU, STATE501, &sprite->data[2]);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
50 }
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
51 if (p->dt1 == 50) {
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
52 /*Putenemy(44,0,0,1,1,411); */
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
53 }
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 }
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
55 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
56 int *w_count = (int*)smanager->get_output(wbuf, 1);
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
57
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
58 *q = *p;
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
59 *w_count = count;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 }