Mercurial > hg > Members > koba > t_dandy
view spe/chara_state12.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 | f4140672ef9f |
children |
line wrap: on
line source
#include "task_base.h" #include "task_object.h" SchedDefineTask1(State12, state12); static int state12(SchedTask *smanager, void *rbuf, void *wbuf) { int fastebos = (int)smanager->get_param(0); int count = (int)smanager->get_param(1); int rinkx = (int)smanager->get_param(2); int rinky = (int)smanager->get_param(3); CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); int length; int rinkf2; int index_count = 0; if (fastebos > 60*60) { length = 2; smanager->set_outputSize(6, 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); int *w_rinky = (int*)smanager->get_output(wbuf, 4); ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6); sprite->flag = true; sprite->length = length; if (p->y > 240+32) { p->state_task = DELETE_CHARA; } p->y += 3; rinky += 3; count++; DefSpriteEx(54, 16, 32, &sprite->data[index_count]); index_count++; PutSpriteEx(54, p->x, p->y, 2, 2, 1, &sprite->data[index_count]); p->state_task = STATE12; *w_rinky = rinky; *w_count = count; *q = *p; return 0; } player *jiki = (player*)smanager->get_input(rbuf, 1); if (p->dt1 <= 60) { length = 2; smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); if (jiki->x + 15 - rinkx < -5) { p->vx = -0.8; } else if(jiki->x + 15 - rinkx > 5) { p->vx = +0.8; } else { p->vx = 0; } rinkx = p->x; rinky = p->y; } if ((p->dt1 > 60) && (p->dt1 <= 70)) { if(p->dt1 % 2 == 1) { length = 5; smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6); sprite->flag = true; sprite->length = length; Puttama(0, rinkx - 16, rinky, &sprite->data[index_count]); index_count++; Puttama(0, rinkx, rinky, &sprite->data[index_count]); index_count++; Puttama(0, rinkx + 16, rinky, &sprite->data[index_count]); index_count++; } else { length = 2; smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); } } if ((p->dt1 > 70) && (p->dt1 <= 180)) { length = 2; smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); } if ((p->dt1 > 180) && (p->dt1 <= 240)) { if (p->dt1 % 2 == 1) { length = 4; smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6); rinkf2 = 1; Puttama(2, rinkx - 16, p->y - 32, &sprite->data[index_count]); index_count++; Puttama(3, rinkx + 32 - 16, p->y - 32, &sprite->data[index_count]); index_count++; } else { length = 2; smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); rinkf2 = 2; } } if (p->dt1 > 240) { rinkf2 = 2; } if ((p->dt1 > 240) && (p->dt1 <= 400)) { length = 4; smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6); count++; PutSprite(count, rinkx - 16, rinky + 32, 58 + p->dt1 % 4, &sprite->data[index_count]); index_count++; if (p->dt1 > 300) { rinkf2 = 3; if(jiki->x + 15 - rinkx < -5) { p->vx = -1; } else if (jiki->x + 15 - rinkx > 5) { p->vx = +1; } else { p->vx = 0; } p->x += p->vx; rinkx = p->x; rinky = p->y; Puttama(4, rinkx - 8, rinky + 16, &sprite->data[index_count]); index_count++; } } if (p->dt1 > 400) { length = 2; smanager->set_outputSize(6, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); smanager->setup_outputData(); } if ((p->dt1 > 400) && (p->dt1 <= 500)) { rinkf2 = 4; if (jiki->x + 15 - rinkx > 5) { p->vx = -1; } else if (jiki->x + 15 - rinkx > 5) { p->vx = +1; } else { p->vx = 0; } p->x += p->vx; rinkx = p->x; rinky = p->y; } if (p->dt1 > 500) { rinkf2 = 5; if (jiki->x + 15 - rinkx < -5) { p->vx = -1; } else if(jiki->x + 15 - rinkx > 5) { p->vx = +1; } else { p->vx = 0; } p->x += p->vx; rinkx = p->x; rinky = p->y; } if (p->dt1 > 600) { rinkf2 = 0; p->dt1 = 0; } CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); int *w_count = (int*)smanager->get_output(wbuf, 1); int *w_fastebos = (int*)smanager->get_output(wbuf, 2); int *w_rinkx = (int*)smanager->get_output(wbuf, 3); int *w_rinky = (int*)smanager->get_output(wbuf, 4); int *w_rinkf2 = (int*)smanager->get_output(wbuf, 5); ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 6); sprite->flag = true; sprite->length = length; fastebos++; p->dt1++; count++; DefSpriteEx(54, 16, 32, &sprite->data[index_count]); index_count++; PutSpriteEx(54, p->x, p->y, 2, 2, 1, &sprite->data[index_count]); *q = *p; *w_count = count; *w_fastebos = fastebos; *w_rinkx = rinkx; *w_rinky = rinky; *w_rinkf2 = rinkf2; return 0; }