Mercurial > hg > Members > koba > t_dandy
changeset 21:5f1abbe03b9a
add new task.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 26 Dec 2010 22:28:18 +0900 |
parents | 6487f54ba3d1 |
children | 0440f2f19f23 |
files | ppe/Atari.cc ppe/Atari.h ppe/chara_state0.cc ppe/chara_state0.h ppe/chara_state1.cc ppe/chara_state1.h ppe/chara_state2.cc ppe/chara_state2.h ppe/chara_state20.cc ppe/chara_state21.cc ppe/chara_state3.cc ppe/chara_state3.h ppe/chara_state30.cc ppe/chara_state4.cc ppe/chara_state4.h ppe/chara_state5.cc ppe/chara_state5.h ppe/chara_state6.cc ppe/chara_state6.h ppe/task_init.cc state_task.cc |
diffstat | 21 files changed, 102 insertions(+), 112 deletions(-) [+] |
line wrap: on
line diff
--- a/ppe/Atari.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/Atari.cc Sun Dec 26 22:28:18 2010 +0900 @@ -1,4 +1,4 @@ -#include "Atari.h" +#include "task_base.h" #include "task_object.h" SchedDefineTask(Atari);
--- a/ppe/Atari.h Sun Dec 26 19:00:01 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDE_COLLISION -#define INCLUDE_COLLISION - -#ifndef INCLUDE_FUNC -#include "../Func.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -#endif
--- a/ppe/chara_state0.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/chara_state0.cc Sun Dec 26 22:28:18 2010 +0900 @@ -1,7 +1,7 @@ -#include "chara_state0.h" +#include "task_base.h" #include "task_object.h" -SchedDefineTask(STATE0); +SchedDefineTask(State0); static int run(SchedTask *smanager, void *rbuf, void *wbuf)
--- a/ppe/chara_state0.h Sun Dec 26 19:00:01 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDE_COLLISION -#define INCLUDE_COLLISION - -#ifndef INCLUDE_FUNC -#include "../Func.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -#endif
--- a/ppe/chara_state1.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/chara_state1.cc Sun Dec 26 22:28:18 2010 +0900 @@ -1,7 +1,7 @@ -#include "chara_state1.h" +#include "task_base.h" #include "task_object.h" -SchedDefineTask(STATE1); +SchedDefineTask(State1); static int run(SchedTask *smanager, void *rbuf, void *wbuf)
--- a/ppe/chara_state1.h Sun Dec 26 19:00:01 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDE_COLLISION -#define INCLUDE_COLLISION - -#ifndef INCLUDE_FUNC -#include "../Func.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -#endif
--- a/ppe/chara_state2.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/chara_state2.cc Sun Dec 26 22:28:18 2010 +0900 @@ -1,7 +1,7 @@ -#include "chara_state2.h" +#include "task_base.h" #include "task_object.h" -SchedDefineTask(STATE2); +SchedDefineTask(State2); static int run(SchedTask *smanager, void *rbuf, void *wbuf)
--- a/ppe/chara_state2.h Sun Dec 26 19:00:01 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDE_COLLISION -#define INCLUDE_COLLISION - -#ifndef INCLUDE_FUNC -#include "../Func.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state20.cc Sun Dec 26 22:28:18 2010 +0900 @@ -0,0 +1,19 @@ +#include "task_base.h" +#include "task_object.h" + +SchedDefineTask(State20); + +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->vy -= 0.5; + p->vy += 0.4; + + p->task = STATE20; + smanager->swap(); + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state21.cc Sun Dec 26 22:28:18 2010 +0900 @@ -0,0 +1,19 @@ +#include "task_base.h" +#include "task_object.h" + +SchedDefineTask(State21); + +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->vx += 0.5; + p->vy += 0.4; + + p->task = STATE21; + smanager->swap(); + return 0; +}
--- a/ppe/chara_state3.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/chara_state3.cc Sun Dec 26 22:28:18 2010 +0900 @@ -1,4 +1,4 @@ -#include "chara_state3.h" +#include "task_base.h" #include "task_object.h" SchedDefineTask(STATE3);
--- a/ppe/chara_state3.h Sun Dec 26 19:00:01 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDE_COLLISION -#define INCLUDE_COLLISION - -#ifndef INCLUDE_FUNC -#include "../Func.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ppe/chara_state30.cc Sun Dec 26 22:28:18 2010 +0900 @@ -0,0 +1,17 @@ +#include "task_base.h" +#include "task_object.h" + +SchedDefineTask(State30); + +static int +run(SchedTask *smanager, void *rbuf, void *wbuf) +{ + CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); + + p->x = p->x - 32; + p->y = p->y; + + p->task = STATE30; + smanager->swap(); + return 0; +}
--- a/ppe/chara_state4.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/chara_state4.cc Sun Dec 26 22:28:18 2010 +0900 @@ -1,7 +1,7 @@ -#include "chara_state3.h" +#include "task_base.h" #include "task_object.h" -SchedDefineTask(STATE4); +SchedDefineTask(State4); static int run(SchedTask *smanager, void *rbuf, void *wbuf) @@ -16,7 +16,7 @@ { p->vy = -2; p->vx = ((jiki->x > p->x) ? 4 : -4); - p->task = STATE7; +// p->task = STATE7; } else p->task = STATE4;
--- a/ppe/chara_state4.h Sun Dec 26 19:00:01 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDE_COLLISION -#define INCLUDE_COLLISION - -#ifndef INCLUDE_FUNC -#include "../Func.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -#endif
--- a/ppe/chara_state5.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/chara_state5.cc Sun Dec 26 22:28:18 2010 +0900 @@ -1,7 +1,7 @@ -#include "chara_state3.h" +#include "task_base.h" #include "task_object.h" -SchedDefineTask(STATE5); +SchedDefineTask(State5); static int run(SchedTask *smanager, void *rbuf, void *wbuf)
--- a/ppe/chara_state5.h Sun Dec 26 19:00:01 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDE_COLLISION -#define INCLUDE_COLLISION - -#ifndef INCLUDE_FUNC -#include "../Func.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -#endif
--- a/ppe/chara_state6.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/chara_state6.cc Sun Dec 26 22:28:18 2010 +0900 @@ -1,7 +1,7 @@ -#include "chara_state6.h" +#include "task_base.h" #include "task_object.h" -SchedDefineTask(STATE6); +SchedDefineTask(State6); static int run(SchedTask *smanager, void *rbuf, void *wbuf)
--- a/ppe/chara_state6.h Sun Dec 26 19:00:01 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -#ifndef INCLUDE_COLLISION -#define INCLUDE_COLLISION - -#ifndef INCLUDE_FUNC -#include "../Func.h" -#endif - -#ifndef INCLUDED_SCHED_TASK -#include "SchedTask.h" -#endif - -#endif
--- a/ppe/task_init.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/ppe/task_init.cc Sun Dec 26 22:28:18 2010 +0900 @@ -3,7 +3,18 @@ /* 必ずこの位置に書いて */ SchedExternTask(Atari); +SchedExternTask(STATE0); +SchedExternTask(STATE1); +SchedExternTask(STATE2); +SchedExternTask(STATE4); +SchedExternTask(STATE5); +SchedExternTask(STATE6); + +SchedExternTask(STATE20); +SchedExternTask(STATE21); + +SchedExternTask(STATE30); /** * この関数は ../spe/spe-main と違って * 自分で呼び出せばいい関数なので @@ -13,4 +24,15 @@ task_init(void) { SchedRegisterTask(ATARI, Atari); + SchedRegisterTask(STATE0, State0); + SchedRegisterTask(STATE1, State1); + SchedRegisterTask(STATE2, State2); + + SchedRegisterTask(STATE4, State4); + SchedRegisterTask(STATE5, State5); + SchedRegisterTask(STATE6, State6); + + SchedRegisterTask(STATE20, State20); + SchedRegisterTask(STATE21, State21); + SchedRegisterTask(STATE30, State30); }
--- a/state_task.cc Sun Dec 26 19:00:01 2010 +0900 +++ b/state_task.cc Sun Dec 26 22:28:18 2010 +0900 @@ -119,7 +119,7 @@ { int task_num = p->task; HTaskPtr state_task = tmanager->create_task(task_num); - + state_task->add_inData(p, sizeof(CHARACTER)); state_task->add_outData(p, sizeof(CHARACTER)); state_task->set_post(updateState, (void*)p, NULL); @@ -167,16 +167,19 @@ CHARACTER * chara_state0(CHARACTER *p) { + p->task = STATE0; return SimpleStateTask(p); } CHARACTER * chara_state1(CHARACTER *p) { + p->task = STATE1; return SimpleStateTask(p); } CHARACTER * chara_state2(CHARACTER *p) { + p->task = STATE2; return SimpleStateTask(p); } @@ -200,16 +203,19 @@ CHARACTER * chara_state4(CHARACTER *p) { + p->task = STATE4; return withJikiTask(p); } CHARACTER * chara_state5(CHARACTER *p) { + p->task = STATE5; return withJikiTask(p); } CHARACTER * chara_state6(CHARACTER *p) { + p->task = STATE6; return withJikiTask(p); } @@ -481,11 +487,13 @@ CHARACTER * chara_state20(CHARACTER *p) { + p->task = STATE20; return SimpleStateTask(p); } CHARACTER * chara_state21(CHARACTER *p) { + p->task = STATE21; return SimpleStateTask(p); } @@ -687,6 +695,7 @@ CHARACTER * chara_state30(CHARACTER *p) { + p->task = STATE30; return SimpleStateTask(p); }