35
|
1 #include "task_base.h"
|
|
2 #include "task_object.h"
|
|
3 #include "Sankaku.h"
|
|
4
|
|
5 SchedDefineTask1(State500, state500);
|
|
6
|
|
7 static int
|
|
8 state500(SchedTask *smanager, void *rbuf, void *wbuf)
|
|
9 {
|
67
|
10 long rand = (long)smanager->get_param(0);
|
38
|
11
|
35
|
12 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
|
|
13 int count = *(int*)smanager->get_input(rbuf, 1);
|
|
14
|
|
15 int length = 4;
|
|
16 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1));
|
|
17 smanager->setup_outputData();
|
|
18
|
|
19 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 2);
|
|
20 sprite->flag = true;
|
|
21 sprite->length = 2;
|
|
22
|
|
23 p->s = 0;
|
|
24
|
|
25 p->dt2++;
|
|
26 p->dt2 %= 512;
|
|
27 p->dt1++;
|
|
28 count++;
|
|
29 DefSpriteEx(100, 16, 16, &sprite->data[0]);
|
|
30 PutSpriteEx(100, p->x + 16, p->y + 16, 2, 2, p->dt1, &sprite->data[1]);
|
|
31
|
|
32 if (p->dt1 % (5 + p->dt2 / 8) == 1) {
|
|
33 sprite->length = 3;
|
|
34
|
38
|
35 if (rand % 2 == 1)
|
35
|
36 Putenemy(24, p->x, p->y,
|
38
|
37 (rand % 5 + 0.5) * (rand % 2 ==
|
35
|
38 1 ? -1 : 1),
|
38
|
39 (rand % 5 + 0.5) * (rand % 2 ==
|
35
|
40 1 ? -1 : 1), STATE501, &sprite->data[2]);
|
|
41 else
|
38
|
42 Putenemy(rand % 2 + 1, p->x,
|
35
|
43 p->y,
|
|
44 (int) Mycos(p->dt1 / 4) * 4 /
|
|
45 SANKAKU,
|
|
46 (int) -Mysin(p->dt1 / 4) * 4 /
|
|
47 SANKAKU, STATE501, &sprite->data[2]);
|
|
48 }
|
|
49 if (p->dt1 == 50) {
|
|
50 /*Putenemy(44,0,0,1,1,411); */
|
|
51 }
|
|
52 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0);
|
|
53 int *w_count = (int*)smanager->get_output(wbuf, 1);
|
|
54
|
|
55 *q = *p;
|
|
56 *w_count = count;
|
|
57 return 0;
|
|
58 }
|