Mercurial > hg > Members > koba > t_dandy
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 |
rev | line source |
---|---|
49 | 1 #include "task_base.h" |
2 #include "task_object.h" | |
3 #include "Sankaku.h" | |
18 | 4 |
49 | 5 SchedDefineTask1(State500, state500); |
18 | 6 |
7 static int | |
49 | 8 state500(SchedTask *smanager, void *rbuf, void *wbuf) |
18 | 9 { |
49 | 10 int rand = (int)smanager->get_param(0); |
11 | |
18 | 12 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); |
49 | 13 int count = *(int*)smanager->get_input(rbuf, 1); |
14 | |
15 int length = 4; | |
16 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); | |
17 smanager->setup_outputData(); | |
18 | |
19 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2); | |
20 sprite->flag = true; | |
21 sprite->length = 2; | |
18 | 22 |
23 p->s = 0; | |
24 | |
25 p->dt2++; | |
26 p->dt2 %= 512; | |
27 p->dt1++; | |
28 count++; | |
49 | 29 DefSpriteEx(100, 16, 16, &sprite->data[0]); |
30 PutSpriteEx(100, p->x + 16, p->y + 16, 2, 2, p->dt1, &sprite->data[1]); | |
18 | 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 | 54 } |
49 | 55 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); |
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 | 58 *q = *p; |
59 *w_count = count; | |
18 | 60 return 0; |
61 } |