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 {
|
65
|
9 long rand1 = (long)smanager->get_param(0);
|
|
10 long rand2 = (long)smanager->get_param(1);
|
|
11 long rand3 = (long)smanager->get_param(2);
|
|
12 long rand4 = (long)smanager->get_param(3);
|
38
|
13
|
27
|
14 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
15
|
58
|
16 int sf = rand1 % 4;
|
27
|
17 if((sf == 0) || (sf == 1))
|
|
18 {
|
|
19 p->x = -35;
|
58
|
20 p->y = rand2 % (120 - 35);
|
|
21 p->vx = (rand3 % 4 + 1);
|
|
22 p->vy = rand4 % 3 + 1;
|
66
|
23 p->state_task = State23;
|
27
|
24 }
|
|
25 if((sf == 2))
|
|
26 {
|
58
|
27 p->x = rand2 % 290;
|
27
|
28 p->y = -30;
|
58
|
29 p->vx = rand3 % 3 - 1;
|
|
30 p->vy = (rand4 % 4 + 1);
|
66
|
31 p->state_task = State23;
|
27
|
32 }
|
|
33 if(sf == 3)
|
|
34 {
|
|
35 p->x = 320;
|
58
|
36 p->y = rand2 % (120 - 35);
|
|
37 p->vx = (rand3 % 4 + 1) * -1;
|
|
38 p->vy = rand4 % 3 -1;
|
66
|
39 p->state_task = State23;
|
27
|
40 }
|
|
41
|
|
42 smanager->swap();
|
|
43 return 0;
|
|
44 }
|