view ppe/chara_state22.cc @ 65:b97628fca317

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

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

SchedDefineTask1(State22, state22);

static int
state22(SchedTask *smanager, void *rbuf, void *wbuf)
{
    long rand1 = (long)smanager->get_param(0);
    long rand2 = (long)smanager->get_param(1);
    long rand3 = (long)smanager->get_param(2);
    long rand4 = (long)smanager->get_param(3);

    CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);

      int sf = rand1 % 4;
      if((sf == 0) || (sf == 1))
      {
	  p->x = -35;
	  p->y = rand2 % (120 - 35);
	  p->vx = (rand3 % 4 + 1);
	  p->vy = rand4 % 3 + 1;
	  p->state_task = STATE23;
      }
      if((sf == 2))
      {
	  p->x = rand2 % 290;
	  p->y = -30;
	  p->vx = rand3 % 3 - 1;
	  p->vy = (rand4 % 4 + 1);
	  p->state_task = STATE23;
      }
      if(sf == 3)
      {
	  p->x = 320;
	  p->y = rand2 % (120 - 35);
	  p->vx = (rand3 % 4 + 1) * -1;
	  p->vy = rand4 % 3 -1;
	  p->state_task = STATE23;
      }

      smanager->swap();
      return 0;
}