Mercurial > hg > Members > koba > t_dandy
diff 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 |
line wrap: on
line diff
--- a/spe/asteroid.cc Mon Feb 07 03:31:18 2011 +0900 +++ b/spe/asteroid.cc Sun Feb 06 17:16:43 2011 +0900 @@ -1,31 +1,33 @@ -#include "asteroid.h" -#include "tobject.h" +#include "task_base.h" +#include "task_object.h" -SchedDefineTask(ASTEROID); +SchedDefineTask1(Asteroid, asteroid_task); static int -run(SchedTask *smanager, void *rbuf, void *wbuf) +asteroid_task(SchedTask *smanager, void *rbuf, void *wbuf) { + int asteroidi = (int)smanager->get_param(0); + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); - int i; - asteroiddt[asteroidi] = p; - // if(asteroidi==0) - // { p->x += p->vx; p->y += p->vy; - // } + if (asteroidi > 0) { - for (i = 0; i < asteroidi; i++) { - if ((asteroiddt[i]->x + 32 > p->x) - && (p->x + 32 > asteroiddt[i]->x) - && (asteroiddt[i]->y + 32 > p->y) - && (asteroiddt[i]->y < p->y + 32)) { + CHARACTER* asteroiddt = (CHARACTER*)smanager->get_input(rbuf, 1); + + for (int i = 0; i < asteroidi; i++) { + if ((asteroiddt[i].x + 32 > p->x) + && (p->x + 32 > asteroiddt[i].x) + && (asteroiddt[i].y + 32 > p->y) + && (asteroiddt[i].y < p->y + 32)) { p->vx *= -1; p->vy *= -1; } } } - asteroidi++; + CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); + + *q = *p; return 0; }