comparison spe/chara_state22.cc @ 49:f4140672ef9f

fix.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 21 Jan 2011 22:18:28 +0900
parents c330ded6d728
children cfd42ee2ad28
comparison
equal deleted inserted replaced
45:e01948ce859a 49:f4140672ef9f
1 #include "chara_state22.h" 1 #include "task_base.h"
2 #include "tobject.h" 2 #include "task_object.h"
3 3
4 SchedDefineTask(STATE22); 4 SchedDefineTask1(State22, state22);
5 5
6 static int 6 static int
7 run(SchedTask *smanager, void *rbuf, void *wbuf) 7 state22(SchedTask *smanager, void *rbuf, void *wbuf)
8 { 8 {
9 int rand = (int)smanager->get_param(0);
10
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); 11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
10 12
11 int sf; 13 int sf = rand % 4;
12
13 sf = rand() % 4;
14 if((sf == 0) || (sf == 1)) 14 if((sf == 0) || (sf == 1))
15 { 15 {
16 p->x = -35; 16 p->x = -35;
17 p->y = rand() % (120 - 35); 17 p->y = rand % (120 - 35);
18 p->vx = (rand() % 4 + 1); 18 p->vx = (rand % 4 + 1);
19 p->vy = rand() % 3 + 1; 19 p->vy = rand % 3 + 1;
20 p->task = STATE23; 20 p->task = STATE23;
21 } 21 }
22 if((sf == 2)) 22 if((sf == 2))
23 { 23 {
24 p->x = rand() % 290; 24 p->x = rand % 290;
25 p->y = -30; 25 p->y = -30;
26 p->vx = rand() % 3 - 1; 26 p->vx = rand % 3 - 1;
27 p->vy = (rand() % 4 + 1); 27 p->vy = (rand % 4 + 1);
28 p->task = STATE23; 28 p->task = STATE23;
29 } 29 }
30 if(sf == 3) 30 if(sf == 3)
31 { 31 {
32 p->x = 320; 32 p->x = 320;
33 p->y = rand() % (120 - 35); 33 p->y = rand % (120 - 35);
34 p->vx = (rand() % 4 + 1) * -1; 34 p->vx = (rand % 4 + 1) * -1;
35 p->vy = rand() % 3 -1; 35 p->vy = rand % 3 -1;
36 p->task = STATE23; 36 p->task = STATE23;
37 } 37 }
38
39 smanager->swap();
38 return 0; 40 return 0;
39 } 41 }