# HG changeset patch # User koba # Date 1293357601 -32400 # Node ID 6487f54ba3d13521709c2190cc9de5228a23f276 # Parent 00c3272a801f6b7e9c934b8b5603bcac3e773868 add new file. diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state0.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state0.cc Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,17 @@ +#include "chara_state0.h" +#include "task_object.h" + +SchedDefineTask(STATE0); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); + + p->x += p->vx; + p->y += p->vy; + + p->task = STATE0; + smanager->swap(); + return 0; +} diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state0.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state0.h Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,12 @@ +#ifndef INCLUDE_COLLISION +#define INCLUDE_COLLISION + +#ifndef INCLUDE_FUNC +#include "../Func.h" +#endif + +#ifndef INCLUDED_SCHED_TASK +#include "SchedTask.h" +#endif + +#endif diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state1.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state1.cc Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,17 @@ +#include "chara_state1.h" +#include "task_object.h" + +SchedDefineTask(STATE1); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); + + p->x -= p->vx; + p->y -= p->vy; + + p->task = STATE1; + smanager->swap(); + return 0; +} diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state1.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state1.h Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,12 @@ +#ifndef INCLUDE_COLLISION +#define INCLUDE_COLLISION + +#ifndef INCLUDE_FUNC +#include "../Func.h" +#endif + +#ifndef INCLUDED_SCHED_TASK +#include "SchedTask.h" +#endif + +#endif diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state2.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state2.cc Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,17 @@ +#include "chara_state2.h" +#include "task_object.h" + +SchedDefineTask(STATE2); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); + + p->vy -= 0.25; + p->y += p->vy; + + p->task = STATE2; + smanager->swap(); + return 0; +} diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state2.h Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,12 @@ +#ifndef INCLUDE_COLLISION +#define INCLUDE_COLLISION + +#ifndef INCLUDE_FUNC +#include "../Func.h" +#endif + +#ifndef INCLUDED_SCHED_TASK +#include "SchedTask.h" +#endif + +#endif diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state3.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state3.cc Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,24 @@ +#include "chara_state3.h" +#include "task_object.h" + +SchedDefineTask(STATE3); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); + + p->x += p->vx; + p->y += p->vy; + if((p->dt1 == 60) || + (p->dt1 == 90) || + (p->dt1 == 30)) + { + Puttama(0, p->x, p->y); + } + p->dt1++; + + p->task = STATE3; + smanager->swap(); + return 0; +} diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state3.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state3.h Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,12 @@ +#ifndef INCLUDE_COLLISION +#define INCLUDE_COLLISION + +#ifndef INCLUDE_FUNC +#include "../Func.h" +#endif + +#ifndef INCLUDED_SCHED_TASK +#include "SchedTask.h" +#endif + +#endif diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state4.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state4.cc Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,25 @@ +#include "chara_state3.h" +#include "task_object.h" + +SchedDefineTask(STATE4); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); + CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); + player *jiki = (player*)smanager->get_input(rbuf, 1); + + p->y += p->vy; + p->x += p->vx; + if(p->y < jiki->y && p->y + 16 > jiki->y) + { + p->vy = -2; + p->vx = ((jiki->x > p->x) ? 4 : -4); + p->task = STATE7; + } + else p->task = STATE4; + + *q = *p; + return 0; +} diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state4.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state4.h Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,12 @@ +#ifndef INCLUDE_COLLISION +#define INCLUDE_COLLISION + +#ifndef INCLUDE_FUNC +#include "../Func.h" +#endif + +#ifndef INCLUDED_SCHED_TASK +#include "SchedTask.h" +#endif + +#endif diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state5.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state5.cc Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,26 @@ +#include "chara_state3.h" +#include "task_object.h" + +SchedDefineTask(STATE5); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); + CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); + player *jiki = (player*)smanager->get_input(rbuf, 1); + + p->y += p->vy; + p->x += p->vx; + if(p->y + 96 < jiki->y + && p->y + 128 > jiki->y) + { + p->vy = -2; + p->vx = ((jiki->x > p->x) ? 4 : -4); + p->task = STATE0; + } + else p->task = STATE5; + + *q = *p; + return 0; +} diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state5.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state5.h Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,12 @@ +#ifndef INCLUDE_COLLISION +#define INCLUDE_COLLISION + +#ifndef INCLUDE_FUNC +#include "../Func.h" +#endif + +#ifndef INCLUDED_SCHED_TASK +#include "SchedTask.h" +#endif + +#endif diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state6.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state6.cc Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,26 @@ +#include "chara_state6.h" +#include "task_object.h" + +SchedDefineTask(STATE6); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); + CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); + player *jiki = (player*)smanager->get_input(rbuf, 1); + + p->y += p->vy; + p->x += p->vx; + if(p->y + 96 < jiki->y + && p->y + 128 > jiki->y) + { + p->vy = 2; + p->vx = ((jiki->x > p->x) ? 4 : -4); + p->task = STATE0; + } + else p->task = STATE6; + + *q = *p; + return 0; +} diff -r 00c3272a801f -r 6487f54ba3d1 ppe/chara_state6.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state6.h Sun Dec 26 19:00:01 2010 +0900 @@ -0,0 +1,12 @@ +#ifndef INCLUDE_COLLISION +#define INCLUDE_COLLISION + +#ifndef INCLUDE_FUNC +#include "../Func.h" +#endif + +#ifndef INCLUDED_SCHED_TASK +#include "SchedTask.h" +#endif + +#endif