Mercurial > hg > Members > koba > t_dandy
view ppe/chara_state28.cc @ 34:7aaaaf5dde40
add new task.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 07 Jan 2011 23:19:05 +0900 |
parents | |
children | c122e3d2302e |
line wrap: on
line source
#include "task_base.h" #include "task_object.h" #include "Sankaku.h" SchedDefineTask1(State28, state28); static int state28(SchedTask *smanager, void *rbuf, void *wbuf) { int length = 2; CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); int count = *(int*)smanager->get_input(rbuf, 1); smanager->set_outputSize(4, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); int *w_count = (int*)smanager->get_output(wbuf, 1); ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 4); sprite->flag = true; sprite->length = length; if (p->dt1 <= 360) { p->x = Mycos(p->dt1) * 30 / SANKAKU + 82 + 32; p->y = Mysin(p->dt1) * 30 / SANKAKU + 30; } if (p->dt1 > 360) { p->x = Mycos(p->dt1) * 30 * -1 / SANKAKU + 142 + 32; p->y = Mysin(p->dt1) * 30 / SANKAKU + 30; } count++; PutSprite(count, p->x - 42, p->y, 64, &sprite->data[0]); if (p->dt1 % 30 == 3) { Putenemy(24, p->x + 14, p->y + 14, (rand() % 5 + 0.5) * (rand() % 2 == 1 ? -1 : 1), (rand() % 5 + 0.5) * (rand() % 2 == 1 ? -1 : 1), STATE29, &sprite->data[1]); } p->dt1 += 3; *q = *p; *w_count = count; return 0; }