* Some Mac fixes that don't break Linux (inclusion of stddef.h for size_t, explicit...
authorOndřej Hošek <ondra.hosek@gmail.com>
Tue, 11 Apr 2006 07:34:01 +0000 (07:34 +0000)
committerOndřej Hošek <ondra.hosek@gmail.com>
Tue, 11 Apr 2006 07:34:01 +0000 (07:34 +0000)
* Fixed crasher when player carries Mr Iceblock and jumps out of sector's bounds
* Fixed crasher when player hits Enter without supplying a command (or only one or more spaces) in the console
* Reflected changes in directory structure and file types in Jamfiles for 'jam install'

SVN-Revision: 3290

data/Jamfile
src/badguy/badguy.cpp
src/badguy/badguy.hpp
src/badguy/mriceblock.cpp
src/console.cpp
src/physfs/physfs_stream.hpp
src/video/texture_manager.cpp
src/world.cpp

index 32fab8c..2abd5d7 100644 (file)
 SubDir TOP data ;
 
 IMAGEPATHS =
-       images/tiles
-       images/tiles/goal
-       images/tiles/grey
-       images/tiles/lava
-       images/tiles/pipe
-       images/tiles/pole
-       images/tiles/snow
-       images/tiles/darksnow
-       images/tiles/signs
-       images/tiles/water
-       images/tiles/doodads
-       images/tiles/waterfall
-       images/tiles/auxiliary
-       images/tiles/background
-       images/tiles/blocks
-       images/tiles/forest
-       images/tiles/jungle
-       images/tiles/worldmap
+       images
        images/background
-       images/powerups
-       images/powerups/1up
-       images/powerups/egg
-       images/powerups/star
-       images/powerups/iceflower
-       images/powerups/fireflower
-       images/engine
-       images/engine/menu
-       images/engine/fonts
-       images/engine/icons
-       images/engine/editor
-       images/objects
-       images/objects/bell
-       images/objects/coin
-       images/objects/door
-       images/objects/particles
-       images/objects/hatch
-       images/objects/flying_platform
-       images/objects/bonus_block
-       images/objects/unstable_tile
-       images/objects/trampoline
-       images/objects/bullets
        images/creatures
-       images/creatures/fish
-       images/creatures/yeti
-       images/creatures/snowball
-       images/creatures/tux_small
+       images/creatures/angrystone
+       images/creatures/bouncing_snowball
+       images/creatures/colorlamp
        images/creatures/dispenser
-       images/creatures/mr_iceblock
+       images/creatures/dummyguy
+       images/creatures/evilpenguin
+       images/creatures/fish
        images/creatures/flame
+       images/creatures/flame_fish
+       images/creatures/fluffy
+       images/creatures/flying_snowball
+       images/creatures/ghost
+       images/creatures/granito
        images/creatures/jumpy
+       images/creatures/kirby
+       images/creatures/kugelblitz
+       images/creatures/mr_bomb
+       images/creatures/mr_fluffy
+       images/creatures/mr_iceblock
+       images/creatures/mr_rocket
+       images/creatures/mr_tree
        images/creatures/nolok
+       images/creatures/penny
+       images/creatures/plant
+       images/creatures/poison_ivy
+       images/creatures/skullhead
+       images/creatures/skullyhop
+       images/creatures/snowball
+       images/creatures/snowsnail
+       images/creatures/spidermite
        images/creatures/spike
        images/creatures/spiky
+       images/creatures/sspiky
        images/creatures/stalactite
-       images/creatures/mr_bomb
-       images/creatures/mr_tree
-       images/creatures/flying_snowball
+       images/creatures/stony
+       images/creatures/totem
        images/creatures/tux_big
-       images/creatures/flame_fish
        images/creatures/tux_grow
-       images/creatures/poison_ivy
+       images/creatures/tux_small
+       images/creatures/willowisp
+       images/creatures/yeti
        images/creatures/zeekling
-       images/creatures/mr_rocket
-       images/creatures/bouncing_snowball
-       images/creatures/dummyguy
-        images/creatures/plant
-       images/creatures/sspiky
+       images/credits
+       images/effects
+       images/engine
+       images/engine/editor
+       images/engine/fonts
+       images/engine/icons
+       images/engine/menu
+       images/objects
+       images/objects/bonus_block
+       images/objects/bullets
+       images/objects/castledoor
+       images/objects/coin
+       images/objects/door
+       images/objects/eat-me
+       images/objects/firefly
+       images/objects/flying_platform
+       images/objects/hatch
+       images/objects/icecube
+       images/objects/keys
+       images/objects/lamp
+       images/objects/lightmap_light
+       images/objects/logo
+       images/objects/particles
+       images/objects/platforms
+       images/objects/radio
+       images/objects/rock
+       images/objects/skull_tile
+       images/objects/skulls
+       images/objects/spotlight
+       images/objects/strawbox
+       images/objects/trampoline
+       images/objects/unstable_tile
+       images/objects/voicemail
+       images/powerups
+       images/powerups/1up
+       images/powerups/egg
+       images/powerups/fireflower
+       images/powerups/iceflower
+       images/powerups/potions
+       images/powerups/star
+       images/tiles
+       images/tiles/auxiliary
+       images/tiles/background
+       images/tiles/blocks
+       images/tiles/castle
+       images/tiles/color
+       images/tiles/darksnow
+       images/tiles/doodads
+       images/tiles/firefly
+       images/tiles/forest
+       images/tiles/ghostforest
+       images/tiles/goal
+       images/tiles/icewood
+       images/tiles/jungle
+       images/tiles/lava
+       images/tiles/pipe
+       images/tiles/pole
+       images/tiles/signs
+       images/tiles/snow
+       images/tiles/underground
+       images/tiles/water
+       images/tiles/waterfall
+       images/worldmap
+       images/worldmap/antarctica
+       images/worldmap/common
+       images/worldmap/forest
 ;
 
 for p in $(IMAGEPATHS) {
     InstallData 
-        [ Wildcard $(p) : *.png *.jpg *.xpm *.strf *.ico *.stgt *.stwt ] 
+        [ Wildcard $(p) : *.png *.jpg *.xpm *.strf *.sprite *.ico *.stgt *.stwt ] 
       : $(p)
     ;
 }
@@ -88,14 +132,16 @@ LEVELPATHS =
 ;
 
 for p in $(LEVELPATHS) {
-  InstallData [ Wildcard $(p) : info *.stl *.stwm *.txt *.po ] : $(p) ;
+  InstallData [ Wildcard $(p) : info *.nut *.stl *.stwm *.txt *.po ] : $(p) ;
 
   local translatable_lisp = [ Wildcard $(p) : info *.stl *.stwm *.txt ] ;
   SEARCH on $(translatable_lisp) = $(SEARCH_SOURCE) ;
   MakePot $(SUBDIR)/$(p)/messages.pot : $(translatable_lisp) ;
   XGETTEXT_FLAGS on $(SUBDIR)/$(p)/messages.pot += --language=Lisp ;
 }
-InstallData [ Wildcard *.txt ] ;
+InstallData [ Wildcard *.txt *.po ] ;
 InstallData [ Wildcard music : *.ogg ] : music ;
+InstallData [ Wildcard script : *.nut ] : script ;
+InstallData [ Wildcard speech : *.ogg ] : speech ;
 InstallData [ Wildcard sounds : *.wav ] : sounds ;
 InstallData [ Wildcard locale : *.po ] : locale ;
index 4290404..a9edc75 100644 (file)
@@ -32,7 +32,7 @@ static const float X_OFFSCREEN_DISTANCE = 1600;
 static const float Y_OFFSCREEN_DISTANCE = 1200;
 
 BadGuy::BadGuy()
-  : countMe(true), sprite(0), dir(LEFT), state(STATE_INIT)
+  : countMe(true), sprite(0), remove_out_of_bounds(true), dir(LEFT), state(STATE_INIT)
 {
   set_group(COLGROUP_DISABLED);
 }
@@ -62,7 +62,7 @@ BadGuy::draw(DrawingContext& context)
 void
 BadGuy::update(float elapsed_time)
 {
-  if(!Sector::current()->inside(bbox)) {
+  if(!Sector::current()->inside(bbox) && remove_out_of_bounds) {
     remove_me();
     return;
   }
index b3ae59f..5f0910a 100644 (file)
@@ -141,6 +141,12 @@ protected:
   /// is the enemy activated
   bool activated;
   /**
+   * Should the badguy be removed when it leaves the bounds of the sector?
+   * Use this when the badguy is portable and picked up by the player, who
+   * may actually leave the sector's bounds sometimes.
+   */
+  bool remove_out_of_bounds;
+  /**
    * initial position of the enemy. Also the position where enemy respawns when
    * after being deactivated.
    */
index 18efa2f..d79641a 100644 (file)
@@ -277,6 +277,7 @@ MrIceBlock::grab(MovingObject&, const Vector& pos, Direction dir)
   sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
   set_state(ICESTATE_GRABBED);
   set_group(COLGROUP_DISABLED);
+  remove_out_of_bounds = false;
 }
 
 void
@@ -285,6 +286,7 @@ MrIceBlock::ungrab(MovingObject& , Direction dir)
   this->dir = dir;
   set_state(ICESTATE_KICKED);
   set_group(COLGROUP_MOVING);
+  remove_out_of_bounds = true;
 }
 
 IMPLEMENT_FACTORY(MrIceBlock, "mriceblock")
index da30b22..091619c 100644 (file)
@@ -177,6 +177,7 @@ Console::parse(std::string s)
   }
 
   // command is args[0]
+  if (args.size() == 0) return;
   std::string command = args.front();
   args.erase(args.begin());
 
index 6b6b627..6a090e4 100644 (file)
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #ifndef __PHYSFSSTREAM_HPP__
 #define __PHYSFSSTREAM_HPP__
 
+#include <stddef.h>
 #include <physfs.h>
 #include <string>
 #include <streambuf>
index 174343b..42f59c1 100644 (file)
@@ -148,19 +148,19 @@ TextureManager::save_texture(Texture* texture)
   saved_texture.texture = texture;
   glBindTexture(GL_TEXTURE_2D, texture->get_handle());
   glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH,
-                           &saved_texture.width);
+                           (GLint*)&saved_texture.width);
   glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT,
-                           &saved_texture.height);
+                           (GLint*)&saved_texture.height);
   glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER,
-                           &saved_texture.border);
+                           (GLint*)&saved_texture.border);
   glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
-                      &saved_texture.min_filter);
+                      (GLint*)&saved_texture.min_filter);
   glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
-                      &saved_texture.mag_filter);
+                      (GLint*)&saved_texture.mag_filter);
   glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
-                      &saved_texture.wrap_s);
+                      (GLint*)&saved_texture.wrap_s);
   glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
-                      &saved_texture.wrap_t);
+                      (GLint*)&saved_texture.wrap_t);
 
   size_t pixelssize = saved_texture.width * saved_texture.height * 4;
   saved_texture.pixels = new char[pixelssize];
index 7999097..faf5c7b 100644 (file)
@@ -19,6 +19,7 @@
 //  02111-1307, USA.
 #include <config.h>
 
+#include <stddef.h>
 #include <physfs.h>
 #include <stdexcept>