Mercurial > hg > old > magoroku_racing.bad
annotate schedule.cc @ 133:e7caa277d7e8
add createStringFont()
author | Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 21 Jul 2011 18:16:26 +0900 |
parents | d84ee8b2cfd9 |
children | bb8bbca19a5f |
rev | line source |
---|---|
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
1 /* schedule.c */ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
2 |
0 | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
5 #include <string.h> | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
6 #include <stdbool.h> |
91 | 7 #include "libps2.h" |
8 #include "ps2util.h" | |
0 | 9 #include "field.h" |
10 #include "car.h" | |
11 #include "gSprite.h" | |
12 #include "gFont.h" | |
13 #include "game.h" | |
14 #include "controler.h" | |
15 #include "camera.h" | |
91 | 16 #include "carNode.h" |
110
8a525ec378fc
bool.h change stdbool.h
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
17 #include "car.h" |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
18 #include "light.h" |
0 | 19 #include "title_scene.h" |
20 #include "game_time.h" | |
45 | 21 #include "schedule.h" |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
22 #include "game.h" |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
23 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
24 #include "mytype.h" |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
25 #include "linda.h" |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
26 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
27 #include "sjoy.h" |
0 | 28 |
122 | 29 |
62 | 30 #ifdef LINDA |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
31 bool linda_update(int p, Game *game); |
62 | 32 #else |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
33 #define linda_update(change_state, game) true |
62 | 34 #endif |
0 | 35 |
128 | 36 #define MAXCAR 4 // 選択可能機体 |
88 | 37 #define MAXFIELD 2 // 選択可能コース |
38 #define MAXRAP 3 // ラップ数 | |
0 | 39 #define SP_SEL_CAR 50 |
40 #define SP_SEL_COURSE 80 | |
4 | 41 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
42 // controler.cより |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
43 extern SGO_PAD pad; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
44 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
45 |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
46 static void set_schedule(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
47 static void sche_game_init(Game *game); |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
48 //static void sche_game_wait(Game *game); //プロトタイプも消しといた |
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
49 //static void sche_game_wait_ready(Game *game); |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
50 static void sche_game_opening(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
51 static void sche_game_select_car(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
52 static void sche_game_select_course(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
53 static void sche_game_ready(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
54 static void sche_game_main_init(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
55 static void sche_game_main_ready(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
56 static void sche_game_main(Game *game); |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
57 static void sche_game_main_pause(Game *game); |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
58 static void sche_game_main_goal(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
59 static void sche_game_main_finish(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
60 static void sche_game_main_finish2(Game *game); |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
61 |
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
62 |
20 | 63 /* timer */ |
64 static int start_time,time_count; | |
65 static int RUNNIG=0; | |
66 char raptime[10]; | |
0 | 67 |
68 static int ranking = 0; | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
69 static LIGHT l; |
0 | 70 static int i=0; |
71 | |
100 | 72 static void (*sche_func_assumption)(Game*); |
73 static void (*sche_func)(Game*) = &sche_game_init; | |
58 | 74 static int change_state = 0; |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
75 |
128 | 76 |
110
8a525ec378fc
bool.h change stdbool.h
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
77 // schedule.ccで使用してる |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
78 void linda_env_init( void ); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
79 |
58 | 80 static void |
100 | 81 set_schedule_assumption(void (*_func)(Game*) ) |
11 | 82 { |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
83 //droot->createFromXMLfile("/Users/yonaminetakao/Desktop/Cerium/Renderer/Test/xml_file/universe.xml"); |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
84 //SceneGraphPtr root = droot->createSceneGraph("Earth"); |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
85 //droot->createStringFont(root,"As",80,640,480,0x00ff00ff); |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
86 //root->xyz[0] = 320; |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
87 //root->xyz[1] = 240; |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
88 //root->xyz[2] = 100; |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
89 //get_matrix(root->matrix, root->angle, root->xyz, camera->matrix); |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
90 //droot->setSceneData(root); |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
91 sche_func_assumption = _func; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
92 change_state = 1; |
58 | 93 } |
94 | |
95 static void | |
62 | 96 unset_schedule() |
97 { | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
98 change_state = 0; |
62 | 99 } |
100 | |
101 static void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
102 set_schedule(Game *game) |
58 | 103 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
104 sche_func = sche_func_assumption; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
105 change_state = 0; |
11 | 106 } |
0 | 107 |
108 static void | |
2 | 109 graphic_init() |
0 | 110 { |
128 | 111 // flip(); |
112 | |
119 | 113 printf("graphic_init()\n"); |
114 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
115 gSprite_Init(); // グラフィック関連の初期化 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
116 gFont_Init(); // フォント関連の初期化 |
0 | 117 } |
118 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
119 static void |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
120 play_init( Game *game ) |
0 | 121 { |
124 | 122 printf("play_init()\n"); |
122 | 123 |
124 // ここで、car_idには1か2か3が入らんとダメ | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
125 game->jiki = car_init(game->car_id); |
128 | 126 |
127 // carNode.cc内のcar_listに追加 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
128 carNode_append(game->jiki); |
128 | 129 |
130 | 130 // |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
131 field_init(game->course_id); |
0 | 132 } |
133 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
134 // 適当に自作 :miya |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
135 void linda_env_init( void ) |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
136 { |
98 | 137 printf("linda_env_init\n"); |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
138 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
139 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
140 static void game_env_init ( Game *game ) |
0 | 141 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
142 game->car_id = 1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
143 game->course_id = 1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
144 game->camera_type = 0; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
145 game->rap = 1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
146 game->jiki = NULL; |
117 | 147 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
148 ranking = 0; |
0 | 149 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
150 wait_init(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
151 linda_env_init(); |
0 | 152 } |
153 | |
154 | |
2 | 155 void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
156 sche_game_init(Game *game) |
2 | 157 { |
116 | 158 printf("sche_game_init()\n"); |
119 | 159 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
160 game_env_init(game); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
161 graphic_init(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
162 camera_init(); |
8 | 163 |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
164 FVECTOR cP = { 0, 0, 0, 0 };//camera position |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
165 FVECTOR cA = { 0, 0, 0, 0 };//camera angle |
130 | 166 |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
167 set_cameraPos( cP, cA );//camera set |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
168 |
46 | 169 #ifdef LINDA |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
170 //sche_func = &sche_game_wait; |
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
171 //set_schedule_assumption(sche_game_wait); |
46 | 172 #else |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
173 set_schedule_assumption(sche_game_opening); |
46 | 174 #endif |
2 | 175 } |
176 | |
44 | 177 /** |
88 | 178 * 通信対戦専用 |
179 * 全ユーザが接続するまで待つ | |
95 | 180 * ・・・だったんだけど、現在 linda を切っているため worning が出る。 |
181 * ので cut する。 | |
44 | 182 */ |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
183 |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
184 /* linda を使用しないのでカットした |
124 | 185 static void |
186 sche_game_wait(Game *game) | |
187 { | |
188 gFont_SetString("WAITING...", 200, 100); | |
189 set_schedule_assumption(sche_game_wait_ready); | |
190 } | |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
191 */ |
44 | 192 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
193 |
44 | 194 /** |
88 | 195 * 通信対戦専用 |
196 * 全ユーザの接続を確認したら呼び出す | |
95 | 197 * こいつも、linda がないので cut |
97
afddacdf30dd
compile on Mac OS X -no Warning
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
198 */ |
128 | 199 /* |
200 static void | |
201 sche_game_wait_ready(Game *game) | |
202 { | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
203 gFont_SetString("CONNECT OK!!", 170, 300); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
204 if (game->play_id == 1) { |
128 | 205 gFont_SetString(" PUSH START ", 170, 400); |
206 if (pad.st != 1) { goto WAIT_READY; } | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
207 } |
44 | 208 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
209 set_schedule_assumption(sche_game_opening); |
44 | 210 |
128 | 211 WAIT_READY: |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
212 return; |
128 | 213 } |
115 | 214 */ |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
215 |
44 | 216 |
2 | 217 void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
218 sche_game_opening(Game *game) |
2 | 219 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
220 static int blink_count = 0; |
117 | 221 |
130 | 222 //gSprite_PutSprite(TITLE, 600 + get_cameraPos(0), 100 + get_cameraPos(1), -500 + get_cameraPos(2), 0); |
223 | |
128 | 224 gSprite_PutSprite( true, TITLE, 600, 100, -500, 0); |
130 | 225 //gSprite_PutSprite(TITLE, 600 - 40, 100 + get_cameraPos(1), -500 + 30, 0); |
128 | 226 |
117 | 227 //ここを現在通らないらしい。 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
228 if (game->play_id==1){ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
229 if (blink_count < 35) { |
133
e7caa277d7e8
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
132
diff
changeset
|
230 gFont_SetString("PUSH START !!", 320, 480); |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
231 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
232 blink_count = (blink_count > 70) ? 0 : blink_count + 1; |
44 | 233 |
117 | 234 printf("pad.st = %d\n",pad.st); |
235 if (pad.st != 1) { goto OPENING; } | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
236 } |
117 | 237 |
238 /*処理をいったんifの外へ。これを見る限り、キー入力自体はokぽい | |
119 | 239 printf("pad.st = %d\n",pad.st); |
240 if (pad.st != 1) { goto OPENING; } | |
117 | 241 */ |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
242 set_schedule_assumption(sche_game_select_car); |
44 | 243 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
244 OPENING: |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
245 return; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
246 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
247 if (game->play_id == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
248 if (title_scene() < 0){ |
2 | 249 } |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
250 } else if (game->play_id == 2) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
251 if (i==0){ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
252 title_init_call(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
253 i=1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
254 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
255 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
256 |
2 | 257 } |
258 | |
259 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
260 sche_game_select_car(Game *game) |
2 | 261 { |
124 | 262 printf("sche_game_select_car()\n"); |
122 | 263 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
264 if (i==1){ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
265 title_finish_call(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
266 i=2; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
267 } |
124 | 268 |
128 | 269 gSprite_PutSpriteEx(true,SP_SEL_CAR+game->car_id, 600, 200, TEST_Z_GRID,1.5, 1.5, 0.0); |
270 gSprite_PutSprite(true,R_ARROW, 750, 200, TEST_Z_GRID, 0); | |
271 gSprite_PutSprite(true,L_ARROW, 450, 200, TEST_Z_GRID, 0 ); | |
116 | 272 |
133
e7caa277d7e8
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
132
diff
changeset
|
273 gFont_SetString("SELECT CAR", 320, 480); |
124 | 274 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
275 if (pad.right == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
276 game->car_id = |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
277 (game->car_id > MAXCAR-1) ? 1 : game->car_id + 1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
278 } |
124 | 279 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
280 if (pad.left == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
281 game->car_id = |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
282 (game->car_id < 2) ? MAXCAR : game->car_id - 1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
283 } |
44 | 284 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
285 if (game->play_id == 1) |
116 | 286 if (pad.circle != 1) { goto SELECT_CAR; } |
287 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
288 set_schedule_assumption(sche_game_select_course); |
124 | 289 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
290 SELECT_CAR: |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
291 return; |
2 | 292 } |
293 | |
294 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
295 sche_game_select_course(Game *game) |
2 | 296 { |
116 | 297 printf("sche_game_select_course()\n"); |
128 | 298 gSprite_PutSpriteEx(true, SP_SEL_COURSE+game->course_id, 600, 200, TEST_Z_GRID ,1.7, 1.8, 0.0); |
299 gSprite_PutSprite(true, R_ARROW, 750, 200, TEST_Z_GRID, 0); | |
300 gSprite_PutSprite(true, L_ARROW, 450, 200, TEST_Z_GRID, 0); | |
2 | 301 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
302 gFont_SetString("SELECT COURSE", 150, 50); |
44 | 303 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
304 if (game->play_id == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
305 if (pad.right == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
306 game->course_id = |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
307 (game->course_id > MAXFIELD-1) ? 1 : game->course_id + 1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
308 goto SELECT_COURSE; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
309 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
310 if (pad.left == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
311 game->course_id = |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
312 (game->course_id < 2) ? MAXFIELD : game->course_id - 1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
313 goto SELECT_COURSE; |
2 | 314 } |
44 | 315 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
316 if (pad.circle != 1) { goto SELECT_COURSE; } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
317 } |
44 | 318 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
319 set_schedule_assumption(sche_game_ready); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
320 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
321 SELECT_COURSE: |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
322 return; |
2 | 323 } |
324 | |
325 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
326 sche_game_ready(Game *game) |
2 | 327 { |
116 | 328 printf("sche_game_ready()\n"); |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
329 static int blink_count = 0;// |
2 | 330 |
128 | 331 int tesX = 500; |
126 | 332 |
130 | 333 // PLAYER_1 or PLAYER_2 今は通信対戦できないから常にPLAYER_1 |
128 | 334 gSprite_PutSprite(true, 27+game->play_id, 265 + 50 , 200, TEST_Z_GRID + 400, 0 ); |
126 | 335 |
128 | 336 gSprite_PutSpriteEx(true, SP_SEL_CAR+game->car_id, 50 + tesX, 120, TEST_Z_GRID - 300, 1.5, 1.5 , 0.0); |
337 gSprite_PutSpriteEx(true, SP_SEL_COURSE+game->course_id, 340 + tesX, 120, TEST_Z_GRID - 300, 1.7, 1.8 , 0.0); | |
122 | 338 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
339 /* 点滅 */ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
340 if (blink_count < 35) { |
133
e7caa277d7e8
add createStringFont()
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
132
diff
changeset
|
341 gFont_SetString("GAME START !!", 220, 580); |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
342 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
343 blink_count = (blink_count > 70) ? 0 : blink_count + 1; |
2 | 344 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
345 if (pad.st == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
346 set_schedule_assumption(sche_game_main_init); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
347 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
348 if (pad.cross > 0) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
349 set_schedule_assumption(sche_game_select_car); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
350 } |
2 | 351 } |
352 | |
353 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
354 sche_game_main_init(Game *game) |
2 | 355 { |
116 | 356 printf("sche_game_main_init()\n"); |
357 if (!game->jiki){ | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
358 play_init(game); |
116 | 359 } |
360 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
361 RUNNIG=0; |
52 | 362 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
363 set_schedule_assumption(sche_game_main_ready); |
130 | 364 |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
365 |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
366 // とりあえず、トップビューで |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
367 FVECTOR cPos = { game->jiki->location[0],game->jiki->location[1],game->jiki->location[2],0 }; |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
368 FVECTOR cAngle = { 0, 0, 0, 0 }; |
130 | 369 // FVECTOR cA = { 0, 0, 0, 0 }; |
370 | |
371 set_cameraPos( cPos, cAngle ); | |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
372 |
72 | 373 } |
374 | |
375 static void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
376 sche_game_main_ready(Game *game) |
72 | 377 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
378 gFont_SetString("Loading....", 180, 100); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
379 set_schedule_assumption(sche_game_main); |
128 | 380 |
2 | 381 } |
382 | |
72 | 383 static void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
384 sche_game_main(Game *game) |
2 | 385 { |
124 | 386 printf("sche_game_main()\n"); |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
387 FVECTOR cPos = { game->jiki->location[0],game->jiki->location[1],game->jiki->location[2] ,0 }; |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
388 FVECTOR cAngle = {0, 0, 0, 0 }; |
128 | 389 // jikiによってカメラも移動( camera_update()って関数のほう使うあらイラんね ) |
130 | 390 // set_cameraPos( game->jiki->body->xyz, game->jiki->body->angle ); |
128 | 391 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
392 /** begin: dispaly RAP TIME **/ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
393 if(RUNNIG==0){ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
394 start_time = game_time_get_msec(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
395 RUNNIG=1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
396 } |
2 | 397 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
398 time_count = game_time_get_msec() - start_time; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
399 game_time_set_raptime(raptime,time_count); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
400 gFont_SetString("TIME",300,20); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
401 gFont_SetString(raptime,400,20); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
402 /** end: dispaly RAP TIME **/ |
2 | 403 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
404 // light_init と init_lightの書き間違え? |
130 | 405 init_light(&l); |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
406 set_light(&l); |
128 | 407 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
408 car_id_update(game, game->jiki); |
130 | 409 |
128 | 410 // 宣言では引数が二つだったから、第一引数に game を入れてみた |
411 car_update(game, game->jiki); | |
20 | 412 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
413 field_update(game->jiki); |
130 | 414 |
128 | 415 // 車のDraw関数 |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
416 carNode_draw(game->jiki); |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
417 |
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
418 set_cameraPos( cPos, cAngle ); |
128 | 419 //camera_update(game, game->jiki->body->transfer); |
130 | 420 //camera_update(game, &(game->jiki->body->matrix) ); |
118 | 421 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
422 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
423 gFont_SetStringInt(game->rap, 50, 100); |
2 | 424 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
425 /* スピードメーター */ |
124 | 426 //gSprite_DefSprite(SP_METER, 1, 1,(int)(106.0*(game->jiki->speed/game->jiki->speed_max)), 34); |
427 | |
428 // とりあえずコンパイル通すためにコメント。あとで調べましょう | |
429 // gSprite_DefSprite(SP_METER, "name", (float)(106.0*(game->jiki->speed/game->jiki->speed_max)), 34.0, 100); | |
430 | |
128 | 431 gSprite_PutSprite(true,SP_METER, 400, 400, TEST_Z_GRID, 0); |
124 | 432 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
433 /* km/h */ |
128 | 434 gSprite_PutSprite(true, KM, 470, 350, TEST_Z_GRID, 0); |
124 | 435 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
436 /* Rap */ |
128 | 437 gSprite_PutSprite(true,RAP, 80, 100, TEST_Z_GRID, 0); |
2 | 438 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
439 if (game->rap > MAXRAP) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
440 ranking = 1; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
441 set_schedule_assumption(sche_game_main_goal); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
442 } |
2 | 443 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
444 gFont_SetStringInt((int)(100.0*game->jiki->speed), 380, 350); |
128 | 445 |
130 | 446 |
447 | |
448 | |
449 if( pad.up > 0 ){ | |
450 game->jiki->direction[2] ++; | |
451 } | |
452 if( pad.down > 0 ){ | |
453 game->jiki->direction[2] --; | |
454 } | |
455 if( pad.right > 0 ){ | |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
456 game->jiki->direction[0] ++; |
130 | 457 } |
458 if( pad.left > 0 ){ | |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
459 game->jiki->direction[0] --; |
130 | 460 } |
461 | |
462 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
463 if ((pad.right > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
464 car_swerve(game->jiki, 1); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
465 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
466 if ((pad.left > 0) && ((game->jiki->speed != 0) || (pad.circle > 0))) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
467 car_swerve(game->jiki, -1); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
468 } |
128 | 469 |
470 // 丸ボタン押したら加速 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
471 if (pad.circle > 0) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
472 car_accelerate(game->jiki, 1); |
128 | 473 // game->jiki->body->xyz[0] ++; //テスト用でし |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
474 } |
128 | 475 // バツボタン押したら減速 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
476 if (pad.cross > 0) { |
128 | 477 //game->jiki->body->xyz[2] ++; |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
478 car_accelerate(game->jiki, -1); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
479 } |
130 | 480 |
481 | |
482 // テスト用関数 | |
483 //cameraControl( ); | |
484 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
485 if (pad.r1 == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
486 game->camera_type = !game->camera_type; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
487 } |
128 | 488 |
489 // startボタン押したらpause画面へ | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
490 if (pad.st == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
491 set_schedule_assumption(sche_game_main_pause); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
492 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
493 |
124 | 494 //S-dandy の obj てきな |
2 | 495 } |
496 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
497 |
2 | 498 void |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
499 sche_game_main_pause(Game *game) |
2 | 500 { |
124 | 501 printf("sche_game_main_pause\n"); |
502 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
503 static int select = 0; |
26 | 504 |
130 | 505 // field_update(game->jiki); |
506 //carNode_draw(); | |
128 | 507 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
508 if (game->play_id == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
509 // 選択マーク |
128 | 510 gSprite_PutSprite(true, SELECT, 100 + 250, 190+select*100 + 10, TEST_Z_GRID + 400, 0); |
2 | 511 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
512 gFont_SetString("BACK TO GAME", 200, 200); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
513 gFont_SetString("GO TO TITLE", 200, 300); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
514 } else { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
515 gFont_SetString("Pause ...", 200, 200); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
516 } |
2 | 517 |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
518 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
519 if (pad.circle == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
520 if (select == 0) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
521 set_schedule_assumption(sche_game_main); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
522 } else { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
523 set_schedule_assumption(sche_game_main_finish); |
2 | 524 } |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
525 } else if (pad.st == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
526 set_schedule_assumption(sche_game_main); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
527 } else if (pad.up == 1 || pad.down == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
528 select = !select; |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
529 } |
2 | 530 } |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
531 |
2 | 532 |
533 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
534 sche_game_main_goal(Game *game) |
2 | 535 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
536 /** dispaly TOTAL TIME **/ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
537 game_time_set_raptime(raptime,time_count); |
2 | 538 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
539 gFont_SetString("TOTAL TIME",150,20); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
540 gFont_SetString(raptime,400,20); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
541 gFont_SetString("GOAL !!", 220, 150); |
2 | 542 |
543 #ifdef LINDA | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
544 if (ranking == 1) |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
545 gFont_SetString("You WIN!!", 200, 250); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
546 else |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
547 gFont_SetString("You Lose...", 200, 250); |
2 | 548 #endif |
549 | |
130 | 550 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
551 // 宣言では引数が二つだったから、第一引数に game を入れてみた |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
552 car_update(game, game->jiki); |
130 | 553 //field_update(game->jiki); |
132
d84ee8b2cfd9
camera position update
Takao YONAMINE <e095763@ie.u-ryukyu.ac.jp>
parents:
130
diff
changeset
|
554 carNode_draw(game->jiki); |
128 | 555 |
556 // ちょっとコメントアウト | |
557 // camera_update( game, (FMATRIX)(game->jiki->body->matrix) ); | |
115 | 558 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
559 if (pad.st == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
560 set_schedule_assumption(sche_game_main_finish); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
561 } |
2 | 562 } |
563 | |
564 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
565 sche_game_main_finish(Game *game) |
2 | 566 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
567 field_destroy(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
568 carNode_destroy(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
569 game_env_init(game); |
30 | 570 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
571 set_schedule_assumption(sche_game_main_finish2); |
30 | 572 } |
573 | |
574 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
575 sche_game_main_finish2(Game *game) |
30 | 576 { |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
577 gFont_SetString("GAME OVER ...", 200, 200); |
117 | 578 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
579 if (pad.st == 1) { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
580 set_schedule_assumption(sche_game_opening); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
581 } |
130 | 582 |
2 | 583 } |
3 | 584 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
585 // 適当に作りました |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
586 void wait_sync(Game *game) |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
587 { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
588 printf("wait_sync\n"); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
589 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
590 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
591 // 適当に |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
592 void swap_dbuff() |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
593 { |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
594 printf("swap_dbuff()\n"); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
595 } |
3 | 596 |
597 void | |
90
8edae89a3877
compile on Mac OS X
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
88
diff
changeset
|
598 schedule(Game *game) |
3 | 599 { |
124 | 600 flip(); |
128 | 601 |
116 | 602 printf("----------------------\n"); |
603 printf("schedule()\n"); | |
604 | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
605 sche_func(game); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
606 |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
607 if (linda_update(change_state, game) == true){ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
608 set_schedule(game); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
609 } |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
610 else{ |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
611 unset_schedule(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
612 } |
58 | 613 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
614 wait_sync(game); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
615 swap_dbuff(); |
128 | 616 |
617 // この関数はなんなのかな | |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
618 sjoy_poll(); |
3 | 619 |
96
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
620 ps2util_sprite_Draw(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
621 gSprite_Draw_Reset(); |
0b65ca27f113
compile on Mac OS X 2
Atuto SHIROMA <e095729@ie.u-ryukyu.ac.jp>
parents:
95
diff
changeset
|
622 gFont_Draw_Reset(); |
119 | 623 |
624 // ここにgSprite_Init()があるのって良いのかな? | |
625 // gSprite_Init(); | |
3 | 626 } |