annotate spe/chara_state12.cc @ 18:c330ded6d728

add task file.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Dec 2010 22:18:11 +0900
parents
children f4140672ef9f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "chara_state12.h"
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include "tobject.h"
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 SchedDefineTask(STATE12);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 static int
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 run(SchedTask *smanager, void *rbuf, void *wbuf)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 if(fastebos > 60*60)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 if(p->y > 240+32)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 p->state = delete_chara;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 p->y += 3;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 rinky += 3;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 count++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 DefSpriteEx(54, 16, 32);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 PutSpriteEx(54, p->x, p->y, 2, 2, 1);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 p->state = chara_state12;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 if(p->dt1 <= 60)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 if(jiki.x + 15 - rinkx < -5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 p->vx = -0.8;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 else if(jiki.x + 15 - rinkx > 5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 p->vx = +0.8;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 else p->vx = 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 rinkx = p->x;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 rinky = p->y;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 if((p->dt1 > 60) && (p->dt1 <= 70))
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 if(p->dt1 % 2 == 1)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 Puttama(0, rinkx - 16, rinky);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 Puttama(0, rinkx, rinky);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 Puttama(0, rinkx + 16, rinky);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 if((p->dt1 > 180) && (p->dt1 <= 240))
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 if(p->dt1 % 2 == 1)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 rinkf2 = 1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 Puttama(2, rinkx - 16, p->y - 32);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 Puttama(3, rinkx + 32 - 16, p->y - 32);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 else
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 rinkf2 = 2;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 if(p->dt1 > 240)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 rinkf2 = 2;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 if((p->dt1 > 240) && (p->dt1 <= 400))
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 count++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 PutSprite(count, rinkx - 16, rinky + 32,
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 58 + p->dt1 % 4);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 if((p->dt1 > 300) && (p->dt1 <= 400))
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 rinkf2 = 3;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 if(jiki.x + 15 - rinkx < -5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 p->vx = -1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 else if(jiki.x + 15 - rinkx > 5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 p->vx = +1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 else p->vx = 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 p->x += p->vx;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 rinkx = p->x;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 rinky = p->y;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 Puttama(4, rinkx - 8, rinky + 16);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 if((p->dt1 > 400) && (p->dt1 <= 500))
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 rinkf2 = 4;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 if(jiki.x + 15 - rinkx > 5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 p->vx = -1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 else if(jiki.x + 15 - rinkx > 5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 p->vx = +1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 else p->vx = 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 p->x += p->vx;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 rinkx = p->x;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 rinky = p->y;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 if(p->dt1 > 500)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 rinkf2 = 5;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 if(jiki.x + 15 - rinkx < -5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 p->vx = -1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 else if(jiki.x + 15 - rinkx > 5)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 p->vx = +1;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 else p->vx = 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 p->x += p->vx;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 rinkx = p->x;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 rinky = p->y;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 if(p->dt1 > 600)
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 {
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 rinkf2 = 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 p->dt1 = 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 }
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 fastebos++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 p->dt1++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 count++;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 DefSpriteEx(54, 16, 32);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 PutSpriteEx(54, p->x, p->y, 2, 2, 1);
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 return 0;
c330ded6d728 add task file.
koba <koba@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 }