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 {
|
|
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
10
|
34
|
11 int sf = rand() % 4;
|
27
|
12 if((sf == 0) || (sf == 1))
|
|
13 {
|
|
14 p->x = -35;
|
|
15 p->y = rand() % (120 - 35);
|
|
16 p->vx = (rand() % 4 + 1);
|
|
17 p->vy = rand() % 3 + 1;
|
|
18 p->task = STATE23;
|
|
19 }
|
|
20 if((sf == 2))
|
|
21 {
|
|
22 p->x = rand() % 290;
|
|
23 p->y = -30;
|
|
24 p->vx = rand() % 3 - 1;
|
|
25 p->vy = (rand() % 4 + 1);
|
|
26 p->task = STATE23;
|
|
27 }
|
|
28 if(sf == 3)
|
|
29 {
|
|
30 p->x = 320;
|
|
31 p->y = rand() % (120 - 35);
|
|
32 p->vx = (rand() % 4 + 1) * -1;
|
|
33 p->vy = rand() % 3 -1;
|
|
34 p->task = STATE23;
|
|
35 }
|
|
36
|
|
37 smanager->swap();
|
|
38 return 0;
|
|
39 }
|