annotate spe/chara_state22.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"
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
4 SchedDefineTask1(State22, state22);
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 static int
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
7 state22(SchedTask *smanager, void *rbuf, void *wbuf)
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 {
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
9 int rand1 = (int)smanager->get_param(0);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
10 int rand2 = (int)smanager->get_param(1);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
11 int rand3 = (int)smanager->get_param(2);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
12 int rand4 = (int)smanager->get_param(3);
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
13
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
16 int sf = rand1 % 4;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 if((sf == 0) || (sf == 1))
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 p->x = -35;
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
20 p->y = rand2 % (120 - 35);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
21 p->vx = (rand3 % 4 + 1);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
22 p->vy = rand4 % 3 + 1;
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
23 p->state_task = STATE23;
18
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 if((sf == 2))
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 {
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
27 p->x = rand2 % 290;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 p->y = -30;
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
29 p->vx = rand3 % 3 - 1;
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
30 p->vy = (rand4 % 4 + 1);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
31 p->state_task = STATE23;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 if(sf == 3)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 p->x = 320;
60
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
36 p->y = rand2 % (120 - 35);
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
37 p->vx = (rand3 % 4 + 1) * -1;
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
38 p->vy = rand4 % 3 -1;
cfd42ee2ad28 change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents: 49
diff changeset
39 p->state_task = STATE23;
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 }
49
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
41
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents: 18
diff changeset
42 smanager->swap();
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 }