view ppe/chara_state25.cc @ 65:b97628fca317

int -> long. not move on ABIBIT=64.
author tkaito
date Thu, 17 Feb 2011 04:49:47 +0900
parents 978097c6427a
children f27a6af6514c
line wrap: on
line source

#include "task_base.h"
#include "task_object.h"
#include "Sankaku.h"

SchedDefineTask1(State25, state25);

static int
state25(SchedTask *smanager, void *rbuf, void *wbuf)
{
    int length = 1;
    int amari;

    long part1_f = (long)smanager->get_param(0);
    long part5_f = (long)smanager->get_param(1);
    long rand    = (long)smanager->get_param(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);
    int *rinkx = (int*)smanager->get_output(wbuf, 2);
    int *rinkf1 = (int*)smanager->get_output(wbuf, 3);
    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++;
    *w_count = count;
    PutSprite(count, p->x - 42, p->y, 64, &sprite->data[0]);
    amari = rand % 160;
    if((amari == 1) && (part5_f == TRUE))
    {
	p->state_task = STATE26;
	*rinkf1 = 1;
    }
    if((amari == 2) && (part1_f == TRUE))
    {
	p->state_task = STATE27;
	*rinkf1 = 5;
	*rinkx = 0;

	*q = *p;
	return 0;
    }
    if((part5_f == TRUE) && (part1_f != TRUE))
    {
	p->state_task = STATE28;
    }
    p->dt1 += 3;
    if(p->dt1 == 720)
    {
	p->dt1 = 0;
    }

    *q = *p;
    return 0;
}