From: Tobias Gläßer Date: Tue, 20 Jul 2004 18:04:49 +0000 (+0000) Subject: mainly changed #includes to work with the new SuperTux library X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=236df51d91f0845cd4e06b3269e262911d81f5db;p=supertux.git mainly changed #includes to work with the new SuperTux library SVN-Revision: 1599 --- diff --git a/src/background.cpp b/src/background.cpp index 78a91809d..fef1c99c7 100644 --- a/src/background.cpp +++ b/src/background.cpp @@ -18,10 +18,10 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "background.h" -#include "globals.h" +#include "app/globals.h" #include "camera.h" -#include "screen/drawing_context.h" -#include "lispwriter.h" +#include "video/drawing_context.h" +#include "utils/lispwriter.h" Background::Background() : type(INVALID), image(0) diff --git a/src/background.h b/src/background.h index bafb77c5d..375343fca 100644 --- a/src/background.h +++ b/src/background.h @@ -20,10 +20,10 @@ #ifndef SUPERTUX_BACKGROUND_H #define SUPERTUX_BACKGROUND_H -#include "screen/surface.h" -#include "screen/drawing_context.h" -#include "game_object.h" -#include "lispreader.h" +#include "video/surface.h" +#include "video/drawing_context.h" +#include "special/game_object.h" +#include "utils/lispreader.h" #include "serializable.h" class DisplayManager; diff --git a/src/badguy.cpp b/src/badguy.cpp index 28d151b60..807a8d86c 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -23,14 +23,14 @@ #include #include -#include "globals.h" -#include "defines.h" +#include "app/globals.h" +#include "app/defines.h" +#include "special/sprite_manager.h" +#include "utils/lispwriter.h" #include "badguy.h" #include "tile.h" #include "resources.h" -#include "sprite_manager.h" #include "camera.h" -#include "lispwriter.h" #include "level.h" #include "sector.h" #include "tilemap.h" @@ -321,7 +321,7 @@ BadGuy::action_mriceblock(double elapsed_time) if (mode != HELD) { // move - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if (dying != DYING_FALLING) collision_swept_object_map(&old_base,&base); } @@ -357,7 +357,7 @@ BadGuy::action_mriceblock(double elapsed_time) 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); - sound_manager->play_sound(sounds[SND_KICK], this); + sound_manager->play_sound(sounds[SND_KICK], this, Sector::current()->player->get_pos()); } } @@ -367,7 +367,7 @@ BadGuy::action_mriceblock(double elapsed_time) check_horizontal_bump(); if(mode == KICK && changed != dir) { - sound_manager->play_sound(sounds[SND_RICOCHET], get_pos()); + sound_manager->play_sound(sounds[SND_RICOCHET], get_pos(), Sector::current()->player->get_pos()); } } @@ -519,7 +519,7 @@ BadGuy::action_jumpy(double elapsed_time) dir = LEFT; // move - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if(dying == DYING_NOT) collision_swept_object_map(&old_base, &base); } @@ -538,7 +538,7 @@ BadGuy::action_mrbomb(double elapsed_time) fall(); - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if (dying != DYING_FALLING) collision_swept_object_map(&old_base,&base); } @@ -561,7 +561,7 @@ BadGuy::action_bomb(double elapsed_time) dying = DYING_NOT; // now the bomb hurts timer.start(EXPLODETIME); - sound_manager->play_sound(sounds[SND_EXPLODE], this); + sound_manager->play_sound(sounds[SND_EXPLODE], this, Sector::current()->player->get_pos()); } else if(mode == BOMB_EXPLODE) { remove_me(); return; @@ -569,7 +569,7 @@ BadGuy::action_bomb(double elapsed_time) } // move - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); collision_swept_object_map(&old_base,&base); } @@ -610,7 +610,7 @@ BadGuy::action_stalactite(double elapsed_time) } // move - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if(dying == DYING_SQUISHED && !timer.check()) remove_me(); @@ -664,7 +664,7 @@ BadGuy::action_fish(double elapsed_time) physic.enable_gravity(true); } - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if(dying == DYING_NOT) collision_swept_object_map(&old_base, &base); @@ -693,7 +693,7 @@ BadGuy::action_bouncingsnowball(double elapsed_time) // check for right/left collisions check_horizontal_bump(); - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if(dying == DYING_NOT) collision_swept_object_map(&old_base, &base); @@ -729,7 +729,7 @@ BadGuy::action_flyingsnowball(double elapsed_time) if(dying != DYING_NOT) physic.enable_gravity(true); - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if(dying == DYING_NOT || dying == DYING_SQUISHED) collision_swept_object_map(&old_base, &base); @@ -760,7 +760,7 @@ BadGuy::action_spiky(double elapsed_time) } #endif - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if (dying != DYING_FALLING) collision_swept_object_map(&old_base,&base); } @@ -773,7 +773,7 @@ BadGuy::action_snowball(double elapsed_time) fall(); - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if (dying != DYING_FALLING) collision_swept_object_map(&old_base,&base); @@ -805,7 +805,7 @@ BadGuy::action_wingling(double elapsed_time) physic.set_velocity(dirsign * WINGLING_FLY_SPEED, 0); } - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); // Handle dying timer: @@ -841,7 +841,7 @@ BadGuy::action_walkingtree(double elapsed_time) } - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if (dying != DYING_FALLING) collision_swept_object_map(&old_base,&base); @@ -1034,7 +1034,7 @@ BadGuy::squish_me(Player* player) Sector::current()->add_score(Vector(base.x, base.y), 50 * player_status.score_multiplier); - sound_manager->play_sound(sounds[SND_SQUISH], get_pos()); + sound_manager->play_sound(sounds[SND_SQUISH], get_pos(), Sector::current()->player->get_pos()); player_status.score_multiplier++; dying = DYING_SQUISHED; @@ -1054,7 +1054,7 @@ BadGuy::squish(Player* player) player->bounce(this); Sector::current()->add_score(Vector(base.x, base.y), 50 * player_status.score_multiplier); - sound_manager->play_sound(sounds[SND_SQUISH], get_pos()); + sound_manager->play_sound(sounds[SND_SQUISH], get_pos(), Sector::current()->player->get_pos()); player_status.score_multiplier++; return; @@ -1062,7 +1062,7 @@ BadGuy::squish(Player* player) if (mode == NORMAL || mode == KICK) { /* Flatten! */ - sound_manager->play_sound(sounds[SND_STOMP], get_pos()); + sound_manager->play_sound(sounds[SND_STOMP], get_pos(), Sector::current()->player->get_pos()); mode = FLAT; set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right); physic.set_velocity_x(0); @@ -1070,7 +1070,7 @@ BadGuy::squish(Player* player) timer.start(4000); } else if (mode == FLAT) { /* Kick! */ - sound_manager->play_sound(sounds[SND_KICK], this); + sound_manager->play_sound(sounds[SND_KICK], this, Sector::current()->player->get_pos()); if (player->base.x < base.x + (base.width/2)) { physic.set_velocity_x(5); @@ -1171,7 +1171,7 @@ BadGuy::kill_me(int score) score * player_status.score_multiplier); /* Play death sound: */ - sound_manager->play_sound(sounds[SND_FALL], this); + sound_manager->play_sound(sounds[SND_FALL], this, Sector::current()->player->get_pos()); } void @@ -1334,7 +1334,7 @@ BadGuy::collision(void *p_c_object, int c_object, CollisionType type) /* Get kicked if were flat */ if (mode == FLAT && !dying) { - sound_manager->play_sound(sounds[SND_KICK], this); + sound_manager->play_sound(sounds[SND_KICK], this, Sector::current()->player->get_pos()); // Hit from left side if (player->base.x < base.x) { diff --git a/src/badguy.h b/src/badguy.h index 03c881851..0db6b6160 100644 --- a/src/badguy.h +++ b/src/badguy.h @@ -25,14 +25,19 @@ #include "SDL.h" -#include "timer.h" -#include "screen/surface.h" -#include "physic.h" -#include "sprite.h" -#include "defines.h" -#include "moving_object.h" +#include "special/timer.h" +#include "video/surface.h" +#include "math/physic.h" +#include "special/sprite.h" +#include "app/defines.h" +#include "special/moving_object.h" #include "collision.h" #include "serializable.h" +#include "scene.h" + +/* Timing constants (in ms): */ + +#define KICKING_TIME 200 /* Bad guy kinds: */ enum BadGuyKind { diff --git a/src/camera.cpp b/src/camera.cpp index b440d0e00..df856b86b 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -22,11 +22,11 @@ #include #include "camera.h" -#include "lispwriter.h" +#include "utils/lispwriter.h" #include "player.h" #include "tilemap.h" #include "gameloop.h" -#include "globals.h" +#include "app/globals.h" #include "sector.h" Camera::Camera(Sector* newsector) diff --git a/src/camera.h b/src/camera.h index 9c1170880..099e1642d 100644 --- a/src/camera.h +++ b/src/camera.h @@ -23,9 +23,9 @@ #include #include -#include "defines.h" -#include "vector.h" -#include "game_object.h" +#include "app/defines.h" +#include "math/vector.h" +#include "special/game_object.h" #include "serializable.h" class LispReader; diff --git a/src/collision.cpp b/src/collision.cpp index 716c05aa5..1620a2aba 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -19,7 +19,7 @@ // 02111-1307, USA. #include -#include "defines.h" +#include "app/defines.h" #include "collision.h" #include "bitmask.h" #include "scene.h" diff --git a/src/collision.h b/src/collision.h index 399366544..cbbaeefa0 100644 --- a/src/collision.h +++ b/src/collision.h @@ -21,7 +21,7 @@ #ifndef SUPERTUX_COLLISION_H #define SUPERTUX_COLLISION_H -#include "type.h" +#include "special/base.h" class Tile; diff --git a/src/door.cpp b/src/door.cpp index 95d9807bf..a749280be 100644 --- a/src/door.cpp +++ b/src/door.cpp @@ -18,14 +18,14 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "door.h" -#include "lispreader.h" -#include "lispwriter.h" +#include "utils/lispreader.h" +#include "utils/lispwriter.h" #include "gameloop.h" #include "resources.h" -#include "sprite.h" -#include "sprite_manager.h" -#include "screen/drawing_context.h" -#include "globals.h" +#include "special/sprite.h" +#include "special/sprite_manager.h" +#include "video/drawing_context.h" +#include "app/globals.h" /** data images */ Sprite* door; diff --git a/src/door.h b/src/door.h index 402799998..1c22907a4 100644 --- a/src/door.h +++ b/src/door.h @@ -22,9 +22,10 @@ #include +#include "video/surface.h" #include "interactive_object.h" #include "serializable.h" -#include "timer.h" +#include "special/timer.h" class Sprite; diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 0e7d27c48..87c7bdc80 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -36,13 +36,13 @@ #include #endif -#include "defines.h" -#include "globals.h" +#include "app/defines.h" +#include "app/globals.h" #include "gameloop.h" -#include "screen/screen.h" -#include "setup.h" +#include "video/screen.h" +#include "app/setup.h" #include "high_scores.h" -#include "menu.h" +#include "gui/menu.h" #include "badguy.h" #include "sector.h" #include "special.h" @@ -55,7 +55,10 @@ #include "resources.h" #include "background.h" #include "tilemap.h" -#include "gettext.h" +#include "app/gettext.h" +#include "worldmap.h" +#include "intro.h" +#include "misc.h" GameSession* GameSession::current_ = 0; @@ -713,7 +716,7 @@ void bumpbrick(float x, float y) Sector::current()->add_bouncy_brick(Vector(((int)(x + 1) / 32) * 32, (int)(y / 32) * 32)); - sound_manager->play_sound(sounds[SND_BRICK], Vector(x, y)); + sound_manager->play_sound(sounds[SND_BRICK], Vector(x, y), Sector::current()->player->get_pos()); } /* (Status): */ @@ -832,4 +835,36 @@ std::string slotinfo(int slot) return tmp; } +bool process_load_game_menu() +{ + int slot = load_game_menu->check(); + + if(slot != -1 && load_game_menu->get_item_by_id(slot).kind == MN_ACTION) + { + char slotfile[1024]; + snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot); + + if (access(slotfile, F_OK) != 0) + { + draw_intro(); + } + + // shrink_fade(Point((screen->w/2),(screen->h/2)), 1000); + fadeout(256); + WorldMapNS::WorldMap worldmap; + + // Load the game or at least set the savegame_file variable + worldmap.loadgame(slotfile); + worldmap.display(); + + Menu::set_current(main_menu); + + st_pause_ticks_stop(); + return true; + } + else + { + return false; + } +} diff --git a/src/gameloop.h b/src/gameloop.h index 196a74a3b..cf001209b 100644 --- a/src/gameloop.h +++ b/src/gameloop.h @@ -22,8 +22,9 @@ #ifndef SUPERTUX_GAMELOOP_H #define SUPERTUX_GAMELOOP_H -#include "sound.h" -#include "type.h" +#include "special/timer.h" +#include "audio/sound.h" +#include "special/base.h" /* GameLoop modes */ @@ -33,6 +34,12 @@ #define ST_GL_LOAD_LEVEL_FILE 3 #define ST_GL_DEMO_GAME 4 + +enum GameMenuIDs { + MNID_CONTINUE, + MNID_ABORTLEVEL + }; + extern int game_started; class Level; @@ -127,5 +134,8 @@ std::string slotinfo(int slot); bool rectcollision(base_type* one, base_type* two); void bumpbrick(float x, float y); +/** Return true if the gameloop() was entered, false otherwise */ +bool process_load_game_menu(); + #endif /*SUPERTUX_GAMELOOP_H*/ diff --git a/src/gameobjs.cpp b/src/gameobjs.cpp index 0841dac70..cb3984d4c 100644 --- a/src/gameobjs.cpp +++ b/src/gameobjs.cpp @@ -23,12 +23,12 @@ #include #include -#include "globals.h" +#include "app/globals.h" #include "tile.h" #include "tile_manager.h" #include "gameloop.h" #include "gameobjs.h" -#include "sprite_manager.h" +#include "special/sprite_manager.h" #include "resources.h" #include "sector.h" #include "tilemap.h" @@ -232,7 +232,7 @@ Trampoline::action(float frame_ratio) } } - physic.apply(frame_ratio, base.x, base.y); + physic.apply(frame_ratio, base.x, base.y, Sector::current()->gravity); collision_swept_object_map(&old_base, &base); } diff --git a/src/gameobjs.h b/src/gameobjs.h index 6061cbd8f..23f99f351 100644 --- a/src/gameobjs.h +++ b/src/gameobjs.h @@ -22,16 +22,16 @@ #ifndef SUPERTUX_GAMEOBJS_H #define SUPERTUX_GAMEOBJS_H -#include "type.h" -#include "screen/surface.h" -#include "timer.h" +#include "special/base.h" +#include "video/surface.h" +#include "special/timer.h" #include "scene.h" -#include "physic.h" +#include "math/physic.h" #include "collision.h" -#include "game_object.h" -#include "moving_object.h" +#include "special/game_object.h" +#include "special/moving_object.h" #include "serializable.h" -#include "lispwriter.h" +#include "utils/lispwriter.h" /* Bounciness of distros: */ #define NO_BOUNCE 0 diff --git a/src/high_scores.cpp b/src/high_scores.cpp index 4edd7bec5..73fc52899 100644 --- a/src/high_scores.cpp +++ b/src/high_scores.cpp @@ -23,14 +23,14 @@ #include #include -#include "globals.h" +#include "app/globals.h" #include "high_scores.h" -#include "menu.h" -#include "screen/drawing_context.h" -#include "screen/screen.h" -#include "screen/surface.h" -#include "setup.h" -#include "lispreader.h" +#include "gui/menu.h" +#include "video/drawing_context.h" +#include "video/screen.h" +#include "video/surface.h" +#include "app/setup.h" +#include "utils/lispreader.h" #ifdef WIN32 const char * highscore_filename = "/st_highscore.dat"; diff --git a/src/interactive_object.h b/src/interactive_object.h index 62bfb4b39..5f4e5bd3b 100644 --- a/src/interactive_object.h +++ b/src/interactive_object.h @@ -20,8 +20,8 @@ #ifndef SUPERTUX_INTERACTIVE_OBJECT_H #define SUPERTUX_INTERACTIVE_OBJECT_H -#include "game_object.h" -#include "type.h" +#include "special/game_object.h" +#include "special/base.h" enum InteractionType { diff --git a/src/intro.cpp b/src/intro.cpp index e53927959..62890b663 100644 --- a/src/intro.cpp +++ b/src/intro.cpp @@ -18,13 +18,13 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "intro.h" -#include "globals.h" -#include "defines.h" -#include "screen/font.h" -#include "screen/screen.h" +#include "app/globals.h" +#include "app/defines.h" +#include "video/font.h" +#include "video/screen.h" void draw_intro() { - display_text_file("intro.txt", SCROLL_SPEED_MESSAGE); + display_text_file("intro.txt", 1); } diff --git a/src/level.cpp b/src/level.cpp index 06d6426b4..4aa704248 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -26,19 +26,19 @@ #include #include -#include "globals.h" -#include "setup.h" +#include "app/globals.h" +#include "app/setup.h" #include "camera.h" -#include "screen/screen.h" +#include "video/screen.h" #include "level.h" -#include "physic.h" +#include "math/physic.h" #include "scene.h" #include "sector.h" #include "tile.h" -#include "lispreader.h" +#include "utils/lispreader.h" #include "resources.h" #include "gameobjs.h" -#include "lispwriter.h" +#include "utils/lispwriter.h" using namespace std; diff --git a/src/level_subset.cpp b/src/level_subset.cpp index a35c6890d..5193c5157 100644 --- a/src/level_subset.cpp +++ b/src/level_subset.cpp @@ -19,10 +19,10 @@ // 02111-1307, USA. #include -#include "setup.h" +#include "app/setup.h" #include "level.h" -#include "globals.h" -#include "screen/surface.h" +#include "app/globals.h" +#include "video/surface.h" #include "level_subset.h" static bool has_suffix(const std::string& data, const std::string& suffix) diff --git a/src/level_subset.h b/src/level_subset.h index 4ff6b4da9..d9a0fa815 100644 --- a/src/level_subset.h +++ b/src/level_subset.h @@ -23,7 +23,7 @@ #include #include -#include "lispreader.h" +#include "utils/lispreader.h" class Surface; diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index c9c201fea..998451a78 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -33,10 +33,10 @@ #include "SDL_image.h" #include "leveleditor.h" -#include "screen/screen.h" -#include "defines.h" -#include "globals.h" -#include "setup.h" +#include "video/screen.h" +#include "app/defines.h" +#include "app/globals.h" +#include "app/setup.h" #include "sector.h" #include "tilemap.h" #include "gameloop.h" @@ -69,6 +69,10 @@ #define SELECT_W 2 // size of the selections lines #define SELECT_CLR 0, 255, 0, 255 // lines color (R, G, B, A) +/* Frames per second: */ + +#define FPS (1000 / 25) + enum { TM_IA, TM_BG, TM_FG }; LevelEditor::LevelEditor() diff --git a/src/leveleditor.h b/src/leveleditor.h index 5c333a814..d4bf7f5c8 100644 --- a/src/leveleditor.h +++ b/src/leveleditor.h @@ -23,15 +23,53 @@ #ifndef SUPERTUX_LEVELEDITOR_H #define SUPERTUX_LEVELEDITOR_H -#include "screen/drawing_context.h" -#include "game_object.h" -#include "screen/surface.h" +#include "video/drawing_context.h" +#include "special/game_object.h" +#include "video/surface.h" #include "level.h" #include "level_subset.h" -#include "moving_object.h" -#include "button.h" -#include "menu.h" +#include "special/moving_object.h" +#include "gui/button.h" +#include "gui/menu.h" + +enum LevelEditorMainMenuIDs { + MNID_RETURNLEVELEDITOR, + MNID_SUBSETSETTINGS, + MNID_QUITLEVELEDITOR + }; + +enum LevelEditorSubsetSettingsIDs { + MNID_SUBSETTITLE, + MNID_SUBSETDESCRIPTION, + MNID_SUBSETSAVECHANGES + }; + +enum LevelEditorSubsetNewIDs { + MNID_SUBSETNAME, + MNID_CREATESUBSET +}; +enum LevelEditorSettingsMenuIDs { + MNID_NAME, + MNID_AUTHOR, + MNID_SONG, + MNID_BGIMG, + MNID_PARTICLE, + MNID_LENGTH, + MNID_HEIGHT, + MNID_TIME, + MNID_GRAVITY, + MNID_BGSPEED, + MNID_TopRed, + MNID_TopGreen, + MNID_TopBlue, + MNID_BottomRed, + MNID_BottomGreen, + MNID_BottomBlue, + MNID_APPLY + }; + + class LevelEditor { public: diff --git a/src/particlesystem.cpp b/src/particlesystem.cpp index baa812e31..ea301d871 100644 --- a/src/particlesystem.cpp +++ b/src/particlesystem.cpp @@ -22,10 +22,10 @@ #include #include "particlesystem.h" -#include "globals.h" -#include "lispreader.h" -#include "lispwriter.h" -#include "screen/drawing_context.h" +#include "app/globals.h" +#include "utils/lispreader.h" +#include "utils/lispwriter.h" +#include "video/drawing_context.h" ParticleSystem::ParticleSystem() { diff --git a/src/particlesystem.h b/src/particlesystem.h index 80b3e73e5..8ceecc439 100644 --- a/src/particlesystem.h +++ b/src/particlesystem.h @@ -22,8 +22,8 @@ #include -#include "screen/surface.h" -#include "game_object.h" +#include "video/surface.h" +#include "special/game_object.h" #include "serializable.h" class LispReader; diff --git a/src/player.cpp b/src/player.cpp index c42499db9..624f18186 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -22,19 +22,19 @@ #include #include "gameloop.h" -#include "globals.h" +#include "app/globals.h" #include "player.h" -#include "defines.h" +#include "app/defines.h" #include "scene.h" #include "tile.h" -#include "sprite.h" +#include "special/sprite.h" #include "sector.h" #include "tilemap.h" #include "camera.h" #include "gameobjs.h" #include "resources.h" #include "interactive_object.h" -#include "screen/screen.h" +#include "video/screen.h" // behavior definitions: #define TILES_FOR_BUTTJUMP 3 @@ -227,7 +227,7 @@ Player::action(float elapsed_time) if(dying == DYING_NOT) handle_input(); - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if(dying == DYING_NOT) { diff --git a/src/player.h b/src/player.h index 2d0646516..8ae05ae94 100644 --- a/src/player.h +++ b/src/player.h @@ -23,13 +23,14 @@ #include "SDL.h" #include "bitmask.h" -#include "type.h" -#include "timer.h" -#include "screen/surface.h" +#include "special/timer.h" +#include "special/base.h" +#include "video/surface.h" #include "collision.h" -#include "sound.h" -#include "moving_object.h" -#include "physic.h" +#include "audio/sound.h" +#include "special/moving_object.h" +#include "math/physic.h" +#include "app/defines.h" class BadGuy; @@ -49,6 +50,11 @@ class BadGuy; #define SCORE_BRICK 5 #define SCORE_DISTRO 25 +/* Sizes: */ + +#define SMALL 0 +#define BIG 1 + #include struct PlayerKeymap diff --git a/src/resources.cpp b/src/resources.cpp index 981541142..aa3336e76 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -17,16 +17,16 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "globals.h" +#include "app/globals.h" #include "scene.h" #include "player.h" #include "badguy.h" #include "gameobjs.h" #include "special.h" #include "resources.h" -#include "sprite_manager.h" -#include "sound_manager.h" -#include "setup.h" +#include "special/sprite_manager.h" +#include "audio/sound_manager.h" +#include "app/setup.h" #include "door.h" Surface* img_waves[3]; @@ -43,6 +43,28 @@ MusicRef level_end_song; SpriteManager* sprite_manager = 0; SoundManager* sound_manager = 0; +char * soundfilenames[NUM_SOUNDS] = { + "/sounds/jump.wav", + "/sounds/bigjump.wav", + "/sounds/skid.wav", + "/sounds/coin.wav", + "/sounds/invincible.wav", + "/sounds/brick.wav", + "/sounds/hurt.wav", + "/sounds/squish.wav", + "/sounds/fall.wav", + "/sounds/ricochet.wav", + "/sounds/bump-upgrade.wav", + "/sounds/upgrade.wav", + "/sounds/grow.wav", + "/sounds/fire-flower.wav", + "/sounds/shoot.wav", + "/sounds/lifeup.wav", + "/sounds/stomp.wav", + "/sounds/kick.wav", + "/sounds/explosion.wav" + }; + /* Load graphics/sounds shared between all levels: */ void loadshared() { @@ -232,7 +254,7 @@ void loadshared() Send a mail to me: neoneurone@users.sf.net, if you have another opinion. :) */ for (i = 0; i < NUM_SOUNDS; i++) - sounds[i] = load_sound(datadir + soundfilenames[i]); + sounds.push_back(load_sound(datadir + soundfilenames[i])); /* Herring song */ herring_song = sound_manager->load_music(datadir + "/music/SALCON.MOD"); diff --git a/src/resources.h b/src/resources.h index edff837ee..18e4ecbb9 100644 --- a/src/resources.h +++ b/src/resources.h @@ -20,11 +20,37 @@ #ifndef SUPERTUX_RESOURCES_H #define SUPERTUX_RESOURCES_H -#include "musicref.h" +#include "audio/musicref.h" class SpriteManager; class SoundManager; +/* Sound files: */ +enum { + SND_JUMP, + SND_BIGJUMP, + SND_SKID, + SND_DISTRO, + SND_HERRING, + SND_BRICK, + SND_HURT, + SND_SQUISH, + SND_FALL, + SND_RICOCHET, + SND_BUMP_UPGRADE, + SND_UPGRADE, + SND_EXCELLENT, + SND_COFFEE, + SND_SHOOT, + SND_LIFEUP, + SND_STOMP, + SND_KICK, + SND_EXPLODE, + NUM_SOUNDS +}; + +extern char* soundfilenames[NUM_SOUNDS]; + extern Surface* img_waves[3]; extern Surface* img_water; extern Surface* img_pole; diff --git a/src/scene.cpp b/src/scene.cpp index 238039e90..7c3561485 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -20,7 +20,7 @@ #include #include "scene.h" -#include "defines.h" +#include "app/defines.h" PlayerStatus player_status; diff --git a/src/scene.h b/src/scene.h index 57745d2d5..2c34601a5 100644 --- a/src/scene.h +++ b/src/scene.h @@ -20,8 +20,8 @@ #ifndef SUPERTUX_SCENE_H #define SUPERTUX_SCENE_H -#include "screen/surface.h" -#include "timer.h" +#include "video/surface.h" +#include "special/timer.h" #define FRAME_RATE 10 // 100 Frames per second (10ms) diff --git a/src/sector.cpp b/src/sector.cpp index 4972ecc0d..3bb3ee60c 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -24,9 +24,9 @@ #include #include -#include "globals.h" +#include "app/globals.h" #include "sector.h" -#include "lispreader.h" +#include "utils/lispreader.h" #include "badguy.h" #include "special.h" #include "gameobjs.h" @@ -35,7 +35,7 @@ #include "particlesystem.h" #include "tile.h" #include "tilemap.h" -#include "sound_manager.h" +#include "audio/sound_manager.h" #include "gameloop.h" #include "resources.h" #include "interactive_object.h" diff --git a/src/sector.h b/src/sector.h index fe2acf1d5..bcfac4bc0 100644 --- a/src/sector.h +++ b/src/sector.h @@ -23,11 +23,11 @@ #include #include -#include "vector.h" +#include "math/vector.h" #include "badguy.h" #include "special.h" -#include "musicref.h" -#include "screen/drawing_context.h" +#include "audio/musicref.h" +#include "video/drawing_context.h" class GameObject; class InteractiveObject; diff --git a/src/special.cpp b/src/special.cpp index ec2fd47ab..701a82c74 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -26,13 +26,13 @@ #include "special.h" #include "camera.h" #include "gameloop.h" -#include "screen/screen.h" -#include "sound.h" +#include "video/screen.h" +#include "audio/sound.h" #include "scene.h" -#include "globals.h" +#include "app/globals.h" #include "player.h" #include "sector.h" -#include "sprite_manager.h" +#include "special/sprite_manager.h" #include "resources.h" Sprite* img_firebullet; @@ -81,7 +81,7 @@ Bullet::action(float elapsed_time) float old_y = base.y; - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); collision_swept_object_map(&old_base,&base); if (issolid(base.x+2, base.y + 4) || issolid(base.x+2, base.y)) @@ -210,7 +210,7 @@ Upgrade::action(float elapsed_time) } /* Move around? */ - physic.apply(elapsed_time, base.x, base.y); + physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity); if(kind == UPGRADE_GROWUP) { collision_swept_object_map(&old_base, &base); } @@ -280,7 +280,7 @@ Upgrade::bump(Player* player) if(kind != UPGRADE_GROWUP) return; - sound_manager->play_sound(sounds[SND_BUMP_UPGRADE], Vector(base.x, base.y)); + sound_manager->play_sound(sounds[SND_BUMP_UPGRADE], Vector(base.x, base.y), Sector::current()->player->get_pos()); // determine new direction Direction old_dir = dir; diff --git a/src/special.h b/src/special.h index cbf33e5fe..bd86c08dd 100644 --- a/src/special.h +++ b/src/special.h @@ -23,11 +23,11 @@ #include "SDL.h" #include "bitmask.h" -#include "type.h" -#include "screen/surface.h" +#include "special/base.h" +#include "video/surface.h" #include "collision.h" #include "player.h" -#include "physic.h" +#include "math/physic.h" /* Upgrade types: */ diff --git a/src/supertux.cpp b/src/supertux.cpp index 00fd2e1ad..3181f3204 100644 --- a/src/supertux.cpp +++ b/src/supertux.cpp @@ -23,26 +23,30 @@ #include #include -#include "exceptions.h" -#include "defines.h" -#include "globals.h" -#include "setup.h" +#include "utils/exceptions.h" +#include "app/defines.h" +#include "app/globals.h" +#include "app/setup.h" #include "intro.h" #include "title.h" #include "gameloop.h" #include "leveleditor.h" -#include "screen/screen.h" +#include "video/screen.h" #include "worldmap.h" #include "resources.h" -#include "screen/surface.h" +#include "video/surface.h" #include "tile_manager.h" -#include "gettext.h" +#include "app/gettext.h" +#include "player.h" +#include "misc.h" +#include "utils/configfile.h" int main(int argc, char * argv[]) { #ifndef DEBUG try { #endif + config = new MyConfig; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); @@ -94,6 +98,7 @@ int main(int argc, char * argv[]) unloadshared(); st_general_free(); + st_menu_free(); TileManager::destroy_instance(); #ifdef DEBUG Surface::debug_check(); diff --git a/src/tile.cpp b/src/tile.cpp index 13f699e98..2bd161d98 100644 --- a/src/tile.cpp +++ b/src/tile.cpp @@ -22,12 +22,12 @@ #include #include -#include "globals.h" +#include "app/globals.h" #include "tile.h" #include "scene.h" -#include "lispreader.h" -#include "vector.h" -#include "screen/drawing_context.h" +#include "utils/lispreader.h" +#include "math/vector.h" +#include "video/drawing_context.h" /** Dirty little helper to create a surface from a snipped of lisp: * diff --git a/src/tile.h b/src/tile.h index d1f929bc7..6af2fd22e 100644 --- a/src/tile.h +++ b/src/tile.h @@ -23,7 +23,7 @@ #include #include "SDL.h" -#include "screen/surface.h" +#include "video/surface.h" class Vector; class LispReader; diff --git a/src/tile_manager.cpp b/src/tile_manager.cpp index f9ad0c235..c963a721d 100644 --- a/src/tile_manager.cpp +++ b/src/tile_manager.cpp @@ -19,12 +19,13 @@ // 02111-1307, USA. #include -#include "screen/drawing_context.h" -#include "setup.h" -#include "globals.h" -#include "lispreader.h" +#include "video/drawing_context.h" +#include "app/setup.h" +#include "app/globals.h" +#include "utils/lispreader.h" #include "tile.h" #include "tile_manager.h" +#include "scene.h" TileManager* TileManager::instance_ = 0; std::set* TileManager::tilegroups_ = 0; diff --git a/src/tilemap.cpp b/src/tilemap.cpp index 21651784a..4b7e1239e 100644 --- a/src/tilemap.cpp +++ b/src/tilemap.cpp @@ -24,13 +24,13 @@ #include #include "tilemap.h" -#include "screen/drawing_context.h" +#include "video/drawing_context.h" #include "level.h" #include "tile.h" #include "tile_manager.h" -#include "globals.h" -#include "lispreader.h" -#include "lispwriter.h" +#include "app/globals.h" +#include "utils/lispreader.h" +#include "utils/lispwriter.h" TileMap::TileMap() : solid(false), speed(1), width(0), height(0), layer(LAYER_TILES), vertical_flip(false) diff --git a/src/tilemap.h b/src/tilemap.h index 3df34cb9a..50a843e96 100644 --- a/src/tilemap.h +++ b/src/tilemap.h @@ -22,9 +22,9 @@ #include -#include "game_object.h" +#include "special/game_object.h" #include "serializable.h" -#include "vector.h" +#include "math/vector.h" class Level; class TileManager; diff --git a/src/title.cpp b/src/title.cpp index e046e9c1c..6a4c5f041 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -34,15 +34,15 @@ #include #endif -#include "defines.h" -#include "globals.h" +#include "app/defines.h" +#include "app/globals.h" #include "title.h" -#include "screen/screen.h" -#include "screen/surface.h" +#include "video/screen.h" +#include "video/surface.h" #include "high_scores.h" -#include "menu.h" -#include "timer.h" -#include "setup.h" +#include "gui/menu.h" +#include "special/timer.h" +#include "app/setup.h" #include "level.h" #include "level_subset.h" #include "gameloop.h" @@ -54,8 +54,9 @@ #include "sector.h" #include "tilemap.h" #include "resources.h" -#include "type.h" -#include "gettext.h" +#include "special/base.h" +#include "app/gettext.h" +#include "misc.h" static Surface* bkg_title; static Surface* logo; @@ -77,6 +78,18 @@ static string_list_type worldmap_list; static LevelEditor* leveleditor; +void update_load_save_game_menu(Menu* pmenu) +{ + for(int i = 2; i < 7; ++i) + { + // FIXME: Insert a real savegame struct/class here instead of + // doing string vodoo + std::string tmp = slotinfo(i - 1); + pmenu->item[i].kind = MN_ACTION; + pmenu->item[i].change_text(tmp.c_str()); + } +} + void free_contrib_menu() { for(std::vector::iterator i = contrib_subsets.begin(); diff --git a/src/title.h b/src/title.h index a2f50b29f..96713a2a3 100644 --- a/src/title.h +++ b/src/title.h @@ -19,7 +19,26 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // 02111-1307, USA. +#ifndef SUPERTUX_TITLE_H +#define SUPERTUX_TITLE_H + +enum MainMenuIDs { + MNID_STARTGAME, + MNID_LEVELS_CONTRIB, + MNID_OPTIONMENU, + MNID_LEVELEDITOR, + MNID_CREDITS, + MNID_QUITMAINMENU + }; + +/* Scrolling text speed */ + +#define SCROLL_SPEED_CREDITS 2.0 +#define SCROLL_SPEED_MESSAGE 1.0 + void title(void); +#endif //SUPERTUX_TITLE_H + // EOF // diff --git a/src/worldmap.cpp b/src/worldmap.cpp index b0e29b783..8f3282c72 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -23,18 +23,21 @@ #include #include -#include "globals.h" -#include "screen/surface.h" -#include "screen/screen.h" -#include "screen/drawing_context.h" -#include "lispreader.h" +#include "app/globals.h" +#include "video/surface.h" +#include "video/screen.h" +#include "video/drawing_context.h" +#include "utils/lispreader.h" #include "gameloop.h" -#include "setup.h" +#include "app/setup.h" #include "sector.h" #include "worldmap.h" -#include "sound_manager.h" +#include "audio/sound_manager.h" #include "resources.h" -#include "gettext.h" +#include "app/gettext.h" +#include "misc.h" + +Menu* worldmap_menu = 0; namespace WorldMapNS { diff --git a/src/worldmap.h b/src/worldmap.h index 0d20a1ce8..4ad8243cc 100644 --- a/src/worldmap.h +++ b/src/worldmap.h @@ -23,12 +23,19 @@ #include #include -#include "vector.h" -#include "musicref.h" -#include "screen/screen.h" +#include "math/vector.h" +#include "audio/musicref.h" +#include "video/screen.h" + +extern Menu* worldmap_menu; namespace WorldMapNS { +enum WorldMapMenuIDs { + MNID_RETURNWORLDMAP, + MNID_QUITWORLDMAP + }; + class Tile { public: