27
|
1 #include "task_base.h"
|
|
2 #include "task_object.h"
|
|
3
|
34
|
4 SchedDefineTask1(State22, state22);
|
27
|
5
|
|
6 static int
|
34
|
7 state22(SchedTask *smanager, void *rbuf, void *wbuf)
|
27
|
8 {
|
38
|
9 int rand = (int)smanager->get_param(0);
|
|
10
|
27
|
11 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
12
|
38
|
13 int sf = rand % 4;
|
27
|
14 if((sf == 0) || (sf == 1))
|
|
15 {
|
|
16 p->x = -35;
|
38
|
17 p->y = rand % (120 - 35);
|
|
18 p->vx = (rand % 4 + 1);
|
|
19 p->vy = rand % 3 + 1;
|
27
|
20 p->task = STATE23;
|
|
21 }
|
|
22 if((sf == 2))
|
|
23 {
|
38
|
24 p->x = rand % 290;
|
27
|
25 p->y = -30;
|
38
|
26 p->vx = rand % 3 - 1;
|
|
27 p->vy = (rand % 4 + 1);
|
27
|
28 p->task = STATE23;
|
|
29 }
|
|
30 if(sf == 3)
|
|
31 {
|
|
32 p->x = 320;
|
38
|
33 p->y = rand % (120 - 35);
|
|
34 p->vx = (rand % 4 + 1) * -1;
|
|
35 p->vy = rand % 3 -1;
|
27
|
36 p->task = STATE23;
|
|
37 }
|
|
38
|
|
39 smanager->swap();
|
|
40 return 0;
|
|
41 }
|