annotate schedule.c @ 53:a233027e895c

*** empty log message ***
author gongo
date Wed, 08 Nov 2006 07:19:26 +0000
parents c875add6256e
children 8cef655f3bf9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
1 /*
17
6910aeb52843 *** empty log message ***
gongo
parents: 16
diff changeset
2 * $Id$
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
3 */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
4 #include <stdio.h>
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
5 #include <stdlib.h>
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
6 #include <string.h>
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
7 #include "libps2.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
8 #include "ps2util.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
9 #include "field.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
10 #include "car.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
11 #include "gSprite.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
12 #include "gFont.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
13 #include "game.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
14 #include "controler.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
15 #include "camera.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
16 #include "light.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
17 #include "title_scene.h"
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
18 #include "game_time.h"
45
d7520785d8a6 *** empty log message ***
gongo
parents: 44
diff changeset
19 #include "schedule.h"
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
20
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
21
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
22 #define MAXCAR 3 // 選択可能機体
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
23 #define MAXFIELD 2 // 選択可能コース
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
24 #define MAXRAP 3 // ラップ数
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
25 #define SP_SEL_CAR 50
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
26 #define SP_SEL_COURSE 80
4
d214fd22ef16 *** empty log message ***
gongo
parents: 3
diff changeset
27
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
28 /* --- car.c --- */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
29 extern void car_update(CarPtr);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
30 /* --- carNode.c */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
31 extern void carNode_append(CarPtr);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
32 extern void carNode_draw();
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
33 extern void carNode_destroy();
43
a1908b83f8fa *** empty log message ***
gongo
parents: 32
diff changeset
34 /* --- fielc.c */
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
35 extern void field_update(CarPtr);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
36 /* --- mytype.c --- */
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
37 extern void wait_init();
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
38 extern Bool wait(double);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
39 extern void time_RaceStart();
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
40 extern double time_RaceTime();
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
41 /* --- linda.c --- */
43
a1908b83f8fa *** empty log message ***
gongo
parents: 32
diff changeset
42 extern void linda_env_init();
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
43
46
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
44
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
45
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
46 /* timer */
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
47 static int start_time,time_count;
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
48 static int RUNNIG=0;
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
49 char raptime[10];
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
50
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
51 static int ranking = 0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
52 static LIGHT l;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
53
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
54 static int i=0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
55
12
b405fe1a6920 *** empty log message ***
gongo
parents: 11
diff changeset
56 void
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
57 set_schedule(void *func)
11
41d3037c34c8 *** empty log message ***
gongo
parents: 8
diff changeset
58 {
41d3037c34c8 *** empty log message ***
gongo
parents: 8
diff changeset
59 game.exec = func;
41d3037c34c8 *** empty log message ***
gongo
parents: 8
diff changeset
60 }
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
61
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
62 static void
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
63 graphic_init()
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
64 {
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
65 gSprite_Init(); // グラフィック関連の初期化
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
66 gFont_Init(); // フォント関連の初期化
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
67 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
68
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
69 static void
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
70 play_init()
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
71 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
72 game.jiki = car_init(game.car_id);
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
73 carNode_append(game.jiki);
32
b5c5ffd4d2f2 *** empty log message ***
gongo
parents: 31
diff changeset
74 field_init(game.course_id);
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
75 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
76
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
77 static void
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
78 game_env_init()
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
79 {
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
80 game.car_id = 1;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
81 game.course_id = 1;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
82 game.camera_type = 0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
83 game.rap = 1;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
84 game.jiki = NULL;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
85
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
86 ranking = 0;
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
87
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
88 wait_init();
43
a1908b83f8fa *** empty log message ***
gongo
parents: 32
diff changeset
89 linda_env_init();
0
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
90 }
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
91
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
92
0fae5658fb0b Initial revision
gongo
parents:
diff changeset
93
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
94 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
95 sche_game_init()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
96 {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
97 game_env_init();
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
98 graphic_init();
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
99 camera_init();
8
f60cb9a39d7a *** empty log message ***
gongo
parents: 5
diff changeset
100
46
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
101 #ifdef LINDA
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
102 set_schedule(sche_game_wait);
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
103 #else
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
104 set_schedule(sche_game_opening);
46
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
105 #endif
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
106 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
107
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
108 /**
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
109 * 通信対戦専用
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
110 * 全ユーザが接続するまで待つ
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
111 */
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
112 static void
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
113 sche_game_wait()
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
114 {
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
115 gFont_SetString("WAITING...", 200, 100);
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
116 if (game.linda_exec() == TRUE)
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
117 set_schedule(sche_game_wait_ready);
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
118 }
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
119
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
120 /**
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
121 * 通信対戦専用
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
122 * 全ユーザの接続を確認したら呼び出す
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
123 */
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
124 static void
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
125 sche_game_wait_ready()
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
126 {
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
127 gFont_SetString("CONNECT OK!!", 170, 300);
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
128 if (game.play_id == 1) {
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
129 gFont_SetString(" PUSH START ", 170, 400);
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
130 if (pad.st != 1) { goto WAIT_READY; }
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
131 }
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
132
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
133 if (game.linda_exec() == TRUE)
46
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
134 set_schedule(sche_game_opening);
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
135
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
136 WAIT_READY:
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
137 return;
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
138 }
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
139
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
140 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
141 sche_game_opening()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
142 {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
143 static int blink_count = 0;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
144 if (game.play_id==1){
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
145 if (blink_count < 35) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
146 gFont_SetString("PUSH START !!", 170, 380);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
147 }
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
148 blink_count = (blink_count > 70) ? 0 : blink_count + 1;
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
149
46
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
150 if (pad.st != 1) { goto OPENING; }
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
151 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
152
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
153 if (game.linda_exec() == TRUE)
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
154 set_schedule(sche_game_select_car);
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
155
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
156 OPENING:
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
157 return;
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
158
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
159 /*
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
160 if (game.play_id == 1) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
161 if (title_scene() < 0){
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
162 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
163 } else if (game.play_id == 2) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
164 if (i==0){
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
165 title_init_call();
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
166 i=1;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
167 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
168 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
169 */
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
170 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
171
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
172 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
173 sche_game_select_car()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
174 {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
175 if (i==1){
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
176 title_finish_call();
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
177 i=2;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
178 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
179 gSprite_PutSpriteEx(SP_SEL_CAR+game.car_id, 190, 200, 1.5, 1.5);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
180 gSprite_PutSprite(24, 460, 300);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
181 gSprite_PutSprite(25, 120, 300);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
182 gFont_SetString("SELECT CAR", 180, 50);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
183
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
184 if (pad.right == 1) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
185 game.car_id =
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
186 (game.car_id > MAXCAR-1) ? 1 : game.car_id + 1;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
187 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
188 if (pad.left == 1) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
189 game.car_id =
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
190 (game.car_id < 2) ? MAXCAR : game.car_id - 1;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
191 }
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
192
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
193 if (game.play_id == 1)
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
194 if (pad.circle != 1) { goto SELECT_CAR; }
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
195
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
196 if (game.linda_exec() == TRUE)
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
197 set_schedule(sche_game_select_course);
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
198
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
199 SELECT_CAR:
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
200 return;
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
201 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
202
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
203 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
204 sche_game_select_course()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
205 {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
206 gSprite_PutSpriteEx(SP_SEL_COURSE+game.course_id, 190, 200, 1.7, 1.8);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
207 gSprite_PutSprite(24, 460, 300);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
208 gSprite_PutSprite(25, 120, 300);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
209
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
210 gFont_SetString("SELECT COURSE", 150, 50);
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
211
46
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
212 if (game.play_id == 1) {
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
213 if (pad.right == 1) {
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
214 game.course_id =
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
215 (game.course_id > MAXFIELD-1) ? 1 : game.course_id + 1;
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
216 game.linda_exec();
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
217 goto SELECT_COURSE;
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
218 }
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
219 if (pad.left == 1) {
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
220 game.course_id =
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
221 (game.course_id < 2) ? MAXFIELD : game.course_id - 1;
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
222 game.linda_exec();
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
223 goto SELECT_COURSE;
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
224 }
46
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
225
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
226 if (pad.circle != 1) { goto SELECT_COURSE; }
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
227 }
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
228
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
229 if (game.linda_exec() == TRUE)
46
abadcc080667 *** empty log message ***
gongo
parents: 45
diff changeset
230 set_schedule(sche_game_ready);
44
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
231
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
232 SELECT_COURSE:
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
233 return;
3b71b39411b1 *** empty log message ***
gongo
parents: 43
diff changeset
234
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
235 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
236
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
237 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
238 sche_game_ready()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
239 {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
240 static int blink_count = 0;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
241
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
242 gSprite_PutSprite(27+game.play_id,265,10);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
243 gSprite_PutSpriteEx(SP_SEL_CAR+game.car_id, 50, 120, 1.5, 1.5);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
244 gSprite_PutSpriteEx(SP_SEL_COURSE+game.course_id, 340, 120, 1.7, 1.8);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
245
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
246 /* 点滅 */
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
247 if (blink_count < 35) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
248 gFont_SetString("GAME START !!", 170, 380);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
249 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
250 blink_count = (blink_count > 70) ? 0 : blink_count + 1;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
251
52
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
252 if (game.linda_exec() == TRUE)
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
253 set_schedule(sche_game_main_init);
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
254
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
255 /*
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
256 if (pad.st == 1) {
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
257 set_schedule(sche_game_main_init);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
258 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
259 if (pad.cross > 0) {
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
260 set_schedule(sche_game_select_car);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
261 }
52
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
262 */
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
263 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
264
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
265 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
266 sche_game_main_init()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
267 {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
268 if (!game.jiki)
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
269 play_init();
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
270 RUNNIG=0;
52
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
271
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
272 set_schedule(sche_game_main);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
273 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
274
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
275 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
276 sche_game_main()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
277 {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
278
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
279 /** begin: dispaly RAP TIME **/
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
280 if(RUNNIG==0){
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
281 start_time = game_time_get_msec();
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
282 RUNNIG=1;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
283 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
284
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
285 time_count = game_time_get_msec() - start_time;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
286 game_time_set_raptime(raptime,time_count);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
287 gFont_SetString("TIME",300,20);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
288 gFont_SetString(raptime,400,20);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
289 /** end: dispaly RAP TIME **/
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
290
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
291 light_init(&l);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
292 set_light(&l);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
293
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
294 car_update(game.jiki);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
295 field_update(game.jiki);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
296 camera_update(game.jiki->body->transfer);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
297 carNode_draw();
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
298
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
299 gFont_SetStringInt(game.rap, 50, 100);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
300
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
301 /* スピードメーター */
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
302 gSprite_DefSprite(23, 1, 1,(int)(106.0*(game.jiki->speed/game.jiki->speed_max)), 34);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
303 gSprite_PutSprite(23, 400, 400);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
304 /* km/h */
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
305 gSprite_PutSprite(26, 470, 350);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
306 /* Rap */
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
307 gSprite_PutSprite(27, 80, 100);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
308
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
309 if (game.rap > MAXRAP) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
310 ranking = 1;
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
311 set_schedule(sche_game_main_goal);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
312 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
313
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
314 gFont_SetStringInt((int)(100.0*game.jiki->speed), 380, 350);
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
315
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
316 if ((pad.right > 0) && ((game.jiki->speed != 0) || (pad.circle > 0))) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
317 car_swerve(game.jiki, 1);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
318 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
319 if ((pad.left > 0) && ((game.jiki->speed != 0) || (pad.circle > 0))) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
320 car_swerve(game.jiki, -1);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
321 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
322 if (pad.circle > 0) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
323 car_accelerate(game.jiki, 1);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
324 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
325 if (pad.cross > 0) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
326 car_accelerate(game.jiki, -1);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
327 }
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
328
52
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
329 game.linda_exec();
c875add6256e *** empty log message ***
gongo
parents: 46
diff changeset
330
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
331 if (pad.r1 == 1) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
332 game.camera_type = !game.camera_type;
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
333 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
334 if (pad.st == 1) {
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
335 set_schedule(sche_game_main_pause);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
336 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
337 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
338
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
339 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
340 sche_game_main_pause()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
341 {
26
4447fd650f60 *** empty log message ***
gongo
parents: 20
diff changeset
342 static int select = 0;
4447fd650f60 *** empty log message ***
gongo
parents: 20
diff changeset
343
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
344 field_update(game.jiki);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
345 carNode_draw();
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
346
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
347 if (game.play_id == 1) {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
348 /* 選択マーク */
26
4447fd650f60 *** empty log message ***
gongo
parents: 20
diff changeset
349 gSprite_PutSprite(17, 100, 190+select*100);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
350
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
351 gFont_SetString("BACK TO GAME", 200, 200);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
352 gFont_SetString("GO TO TITLE", 200, 300);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
353 } else {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
354 gFont_SetString("Pause ...", 200, 200);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
355 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
356
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
357 if (pad.circle == 1) {
26
4447fd650f60 *** empty log message ***
gongo
parents: 20
diff changeset
358 if (select == 0) {
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
359 set_schedule(sche_game_main);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
360 } else {
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
361 set_schedule(sche_game_main_finish);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
362 }
27
618f39723403 *** empty log message ***
gongo
parents: 26
diff changeset
363 } else if (pad.st == 1) {
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
364 set_schedule(sche_game_main);
27
618f39723403 *** empty log message ***
gongo
parents: 26
diff changeset
365 } else if (pad.up == 1 || pad.down == 1) {
26
4447fd650f60 *** empty log message ***
gongo
parents: 20
diff changeset
366 select = !select;
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
367 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
368 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
369
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
370 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
371 sche_game_main_goal()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
372 {
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
373 /** dispaly TOTAL TIME **/
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
374 game_time_set_raptime(raptime,time_count);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
375
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
376 gFont_SetString("TOTAL TIME",150,20);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
377 gFont_SetString(raptime,400,20);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
378 gFont_SetString("GOAL !!", 220, 150);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
379
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
380 #ifdef LINDA
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
381 if (ranking == 1)
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
382 gFont_SetString("You WIN!!", 200, 250);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
383 else
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
384 gFont_SetString("You Lose...", 200, 250);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
385 #endif
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
386
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
387 car_update(game.jiki);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
388 field_update(game.jiki);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
389 carNode_draw();
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
390 camera_update(game.jiki->body->transfer);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
391 if (pad.st == 1) {
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
392 set_schedule(sche_game_main_finish);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
393 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
394 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
395
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
396 void
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
397 sche_game_main_finish()
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
398 {
30
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
399 field_destroy();
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
400 carNode_destroy();
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
401 game_env_init();
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
402
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
403 set_schedule(sche_game_main_finish2);
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
404 }
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
405
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
406 void
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
407 sche_game_main_finish2()
7a348d9ce4ac *** empty log message ***
gongo
parents: 27
diff changeset
408 {
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
409 gFont_SetString("GAME OVER ...", 200, 200);
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
410
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
411 if (pad.st == 1) {
20
b1ba4dad7f6e *** empty log message ***
gongo
parents: 19
diff changeset
412 set_schedule(sche_game_opening);
2
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
413 }
b6a1385f19be *** empty log message ***
gongo
parents: 0
diff changeset
414 }
3
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
415
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
416
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
417 void
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
418 schedule()
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
419 {
8
f60cb9a39d7a *** empty log message ***
gongo
parents: 5
diff changeset
420 game.exec();
3
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
421
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
422 wait_sync();
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
423 swap_dbuff();
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
424 sjoy_poll();
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
425
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
426 ps2util_sprite_Draw();
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
427 gSprite_Draw_Reset();
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
428 gFont_Draw_Reset();
38aedf763052 *** empty log message ***
gongo
parents: 2
diff changeset
429 }