OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Commit Details
Date: | 2011-02-13 20:08:08 (13 years 1 month ago) |
---|---|
Author: | kyak |
Commit: | 8be517484d807f9652483b680b3252940111a398 |
Message: | supertux: initial port Credits go to OE recipy! |
Files: |
supertux/Makefile (1 diff) supertux/files/img-resize.sh (1 diff) supertux/files/supertux-smallsize-data.tar.bz2 (0 diffs) supertux/patches/001-gp2x.patch (1 diff) supertux/patches/002-compilation-fixes.patch (1 diff) supertux/patches/003-install-no-overwrite.patch (1 diff) supertux/patches/004-extra-qualification.patch (1 diff) |
Change Details
supertux/Makefile | ||
---|---|---|
1 | # | |
2 | # This is free software, licensed under the GNU General Public License v2. | |
3 | # | |
4 | ||
5 | include $(TOPDIR)/rules.mk | |
6 | ||
7 | PKG_NAME:=supertux | |
8 | PKG_VERSION:=0.1.3 | |
9 | PKG_RELEASE:=1 | |
10 | ||
11 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 | |
12 | PKG_SOURCE_URL:=http://download.berlios.de/$(PKG_NAME)/ | |
13 | PKG_MD5SUM:=f2fc288459f33d5cd8f645fbca737a63 | |
14 | ||
15 | include $(INCLUDE_DIR)/package.mk | |
16 | ||
17 | define Package/supertux | |
18 | TITLE:=supertux | |
19 | SECTION:=games | |
20 | CATEGORY:=Games | |
21 | URL:=http://supertux.lethargik.org | |
22 | DEPENDS:=+libsdl +libsdl-image +libmikmod | |
23 | endef | |
24 | ||
25 | define Package/supertux/description | |
26 | SuperTux is a classic 2D jump'n run sidescroller game in a style similar to the original Super Mario games covered under the GPL. | |
27 | endef | |
28 | ||
29 | CONFIGURE_ARGS+=--disable-opengl \ | |
30 | --disable-sdltest \ | |
31 | --with-sdl-prefix=$(STAGING_DIR)/usr \ | |
32 | --enable-320x240 | |
33 | ||
34 | TARGET_LDFLAGS+=-Wl,-rpath-link=$(STAGING_DIR)/usr/lib | |
35 | ||
36 | define Build/Configure | |
37 | ( cd $(PKG_BUILD_DIR) ; ./autogen.sh ) | |
38 | $(call Build/Configure/Default) | |
39 | endef | |
40 | ||
41 | define Build/Prepare | |
42 | $(call Build/Prepare/Default) | |
43 | (\ | |
44 | bzip2 -dc $(FILES_DIR)/supertux-smallsize-data.tar.bz2 | $(TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xf -; \ | |
45 | $(CP) $(FILES_DIR)/img-resize.sh $(PKG_BUILD_DIR); \ | |
46 | cd $(PKG_BUILD_DIR); \ | |
47 | for i in background shared tilesets title worldmap; do \ | |
48 | echo "Converting images in ${PKG_BUILD_DIR}/data/images/$$$$i..."; \ | |
49 | cd ${PKG_BUILD_DIR}/data/images/$$$$i; \ | |
50 | sh ${PKG_BUILD_DIR}/img-resize.sh; \ | |
51 | done; \ | |
52 | ) | |
53 | endef | |
54 | ||
55 | define Package/supertux/install | |
56 | $(INSTALL_DIR) \ | |
57 | $(1)/usr/bin/ \ | |
58 | $(1)/usr/share/supertux/{images,levels,music,sounds} \ | |
59 | ||
60 | $(INSTALL_BIN) \ | |
61 | $(PKG_BUILD_DIR)/src/supertux \ | |
62 | $(1)/usr/bin/ | |
63 | ||
64 | $(CP) \ | |
65 | $(PKG_BUILD_DIR)/data/{images,levels,music,sounds,supertux.strf,*.txt} \ | |
66 | $(1)/usr/share/supertux | |
67 | endef | |
68 | ||
69 | $(eval $(call RequireCommand,pngcrush,Please install pngcrush.)) | |
70 | $(eval $(call RequireCommand,convert,Please install imagemagick.)) | |
71 | $(eval $(call BuildPackage,supertux)) |
supertux/files/img-resize.sh | ||
---|---|---|
1 | #!/bin/sh | |
2 | ||
3 | conv() { | |
4 | ||
5 | if [ ! -d org ]; then | |
6 | mkdir org | |
7 | mv *.jpg *.png org/ | |
8 | fi | |
9 | ||
10 | for i in org/*; do | |
11 | b=`basename $i` | |
12 | ext=`expr "x$b" : 'x.*\.\(.*\)'` | |
13 | if [ "$ext" = "png" ]; then | |
14 | if [ $b = "tux-life.png" ]; then | |
15 | cp $i _.png | |
16 | else | |
17 | convert $i -resize 50% _.png | |
18 | fi | |
19 | pngcrush -q _.png $b | |
20 | elif [ "$ext" = "jpg" ]; then | |
21 | convert $i -resize 50% -quality 60 $b | |
22 | fi | |
23 | done | |
24 | rm _.png | |
25 | ||
26 | } | |
27 | ||
28 | conv |
supertux/files/supertux-smallsize-data.tar.bz2 |
---|
supertux/patches/001-gp2x.patch | ||
---|---|---|
1 | Only in supertux-0.1.3: aclocal.m4 | |
2 | diff -ur supertux-0.1.3/AUTHORS supertux-0.1.3-gp2x/AUTHORS | |
3 | --- supertux-0.1.3/AUTHORS 2005-07-02 14:37:30.000000000 +0300 | |
4 | @@ -91,6 +91,12 @@ | |
5 | ||
6 | Royalty free CDROMs and FTP sites sounds | |
7 | ||
8 | +Port to GP2X | |
9 | +----------- | |
10 | + Ingo Arndt | |
11 | + scachi@gmx.de | |
12 | + http://www.bitmage.de | |
13 | + | |
14 | More information and contacts | |
15 | ============================= | |
16 | ||
17 | Only in supertux-0.1.3: autom4te.cache | |
18 | Only in supertux-0.1.3-gp2x: autoscan.log | |
19 | Only in supertux-0.1.3-gp2x: COMPILE4GP2X | |
20 | Only in supertux-0.1.3: config.guess | |
21 | Only in supertux-0.1.3: config.log | |
22 | Only in supertux-0.1.3: config.status | |
23 | Only in supertux-0.1.3: config.sub | |
24 | Only in supertux-0.1.3: configure | |
25 | diff -ur supertux-0.1.3/configure.ac supertux-0.1.3-gp2x/configure.ac | |
26 | --- supertux-0.1.3/configure.ac 2005-07-06 12:26:15.000000000 +0300 | |
27 | @@ -76,13 +76,33 @@ | |
28 | CFLAGS="$CFLAGS $SDL_CFLAGS" | |
29 | LIBS="$LIBS $SDL_LIBS" | |
30 | ||
31 | +AM_PATH_LIBMIKMOD(, | |
32 | + :, | |
33 | + AC_MSG_ERROR([*** mikmod not found!])) | |
34 | +CXXFLAGS="$CXXFLAGS $LIBMIKMOD_CFLAGS" | |
35 | +CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS" | |
36 | +LIBS="$LIBS $LIBMIKMOD_LIBS" | |
37 | + | |
38 | dnl Checks for additional libraries. | |
39 | +AC_CHECK_LIB(smpeg, SMPEG_status) | |
40 | + | |
41 | +AC_CHECK_LIB(mikmod, MikMod_Init) | |
42 | + | |
43 | AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,, | |
44 | AC_MSG_ERROR([SDL_mixer library required])) | |
45 | ||
46 | +AC_CHECK_LIB(jpeg,jpeg_abort) | |
47 | + | |
48 | +AC_CHECK_LIB(z,compress) | |
49 | + | |
50 | +AC_CHECK_LIB(png,png_free) | |
51 | + | |
52 | AC_CHECK_LIB(SDL_image, IMG_Load,, | |
53 | AC_MSG_ERROR([SDL_image library required])) | |
54 | ||
55 | +AC_CHECK_LIB(SDL_gfx, rotozoomSurface,, | |
56 | + AC_MSG_ERROR([SDL_gfx library required])) | |
57 | + | |
58 | if test "x${enable_opengl}" != "xno"; then | |
59 | AX_CHECK_GL | |
60 | fi | |
61 | @@ -95,7 +115,30 @@ | |
62 | LIBS="$LIBS $GL_LIBS" | |
63 | fi | |
64 | ||
65 | -AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing])) | |
66 | +# compile for the testing the 320x240 resolution | |
67 | +# compile for the gp2x | |
68 | +AC_ARG_ENABLE(gp2x, | |
69 | +[ --enable-gp2x Build the gp2x version [default=no]], | |
70 | + , enable_gp2x=no) | |
71 | +if test x$enable_gp2x = xyes; then | |
72 | + CXXFLAGS="$CXXFLAGS -DGP2X" | |
73 | +fi | |
74 | + | |
75 | +AC_ARG_ENABLE(320x240, | |
76 | +[ --enable-320x240 Test the 320x240 resolution [default=no]], | |
77 | + , enable_320x240=no) | |
78 | +if test x$enable_320x240 = xyes; then | |
79 | + CXXFLAGS="$CXXFLAGS -DRES320X240" | |
80 | +fi | |
81 | + | |
82 | +# compile static | |
83 | +AC_ARG_ENABLE(static, | |
84 | +[ --enable-static Build the static version [default=no]], | |
85 | + , enable_static=no) | |
86 | +if test x$enable_static = xyes; then | |
87 | + CXXFLAGS="$CXXFLAGS -static" | |
88 | +fi | |
89 | + | |
90 | ||
91 | CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux\"'" | |
92 | ||
93 | @@ -110,6 +153,9 @@ | |
94 | echo " Profile Mode: $enable_gprof" | |
95 | echo " Debug Mode: $enable_debug" | |
96 | echo " OpenGL Support: $enable_opengl" | |
97 | +echo " 320x240 Resolution: $enable_320x240" | |
98 | +echo " GP2X Build (+320x240): $enable_gp2x" | |
99 | +echo " Static Build: $enable_static" | |
100 | echo "" | |
101 | ||
102 | # EOF # | |
103 | Only in supertux-0.1.3/data: CREDITS | |
104 | Only in supertux-0.1.3/data: extro-bonus2.txt | |
105 | Only in supertux-0.1.3/data: extro-bonus.txt | |
106 | Only in supertux-0.1.3/data: extro.txt | |
107 | Only in supertux-0.1.3/data: images | |
108 | Only in supertux-0.1.3/data: intro.txt | |
109 | Only in supertux-0.1.3/data: levels | |
110 | Only in supertux-0.1.3/data: Makefile | |
111 | Only in supertux-0.1.3/data: Makefile.in | |
112 | Only in supertux-0.1.3/data: music | |
113 | Only in supertux-0.1.3/data: sounds | |
114 | Only in supertux-0.1.3/data: supertux.strf | |
115 | Only in supertux-0.1.3: depcomp | |
116 | Only in supertux-0.1.3: install-sh | |
117 | Only in supertux-0.1.3: m4 | |
118 | Only in supertux-0.1.3: Makefile | |
119 | Only in supertux-0.1.3: Makefile.in | |
120 | Only in supertux-0.1.3: missing | |
121 | Only in supertux-0.1.3: mkinstalldirs | |
122 | Only in supertux-0.1.3: patches | |
123 | diff -ur supertux-0.1.3/src/badguy.cpp supertux-0.1.3-gp2x/src/badguy.cpp | |
124 | --- supertux-0.1.3/src/badguy.cpp 2005-06-22 00:16:07.000000000 +0300 | |
125 | @@ -250,7 +250,11 @@ | |
126 | tux.kick_timer.start(KICKING_TIME); | |
127 | set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); | |
128 | physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5); | |
129 | +#ifndef GP2X | |
130 | play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER); | |
131 | +#else | |
132 | + play_chunk(SND_KICK); | |
133 | +#endif | |
134 | } | |
135 | } | |
136 | ||
137 | @@ -260,6 +264,7 @@ | |
138 | check_horizontal_bump(); | |
139 | if(mode == KICK && changed != dir) | |
140 | { | |
141 | +#ifndef GP2X | |
142 | /* handle stereo sound (number 10 should be tweaked...)*/ | |
143 | if (base.x < scroll_x + screen->w/2 - 10) | |
144 | play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER); | |
145 | @@ -267,6 +272,9 @@ | |
146 | play_sound(sounds[SND_RICOCHET], SOUND_RIGHT_SPEAKER); | |
147 | else | |
148 | play_sound(sounds[SND_RICOCHET], SOUND_CENTER_SPEAKER); | |
149 | +#else | |
150 | + play_chunk(SND_RICOCHET); | |
151 | +#endif | |
152 | } | |
153 | } | |
154 | ||
155 | @@ -455,11 +463,15 @@ | |
156 | ||
157 | /* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates... | |
158 | if (base.x < scroll_x + screen->w/2 - 10) | |
159 | +#ifndef GP2X | |
160 | play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER); | |
161 | else if (base.x > scroll_x + screen->w/2 + 10) | |
162 | play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER); | |
163 | else | |
164 | play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER); | |
165 | +#else | |
166 | + play_chunk(SND_EXPLODE); | |
167 | +#endif | |
168 | ||
169 | } else if(mode == BOMB_EXPLODE) { | |
170 | remove_me(); | |
171 | @@ -677,13 +689,21 @@ | |
172 | } | |
173 | ||
174 | // BadGuy fall below the ground | |
175 | +#ifndef RES320X240 | |
176 | if (base.y > screen->h) { | |
177 | +#else | |
178 | + if (base.y > 640) { | |
179 | +#endif | |
180 | remove_me(); | |
181 | return; | |
182 | } | |
183 | ||
184 | // Once it's on screen, it's activated! | |
185 | +#ifndef RES320X240 | |
186 | if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE) | |
187 | +#else | |
188 | + if (base.x <= scroll_x + 640 + OFFSCREEN_DISTANCE) | |
189 | +#endif | |
190 | seen = true; | |
191 | ||
192 | if(!seen) | |
193 | @@ -743,7 +763,11 @@ | |
194 | BadGuy::draw() | |
195 | { | |
196 | // Don't try to draw stuff that is outside of the screen | |
197 | +#ifndef RES320X240 | |
198 | if(base.x <= scroll_x - base.width || base.x >= scroll_x + screen->w) | |
199 | +#else | |
200 | + if(base.x <= scroll_x - base.width || base.x >= scroll_x + 640) | |
201 | +#endif | |
202 | return; | |
203 | ||
204 | if(sprite_left == 0 || sprite_right == 0) | |
205 | @@ -811,7 +835,11 @@ | |
206 | ||
207 | World::current()->add_score(base.x - scroll_x, | |
208 | base.y, 50 * player_status.score_multiplier); | |
209 | +#ifndef GP2X | |
210 | play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); | |
211 | +#else | |
212 | + play_chunk(SND_SQUISH); | |
213 | +#endif | |
214 | player_status.score_multiplier++; | |
215 | ||
216 | dying = DYING_SQUISHED; | |
217 | @@ -830,7 +858,11 @@ | |
218 | ||
219 | player->jump_of_badguy(this); | |
220 | World::current()->add_score(base.x - scroll_x, base.y, 50 * player_status.score_multiplier); | |
221 | +#ifndef GP2X | |
222 | play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); | |
223 | +#else | |
224 | + play_chunk(SND_SQUISH); | |
225 | +#endif | |
226 | player_status.score_multiplier++; | |
227 | remove_me(); | |
228 | return; | |
229 | @@ -839,7 +871,11 @@ | |
230 | if (mode == NORMAL || mode == KICK) | |
231 | { | |
232 | /* Flatten! */ | |
233 | +#ifndef GP2X | |
234 | play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER); | |
235 | +#else | |
236 | + play_chunk(SND_STOMP); | |
237 | +#endif | |
238 | mode = FLAT; | |
239 | set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); | |
240 | physic.set_velocity_x(0); | |
241 | @@ -847,7 +883,11 @@ | |
242 | timer.start(4000); | |
243 | } else if (mode == FLAT) { | |
244 | /* Kick! */ | |
245 | +#ifndef GP2X | |
246 | play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); | |
247 | +#else | |
248 | + play_chunk(SND_KICK); | |
249 | +#endif | |
250 | ||
251 | if (player->base.x < base.x + (base.width/2)) { | |
252 | physic.set_velocity_x(5); | |
253 | @@ -925,7 +965,11 @@ | |
254 | score * player_status.score_multiplier); | |
255 | ||
256 | /* Play death sound: */ | |
257 | +#ifndef GP2X | |
258 | play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); | |
259 | +#else | |
260 | + play_chunk(SND_FALL); | |
261 | +#endif | |
262 | } | |
263 | ||
264 | void BadGuy::explode(BadGuy *badguy) | |
265 | @@ -1053,7 +1097,11 @@ | |
266 | /* Get kicked if were flat */ | |
267 | if (mode == FLAT && !dying) | |
268 | { | |
269 | +#ifndef GP2X | |
270 | play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); | |
271 | +#else | |
272 | + play_chunk(SND_KICK); | |
273 | +#endif | |
274 | ||
275 | // Hit from left side | |
276 | if (player->base.x < base.x) { | |
277 | diff -ur supertux-0.1.3/src/configfile.cpp supertux-0.1.3-gp2x/src/configfile.cpp | |
278 | --- supertux-0.1.3/src/configfile.cpp 2005-06-22 00:16:07.000000000 +0300 | |
279 | @@ -92,12 +92,22 @@ | |
280 | else | |
281 | use_joystick = true; | |
282 | ||
283 | +#ifndef GP2X | |
284 | reader.read_int ("joystick-x", &joystick_keymap.x_axis); | |
285 | reader.read_int ("joystick-y", &joystick_keymap.y_axis); | |
286 | reader.read_int ("joystick-a", &joystick_keymap.a_button); | |
287 | reader.read_int ("joystick-b", &joystick_keymap.b_button); | |
288 | reader.read_int ("joystick-start", &joystick_keymap.start_button); | |
289 | reader.read_int ("joystick-deadzone", &joystick_keymap.dead_zone); | |
290 | +#else | |
291 | + reader.read_int ("joystick-up", &joystick_keymap.up_button); | |
292 | + reader.read_int ("joystick-down", &joystick_keymap.down_button); | |
293 | + reader.read_int ("joystick-right", &joystick_keymap.right_button); | |
294 | + reader.read_int ("joystick-left", &joystick_keymap.left_button); | |
295 | + reader.read_int ("joystick-a", &joystick_keymap.a_button); | |
296 | + reader.read_int ("joystick-b", &joystick_keymap.b_button); | |
297 | + reader.read_int ("joystick-start", &joystick_keymap.start_button); | |
298 | +#endif | |
299 | ||
300 | reader.read_int ("keyboard-jump", &keymap.jump); | |
301 | reader.read_int ("keyboard-duck", &keymap.duck); | |
302 | @@ -130,12 +140,22 @@ | |
303 | fprintf(config, "\n\t;; joystick number (-1 means no joystick):\n"); | |
304 | fprintf(config, "\t(joystick %d)\n", use_joystick ? joystick_num : -1); | |
305 | ||
306 | +#ifndef GP2X | |
307 | fprintf(config, "\t(joystick-x %d)\n", joystick_keymap.x_axis); | |
308 | fprintf(config, "\t(joystick-y %d)\n", joystick_keymap.y_axis); | |
309 | fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button); | |
310 | fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button); | |
311 | fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button); | |
312 | fprintf(config, "\t(joystick-deadzone %d)\n", joystick_keymap.dead_zone); | |
313 | +#else | |
314 | + fprintf(config, "\t(joystick-up %d)\n", joystick_keymap.up_button); | |
315 | + fprintf(config, "\t(joystick-down %d)\n", joystick_keymap.down_button); | |
316 | + fprintf(config, "\t(joystick-right %d)\n", joystick_keymap.right_button); | |
317 | + fprintf(config, "\t(joystick-left %d)\n", joystick_keymap.left_button); | |
318 | + fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button); | |
319 | + fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button); | |
320 | + fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button); | |
321 | +#endif | |
322 | ||
323 | fprintf(config, "\t(keyboard-jump %d)\n", keymap.jump); | |
324 | fprintf(config, "\t(keyboard-duck %d)\n", keymap.duck); | |
325 | diff -ur supertux-0.1.3/src/defines.h supertux-0.1.3-gp2x/src/defines.h | |
326 | --- supertux-0.1.3/src/defines.h 2005-07-07 02:05:03.000000000 +0300 | |
327 | @@ -91,7 +91,11 @@ | |
328 | ||
329 | /* Scrolling text speed */ | |
330 | ||
331 | +#ifndef RES320X240 | |
332 | #define SCROLL_SPEED_CREDITS 1.2 | |
333 | +#else | |
334 | +#define SCROLL_SPEED_CREDITS 2.4 | |
335 | +#endif | |
336 | #define SCROLL_SPEED_MESSAGE 1.0 | |
337 | ||
338 | /* Debugging */ | |
339 | Only in supertux-0.1.3/src: .deps | |
340 | diff -ur supertux-0.1.3/src/gameloop.cpp supertux-0.1.3-gp2x/src/gameloop.cpp | |
341 | --- supertux-0.1.3/src/gameloop.cpp 2005-07-02 15:16:08.000000000 +0300 | |
342 | @@ -288,6 +288,7 @@ | |
343 | ||
344 | switch(event.type) | |
345 | { | |
346 | +#ifndef GP2X | |
347 | case SDL_QUIT: /* Quit event - quit: */ | |
348 | st_abort("Received window close", ""); | |
349 | break; | |
350 | @@ -434,22 +435,60 @@ | |
351 | tux.input.down = UP; | |
352 | } | |
353 | break; | |
354 | - | |
355 | +#endif | |
356 | case SDL_JOYBUTTONDOWN: | |
357 | +#ifndef GP2X | |
358 | + if (event.jbutton.button == joystick_keymap.a_button) | |
359 | + tux.input.up = DOWN; | |
360 | + else if (event.jbutton.button == joystick_keymap.b_button) | |
361 | + tux.input.fire = DOWN; | |
362 | + else if (event.jbutton.button == joystick_keymap.start_button) | |
363 | + on_escape_press(); | |
364 | + break; | |
365 | +#else | |
366 | if (event.jbutton.button == joystick_keymap.a_button) | |
367 | tux.input.up = DOWN; | |
368 | else if (event.jbutton.button == joystick_keymap.b_button) | |
369 | tux.input.fire = DOWN; | |
370 | else if (event.jbutton.button == joystick_keymap.start_button) | |
371 | on_escape_press(); | |
372 | + else if (event.jbutton.button == joystick_keymap.up_button) | |
373 | + tux.input.up = DOWN; | |
374 | + else if (event.jbutton.button == joystick_keymap.down_button) | |
375 | + tux.input.down = DOWN; | |
376 | + else if (event.jbutton.button == joystick_keymap.right_button) | |
377 | + tux.input.right = DOWN; | |
378 | + else if (event.jbutton.button == joystick_keymap.left_button) | |
379 | + tux.input.left = DOWN; | |
380 | + else if (event.jbutton.button == joystick_keymap.voldown_button) | |
381 | + decreaseSoundVolume(); | |
382 | + else if (event.jbutton.button == joystick_keymap.volup_button) | |
383 | + increaseSoundVolume(); | |
384 | break; | |
385 | +#endif | |
386 | + | |
387 | case SDL_JOYBUTTONUP: | |
388 | +#ifndef GP2X | |
389 | if (event.jbutton.button == joystick_keymap.a_button) | |
390 | tux.input.up = UP; | |
391 | else if (event.jbutton.button == joystick_keymap.b_button) | |
392 | tux.input.fire = UP; | |
393 | break; | |
394 | - | |
395 | +#else | |
396 | + if (event.jbutton.button == joystick_keymap.a_button) | |
397 | + tux.input.up = UP; | |
398 | + else if (event.jbutton.button == joystick_keymap.b_button) | |
399 | + tux.input.fire = UP; | |
400 | + else if (event.jbutton.button == joystick_keymap.up_button) | |
401 | + tux.input.up = UP; | |
402 | + else if (event.jbutton.button == joystick_keymap.down_button) | |
403 | + tux.input.down = UP; | |
404 | + else if (event.jbutton.button == joystick_keymap.right_button) | |
405 | + tux.input.right = UP; | |
406 | + else if (event.jbutton.button == joystick_keymap.left_button) | |
407 | + tux.input.left = UP; | |
408 | + break; | |
409 | +#endif | |
410 | default: | |
411 | break; | |
412 | } /* switch */ | |
413 | @@ -464,7 +503,7 @@ | |
414 | Player* tux = world->get_tux(); | |
415 | ||
416 | /* End of level? */ | |
417 | - int endpos = (World::current()->get_level()->width-5) * 32; | |
418 | + int endpos = (World::current()->get_level()->width-5) * (32); | |
419 | Tile* endtile = collision_goal(tux->base); | |
420 | ||
421 | // fallback in case the other endpositions don't trigger | |
422 | @@ -545,7 +584,7 @@ | |
423 | Menu::current()->draw(); | |
424 | mouse_cursor->draw(); | |
425 | } | |
426 | - | |
427 | + //updateSound(); | |
428 | updatescreen(); | |
429 | } | |
430 | ||
431 | @@ -599,6 +638,7 @@ | |
432 | ||
433 | while (exit_status == ES_NONE) | |
434 | { | |
435 | + SDL_Delay(10); | |
436 | /* Calculate the movement-factor */ | |
437 | double frame_ratio = ((double)(update_time-last_update_time))/((double)FRAME_RATE); | |
438 | ||
439 | @@ -686,6 +726,7 @@ | |
440 | fps_cnt = 0; | |
441 | } | |
442 | } | |
443 | + //updateSound(); | |
444 | } | |
445 | ||
446 | return exit_status; | |
447 | @@ -694,21 +735,32 @@ | |
448 | /* Bounce a brick: */ | |
449 | void bumpbrick(float x, float y) | |
450 | { | |
451 | - World::current()->add_bouncy_brick(((int)(x + 1) / 32) * 32, | |
452 | - (int)(y / 32) * 32); | |
453 | + World::current()->add_bouncy_brick(((int)(x + 1) / (32)) * (32), | |
454 | + (int)(y / (32)) * (32)); | |
455 | ||
456 | +#ifndef GP2X | |
457 | play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); | |
458 | +#else | |
459 | + play_chunk(SND_BRICK); | |
460 | +#endif | |
461 | } | |
462 | ||
463 | /* (Status): */ | |
464 | void | |
465 | GameSession::drawstatus() | |
466 | { | |
467 | + int xdiv; | |
468 | +#ifdef RES320X240 | |
469 | + xdiv=2; | |
470 | +#else | |
471 | + xdiv=1; | |
472 | +#endif | |
473 | + | |
474 | char str[60]; | |
475 | ||
476 | sprintf(str, "%d", player_status.score); | |
477 | white_text->draw("SCORE", 0, 0, 1); | |
478 | - gold_text->draw(str, 96, 0, 1); | |
479 | + gold_text->draw(str, 96/xdiv, 0, 1); | |
480 | ||
481 | if(st_gl_mode == ST_GL_TEST) | |
482 | { | |
483 | @@ -716,28 +768,33 @@ | |
484 | } | |
485 | ||
486 | if(!time_left.check()) { | |
487 | - white_text->draw("TIME'S UP", 224, 0, 1); | |
488 | + white_text->draw("TIME'S UP", 224/xdiv, 0, 1); | |
489 | } else if (time_left.get_left() > TIME_WARNING || (global_frame_counter % 10) < 5) { | |
490 | sprintf(str, "%d", time_left.get_left() / 1000 ); | |
491 | - white_text->draw("TIME", 224, 0, 1); | |
492 | - gold_text->draw(str, 304, 0, 1); | |
493 | + white_text->draw("TIME", 224/xdiv, 0, 1); | |
494 | + gold_text->draw(str, 304/xdiv, 0, 1); | |
495 | } | |
496 | ||
497 | sprintf(str, "%d", player_status.distros); | |
498 | white_text->draw("COINS", screen->h, 0, 1); | |
499 | - gold_text->draw(str, 608, 0, 1); | |
500 | + gold_text->draw(str, 608/xdiv, 0, 1); | |
501 | ||
502 | - white_text->draw("LIVES", 480, 20); | |
503 | + white_text->draw("LIVES", 480/xdiv, 20); | |
504 | if (player_status.lives >= 5) | |
505 | { | |
506 | sprintf(str, "%dx", player_status.lives); | |
507 | +#ifdef RES320X240 | |
508 | + gold_text->draw_align(str, 617/xdiv-5, 20, A_RIGHT, A_TOP); | |
509 | + tux_life->draw(565+(18*3)/xdiv+10, 20); | |
510 | +#else | |
511 | gold_text->draw_align(str, 617, 20, A_RIGHT, A_TOP); | |
512 | tux_life->draw(565+(18*3), 20); | |
513 | +#endif | |
514 | } | |
515 | else | |
516 | { | |
517 | for(int i= 0; i < player_status.lives; ++i) | |
518 | - tux_life->draw(565+(18*i),20); | |
519 | + tux_life->draw(565+(18*i)/xdiv,20); | |
520 | } | |
521 | ||
522 | if(show_fps) | |
523 | @@ -746,6 +803,7 @@ | |
524 | white_text->draw("FPS", screen->h, 40, 1); | |
525 | gold_text->draw(str, screen->h + 60, 40, 1); | |
526 | } | |
527 | +// updateSound(); | |
528 | } | |
529 | ||
530 | void | |
531 | @@ -824,4 +882,3 @@ | |
532 | return tmp; | |
533 | } | |
534 | ||
535 | - | |
536 | diff -ur supertux-0.1.3/src/gameobjs.cpp supertux-0.1.3-gp2x/src/gameobjs.cpp | |
537 | --- supertux-0.1.3/src/gameobjs.cpp 2005-06-22 00:16:07.000000000 +0300 | |
538 | @@ -98,6 +98,9 @@ | |
539 | src.h = 16; | |
540 | ||
541 | dest.x = (int)(base.x - scroll_x); | |
542 | +#ifdef RES320X240 | |
543 | + dest.x=dest.x/2; | |
544 | +#endif | |
545 | dest.y = (int)base.y; | |
546 | dest.w = 16; | |
547 | dest.h = 16; | |
548 | @@ -143,8 +146,13 @@ | |
549 | { | |
550 | SDL_Rect dest; | |
551 | ||
552 | +#ifndef RES320X240 | |
553 | if (base.x >= scroll_x - 32 && | |
554 | base.x <= scroll_x + screen->w) | |
555 | +#else | |
556 | + if (base.x >= scroll_x - 32 && | |
557 | + base.x <= scroll_x + 640) | |
558 | +#endif | |
559 | { | |
560 | dest.x = (int)(base.x - scroll_x); | |
561 | dest.y = (int)base.y; | |
562 | @@ -165,8 +173,14 @@ | |
563 | else | |
564 | { | |
565 | int s = ((int)scroll_x / 2)%640; | |
566 | + | |
567 | +#ifdef RES320X240 | |
568 | + plevel->img_bkgd->draw_part(dest.x/2 + s/2, dest.y/2, | |
569 | + dest.x/2, dest.y,dest.w/2,dest.h/2); | |
570 | +#else | |
571 | plevel->img_bkgd->draw_part(dest.x + s, dest.y, | |
572 | dest.x, dest.y,dest.w,dest.h); | |
573 | +#endif | |
574 | } | |
575 | ||
576 | Tile::draw(base.x - scroll_x, | |
577 | diff -ur supertux-0.1.3/src/globals.cpp supertux-0.1.3-gp2x/src/globals.cpp | |
578 | --- supertux-0.1.3/src/globals.cpp 2005-06-22 00:16:07.000000000 +0300 | |
579 | @@ -25,6 +25,7 @@ | |
580 | ||
581 | JoystickKeymap::JoystickKeymap() | |
582 | { | |
583 | +#ifndef GP2X | |
584 | a_button = 0; | |
585 | b_button = 1; | |
586 | start_button = 2; | |
587 | @@ -33,6 +34,17 @@ | |
588 | y_axis = 1; | |
589 | ||
590 | dead_zone = 4096; | |
591 | +#else | |
592 | + a_button = GP2X_BUTTON_A; | |
593 | + b_button = GP2X_BUTTON_X; | |
594 | + start_button = GP2X_BUTTON_START; | |
595 | + up_button = GP2X_BUTTON_UP; | |
596 | + down_button = GP2X_BUTTON_DOWN; | |
597 | + left_button = GP2X_BUTTON_LEFT; | |
598 | + right_button = GP2X_BUTTON_RIGHT; | |
599 | + volup_button = GP2X_BUTTON_VOLUP; | |
600 | + voldown_button = GP2X_BUTTON_VOLDOWN; | |
601 | +#endif | |
602 | } | |
603 | ||
604 | JoystickKeymap joystick_keymap; | |
605 | diff -ur supertux-0.1.3/src/globals.h supertux-0.1.3-gp2x/src/globals.h | |
606 | --- supertux-0.1.3/src/globals.h 2005-06-22 00:16:07.000000000 +0300 | |
607 | @@ -28,10 +28,33 @@ | |
608 | #include "menu.h" | |
609 | #include "mousecursor.h" | |
610 | ||
611 | +#ifdef GP2X | |
612 | +#define GP2X_BUTTON_UP (0) | |
613 | +#define GP2X_BUTTON_DOWN (4) | |
614 | +#define GP2X_BUTTON_LEFT (2) | |
615 | +#define GP2X_BUTTON_RIGHT (6) | |
616 | +#define GP2X_BUTTON_UPLEFT (1) | |
617 | +#define GP2X_BUTTON_UPRIGHT (7) | |
618 | +#define GP2X_BUTTON_DOWNLEFT (3) | |
619 | +#define GP2X_BUTTON_DOWNRIGHT (5) | |
620 | +#define GP2X_BUTTON_CLICK (18) | |
621 | +#define GP2X_BUTTON_A (12) | |
622 | +#define GP2X_BUTTON_B (13) | |
623 | +#define GP2X_BUTTON_X (15) | |
624 | +#define GP2X_BUTTON_Y (14) | |
625 | +#define GP2X_BUTTON_L (10) | |
626 | +#define GP2X_BUTTON_R (11) | |
627 | +#define GP2X_BUTTON_START (8) | |
628 | +#define GP2X_BUTTON_SELECT (9) | |
629 | +#define GP2X_BUTTON_VOLUP (16) | |
630 | +#define GP2X_BUTTON_VOLDOWN (17) | |
631 | +#endif | |
632 | + | |
633 | extern std::string datadir; | |
634 | ||
635 | struct JoystickKeymap | |
636 | { | |
637 | +#ifndef GP2X | |
638 | int a_button; | |
639 | int b_button; | |
640 | int start_button; | |
641 | @@ -42,6 +65,19 @@ | |
642 | int dead_zone; | |
643 | ||
644 | JoystickKeymap(); | |
645 | +#else | |
646 | + int a_button; | |
647 | + int b_button; | |
648 | + int start_button; | |
649 | + int up_button; | |
650 | + int down_button; | |
651 | + int left_button; | |
652 | + int right_button; | |
653 | + int volup_button; | |
654 | + int voldown_button; | |
655 | + | |
656 | + JoystickKeymap(); | |
657 | +#endif | |
658 | }; | |
659 | ||
660 | extern JoystickKeymap joystick_keymap; | |
661 | diff -ur supertux-0.1.3/src/lispreader.h supertux-0.1.3-gp2x/src/lispreader.h | |
662 | Only in supertux-0.1.3/src: Makefile | |
663 | diff -ur supertux-0.1.3/src/Makefile.am supertux-0.1.3-gp2x/src/Makefile.am | |
664 | --- supertux-0.1.3/src/Makefile.am 2005-06-22 00:16:07.000000000 +0300 | |
665 | @@ -77,3 +77,5 @@ | |
666 | musicref.h | |
667 | ||
668 | # EOF # | |
669 | + | |
670 | +#supertux_LDADD = libmikmod | |
671 | Only in supertux-0.1.3/src: Makefile.in | |
672 | diff -ur supertux-0.1.3/src/menu.cpp supertux-0.1.3-gp2x/src/menu.cpp | |
673 | --- supertux-0.1.3/src/menu.cpp 2005-06-29 15:44:13.000000000 +0300 | |
674 | @@ -53,6 +53,8 @@ | |
675 | Menu* options_menu = 0; | |
676 | Menu* options_keys_menu = 0; | |
677 | Menu* options_joystick_menu = 0; | |
678 | +Menu* options_joystick_axis_menu = 0; | |
679 | +Menu* options_joystick_button_menu = 0; | |
680 | Menu* highscore_menu = 0; | |
681 | Menu* load_game_menu = 0; | |
682 | Menu* save_game_menu = 0; | |
683 | @@ -240,8 +242,10 @@ | |
684 | } | |
685 | ||
686 | /* Set ControlField a key */ | |
687 | +//TODO: get joystick in here somehow | |
688 | void Menu::get_controlfield_key_into_input(MenuItem *item) | |
689 | { | |
690 | +#ifndef GP2X | |
691 | switch(*item->int_p) | |
692 | { | |
693 | case SDLK_UP: | |
694 | @@ -288,6 +292,11 @@ | |
695 | } | |
696 | break; | |
697 | } | |
698 | +#else | |
699 | + char tmp[64]; | |
700 | + snprintf(tmp, 64, "%d", *item->int_p); | |
701 | + item->change_input(tmp); | |
702 | +#endif | |
703 | } | |
704 | ||
705 | /* Free a menu and all its items */ | |
706 | @@ -497,8 +506,13 @@ | |
707 | int menu_height) | |
708 | { | |
709 | MenuItem& pitem = item[index]; | |
710 | - | |
711 | + | |
712 | +#ifndef RES320X240 | |
713 | int font_width = 16; | |
714 | +#else | |
715 | + int font_width = 16/2; | |
716 | +#endif | |
717 | + | |
718 | int effect_offset = 0; | |
719 | { | |
720 | int effect_time = 0; | |
721 | @@ -510,7 +524,7 @@ | |
722 | } | |
723 | ||
724 | int x_pos = pos_x; | |
725 | - int y_pos = pos_y + 24*index - menu_height/2 + 12 + effect_offset; | |
726 | + int y_pos = pos_y + (int)(24)*index - menu_height/2 + 12 + effect_offset; | |
727 | int shadow_size = 2; | |
728 | int text_width = strlen(pitem.text) * font_width; | |
729 | int input_width = (strlen(pitem.input)+ 1) * font_width; | |
730 | @@ -518,7 +532,7 @@ | |
731 | Text* text_font = white_text; | |
732 | ||
733 | if (arrange_left) | |
734 | - x_pos += 24 - menu_width/2 + (text_width + input_width + list_width)/2; | |
735 | + x_pos += (int)(24) - menu_width/2 + (text_width + input_width + list_width)/2; | |
736 | ||
737 | if(index == active_item) | |
738 | { | |
739 | @@ -538,7 +552,11 @@ | |
740 | ||
741 | case MN_HL: | |
742 | { | |
743 | +#ifndef RES320X240 | |
744 | int x = pos_x - menu_width/2; | |
745 | +#else | |
746 | + int x = pos_x - menu_width/4; | |
747 | +#endif | |
748 | int y = y_pos - 12 - effect_offset; | |
749 | /* Draw a horizontal line with a little 3d effect */ | |
750 | fillrect(x, y + 6, | |
751 | @@ -551,9 +569,15 @@ | |
752 | } | |
753 | case MN_LABEL: | |
754 | { | |
755 | +#ifndef RES320X240 | |
756 | white_big_text->draw_align(pitem.text, | |
757 | x_pos, y_pos, | |
758 | A_HMIDDLE, A_VMIDDLE, 2); | |
759 | +#else | |
760 | + white_text->draw_align(pitem.text, | |
761 | + x_pos, y_pos, | |
762 | + A_HMIDDLE, A_VMIDDLE, 2); | |
763 | +#endif | |
764 | break; | |
765 | } | |
766 | case MN_TEXTFIELD: | |
767 | @@ -570,8 +594,9 @@ | |
768 | input_width + font_width, 18, | |
769 | 0,0,0,128); | |
770 | ||
771 | - if(pitem.kind == MN_CONTROLFIELD) | |
772 | + if(pitem.kind == MN_CONTROLFIELD) { | |
773 | get_controlfield_key_into_input(&pitem); | |
774 | + } | |
775 | ||
776 | if(pitem.kind == MN_TEXTFIELD || pitem.kind == MN_NUMFIELD) | |
777 | { | |
778 | @@ -663,7 +688,7 @@ | |
779 | menu_width += 2; | |
780 | } | |
781 | } | |
782 | - | |
783 | + | |
784 | return (menu_width * 16 + 24); | |
785 | } | |
786 | ||
787 | @@ -680,10 +705,17 @@ | |
788 | int menu_width = get_width(); | |
789 | ||
790 | /* Draw a transparent background */ | |
791 | +#ifndef RES320X240 | |
792 | fillrect(pos_x - menu_width/2, | |
793 | pos_y - 24*item.size()/2 - 10, | |
794 | menu_width,menu_height + 20, | |
795 | 150,180,200,125); | |
796 | +#else | |
797 | + fillrect(pos_x - menu_width/4, | |
798 | + pos_y - 24*item.size()/2 - 10, | |
799 | + menu_width,menu_height + 20, | |
800 | + 150,180,200,125); | |
801 | +#endif | |
802 | ||
803 | for(unsigned int i = 0; i < item.size(); ++i) | |
804 | { | |
805 | @@ -723,6 +755,8 @@ | |
806 | SDLKey key; | |
807 | switch(event.type) | |
808 | { | |
809 | + | |
810 | +#ifndef GP2X | |
811 | case SDL_KEYDOWN: | |
812 | key = event.key.keysym.sym; | |
813 | SDLMod keymod; | |
814 | @@ -754,7 +788,6 @@ | |
815 | return; | |
816 | } | |
817 | ||
818 | - | |
819 | switch(key) | |
820 | { | |
821 | case SDLK_UP: /* Menu Up */ | |
822 | @@ -800,12 +833,14 @@ | |
823 | break; | |
824 | } | |
825 | break; | |
826 | + | |
827 | case SDL_JOYHATMOTION: | |
828 | if(event.jhat.value == SDL_HAT_UP) | |
829 | menuaction = MENU_ACTION_UP; | |
830 | if(event.jhat.value == SDL_HAT_DOWN) | |
831 | menuaction = MENU_ACTION_DOWN; | |
832 | break; | |
833 | + | |
834 | case SDL_JOYAXISMOTION: | |
835 | if(event.jaxis.axis == joystick_keymap.y_axis) | |
836 | { | |
837 | @@ -815,9 +850,88 @@ | |
838 | menuaction = MENU_ACTION_UP; | |
839 | } | |
840 | break; | |
841 | +#endif | |
842 | + | |
843 | case SDL_JOYBUTTONDOWN: | |
844 | +#ifndef GP2X | |
845 | menuaction = MENU_ACTION_HIT; | |
846 | break; | |
847 | +#else | |
848 | + | |
849 | + if(item[active_item].kind == MN_CONTROLFIELD) | |
850 | + { | |
851 | + if( event.jbutton.button == joystick_keymap.start_button ) | |
852 | + { | |
853 | + Menu::pop_current(); | |
854 | + return; | |
855 | + } | |
856 | + | |
857 | + static int save[8]={-1,-1,-1,-1,-1,-1,-1,-1}; | |
858 | + int itemid=get_active_item_id(); | |
859 | + int inputkey; | |
860 | + switch ( itemid ) { | |
861 | + case 11 : inputkey=joystick_keymap.up_button; | |
862 | + break; | |
863 | + case 12 : inputkey=joystick_keymap.down_button; | |
864 | + break; | |
865 | + case 13 : inputkey=joystick_keymap.left_button; | |
866 | + break; | |
867 | + case 14 : inputkey=joystick_keymap.right_button; | |
868 | + break; | |
869 | + case 15 : inputkey=joystick_keymap.a_button; | |
870 | + break; | |
871 | + case 16 : inputkey=joystick_keymap.b_button; | |
872 | + break; | |
873 | + default : break; | |
874 | + } | |
875 | + | |
876 | + *item[active_item].int_p = event.jbutton.button; | |
877 | + | |
878 | + bool okay=true; | |
879 | + | |
880 | + save[itemid-11]=event.jbutton.button; | |
881 | + | |
882 | + int i; | |
883 | + for ( i=0;i<itemid-11;i++ ) { | |
884 | + if ( save[i] == event.jbutton.button ) okay=false; | |
885 | + } | |
886 | + if ( okay == true ) menuaction = MENU_ACTION_DOWN; | |
887 | + else menuaction = MENU_ACTION_NONE; | |
888 | + | |
889 | + return; | |
890 | + } | |
891 | + | |
892 | + if (event.jbutton.button == joystick_keymap.a_button) | |
893 | + menuaction = MENU_ACTION_HIT; | |
894 | + else if (event.jbutton.button == joystick_keymap.b_button) | |
895 | + menuaction = MENU_ACTION_HIT; | |
896 | + else if (event.jbutton.button == joystick_keymap.start_button) | |
897 | + menuaction = MENU_ACTION_HIT; | |
898 | + else if (event.jbutton.button == joystick_keymap.up_button) | |
899 | + menuaction = MENU_ACTION_UP; | |
900 | + else if (event.jbutton.button == joystick_keymap.down_button) | |
901 | + menuaction = MENU_ACTION_DOWN; | |
902 | + else if (event.jbutton.button == joystick_keymap.right_button) | |
903 | + menuaction = MENU_ACTION_RIGHT; | |
904 | + else if (event.jbutton.button == joystick_keymap.left_button) | |
905 | + menuaction = MENU_ACTION_LEFT; | |
906 | + else if (event.jbutton.button == joystick_keymap.volup_button) | |
907 | +#ifdef GP2X | |
908 | + increaseSoundVolume(); | |
909 | +#else | |
910 | + sound_volume(2); | |
911 | +#endif | |
912 | + else if (event.jbutton.button == joystick_keymap.voldown_button) | |
913 | +#ifdef GP2X | |
914 | + decreaseSoundVolume(); | |
915 | +#else | |
916 | + sound_volume(1); | |
917 | +#endif | |
918 | + break; | |
919 | + | |
920 | +#endif | |
921 | + | |
922 | +#ifndef GP2X | |
923 | case SDL_MOUSEBUTTONDOWN: | |
924 | x = event.motion.x; | |
925 | y = event.motion.y; | |
926 | @@ -847,6 +961,7 @@ | |
927 | break; | |
928 | default: | |
929 | break; | |
930 | +#endif | |
931 | } | |
932 | } | |
933 | ||
934 | diff -ur supertux-0.1.3/src/menu.h supertux-0.1.3-gp2x/src/menu.h | |
935 | --- supertux-0.1.3/src/menu.h 2005-06-22 00:16:07.000000000 +0300 | |
936 | @@ -236,6 +236,8 @@ | |
937 | extern Menu* options_menu; | |
938 | extern Menu* options_keys_menu; | |
939 | extern Menu* options_joystick_menu; | |
940 | +extern Menu* options_joystick_axis_menu; | |
941 | +extern Menu* options_joystick_button_menu; | |
942 | extern Menu* highscore_menu; | |
943 | extern Menu* load_game_menu; | |
944 | extern Menu* save_game_menu; | |
945 | diff -ur supertux-0.1.3/src/music_manager.cpp supertux-0.1.3-gp2x/src/music_manager.cpp | |
946 | --- supertux-0.1.3/src/music_manager.cpp 2005-06-22 00:16:07.000000000 +0300 | |
947 | @@ -59,7 +59,14 @@ | |
948 | return true; | |
949 | } | |
950 | ||
951 | +#ifndef GP2X | |
952 | Mix_Music* song = Mix_LoadMUS(file.c_str()); | |
953 | +#else | |
954 | + char mfile[100]; | |
955 | + snprintf(mfile,sizeof(mfile),"%s",file.c_str()); | |
956 | + MODULE *song=Player_Load(mfile, 64, 0); | |
957 | +#endif | |
958 | + | |
959 | if(song == 0) | |
960 | return false; | |
961 | ||
962 | @@ -84,6 +91,8 @@ | |
963 | void | |
964 | MusicManager::play_music(const MusicRef& musicref, int loops) | |
965 | { | |
966 | +// printf("loop: %d, musicref: %d\n",loops,musicref.music); | |
967 | + | |
968 | if(!audio_device) | |
969 | return; | |
970 | ||
971 | @@ -97,7 +106,16 @@ | |
972 | current_music->refcount++; | |
973 | ||
974 | if(music_enabled) | |
975 | +#ifndef GP2X | |
976 | Mix_PlayMusic(current_music->music, loops); | |
977 | +#else | |
978 | + { | |
979 | + if ( loops == -1 ) current_music->music->wrap=1; | |
980 | + Player_Stop(); | |
981 | + Player_Start(current_music->music); | |
982 | + Player_SetPosition(0); | |
983 | + } | |
984 | +#endif | |
985 | } | |
986 | ||
987 | void | |
988 | @@ -106,13 +124,17 @@ | |
989 | if(!audio_device) | |
990 | return; | |
991 | ||
992 | +#ifndef GP2X | |
993 | Mix_HaltMusic(); | |
994 | +#else | |
995 | + Player_Stop(); | |
996 | +#endif | |
997 | ||
998 | if(current_music) { | |
999 | current_music->refcount--; | |
1000 | if(current_music->refcount == 0) | |
1001 | free_music(current_music); | |
1002 | - current_music = 0; | |
1003 | + current_music = 0; | |
1004 | } | |
1005 | } | |
1006 | ||
1007 | @@ -127,9 +149,17 @@ | |
1008 | ||
1009 | music_enabled = enable; | |
1010 | if(music_enabled == false) { | |
1011 | +#ifndef GP2X | |
1012 | Mix_HaltMusic(); | |
1013 | +#else | |
1014 | + Player_Stop(); | |
1015 | +#endif | |
1016 | } else { | |
1017 | +#ifndef GP2X | |
1018 | Mix_PlayMusic(current_music->music, -1); | |
1019 | +#else | |
1020 | + Player_Start(current_music->music); | |
1021 | +#endif | |
1022 | } | |
1023 | } | |
1024 | ||
1025 | diff -ur supertux-0.1.3/src/music_manager.h supertux-0.1.3-gp2x/src/music_manager.h | |
1026 | --- supertux-0.1.3/src/music_manager.h 2005-06-22 00:16:07.000000000 +0300 | |
1027 | @@ -20,6 +20,10 @@ | |
1028 | #ifndef HEADER_MUSIC_MANAGER_H | |
1029 | #define HEADER_MUSIC_MANAGER_H | |
1030 | ||
1031 | +#ifdef GP2X | |
1032 | +#include "mikmod.h" | |
1033 | +#endif | |
1034 | + | |
1035 | #include <SDL_mixer.h> | |
1036 | #include <string> | |
1037 | #include <map> | |
1038 | @@ -51,7 +55,12 @@ | |
1039 | ~MusicResource(); | |
1040 | ||
1041 | MusicManager* manager; | |
1042 | +#ifndef GP2X | |
1043 | Mix_Music* music; | |
1044 | +#else | |
1045 | + MODULE *music; | |
1046 | +#endif | |
1047 | + | |
1048 | int refcount; | |
1049 | }; | |
1050 | ||
1051 | diff -ur supertux-0.1.3/src/particlesystem.cpp supertux-0.1.3-gp2x/src/particlesystem.cpp | |
1052 | --- supertux-0.1.3/src/particlesystem.cpp 2005-06-22 00:16:07.000000000 +0300 | |
1053 | @@ -28,8 +28,13 @@ | |
1054 | ||
1055 | ParticleSystem::ParticleSystem() | |
1056 | { | |
1057 | +#ifndef RES320X240 | |
1058 | virtual_width = screen->w; | |
1059 | virtual_height = screen->h; | |
1060 | +#else | |
1061 | + virtual_width = 640; | |
1062 | + virtual_height = 480; | |
1063 | +#endif | |
1064 | } | |
1065 | ||
1066 | ParticleSystem::~ParticleSystem() | |
1067 | @@ -57,13 +62,24 @@ | |
1068 | float ymax = fmodf(y + particle->texture->h, virtual_height); | |
1069 | ||
1070 | // particle on screen | |
1071 | +#ifndef RES320X240 | |
1072 | if(x >= screen->w && xmax >= screen->w) | |
1073 | continue; | |
1074 | if(y >= screen->h && ymax >= screen->h) | |
1075 | continue; | |
1076 | - | |
1077 | + | |
1078 | if(x > screen->w) x -= virtual_width; | |
1079 | if(y > screen->h) y -= virtual_height; | |
1080 | +#else | |
1081 | + if(x >= 640 && xmax >= 640) | |
1082 | + continue; | |
1083 | + if(y >= 480 && ymax >= 480) | |
1084 | + continue; | |
1085 | + | |
1086 | + if(x > 640) x -= virtual_width; | |
1087 | + if(y > 480) y -= virtual_height; | |
1088 | +#endif | |
1089 | + | |
1090 | particle->texture->draw(x, y); | |
1091 | } | |
1092 | } | |
1093 | @@ -74,14 +90,21 @@ | |
1094 | snowimages[1] = new Surface(datadir+"/images/shared/snow1.png", USE_ALPHA); | |
1095 | snowimages[2] = new Surface(datadir+"/images/shared/snow2.png", USE_ALPHA); | |
1096 | ||
1097 | +#ifndef RES320X240 | |
1098 | virtual_width = screen->w * 2; | |
1099 | - | |
1100 | +#else | |
1101 | + virtual_width = 640 * 2; | |
1102 | +#endif | |
1103 | // create some random snowflakes | |
1104 | size_t snowflakecount = size_t(virtual_width/10.0); | |
1105 | for(size_t i=0; i<snowflakecount; ++i) { | |
1106 | SnowParticle* particle = new SnowParticle; | |
1107 | particle->x = rand() % int(virtual_width); | |
1108 | +#ifndef RES320X240 | |
1109 | particle->y = rand() % screen->h; | |
1110 | +#else | |
1111 | + particle->y = rand() % 480; | |
1112 | +#endif | |
1113 | particle->layer = i % 2; | |
1114 | int snowsize = rand() % 3; | |
1115 | particle->texture = snowimages[snowsize]; | |
1116 | @@ -106,7 +129,11 @@ | |
1117 | for(i = particles.begin(); i != particles.end(); ++i) { | |
1118 | SnowParticle* particle = (SnowParticle*) *i; | |
1119 | particle->y += particle->speed * elapsed_time; | |
1120 | +#ifndef RES320X240 | |
1121 | if(particle->y > screen->h) { | |
1122 | +#else | |
1123 | + if(particle->y > 480) { | |
1124 | +#endif | |
1125 | particle->y = fmodf(particle->y , virtual_height); | |
1126 | particle->x = rand() % int(virtual_width); | |
1127 | } | |
1128 | diff -ur supertux-0.1.3/src/player.cpp supertux-0.1.3-gp2x/src/player.cpp | |
1129 | --- supertux-0.1.3/src/player.cpp 2005-06-22 00:16:07.000000000 +0300 | |
1130 | @@ -261,6 +261,7 @@ | |
1131 | } | |
1132 | } | |
1133 | } | |
1134 | +// updateSound(); | |
1135 | ||
1136 | /* ---- DONE HANDLING TUX! --- */ | |
1137 | ||
1138 | @@ -337,7 +338,11 @@ | |
1139 | if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) { | |
1140 | if(fabs(vx)>SKID_XM && !skidding_timer.check()) { | |
1141 | skidding_timer.start(SKID_TIME); | |
1142 | +#ifndef GP2X | |
1143 | play_sound(sounds[SND_SKID], SOUND_CENTER_SPEAKER); | |
1144 | +#else | |
1145 | + play_chunk(SND_SKID); | |
1146 | +#endif | |
1147 | ax *= 2.5; | |
1148 | } else { | |
1149 | ax *= 2; | |
1150 | @@ -391,9 +396,17 @@ | |
1151 | jumping = true; | |
1152 | can_jump = false; | |
1153 | if (size == SMALL) | |
1154 | +#ifndef GP2X | |
1155 | play_sound(sounds[SND_JUMP], SOUND_CENTER_SPEAKER); | |
1156 | +#else | |
1157 | + play_chunk(SND_JUMP); | |
1158 | +#endif | |
1159 | else | |
1160 | +#ifndef GP2X | |
1161 | play_sound(sounds[SND_BIGJUMP], SOUND_CENTER_SPEAKER); | |
1162 | +#else | |
1163 | + play_chunk(SND_BIGJUMP); | |
1164 | +#endif | |
1165 | } | |
1166 | } | |
1167 | // Let go of jump key | |
1168 | @@ -533,7 +546,11 @@ | |
1169 | if(player_status.lives < MAX_LIVES) | |
1170 | ++player_status.lives; | |
1171 | /*We want to hear the sound even, if MAX_LIVES is reached*/ | |
1172 | +#ifndef GP2X | |
1173 | play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER); | |
1174 | +#else | |
1175 | + play_chunk(SND_LIFEUP); | |
1176 | +#endif | |
1177 | } | |
1178 | } | |
1179 | ||
1180 | @@ -665,7 +682,11 @@ | |
1181 | else | |
1182 | { | |
1183 | pbad_c->dying = DYING_FALLING; | |
1184 | +#ifndef GP2X | |
1185 | play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); | |
1186 | +#else | |
1187 | + play_chunk(SND_FALL); | |
1188 | +#endif | |
1189 | World::current()->add_score(pbad_c->base.x - scroll_x, | |
1190 | pbad_c->base.y, | |
1191 | 25 * player_status.score_multiplier); | |
1192 | @@ -696,7 +717,12 @@ | |
1193 | void | |
1194 | Player::kill(HurtMode mode) | |
1195 | { | |
1196 | +#ifndef GP2X | |
1197 | play_sound(sounds[SND_HURT], SOUND_CENTER_SPEAKER); | |
1198 | +#else | |
1199 | + play_chunk(SND_HURT); | |
1200 | + updateSound(); | |
1201 | +#endif | |
1202 | ||
1203 | physic.set_velocity_x(0); | |
1204 | ||
1205 | @@ -734,7 +760,11 @@ | |
1206 | ||
1207 | bool Player::is_dead() | |
1208 | { | |
1209 | +#ifndef RES320X240 | |
1210 | if(base.y > screen->h || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling | |
1211 | +#else | |
1212 | + if(base.y > 640 || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling | |
1213 | +#endif | |
1214 | return true; | |
1215 | else | |
1216 | return false; | |
1217 | @@ -760,9 +790,20 @@ | |
1218 | } | |
1219 | ||
1220 | /* Keep in-bounds, vertically: */ | |
1221 | +#ifndef RES320X240 | |
1222 | if (base.y > screen->h) | |
1223 | +#else | |
1224 | + if (base.y > 640) | |
1225 | +#endif | |
1226 | { | |
1227 | kill(KILL); | |
1228 | +#ifdef GP2X | |
1229 | + float wait=SDL_GetTicks()+800; | |
1230 | + while ( wait > SDL_GetTicks()) { | |
1231 | + updateSound(); | |
1232 | + } | |
1233 | +#endif | |
1234 | + | |
1235 | } | |
1236 | ||
1237 | if(base.x < scroll_x && (!back_scrolling || hor_autoscroll)) // can happen if back scrolling is disabled | |
1238 | @@ -777,7 +818,6 @@ | |
1239 | if(base.x + base.width > scroll_x + screen->w) | |
1240 | base.x = scroll_x + screen->w - base.width; | |
1241 | } | |
1242 | - | |
1243 | } | |
1244 | ||
1245 | // EOF // | |
1246 | diff -ur supertux-0.1.3/src/resources.cpp supertux-0.1.3-gp2x/src/resources.cpp | |
1247 | --- supertux-0.1.3/src/resources.cpp 2005-07-02 15:20:14.000000000 +0300 | |
1248 | @@ -18,6 +18,7 @@ | |
1249 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
1250 | ||
1251 | #include "globals.h" | |
1252 | +#include "sound.h" | |
1253 | #include "scene.h" | |
1254 | #include "player.h" | |
1255 | #include "badguy.h" | |
1256 | @@ -187,11 +188,13 @@ | |
1257 | // This is also true with if (use_music) | |
1258 | Send a mail to me: neoneurone@users.sf.net, if you have another opinion. :) | |
1259 | */ | |
1260 | +#ifndef GP2X | |
1261 | for (i = 0; i < NUM_SOUNDS; i++) | |
1262 | sounds[i] = load_sound(datadir + soundfilenames[i]); | |
1263 | +#endif | |
1264 | ||
1265 | /* Herring song */ | |
1266 | - herring_song = music_manager->load_music(datadir + "/music/SALCON.MOD"); | |
1267 | + herring_song = music_manager->load_music(datadir + "/music/SALCON.MOD"); | |
1268 | level_end_song = music_manager->load_music(datadir + "/music/leveldone.mod"); | |
1269 | } | |
1270 | ||
1271 | @@ -223,8 +226,10 @@ | |
1272 | ||
1273 | delete tux_life; | |
1274 | ||
1275 | +#ifndef GP2X | |
1276 | for (i = 0; i < NUM_SOUNDS; i++) | |
1277 | free_chunk(sounds[i]); | |
1278 | +#endif | |
1279 | ||
1280 | delete sprite_manager; | |
1281 | sprite_manager = 0; | |
1282 | diff -ur supertux-0.1.3/src/screen.cpp supertux-0.1.3-gp2x/src/screen.cpp | |
1283 | --- supertux-0.1.3/src/screen.cpp 2005-06-22 00:16:07.000000000 +0300 | |
1284 | @@ -81,7 +81,6 @@ | |
1285 | else | |
1286 | { | |
1287 | #endif | |
1288 | - | |
1289 | for(float y = 0; y < 480; y += 2) | |
1290 | fillrect(0, (int)y, 640, 2, | |
1291 | (int)(((float)(top_clr.red-bot_clr.red)/(0-480)) * y + top_clr.red), | |
1292 | @@ -199,11 +198,23 @@ | |
1293 | SDL_UnlockSurface(screen); | |
1294 | } | |
1295 | /* Update just the part of the display that we've changed */ | |
1296 | +#ifndef RES320X240 | |
1297 | SDL_UpdateRect(screen, x, y, 1, 1); | |
1298 | +#else | |
1299 | + SDL_UpdateRect(screen, x/2, y/2, 1, 1); | |
1300 | +#endif | |
1301 | } | |
1302 | ||
1303 | void drawline(int x1, int y1, int x2, int y2, int r, int g, int b, int a) | |
1304 | { | |
1305 | + | |
1306 | +#ifdef RES320X240 | |
1307 | + x1=x1/2; | |
1308 | + x2=x2/2; | |
1309 | + y1=y1/2; | |
1310 | + y2=y2/2; | |
1311 | +#endif | |
1312 | + | |
1313 | #ifndef NOOPENGL | |
1314 | if(use_gl) | |
1315 | { | |
1316 | @@ -280,6 +291,13 @@ | |
1317 | y += h; | |
1318 | h = -h; | |
1319 | } | |
1320 | + | |
1321 | +#ifdef RES320X240 | |
1322 | + x=x; | |
1323 | + y=y/2; | |
1324 | + w=w/2; | |
1325 | + h=h/2; | |
1326 | +#endif | |
1327 | ||
1328 | #ifndef NOOPENGL | |
1329 | if(use_gl) | |
1330 | @@ -367,6 +385,9 @@ | |
1331 | void update_rect(SDL_Surface *scr, Sint32 x, Sint32 y, Sint32 w, Sint32 h) | |
1332 | { | |
1333 | if(!use_gl) | |
1334 | +#ifndef RES320X240 | |
1335 | + SDL_UpdateRect(scr, x, y, w, h); | |
1336 | +#else | |
1337 | SDL_UpdateRect(scr, x, y, w, h); | |
1338 | +#endif | |
1339 | } | |
1340 | - | |
1341 | diff -ur supertux-0.1.3/src/setup.cpp supertux-0.1.3-gp2x/src/setup.cpp | |
1342 | --- supertux-0.1.3/src/setup.cpp 2005-07-08 15:19:17.000000000 +0300 | |
1343 | @@ -62,10 +62,19 @@ | |
1344 | #define DATA_PREFIX "./data/" | |
1345 | #endif | |
1346 | ||
1347 | -/* Screen proprities: */ | |
1348 | +/* Screen properties: */ | |
1349 | /* Don't use this to test for the actual screen sizes. Use screen->w/h instead! */ | |
1350 | +#ifndef RES320X240 | |
1351 | #define SCREEN_W 640 | |
1352 | #define SCREEN_H 480 | |
1353 | +#else | |
1354 | +#define SCREEN_W 320 | |
1355 | +#define SCREEN_H 240 | |
1356 | +#endif | |
1357 | + | |
1358 | +#ifdef GP2X | |
1359 | +#define DATA_PREFIX "data/" | |
1360 | +#endif | |
1361 | ||
1362 | /* Local function prototypes: */ | |
1363 | ||
1364 | @@ -308,10 +317,14 @@ | |
1365 | char str[1024]; | |
1366 | /* Get home directory (from $HOME variable)... if we can't determine it, | |
1367 | use the current directory ("."): */ | |
1368 | +#ifndef GP2X | |
1369 | if (getenv("HOME") != NULL) | |
1370 | home = getenv("HOME"); | |
1371 | else | |
1372 | home = "."; | |
1373 | +#else | |
1374 | + home = "."; | |
1375 | +#endif | |
1376 | ||
1377 | st_dir = (char *) malloc(sizeof(char) * (strlen(home) + | |
1378 | strlen("/.supertux") + 1)); | |
1379 | @@ -340,9 +353,10 @@ | |
1380 | // User has not that a datadir, so we try some magic | |
1381 | if (datadir.empty()) | |
1382 | { | |
1383 | -#ifndef WIN32 | |
1384 | // Detect datadir | |
1385 | char exe_file[PATH_MAX]; | |
1386 | + | |
1387 | +#ifndef WIN32 | |
1388 | if (readlink("/proc/self/exe", exe_file, PATH_MAX) < 0) | |
1389 | { | |
1390 | puts("Couldn't read /proc/self/exe, using default path: " DATA_PREFIX); | |
1391 | @@ -358,7 +372,12 @@ | |
1392 | datadir = exedir + "../share/supertux"; // SuperTux run from PATH | |
1393 | if (access(datadir.c_str(), F_OK) != 0) | |
1394 | { // If all fails, fall back to compiled path | |
1395 | - datadir = DATA_PREFIX; | |
1396 | + datadir = exedir + "./data"; // SuperTux run with data in same path as executable | |
1397 | + if (access(datadir.c_str(), F_OK) != 0) | |
1398 | + { | |
1399 | + // If all fails, fall back to compiled path | |
1400 | + datadir = DATA_PREFIX; | |
1401 | + } | |
1402 | } | |
1403 | } | |
1404 | } | |
1405 | @@ -375,7 +394,8 @@ | |
1406 | main_menu = new Menu(); | |
1407 | options_menu = new Menu(); | |
1408 | options_keys_menu = new Menu(); | |
1409 | - options_joystick_menu = new Menu(); | |
1410 | + options_joystick_axis_menu = new Menu(); | |
1411 | + options_joystick_button_menu = new Menu(); | |
1412 | load_game_menu = new Menu(); | |
1413 | save_game_menu = new Menu(); | |
1414 | game_menu = new Menu(); | |
1415 | @@ -384,22 +404,27 @@ | |
1416 | contrib_subset_menu = new Menu(); | |
1417 | worldmap_menu = new Menu(); | |
1418 | ||
1419 | - main_menu->set_pos(screen->w/2, 335); | |
1420 | + main_menu->set_pos(screen->w/2, (int)(335)+20); | |
1421 | main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu, MNID_STARTGAME); | |
1422 | main_menu->additem(MN_GOTO, "Bonus Levels",0,contrib_menu, MNID_CONTRIB); | |
1423 | main_menu->additem(MN_GOTO, "Options",0,options_menu, MNID_OPTIONMENU); | |
1424 | + | |
1425 | +#ifndef GP2X | |
1426 | main_menu->additem(MN_ACTION,"Level Editor",0,0, MNID_LEVELEDITOR); | |
1427 | +#endif | |
1428 | main_menu->additem(MN_ACTION,"Credits",0,0, MNID_CREDITS); | |
1429 | main_menu->additem(MN_ACTION,"Quit",0,0, MNID_QUITMAINMENU); | |
1430 | ||
1431 | options_menu->additem(MN_LABEL,"Options",0,0); | |
1432 | options_menu->additem(MN_HL,"",0,0); | |
1433 | +#ifndef GP2X | |
1434 | #ifndef NOOPENGL | |
1435 | options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0, MNID_OPENGL); | |
1436 | #else | |
1437 | options_menu->additem(MN_DEACTIVE,"OpenGL (not supported)",use_gl, 0, MNID_OPENGL); | |
1438 | #endif | |
1439 | options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0, MNID_FULLSCREEN); | |
1440 | +#endif | |
1441 | if(audio_device) | |
1442 | { | |
1443 | options_menu->additem(MN_TOGGLE,"Sound ", use_sound,0, MNID_SOUND); | |
1444 | @@ -411,10 +436,15 @@ | |
1445 | options_menu->additem(MN_DEACTIVE,"Music ", false,0, MNID_MUSIC); | |
1446 | } | |
1447 | options_menu->additem(MN_TOGGLE,"Show FPS ",show_fps,0, MNID_SHOWFPS); | |
1448 | +#ifndef GP2X | |
1449 | options_menu->additem(MN_GOTO,"Keyboard Setup",0,options_keys_menu); | |
1450 | +#endif | |
1451 | ||
1452 | //if(use_joystick) | |
1453 | - // options_menu->additem(MN_GOTO,"Joystick Setup",0,options_joystick_menu); | |
1454 | +#ifdef GP2X | |
1455 | + options_menu->additem(MN_GOTO,"Joystick Move Setup",0,options_joystick_axis_menu); | |
1456 | + options_menu->additem(MN_GOTO,"Joystick Action Setup",0,options_joystick_button_menu); | |
1457 | +#endif | |
1458 | ||
1459 | options_menu->additem(MN_HL,"",0,0); | |
1460 | options_menu->additem(MN_BACK,"Back",0,0); | |
1461 | @@ -429,6 +459,7 @@ | |
1462 | options_keys_menu->additem(MN_HL,"",0,0); | |
1463 | options_keys_menu->additem(MN_BACK,"Back",0,0); | |
1464 | ||
1465 | +#ifndef GP2X | |
1466 | if(use_joystick) | |
1467 | { | |
1468 | options_joystick_menu->additem(MN_LABEL,"Joystick Setup",0,0); | |
1469 | @@ -442,6 +473,20 @@ | |
1470 | options_joystick_menu->additem(MN_HL,"",0,0); | |
1471 | options_joystick_menu->additem(MN_BACK,"Back",0,0); | |
1472 | } | |
1473 | +#else | |
1474 | + options_joystick_axis_menu->additem(MN_LABEL,"Joystick Move Setup",0,0); | |
1475 | + options_joystick_axis_menu->additem(MN_CONTROLFIELD,"Up", 0,0, 11,&joystick_keymap.up_button); | |
1476 | + options_joystick_axis_menu->additem(MN_CONTROLFIELD,"Down", 0,0, 12,&joystick_keymap.down_button); | |
1477 | + options_joystick_axis_menu->additem(MN_CONTROLFIELD,"Left", 0,0, 13,&joystick_keymap.left_button); | |
1478 | + options_joystick_axis_menu->additem(MN_CONTROLFIELD,"Right", 0,0, 14,&joystick_keymap.right_button); | |
1479 | + options_joystick_axis_menu->additem(MN_BACK,"Back",0,0); | |
1480 | + | |
1481 | + options_joystick_button_menu->additem(MN_LABEL,"Joystick Action Setup",0,0); | |
1482 | + options_joystick_button_menu->additem(MN_CONTROLFIELD,"Jump", 0,0, 15,&joystick_keymap.a_button); | |
1483 | + options_joystick_button_menu->additem(MN_CONTROLFIELD,"Shoot/Run", 0,0, 16,&joystick_keymap.b_button); | |
1484 | + options_joystick_button_menu->additem(MN_BACK,"Back",0,0); | |
1485 | +#endif | |
1486 | + | |
1487 | ||
1488 | load_game_menu->additem(MN_LABEL,"Start Game",0,0); | |
1489 | load_game_menu->additem(MN_HL,"",0,0); | |
1490 | @@ -576,9 +621,10 @@ | |
1491 | ||
1492 | srand(SDL_GetTicks()); | |
1493 | ||
1494 | +#ifndef GP2X | |
1495 | /* Set icon image: */ | |
1496 | - | |
1497 | seticon(); | |
1498 | +#endif | |
1499 | ||
1500 | /* Unicode needed for input handling: */ | |
1501 | ||
1502 | @@ -586,13 +632,32 @@ | |
1503 | ||
1504 | /* Load global images: */ | |
1505 | ||
1506 | +#ifndef RES320X240 | |
1507 | + white_text = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); | |
1508 | +#else | |
1509 | + white_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9); | |
1510 | + fadeout(); | |
1511 | +#endif | |
1512 | + | |
1513 | + | |
1514 | +#ifndef RES320X240 | |
1515 | black_text = new Text(datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18); | |
1516 | +#else | |
1517 | + black_text = new Text(datadir + "/images/status/letters-black.png", TEXT_TEXT, 8,9); | |
1518 | +#endif | |
1519 | +#ifndef RES320X240 | |
1520 | gold_text = new Text(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18); | |
1521 | +#else | |
1522 | + gold_text = new Text(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 8,9); | |
1523 | +#endif | |
1524 | silver_text = new Text(datadir + "/images/status/letters-silver.png", TEXT_TEXT, 16,18); | |
1525 | +#ifndef RES320X240 | |
1526 | blue_text = new Text(datadir + "/images/status/letters-blue.png", TEXT_TEXT, 16,18); | |
1527 | +#else | |
1528 | + blue_text = new Text(datadir + "/images/status/letters-blue.png", TEXT_TEXT, 8,9); | |
1529 | +#endif | |
1530 | red_text = new Text(datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18); | |
1531 | green_text = new Text(datadir + "/images/status/letters-green.png", TEXT_TEXT, 16,18); | |
1532 | - white_text = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18); | |
1533 | white_small_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9); | |
1534 | white_big_text = new Text(datadir + "/images/status/letters-white-big.png", TEXT_TEXT, 20,22); | |
1535 | yellow_nums = new Text(datadir + "/images/status/numbers.png", TEXT_NUM, 32,32); | |
1536 | @@ -665,14 +736,22 @@ | |
1537 | Surface::reload_all(); | |
1538 | ||
1539 | /* Set window manager stuff: */ | |
1540 | +#ifndef GP2X_VERSION | |
1541 | SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux"); | |
1542 | +#endif | |
1543 | } | |
1544 | ||
1545 | void st_video_setup_sdl(void) | |
1546 | { | |
1547 | if (use_fullscreen) | |
1548 | { | |
1549 | +#ifndef GP2X | |
1550 | screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */ | |
1551 | +#else | |
1552 | +// screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 16, SDL_HWSURFACE | SDL_DOUBLEBUF ) ; /* GP2X */ | |
1553 | + printf("screen width: %d, height: %d\n",SCREEN_W, SCREEN_H); | |
1554 | + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 16, SDL_SWSURFACE ) ; /* GP2X */ | |
1555 | +#endif | |
1556 | if (screen == NULL) | |
1557 | { | |
1558 | fprintf(stderr, | |
1559 | @@ -685,14 +764,22 @@ | |
1560 | } | |
1561 | else | |
1562 | { | |
1563 | +#ifndef GP2X | |
1564 | screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_HWSURFACE | SDL_DOUBLEBUF ); | |
1565 | - | |
1566 | +#else | |
1567 | +// screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 16, SDL_HWSURFACE | SDL_DOUBLEBUF ) ; /* GP2X */ | |
1568 | + screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 16, SDL_SWSURFACE ) ; /* GP2X */ | |
1569 | +#endif | |
1570 | if (screen == NULL) | |
1571 | { | |
1572 | fprintf(stderr, | |
1573 | "\nError: I could not set up video for 640x480 mode.\n" | |
1574 | "The Simple DirectMedia error that occured was:\n" | |
1575 | "%s\n\n", SDL_GetError()); | |
1576 | +#ifdef GP2X_VERSION | |
1577 | + chdir("/usr/gp2x"); | |
1578 | + execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); | |
1579 | +#endif | |
1580 | exit(1); | |
1581 | } | |
1582 | } | |
1583 | @@ -790,6 +877,7 @@ | |
1584 | ||
1585 | use_joystick = false; | |
1586 | } | |
1587 | +#ifndef GP2X | |
1588 | else | |
1589 | { | |
1590 | if (SDL_JoystickNumAxes(js) < 2) | |
1591 | @@ -811,6 +899,7 @@ | |
1592 | } | |
1593 | } | |
1594 | } | |
1595 | +#endif | |
1596 | } | |
1597 | } | |
1598 | } | |
1599 | @@ -844,12 +933,17 @@ | |
1600 | } | |
1601 | } | |
1602 | ||
1603 | - | |
1604 | + audio_device = true; | |
1605 | + | |
1606 | /* Open sound silently regarless the value of "use_sound": */ | |
1607 | ||
1608 | if (audio_device) | |
1609 | { | |
1610 | +#ifndef GP2X | |
1611 | if (open_audio(44100, AUDIO_S16, 2, 2048) < 0) | |
1612 | +#else | |
1613 | + if (open_audio(44100, AUDIO_S16, 1, 1024) < 0) | |
1614 | +#endif | |
1615 | { | |
1616 | /* only print out message if sound or music | |
1617 | was not disabled at command-line | |
1618 | @@ -878,6 +972,12 @@ | |
1619 | close_audio(); | |
1620 | SDL_Quit(); | |
1621 | saveconfig(); | |
1622 | + | |
1623 | +#ifdef GP2X | |
1624 | + chdir("/usr/gp2x"); | |
1625 | + execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL); | |
1626 | +#endif | |
1627 | + | |
1628 | } | |
1629 | ||
1630 | /* --- ABORT! --- */ | |
1631 | @@ -893,6 +993,7 @@ | |
1632 | ||
1633 | void seticon(void) | |
1634 | { | |
1635 | +#ifndef GP2X | |
1636 | // int masklen; | |
1637 | // Uint8 * mask; | |
1638 | SDL_Surface * icon; | |
1639 | @@ -927,6 +1028,7 @@ | |
1640 | ||
1641 | // free(mask); | |
1642 | SDL_FreeSurface(icon); | |
1643 | +#endif | |
1644 | } | |
1645 | ||
1646 | ||
1647 | @@ -956,6 +1058,7 @@ | |
1648 | } | |
1649 | else if (strcmp(argv[i], "--joymap") == 0) | |
1650 | { | |
1651 | +#ifndef GP2X | |
1652 | assert(i+1 < argc); | |
1653 | if (sscanf(argv[++i], | |
1654 | "%d:%d:%d:%d:%d", | |
1655 | @@ -976,6 +1079,7 @@ | |
1656 | << " B-Button: " << joystick_keymap.b_button << "\n" | |
1657 | << " Start-Button: " << joystick_keymap.start_button << std::endl; | |
1658 | } | |
1659 | +#endif | |
1660 | } | |
1661 | else if (strcmp(argv[i], "--leveleditor") == 0) | |
1662 | { | |
1663 | diff -ur supertux-0.1.3/src/sound.cpp supertux-0.1.3-gp2x/src/sound.cpp | |
1664 | --- supertux-0.1.3/src/sound.cpp 2005-06-22 00:16:07.000000000 +0300 | |
1665 | @@ -22,6 +22,9 @@ | |
1666 | #include "globals.h" | |
1667 | #include "sound.h" | |
1668 | #include "setup.h" | |
1669 | +#ifdef GP2X | |
1670 | +#include <string.h> | |
1671 | +#endif | |
1672 | ||
1673 | /*global variable*/ | |
1674 | bool use_sound = true; /* handle sound on/off menu and command-line option */ | |
1675 | @@ -54,12 +57,21 @@ | |
1676 | ||
1677 | #include <SDL_mixer.h> | |
1678 | ||
1679 | +#ifndef GP2X | |
1680 | Mix_Chunk * sounds[NUM_SOUNDS]; | |
1681 | +#else | |
1682 | ||
1683 | -/* --- OPEN THE AUDIO DEVICE --- */ | |
1684 | +#include <mikmod.h> | |
1685 | +static MODULE *music=NULL; | |
1686 | +static SAMPLE *chunk[NUM_SOUNDS]; | |
1687 | +static int chunkFlag[NUM_SOUNDS]; | |
1688 | +#endif | |
1689 | ||
1690 | +/* --- OPEN THE AUDIO DEVICE --- */ | |
1691 | int open_audio (int frequency, Uint16 format, int channels, int chunksize) | |
1692 | { | |
1693 | +// close_audio(); | |
1694 | +#ifndef GP2X | |
1695 | if (Mix_OpenAudio( frequency, format, channels, chunksize ) < 0) | |
1696 | return -1; | |
1697 | ||
1698 | @@ -74,20 +86,93 @@ | |
1699 | /* prepare the spanning effects */ | |
1700 | Mix_SetPanning( SOUND_LEFT_SPEAKER, 230, 24 ); | |
1701 | Mix_SetPanning( SOUND_RIGHT_SPEAKER, 24, 230 ); | |
1702 | +#else | |
1703 | + if (drv_oss.Name) // Valid OSS driver | |
1704 | + { | |
1705 | + if (drv_oss.CommandLine) // Valid Commandline | |
1706 | + { | |
1707 | + drv_oss.CommandLine("buffer=14,count=2"); | |
1708 | + } | |
1709 | + MikMod_RegisterDriver(&drv_oss); | |
1710 | + } | |
1711 | + if (drv_alsa.Name) // Valid ALSA driver | |
1712 | + { | |
1713 | + if (drv_alsa.CommandLine) // Valid Commandline | |
1714 | + { | |
1715 | + drv_alsa.CommandLine("buffer=14"); | |
1716 | + } | |
1717 | + MikMod_RegisterDriver(&drv_alsa); | |
1718 | + } | |
1719 | + MikMod_RegisterDriver(&drv_nos); | |
1720 | + | |
1721 | + // register standard tracker | |
1722 | + MikMod_RegisterAllLoaders(); | |
1723 | + | |
1724 | + // Note, the md_mode flags are already set by default | |
1725 | + md_mode |= DMODE_SOFT_SNDFX | DMODE_SOFT_MUSIC; | |
1726 | + | |
1727 | + if (MikMod_Init("")) // Command paramenters are ignored as all drivers are registered | |
1728 | + { | |
1729 | + printf("mikmod init war fürn arsch\n"); | |
1730 | + return 1; | |
1731 | + } | |
1732 | + | |
1733 | + load_sounds(); | |
1734 | + | |
1735 | + // get ready to play | |
1736 | + MikMod_EnableOutput(); | |
1737 | + md_volume =64; | |
1738 | + md_sndfxvolume = 64; | |
1739 | + //md_musicvolume = md_sndfxvolume = 64; | |
1740 | + | |
1741 | + use_sound = true; | |
1742 | + audio_device=true; | |
1743 | + | |
1744 | +#endif | |
1745 | return 0; | |
1746 | -} | |
1747 | ||
1748 | +} | |
1749 | ||
1750 | /* --- CLOSE THE AUDIO DEVICE --- */ | |
1751 | ||
1752 | void close_audio( void ) | |
1753 | { | |
1754 | +#ifndef GP2X | |
1755 | if (audio_device) { | |
1756 | Mix_UnregisterAllEffects( SOUND_LEFT_SPEAKER ); | |
1757 | Mix_UnregisterAllEffects( SOUND_RIGHT_SPEAKER ); | |
1758 | Mix_CloseAudio(); | |
1759 | } | |
1760 | +#else | |
1761 | + int i; | |
1762 | + if (! audio_device) return; | |
1763 | + | |
1764 | + MikMod_DisableOutput(); | |
1765 | + Player_Stop(); | |
1766 | + MikMod_Update(); | |
1767 | + | |
1768 | + if (music) { | |
1769 | + Player_Free(music); | |
1770 | + music = NULL; | |
1771 | + } | |
1772 | + | |
1773 | + for ( i=0 ; i<NUM_SOUNDS ; i++ ) { | |
1774 | + if ( chunk[i] ) { | |
1775 | + Sample_Free(chunk[i]); | |
1776 | + } | |
1777 | + } | |
1778 | + | |
1779 | + MikMod_Update(); | |
1780 | + MikMod_Exit(); | |
1781 | +#endif | |
1782 | +} | |
1783 | + | |
1784 | +#ifdef GP2X | |
1785 | +void updateSound ( void ) { | |
1786 | + if (! audio_device) return; | |
1787 | + MikMod_Update(); | |
1788 | } | |
1789 | +#endif | |
1790 | ||
1791 | ||
1792 | /* --- LOAD A SOUND --- */ | |
1793 | @@ -105,6 +190,30 @@ | |
1794 | return(snd); | |
1795 | } | |
1796 | ||
1797 | +#ifdef GP2X | |
1798 | +static void load_sounds() { | |
1799 | + int i; | |
1800 | + std::string name; | |
1801 | + char file[100]; | |
1802 | + | |
1803 | + for ( i=0 ; i<NUM_SOUNDS ; i++ ) { | |
1804 | + name = datadir + soundfilenames[i]; | |
1805 | + printf("loading: %s\n",name.c_str()); | |
1806 | + snprintf(file,sizeof(file),"%s",name.c_str()); | |
1807 | + if ( NULL == (chunk[i] = Sample_Load(file)) ) { | |
1808 | + fprintf(stderr, "Couldn't load: %s\n", file); | |
1809 | + use_sound = 0; | |
1810 | + return; | |
1811 | + } | |
1812 | + chunkFlag[i] = 0; | |
1813 | + } | |
1814 | + | |
1815 | + // reserve voices for sound effects | |
1816 | + MikMod_SetNumVoices(-1, 4); | |
1817 | +} | |
1818 | +#endif | |
1819 | + | |
1820 | + | |
1821 | /* --- PLAY A SOUND ON LEFT OR RIGHT OR CENTER SPEAKER --- */ | |
1822 | ||
1823 | void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker) | |
1824 | @@ -130,8 +239,45 @@ | |
1825 | } | |
1826 | } | |
1827 | ||
1828 | + | |
1829 | +#ifdef GP2X | |
1830 | +void play_chunk(int idx) | |
1831 | +{ | |
1832 | + int cid; | |
1833 | +// if (use_sound) return; | |
1834 | + cid = Sample_Play (chunk[idx], 0, 0); | |
1835 | + Voice_SetPanning(cid, PAN_CENTER); | |
1836 | + Voice_SetVolume(cid, 1000); | |
1837 | +} | |
1838 | +#endif | |
1839 | + | |
1840 | + | |
1841 | void free_chunk(Mix_Chunk *chunk) | |
1842 | { | |
1843 | Mix_FreeChunk( chunk ); | |
1844 | } | |
1845 | ||
1846 | +void sound_volume ( int vol ) | |
1847 | +{ | |
1848 | +#ifndef GP2X | |
1849 | + static int volume = 10; | |
1850 | + | |
1851 | + if ( vol == 1 ) volume-=5; | |
1852 | + else if ( vol == 2 ) volume+=5; | |
1853 | + Mix_Volume(-1,volume); | |
1854 | +#endif | |
1855 | +} | |
1856 | + | |
1857 | +#ifdef GP2X | |
1858 | +void increaseSoundVolume(void) | |
1859 | +{ | |
1860 | + if (md_volume > (256 - 13)) md_volume = 256; | |
1861 | + else md_volume += 13; | |
1862 | +} | |
1863 | + | |
1864 | +void decreaseSoundVolume(void) | |
1865 | +{ | |
1866 | + if (md_volume < 13) md_volume = 0; | |
1867 | + else md_volume -= 13; | |
1868 | +} | |
1869 | +#endif | |
1870 | diff -ur supertux-0.1.3/src/sound.h supertux-0.1.3-gp2x/src/sound.h | |
1871 | --- supertux-0.1.3/src/sound.h 2005-06-22 00:16:07.000000000 +0300 | |
1872 | @@ -75,14 +75,27 @@ | |
1873 | #include <SDL_mixer.h> | |
1874 | ||
1875 | /* variables for stocking the sound and music */ | |
1876 | +#ifndef GP2X | |
1877 | extern Mix_Chunk* sounds[NUM_SOUNDS]; | |
1878 | +#endif | |
1879 | ||
1880 | /* functions handling the sound and music */ | |
1881 | int open_audio(int frequency, Uint16 format, int channels, int chunksize); | |
1882 | void close_audio( void ); | |
1883 | ||
1884 | +#ifndef GP2X | |
1885 | Mix_Chunk * load_sound(const std::string& file); | |
1886 | +#endif | |
1887 | void free_chunk(Mix_Chunk*chunk); | |
1888 | void play_sound(Mix_Chunk * snd, enum Sound_Speaker whichSpeaker); | |
1889 | +void sound_volume ( int vol ); | |
1890 | ||
1891 | #endif /*SUPERTUX_SOUND_H*/ | |
1892 | + | |
1893 | +#ifdef GP2X | |
1894 | +void play_chunk(int idx); | |
1895 | +static void load_sounds(); | |
1896 | +void updateSound ( void ); | |
1897 | +void increaseSoundVolume(void); | |
1898 | +void decreaseSoundVolume(void); | |
1899 | +#endif | |
1900 | diff -ur supertux-0.1.3/src/special.cpp supertux-0.1.3-gp2x/src/special.cpp | |
1901 | --- supertux-0.1.3/src/special.cpp 2005-06-22 00:16:07.000000000 +0300 | |
1902 | @@ -105,12 +105,21 @@ | |
1903 | ||
1904 | base.ym = base.ym + 0.5 * frame_ratio; | |
1905 | ||
1906 | +#ifndef RES320X240 | |
1907 | if (base.x < scroll_x || | |
1908 | base.x > scroll_x + screen->w || | |
1909 | base.y > screen->h || | |
1910 | issolid(base.x + 4, base.y + 2) || | |
1911 | issolid(base.x, base.y + 2) || | |
1912 | life_count <= 0) | |
1913 | +#else | |
1914 | + if (base.x < scroll_x || | |
1915 | + base.x > scroll_x + 640 || | |
1916 | + base.y > 480 || | |
1917 | + issolid(base.x + 4, base.y + 2) || | |
1918 | + issolid(base.x, base.y + 2) || | |
1919 | + life_count <= 0) | |
1920 | +#endif | |
1921 | { | |
1922 | remove_me(); | |
1923 | } | |
1924 | @@ -120,8 +129,13 @@ | |
1925 | void | |
1926 | Bullet::draw() | |
1927 | { | |
1928 | +#ifndef RES320X240 | |
1929 | if (base.x >= scroll_x - base.width && | |
1930 | base.x <= scroll_x + screen->w) | |
1931 | +#else | |
1932 | + if (base.x >= scroll_x - base.width && | |
1933 | + base.x <= scroll_x + 640) | |
1934 | +#endif | |
1935 | { | |
1936 | img_bullet->draw(base.x - scroll_x, base.y); | |
1937 | } | |
1938 | @@ -140,7 +154,7 @@ | |
1939 | { | |
1940 | kind = kind_; | |
1941 | dir = dir_; | |
1942 | - | |
1943 | + | |
1944 | base.width = 32; | |
1945 | base.height = 0; | |
1946 | base.x = x_; | |
1947 | @@ -197,7 +211,11 @@ | |
1948 | remove_me(); | |
1949 | return; | |
1950 | } | |
1951 | +#ifndef RES320X240 | |
1952 | if(base.y > screen->h) { | |
1953 | +#else | |
1954 | + if(base.y > 640) { | |
1955 | +#endif | |
1956 | remove_me(); | |
1957 | return; | |
1958 | } | |
1959 | @@ -252,7 +270,12 @@ | |
1960 | { | |
1961 | /* Rising up... */ | |
1962 | ||
1963 | + | |
1964 | +#ifndef RES320X240 | |
1965 | dest.x = (int)(base.x - scroll_x); | |
1966 | +#else | |
1967 | + dest.x = (int)(base.x - scroll_x)/2; | |
1968 | +#endif | |
1969 | dest.y = (int)(base.y + 32 - base.height); | |
1970 | dest.w = 32; | |
1971 | dest.h = (int)base.height; | |
1972 | @@ -297,7 +320,11 @@ | |
1973 | if(kind != UPGRADE_GROWUP) | |
1974 | return; | |
1975 | ||
1976 | +#ifndef GP2X | |
1977 | play_sound(sounds[SND_BUMP_UPGRADE], SOUND_CENTER_SPEAKER); | |
1978 | +#else | |
1979 | + play_chunk(SND_BUMP_UPGRADE); | |
1980 | +#endif | |
1981 | ||
1982 | // do a little jump and change direction | |
1983 | physic.set_velocity(-physic.get_velocity_x(), 3); | |
1984 | @@ -329,18 +356,30 @@ | |
1985 | ||
1986 | if (kind == UPGRADE_GROWUP) | |
1987 | { | |
1988 | +#ifndef GP2X | |
1989 | play_sound(sounds[SND_EXCELLENT], SOUND_CENTER_SPEAKER); | |
1990 | +#else | |
1991 | + play_chunk(SND_EXCELLENT); | |
1992 | +#endif | |
1993 | pplayer->grow(); | |
1994 | } | |
1995 | else if (kind == UPGRADE_ICEFLOWER) | |
1996 | { | |
1997 | +#ifndef GP2X | |
1998 | play_sound(sounds[SND_COFFEE], SOUND_CENTER_SPEAKER); | |
1999 | +#else | |
2000 | + play_chunk(SND_COFFEE); | |
2001 | +#endif | |
2002 | pplayer->grow(); | |
2003 | pplayer->got_coffee = true; | |
2004 | } | |
2005 | else if (kind == UPGRADE_HERRING) | |
2006 | { | |
2007 | +#ifndef GP2X | |
2008 | play_sound(sounds[SND_HERRING], SOUND_CENTER_SPEAKER); | |
2009 | +#else | |
2010 | + play_chunk(SND_HERRING); | |
2011 | +#endif | |
2012 | pplayer->invincible_timer.start(TUX_INVINCIBLE_TIME); | |
2013 | World::current()->play_music(HERRING_MUSIC); | |
2014 | } | |
2015 | @@ -348,7 +387,11 @@ | |
2016 | { | |
2017 | if(player_status.lives < MAX_LIVES) { | |
2018 | player_status.lives++; | |
2019 | +#ifndef GP2X | |
2020 | play_sound(sounds[SND_LIFEUP], SOUND_CENTER_SPEAKER); | |
2021 | +#else | |
2022 | + play_chunk(SND_LIFEUP); | |
2023 | +#endif | |
2024 | } | |
2025 | } | |
2026 | ||
2027 | diff -ur supertux-0.1.3/src/text.cpp supertux-0.1.3-gp2x/src/text.cpp | |
2028 | --- supertux-0.1.3/src/text.cpp 2005-06-22 00:16:07.000000000 +0300 | |
2029 | @@ -24,6 +24,7 @@ | |
2030 | #include "defines.h" | |
2031 | #include "screen.h" | |
2032 | #include "text.h" | |
2033 | +#include "sound.h" | |
2034 | ||
2035 | Text::Text(const std::string& file, int kind_, int w_, int h_) | |
2036 | { | |
2037 | @@ -79,6 +80,7 @@ | |
2038 | void | |
2039 | Text::draw(const char* text, int x, int y, int shadowsize, int update) | |
2040 | { | |
2041 | + | |
2042 | if(text != NULL) | |
2043 | { | |
2044 | if(shadowsize != 0) | |
2045 | @@ -116,6 +118,9 @@ | |
2046 | else if ( text[i] == '\n') | |
2047 | { | |
2048 | y += h + 2; | |
2049 | +#ifdef RES320X240 | |
2050 | + y+=6; | |
2051 | +#endif | |
2052 | j = 0; | |
2053 | } | |
2054 | } | |
2055 | @@ -129,6 +134,9 @@ | |
2056 | else if ( text[i] == '\n') | |
2057 | { | |
2058 | y += h + 2; | |
2059 | +#ifdef RES320X240 | |
2060 | + y+=6; | |
2061 | +#endif | |
2062 | j = 0; | |
2063 | } | |
2064 | } | |
2065 | @@ -306,6 +314,24 @@ | |
2066 | break; | |
2067 | } | |
2068 | break; | |
2069 | + | |
2070 | +#ifdef GP2X | |
2071 | + case SDL_JOYBUTTONDOWN: | |
2072 | + if ( event.jbutton.button == joystick_keymap.down_button ) { | |
2073 | + speed += SPEED_INC; | |
2074 | + } | |
2075 | + if ( event.jbutton.button == joystick_keymap.up_button ) { | |
2076 | + speed -= SPEED_INC; | |
2077 | + } | |
2078 | + if ( event.jbutton.button == joystick_keymap.b_button ) { | |
2079 | + done = 1; | |
2080 | + } | |
2081 | + if ( event.jbutton.button == joystick_keymap.a_button ) { | |
2082 | + scroll += SCROLL; | |
2083 | + } | |
2084 | + break; | |
2085 | +#endif | |
2086 | + | |
2087 | case SDL_QUIT: | |
2088 | done = 1; | |
2089 | break; | |
2090 | @@ -330,21 +356,36 @@ | |
2091 | white_small_text->drawf(names.item[i]+1, 0, screen->h+y-int(scroll), | |
2092 | A_HMIDDLE, A_TOP, 1); | |
2093 | y += white_small_text->h+ITEMS_SPACE; | |
2094 | +#ifdef RES320X240 | |
2095 | + y += 6; | |
2096 | +#endif | |
2097 | break; | |
2098 | case ' ': | |
2099 | white_text->drawf(names.item[i]+1, 0, screen->h+y-int(scroll), | |
2100 | A_HMIDDLE, A_TOP, 1); | |
2101 | y += white_text->h+ITEMS_SPACE; | |
2102 | +#ifdef RES320X240 | |
2103 | + y += 6; | |
2104 | +#endif | |
2105 | break; | |
2106 | case '-': | |
2107 | - white_big_text->drawf(names.item[i]+1, 0, screen->h+y-int(scroll), | |
2108 | - A_HMIDDLE, A_TOP, 3); | |
2109 | +#ifdef RES320X240 | |
2110 | + white_text->drawf(names.item[i]+1, 0, screen->h+y-int(scroll), A_HMIDDLE, A_TOP, 3); | |
2111 | +#else | |
2112 | + white_big_text->drawf(names.item[i]+1, 0, screen->h+y-int(scroll), A_HMIDDLE, A_TOP, 3); | |
2113 | +#endif | |
2114 | y += white_big_text->h+ITEMS_SPACE; | |
2115 | +#ifdef RES320X240 | |
2116 | + y += 6; | |
2117 | +#endif | |
2118 | break; | |
2119 | default: | |
2120 | blue_text->drawf(names.item[i], 0, screen->h+y-int(scroll), | |
2121 | A_HMIDDLE, A_TOP, 1); | |
2122 | y += blue_text->h+ITEMS_SPACE; | |
2123 | +#ifdef RES320X240 | |
2124 | + y += 6; | |
2125 | +#endif | |
2126 | break; | |
2127 | } | |
2128 | } | |
2129 | @@ -360,7 +401,13 @@ | |
2130 | if(scroll < 0) | |
2131 | scroll = 0; | |
2132 | ||
2133 | - SDL_Delay(10); | |
2134 | +#ifndef GP2X | |
2135 | + SDL_Delay(10); | |
2136 | +#else | |
2137 | + SDL_Delay(2); | |
2138 | + updateSound(); | |
2139 | +#endif | |
2140 | + | |
2141 | } | |
2142 | string_list_free(&names); | |
2143 | ||
2144 | diff -ur supertux-0.1.3/src/texture.cpp supertux-0.1.3-gp2x/src/texture.cpp | |
2145 | --- supertux-0.1.3/src/texture.cpp 2005-06-22 00:16:07.000000000 +0300 | |
2146 | @@ -211,7 +211,8 @@ | |
2147 | { | |
2148 | if (impl) | |
2149 | { | |
2150 | - if (impl->draw(x, y, alpha, update) == -2) | |
2151 | +// if (impl->draw(x, y, alpha, update) == -2) | |
2152 | + if (impl->draw(x/2, y/2, alpha, update) == -2) | |
2153 | reload(); | |
2154 | } | |
2155 | } | |
2156 | @@ -231,7 +232,8 @@ | |
2157 | { | |
2158 | if (impl) | |
2159 | { | |
2160 | - if (impl->draw_part(sx, sy, x, y, w, h, alpha, update) == -2) | |
2161 | +// if (impl->draw_part(sx, sy, x, y, w, h, alpha, update) == -2) | |
2162 | + if (impl->draw_part(sx, sy, x, y/2, w, h, alpha, update) == -2) | |
2163 | reload(); | |
2164 | } | |
2165 | } | |
2166 | @@ -241,7 +243,8 @@ | |
2167 | { | |
2168 | if (impl) | |
2169 | { | |
2170 | - if (impl->draw_stretched(x, y, w, h, alpha, update) == -2) | |
2171 | +// if (impl->draw_stretched(x, y, w, h, alpha, update) == -2) | |
2172 | + if (impl->draw_stretched(x/2, y/2, w, h, alpha, update) == -2) | |
2173 | reload(); | |
2174 | } | |
2175 | } | |
2176 | diff -ur supertux-0.1.3/src/title.cpp supertux-0.1.3-gp2x/src/title.cpp | |
2177 | --- supertux-0.1.3/src/title.cpp 2005-07-08 15:19:17.000000000 +0300 | |
2178 | @@ -51,6 +51,7 @@ | |
2179 | #include "tile.h" | |
2180 | #include "resources.h" | |
2181 | #include "worldmap.h" | |
2182 | +#include "sound.h" | |
2183 | ||
2184 | static Surface* bkg_title; | |
2185 | static Surface* logo; | |
2186 | @@ -80,6 +81,10 @@ | |
2187 | ||
2188 | void generate_contrib_menu() | |
2189 | { | |
2190 | +#ifdef RES320X240 | |
2191 | + fadeout(); | |
2192 | +#endif | |
2193 | + | |
2194 | string_list_type level_subsets = dsubdirs("/levels", "info"); | |
2195 | ||
2196 | free_contrib_menu(); | |
2197 | @@ -208,7 +213,7 @@ | |
2198 | } | |
2199 | ||
2200 | // Wrap around at the end of the level back to the beginnig | |
2201 | - if(plevel->width * 32 - 320 < tux->base.x) | |
2202 | + if((plevel->width * 32) - 320 < tux->base.x) | |
2203 | { | |
2204 | tux->level_begin(); | |
2205 | scroll_x = 0; | |
2206 | @@ -226,7 +231,6 @@ | |
2207 | { | |
2208 | walking = false; | |
2209 | } | |
2210 | - | |
2211 | world->draw(); | |
2212 | } | |
2213 | ||
2214 | @@ -301,13 +305,26 @@ | |
2215 | ||
2216 | if (Menu::current() == main_menu) | |
2217 | logo->draw( 160, 30); | |
2218 | - | |
2219 | + | |
2220 | +#ifndef RES320X240 | |
2221 | white_small_text->draw(" SuperTux " VERSION "\n" | |
2222 | "Copyright (c) 2003 SuperTux Devel Team\n" | |
2223 | "This game comes with ABSOLUTELY NO WARRANTY. This is free software, and you\n" | |
2224 | "are welcome to redistribute it under certain conditions; see the file COPYING\n" | |
2225 | "for details.\n", | |
2226 | 0, 420, 0); | |
2227 | +#else | |
2228 | + white_small_text->draw(" SuperTux " VERSION "\n" | |
2229 | + "Copyright (c) 2003 SuperTux Devel Team\n" | |
2230 | + "This game comes with ABSOLUTELY NO \n" | |
2231 | + "WARRANTY. This is free software, and\n" | |
2232 | + "you are welcome to redistribute it\n" | |
2233 | + "under certain conditions; see the file\n" | |
2234 | + "COPYING for details.\n", | |
2235 | + 0, 360, 0); | |
2236 | +#endif | |
2237 | + | |
2238 | + //updateSound(); | |
2239 | ||
2240 | /* Don't draw menu, if quit is true */ | |
2241 | Menu* menu = Menu::current(); | |
2242 | @@ -337,10 +354,10 @@ | |
2243 | break; | |
2244 | case MNID_CREDITS: | |
2245 | music_manager = new MusicManager(); | |
2246 | - menu_song = music_manager->load_music(datadir + "/music/credits.ogg"); | |
2247 | + menu_song = music_manager->load_music(datadir + "/music/credits.mod"); | |
2248 | music_manager->halt_music(); | |
2249 | music_manager->play_music(menu_song,0); | |
2250 | - display_text_file("CREDITS", bkg_title, SCROLL_SPEED_CREDITS); | |
2251 | + display_text_file("CREDITS", bkg_title, SCROLL_SPEED_CREDITS); | |
2252 | music_manager->halt_music(); | |
2253 | menu_song = music_manager->load_music(datadir + "/music/theme.mod"); | |
2254 | music_manager->play_music(menu_song); | |
2255 | diff -ur supertux-0.1.3/src/world.cpp supertux-0.1.3-gp2x/src/world.cpp | |
2256 | --- supertux-0.1.3/src/world.cpp 2005-06-22 00:16:07.000000000 +0300 | |
2257 | @@ -206,6 +206,7 @@ | |
2258 | } | |
2259 | } | |
2260 | ||
2261 | + | |
2262 | /* Draw interactive tiles: */ | |
2263 | for (y = 0; y < 15; ++y) | |
2264 | { | |
2265 | @@ -255,6 +256,8 @@ | |
2266 | { | |
2267 | (*p)->draw(scroll_x, 0, 1); | |
2268 | } | |
2269 | + | |
2270 | + //updateSound(); | |
2271 | } | |
2272 | ||
2273 | void | |
2274 | @@ -312,7 +315,12 @@ | |
2275 | ||
2276 | // the space that it takes for the screen to start scrolling, regarding | |
2277 | // screen bounds (in pixels) | |
2278 | +#ifndef RES320X240 | |
2279 | #define X_SPACE (400-16) | |
2280 | +#else | |
2281 | +#define X_SPACE (80-16) | |
2282 | +#endif | |
2283 | + | |
2284 | // the time it takes to move the camera (in ms) | |
2285 | #define CHANGE_DIR_SCROLL_SPEED 2000 | |
2286 | ||
2287 | @@ -388,8 +396,13 @@ | |
2288 | // this code prevent the screen to scroll before the start or after the level's end | |
2289 | if(scroll_x < 0) | |
2290 | scroll_x = 0; | |
2291 | +#ifndef RES320X240 | |
2292 | if(scroll_x > level->width * 32 - screen->w) | |
2293 | scroll_x = level->width * 32 - screen->w; | |
2294 | +#else | |
2295 | + if(scroll_x > level->width * 32 - 640) | |
2296 | + scroll_x = level->width * 32 - 640; | |
2297 | +#endif | |
2298 | } | |
2299 | ||
2300 | void | |
2301 | @@ -481,6 +494,10 @@ | |
2302 | void | |
2303 | World::add_score(float x, float y, int s) | |
2304 | { | |
2305 | +#ifdef RES320X240 | |
2306 | + x=x/2; | |
2307 | +#endif | |
2308 | + | |
2309 | player_status.score += s; | |
2310 | ||
2311 | FloatingScore* new_floating_score = new FloatingScore(); | |
2312 | @@ -547,8 +564,11 @@ | |
2313 | Bullet new_bullet; | |
2314 | new_bullet.init(x,y,xm,dir); | |
2315 | bullets.push_back(new_bullet); | |
2316 | - | |
2317 | +#ifndef GP2X | |
2318 | play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER); | |
2319 | +#else | |
2320 | + play_chunk(SND_SHOOT); | |
2321 | +#endif | |
2322 | } | |
2323 | ||
2324 | void | |
2325 | @@ -608,8 +628,11 @@ | |
2326 | counting_distros = false; | |
2327 | plevel->change(x, y, TM_IA, tile->next_tile); | |
2328 | } | |
2329 | - | |
2330 | +#ifndef GP2X | |
2331 | play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); | |
2332 | +#else | |
2333 | + play_chunk(SND_DISTRO); | |
2334 | +#endif | |
2335 | player_status.score = player_status.score + SCORE_DISTRO; | |
2336 | player_status.distros++; | |
2337 | } | |
2338 | @@ -622,9 +645,13 @@ | |
2339 | add_broken_brick(tile, | |
2340 | ((int)(x + 1) / 32) * 32, | |
2341 | (int)(y / 32) * 32); | |
2342 | - | |
2343 | + | |
2344 | /* Get some score: */ | |
2345 | +#ifndef GP2X | |
2346 | play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); | |
2347 | +#else | |
2348 | + play_chunk(SND_BRICK); | |
2349 | +#endif | |
2350 | player_status.score = player_status.score + SCORE_BRICK; | |
2351 | } | |
2352 | } | |
2353 | @@ -652,7 +679,11 @@ | |
2354 | { | |
2355 | case 1: // Box with a distro! | |
2356 | add_bouncy_distro(posx, posy); | |
2357 | +#ifndef GP2X | |
2358 | play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); | |
2359 | +#else | |
2360 | + play_chunk(SND_DISTRO); | |
2361 | +#endif | |
2362 | player_status.score = player_status.score + SCORE_DISTRO; | |
2363 | player_status.distros++; | |
2364 | break; | |
2365 | @@ -662,7 +693,11 @@ | |
2366 | add_upgrade(posx, posy, col_side, UPGRADE_GROWUP); | |
2367 | else /* Tux is big, add an iceflower: */ | |
2368 | add_upgrade(posx, posy, col_side, UPGRADE_ICEFLOWER); | |
2369 | +#ifndef GP2X | |
2370 | play_sound(sounds[SND_UPGRADE], SOUND_CENTER_SPEAKER); | |
2371 | +#else | |
2372 | + play_chunk(SND_UPGRADE); | |
2373 | +#endif | |
2374 | break; | |
2375 | ||
2376 | case 3: // Add a golden herring | |
2377 | @@ -688,7 +723,11 @@ | |
2378 | if (tile && tile->distro) | |
2379 | { | |
2380 | level->change(x, y, TM_IA, tile->next_tile); | |
2381 | +#ifndef GP2X | |
2382 | play_sound(sounds[SND_DISTRO], SOUND_CENTER_SPEAKER); | |
2383 | +#else | |
2384 | + play_chunk(SND_DISTRO); | |
2385 | +#endif | |
2386 | ||
2387 | if (bounciness == BOUNCE) | |
2388 | { | |
2389 | diff -ur supertux-0.1.3/src/worldmap.cpp supertux-0.1.3-gp2x/src/worldmap.cpp | |
2390 | --- supertux-0.1.3/src/worldmap.cpp 2005-07-08 15:19:17.000000000 +0300 | |
2391 | @@ -376,11 +376,11 @@ | |
2392 | { | |
2393 | tile_manager = new TileManager(); | |
2394 | ||
2395 | - width = 20; | |
2396 | - height = 15; | |
2397 | + width = (int)(20); | |
2398 | + height = (int)(15); | |
2399 | ||
2400 | - start_x = 4; | |
2401 | - start_y = 5; | |
2402 | + start_x = int(4); | |
2403 | + start_y = int(5); | |
2404 | ||
2405 | passive_message_timer.init(true); | |
2406 | ||
2407 | @@ -395,7 +395,7 @@ | |
2408 | enter_level = false; | |
2409 | ||
2410 | name = "<no file>"; | |
2411 | - music = "SALCON.MOD"; | |
2412 | + music = "salcon.mod"; | |
2413 | } | |
2414 | ||
2415 | WorldMap::~WorldMap() | |
2416 | @@ -589,7 +589,8 @@ | |
2417 | break; | |
2418 | } | |
2419 | break; | |
2420 | - | |
2421 | + | |
2422 | +#ifndef GP2X | |
2423 | case SDL_JOYAXISMOTION: | |
2424 | if (event.jaxis.axis == joystick_keymap.x_axis) | |
2425 | { | |
2426 | @@ -617,13 +618,29 @@ | |
2427 | if (event.jhat.value == SDL_HAT_RIGHT) | |
2428 | input_direction = D_EAST; | |
2429 | break; | |
2430 | - | |
2431 | +#endif | |
2432 | case SDL_JOYBUTTONDOWN: | |
2433 | +#ifndef GP2X | |
2434 | if (event.jbutton.button == joystick_keymap.b_button) | |
2435 | enter_level = true; | |
2436 | else if (event.jbutton.button == joystick_keymap.start_button) | |
2437 | on_escape_press(); | |
2438 | break; | |
2439 | +#else | |
2440 | + if (event.jbutton.button == joystick_keymap.a_button) | |
2441 | + enter_level = true; | |
2442 | + else if (event.jbutton.button == joystick_keymap.start_button) | |
2443 | + on_escape_press(); | |
2444 | + else if (event.jbutton.button == joystick_keymap.up_button) | |
2445 | + input_direction = D_NORTH; | |
2446 | + else if (event.jbutton.button == joystick_keymap.down_button) | |
2447 | + input_direction = D_SOUTH; | |
2448 | + else if (event.jbutton.button == joystick_keymap.right_button) | |
2449 | + input_direction = D_EAST; | |
2450 | + else if (event.jbutton.button == joystick_keymap.left_button) | |
2451 | + input_direction = D_WEST; | |
2452 | + break; | |
2453 | +#endif | |
2454 | ||
2455 | default: | |
2456 | break; | |
2457 | @@ -769,13 +786,13 @@ | |
2458 | { | |
2459 | MusicRef theme = | |
2460 | music_manager->load_music(datadir + "/music/theme.mod"); | |
2461 | - MusicRef credits = music_manager->load_music(datadir + "/music/credits.ogg"); | |
2462 | + MusicRef credits = music_manager->load_music(datadir + "/music/credits.xm"); | |
2463 | music_manager->play_music(theme); | |
2464 | // Display final credits and go back to the main menu | |
2465 | display_text_file(level->extro_filename, | |
2466 | "/images/background/extro.jpg", SCROLL_SPEED_MESSAGE); | |
2467 | music_manager->play_music(credits,0); | |
2468 | - display_text_file("CREDITS", | |
2469 | + display_text_file("CREDITS", | |
2470 | "/images/background/oiltux.jpg", SCROLL_SPEED_CREDITS); | |
2471 | music_manager->play_music(theme); | |
2472 | quit = true; | |
2473 | @@ -812,7 +829,12 @@ | |
2474 | if (level->x == tux->get_tile_pos().x && | |
2475 | level->y == tux->get_tile_pos().y) | |
2476 | { | |
2477 | +#ifndef GP2X | |
2478 | play_sound(sounds[SND_TELEPORT], SOUND_CENTER_SPEAKER); | |
2479 | +#else | |
2480 | + play_chunk(SND_TELEPORT); | |
2481 | + updateSound(); | |
2482 | +#endif | |
2483 | tux->back_direction = D_NONE; | |
2484 | tux->set_tile_pos(Point(level->teleport_dest_x, level->teleport_dest_y)); | |
2485 | SDL_Delay(1000); | |
2486 | @@ -914,26 +936,39 @@ | |
2487 | void | |
2488 | WorldMap::draw_status() | |
2489 | { | |
2490 | + int xdiv; | |
2491 | + | |
2492 | +#ifdef RES320X240 | |
2493 | + xdiv=2; | |
2494 | +#else | |
2495 | + xdiv=1; | |
2496 | +#endif | |
2497 | + | |
2498 | char str[80]; | |
2499 | sprintf(str, "%d", player_status.score); | |
2500 | white_text->draw("SCORE", 0, 0); | |
2501 | - gold_text->draw(str, 96, 0); | |
2502 | + gold_text->draw(str, (int)(96)/xdiv, 0); | |
2503 | ||
2504 | sprintf(str, "%d", player_status.distros); | |
2505 | - white_text->draw_align("COINS", 320-64, 0, A_LEFT, A_TOP); | |
2506 | - gold_text->draw_align(str, 320+64, 0, A_RIGHT, A_TOP); | |
2507 | + white_text->draw_align("COINS", (int)(320-64)/xdiv, 0, A_LEFT, A_TOP); | |
2508 | + gold_text->draw_align(str, (int)(320+64)/xdiv, 0, A_RIGHT, A_TOP); | |
2509 | ||
2510 | - white_text->draw("LIVES", 480, 0); | |
2511 | + white_text->draw("LIVES", (int)(480)/xdiv, 0); | |
2512 | if (player_status.lives >= 5) | |
2513 | { | |
2514 | sprintf(str, "%dx", player_status.lives); | |
2515 | - gold_text->draw_align(str, 617, 0, A_RIGHT, A_TOP); | |
2516 | - tux_life->draw(565+(18*3), 0); | |
2517 | +#ifdef RES320X240 | |
2518 | + gold_text->draw_align(str, (int)(617)/xdiv-5, 0, A_RIGHT, A_TOP); | |
2519 | + tux_life->draw((int)((565-12+(18*3))), 0); | |
2520 | +#else | |
2521 | + gold_text->draw_align(str, (int)(617), 0, A_RIGHT, A_TOP); | |
2522 | + tux_life->draw((int)((565+(18*3))), 0); | |
2523 | +#endif | |
2524 | } | |
2525 | else | |
2526 | { | |
2527 | for(int i= 0; i < player_status.lives; ++i) | |
2528 | - tux_life->draw(565+(18*i),0); | |
2529 | + tux_life->draw((565+(18/xdiv*i)),0); | |
2530 | } | |
2531 | ||
2532 | if (!tux->is_moving()) | |
2533 | @@ -945,7 +980,11 @@ | |
2534 | { | |
2535 | if(!i->name.empty()) | |
2536 | { | |
2537 | +#ifndef RES320X240 | |
2538 | white_text->draw_align(i->title.c_str(), screen->w/2, screen->h, A_HMIDDLE, A_BOTTOM); | |
2539 | +#else | |
2540 | + white_text->draw_align(i->title.c_str(), screen->w/2, 470, A_HMIDDLE, A_BOTTOM); | |
2541 | +#endif | |
2542 | } | |
2543 | else if (i->teleport_dest_x != -1) { | |
2544 | if(!i->teleport_message.empty()) | |
2545 | @@ -955,7 +994,7 @@ | |
2546 | /* Display a message in the map, if any as been selected */ | |
2547 | if(!i->display_map_message.empty() && !i->passive_message) | |
2548 | gold_text->draw_align(i->display_map_message.c_str(), | |
2549 | - screen->w/2, screen->h - 30,A_HMIDDLE, A_BOTTOM); | |
2550 | + screen->w/2, screen->h - (int)(30),A_HMIDDLE, A_BOTTOM); | |
2551 | break; | |
2552 | } | |
2553 | } | |
2554 | @@ -964,7 +1003,7 @@ | |
2555 | /* Display a passive message in the map, if needed */ | |
2556 | if(passive_message_timer.check()) | |
2557 | gold_text->draw_align(passive_message.c_str(), | |
2558 | - screen->w/2, screen->h - 30,A_HMIDDLE, A_BOTTOM); | |
2559 | + screen->w/2, screen->h - (int)(30),A_HMIDDLE, A_BOTTOM); | |
2560 | } | |
2561 | ||
2562 | void | |
2563 | @@ -997,6 +1036,7 @@ | |
2564 | Point tux_pos = tux->get_pos(); | |
2565 | if (1) | |
2566 | { | |
2567 | +#ifndef GP2X | |
2568 | offset.x = -tux_pos.x + screen->w/2; | |
2569 | offset.y = -tux_pos.y + screen->h/2; | |
2570 | ||
2571 | @@ -1005,6 +1045,16 @@ | |
2572 | ||
2573 | if (offset.x < screen->w - width*32) offset.x = screen->w - width*32; | |
2574 | if (offset.y < screen->h - height*32) offset.y = screen->h - height*32; | |
2575 | +#else | |
2576 | + offset.x = -tux_pos.x + 640/2; | |
2577 | + offset.y = -tux_pos.y + 480/2; | |
2578 | + | |
2579 | + if (offset.x > 0) offset.x = 0; | |
2580 | + if (offset.y > 0) offset.y = 0; | |
2581 | + | |
2582 | + if (offset.x < 640 - width*32) offset.x = 640 - width*32; | |
2583 | + if (offset.y < 480 - height*32) offset.y = 480 - height*32; | |
2584 | +#endif | |
2585 | } | |
2586 | ||
2587 | draw(offset); |
supertux/patches/002-compilation-fixes.patch | ||
---|---|---|
1 | Index: supertux-0.1.3/src/badguy.cpp | |
2 | =================================================================== | |
3 | --- supertux-0.1.3.orig/src/badguy.cpp | |
4 | @@ -21,6 +21,7 @@ | |
5 | // 02111-1307, USA. | |
6 | ||
7 | #include <iostream> | |
8 | +#include <cstdlib> | |
9 | #include <math.h> | |
10 | ||
11 | #include "globals.h" | |
12 | Index: supertux-0.1.3/src/configfile.cpp | |
13 | =================================================================== | |
14 | --- supertux-0.1.3.orig/src/configfile.cpp | |
15 | @@ -18,7 +18,7 @@ | |
16 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
17 | ||
18 | #include <stdlib.h> | |
19 | -#include <string> | |
20 | +#include <cstring> | |
21 | #include "configfile.h" | |
22 | #include "setup.h" | |
23 | #include "globals.h" | |
24 | Index: supertux-0.1.3/src/gameobjs.cpp | |
25 | =================================================================== | |
26 | --- supertux-0.1.3.orig/src/gameobjs.cpp | |
27 | @@ -19,6 +19,7 @@ | |
28 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
29 | // 02111-1307, USA. | |
30 | #include <algorithm> | |
31 | +#include <cstring> | |
32 | #include "world.h" | |
33 | #include "tile.h" | |
34 | #include "gameloop.h" | |
35 | Index: supertux-0.1.3/src/particlesystem.cpp | |
36 | =================================================================== | |
37 | --- supertux-0.1.3.orig/src/particlesystem.cpp | |
38 | @@ -20,6 +20,7 @@ | |
39 | #include "particlesystem.h" | |
40 | ||
41 | #include <iostream> | |
42 | +#include <cstdlib> | |
43 | #include <math.h> | |
44 | #include "globals.h" | |
45 | #include "world.h" | |
46 | Index: supertux-0.1.3/src/sprite_manager.cpp | |
47 | =================================================================== | |
48 | --- supertux-0.1.3.orig/src/sprite_manager.cpp | |
49 | @@ -18,6 +18,7 @@ | |
50 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
51 | ||
52 | #include <iostream> | |
53 | +#include <cstring> | |
54 | #include "lispreader.h" | |
55 | #include "sprite_manager.h" | |
56 | ||
57 | Index: supertux-0.1.3/src/tile.cpp | |
58 | =================================================================== | |
59 | --- supertux-0.1.3.orig/src/tile.cpp | |
60 | @@ -21,6 +21,7 @@ | |
61 | #include "tile.h" | |
62 | #include "scene.h" | |
63 | #include "assert.h" | |
64 | +#include <cstring> | |
65 | ||
66 | TileManager* TileManager::instance_ = 0; | |
67 | std::set<TileGroup>* TileManager::tilegroups_ = 0; | |
68 | Index: supertux-0.1.3/src/worldmap.cpp | |
69 | =================================================================== | |
70 | --- supertux-0.1.3.orig/src/worldmap.cpp | |
71 | @@ -20,6 +20,7 @@ | |
72 | #include <iostream> | |
73 | #include <fstream> | |
74 | #include <vector> | |
75 | +#include <cstring> | |
76 | #include <assert.h> | |
77 | #include <unistd.h> | |
78 | #include "globals.h" |
supertux/patches/003-install-no-overwrite.patch | ||
---|---|---|
1 | Index: supertux-0.1.3/data/Makefile.am | |
2 | =================================================================== | |
3 | --- supertux-0.1.3.orig/data/Makefile.am 2010-07-04 22:53:15.209949507 +0200 | |
4 | @@ -2,8 +2,6 @@ | |
5 | supertux.strf \ | |
6 | $(wildcard *.txt) \ | |
7 | CREDITS \ | |
8 | - $(wildcard sounds/*.wav) \ | |
9 | - images/icon.xpm \ | |
10 | $(wildcard images/*.png) \ | |
11 | $(wildcard images/*.xpm) \ | |
12 | $(wildcard images/background/*.png) \ |
supertux/patches/004-extra-qualification.patch | ||
---|---|---|
1 | --- supertux-0.1.3/src/menu.h 2011-02-13 21:26:19.427185060 +0300 | |
2 | @@ -207,7 +207,7 @@ | |
3 | ||
4 | bool isToggled(int id); | |
5 | ||
6 | - void Menu::get_controlfield_key_into_input(MenuItem *item); | |
7 | + void get_controlfield_key_into_input(MenuItem *item); | |
8 | ||
9 | void draw (); | |
10 | void draw_item(int index, int menu_width, int menu_height); |