Mercurial > hg > Members > koba > t_dandy
annotate spe/asteroid.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 | c330ded6d728 |
children |
rev | line source |
---|---|
60
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
1 #include "task_base.h" |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
2 #include "task_object.h" |
18 | 3 |
60
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
4 SchedDefineTask1(Asteroid, asteroid_task); |
18 | 5 |
6 static int | |
60
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
7 asteroid_task(SchedTask *smanager, void *rbuf, void *wbuf) |
18 | 8 { |
60
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
9 int asteroidi = (int)smanager->get_param(0); |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
10 |
18 | 11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); |
12 | |
13 p->x += p->vx; | |
14 p->y += p->vy; | |
60
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
15 |
18 | 16 if (asteroidi > 0) { |
60
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
17 CHARACTER* asteroiddt = (CHARACTER*)smanager->get_input(rbuf, 1); |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
18 |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
19 for (int i = 0; i < asteroidi; i++) { |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
20 if ((asteroiddt[i].x + 32 > p->x) |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
21 && (p->x + 32 > asteroiddt[i].x) |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
22 && (asteroiddt[i].y + 32 > p->y) |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
23 && (asteroiddt[i].y < p->y + 32)) { |
18 | 24 p->vx *= -1; |
25 p->vy *= -1; | |
26 } | |
27 } | |
28 } | |
60
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
29 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
30 |
cfd42ee2ad28
change makefile, spe/task. adjust scale api. worked on ps3-ppe.
yutaka@localhost.localdomain
parents:
18
diff
changeset
|
31 *q = *p; |
18 | 32 return 0; |
33 } |