view spe/chara_state411.cc @ 18:c330ded6d728

add task file.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Dec 2010 22:18:11 +0900
parents
children f4140672ef9f
line wrap: on
line source

#include "chara_state411.h"
#include "tobject.h"

SchedDefineTask(STATE411);

static int
run(SchedTask *smanager, void *rbuf, void *wbuf)
{
    CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);

    if (p->dt2 > 356)
    {
	p->vx = -1;
    }
    if (p->dt2 < -398)
    {
	p->vx = 1;
    }
    if ((p->dt1) % 62 == 0)
	Putenemy(41,
		 p->x,
		 p->y,
		 (int) -Mycos(p->dt1 / 16) * 4 /
		 SANKAKU,
		 (int) -Mysin(p->dt1 / 16) * 4 /
		 SANKAKU, chara_state7);
    if ((p->dt1) % 13 == 0)
	Puttama(11, p->x + 32,
		p->y + 32);
    
    p->dt2 += p->vx;
    p->dt1 += p->dt2 / 4;
    
    p->x = jiki.x - 16 +
	Mycos(p->dt1 / 16) * 128 / SANKAKU;
  p->y = jiki.y - 16 +
      Mysin(p->dt1 / 16) * 128 / SANKAKU;
  if (p->x < 0)
  {
      p->x = 0;
  }
  if (p->x > 260)
  {
      p->x = 260;
  }
  if (p->y < 0)
  {
      p->y = 0;
  }
  if (p->y > 232)
    {
	p->y = 232;
    }
  return 0;
}