mainly changed #includes to work with the new SuperTux library
authorTobias Gläßer <tobi.web@gmx.de>
Tue, 20 Jul 2004 18:04:49 +0000 (18:04 +0000)
committerTobias Gläßer <tobi.web@gmx.de>
Tue, 20 Jul 2004 18:04:49 +0000 (18:04 +0000)
SVN-Revision: 1599

44 files changed:
src/background.cpp
src/background.h
src/badguy.cpp
src/badguy.h
src/camera.cpp
src/camera.h
src/collision.cpp
src/collision.h
src/door.cpp
src/door.h
src/gameloop.cpp
src/gameloop.h
src/gameobjs.cpp
src/gameobjs.h
src/high_scores.cpp
src/interactive_object.h
src/intro.cpp
src/level.cpp
src/level_subset.cpp
src/level_subset.h
src/leveleditor.cpp
src/leveleditor.h
src/particlesystem.cpp
src/particlesystem.h
src/player.cpp
src/player.h
src/resources.cpp
src/resources.h
src/scene.cpp
src/scene.h
src/sector.cpp
src/sector.h
src/special.cpp
src/special.h
src/supertux.cpp
src/tile.cpp
src/tile.h
src/tile_manager.cpp
src/tilemap.cpp
src/tilemap.h
src/title.cpp
src/title.h
src/worldmap.cpp
src/worldmap.h

index 78a9180..fef1c99 100644 (file)
 //  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)
index bafb77c..375343f 100644 (file)
 #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;
index 28d151b..807a8d8 100644 (file)
 #include <iostream>
 #include <cmath>
 
-#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) {
index 03c8818..0db6b61 100644 (file)
 
 #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 {
index b440d0e..df856b8 100644 (file)
 #include <cmath>
 
 #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)
index 9c11708..099e164 100644 (file)
@@ -23,9 +23,9 @@
 #include <vector>
 #include <cassert>
 
-#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;
index 716c05a..1620a2a 100644 (file)
@@ -19,7 +19,7 @@
 //  02111-1307, USA.
 
 #include <cmath>
-#include "defines.h"
+#include "app/defines.h"
 #include "collision.h"
 #include "bitmask.h"
 #include "scene.h"
index 3993665..cbbaeef 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef SUPERTUX_COLLISION_H
 #define SUPERTUX_COLLISION_H
 
-#include "type.h"
+#include "special/base.h"
 
 class Tile;
 
index 95d9807..a749280 100644 (file)
 //  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;
index 4027999..1c22907 100644 (file)
 
 #include <string>
 
+#include "video/surface.h"
 #include "interactive_object.h"
 #include "serializable.h"
-#include "timer.h"
+#include "special/timer.h"
 
 class Sprite;
 
index 0e7d27c..87c7bdc 100644 (file)
 #include <ctype.h>
 #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"
 #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;
+    }
+}
index 196a74a..cf00120 100644 (file)
@@ -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 */
 
 #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*/
 
index 0841dac..cb3984d 100644 (file)
 #include <iostream>
 #include <cmath>
 
-#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);
 }
 
index 6061cbd..23f99f3 100644 (file)
 #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
index 4edd7be..73fc528 100644 (file)
 #include <cstring>
 #include <cstdlib>
 
-#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";
index 62bfb4b..5f4e5bd 100644 (file)
@@ -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
 {
index e539279..62890b6 100644 (file)
 //  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);
 }
 
index 06d6426..4aa7042 100644 (file)
 #include <fstream>
 #include <stdexcept>
 
-#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;
 
index a35c689..5193c51 100644 (file)
 //  02111-1307, USA.
 
 #include <assert.h>
-#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)
index 4ff6b4d..d9a0fa8 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <vector>
 #include <string>
-#include "lispreader.h"
+#include "utils/lispreader.h"
 
 class Surface;
 
index c9c201f..998451a 100644 (file)
 #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"
 #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()
index 5c333a8..d4bf7f5 100644 (file)
 #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:
index baa812e..ea301d8 100644 (file)
 #include <cmath>
 
 #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()
 {
index 80b3e73..8ceecc4 100644 (file)
@@ -22,8 +22,8 @@
 
 #include <vector>
 
-#include "screen/surface.h"
-#include "game_object.h"
+#include "video/surface.h"
+#include "special/game_object.h"
 #include "serializable.h"
 
 class LispReader;
index c42499d..624f181 100644 (file)
 #include <cassert>
 
 #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) 
     {
index 2d06465..8ae05ae 100644 (file)
 #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 <vector>
 
 struct PlayerKeymap
index 9815411..aa3336e 100644 (file)
 //  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");
index edff837..18e4ecb 100644 (file)
 #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;
index 238039e..7c35614 100644 (file)
@@ -20,7 +20,7 @@
 #include <cstdlib>
 
 #include "scene.h"
-#include "defines.h"
+#include "app/defines.h"
 
 PlayerStatus player_status;
 
index 57745d2..2c34601 100644 (file)
@@ -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)
 
index 4972ecc..3bb3ee6 100644 (file)
@@ -24,9 +24,9 @@
 #include <fstream>
 #include <stdexcept>
 
-#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"
index fe2acf1..bcfac4b 100644 (file)
 #include <string>
 #include <vector>
 
-#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;
index ec2fd47..701a82c 100644 (file)
 #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;
index cbf33e5..bd86c08 100644 (file)
 #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: */
 
index 00fd2e1..3181f32 100644 (file)
 #include <iostream>
 #include <exception>
 
-#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();
index 13f699e..2bd161d 100644 (file)
 #include <cassert>
 #include <iostream>
 
-#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:
  *
index d1f929b..6af2fd2 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <vector>
 #include "SDL.h"
-#include "screen/surface.h"
+#include "video/surface.h"
 
 class Vector;
 class LispReader;
index f9ad0c2..c963a72 100644 (file)
 //  02111-1307, USA.
 
 #include <assert.h>
-#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<TileGroup>* TileManager::tilegroups_  = 0;
index 2165178..4b7e123 100644 (file)
 #include <cmath>
 
 #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)
index 3df34cb..50a843e 100644 (file)
@@ -22,9 +22,9 @@
 
 #include <vector>
 
-#include "game_object.h"
+#include "special/game_object.h"
 #include "serializable.h"
-#include "vector.h"
+#include "math/vector.h"
 
 class Level;
 class TileManager;
index e046e9c..6a4c5f0 100644 (file)
 #include <ctype.h>
 #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<LevelSubset*>::iterator i = contrib_subsets.begin();
index a2f50b2..96713a2 100644 (file)
 //  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 //
 
index b0e29b7..8f3282c 100644 (file)
 #include <cassert>
 #include <unistd.h>
 
-#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 {
 
index 0d20a1c..4ad8243 100644 (file)
 #include <vector>
 #include <string>
 
-#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: