Mercurial > hg > Members > kono > tree_dandy2
annotate syokika.c @ 30:00ef8386edd6
scale_matrix does not work
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 25 Dec 2010 21:04:59 +0900 |
parents | 4c9c5cbd47c5 |
children |
rev | line source |
---|---|
0 | 1 #include <stdlib.h> |
2 #include <stdio.h> | |
3 #include <SDL.h> | |
4 #include "SDL_opengl.h" | |
5 #include "SDL_image.h" | |
6 #include <math.h> | |
7 #include "object.h" | |
8 #include "xml.h" | |
9 #include "tree_controll.h" | |
10 #include "count2.h" | |
11 #include "sgoex.h" | |
12 #include "sankaku.h" | |
13 #include "bom.h" | |
14 #include "sound.h" | |
15 #include "syokika.h" | |
16 #include "debug.h" | |
17 #include "LoadSprite.h" | |
18 | |
19 #define CHARACTER_FILE "xml/character.xml" | |
20 #define FONT_FILE "xml/font.xml" | |
21 #define EFFECT_FILE "xml/effect.xml" | |
22 #define BOSS_FILE "xml/boss.xml" | |
23 | |
2 | 24 extern void all_object_load_texture(OBJECT *top); |
0 | 25 //extern void init_sprite(TEXTURE * tex); |
26 //extern int LoadSprite(); | |
27 | |
28 #define SEED_VALUE 1 | |
29 | |
7 | 30 struct SDL_Surface *screen; |
31 | |
32 OBJECT *font; | |
33 OBJECT *chara; | |
34 OBJECT *effect; | |
35 OBJECT *boss; | |
36 | |
37 | |
0 | 38 void syokika(int argc, char *argv[]) |
39 { | |
7 | 40 int i; |
0 | 41 //volatile unsigned char *bb0, *bb1; |
42 int width = 740; | |
43 int height = 480; | |
44 Uint8 video_bpp = 32; | |
45 Uint32 videoflags; | |
46 | |
47 /* Initialize SDL */ | |
48 if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0 ) { | |
49 fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError()); | |
50 //return(1); | |
51 } | |
52 | |
53 for (i = 1; argv[i]; i++) { | |
54 if (strcmp(argv[i], "-width") == 0) { | |
55 width = atoi(argv[++i]); | |
56 } | |
57 if (strcmp(argv[i], "-height") == 0) { | |
58 height = atoi(argv[++i]); | |
59 } | |
60 if (strcmp(argv[i], "-bpp") == 0) { | |
61 video_bpp = atoi(argv[++i]); | |
62 } | |
63 } | |
64 | |
65 videoflags = SDL_OPENGL; | |
66 | |
67 SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 3 ); | |
68 SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 3 ); | |
69 SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 2 ); | |
70 //SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); | |
71 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); | |
72 | |
73 /* Set video mode */ | |
74 screen = SDL_SetVideoMode(width, height, video_bpp, videoflags); | |
75 if ( ! screen ) { | |
76 fprintf(stderr, "Couldn't set %dx%d video mode: %s\n", width, height, SDL_GetError()); | |
77 } | |
78 glClearColor( 0.0, 0.0, 0.0, 1.0 ); | |
79 glClear( GL_COLOR_BUFFER_BIT ); | |
80 | |
81 /*glViewport(0, 0, screen->w, screen->h); | |
82 glEnable(GL_TEXTURE_2D); | |
83 glDisable(GL_DEPTH_TEST); | |
84 glDisable(GL_CULL_FACE); | |
85 glOrtho(0.0, (GLdouble)screen->w, (GLdouble)screen->h, 0.0, 0.0, 1.0);*/ | |
86 | |
87 srand(SEED_VALUE); | |
88 | |
89 //LoadSprite(); | |
3 | 90 // sankakuf(); |
0 | 91 font = read_xml_3d_file(FONT_FILE); |
92 boss = read_xml_3d_file(BOSS_FILE); | |
93 chara = read_xml_3d_file(CHARACTER_FILE); | |
94 effect = read_xml_3d_file(EFFECT_FILE); | |
95 | |
96 all_object_load_texture(font); | |
97 all_object_load_texture(boss); | |
98 all_object_load_texture(chara); | |
99 all_object_load_texture(effect); | |
7 | 100 init_sprite(font, boss, chara, effect); |
6
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
101 } |
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
102 |
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
103 void |
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
104 init_sprite(OBJECT *font, OBJECT *boss, OBJECT *chara, OBJECT *effect) |
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
105 { |
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
106 int i, i2; |
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
107 |
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
108 laser_lv3[0].r = 62; |
6541f0bebb81
cerium redering engine main routine.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
109 laser_lv3[0].r = 62; |
0 | 110 |
111 /* | |
112 for (i = 0; i < BOX_NUM; i++) { | |
113 boxdt[i].x = rand() % 320; | |
114 boxdt[i].y = rand() % 240; | |
115 boxdt[i].s = i % 5 + 1; | |
116 } | |
117 */ | |
118 for (i2 = 0; i2 < 3; i2++) { | |
119 tlv3[i2].y = -1; | |
120 } | |
121 | |
122 for (i = 0; i < 50; i++) | |
123 bchar[i].no = 8; | |
124 | |
125 /** | |
126 * 1引数:キャラクターナンバー; | |
127 * 2引数:キャラクタ名; | |
128 * 3引数:幅 | |
129 * 4引数:高さ | |
130 * 5引数:カラー- 480のままでよろし | |
131 * 6引数:OBJECT構造体のポインタを渡す | |
132 * 下書き直し | |
133 */ | |
134 DefSprite(PLAYER_IDLE, "player_idle", 128, 128, 480, chara); | |
135 DefSprite(PLAYER_LEFTMOVE, "player_leftmove", 128, 128, 480, chara); | |
136 DefSprite(PLAYER_TURNTOLEFT, "player_turntoleft", 128, 128, 480, chara); | |
137 | |
138 DefSprite(PLAYER_TURNTORIGHT, "player_turntoright", 128, 128, 480, chara); | |
139 //DefSprite(PLAYER_RIGHTMOVE, 1, 480, chara); | |
140 DefSprite(PLAYER_RIGHTMOVE, "player_rightmove", 128, 128, 480, chara); | |
141 DefSprite(BLUEBULLET_LEFT, "bulebullet_left", 45, 128, 480, effect); | |
142 DefSprite(BLUEBULLET_RIGHT, "blebullet_right", 38, 128, 480, effect); | |
143 DefSprite(REDBULLET, "redbullet", 128, 256, 480, effect); | |
144 DefSprite(LONGLASER, "longlaser", 64, 256, 480, effect); | |
145 DefSprite(GAUGE_PANEL, "gauge_panel", 128, 512, 480, effect); | |
146 DefSprite(OFFENSIVEPOWER_GAUGE, "offensivepower_gauge", 27, 220, 480, effect); | |
147 DefSprite(BURNER, "burner", 63, 122, 480, effect); | |
148 DefSprite(LOCKON_SIGHT, "lockon_sight", 64, 64, 480, effect); | |
149 //DefSprite(SPECIAL_LASERGAUGE, "special_lasergauge", 0, 0, 480, effect); | |
150 DefSprite(DIFFENSIVEPOWER_GAUGE, "diffensivepower_gauge", 20, 215, 480, effect); | |
151 DefSprite(GREENBULLET, "greenbullet", 128, 128, 480, effect); | |
152 DefSprite(BULEBARRIER, "bulebarrier", 128, 128, 480, effect); | |
12 | 153 DefSprite(FONT_PLAYER_1, "font_player_1", 128, 32, 480, font); |
0 | 154 //DefSprite(FONT_GAMEOVER, "font_gameover", 256, 32, 480, font); |
155 DefSprite(FONT_0, "font_0", 32, 32, 480, font); | |
156 DefSprite(FONT_1, "font_1", 32, 32, 480, font); | |
157 DefSprite(FONT_2, "font_2", 32, 32, 480, font); | |
158 DefSprite(FONT_3, "font_3", 32, 32, 480, font); | |
159 DefSprite(FONT_4, "font_4", 32, 32, 480, font); | |
160 DefSprite(FONT_5, "font_5", 32, 32, 480, font); | |
161 DefSprite(FONT_6, "font_6", 32, 32, 480, font); | |
162 DefSprite(FONT_7, "font_7", 32, 32, 480, font); | |
163 DefSprite(FONT_8, "font_8", 32, 32, 480, font); | |
164 DefSprite(FONT_9, "font_9", 32, 32, 480, font); | |
165 DefSprite(REDBOMB_ANIM_0, "redbomb_anim_0", 64, 64, 480, effect); | |
166 DefSprite(REDBOMB_ANIM_1, "redbomb_anim_1", 64, 64, 480, effect); | |
167 DefSprite(REDBOMB_ANIM_2, "redbomb_anim_2", 64, 64, 480, effect); | |
168 DefSprite(REDBOMB_ANIM_3, "redbomb_anim_3", 64, 64, 480, effect); | |
169 DefSprite(REDBOMB_ANIM_4, "redbomb_anim_4", 64, 64, 480, effect); | |
170 DefSprite(REDBOMB_ANIM_5, "redbomb_anim_5", 64, 64, 480, effect); | |
171 DefSprite(REDBOMB_ANIM_6, "redbomb_anim_6", 64, 64, 480, effect); | |
172 DefSprite(REDBOMB_ANIM_7, "redbomb_anim_7", 64, 64, 480, effect); | |
173 DefSprite(FONT_HIGE, "font_hige", 128, 32, 480, font); | |
174 DefSprite(GREENBOMB_ANIM_0, "greenbomb_anim_0", 64, 64, 480, effect); | |
175 DefSprite(GREENBOMB_ANIM_1, "greenbomb_anim_1", 64, 64, 480, effect); | |
176 DefSprite(GREENBOMB_ANIM_2, "greenbomb_anim_2", 64, 64, 480, effect); | |
177 //DefSprite(GREENBOMB_ANIM_3, "greenbomb_anim_3", 64, 64, 480, effect); | |
178 DefSprite(GREENBOMB_ANIM_4, "greenbomb_anim_4", 64, 64, 480, effect); | |
179 DefSprite(GREENBOMB_ANIM_5, "greenbomb_anim_5", 64, 64, 480, effect); | |
180 DefSprite(GREENBOMB_ANIM_6, "greenbomb_anim_6", 64, 64, 480, effect); | |
181 DefSprite(GREENBOMB_ANIM_7, "greenbomb_anim_7", 64, 64, 480, effect); | |
182 DefSprite(INFLATION_GAUGE, "inflation_gauge", 64, 512, 480, effect); | |
183 DefSprite(INFLATION_METER, "inflation_meter", 32, 512, 480, effect); | |
184 DefSprite(ENEMY_GREENCRAB, "enemy_greenclab", 128, 128, 480, chara); | |
185 DefSprite(ENEMY_PLANE, "enemy_plane", 128, 128, 480, chara); | |
186 DefSprite(ENEMY_REDBULLET, "enemy_redbullet", 32, 32, 480, effect); | |
187 DefSprite(FONT_PUSHSTART, "font_pushstart", 512, 32, 480, font); | |
188 DefSprite(BOSS1_ORGAN, "boss1_organ", 128, 256, 480, boss); | |
189 DefSprite(ENEMY_LASER, "enemy_laser", 64, 251, 480, effect); | |
190 DefSprite(ENEMY_BLUEBULLET, "enemy_bluebullet", 36, 28, 480, effect); | |
191 DefSprite(ENEMY_LIGHTNING, "enemy_lightning", 64, 252, 480, effect); | |
192 DefSprite(ENEMY_LASERSPLOSH_0, "enemy_lasersplosh_0", 126, 127, 480, effect); | |
193 DefSprite(ENEMY_LASERSPLOSH_1, "enemy_lasersplosh_1", 124, 119, 480, effect); | |
194 DefSprite(ENEMY_LASERSPLOSH_2, "enemy_lasersplosh_2", 126, 127, 480, effect); | |
195 DefSprite(ENEMY_LASERSPLOSH_3, "enemy_lasersplosh_3", 112, 102, 480, effect); | |
196 DefSprite(ASTEROID, "meteo", 128, 128, 480, chara); //inseki | |
197 DefSprite(ORBITMACHINE, "orbitmachine", 128, 64, 480, chara); //inseki no shita maruiyatsu | |
198 DefSprite(BOSS2_BODY, "boss2_body", 512, 512, 480, boss); | |
199 DefSprite(BOSS2_RIGHTSHOULDER, "boss2_rightshoulder", 256, 256, 480, boss); | |
200 DefSprite(BOSS2_LEFTSHOULDER, "boss2_leftshoulder", 256, 256, 480, boss); | |
201 DefSprite(BOSS2_RIGHTARM, "boss2_rightarm", 128, 256, 480, boss); | |
202 DefSprite(BOSS2_LEFTARM, "boss2_leftarm", 128, 256, 480, boss); | |
203 DefSprite(BOSS2_BATTERY, "boss2_battery", 128, 128, 480, boss); | |
204 DefSprite(BOSS2_OPENBATTERY, "boss2_openbattery", 256, 128, 480, boss); | |
205 DefSprite(BOSS2_BROKENHATCH, "boss2_brokenhatch", 128, 64, 480, boss); | |
206 DefSprite(BOSS2_DUMMY, "boss2_dummy", 128, 64, 480, boss); | |
207 DefSprite(BOSS2_RIGHTSHOULDERUP, "boss2_r_shoulderup", 256, 128, 480, boss); | |
208 DefSprite(BOSS2_LEFTSHOULDERUP, "boss2_left_s_up", 256, 128, 480, boss); | |
209 DefSprite(BOSS2_LEFTSHOULDERGIRD, "boss2_left_s_gird", 256, 256, 480, boss); | |
210 DefSprite(BOSS2_RIGHTARMBATTERY, "boss2_rightarm_b", 64, 64, 480, boss); | |
211 DefSprite(BOSS2_LEFTARMBATTERY, "boss2_leftarmbattery", 64, 64, 480, boss); | |
212 DefSprite(BOSS2_RIGHTHAND, "boss2_righthand", 64, 64, 480, boss); | |
213 DefSprite(BOSS2_RIGHTPALM, "boss2_rightpalm", 64, 64, 480, boss); | |
214 DefSprite(BOSS2_LEFTHAND, "boss2_lefthand", 64, 64, 480, boss); | |
215 DefSprite(BOSS2_LEFTPALM, "boss2_leftpalm", 64, 64, 480, boss); | |
216 DefSprite(PLAYER_LASERSPLOSH_0, "player_lasersplosh_0", 115, 91, 480, effect); | |
217 DefSprite(PLAYER_LASERSPLOSH_1, "player_lasersplosh_1", 133, 121, 480, effect); | |
218 DefSprite(PLAYER_LASERSPLOSH_2, "player_lasersplosh_2", 135, 119, 480, effect); | |
219 DefSprite(PLAYER_LASERSPLOSH_3, "player_lasersplosh_3", 131, 120, 480, effect); | |
220 DefSprite(BOSS_POWERGAUGE, "boss_powergauge", 69, 762, 480, effect); | |
221 DefSprite(BLACKHOLE, "blackhole", 128, 128, 480, boss); | |
222 DefSprite(FONT_DOYOUCONTINUE, "font_doyoucontinue", 512, 32, 480, font); | |
223 DefSprite(FONT_ALLSTAGECLEAR, "font_allstageclear", 512, 32, 480, font); | |
224 DefSprite(FONT_REST, "font_rest", 128, 32, 480, font); | |
225 DefSprite(FONT_STAGE, "font_stage", 256, 32, 480, font); | |
226 DefSprite(FONT_LINEOFZERO_000000, "font_000000", 256, 32, 480, font); | |
227 DefSprite(FONT_LINEOFZERO_0000000, "font_0000000", 256, 32, 480, font); | |
228 DefSprite(FONT_THANKYOU, "font_thankyou", 512, 32, 480, font); | |
229 DefSprite(FONT_NYSOFT, "font_nysoft", 512, 32, 480, font); | |
230 DefSprite(FONT_1997YGGDRASIL, "font_1997yggdrasil", 512, 32, 480, font); | |
231 DefSprite(FONT_SUPERDANDY, "font_superdandy", 256, 64, 480, font); | |
232 DefSprite(FONT_1997YAS_K, "font_1997yas_k", 512, 32, 480, font); | |
233 DefSprite(GUNBATTERY, "gunbattery", 128, 128, 480, chara); | |
234 DefSprite(PURPLECORE, "purplecore", 128, 128, 480, chara); | |
235 DefSprite(SPACEFISH, "spacefish", 128, 128, 480, chara); | |
236 DefSprite(MISSILE, "missile", 64, 128, 480, chara); | |
237 DefSprite(BOSS3_BODY, "boss3_body", 256, 256, 480, boss); | |
238 DefSprite(BODD4_BODY, "boss_4", 256, 256, 480, boss); | |
239 DefSprite(TITLEFONT_SUPER, "titlefont_super", 256, 256, 480, font); | |
240 DefSprite(TITLEFONT_BATTLE, "titlefont_battle", 256, 256, 480, font); | |
241 DefSprite(TITLEFONT_EMPEROR, "titlefont_emperor", 256, 256, 480, font); | |
242 DefSprite(GREENBARRIER, "greenbarrier", 130, 133, 480, effect); | |
243 DefSprite(REMAINDER, "remainder", 126, 34, 480, effect); | |
244 DefSprite(EARTH, "earth", 256, 256, 480, chara); | |
245 DefSprite(BOSS_CORPSE, "boss_corpse", 64, 256, 480, boss); | |
246 | |
247 /* | |
248 for (i = 0; i < 12; i++) { | |
249 DefSprite(211 - i, 1, 0, 128 + i * 8, 16, 8, 480); | |
250 } | |
251 */ | |
252 //rank | |
253 | |
254 DefSprite(211, "rank_c_mins", 64, 32, 480, font); | |
255 DefSprite(210, "rank_c", 64, 32, 480, font); | |
256 DefSprite(209, "rank_c_pla", 64, 32, 480, font); | |
257 DefSprite(208, "rank_b_mins", 64, 32, 480, font); | |
258 DefSprite(207, "rank_b", 64, 32, 480, font); | |
259 DefSprite(206, "rank_b_pla", 64, 32, 480, font); | |
260 DefSprite(205, "rank_a_mins", 64, 32, 480, font); | |
261 DefSprite(204, "rank_a", 64, 32, 480, font); | |
262 DefSprite(203, "rank_a_pla", 64, 32, 480, font); | |
263 DefSprite(202, "rank_s", 64, 32, 480, font); | |
264 | |
265 } |