diff options
| author | Paul Sokolovsky <pmiscml@gmail.com> | 2008-01-17 13:02:45 +0000 |
|---|---|---|
| committer | Paul Sokolovsky <pmiscml@gmail.com> | 2008-01-17 13:02:45 +0000 |
| commit | a96a64e4975b8e3100904f902bd3b24f521210fb (patch) | |
| tree | 527dc300ac7bd41c00a429efbda53511d9b00109 /packages | |
| parent | d6ab8cb7bb36e7876efeb274dd1aad1d3b1f6f3b (diff) | |
supertux-qvga 0.1.3: Add QVGA port of SperTux, based on GP2X port.
* Original GP2X port by Ingo Arndt.
* Data conversion preparation and script by myself.
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/supertux/files/gp2x.patch | 2614 | ||||
| -rw-r--r-- | packages/supertux/files/img-resize.sh | 28 | ||||
| -rw-r--r-- | packages/supertux/files/supertux-smallsize-data.tar.bz2 | bin | 0 -> 41782 bytes | |||
| -rw-r--r-- | packages/supertux/supertux-qvga_0.1.3.bb | 57 |
4 files changed, 2699 insertions, 0 deletions
diff --git a/packages/supertux/files/gp2x.patch b/packages/supertux/files/gp2x.patch new file mode 100644 index 0000000000..9d5d9a6d02 --- /dev/null +++ b/packages/supertux/files/gp2x.patch @@ -0,0 +1,2614 @@ +Only in supertux-0.1.3: aclocal.m4 +diff -ur supertux-0.1.3/AUTHORS supertux-0.1.3-gp2x/AUTHORS +--- supertux-0.1.3/AUTHORS 2005-07-02 14:37:30.000000000 +0300 ++++ supertux-0.1.3-gp2x/AUTHORS 2006-04-13 06:11:02.000000000 +0300 +@@ -91,6 +91,12 @@ + + Royalty free CDROMs and FTP sites sounds + ++Port to GP2X ++----------- ++ Ingo Arndt ++ scachi@gmx.de ++ http://www.bitmage.de ++ + More information and contacts + ============================= + +Only in supertux-0.1.3: autom4te.cache +Only in supertux-0.1.3-gp2x: autoscan.log +Only in supertux-0.1.3-gp2x: COMPILE4GP2X +Only in supertux-0.1.3: config.guess +Only in supertux-0.1.3: config.log +Only in supertux-0.1.3: config.status +Only in supertux-0.1.3: config.sub +Only in supertux-0.1.3: configure +diff -ur supertux-0.1.3/configure.ac supertux-0.1.3-gp2x/configure.ac +--- supertux-0.1.3/configure.ac 2005-07-06 12:26:15.000000000 +0300 ++++ supertux-0.1.3-gp2x/configure.ac 2006-04-19 22:29:05.000000000 +0300 +@@ -76,13 +76,33 @@ + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + ++AM_PATH_LIBMIKMOD(, ++ :, ++ AC_MSG_ERROR([*** mikmod not found!])) ++CXXFLAGS="$CXXFLAGS $LIBMIKMOD_CFLAGS" ++CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS" ++LIBS="$LIBS $LIBMIKMOD_LIBS" ++ + dnl Checks for additional libraries. ++AC_CHECK_LIB(smpeg, SMPEG_status) ++ ++AC_CHECK_LIB(mikmod, MikMod_Init) ++ + AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,, + AC_MSG_ERROR([SDL_mixer library required])) + ++AC_CHECK_LIB(jpeg,jpeg_abort) ++ ++AC_CHECK_LIB(z,compress) ++ ++AC_CHECK_LIB(png,png_free) ++ + AC_CHECK_LIB(SDL_image, IMG_Load,, + AC_MSG_ERROR([SDL_image library required])) + ++AC_CHECK_LIB(SDL_gfx, rotozoomSurface,, ++ AC_MSG_ERROR([SDL_gfx library required])) ++ + if test "x${enable_opengl}" != "xno"; then + AX_CHECK_GL + fi +@@ -95,7 +115,30 @@ + LIBS="$LIBS $GL_LIBS" + fi + +-AC_CHECK_LIB(z, gzopen,, AC_MSG_ERROR([*** zlib is missing])) ++# compile for the testing the 320x240 resolution ++# compile for the gp2x ++AC_ARG_ENABLE(gp2x, ++[ --enable-gp2x Build the gp2x version [default=no]], ++ , enable_gp2x=no) ++if test x$enable_gp2x = xyes; then ++ CXXFLAGS="$CXXFLAGS -DGP2X" ++fi ++ ++AC_ARG_ENABLE(320x240, ++[ --enable-320x240 Test the 320x240 resolution [default=no]], ++ , enable_320x240=no) ++if test x$enable_320x240 = xyes; then ++ CXXFLAGS="$CXXFLAGS -DRES320X240" ++fi ++ ++# compile static ++AC_ARG_ENABLE(static, ++[ --enable-static Build the static version [default=no]], ++ , enable_static=no) ++if test x$enable_static = xyes; then ++ CXXFLAGS="$CXXFLAGS -static" ++fi ++ + + CXXFLAGS="$CXXFLAGS -DDATA_PREFIX='\"$datadir/supertux\"'" + +@@ -110,6 +153,9 @@ + echo " Profile Mode: $enable_gprof" + echo " Debug Mode: $enable_debug" + echo " OpenGL Support: $enable_opengl" ++echo " 320x240 Resolution: $enable_320x240" ++echo " GP2X Build (+320x240): $enable_gp2x" ++echo " Static Build: $enable_static" + echo "" + + # EOF # +Only in supertux-0.1.3/data: CREDITS +Only in supertux-0.1.3/data: extro-bonus2.txt +Only in supertux-0.1.3/data: extro-bonus.txt +Only in supertux-0.1.3/data: extro.txt +Only in supertux-0.1.3/data: images +Only in supertux-0.1.3/data: intro.txt +Only in supertux-0.1.3/data: levels +Only in supertux-0.1.3/data: Makefile +Only in supertux-0.1.3/data: Makefile.in +Only in supertux-0.1.3/data: music +Only in supertux-0.1.3/data: sounds +Only in supertux-0.1.3/data: supertux.strf +Only in supertux-0.1.3: depcomp +Only in supertux-0.1.3: install-sh +Only in supertux-0.1.3: m4 +Only in supertux-0.1.3: Makefile +Only in supertux-0.1.3: Makefile.in +Only in supertux-0.1.3: missing +Only in supertux-0.1.3: mkinstalldirs +Only in supertux-0.1.3: patches +diff -ur supertux-0.1.3/src/badguy.cpp supertux-0.1.3-gp2x/src/badguy.cpp +--- supertux-0.1.3/src/badguy.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/badguy.cpp 2006-04-20 21:32:23.000000000 +0300 +@@ -250,7 +250,11 @@ + tux.kick_timer.start(KICKING_TIME); + set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); + physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5); ++#ifndef GP2X + play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_KICK); ++#endif + } + } + +@@ -260,6 +264,7 @@ + check_horizontal_bump(); + if(mode == KICK && changed != dir) + { ++#ifndef GP2X + /* handle stereo sound (number 10 should be tweaked...)*/ + if (base.x < scroll_x + screen->w/2 - 10) + play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER); +@@ -267,6 +272,9 @@ + play_sound(sounds[SND_RICOCHET], SOUND_RIGHT_SPEAKER); + else + play_sound(sounds[SND_RICOCHET], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_RICOCHET); ++#endif + } + } + +@@ -455,11 +463,15 @@ + + /* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates... + if (base.x < scroll_x + screen->w/2 - 10) ++#ifndef GP2X + play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER); + else if (base.x > scroll_x + screen->w/2 + 10) + play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER); + else + play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_EXPLODE); ++#endif + + } else if(mode == BOMB_EXPLODE) { + remove_me(); +@@ -677,13 +689,21 @@ + } + + // BadGuy fall below the ground ++#ifndef RES320X240 + if (base.y > screen->h) { ++#else ++ if (base.y > 640) { ++#endif + remove_me(); + return; + } + + // Once it's on screen, it's activated! ++#ifndef RES320X240 + if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE) ++#else ++ if (base.x <= scroll_x + 640 + OFFSCREEN_DISTANCE) ++#endif + seen = true; + + if(!seen) +@@ -743,7 +763,11 @@ + BadGuy::draw() + { + // Don't try to draw stuff that is outside of the screen ++#ifndef RES320X240 + if(base.x <= scroll_x - base.width || base.x >= scroll_x + screen->w) ++#else ++ if(base.x <= scroll_x - base.width || base.x >= scroll_x + 640) ++#endif + return; + + if(sprite_left == 0 || sprite_right == 0) +@@ -811,7 +835,11 @@ + + World::current()->add_score(base.x - scroll_x, + base.y, 50 * player_status.score_multiplier); ++#ifndef GP2X + play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_SQUISH); ++#endif + player_status.score_multiplier++; + + dying = DYING_SQUISHED; +@@ -830,7 +858,11 @@ + + player->jump_of_badguy(this); + World::current()->add_score(base.x - scroll_x, base.y, 50 * player_status.score_multiplier); ++#ifndef GP2X + play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_SQUISH); ++#endif + player_status.score_multiplier++; + remove_me(); + return; +@@ -839,7 +871,11 @@ + if (mode == NORMAL || mode == KICK) + { + /* Flatten! */ ++#ifndef GP2X + play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_STOMP); ++#endif + mode = FLAT; + set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); + physic.set_velocity_x(0); +@@ -847,7 +883,11 @@ + timer.start(4000); + } else if (mode == FLAT) { + /* Kick! */ ++#ifndef GP2X + play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_KICK); ++#endif + + if (player->base.x < base.x + (base.width/2)) { + physic.set_velocity_x(5); +@@ -925,7 +965,11 @@ + score * player_status.score_multiplier); + + /* Play death sound: */ ++#ifndef GP2X + play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_FALL); ++#endif + } + + void BadGuy::explode(BadGuy *badguy) +@@ -1053,7 +1097,11 @@ + /* Get kicked if were flat */ + if (mode == FLAT && !dying) + { ++#ifndef GP2X + play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_KICK); ++#endif + + // Hit from left side + if (player->base.x < base.x) { +diff -ur supertux-0.1.3/src/configfile.cpp supertux-0.1.3-gp2x/src/configfile.cpp +--- supertux-0.1.3/src/configfile.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/configfile.cpp 2006-04-10 13:32:19.000000000 +0300 +@@ -92,12 +92,22 @@ + else + use_joystick = true; + ++#ifndef GP2X + reader.read_int ("joystick-x", &joystick_keymap.x_axis); + reader.read_int ("joystick-y", &joystick_keymap.y_axis); + reader.read_int ("joystick-a", &joystick_keymap.a_button); + reader.read_int ("joystick-b", &joystick_keymap.b_button); + reader.read_int ("joystick-start", &joystick_keymap.start_button); + reader.read_int ("joystick-deadzone", &joystick_keymap.dead_zone); ++#else ++ reader.read_int ("joystick-up", &joystick_keymap.up_button); ++ reader.read_int ("joystick-down", &joystick_keymap.down_button); ++ reader.read_int ("joystick-right", &joystick_keymap.right_button); ++ reader.read_int ("joystick-left", &joystick_keymap.left_button); ++ reader.read_int ("joystick-a", &joystick_keymap.a_button); ++ reader.read_int ("joystick-b", &joystick_keymap.b_button); ++ reader.read_int ("joystick-start", &joystick_keymap.start_button); ++#endif + + reader.read_int ("keyboard-jump", &keymap.jump); + reader.read_int ("keyboard-duck", &keymap.duck); +@@ -130,12 +140,22 @@ + fprintf(config, "\n\t;; joystick number (-1 means no joystick):\n"); + fprintf(config, "\t(joystick %d)\n", use_joystick ? joystick_num : -1); + ++#ifndef GP2X + fprintf(config, "\t(joystick-x %d)\n", joystick_keymap.x_axis); + fprintf(config, "\t(joystick-y %d)\n", joystick_keymap.y_axis); + fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button); + fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button); + fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button); + fprintf(config, "\t(joystick-deadzone %d)\n", joystick_keymap.dead_zone); ++#else ++ fprintf(config, "\t(joystick-up %d)\n", joystick_keymap.up_button); ++ fprintf(config, "\t(joystick-down %d)\n", joystick_keymap.down_button); ++ fprintf(config, "\t(joystick-right %d)\n", joystick_keymap.right_button); ++ fprintf(config, "\t(joystick-left %d)\n", joystick_keymap.left_button); ++ fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button); ++ fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button); ++ fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button); ++#endif + + fprintf(config, "\t(keyboard-jump %d)\n", keymap.jump); + fprintf(config, "\t(keyboard-duck %d)\n", keymap.duck); +diff -ur supertux-0.1.3/src/defines.h supertux-0.1.3-gp2x/src/defines.h +--- supertux-0.1.3/src/defines.h 2005-07-07 02:05:03.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/defines.h 2006-04-11 22:02:05.000000000 +0300 +@@ -91,7 +91,11 @@ + + /* Scrolling text speed */ + ++#ifndef RES320X240 + #define SCROLL_SPEED_CREDITS 1.2 ++#else ++#define SCROLL_SPEED_CREDITS 2.4 ++#endif + #define SCROLL_SPEED_MESSAGE 1.0 + + /* Debugging */ +Only in supertux-0.1.3/src: .deps +diff -ur supertux-0.1.3/src/gameloop.cpp supertux-0.1.3-gp2x/src/gameloop.cpp +--- supertux-0.1.3/src/gameloop.cpp 2005-07-02 15:16:08.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/gameloop.cpp 2006-05-05 23:22:58.000000000 +0300 +@@ -288,6 +288,7 @@ + + switch(event.type) + { ++#ifndef GP2X + case SDL_QUIT: /* Quit event - quit: */ + st_abort("Received window close", ""); + break; +@@ -434,22 +435,60 @@ + tux.input.down = UP; + } + break; +- ++#endif + case SDL_JOYBUTTONDOWN: ++#ifndef GP2X ++ if (event.jbutton.button == joystick_keymap.a_button) ++ tux.input.up = DOWN; ++ else if (event.jbutton.button == joystick_keymap.b_button) ++ tux.input.fire = DOWN; ++ else if (event.jbutton.button == joystick_keymap.start_button) ++ on_escape_press(); ++ break; ++#else + if (event.jbutton.button == joystick_keymap.a_button) + tux.input.up = DOWN; + else if (event.jbutton.button == joystick_keymap.b_button) + tux.input.fire = DOWN; + else if (event.jbutton.button == joystick_keymap.start_button) + on_escape_press(); ++ else if (event.jbutton.button == joystick_keymap.up_button) ++ tux.input.up = DOWN; ++ else if (event.jbutton.button == joystick_keymap.down_button) ++ tux.input.down = DOWN; ++ else if (event.jbutton.button == joystick_keymap.right_button) ++ tux.input.right = DOWN; ++ else if (event.jbutton.button == joystick_keymap.left_button) ++ tux.input.left = DOWN; ++ else if (event.jbutton.button == joystick_keymap.voldown_button) ++ decreaseSoundVolume(); ++ else if (event.jbutton.button == joystick_keymap.volup_button) ++ increaseSoundVolume(); + break; ++#endif ++ + case SDL_JOYBUTTONUP: ++#ifndef GP2X + if (event.jbutton.button == joystick_keymap.a_button) + tux.input.up = UP; + else if (event.jbutton.button == joystick_keymap.b_button) + tux.input.fire = UP; + break; +- ++#else ++ if (event.jbutton.button == joystick_keymap.a_button) ++ tux.input.up = UP; ++ else if (event.jbutton.button == joystick_keymap.b_button) ++ tux.input.fire = UP; ++ else if (event.jbutton.button == joystick_keymap.up_button) ++ tux.input.up = UP; ++ else if (event.jbutton.button == joystick_keymap.down_button) ++ tux.input.down = UP; ++ else if (event.jbutton.button == joystick_keymap.right_button) ++ tux.input.right = UP; ++ else if (event.jbutton.button == joystick_keymap.left_button) ++ tux.input.left = UP; ++ break; ++#endif + default: + break; + } /* switch */ +@@ -464,7 +503,7 @@ + Player* tux = world->get_tux(); + + /* End of level? */ +- int endpos = (World::current()->get_level()->width-5) * 32; ++ int endpos = (World::current()->get_level()->width-5) * (32); + Tile* endtile = collision_goal(tux->base); + + // fallback in case the other endpositions don't trigger +@@ -545,7 +584,7 @@ + Menu::current()->draw(); + mouse_cursor->draw(); + } +- ++ //updateSound(); + updatescreen(); + } + +@@ -599,6 +638,7 @@ + + while (exit_status == ES_NONE) + { ++ SDL_Delay(10); + /* Calculate the movement-factor */ + double frame_ratio = ((double)(update_time-last_update_time))/((double)FRAME_RATE); + +@@ -686,6 +726,7 @@ + fps_cnt = 0; + } + } ++ //updateSound(); + } + + return exit_status; +@@ -694,21 +735,32 @@ + /* Bounce a brick: */ + void bumpbrick(float x, float y) + { +- World::current()->add_bouncy_brick(((int)(x + 1) / 32) * 32, +- (int)(y / 32) * 32); ++ World::current()->add_bouncy_brick(((int)(x + 1) / (32)) * (32), ++ (int)(y / (32)) * (32)); + ++#ifndef GP2X + play_sound(sounds[SND_BRICK], SOUND_CENTER_SPEAKER); ++#else ++ play_chunk(SND_BRICK); ++#endif + } + + /* (Status): */ + void + GameSession::drawstatus() + { ++ int xdiv; ++#ifdef RES320X240 ++ xdiv=2; ++#else ++ xdiv=1; ++#endif ++ + char str[60]; + + sprintf(str, "%d", player_status.score); + white_text->draw("SCORE", 0, 0, 1); +- gold_text->draw(str, 96, 0, 1); ++ gold_text->draw(str, 96/xdiv, 0, 1); + + if(st_gl_mode == ST_GL_TEST) + { +@@ -716,28 +768,33 @@ + } + + if(!time_left.check()) { +- white_text->draw("TIME'S UP", 224, 0, 1); ++ white_text->draw("TIME'S UP", 224/xdiv, 0, 1); + } else if (time_left.get_left() > TIME_WARNING || (global_frame_counter % 10) < 5) { + sprintf(str, "%d", time_left.get_left() / 1000 ); +- white_text->draw("TIME", 224, 0, 1); +- gold_text->draw(str, 304, 0, 1); ++ white_text->draw("TIME", 224/xdiv, 0, 1); ++ gold_text->draw(str, 304/xdiv, 0, 1); + } + + sprintf(str, "%d", player_status.distros); + white_text->draw("COINS", screen->h, 0, 1); +- gold_text->draw(str, 608, 0, 1); ++ gold_text->draw(str, 608/xdiv, 0, 1); + +- white_text->draw("LIVES", 480, 20); ++ white_text->draw("LIVES", 480/xdiv, 20); + if (player_status.lives >= 5) + { + sprintf(str, "%dx", player_status.lives); ++#ifdef RES320X240 ++ gold_text->draw_align(str, 617/xdiv-5, 20, A_RIGHT, A_TOP); ++ tux_life->draw(565+(18*3)/xdiv+10, 20); ++#else + gold_text->draw_align(str, 617, 20, A_RIGHT, A_TOP); + tux_life->draw(565+(18*3), 20); ++#endif + } + else + { + for(int i= 0; i < player_status.lives; ++i) +- tux_life->draw(565+(18*i),20); ++ tux_life->draw(565+(18*i)/xdiv,20); + } + + if(show_fps) +@@ -746,6 +803,7 @@ + white_text->draw("FPS", screen->h, 40, 1); + gold_text->draw(str, screen->h + 60, 40, 1); + } ++// updateSound(); + } + + void +@@ -824,4 +882,3 @@ + return tmp; + } + +- +diff -ur supertux-0.1.3/src/gameobjs.cpp supertux-0.1.3-gp2x/src/gameobjs.cpp +--- supertux-0.1.3/src/gameobjs.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/gameobjs.cpp 2006-04-11 21:52:52.000000000 +0300 +@@ -98,6 +98,9 @@ + src.h = 16; + + dest.x = (int)(base.x - scroll_x); ++#ifdef RES320X240 ++ dest.x=dest.x/2; ++#endif + dest.y = (int)base.y; + dest.w = 16; + dest.h = 16; +@@ -143,8 +146,13 @@ + { + SDL_Rect dest; + ++#ifndef RES320X240 + if (base.x >= scroll_x - 32 && + base.x <= scroll_x + screen->w) ++#else ++ if (base.x >= scroll_x - 32 && ++ base.x <= scroll_x + 640) ++#endif + { + dest.x = (int)(base.x - scroll_x); + dest.y = (int)base.y; +@@ -165,8 +173,14 @@ + else + { + int s = ((int)scroll_x / 2)%640; ++ ++#ifdef RES320X240 ++ plevel->img_bkgd->draw_part(dest.x/2 + s/2, dest.y/2, ++ dest.x/2, dest.y,dest.w/2,dest.h/2); ++#else + plevel->img_bkgd->draw_part(dest.x + s, dest.y, + dest.x, dest.y,dest.w,dest.h); ++#endif + } + + Tile::draw(base.x - scroll_x, +diff -ur supertux-0.1.3/src/globals.cpp supertux-0.1.3-gp2x/src/globals.cpp +--- supertux-0.1.3/src/globals.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/globals.cpp 2006-04-11 22:39:03.000000000 +0300 +@@ -25,6 +25,7 @@ + + JoystickKeymap::JoystickKeymap() + { ++#ifndef GP2X + a_button = 0; + b_button = 1; + start_button = 2; +@@ -33,6 +34,17 @@ + y_axis = 1; + + dead_zone = 4096; ++#else ++ a_button = GP2X_BUTTON_A; ++ b_button = GP2X_BUTTON_X; ++ start_button = GP2X_BUTTON_START; ++ up_button = GP2X_BUTTON_UP; ++ down_button = GP2X_BUTTON_DOWN; ++ left_button = GP2X_BUTTON_LEFT; ++ right_button = GP2X_BUTTON_RIGHT; ++ volup_button = GP2X_BUTTON_VOLUP; ++ voldown_button = GP2X_BUTTON_VOLDOWN; ++#endif + } + + JoystickKeymap joystick_keymap; +diff -ur supertux-0.1.3/src/globals.h supertux-0.1.3-gp2x/src/globals.h +--- supertux-0.1.3/src/globals.h 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/globals.h 2006-04-11 23:45:27.000000000 +0300 +@@ -28,10 +28,33 @@ + #include "menu.h" + #include "mousecursor.h" + ++#ifdef GP2X ++#define GP2X_BUTTON_UP (0) ++#define GP2X_BUTTON_DOWN (4) ++#define GP2X_BUTTON_LEFT (2) ++#define GP2X_BUTTON_RIGHT (6) ++#define GP2X_BUTTON_UPLEFT (1) ++#define GP2X_BUTTON_UPRIGHT (7) ++#define GP2X_BUTTON_DOWNLEFT (3) ++#define GP2X_BUTTON_DOWNRIGHT (5) ++#define GP2X_BUTTON_CLICK (18) ++#define GP2X_BUTTON_A (12) ++#define GP2X_BUTTON_B (13) ++#define GP2X_BUTTON_X (15) ++#define GP2X_BUTTON_Y (14) ++#define GP2X_BUTTON_L (10) ++#define GP2X_BUTTON_R (11) ++#define GP2X_BUTTON_START (8) ++#define GP2X_BUTTON_SELECT (9) ++#define GP2X_BUTTON_VOLUP (16) ++#define GP2X_BUTTON_VOLDOWN (17) ++#endif ++ + extern std::string datadir; + + struct JoystickKeymap + { ++#ifndef GP2X + int a_button; + int b_button; + int start_button; +@@ -42,6 +65,19 @@ + int dead_zone; + + JoystickKeymap(); ++#else ++ int a_button; ++ int b_button; ++ int start_button; ++ int up_button; ++ int down_button; ++ int left_button; ++ int right_button; ++ int volup_button; ++ int voldown_button; ++ ++ JoystickKeymap(); ++#endif + }; + + extern JoystickKeymap joystick_keymap; +diff -ur supertux-0.1.3/src/lispreader.h supertux-0.1.3-gp2x/src/lispreader.h +Only in supertux-0.1.3/src: Makefile +diff -ur supertux-0.1.3/src/Makefile.am supertux-0.1.3-gp2x/src/Makefile.am +--- supertux-0.1.3/src/Makefile.am 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/Makefile.am 2006-04-19 21:55:54.000000000 +0300 +@@ -77,3 +77,5 @@ + musicref.h + + # EOF # ++ ++#supertux_LDADD = libmikmod +Only in supertux-0.1.3/src: Makefile.in +diff -ur supertux-0.1.3/src/menu.cpp supertux-0.1.3-gp2x/src/menu.cpp +--- supertux-0.1.3/src/menu.cpp 2005-06-29 15:44:13.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/menu.cpp 2006-05-04 23:59:29.000000000 +0300 +@@ -53,6 +53,8 @@ + Menu* options_menu = 0; + Menu* options_keys_menu = 0; + Menu* options_joystick_menu = 0; ++Menu* options_joystick_axis_menu = 0; ++Menu* options_joystick_button_menu = 0; + Menu* highscore_menu = 0; + Menu* load_game_menu = 0; + Menu* save_game_menu = 0; +@@ -240,8 +242,10 @@ + } + + /* Set ControlField a key */ ++//TODO: get joystick in here somehow + void Menu::get_controlfield_key_into_input(MenuItem *item) + { ++#ifndef GP2X + switch(*item->int_p) + { + case SDLK_UP: +@@ -288,6 +292,11 @@ + } + break; + } ++#else ++ char tmp[64]; ++ snprintf(tmp, 64, "%d", *item->int_p); ++ item->change_input(tmp); ++#endif + } + + /* Free a menu and all its items */ +@@ -497,8 +506,13 @@ + int menu_height) + { + MenuItem& pitem = item[index]; +- ++ ++#ifndef RES320X240 + int font_width = 16; ++#else ++ int font_width = 16/2; ++#endif ++ + int effect_offset = 0; + { + int effect_time = 0; +@@ -510,7 +524,7 @@ + } + + int x_pos = pos_x; +- int y_pos = pos_y + 24*index - menu_height/2 + 12 + effect_offset; ++ int y_pos = pos_y + (int)(24)*index - menu_height/2 + 12 + effect_offset; + int shadow_size = 2; + int text_width = strlen(pitem.text) * font_width; + int input_width = (strlen(pitem.input)+ 1) * font_width; +@@ -518,7 +532,7 @@ + Text* text_font = white_text; + + if (arrange_left) +- x_pos += 24 - menu_width/2 + (text_width + input_width + list_width)/2; ++ x_pos += (int)(24) - menu_width/2 + (text_width + input_width + list_width)/2; + + if(index == active_item) + { +@@ -538,7 +552,11 @@ + + case MN_HL: + { ++#ifndef RES320X240 + int x = pos_x - menu_width/2; ++#else ++ int x = pos_x - menu_width/4; ++#endif + int y = y_pos - 12 - effect_offset; + /* Draw a horizontal line with a little 3d effect */ + fillrect(x, y + 6, +@@ -551,9 +569,15 @@ + } + case MN_LABEL: + { ++#ifndef RES320X240 + white_big_text->draw_align(pitem.text, + x_pos, y_pos, + A_HMIDDLE, A_VMIDDLE, 2); ++#else ++ white_text->draw_align(pitem.text, ++ x_pos, y_pos, ++ A_HMIDDLE, A_VMIDDLE, 2); ++#endif + break; + } + case MN_TEXTFIELD: +@@ -570,8 +594,9 @@ + input_width + font_width, 18, + 0,0,0,128); + +- if(pitem.kind == MN_CONTROLFIELD) ++ if(pitem.kind == MN_CONTROLFIELD) { + get_controlfield_key_into_input(&pitem); ++ } + + if(pitem.kind == MN_TEXTFIELD || pitem.kind == MN_NUMFIELD) + { +@@ -663,7 +688,7 @@ + menu_width += 2; + } + } +- ++ + return (menu_width * 16 + 24); + } + +@@ -680,10 +705,17 @@ + int menu_width = get_width(); + + /* Draw a transparent background */ ++#ifndef RES320X240 + fillrect(pos_x - menu_width/2, + pos_y - 24*item.size()/2 - 10, + menu_width,menu_height + 20, + 150,180,200,125); ++#else ++ fillrect(pos_x - menu_width/4, ++ pos_y - 24*item.size()/2 - 10, ++ menu_width,menu_height + 20, ++ 150,180,200,125); ++#endif + + for(unsigned int i = 0; i < item.size(); ++i) + { +@@ -723,6 +755,8 @@ + SDLKey key; + switch(event.type) + { ++ ++#ifndef GP2X + case SDL_KEYDOWN: + key = event.key.keysym.sym; + SDLMod keymod; +@@ -754,7 +788,6 @@ + return; + } + +- + switch(key) + { + case SDLK_UP: /* Menu Up */ +@@ -800,12 +833,14 @@ + break; + } + break; ++ + case SDL_JOYHATMOTION: + if(event.jhat.value == SDL_HAT_UP) + menuaction = MENU_ACTION_UP; + if(event.jhat.value == SDL_HAT_DOWN) + menuaction = MENU_ACTION_DOWN; + break; ++ + case SDL_JOYAXISMOTION: + if(event.jaxis.axis == joystick_keymap.y_axis) + { +@@ -815,9 +850,88 @@ + menuaction = MENU_ACTION_UP; + } + break; ++#endif ++ + case SDL_JOYBUTTONDOWN: ++#ifndef GP2X + menuaction = MENU_ACTION_HIT; + break; ++#else ++ ++ if(item[active_item].kind == MN_CONTROLFIELD) ++ { ++ if( event.jbutton.button == joystick_keymap.start_button ) ++ { ++ Menu::pop_current(); ++ return; ++ } ++ ++ static int save[8]={-1,-1,-1,-1,-1,-1,-1,-1}; ++ int itemid=get_active_item_id(); ++ int inputkey; ++ switch ( itemid ) { ++ case 11 : inputkey=joystick_keymap.up_button; ++ break; ++ case 12 : inputkey=joystick_keymap.down_button; ++ break; ++ case 13 : inputkey=joystick_keymap.left_button; ++ break; ++ case 14 : inputkey=joystick_keymap.right_button; ++ break; ++ case 15 : inputkey=joystick_keymap.a_button; ++ break; ++ case 16 : inputkey=joystick_keymap.b_button; ++ break; ++ default : break; ++ } ++ ++ *item[active_item].int_p = event.jbutton.button; ++ ++ bool okay=true; ++ ++ save[itemid-11]=event.jbutton.button; ++ ++ int i; ++ for ( i=0;i<itemid-11;i++ ) { ++ if ( save[i] == event.jbutton.button ) okay=false; ++ } ++ if ( okay == true ) menuaction = MENU_ACTION_DOWN; ++ else menuaction = MENU_ACTION_NONE; ++ ++ return; ++ } ++ ++ if (event.jbutton.button == joystick_keymap.a_button) ++ menuaction = MENU_ACTION_HIT; ++ else if (event.jbutton.button == joystick_keymap.b_button) ++ menuaction = MENU_ACTION_HIT; ++ else if (event.jbutton.button == joystick_keymap.start_button) ++ menuaction = MENU_ACTION_HIT; ++ else if (event.jbutton.button == joystick_keymap.up_button) ++ menuaction = MENU_ACTION_UP; ++ else if (event.jbutton.button == joystick_keymap.down_button) ++ menuaction = MENU_ACTION_DOWN; ++ else if (event.jbutton.button == joystick_keymap.right_button) ++ menuaction = MENU_ACTION_RIGHT; ++ else if (event.jbutton.button == joystick_keymap.left_button) ++ menuaction = MENU_ACTION_LEFT; ++ else if (event.jbutton.button == joystick_keymap.volup_button) ++#ifdef GP2X ++ increaseSoundVolume(); ++#else ++ sound_volume(2); ++#endif ++ else if (event.jbutton.button == joystick_keymap.voldown_button) ++#ifdef GP2X ++ decreaseSoundVolume(); ++#else ++ sound_volume(1); ++#endif ++ break; ++ ++#endif ++ ++#ifndef GP2X + case SDL_MOUSEBUTTONDOWN: + x = event.motion.x; + y = event.motion.y; +@@ -847,6 +961,7 @@ + break; + default: + break; ++#endif + } + } + +diff -ur supertux-0.1.3/src/menu.h supertux-0.1.3-gp2x/src/menu.h +--- supertux-0.1.3/src/menu.h 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/menu.h 2006-05-04 23:48:30.000000000 +0300 +@@ -236,6 +236,8 @@ + extern Menu* options_menu; + extern Menu* options_keys_menu; + extern Menu* options_joystick_menu; ++extern Menu* options_joystick_axis_menu; ++extern Menu* options_joystick_button_menu; + extern Menu* highscore_menu; + extern Menu* load_game_menu; + extern Menu* save_game_menu; +diff -ur supertux-0.1.3/src/music_manager.cpp supertux-0.1.3-gp2x/src/music_manager.cpp +--- supertux-0.1.3/src/music_manager.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/music_manager.cpp 2006-04-22 13:16:32.000000000 +0300 +@@ -59,7 +59,14 @@ + return true; + } + ++#ifndef GP2X + Mix_Music* song = Mix_LoadMUS(file.c_str()); ++#else ++ char mfile[100]; ++ snprintf(mfile,sizeof(mfile),"%s",file.c_str()); ++ MODULE *song=Player_Load(mfile, 64, 0); ++#endif ++ + if(song == 0) + return false; + +@@ -84,6 +91,8 @@ + void + MusicManager::play_music(const MusicRef& musicref, int loops) + { ++// printf("loop: %d, musicref: %d\n",loops,musicref.music); ++ + if(!audio_device) + return; + +@@ -97,7 +106,16 @@ + current_music->refcount++; + + if(music_enabled) ++#ifndef GP2X + Mix_PlayMusic(current_music->music, loops); ++#else ++ { ++ if ( loops == -1 ) current_music->music->wrap=1; ++ Player_Stop(); ++ Player_Start(current_music->music); ++ Player_SetPosition(0); ++ } ++#endif + } + + void +@@ -106,13 +124,17 @@ + if(!audio_device) + return; + ++#ifndef GP2X + Mix_HaltMusic(); ++#else ++ Player_Stop(); ++#endif + + if(current_music) { + current_music->refcount--; + if(current_music->refcount == 0) + free_music(current_music); +- current_music = 0; ++ current_music = 0; + } + } + +@@ -127,9 +149,17 @@ + + music_enabled = enable; + if(music_enabled == false) { ++#ifndef GP2X + Mix_HaltMusic(); ++#else ++ Player_Stop(); ++#endif + } else { ++#ifndef GP2X + Mix_PlayMusic(current_music->music, -1); ++#else ++ Player_Start(current_music->music); ++#endif + } + } + +diff -ur supertux-0.1.3/src/music_manager.h supertux-0.1.3-gp2x/src/music_manager.h +--- supertux-0.1.3/src/music_manager.h 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/music_manager.h 2006-04-22 04:51:32.000000000 +0300 +@@ -20,6 +20,10 @@ + #ifndef HEADER_MUSIC_MANAGER_H + #define HEADER_MUSIC_MANAGER_H + ++#ifdef GP2X ++#include "mikmod.h" ++#endif ++ + #include <SDL_mixer.h> + #include <string> + #include <map> +@@ -51,7 +55,12 @@ + ~MusicResource(); + + MusicManager* manager; ++#ifndef GP2X + Mix_Music* music; ++#else ++ MODULE *music; ++#endif ++ + int refcount; + }; + +diff -ur supertux-0.1.3/src/particlesystem.cpp supertux-0.1.3-gp2x/src/particlesystem.cpp +--- supertux-0.1.3/src/particlesystem.cpp 2005-06-22 00:16:07.000000000 +0300 ++++ supertux-0.1.3-gp2x/src/particlesystem.cpp 2006-04-12 22:20:41.000000000 +0300 +@@ -28,8 +28,13 @@ + + ParticleSystem::ParticleSystem() + { ++#ifndef RES320X240 + virtual_width = screen->w; + virtual_height = screen->h; ++#else ++ virtual_width = 640; ++ virtual_height = 480; ++#endif + } + + ParticleSystem::~ParticleSystem() +@@ -57,13 +62,24 @@ + float ymax = fmodf(y + particle->texture->h, virtual_height); + + // particle on screen ++#ifndef RES320X240 + if(x >= screen->w && xmax >= screen->w) + continue; + if(y >= screen->h && ymax >= screen->h) + continue; +- ++ + if(x > screen->w) x -= virtual_width; + if(y > screen->h) y -= virtual_height; ++#else |
