annotate schedule.c @ 15:32b270ceef34

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