comparison 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
comparison
equal deleted inserted replaced
59:cd05eee90279 60:cfd42ee2ad28
1 #include "asteroid.h" 1 #include "task_base.h"
2 #include "tobject.h" 2 #include "task_object.h"
3 3
4 SchedDefineTask(ASTEROID); 4 SchedDefineTask1(Asteroid, asteroid_task);
5 5
6 static int 6 static int
7 run(SchedTask *smanager, void *rbuf, void *wbuf) 7 asteroid_task(SchedTask *smanager, void *rbuf, void *wbuf)
8 { 8 {
9 int asteroidi = (int)smanager->get_param(0);
10
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); 11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
10 int i;
11 12
12 asteroiddt[asteroidi] = p;
13 // if(asteroidi==0)
14 // {
15 p->x += p->vx; 13 p->x += p->vx;
16 p->y += p->vy; 14 p->y += p->vy;
17 // } 15
18 if (asteroidi > 0) { 16 if (asteroidi > 0) {
19 for (i = 0; i < asteroidi; i++) { 17 CHARACTER* asteroiddt = (CHARACTER*)smanager->get_input(rbuf, 1);
20 if ((asteroiddt[i]->x + 32 > p->x) 18
21 && (p->x + 32 > asteroiddt[i]->x) 19 for (int i = 0; i < asteroidi; i++) {
22 && (asteroiddt[i]->y + 32 > p->y) 20 if ((asteroiddt[i].x + 32 > p->x)
23 && (asteroiddt[i]->y < p->y + 32)) { 21 && (p->x + 32 > asteroiddt[i].x)
22 && (asteroiddt[i].y + 32 > p->y)
23 && (asteroiddt[i].y < p->y + 32)) {
24 p->vx *= -1; 24 p->vx *= -1;
25 p->vy *= -1; 25 p->vy *= -1;
26 } 26 }
27 } 27 }
28 } 28 }
29 asteroidi++; 29 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
30
31 *q = *p;
30 return 0; 32 return 0;
31 } 33 }