Mercurial > hg > Members > koba > t_dandy
view ppe/chara_state601.cc @ 38:6626e451a09d
fix random number.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 11 Jan 2011 16:27:01 +0900 (2011-01-11) |
parents | c122e3d2302e |
children | 978097c6427a 21ac9f57a6d4 |
line wrap: on
line source
#include "task_base.h" #include "task_object.h" SchedDefineTask1(State601, state601); static int state601(SchedTask *smanager, void *rbuf, void *wbuf) { int rand = (int)smanager->get_param(0); CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); player *jiki = (player*)smanager->get_input(rbuf, 1); int length = 1; smanager->set_outputSize(1, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 1); sprite->flag = true; sprite->length = length; p->dt2++; if (p->x < jiki->x) p->vx++; if (p->x > jiki->x) p->vx--; p->x += p->vx; Putenemy(6, p->x + 16 + rand % 32, p->y, 0, rand % 4, STATE400, &sprite->data[0]); if (p->x < 0) p->x = 0; if (p->x > 260) p->x = 260; if (p->y < 0) p->y = 0; if (p->y > 232) p->y = 232; if (p->dt2 > 800) { p->task = STATE602; } CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); *q = *p; return 0; }