Mercurial > hg > Members > koba > t_dandy
comparison ppe/chara_state25.cc @ 34:7aaaaf5dde40
add new task.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 07 Jan 2011 23:19:05 +0900 |
parents | |
children | 6626e451a09d |
comparison
equal
deleted
inserted
replaced
33:39e643fc4f90 | 34:7aaaaf5dde40 |
---|---|
1 #include "task_base.h" | |
2 #include "task_object.h" | |
3 #include "Sankaku.h" | |
4 | |
5 SchedDefineTask1(State25, state25); | |
6 | |
7 static int | |
8 state25(SchedTask *smanager, void *rbuf, void *wbuf) | |
9 { | |
10 int length = 1; | |
11 int amari; | |
12 | |
13 int part1_f = (int)smanager->get_param(0); | |
14 int part5_f = (int)smanager->get_param(1); | |
15 | |
16 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); | |
17 int count = *(int*)smanager->get_input(rbuf, 1); | |
18 | |
19 smanager->set_outputSize(4, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); | |
20 smanager->setup_outputData(); | |
21 | |
22 CHARACTER *q = (CHARACTER*)smanager->get_output(wbuf, 0); | |
23 int *w_count = (int*)smanager->get_output(wbuf, 1); | |
24 int *rinkx = (int*)smanager->get_output(wbuf, 2); | |
25 int *rinkf1 = (int*)smanager->get_output(wbuf, 3); | |
26 ObjContainerPtr sprite = (ObjContainerPtr)smanager->get_output(wbuf, 4); | |
27 sprite->flag = true; | |
28 sprite->length = length; | |
29 | |
30 if(p->dt1 <= 360) | |
31 { | |
32 p->x = Mycos(p->dt1) * 30 / SANKAKU + 82 + 32; | |
33 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30; | |
34 } | |
35 if(p->dt1 > 360) | |
36 { | |
37 p->x = Mycos(p->dt1) * 30 * -1 /SANKAKU + 142 + 32; | |
38 p->y = Mysin(p->dt1) * 30 / SANKAKU + 30; | |
39 } | |
40 count++; | |
41 *w_count = count; | |
42 PutSprite(count, p->x - 42, p->y, 64, &sprite->data[0]); | |
43 amari = rand() % 160; | |
44 if((amari == 1) && (part5_f == TRUE)) | |
45 { | |
46 p->task = STATE26; | |
47 *rinkf1 = 1; | |
48 } | |
49 if((amari == 2) && (part1_f == TRUE)) | |
50 { | |
51 p->task = STATE27; | |
52 *rinkf1 = 5; | |
53 *rinkx = 0; | |
54 | |
55 *q = *p; | |
56 return 0; | |
57 } | |
58 if((part5_f == TRUE) && (part1_f != TRUE)) | |
59 { | |
60 p->task = STATE28; | |
61 } | |
62 p->dt1 += 3; | |
63 if(p->dt1 == 720) | |
64 { | |
65 p->dt1 = 0; | |
66 } | |
67 | |
68 *q = *p; | |
69 return 0; | |
70 } |