view spe/chara_state26.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(State26, state26);

static int
state26(SchedTask *smanager, void *rbuf, void *wbuf)
{
    int length = 1;
    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);
    int *rinkf1 = (int*)smanager->get_output(wbuf, 3);
    ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 4);
    sprite->flag = true;
    sprite->length = length;

    if((p->dt2 > 50) && (p->dt2 < 100))
    {
	*rinkf1 = 2;
    }
    if(p->dt2 > 100)
    {
	*rinkf1 = 3;
    }
    if(p->dt2 == 400)
    {
	*rinkf1 = 4;
    }
    count++;
    *w_count = count;
    PutSprite(count, p->x - 42, p->y, 64, &sprite->data[0]);
    if(p->dt2 == 401)
    {
	p->dt2 = 0;
	*rinkf1 = 0;

	p->state_task = STATE25;
	*q = *p;
	return 0;
    }
    p->dt2++;
    *q = *p;
    return 0;
}