Mercurial > hg > Members > koba > t_dandy
comparison ppe/chara_state500.cc @ 38:6626e451a09d
fix random number.
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 11 Jan 2011 16:27:01 +0900 |
parents | c122e3d2302e |
children | e0018f39f7e1 21ac9f57a6d4 |
comparison
equal
deleted
inserted
replaced
37:6989f8cb0259 | 38:6626e451a09d |
---|---|
5 SchedDefineTask1(State500, state500); | 5 SchedDefineTask1(State500, state500); |
6 | 6 |
7 static int | 7 static int |
8 state500(SchedTask *smanager, void *rbuf, void *wbuf) | 8 state500(SchedTask *smanager, void *rbuf, void *wbuf) |
9 { | 9 { |
10 int rand = (int)smanager->get_param(0); | |
11 | |
10 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); | 12 CHARACTER *p = (CHARACTER*)smanager->get_input(rbuf, 0); |
11 int count = *(int*)smanager->get_input(rbuf, 1); | 13 int count = *(int*)smanager->get_input(rbuf, 1); |
12 | 14 |
13 int length = 4; | 15 int length = 4; |
14 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); | 16 smanager->set_outputSize(2, sizeof(ObjContainer)+sizeof(ObjData)*(length-1)); |
28 PutSpriteEx(100, p->x + 16, p->y + 16, 2, 2, p->dt1, &sprite->data[1]); | 30 PutSpriteEx(100, p->x + 16, p->y + 16, 2, 2, p->dt1, &sprite->data[1]); |
29 | 31 |
30 if (p->dt1 % (5 + p->dt2 / 8) == 1) { | 32 if (p->dt1 % (5 + p->dt2 / 8) == 1) { |
31 sprite->length = 3; | 33 sprite->length = 3; |
32 | 34 |
33 if (rand() % 2 == 1) | 35 if (rand % 2 == 1) |
34 Putenemy(24, p->x, p->y, | 36 Putenemy(24, p->x, p->y, |
35 (rand() % 5 + 0.5) * (rand() % 2 == | 37 (rand % 5 + 0.5) * (rand % 2 == |
36 1 ? -1 : 1), | 38 1 ? -1 : 1), |
37 (rand() % 5 + 0.5) * (rand() % 2 == | 39 (rand % 5 + 0.5) * (rand % 2 == |
38 1 ? -1 : 1), STATE501, &sprite->data[2]); | 40 1 ? -1 : 1), STATE501, &sprite->data[2]); |
39 else | 41 else |
40 Putenemy(rand() % 2 + 1, p->x, | 42 Putenemy(rand % 2 + 1, p->x, |
41 p->y, | 43 p->y, |
42 (int) Mycos(p->dt1 / 4) * 4 / | 44 (int) Mycos(p->dt1 / 4) * 4 / |
43 SANKAKU, | 45 SANKAKU, |
44 (int) -Mysin(p->dt1 / 4) * 4 / | 46 (int) -Mysin(p->dt1 / 4) * 4 / |
45 SANKAKU, STATE501, &sprite->data[2]); | 47 SANKAKU, STATE501, &sprite->data[2]); |