# Include Dirs
IncludeDir $(top_builddir) ; # for config.h
-IncludeDir lib src ;
+IncludeDir $(top_srcdir)/src ;
if $(XGETTEXT) != ""
{
SubInclude TOP src scripting ;
sources =
- [ Wildcard *.cpp *.h ]
- [ Wildcard audio : *.cpp *.h ]
- [ Wildcard audio/newapi : *.cpp *.h ]
- [ Wildcard badguy : *.cpp *.h ]
- [ Wildcard control : *.cpp *.h ]
- [ Wildcard gui : *.cpp *.h ]
- [ Wildcard lisp : *.cpp *.h ]
- [ Wildcard math : *.cpp *.h ]
- [ Wildcard object : *.cpp *.h ]
- [ Wildcard physfs : *.cpp *.h ]
- [ Wildcard sprite : *.cpp *.h ]
- [ Wildcard tinygettext : *.cpp *.h ]
- [ Wildcard trigger : *.cpp *.h ]
- [ Wildcard video : *.cpp *.h ]
+ [ Wildcard *.cpp *.hpp ]
+ [ Wildcard audio : *.cpp *.hpp ]
+ [ Wildcard audio/newapi : *.cpp *.hpp ]
+ [ Wildcard badguy : *.cpp *.hpp ]
+ [ Wildcard control : *.cpp *.hpp ]
+ [ Wildcard gui : *.cpp *.hpp ]
+ [ Wildcard lisp : *.cpp *.hpp ]
+ [ Wildcard math : *.cpp *.hpp ]
+ [ Wildcard object : *.cpp *.hpp ]
+ [ Wildcard physfs : *.cpp *.hpp ]
+ [ Wildcard sprite : *.cpp *.hpp ]
+ [ Wildcard tinygettext : *.cpp *.hpp ]
+ [ Wildcard trigger : *.cpp *.hpp ]
+ [ Wildcard video : *.cpp *.hpp ]
;
TRANSLATABLE_SOURCES += [ SearchSource $(sources) ] ;
/** Used SDL_mixer and glest source as reference */
#include <config.h>
-#include "sound_file.h"
+#include "sound_file.hpp"
#include <stdio.h>
#include <stdint.h>
+++ /dev/null
-#ifndef __SOUND_FILE_H__
-#define __SOUND_FILE_H__
-
-#include <stdio.h>
-#include <iostream>
-
-class SoundFile
-{
-public:
- virtual ~SoundFile()
- { }
-
- virtual size_t read(void* buffer, size_t buffer_size) = 0;
- virtual void reset() = 0;
-
- int channels;
- int rate;
- int bits_per_sample;
- /// size in bytes
- size_t size;
-};
-
-SoundFile* load_sound_file(const std::string& filename);
-
-#endif
-
--- /dev/null
+#ifndef __SOUND_FILE_H__
+#define __SOUND_FILE_H__
+
+#include <stdio.h>
+#include <iostream>
+
+class SoundFile
+{
+public:
+ virtual ~SoundFile()
+ { }
+
+ virtual size_t read(void* buffer, size_t buffer_size) = 0;
+ virtual void reset() = 0;
+
+ int channels;
+ int rate;
+ int bits_per_sample;
+ /// size in bytes
+ size_t size;
+};
+
+SoundFile* load_sound_file(const std::string& filename);
+
+#endif
+
-#include "sound_manager.h"
+#include "sound_manager.hpp"
#include <stdexcept>
#include <iostream>
#include <sstream>
#include <memory>
-#include "sound_file.h"
-#include "sound_source.h"
-#include "stream_sound_source.h"
+#include "sound_file.hpp"
+#include "sound_source.hpp"
+#include "stream_sound_source.hpp"
SoundManager::SoundManager()
: device(0), context(0), sound_enabled(false), music_source(0)
+++ /dev/null
-#ifndef __SOUND_MANAGER_H__
-#define __SOUND_MANAGER_H__
-
-#include "math/vector.h"
-#include <string>
-#include <vector>
-#include <map>
-
-#include <AL/alc.h>
-#include <AL/al.h>
-
-typedef void* SoundHandle;
-
-class SoundFile;
-class SoundSource;
-class StreamSoundSource;
-
-class SoundManager
-{
-public:
- SoundManager();
- virtual ~SoundManager();
-
- void enable_sound(bool sound_enabled);
- /**
- * Creates a new sound source object which plays the specified soundfile.
- * You are responsible for deleting the sound source later (this will stop the
- * sound).
- * This function might throw exceptions. It returns 0 if no audio device is
- * available.
- */
- SoundSource* create_sound_source(const std::string& filename);
- /**
- * Convenience function to simply play a sound at a given position.
- * This functions prepends sounds/ to the name and adds .wav
- */
- void play(const std::string& name, const Vector& pos = Vector(-1, -1));
-
- void set_listener_position(Vector position);
- void set_listener_velocity(Vector velocity);
-
- void enable_music(bool music_enabled);
- void play_music(const std::string& filename);
-
- void update();
-
-private:
- friend class SoundSource;
- friend class StreamSoundSource;
-
- static ALuint load_file_into_buffer(const std::string& filename);
- static ALenum get_sample_format(SoundFile* file);
-
- void print_openal_version();
- void check_alc_error(const char* message);
- static void check_al_error(const char* message);
-
- ALCdevice* device;
- ALCcontext* context;
- bool sound_enabled;
-
- typedef std::map<std::string, ALuint> SoundBuffers;
- SoundBuffers buffers;
- typedef std::vector<SoundSource*> SoundSources;
- SoundSources sources;
-
- StreamSoundSource* music_source;
-
- bool music_enabled;
- std::string current_music;
-};
-
-#endif
-
--- /dev/null
+#ifndef __SOUND_MANAGER_H__
+#define __SOUND_MANAGER_H__
+
+#include "math/vector.hpp"
+#include <string>
+#include <vector>
+#include <map>
+
+#include <AL/alc.h>
+#include <AL/al.h>
+
+typedef void* SoundHandle;
+
+class SoundFile;
+class SoundSource;
+class StreamSoundSource;
+
+class SoundManager
+{
+public:
+ SoundManager();
+ virtual ~SoundManager();
+
+ void enable_sound(bool sound_enabled);
+ /**
+ * Creates a new sound source object which plays the specified soundfile.
+ * You are responsible for deleting the sound source later (this will stop the
+ * sound).
+ * This function might throw exceptions. It returns 0 if no audio device is
+ * available.
+ */
+ SoundSource* create_sound_source(const std::string& filename);
+ /**
+ * Convenience function to simply play a sound at a given position.
+ * This functions prepends sounds/ to the name and adds .wav
+ */
+ void play(const std::string& name, const Vector& pos = Vector(-1, -1));
+
+ void set_listener_position(Vector position);
+ void set_listener_velocity(Vector velocity);
+
+ void enable_music(bool music_enabled);
+ void play_music(const std::string& filename);
+
+ void update();
+
+private:
+ friend class SoundSource;
+ friend class StreamSoundSource;
+
+ static ALuint load_file_into_buffer(const std::string& filename);
+ static ALenum get_sample_format(SoundFile* file);
+
+ void print_openal_version();
+ void check_alc_error(const char* message);
+ static void check_al_error(const char* message);
+
+ ALCdevice* device;
+ ALCcontext* context;
+ bool sound_enabled;
+
+ typedef std::map<std::string, ALuint> SoundBuffers;
+ SoundBuffers buffers;
+ typedef std::vector<SoundSource*> SoundSources;
+ SoundSources sources;
+
+ StreamSoundSource* music_source;
+
+ bool music_enabled;
+ std::string current_music;
+};
+
+#endif
+
#include <config.h>
-#include "sound_source.h"
-#include "sound_manager.h"
+#include "sound_source.hpp"
+#include "sound_manager.hpp"
SoundSource::SoundSource()
{
+++ /dev/null
-#ifndef __SOUND_SOURCE_H__
-#define __SOUND_SOURCE_H__
-
-#include <AL/al.h>
-#include "math/vector.h"
-
-class SoundSource
-{
-public:
- SoundSource();
- virtual ~SoundSource();
-
- void play();
- void stop();
- bool playing();
-
- void set_looping(bool looping);
- /// Set volume (0.0 is silent, 1.0 is normal)
- void set_gain(float gain);
- void set_position(Vector position);
- void set_velocity(Vector position);
- void set_reference_distance(float distance);
-
-protected:
- friend class SoundManager;
-
- ALuint source;
-};
-
-#endif
-
--- /dev/null
+#ifndef __SOUND_SOURCE_H__
+#define __SOUND_SOURCE_H__
+
+#include <AL/al.h>
+#include "math/vector.hpp"
+
+class SoundSource
+{
+public:
+ SoundSource();
+ virtual ~SoundSource();
+
+ void play();
+ void stop();
+ bool playing();
+
+ void set_looping(bool looping);
+ /// Set volume (0.0 is silent, 1.0 is normal)
+ void set_gain(float gain);
+ void set_position(Vector position);
+ void set_velocity(Vector position);
+ void set_reference_distance(float distance);
+
+protected:
+ friend class SoundManager;
+
+ ALuint source;
+};
+
+#endif
+
#include <config.h>
-#include "stream_sound_source.h"
-#include "sound_manager.h"
-#include "sound_file.h"
+#include "stream_sound_source.hpp"
+#include "sound_manager.hpp"
+#include "sound_file.hpp"
StreamSoundSource::StreamSoundSource(SoundFile* file)
{
+++ /dev/null
-#ifndef __STREAM_SOUND_SOURCE_H__
-#define __STREAM_SOUND_SOURCE_H__
-
-#include <stdio.h>
-#include "sound_source.h"
-
-class SoundFile;
-
-class StreamSoundSource : public SoundSource
-{
-public:
- StreamSoundSource(SoundFile* file);
- virtual ~StreamSoundSource();
-
- void update();
-
-private:
- static const size_t STREAMBUFFERSIZE = 1024 * 500;
- static const size_t STREAMFRAGMENTS = 5;
- static const size_t STREAMFRAGMENTSIZE
- = STREAMBUFFERSIZE / STREAMFRAGMENTS;
-
- void fillBufferAndQueue(ALuint buffer);
- SoundFile* file;
- ALuint buffers[STREAMFRAGMENTS];
- ALenum format;
-
- enum FadeState { NoFading, FadingOn, FadingOff };
- FadeState fade_state;
- // TODO
-};
-
-#endif
-
--- /dev/null
+#ifndef __STREAM_SOUND_SOURCE_H__
+#define __STREAM_SOUND_SOURCE_H__
+
+#include <stdio.h>
+#include "sound_source.hpp"
+
+class SoundFile;
+
+class StreamSoundSource : public SoundSource
+{
+public:
+ StreamSoundSource(SoundFile* file);
+ virtual ~StreamSoundSource();
+
+ void update();
+
+private:
+ static const size_t STREAMBUFFERSIZE = 1024 * 500;
+ static const size_t STREAMFRAGMENTS = 5;
+ static const size_t STREAMFRAGMENTSIZE
+ = STREAMBUFFERSIZE / STREAMFRAGMENTS;
+
+ void fillBufferAndQueue(ALuint buffer);
+ SoundFile* file;
+ ALuint buffers[STREAMFRAGMENTS];
+ ALenum format;
+
+ enum FadeState { NoFading, FadingOn, FadingOff };
+ FadeState fade_state;
+ // TODO
+};
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "badguy.h"
-#include "object/camera.h"
-#include "statistics.h"
+#include "badguy.hpp"
+#include "object/camera.hpp"
+#include "statistics.hpp"
static const float SQUISH_TIME = 2;
static const float X_OFFSCREEN_DISTANCE = 1600;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __BADGUY_H__
-#define __BADGUY_H__
-
-// moved them here to make it less typing when implementing new badguys
-#include <math.h>
-#include "timer.h"
-#include "moving_object.h"
-#include "sprite/sprite.h"
-#include "physic.h"
-#include "object/player.h"
-#include "serializable.h"
-#include "resources.h"
-#include "sector.h"
-#include "direction.h"
-#include "object_factory.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "video/drawing_context.h"
-#include "audio/sound_manager.h"
-#include "audio/sound_source.h"
-#include "sprite/sprite_manager.h"
-
-class BadGuy : public MovingObject, public Serializable
-{
-public:
- BadGuy();
- ~BadGuy();
-
- /** Called when the badguy is drawn. The default implementation simply draws
- * the badguy sprite on screen
- */
- virtual void draw(DrawingContext& context);
- /** Called each frame. The default implementation checks badguy state and
- * calls active_update and inactive_update
- */
- virtual void update(float elapsed_time);
- /** Called when a collision with another object occured. The default
- * implemetnation calls collision_player, collision_solid, collision_badguy
- * and collision_squished
- */
- virtual HitResponse collision(GameObject& other,
- const CollisionHit& hit);
-
- /** Set the badguy to kill/falling state, which makes him falling of the
- * screen (his sprite is turned upside-down)
- */
- virtual void kill_fall();
-
- Vector get_start_position() const
- {
- return start_position;
- }
- void set_start_position(const Vector& vec)
- {
- start_position = vec;
- }
-
- /** Count this badguy to the statistics? This value should not be changed
- * during runtime. */
- bool countMe;
-
-protected:
- enum State {
- STATE_INIT,
- STATE_INACTIVE,
- STATE_ACTIVE,
- STATE_SQUISHED,
- STATE_FALLING
- };
-
- /** Called when the badguy collided with a player */
- virtual HitResponse collision_player(Player& player,
- const CollisionHit& hit);
- /** Called when the badguy collided with solid ground */
- virtual HitResponse collision_solid(GameObject& other,
- const CollisionHit& hit);
- /** Called when the badguy collided with another badguy */
- virtual HitResponse collision_badguy(BadGuy& other,
- const CollisionHit& hit);
-
- /** Called when the player hit the badguy from above. You should return true
- * if the badguy was squished, false if squishing wasn't possible
- */
- virtual bool collision_squished(Player& player);
-
- /** called each frame when the badguy is activated. */
- virtual void active_update(float elapsed_time);
- /** called each frame when the badguy is not activated. */
- virtual void inactive_update(float elapsed_time);
-
- /**
- * called when the badguy has been activated. (As a side effect the dir
- * variable might have been changed so that it faces towards the player.
- */
- virtual void activate();
- /** called when the badguy has been deactivated */
- virtual void deactivate();
-
- void kill_squished(Player& player);
-
- void set_state(State state);
- State get_state() const
- { return state; }
-
- /**
- * returns a pointer to the player, try to avoid this function to avoid
- * problems later when we have multiple players or no player in scripted
- * sequence.
- */
- Player* get_player();
-
- Sprite* sprite;
- Physic physic;
-
- /// is the enemy activated
- bool activated;
- /**
- * initial position of the enemy. Also the position where enemy respawns when
- * after being deactivated.
- */
- bool is_offscreen();
-
- Vector start_position;
-
- Direction dir;
-private:
- void try_activate();
-
- State state;
- Timer state_timer;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __BADGUY_H__
+#define __BADGUY_H__
+
+// moved them here to make it less typing when implementing new badguys
+#include <math.h>
+#include "timer.hpp"
+#include "moving_object.hpp"
+#include "sprite/sprite.hpp"
+#include "physic.hpp"
+#include "object/player.hpp"
+#include "serializable.hpp"
+#include "resources.hpp"
+#include "sector.hpp"
+#include "direction.hpp"
+#include "object_factory.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "video/drawing_context.hpp"
+#include "audio/sound_manager.hpp"
+#include "audio/sound_source.hpp"
+#include "sprite/sprite_manager.hpp"
+
+class BadGuy : public MovingObject, public Serializable
+{
+public:
+ BadGuy();
+ ~BadGuy();
+
+ /** Called when the badguy is drawn. The default implementation simply draws
+ * the badguy sprite on screen
+ */
+ virtual void draw(DrawingContext& context);
+ /** Called each frame. The default implementation checks badguy state and
+ * calls active_update and inactive_update
+ */
+ virtual void update(float elapsed_time);
+ /** Called when a collision with another object occured. The default
+ * implemetnation calls collision_player, collision_solid, collision_badguy
+ * and collision_squished
+ */
+ virtual HitResponse collision(GameObject& other,
+ const CollisionHit& hit);
+
+ /** Set the badguy to kill/falling state, which makes him falling of the
+ * screen (his sprite is turned upside-down)
+ */
+ virtual void kill_fall();
+
+ Vector get_start_position() const
+ {
+ return start_position;
+ }
+ void set_start_position(const Vector& vec)
+ {
+ start_position = vec;
+ }
+
+ /** Count this badguy to the statistics? This value should not be changed
+ * during runtime. */
+ bool countMe;
+
+protected:
+ enum State {
+ STATE_INIT,
+ STATE_INACTIVE,
+ STATE_ACTIVE,
+ STATE_SQUISHED,
+ STATE_FALLING
+ };
+
+ /** Called when the badguy collided with a player */
+ virtual HitResponse collision_player(Player& player,
+ const CollisionHit& hit);
+ /** Called when the badguy collided with solid ground */
+ virtual HitResponse collision_solid(GameObject& other,
+ const CollisionHit& hit);
+ /** Called when the badguy collided with another badguy */
+ virtual HitResponse collision_badguy(BadGuy& other,
+ const CollisionHit& hit);
+
+ /** Called when the player hit the badguy from above. You should return true
+ * if the badguy was squished, false if squishing wasn't possible
+ */
+ virtual bool collision_squished(Player& player);
+
+ /** called each frame when the badguy is activated. */
+ virtual void active_update(float elapsed_time);
+ /** called each frame when the badguy is not activated. */
+ virtual void inactive_update(float elapsed_time);
+
+ /**
+ * called when the badguy has been activated. (As a side effect the dir
+ * variable might have been changed so that it faces towards the player.
+ */
+ virtual void activate();
+ /** called when the badguy has been deactivated */
+ virtual void deactivate();
+
+ void kill_squished(Player& player);
+
+ void set_state(State state);
+ State get_state() const
+ { return state; }
+
+ /**
+ * returns a pointer to the player, try to avoid this function to avoid
+ * problems later when we have multiple players or no player in scripted
+ * sequence.
+ */
+ Player* get_player();
+
+ Sprite* sprite;
+ Physic physic;
+
+ /// is the enemy activated
+ bool activated;
+ /**
+ * initial position of the enemy. Also the position where enemy respawns when
+ * after being deactivated.
+ */
+ bool is_offscreen();
+
+ Vector start_position;
+
+ Direction dir;
+private:
+ void try_activate();
+
+ State state;
+ Timer state_timer;
+};
+
+#endif
+
#include <config.h>
-#include "bomb.h"
+#include "bomb.hpp"
static const float TICKINGTIME = 1;
static const float EXPLOSIONTIME = 1;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __BOMB_H__
-#define __BOMB_H__
-
-#include "badguy.h"
-
-class Bomb : public BadGuy
-{
-public:
- Bomb(const Vector& pos, Direction dir);
-
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_player(Player& player, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
- void active_update(float elapsed_time);
- void kill_fall();
- void explode();
-
-private:
- int state;
- Timer timer;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __BOMB_H__
+#define __BOMB_H__
+
+#include "badguy.hpp"
+
+class Bomb : public BadGuy
+{
+public:
+ Bomb(const Vector& pos, Direction dir);
+
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_player(Player& player, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+ void active_update(float elapsed_time);
+ void kill_fall();
+ void explode();
+
+private:
+ int state;
+ Timer timer;
+};
+
+#endif
+
#include <config.h>
-#include "bouncing_snowball.h"
+#include "bouncing_snowball.hpp"
static const float JUMPSPEED = 450;
static const float WALKSPEED = 80;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __BOUNCING_SNOWBALL_H__
-#define __BOUNCING_SNOWBALL_H__
-
-#include "badguy.h"
-
-class BouncingSnowball : public BadGuy
-{
-public:
- BouncingSnowball(const lisp::Lisp& reader);
- BouncingSnowball(float pos_x, float pos_y, Direction d);
-
- void activate();
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
-
-protected:
- bool collision_squished(Player& player);
- bool set_direction;
- Direction initial_direction;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __BOUNCING_SNOWBALL_H__
+#define __BOUNCING_SNOWBALL_H__
+
+#include "badguy.hpp"
+
+class BouncingSnowball : public BadGuy
+{
+public:
+ BouncingSnowball(const lisp::Lisp& reader);
+ BouncingSnowball(float pos_x, float pos_y, Direction d);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+
+protected:
+ bool collision_squished(Player& player);
+ bool set_direction;
+ Direction initial_direction;
+};
+
+#endif
+
#include <config.h>
-#include "dispenser.h"
-#include "badguy/bouncing_snowball.h"
-#include "badguy/snowball.h"
-#include "badguy/mrbomb.h"
-#include "badguy/mriceblock.h"
-#include "badguy/mrrocket.h"
-#include "badguy/poisonivy.h"
+#include "dispenser.hpp"
+#include "badguy/bouncing_snowball.hpp"
+#include "badguy/snowball.hpp"
+#include "badguy/mrbomb.hpp"
+#include "badguy/mriceblock.hpp"
+#include "badguy/mrrocket.hpp"
+#include "badguy/poisonivy.hpp"
Dispenser::Dispenser(const lisp::Lisp& reader)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __DISPENSER_H__
-#define __DISPENSER_H__
-
-#include "badguy.h"
-#include "timer.h"
-
-class Dispenser : public BadGuy
-{
-public:
- Dispenser(const lisp::Lisp& reader);
-
- void activate();
- void write(lisp::Writer& writer);
- void active_update(float elapsed_time);
-
-protected:
- bool collision_squished(Player& player);
- void launch_badguy();
- float cycle;
- std::string badguy;
- Timer dispense_timer;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __DISPENSER_H__
+#define __DISPENSER_H__
+
+#include "badguy.hpp"
+#include "timer.hpp"
+
+class Dispenser : public BadGuy
+{
+public:
+ Dispenser(const lisp::Lisp& reader);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ void active_update(float elapsed_time);
+
+protected:
+ bool collision_squished(Player& player);
+ void launch_badguy();
+ float cycle;
+ std::string badguy;
+ Timer dispense_timer;
+};
+
+#endif
+
#include <config.h>
-#include "flame.h"
+#include "flame.hpp"
Flame::Flame(const lisp::Lisp& reader)
: angle(0), radius(100), speed(2), source(0)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __FLAME_H__
-#define __FLAME_H__
-
-#include "badguy.h"
-
-class Flame : public BadGuy
-{
-public:
- Flame(const lisp::Lisp& reader);
- ~Flame();
-
- void activate();
- void deactivate();
-
- void write(lisp::Writer& write);
- void active_update(float elapsed_time);
- void kill_fall();
-
-private:
- float angle;
- float radius;
- float speed;
-
- SoundSource* source;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __FLAME_H__
+#define __FLAME_H__
+
+#include "badguy.hpp"
+
+class Flame : public BadGuy
+{
+public:
+ Flame(const lisp::Lisp& reader);
+ ~Flame();
+
+ void activate();
+ void deactivate();
+
+ void write(lisp::Writer& write);
+ void active_update(float elapsed_time);
+ void kill_fall();
+
+private:
+ float angle;
+ float radius;
+ float speed;
+
+ SoundSource* source;
+};
+
+#endif
+
#include <config.h>
#include <stdio.h>
-#include "flyingsnowball.h"
+#include "flyingsnowball.hpp"
static const float FLYTIME = 1.0;
static const float FLYSPEED = 100.0;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __FLYINGSNOWBALL_H__
-#define __FLYINGSNOWBALL_H__
-
-#include "badguy.h"
-
-class FlyingSnowBall : public BadGuy
-{
-public:
- FlyingSnowBall(const lisp::Lisp& reader);
- FlyingSnowBall(float pos_x, float pos_y);
-
- void activate();
- void write(lisp::Writer& writer);
- void active_update(float elapsed_time);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
-protected:
- enum FlyingSnowballMode {
- FLY_UP,
- FLY_DOWN
- };
- FlyingSnowballMode mode;
- bool collision_squished(Player& player);
-private:
- Timer timer;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __FLYINGSNOWBALL_H__
+#define __FLYINGSNOWBALL_H__
+
+#include "badguy.hpp"
+
+class FlyingSnowBall : public BadGuy
+{
+public:
+ FlyingSnowBall(const lisp::Lisp& reader);
+ FlyingSnowBall(float pos_x, float pos_y);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ void active_update(float elapsed_time);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+protected:
+ enum FlyingSnowballMode {
+ FLY_UP,
+ FLY_DOWN
+ };
+ FlyingSnowballMode mode;
+ bool collision_squished(Player& player);
+private:
+ Timer timer;
+};
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "jumpy.h"
+#include "jumpy.hpp"
static const float JUMPSPEED=600;
static const float JUMPY_MID_TOLERANCE=4;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __JUMPY_H__
-#define __JUMPY_H__
-
-#include "badguy.h"
-
-class Jumpy : public BadGuy
-{
-public:
- Jumpy(const lisp::Lisp& reader);
-
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
-
- void write(lisp::Writer& writer);
- void active_update(float);
-
-private:
- HitResponse hit(const CollisionHit& hit);
- Vector pos_groundhit;
- bool groundhit_pos_set;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __JUMPY_H__
+#define __JUMPY_H__
+
+#include "badguy.hpp"
+
+class Jumpy : public BadGuy
+{
+public:
+ Jumpy(const lisp::Lisp& reader);
+
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
+
+ void write(lisp::Writer& writer);
+ void active_update(float);
+
+private:
+ HitResponse hit(const CollisionHit& hit);
+ Vector pos_groundhit;
+ bool groundhit_pos_set;
+};
+
+#endif
+
#include <config.h>
-#include "mrbomb.h"
-#include "bomb.h"
+#include "mrbomb.hpp"
+#include "bomb.hpp"
static const float WALKSPEED = 80;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __MRBOMB_H__
-#define __MRBOMB_H__
-
-#include "badguy.h"
-
-class MrBomb : public BadGuy
-{
-public:
- MrBomb(const lisp::Lisp& reader);
- MrBomb(float pos_x, float pos_y, Direction d);
-
- void activate();
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
- void kill_fall();
-
-protected:
- bool collision_squished(Player& player);
- bool set_direction;
- Direction initial_direction;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __MRBOMB_H__
+#define __MRBOMB_H__
+
+#include "badguy.hpp"
+
+class MrBomb : public BadGuy
+{
+public:
+ MrBomb(const lisp::Lisp& reader);
+ MrBomb(float pos_x, float pos_y, Direction d);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+ void kill_fall();
+
+protected:
+ bool collision_squished(Player& player);
+ bool set_direction;
+ Direction initial_direction;
+};
+
+#endif
+
#include <config.h>
-#include "mriceblock.h"
-#include "object/block.h"
+#include "mriceblock.hpp"
+#include "object/block.hpp"
static const float WALKSPEED = 80;
static const float KICKSPEED = 500;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __MRICEBLOCK_H__
-#define __MRICEBLOCK_H__
-
-#include "badguy.h"
-
-class MrIceBlock : public BadGuy
-{
-public:
- MrIceBlock(const lisp::Lisp& reader);
- MrIceBlock(float pos_x, float pos_y, Direction d);
-
- void activate();
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& object, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
-
- void active_update(float elapsed_time);
-
-protected:
- bool collision_squished(Player& player);
-
-private:
- enum IceState {
- ICESTATE_NORMAL,
- ICESTATE_FLAT,
- ICESTATE_KICKED
- };
- IceState ice_state;
- Timer flat_timer;
- int squishcount;
- bool set_direction;
- Direction initial_direction;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __MRICEBLOCK_H__
+#define __MRICEBLOCK_H__
+
+#include "badguy.hpp"
+
+class MrIceBlock : public BadGuy
+{
+public:
+ MrIceBlock(const lisp::Lisp& reader);
+ MrIceBlock(float pos_x, float pos_y, Direction d);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& object, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+
+ void active_update(float elapsed_time);
+
+protected:
+ bool collision_squished(Player& player);
+
+private:
+ enum IceState {
+ ICESTATE_NORMAL,
+ ICESTATE_FLAT,
+ ICESTATE_KICKED
+ };
+ IceState ice_state;
+ Timer flat_timer;
+ int squishcount;
+ bool set_direction;
+ Direction initial_direction;
+};
+
+#endif
+
#include <config.h>
-#include "mrrocket.h"
+#include "mrrocket.hpp"
static const float SPEED = 200;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __MRROCKET_H__
-#define __MRROCKET_H__
-
-#include "badguy.h"
-#include "timer.h"
-#include "rocketexplosion.h"
-
-class MrRocket : public BadGuy
-{
-public:
- MrRocket(const lisp::Lisp& reader);
- MrRocket(float pos_x, float pos_y, Direction d);
-
- void activate();
- void active_update(float elapsed_time);
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
-
-protected:
- bool collision_squished(Player& player);
- bool set_direction;
- Direction initial_direction;
- Timer collision_timer;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __MRROCKET_H__
+#define __MRROCKET_H__
+
+#include "badguy.hpp"
+#include "timer.hpp"
+#include "rocketexplosion.hpp"
+
+class MrRocket : public BadGuy
+{
+public:
+ MrRocket(const lisp::Lisp& reader);
+ MrRocket(float pos_x, float pos_y, Direction d);
+
+ void activate();
+ void active_update(float elapsed_time);
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+
+protected:
+ bool collision_squished(Player& player);
+ bool set_direction;
+ Direction initial_direction;
+ Timer collision_timer;
+};
+
+#endif
+
#include <config.h>
-#include "mrtree.h"
+#include "mrtree.hpp"
static const float WALKSPEED = 50;
static const float WALKSPEED_SMALL = 30;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __MRTREE_H__
-#define __MRTREE_H__
-
-#include "badguy.h"
-
-class MrTree : public BadGuy
-{
-public:
- MrTree(const lisp::Lisp& reader);
-
- void activate();
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
-
-protected:
- enum MyState {
- STATE_BIG, STATE_NORMAL
- };
- MyState mystate;
-
- bool collision_squished(Player& player);
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __MRTREE_H__
+#define __MRTREE_H__
+
+#include "badguy.hpp"
+
+class MrTree : public BadGuy
+{
+public:
+ MrTree(const lisp::Lisp& reader);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+
+protected:
+ enum MyState {
+ STATE_BIG, STATE_NORMAL
+ };
+ MyState mystate;
+
+ bool collision_squished(Player& player);
+};
+
+#endif
#include <config.h>
-#include "nolok_01.h"
-#include "badguy/bouncing_snowball.h"
-#include "trigger/door.h"
+#include "nolok_01.hpp"
+#include "badguy/bouncing_snowball.hpp"
+#include "trigger/door.hpp"
#define WALK_TIME 2.5
#define SHOOT_TIME 0.4
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __NOLOK01_H__
-#define __NOLOK01_H__
-
-#include "badguy.h"
-#include "timer.h"
-
-class Nolok_01 : public BadGuy
-{
-public:
- Nolok_01(const lisp::Lisp& reader);
- Nolok_01(float pos_x, float pos_y);
-
- void activate();
- void write(lisp::Writer& writer);
- void active_update(float elapsed_time);
- void kill_fall();
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
-
-protected:
- bool collision_squished(Player& player);
- Timer action_timer;
- enum Actions { WALKING, JUMPING, SHOOTING };
- Actions action;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __NOLOK01_H__
+#define __NOLOK01_H__
+
+#include "badguy.hpp"
+#include "timer.hpp"
+
+class Nolok_01 : public BadGuy
+{
+public:
+ Nolok_01(const lisp::Lisp& reader);
+ Nolok_01(float pos_x, float pos_y);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ void active_update(float elapsed_time);
+ void kill_fall();
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+
+protected:
+ bool collision_squished(Player& player);
+ Timer action_timer;
+ enum Actions { WALKING, JUMPING, SHOOTING };
+ Actions action;
+};
+
+#endif
+
#include <config.h>
-#include "poisonivy.h"
+#include "poisonivy.hpp"
static const float WALKSPEED = 80;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __POISONIVY_H__
-#define __POISONIVY_H__
-
-#include "badguy.h"
-
-class PoisonIvy : public BadGuy
-{
-public:
- PoisonIvy(const lisp::Lisp& reader);
- PoisonIvy(float pos_x, float pos_y, Direction d);
-
- void activate();
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
-
-protected:
- bool collision_squished(Player& player);
- bool set_direction;
- Direction initial_direction;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __POISONIVY_H__
+#define __POISONIVY_H__
+
+#include "badguy.hpp"
+
+class PoisonIvy : public BadGuy
+{
+public:
+ PoisonIvy(const lisp::Lisp& reader);
+ PoisonIvy(float pos_x, float pos_y, Direction d);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
+
+protected:
+ bool collision_squished(Player& player);
+ bool set_direction;
+ Direction initial_direction;
+};
+
+#endif
#include <config.h>
-#include "rocketexplosion.h"
+#include "rocketexplosion.hpp"
static const float EXPLOSIONTIME = 1;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __BOMB_H__
-#define __BOMB_H__
-
-#include "badguy.h"
-
-class RocketExplosion : public BadGuy
-{
-public:
- RocketExplosion(const Vector& pos, Direction dir);
-
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_player(Player& player, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
- void active_update(float elapsed_time);
- void kill_fall();
- void explode();
-
-private:
- Timer timer;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __BOMB_H__
+#define __BOMB_H__
+
+#include "badguy.hpp"
+
+class RocketExplosion : public BadGuy
+{
+public:
+ RocketExplosion(const Vector& pos, Direction dir);
+
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_player(Player& player, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+ void active_update(float elapsed_time);
+ void kill_fall();
+ void explode();
+
+private:
+ Timer timer;
+};
+
+#endif
+
#include <config.h>
-#include "snowball.h"
+#include "snowball.hpp"
static const float WALKSPEED = 80;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __SNOWBALL_H__
-#define __SNOWBALL_H__
-
-#include "badguy.h"
-
-class SnowBall : public BadGuy
-{
-public:
- SnowBall(const lisp::Lisp& reader);
- SnowBall(float pos_x, float pos_y, Direction d);
-
- void activate();
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
-
-protected:
- bool collision_squished(Player& player);
- bool set_direction;
- Direction initial_direction;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __SNOWBALL_H__
+#define __SNOWBALL_H__
+
+#include "badguy.hpp"
+
+class SnowBall : public BadGuy
+{
+public:
+ SnowBall(const lisp::Lisp& reader);
+ SnowBall(float pos_x, float pos_y, Direction d);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
+
+protected:
+ bool collision_squished(Player& player);
+ bool set_direction;
+ Direction initial_direction;
+};
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "spike.h"
+#include "spike.hpp"
Spike::Spike(const Vector& pos, Direction dir)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __SPIKE_H__
-#define __SPIKE_H__
-
-#include "badguy.h"
-
-class Spike : public BadGuy
-{
-public:
- enum Direction {
- NORTH=0, SOUTH, WEST, EAST
- };
- Spike(const Vector& pos, Direction dir);
- Spike(const lisp::Lisp& reader);
-
- void active_update(float elapsed_time);
- void write(lisp::Writer& writer);
- void kill_fall();
-private:
- void set_direction(Direction dir);
- Direction spikedir;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __SPIKE_H__
+#define __SPIKE_H__
+
+#include "badguy.hpp"
+
+class Spike : public BadGuy
+{
+public:
+ enum Direction {
+ NORTH=0, SOUTH, WEST, EAST
+ };
+ Spike(const Vector& pos, Direction dir);
+ Spike(const lisp::Lisp& reader);
+
+ void active_update(float elapsed_time);
+ void write(lisp::Writer& writer);
+ void kill_fall();
+private:
+ void set_direction(Direction dir);
+ Direction spikedir;
+};
+
+#endif
+
#include <config.h>
-#include "spiky.h"
+#include "spiky.hpp"
static const float WALKSPEED = 80;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __SPIKY_H__
-#define __SPIKY_H__
-
-#include "badguy.h"
-
-class Spiky : public BadGuy
-{
-public:
- Spiky(const lisp::Lisp& reader);
-
- void activate();
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __SPIKY_H__
+#define __SPIKY_H__
+
+#include "badguy.hpp"
+
+class Spiky : public BadGuy
+{
+public:
+ Spiky(const lisp::Lisp& reader);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+};
+
+#endif
#include <config.h>
-#include "stalactite.h"
+#include "stalactite.hpp"
static const int SHAKE_RANGE = 40;
static const float SHAKE_TIME = .8;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __STALACTITE_H__
-#define __STALACTITE_H__
-
-#include "badguy.h"
-
-class Stalactite : public BadGuy
-{
-public:
- Stalactite(const lisp::Lisp& reader);
-
- void active_update(float elapsed_time);
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
- HitResponse collision_player(Player& player, const CollisionHit& hit);
-
- void kill_fall();
- void draw(DrawingContext& context);
- void deactivate();
-
-protected:
- Timer timer;
-
- enum StalactiteState {
- STALACTITE_HANGING,
- STALACTITE_SHAKING,
- STALACTITE_FALLING,
- STALACTITE_SQUISHED
- };
- StalactiteState state;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __STALACTITE_H__
+#define __STALACTITE_H__
+
+#include "badguy.hpp"
+
+class Stalactite : public BadGuy
+{
+public:
+ Stalactite(const lisp::Lisp& reader);
+
+ void active_update(float elapsed_time);
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ HitResponse collision_player(Player& player, const CollisionHit& hit);
+
+ void kill_fall();
+ void draw(DrawingContext& context);
+ void deactivate();
+
+protected:
+ Timer timer;
+
+ enum StalactiteState {
+ STALACTITE_HANGING,
+ STALACTITE_SHAKING,
+ STALACTITE_FALLING,
+ STALACTITE_SQUISHED
+ };
+ StalactiteState state;
+};
+
+#endif
+
#include <float.h>
#include <sstream>
#include <memory>
-#include "yeti.h"
-#include "object/camera.h"
-#include "yeti_stalactite.h"
-#include "bouncing_snowball.h"
-#include "game_session.h"
-#include "scripting/script_interpreter.h"
+#include "yeti.hpp"
+#include "object/camera.hpp"
+#include "yeti_stalactite.hpp"
+#include "bouncing_snowball.hpp"
+#include "game_session.hpp"
+#include "scripting/script_interpreter.hpp"
static const float JUMP_VEL1 = 250;
static const float JUMP_VEL2 = 700;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __YETI_H__
-#define __YETI_H__
-
-#include "badguy.h"
-
-class Yeti : public BadGuy
-{
-public:
- Yeti(const lisp::Lisp& lisp);
- ~Yeti();
-
- void draw(DrawingContext& context);
- void write(lisp::Writer& writer);
- void active_update(float elapsed_time);
- HitResponse collision_solid(GameObject& object, const CollisionHit& hit);
- bool collision_squished(Player& player);
- void kill_fall();
-
-private:
- void go_right();
- void go_left();
- void angry_jumping();
- void drop_stalactite();
- void summon_snowball();
-
- enum YetiState {
- INIT,
- ANGRY_JUMPING,
- THROW_SNOWBALL,
- GO_RIGHT,
- GO_LEFT
- };
- Direction side;
- YetiState state;
- Timer timer;
- Timer safe_timer;
- int jumpcount;
- int hit_points;
- std::string dead_script;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __YETI_H__
+#define __YETI_H__
+
+#include "badguy.hpp"
+
+class Yeti : public BadGuy
+{
+public:
+ Yeti(const lisp::Lisp& lisp);
+ ~Yeti();
+
+ void draw(DrawingContext& context);
+ void write(lisp::Writer& writer);
+ void active_update(float elapsed_time);
+ HitResponse collision_solid(GameObject& object, const CollisionHit& hit);
+ bool collision_squished(Player& player);
+ void kill_fall();
+
+private:
+ void go_right();
+ void go_left();
+ void angry_jumping();
+ void drop_stalactite();
+ void summon_snowball();
+
+ enum YetiState {
+ INIT,
+ ANGRY_JUMPING,
+ THROW_SNOWBALL,
+ GO_RIGHT,
+ GO_LEFT
+ };
+ Direction side;
+ YetiState state;
+ Timer timer;
+ Timer safe_timer;
+ int jumpcount;
+ int hit_points;
+ std::string dead_script;
+};
+
+#endif
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
-#include "yeti_stalactite.h"
+#include "yeti_stalactite.hpp"
static const float SHAKE_TIME = .8;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __YETI_STALACTITE_H__
-#define __YETI_STALACTITE_H__
-
-#include "stalactite.h"
-
-class YetiStalactite : public Stalactite
-{
-public:
- YetiStalactite(const lisp::Lisp& lisp);
- virtual ~YetiStalactite();
-
- void active_update(float elapsed_time);
- void start_shaking();
- bool is_hanging();
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __YETI_STALACTITE_H__
+#define __YETI_STALACTITE_H__
+
+#include "stalactite.hpp"
+
+class YetiStalactite : public Stalactite
+{
+public:
+ YetiStalactite(const lisp::Lisp& lisp);
+ virtual ~YetiStalactite();
+
+ void active_update(float elapsed_time);
+ void start_shaking();
+ bool is_hanging();
+};
+
+#endif
+
#include <config.h>
#include <math.h>
-#include "zeekling.h"
+#include "zeekling.hpp"
//TODO: Make the Zeekling behave more interesting
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __ZEEKLING_H__
-#define __ZEEKLING_H__
-
-#include "badguy.h"
-
-class Zeekling : public BadGuy
-{
-public:
- Zeekling(const lisp::Lisp& reader);
- Zeekling(float pos_x, float pos_y, Direction d);
-
- void activate();
- void write(lisp::Writer& writer);
- HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
-
-protected:
- bool collision_squished(Player& player);
- bool set_direction;
- Direction initial_direction;
- float speed;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __ZEEKLING_H__
+#define __ZEEKLING_H__
+
+#include "badguy.hpp"
+
+class Zeekling : public BadGuy
+{
+public:
+ Zeekling(const lisp::Lisp& reader);
+ Zeekling(float pos_x, float pos_y, Direction d);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+
+protected:
+ bool collision_squished(Player& player);
+ bool set_direction;
+ Direction initial_direction;
+ float speed;
+};
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "collision.h"
+#include "collision.hpp"
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <float.h>
#include <math.h>
-#include "math/vector.h"
-#include "math/aatriangle.h"
-#include "math/rect.h"
-#include "collision_hit.h"
+#include "math/vector.hpp"
+#include "math/aatriangle.hpp"
+#include "math/rect.hpp"
+#include "collision_hit.hpp"
static const float DELTA = .0001;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __COLLISION_H__
-#define __COLLISION_H__
-
-class Vector;
-class Rect;
-class AATriangle;
-class CollisionHit;
-
-class Collision
-{
-public:
- /** does collision detection between 2 rectangles. Returns true in case of
- * collision and fills in the hit structure then.
- */
- static bool rectangle_rectangle(CollisionHit& hit, const Rect& r1,
- const Vector& movement, const Rect& r2);
-
- /** does collision detection between a rectangle and an axis aligned triangle
- * Returns true in case of a collision and fills in the hit structure then.
- */
- static bool rectangle_aatriangle(CollisionHit& hit, const Rect& rect,
- const Vector& movement, const AATriangle& triangle);
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __COLLISION_H__
+#define __COLLISION_H__
+
+class Vector;
+class Rect;
+class AATriangle;
+class CollisionHit;
+
+class Collision
+{
+public:
+ /** does collision detection between 2 rectangles. Returns true in case of
+ * collision and fills in the hit structure then.
+ */
+ static bool rectangle_rectangle(CollisionHit& hit, const Rect& r1,
+ const Vector& movement, const Rect& r2);
+
+ /** does collision detection between a rectangle and an axis aligned triangle
+ * Returns true in case of a collision and fills in the hit structure then.
+ */
+ static bool rectangle_aatriangle(CollisionHit& hit, const Rect& rect,
+ const Vector& movement, const AATriangle& triangle);
+};
+
+#endif
+
#include <config.h>
#include <iostream>
-#include "collision_grid.h"
-#include "collision.h"
-#include "sector.h"
-#include "collision_grid_iterator.h"
+#include "collision_grid.hpp"
+#include "collision.hpp"
+#include "sector.hpp"
+#include "collision_grid_iterator.hpp"
static const float DELTA = .001;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __COLLISION_GRID_H__
-#define __COLLISION_GRID_H__
-
-#include <vector>
-#include "moving_object.h"
-
-class CollisionGridIterator;
-
-/**
- * A rectangular grid to keep track of all moving game objects. It allows fast
- * queries for all objects in a rectangular area.
- */
-class CollisionGrid
-{
-public:
- CollisionGrid(float width, float height);
- ~CollisionGrid();
-
- void add_object(MovingObject* object);
- void remove_object(MovingObject* object);
-
- void check_collisions();
-
-private:
- friend class CollisionGridIterator;
-
- struct ObjectWrapper
- {
- MovingObject* object;
- Rect dest;
- /** (pseudo) timestamp. When reading from the grid the timestamp is
- * changed so that you can easily avoid reading an object multiple times
- * when it is in several cells that you check.
- */
- int timestamp;
- /// index in the objects vector
- int id;
- };
-
- /** Element for the single linked list in each grid cell */
- struct GridEntry
- {
- GridEntry* next;
- ObjectWrapper* object_wrapper;
- };
-
- void remove_object_from_gridcell(int gridcell, ObjectWrapper* wrapper);
- void collide_object(ObjectWrapper* wrapper);
- void collide_object_object(ObjectWrapper* wrapper, ObjectWrapper* wrapper2);
- void move_object(ObjectWrapper* wrapper);
-
- typedef std::vector<GridEntry*> GridEntries;
- GridEntries grid;
- typedef std::vector<ObjectWrapper*> Objects;
- Objects objects;
- size_t cells_x, cells_y;
- float width;
- float height;
- float cell_width;
- float cell_height;
- int iterator_timestamp;
-};
-
-extern CollisionGrid* bla;
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __COLLISION_GRID_H__
+#define __COLLISION_GRID_H__
+
+#include <vector>
+#include "moving_object.hpp"
+
+class CollisionGridIterator;
+
+/**
+ * A rectangular grid to keep track of all moving game objects. It allows fast
+ * queries for all objects in a rectangular area.
+ */
+class CollisionGrid
+{
+public:
+ CollisionGrid(float width, float height);
+ ~CollisionGrid();
+
+ void add_object(MovingObject* object);
+ void remove_object(MovingObject* object);
+
+ void check_collisions();
+
+private:
+ friend class CollisionGridIterator;
+
+ struct ObjectWrapper
+ {
+ MovingObject* object;
+ Rect dest;
+ /** (pseudo) timestamp. When reading from the grid the timestamp is
+ * changed so that you can easily avoid reading an object multiple times
+ * when it is in several cells that you check.
+ */
+ int timestamp;
+ /// index in the objects vector
+ int id;
+ };
+
+ /** Element for the single linked list in each grid cell */
+ struct GridEntry
+ {
+ GridEntry* next;
+ ObjectWrapper* object_wrapper;
+ };
+
+ void remove_object_from_gridcell(int gridcell, ObjectWrapper* wrapper);
+ void collide_object(ObjectWrapper* wrapper);
+ void collide_object_object(ObjectWrapper* wrapper, ObjectWrapper* wrapper2);
+ void move_object(ObjectWrapper* wrapper);
+
+ typedef std::vector<GridEntry*> GridEntries;
+ GridEntries grid;
+ typedef std::vector<ObjectWrapper*> Objects;
+ Objects objects;
+ size_t cells_x, cells_y;
+ float width;
+ float height;
+ float cell_width;
+ float cell_height;
+ int iterator_timestamp;
+};
+
+extern CollisionGrid* bla;
+
+#endif
+
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __COLLISION_GRID_ITERATOR_H__
-#define __COLLISION_GRID_ITERATOR_H__
-
-#include "math/rect.h"
-
-class CollisionGrid;
-
-class CollisionGridIterator
-{
-public:
- CollisionGridIterator(CollisionGrid& newgrid, const Rect& bbox)
- : grid(newgrid)
- {
- start_x = int(bbox.p1.x / grid.cell_width) - 2;
- if(start_x < 0)
- start_x = 0;
- x = start_x;
-
- y = int(bbox.p1.y / grid.cell_height) - 2;
- if(y < 0)
- y = 0;
-
- end_x = int(bbox.p2.x / grid.cell_width) + 2;
- if(end_x > (int) grid.cells_x)
- end_x = grid.cells_x;
-
- end_y = int(bbox.p2.y / grid.cell_height) + 2;
- if(end_y > (int) grid.cells_y)
- end_y = grid.cells_y;
-
- if(start_x >= end_x) {
- printf("bad region.\n");
- y = 0;
- end_y = 0;
- return;
- }
-
- timestamp = grid.iterator_timestamp++;
- entry = 0;
- }
-
- MovingObject* next()
- {
- CollisionGrid::ObjectWrapper* wrapper = next_wrapper();
- if(wrapper == 0)
- return 0;
-
- return wrapper->object;
- }
-
-private:
- friend class CollisionGrid;
-
- CollisionGrid::ObjectWrapper* next_wrapper()
- {
- CollisionGrid::ObjectWrapper* wrapper;
-
- do {
- while(entry == 0) {
- if(y >= end_y)
- return 0;
-
- entry = grid.grid[y*grid.cells_x + x];
- x++;
- if(x >= end_x) {
- x = start_x;
- y++;
- }
- }
-
- wrapper = entry->object_wrapper;
- entry = entry->next;
- } while(wrapper->timestamp == timestamp);
-
- wrapper->timestamp = timestamp;
-
- return wrapper;
- }
-
- CollisionGrid& grid;
- CollisionGrid::GridEntry* entry;
- int x, y;
- int start_x, end_x, end_y;
- int timestamp;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __COLLISION_GRID_ITERATOR_H__
+#define __COLLISION_GRID_ITERATOR_H__
+
+#include "math/rect.hpp"
+
+class CollisionGrid;
+
+class CollisionGridIterator
+{
+public:
+ CollisionGridIterator(CollisionGrid& newgrid, const Rect& bbox)
+ : grid(newgrid)
+ {
+ start_x = int(bbox.p1.x / grid.cell_width) - 2;
+ if(start_x < 0)
+ start_x = 0;
+ x = start_x;
+
+ y = int(bbox.p1.y / grid.cell_height) - 2;
+ if(y < 0)
+ y = 0;
+
+ end_x = int(bbox.p2.x / grid.cell_width) + 2;
+ if(end_x > (int) grid.cells_x)
+ end_x = grid.cells_x;
+
+ end_y = int(bbox.p2.y / grid.cell_height) + 2;
+ if(end_y > (int) grid.cells_y)
+ end_y = grid.cells_y;
+
+ if(start_x >= end_x) {
+ printf("bad region.\n");
+ y = 0;
+ end_y = 0;
+ return;
+ }
+
+ timestamp = grid.iterator_timestamp++;
+ entry = 0;
+ }
+
+ MovingObject* next()
+ {
+ CollisionGrid::ObjectWrapper* wrapper = next_wrapper();
+ if(wrapper == 0)
+ return 0;
+
+ return wrapper->object;
+ }
+
+private:
+ friend class CollisionGrid;
+
+ CollisionGrid::ObjectWrapper* next_wrapper()
+ {
+ CollisionGrid::ObjectWrapper* wrapper;
+
+ do {
+ while(entry == 0) {
+ if(y >= end_y)
+ return 0;
+
+ entry = grid.grid[y*grid.cells_x + x];
+ x++;
+ if(x >= end_x) {
+ x = start_x;
+ y++;
+ }
+ }
+
+ wrapper = entry->object_wrapper;
+ entry = entry->next;
+ } while(wrapper->timestamp == timestamp);
+
+ wrapper->timestamp = timestamp;
+
+ return wrapper;
+ }
+
+ CollisionGrid& grid;
+ CollisionGrid::GridEntry* entry;
+ int x, y;
+ int start_x, end_x, end_y;
+ int timestamp;
+};
+
+#endif
+
+++ /dev/null
-// $Id: collision_hit.h 2177 2004-11-24 23:10:09Z matzebraun $
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_COLLISION_HIT_H
-#define SUPERTUX_COLLISION_HIT_H
-
-#include "math/vector.h"
-
-/**
- * Used as return value for the collision functions, to indicate how the
- * collision should be handled
- */
-enum HitResponse
-{
- // note: keep the elements in this order
-
- /// don't move the object
- ABORT_MOVE = 0,
- /// move object out of collision and check for collisions again
- /// if this happens to often then the move will just be aborted
- CONTINUE,
- /// do the move ignoring the collision
- FORCE_MOVE
-};
-
-/**
- * This class collects data about a collision
- */
-class CollisionHit
-{
-public:
- /// penetration depth
- float depth;
- /// time of the collision (between 0 and 1 in relation to movement)
- float time;
- /// The normal of the side we collided with
- Vector normal;
-};
-
-#endif
-
--- /dev/null
+// $Id: collision_hit.h 2177 2004-11-24 23:10:09Z matzebraun $
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_COLLISION_HIT_H
+#define SUPERTUX_COLLISION_HIT_H
+
+#include "math/vector.hpp"
+
+/**
+ * Used as return value for the collision functions, to indicate how the
+ * collision should be handled
+ */
+enum HitResponse
+{
+ // note: keep the elements in this order
+
+ /// don't move the object
+ ABORT_MOVE = 0,
+ /// move object out of collision and check for collisions again
+ /// if this happens to often then the move will just be aborted
+ CONTINUE,
+ /// do the move ignoring the collision
+ FORCE_MOVE
+};
+
+/**
+ * This class collects data about a collision
+ */
+class CollisionHit
+{
+public:
+ /// penetration depth
+ float depth;
+ /// time of the collision (between 0 and 1 in relation to movement)
+ float time;
+ /// The normal of the side we collided with
+ Vector normal;
+};
+
+#endif
+
#include <config.h>
-#include "codecontroller.h"
+#include "codecontroller.hpp"
CodeController::CodeController()
{}
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __CODECONTROLLER_H__
-#define __CODECONTROLLER_H__
-
-#include "controller.h"
-
-/**
- * This is a dummy controler that doesn't react to any user input but should
- * be controlled by code
- */
-class CodeController : public Controller
-{
-public:
- CodeController();
- virtual ~CodeController();
-
- void press(Control c, bool pressed = true);
- void update();
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __CODECONTROLLER_H__
+#define __CODECONTROLLER_H__
+
+#include "controller.hpp"
+
+/**
+ * This is a dummy controler that doesn't react to any user input but should
+ * be controlled by code
+ */
+class CodeController : public Controller
+{
+public:
+ CodeController();
+ virtual ~CodeController();
+
+ void press(Control c, bool pressed = true);
+ void update();
+};
+
+#endif
#include <config.h>
-#include "controller.h"
+#include "controller.hpp"
extern Controller* main_controller;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __CONTROLLER_H__
-#define __CONTROLLER_H__
-
-class Controller
-{
-public:
- static const char* controlNames[];
-
- enum Control {
- LEFT = 0,
- RIGHT,
- UP,
- DOWN,
- JUMP,
- ACTION,
- PAUSE_MENU,
- MENU_SELECT,
-
- CONTROLCOUNT
- };
-
- Controller();
- virtual ~Controller();
-
- /** returns true if the control is pressed down */
- bool hold(Control control);
- /** returns true if the control has just been pressed down this frame */
- bool pressed(Control control);
-
- virtual void reset();
- virtual void update();
-
-protected:
- /** current control status */
- bool controls[CONTROLCOUNT];
- /** control status at last frame */
- bool oldControls[CONTROLCOUNT];
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __CONTROLLER_H__
+#define __CONTROLLER_H__
+
+class Controller
+{
+public:
+ static const char* controlNames[];
+
+ enum Control {
+ LEFT = 0,
+ RIGHT,
+ UP,
+ DOWN,
+ JUMP,
+ ACTION,
+ PAUSE_MENU,
+ MENU_SELECT,
+
+ CONTROLCOUNT
+ };
+
+ Controller();
+ virtual ~Controller();
+
+ /** returns true if the control is pressed down */
+ bool hold(Control control);
+ /** returns true if the control has just been pressed down this frame */
+ bool pressed(Control control);
+
+ virtual void reset();
+ virtual void update();
+
+protected:
+ /** current control status */
+ bool controls[CONTROLCOUNT];
+ /** control status at last frame */
+ bool oldControls[CONTROLCOUNT];
+};
+
+#endif
#include <config.h>
#include <sstream>
-#include "joystickkeyboardcontroller.h"
-#include "gui/menu.h"
-#include "gettext.h"
-#include "lisp/lisp.h"
-#include "lisp/list_iterator.h"
-#include "game_session.h"
+#include "joystickkeyboardcontroller.hpp"
+#include "gui/menu.hpp"
+#include "gettext.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/list_iterator.hpp"
+#include "game_session.hpp"
class JoystickKeyboardController::JoystickMenu : public Menu
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __JOYSTICKKEYBOARDCONTROLLER_H__
-#define __JOYSTICKKEYBOARDCONTROLLER_H__
-
-#include "controller.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include <SDL.h>
-#include <string>
-#include <map>
-
-class Menu;
-
-class JoystickKeyboardController : public Controller
-{
-public:
- JoystickKeyboardController();
- virtual ~JoystickKeyboardController();
-
- /** Process an SDL Event and return true if the event has been used
- */
- void process_event(const SDL_Event& event);
-
- void write(lisp::Writer& writer);
- void read(const lisp::Lisp& lisp);
- bool check_cheatcode(const std::string& cheatcode);
- void reset();
-
- Menu* get_key_options_menu();
- Menu* get_joystick_options_menu();
-
-private:
- void process_menu_key_event(const SDL_Event& event);
-
- typedef std::map<SDLKey, Control> KeyMap;
- KeyMap keymap;
-
- std::vector<SDL_Joystick*> joysticks;
-
- typedef std::map<int, Control> ButtonMap;
- ButtonMap joy_button_map;
- std::string name;
- bool use_hat;
- int joyaxis_x;
- int joyaxis_y;
- int dead_zone_x;
- int dead_zone_y;
- /// the number of buttons all joysticks have
- int min_joybuttons;
- /// the max number of buttons a joystick has
- int max_joybuttons;
-
- enum {
- MNID_KEY_UP,
- MNID_KEY_DOWN,
- MNID_KEY_LEFT,
- MNID_KEY_RIGHT,
- MNID_KEY_JUMP,
- MNID_KEY_ACTION
- };
- enum {
- MNID_JS_JUMP,
- MNID_JS_ACTION,
- MNID_JS_MENU,
- MNID_JS_PAUSE
- };
- SDLKey reversemap_key(Control c);
- int reversemap_joybutton(Control c);
- void reset_joybutton(int button, Control c);
- void reset_key(SDLKey key, Control c);
-
- int wait_for_key;
- int wait_for_joybutton;
-
- class KeyboardMenu;
- class JoystickMenu;
-
- KeyboardMenu* key_options_menu;
- JoystickMenu* joystick_options_menu;
- friend class KeyboardMenu;
- friend class JoystickMenu;
-
- char last_keys[20];
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __JOYSTICKKEYBOARDCONTROLLER_H__
+#define __JOYSTICKKEYBOARDCONTROLLER_H__
+
+#include "controller.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include <SDL.h>
+#include <string>
+#include <map>
+
+class Menu;
+
+class JoystickKeyboardController : public Controller
+{
+public:
+ JoystickKeyboardController();
+ virtual ~JoystickKeyboardController();
+
+ /** Process an SDL Event and return true if the event has been used
+ */
+ void process_event(const SDL_Event& event);
+
+ void write(lisp::Writer& writer);
+ void read(const lisp::Lisp& lisp);
+ bool check_cheatcode(const std::string& cheatcode);
+ void reset();
+
+ Menu* get_key_options_menu();
+ Menu* get_joystick_options_menu();
+
+private:
+ void process_menu_key_event(const SDL_Event& event);
+
+ typedef std::map<SDLKey, Control> KeyMap;
+ KeyMap keymap;
+
+ std::vector<SDL_Joystick*> joysticks;
+
+ typedef std::map<int, Control> ButtonMap;
+ ButtonMap joy_button_map;
+ std::string name;
+ bool use_hat;
+ int joyaxis_x;
+ int joyaxis_y;
+ int dead_zone_x;
+ int dead_zone_y;
+ /// the number of buttons all joysticks have
+ int min_joybuttons;
+ /// the max number of buttons a joystick has
+ int max_joybuttons;
+
+ enum {
+ MNID_KEY_UP,
+ MNID_KEY_DOWN,
+ MNID_KEY_LEFT,
+ MNID_KEY_RIGHT,
+ MNID_KEY_JUMP,
+ MNID_KEY_ACTION
+ };
+ enum {
+ MNID_JS_JUMP,
+ MNID_JS_ACTION,
+ MNID_JS_MENU,
+ MNID_JS_PAUSE
+ };
+ SDLKey reversemap_key(Control c);
+ int reversemap_joybutton(Control c);
+ void reset_joybutton(int button, Control c);
+ void reset_key(SDLKey key, Control c);
+
+ int wait_for_key;
+ int wait_for_joybutton;
+
+ class KeyboardMenu;
+ class JoystickMenu;
+
+ KeyboardMenu* key_options_menu;
+ JoystickMenu* joystick_options_menu;
+ friend class KeyboardMenu;
+ friend class JoystickMenu;
+
+ char last_keys[20];
+};
+
+#endif
+
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef SUPERTUX_DIRECTION_H
-#define SUPERTUX_DIRECTION_H
-
-enum Direction { LEFT = 0, RIGHT = 1 };
-
-#endif /*SUPERTUX_DEFINES_H*/
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef SUPERTUX_DIRECTION_H
+#define SUPERTUX_DIRECTION_H
+
+enum Direction { LEFT = 0, RIGHT = 1 };
+
+#endif /*SUPERTUX_DEFINES_H*/
+
#include <config.h>
-#include "file_system.h"
+#include "file_system.hpp"
#include <string>
+++ /dev/null
-#ifndef __FILESYSTEM_H__
-#define __FILESYSTEM_H__
-
-#include <set>
-#include <string>
-
-namespace FileSystem
-{
- std::string dirname(const std::string& filename);
- std::string basename(const std::string& filename);
-}
-
-#endif
-
--- /dev/null
+#ifndef __FILESYSTEM_H__
+#define __FILESYSTEM_H__
+
+#include <set>
+#include <string>
+
+namespace FileSystem
+{
+ std::string dirname(const std::string& filename);
+ std::string basename(const std::string& filename);
+}
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "flip_level_transformer.h"
-#include "object/tilemap.h"
-#include "object/camera.h"
-#include "badguy/badguy.h"
-#include "sector.h"
-#include "tile_manager.h"
-#include "spawn_point.h"
+#include "flip_level_transformer.hpp"
+#include "object/tilemap.hpp"
+#include "object/camera.hpp"
+#include "badguy/badguy.hpp"
+#include "sector.hpp"
+#include "tile_manager.hpp"
+#include "spawn_point.hpp"
void
FlipLevelTransformer::transform_sector(Sector* sector)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __FLIP_LEVEL_TRANSFORMER_H__
-#define __FLIP_LEVEL_TRANSFORMER_H__
-
-#include "level_transformer.h"
-
-class TileMap;
-class BadGuy;
-class SpawnPoint;
-class MovingObject;
-
-/** Vertically or horizontally flip a level */
-class FlipLevelTransformer : public LevelTransformer
-{
-public:
- virtual void transform_sector(Sector* sector);
-
-private:
- void transform_tilemap(TileMap* tilemap);
- void transform_moving_object(float height, MovingObject* object);
- void transform_badguy(float height, BadGuy* badguy);
- void transform_spawnpoint(float height, SpawnPoint* spawnpoint);
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __FLIP_LEVEL_TRANSFORMER_H__
+#define __FLIP_LEVEL_TRANSFORMER_H__
+
+#include "level_transformer.hpp"
+
+class TileMap;
+class BadGuy;
+class SpawnPoint;
+class MovingObject;
+
+/** Vertically or horizontally flip a level */
+class FlipLevelTransformer : public LevelTransformer
+{
+public:
+ virtual void transform_sector(Sector* sector);
+
+private:
+ void transform_tilemap(TileMap* tilemap);
+ void transform_moving_object(float height, MovingObject* object);
+ void transform_badguy(float height, BadGuy* badguy);
+ void transform_spawnpoint(float height, SpawnPoint* spawnpoint);
+};
+
+#endif
+
#include <config.h>
-#include "game_object.h"
-#include "object_remove_listener.h"
+#include "game_object.hpp"
+#include "object_remove_listener.hpp"
GameObject::GameObject()
: wants_to_die(false), remove_listeners(0), flags(0)
+++ /dev/null
-// $Id: game_object.h 2293 2005-03-25 20:39:56Z matzebraun $
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_GAMEOBJECT_H
-#define SUPERTUX_GAMEOBJECT_H
-
-#include <string>
-
-class DrawingContext;
-class ObjectRemoveListener;
-
-/**
- * This is a base class for all game objects. Each sector of a level will hold a
- * list of active GameObject while the game is played.
- *
- * This class is responsible for:
- * - Updating and Drawing the object. This should happen in the update() and
- * draw() functions. Both are called once per frame.
- * - Providing a safe way to remove the object by calling the remove_me
- * functions.
- * - a 32bit bitset for flags...
- */
-class GameObject
-{
-public:
- GameObject();
- virtual ~GameObject();
-
- /** This function is called once per frame and allows the object to update
- * it's state. The elapsed_time is the time since the last frame in
- * seconds and should be the base for all timed calculations (don't use
- * SDL_GetTicks directly as this will fail in pause mode)
- */
- virtual void update(float elapsed_time) = 0;
-
- /** The GameObject should draw itself onto the provided DrawingContext if this
- * function is called.
- */
- virtual void draw(DrawingContext& context) = 0;
-
- /** returns true if the object is not scheduled to be removed yet */
- bool is_valid() const
- {
- return !wants_to_die;
- }
- /** schedules this object to be removed at the end of the frame */
- void remove_me()
- {
- wants_to_die = true;
- }
- /** registers a remove listener which will be called if the object
- * gets removed/destroyed
- */
- void add_remove_listener(ObjectRemoveListener* listener)
- {
- RemoveListenerListEntry* entry = new RemoveListenerListEntry();
- entry->next = remove_listeners;
- entry->listener = listener;
-
- remove_listeners = entry;
- }
-
- // flags
- enum {
- /// the tile so you can stand on it
- FLAG_SOLID = 0x0001,
- /// can be used to temporatily disable collision detection
- FLAG_NO_COLLDET = 0x0002
- };
-
- int get_flags() const
- {
- return flags;
- }
-
-private:
- /** this flag indicates if the object should be removed at the end of the
- * frame
- */
- bool wants_to_die;
-
- struct RemoveListenerListEntry
- {
- RemoveListenerListEntry* next;
- ObjectRemoveListener* listener;
- };
- RemoveListenerListEntry* remove_listeners;
-
-protected:
- int flags;
-};
-
-#endif /*SUPERTUX_GAMEOBJECT_H*/
-
--- /dev/null
+// $Id: game_object.h 2293 2005-03-25 20:39:56Z matzebraun $
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_GAMEOBJECT_H
+#define SUPERTUX_GAMEOBJECT_H
+
+#include <string>
+
+class DrawingContext;
+class ObjectRemoveListener;
+
+/**
+ * This is a base class for all game objects. Each sector of a level will hold a
+ * list of active GameObject while the game is played.
+ *
+ * This class is responsible for:
+ * - Updating and Drawing the object. This should happen in the update() and
+ * draw() functions. Both are called once per frame.
+ * - Providing a safe way to remove the object by calling the remove_me
+ * functions.
+ * - a 32bit bitset for flags...
+ */
+class GameObject
+{
+public:
+ GameObject();
+ virtual ~GameObject();
+
+ /** This function is called once per frame and allows the object to update
+ * it's state. The elapsed_time is the time since the last frame in
+ * seconds and should be the base for all timed calculations (don't use
+ * SDL_GetTicks directly as this will fail in pause mode)
+ */
+ virtual void update(float elapsed_time) = 0;
+
+ /** The GameObject should draw itself onto the provided DrawingContext if this
+ * function is called.
+ */
+ virtual void draw(DrawingContext& context) = 0;
+
+ /** returns true if the object is not scheduled to be removed yet */
+ bool is_valid() const
+ {
+ return !wants_to_die;
+ }
+ /** schedules this object to be removed at the end of the frame */
+ void remove_me()
+ {
+ wants_to_die = true;
+ }
+ /** registers a remove listener which will be called if the object
+ * gets removed/destroyed
+ */
+ void add_remove_listener(ObjectRemoveListener* listener)
+ {
+ RemoveListenerListEntry* entry = new RemoveListenerListEntry();
+ entry->next = remove_listeners;
+ entry->listener = listener;
+
+ remove_listeners = entry;
+ }
+
+ // flags
+ enum {
+ /// the tile so you can stand on it
+ FLAG_SOLID = 0x0001,
+ /// can be used to temporatily disable collision detection
+ FLAG_NO_COLLDET = 0x0002
+ };
+
+ int get_flags() const
+ {
+ return flags;
+ }
+
+private:
+ /** this flag indicates if the object should be removed at the end of the
+ * frame
+ */
+ bool wants_to_die;
+
+ struct RemoveListenerListEntry
+ {
+ RemoveListenerListEntry* next;
+ ObjectRemoveListener* listener;
+ };
+ RemoveListenerListEntry* remove_listeners;
+
+protected:
+ int flags;
+};
+
+#endif /*SUPERTUX_GAMEOBJECT_H*/
+
#include <SDL.h>
-#include "game_session.h"
-#include "video/screen.h"
-#include "audio/sound_manager.h"
-#include "gui/menu.h"
-#include "sector.h"
-#include "level.h"
-#include "tile.h"
-#include "player_status.h"
-#include "object/particlesystem.h"
-#include "object/background.h"
-#include "object/tilemap.h"
-#include "object/camera.h"
-#include "object/player.h"
-#include "lisp/lisp.h"
-#include "lisp/parser.h"
-#include "resources.h"
-#include "worldmap.h"
-#include "misc.h"
-#include "statistics.h"
-#include "timer.h"
-#include "object/fireworks.h"
-#include "textscroller.h"
-#include "control/codecontroller.h"
-#include "control/joystickkeyboardcontroller.h"
-#include "main.h"
-#include "file_system.h"
-#include "gameconfig.h"
-#include "gettext.h"
+#include "game_session.hpp"
+#include "video/screen.hpp"
+#include "audio/sound_manager.hpp"
+#include "gui/menu.hpp"
+#include "sector.hpp"
+#include "level.hpp"
+#include "tile.hpp"
+#include "player_status.hpp"
+#include "object/particlesystem.hpp"
+#include "object/background.hpp"
+#include "object/tilemap.hpp"
+#include "object/camera.hpp"
+#include "object/player.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/parser.hpp"
+#include "resources.hpp"
+#include "worldmap.hpp"
+#include "misc.hpp"
+#include "statistics.hpp"
+#include "timer.hpp"
+#include "object/fireworks.hpp"
+#include "textscroller.hpp"
+#include "control/codecontroller.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
+#include "main.hpp"
+#include "file_system.hpp"
+#include "gameconfig.hpp"
+#include "gettext.hpp"
// the engine will be run with a logical framerate of 64fps.
// We chose 64fps here because it is a power of 2, so 1/64 gives an "even"
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Bill Kendrick <bill@newbreedsoftware.com>
-// Tobias Glaesser <tobi.web@gmx.de>
-// Ingo Ruhnke <grumbel@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_GAMELOOP_H
-#define SUPERTUX_GAMELOOP_H
-
-#include <string>
-#include <SDL.h>
-#include "timer.h"
-#include "statistics.h"
-#include "math/vector.h"
-
-/* GameLoop modes */
-enum GameSessionMode {
- ST_GL_PLAY,
- ST_GL_TEST,
- ST_GL_LOAD_GAME,
- ST_GL_LOAD_LEVEL_FILE,
- ST_GL_DEMO_GAME
-};
-
-enum GameMenuIDs {
- MNID_CONTINUE,
- MNID_ABORTLEVEL
-};
-
-extern int game_started;
-
-class Level;
-class Sector;
-class Statistics;
-class DrawingContext;
-class CodeController;
-
-/** The GameSession class controlls the controll flow of a World, ie.
- present the menu on specifc keypresses, render and update it while
- keeping the speed and framerate sane, etc. */
-class GameSession
-{
-public:
- enum ExitStatus { ES_NONE, ES_LEVEL_FINISHED, ES_GAME_OVER, ES_LEVEL_ABORT };
-
-public:
- DrawingContext* context;
-
- GameSession(const std::string& levelfile, GameSessionMode mode,
- Statistics* statistics=0);
- ~GameSession();
-
- /** Enter the busy loop */
- ExitStatus run();
-
- void record_demo(const std::string& filename);
- void play_demo(const std::string& filename);
- void draw();
- void update(float frame_ratio);
-
- void set_current()
- { current_ = this; }
- static GameSession* current() { return current_; }
-
- /// ends the current level
- void finish(bool win = true);
- void respawn(const std::string& sectorname,
- const std::string& spawnpointname);
- void set_reset_point(const std::string& sectorname,
- const Vector& pos);
- void display_info_box(const std::string& text);
- Sector* get_current_sector()
- { return currentsector; }
-
- Level* get_current_level()
- { return level; }
-
- void start_sequence(const std::string& sequencename);
- /// called by JoystickKeyboardController after an ascii key has been pressed
- void try_cheats();
-
- /** returns the "working directory" usually this is the directory where the
- * currently played level resides. This is used when locating additional
- * resources for the current level/world
- */
- std::string get_working_directory();
-
-private:
- void restart_level();
-
- void check_end_conditions();
- void process_events();
- void capture_demo_step();
-
- void levelintro();
- void drawstatus(DrawingContext& context);
- void drawendscreen();
- void drawresultscreen();
- void draw_pause();
-
- void on_escape_press();
- void process_menu();
-
- Timer endsequence_timer;
- Level* level;
- Sector* currentsector;
-
- GameSessionMode mode;
- int levelnb;
- float fps_fps;
- int pause_menu_frame;
-
- /** If true the end_sequence will be played, user input will be
- ignored while doing that */
- enum EndSequenceState {
- NO_ENDSEQUENCE,
- ENDSEQUENCE_RUNNING, // tux is running right
- ENDSEQUENCE_WAITING // waiting for the end of the music
- };
- EndSequenceState end_sequence;
- float last_x_pos;
- CodeController* end_sequence_controller;
-
- bool game_pause;
- bool music_playing;
-
- std::string levelfile;
-
- // reset point (the point where tux respawns if he dies)
- std::string reset_sector;
- Vector reset_pos;
-
- // the sector and spawnpoint we should spawn after this frame
- std::string newsector;
- std::string newspawnpoint;
-
- static GameSession* current_;
-
- Statistics* best_level_statistics;
- ExitStatus exit_status;
-
- std::ostream* capture_demo_stream;
- std::string capture_file;
- std::istream* playback_demo_stream;
- CodeController* demo_controller;
-};
-
-std::string slotinfo(int slot);
-
-/** Return true if the gameloop() was entered, false otherwise */
-bool process_load_game_menu();
-
-#endif /*SUPERTUX_GAMELOOP_H*/
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Bill Kendrick <bill@newbreedsoftware.com>
+// Tobias Glaesser <tobi.web@gmx.de>
+// Ingo Ruhnke <grumbel@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_GAMELOOP_H
+#define SUPERTUX_GAMELOOP_H
+
+#include <string>
+#include <SDL.h>
+#include "timer.hpp"
+#include "statistics.hpp"
+#include "math/vector.hpp"
+
+/* GameLoop modes */
+enum GameSessionMode {
+ ST_GL_PLAY,
+ ST_GL_TEST,
+ ST_GL_LOAD_GAME,
+ ST_GL_LOAD_LEVEL_FILE,
+ ST_GL_DEMO_GAME
+};
+
+enum GameMenuIDs {
+ MNID_CONTINUE,
+ MNID_ABORTLEVEL
+};
+
+extern int game_started;
+
+class Level;
+class Sector;
+class Statistics;
+class DrawingContext;
+class CodeController;
+
+/** The GameSession class controlls the controll flow of a World, ie.
+ present the menu on specifc keypresses, render and update it while
+ keeping the speed and framerate sane, etc. */
+class GameSession
+{
+public:
+ enum ExitStatus { ES_NONE, ES_LEVEL_FINISHED, ES_GAME_OVER, ES_LEVEL_ABORT };
+
+public:
+ DrawingContext* context;
+
+ GameSession(const std::string& levelfile, GameSessionMode mode,
+ Statistics* statistics=0);
+ ~GameSession();
+
+ /** Enter the busy loop */
+ ExitStatus run();
+
+ void record_demo(const std::string& filename);
+ void play_demo(const std::string& filename);
+ void draw();
+ void update(float frame_ratio);
+
+ void set_current()
+ { current_ = this; }
+ static GameSession* current() { return current_; }
+
+ /// ends the current level
+ void finish(bool win = true);
+ void respawn(const std::string& sectorname,
+ const std::string& spawnpointname);
+ void set_reset_point(const std::string& sectorname,
+ const Vector& pos);
+ void display_info_box(const std::string& text);
+ Sector* get_current_sector()
+ { return currentsector; }
+
+ Level* get_current_level()
+ { return level; }
+
+ void start_sequence(const std::string& sequencename);
+ /// called by JoystickKeyboardController after an ascii key has been pressed
+ void try_cheats();
+
+ /** returns the "working directory" usually this is the directory where the
+ * currently played level resides. This is used when locating additional
+ * resources for the current level/world
+ */
+ std::string get_working_directory();
+
+private:
+ void restart_level();
+
+ void check_end_conditions();
+ void process_events();
+ void capture_demo_step();
+
+ void levelintro();
+ void drawstatus(DrawingContext& context);
+ void drawendscreen();
+ void drawresultscreen();
+ void draw_pause();
+
+ void on_escape_press();
+ void process_menu();
+
+ Timer endsequence_timer;
+ Level* level;
+ Sector* currentsector;
+
+ GameSessionMode mode;
+ int levelnb;
+ float fps_fps;
+ int pause_menu_frame;
+
+ /** If true the end_sequence will be played, user input will be
+ ignored while doing that */
+ enum EndSequenceState {
+ NO_ENDSEQUENCE,
+ ENDSEQUENCE_RUNNING, // tux is running right
+ ENDSEQUENCE_WAITING // waiting for the end of the music
+ };
+ EndSequenceState end_sequence;
+ float last_x_pos;
+ CodeController* end_sequence_controller;
+
+ bool game_pause;
+ bool music_playing;
+
+ std::string levelfile;
+
+ // reset point (the point where tux respawns if he dies)
+ std::string reset_sector;
+ Vector reset_pos;
+
+ // the sector and spawnpoint we should spawn after this frame
+ std::string newsector;
+ std::string newspawnpoint;
+
+ static GameSession* current_;
+
+ Statistics* best_level_statistics;
+ ExitStatus exit_status;
+
+ std::ostream* capture_demo_stream;
+ std::string capture_file;
+ std::istream* playback_demo_stream;
+ CodeController* demo_controller;
+};
+
+std::string slotinfo(int slot);
+
+/** Return true if the gameloop() was entered, false otherwise */
+bool process_load_game_menu();
+
+#endif /*SUPERTUX_GAMELOOP_H*/
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "gameconfig.h"
+#include "gameconfig.hpp"
#include <cstdlib>
#include <string>
#include <sstream>
#include <fstream>
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "control/joystickkeyboardcontroller.h"
-#include "resources.h"
-#include "main.h"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
+#include "resources.hpp"
+#include "main.hpp"
Config* config = 0;
+++ /dev/null
-// $Id: configfile.h 2293 2005-03-25 20:39:56Z matzebraun $
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Michael George <mike@georgetech.com>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_CONFIG_H
-#define SUPERTUX_CONFIG_H
-
-#include <string>
-
-class Config {
-public:
- Config();
- ~Config();
-
- void load();
- void save();
-
- /** screen width in pixel (warning: this is the real screen width+height,
- * supertux is using a logical width+height and not this one)
- */
- int screenwidth;
- int screenheight;
- bool use_gl;
-
- bool use_fullscreen;
- bool show_fps;
- bool sound_enabled;
- bool music_enabled;
- bool cheats_enabled;
-
- /** this variable is set if supertux should start in a specific level */
- std::string start_level;
- std::string start_demo;
- std::string record_demo;
-};
-
-extern Config* config;
-
-#endif
--- /dev/null
+// $Id: configfile.h 2293 2005-03-25 20:39:56Z matzebraun $
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Michael George <mike@georgetech.com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_CONFIG_H
+#define SUPERTUX_CONFIG_H
+
+#include <string>
+
+class Config {
+public:
+ Config();
+ ~Config();
+
+ void load();
+ void save();
+
+ /** screen width in pixel (warning: this is the real screen width+height,
+ * supertux is using a logical width+height and not this one)
+ */
+ int screenwidth;
+ int screenheight;
+ bool use_gl;
+
+ bool use_fullscreen;
+ bool show_fps;
+ bool sound_enabled;
+ bool music_enabled;
+ bool cheats_enabled;
+
+ /** this variable is set if supertux should start in a specific level */
+ std::string start_level;
+ std::string start_demo;
+ std::string record_demo;
+};
+
+extern Config* config;
+
+#endif
+++ /dev/null
-/*
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published
- by the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA. */
-#ifndef _LIBGETTEXT_H
-#define _LIBGETTEXT_H
-
-#include "tinygettext/tinygettext.h"
-
-extern TinyGetText::DictionaryManager dictionary_manager;
-
-static inline const char* _(const char* message)
-{
- return dictionary_manager.get_dictionary().translate(message);
-}
-
-static inline std::string _(const std::string& message)
-{
- return dictionary_manager.get_dictionary().translate(message);
-}
-
-static inline const char* N_(const char* id, const char* id2, int num)
-{
- return dictionary_manager.get_dictionary().translate(id, id2, num).c_str();
-}
-
-#endif /* _LIBGETTEXT_H */
--- /dev/null
+/*
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published
+ by the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
+#ifndef _LIBGETTEXT_H
+#define _LIBGETTEXT_H
+
+#include "tinygettext/tinygettext.hpp"
+
+extern TinyGetText::DictionaryManager dictionary_manager;
+
+static inline const char* _(const char* message)
+{
+ return dictionary_manager.get_dictionary().translate(message);
+}
+
+static inline std::string _(const std::string& message)
+{
+ return dictionary_manager.get_dictionary().translate(message);
+}
+
+static inline const char* N_(const char* id, const char* id2, int num)
+{
+ return dictionary_manager.get_dictionary().translate(id, id2, num).c_str();
+}
+
+#endif /* _LIBGETTEXT_H */
// 02111-1307, USA.
#include <config.h>
-#include "SDL.h"
+#include <SDL.h>
#include <iostream>
-#include "main.h"
-#include "button.h"
-#include "mousecursor.h"
-#include "video/font.h"
-#include "video/surface.h"
+#include "main.hpp"
+#include "button.hpp"
+#include "mousecursor.hpp"
+#include "video/font.hpp"
+#include "video/surface.hpp"
Font* Button::info_font = 0;
extern SDL_Surface* screen;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef SUPERTUX_BUTTON_H
-#define SUPERTUX_BUTTON_H
-
-#include <vector>
-#include <string>
-
-#include "math/vector.h"
-#include "video/drawing_context.h"
-
-class Surface;
-
-class ButtonGroup;
-
-enum {
- BT_NONE,
- BT_HOVER,
- BT_SELECTED,
- BT_SHOW_INFO
- };
-
-class Button
-{
-public:
- Button(Surface* image_, std::string info_, SDLKey binding_);
- ~Button();
-
- void draw(DrawingContext& context, bool selected);
- int event(SDL_Event& event, int x_offset = 0, int y_offset = 0);
-
- static Font* info_font;
-
-private:
- friend class ButtonGroup;
-
- Vector pos, size;
-
- Surface* image;
- SDLKey binding;
-
- int id;
- int state;
- std::string info;
-};
-
-class ButtonGroup
-{
-public:
- ButtonGroup(Vector pos_, Vector size_, Vector button_box_);
- ~ButtonGroup();
-
- void draw(DrawingContext& context);
- bool event(SDL_Event& event);
-
- void add_button(Button button, int id, bool select = false);
- void add_pair_of_buttons(Button button1, int id1, Button button2, int id2);
-
- int selected_id();
- void set_unselected();
- bool is_hover();
-
-private:
- Vector pos, buttons_size, buttons_box;
- typedef std::vector <Button> Buttons;
- Buttons buttons;
-
- int button_selected, row;
- bool mouse_hover, mouse_left_button;
-
- int buttons_pair_nb;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef SUPERTUX_BUTTON_H
+#define SUPERTUX_BUTTON_H
+
+#include <vector>
+#include <string>
+
+#include "math/vector.hpp"
+#include "video/drawing_context.hpp"
+
+class Surface;
+
+class ButtonGroup;
+
+enum {
+ BT_NONE,
+ BT_HOVER,
+ BT_SELECTED,
+ BT_SHOW_INFO
+ };
+
+class Button
+{
+public:
+ Button(Surface* image_, std::string info_, SDLKey binding_);
+ ~Button();
+
+ void draw(DrawingContext& context, bool selected);
+ int event(SDL_Event& event, int x_offset = 0, int y_offset = 0);
+
+ static Font* info_font;
+
+private:
+ friend class ButtonGroup;
+
+ Vector pos, size;
+
+ Surface* image;
+ SDLKey binding;
+
+ int id;
+ int state;
+ std::string info;
+};
+
+class ButtonGroup
+{
+public:
+ ButtonGroup(Vector pos_, Vector size_, Vector button_box_);
+ ~ButtonGroup();
+
+ void draw(DrawingContext& context);
+ bool event(SDL_Event& event);
+
+ void add_button(Button button, int id, bool select = false);
+ void add_pair_of_buttons(Button button1, int id1, Button button2, int id2);
+
+ int selected_id();
+ void set_unselected();
+ bool is_hover();
+
+private:
+ Vector pos, buttons_size, buttons_box;
+ typedef std::vector <Button> Buttons;
+ Buttons buttons;
+
+ int button_selected, row;
+ bool mouse_hover, mouse_left_button;
+
+ int buttons_pair_nb;
+};
+
+#endif
#include <cassert>
#include <stdexcept>
-#include "menu.h"
-#include "video/screen.h"
-#include "video/drawing_context.h"
-#include "gettext.h"
-#include "math/vector.h"
-#include "main.h"
-#include "resources.h"
-#include "control/joystickkeyboardcontroller.h"
+#include "menu.hpp"
+#include "video/screen.hpp"
+#include "video/drawing_context.hpp"
+#include "gettext.hpp"
+#include "math/vector.hpp"
+#include "main.hpp"
+#include "resources.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
static const int MENU_REPEAT_INITIAL = 400;
static const int MENU_REPEAT_RATE = 200;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_MENU_H
-#define SUPERTUX_MENU_H
-
-#include <vector>
-#include <set>
-#include <string>
-#include <utility>
-#include <assert.h>
-
-#include "SDL.h"
-
-#include "video/surface.h"
-#include "video/font.h"
-#include "mousecursor.h"
-
-bool confirm_dialog(Surface* background, std::string text);
-
-/* Kinds of menu items */
-enum MenuItemKind {
- MN_ACTION,
- MN_GOTO,
- MN_TOGGLE,
- MN_BACK,
- MN_DEACTIVE,
- MN_TEXTFIELD,
- MN_NUMFIELD,
- MN_CONTROLFIELD,
- MN_STRINGSELECT,
- MN_LABEL,
- MN_HL, /* horizontal line */
-};
-
-class Menu;
-
-class MenuItem
-{
-public:
- MenuItem(MenuItemKind kind, int id = -1);
- MenuItemKind kind;
- int id; // item id
- bool toggled;
- std::string text;
- std::string input;
-
- std::vector<std::string> list; // list of values for a STRINGSELECT item
- size_t selected; // currently selected item
-
- Menu* target_menu;
-
- void change_text (const std::string& text);
- void change_input(const std::string& text);
-
- static MenuItem* create(MenuItemKind kind, const std::string& text,
- int init_toggle, Menu* target_menu, int id, int key);
-
- std::string get_input_with_symbol(bool active_item); // returns the text with an input symbol
-
-private:
- /// copy-construction not allowed
- MenuItem(const MenuItem& ) { assert(false); }
- /// assignment not allowed
- void operator= (const MenuItem& ) { assert(false); }
-
- /// keyboard key or joystick button
- bool input_flickering;
-};
-
-class Menu
-{
-private:
- static std::vector<Menu*> last_menus;
- static Menu* current_;
-
- static void push_current(Menu* pmenu);
- static void pop_current();
-
-public:
- /** Set the current menu, if pmenu is NULL, hide the current menu */
- static void set_current(Menu* pmenu);
-
- /** Return the current active menu or NULL if none is active */
- static Menu* current()
- {
- return current_;
- }
-
-private:
- /* Action done on the menu */
- enum MenuAction {
- MENU_ACTION_NONE = -1,
- MENU_ACTION_UP,
- MENU_ACTION_DOWN,
- MENU_ACTION_LEFT,
- MENU_ACTION_RIGHT,
- MENU_ACTION_HIT,
- MENU_ACTION_INPUT,
- MENU_ACTION_REMOVE,
- MENU_ACTION_BACK
- };
-
- /** Number of the item that got 'hit' (ie. pressed) in the last
- event()/update() call, -1 if none */
- int hit_item;
-
- // position of the menu (ie. center of the menu, not top/left)
- int pos_x;
- int pos_y;
-
- /** input event for the menu (up, down, left, right, etc.) */
- MenuAction menuaction;
-
- /* input implementation variables */
- int delete_character;
- char mn_input_char;
- Uint32 menu_repeat_ticks;
-
-public:
- static Font* default_font;
- static Font* active_font;
- static Font* deactive_font;
- static Font* label_font;
- static Font* field_font;
-
- std::vector<MenuItem*> items;
-
- Menu();
- virtual ~Menu();
-
- void add_hl();
- void add_label(const std::string& text);
- void add_entry(int id, const std::string& text);
- void add_toggle(int id, const std::string& text, bool toggled = false);
- void add_deactive(int id, const std::string& text);
- void add_back(const std::string& text);
- void add_submenu(const std::string& text, Menu* submenu, int id = -1);
- void add_controlfield(int id, const std::string& text,
- const std::string& mapping = "");
-
- virtual void menu_action(MenuItem* item);
-
- void update();
-
- /** Remove all entries from the menu */
- void clear();
-
- /** Return the index of the menu item that was 'hit' (ie. the user
- clicked on it) in the last event() call */
- int check ();
-
- MenuItem& get_item(int index)
- {
- return *(items[index]);
- }
- MenuItem& get_item_by_id(int id);
- const MenuItem& get_item_by_id(int id) const;
-
- int get_active_item_id();
- void set_active_item(int id);
-
- void draw(DrawingContext& context);
- void set_pos(int x, int y, float rw = 0, float rh = 0);
-
- void event(const SDL_Event& event);
-
- bool is_toggled(int id) const;
-
-protected:
- void additem(MenuItem* pmenu_item);
- int get_width() const;
- int get_height() const;
-
-private:
- void check_controlfield_change_event(const SDL_Event& event);
- void draw_item(DrawingContext& context, int index);
- Uint32 effect_ticks;
- int arrange_left;
- int active_item;
-};
-
-extern Surface* checkbox;
-extern Surface* checkbox_checked;
-extern Surface* back;
-extern Surface* arrow_left;
-extern Surface* arrow_right;
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_MENU_H
+#define SUPERTUX_MENU_H
+
+#include <vector>
+#include <set>
+#include <string>
+#include <utility>
+#include <assert.h>
+
+#include <SDL.h>
+
+#include "video/surface.hpp"
+#include "video/font.hpp"
+#include "mousecursor.hpp"
+
+bool confirm_dialog(Surface* background, std::string text);
+
+/* Kinds of menu items */
+enum MenuItemKind {
+ MN_ACTION,
+ MN_GOTO,
+ MN_TOGGLE,
+ MN_BACK,
+ MN_DEACTIVE,
+ MN_TEXTFIELD,
+ MN_NUMFIELD,
+ MN_CONTROLFIELD,
+ MN_STRINGSELECT,
+ MN_LABEL,
+ MN_HL, /* horizontal line */
+};
+
+class Menu;
+
+class MenuItem
+{
+public:
+ MenuItem(MenuItemKind kind, int id = -1);
+ MenuItemKind kind;
+ int id; // item id
+ bool toggled;
+ std::string text;
+ std::string input;
+
+ std::vector<std::string> list; // list of values for a STRINGSELECT item
+ size_t selected; // currently selected item
+
+ Menu* target_menu;
+
+ void change_text (const std::string& text);
+ void change_input(const std::string& text);
+
+ static MenuItem* create(MenuItemKind kind, const std::string& text,
+ int init_toggle, Menu* target_menu, int id, int key);
+
+ std::string get_input_with_symbol(bool active_item); // returns the text with an input symbol
+
+private:
+ /// copy-construction not allowed
+ MenuItem(const MenuItem& ) { assert(false); }
+ /// assignment not allowed
+ void operator= (const MenuItem& ) { assert(false); }
+
+ /// keyboard key or joystick button
+ bool input_flickering;
+};
+
+class Menu
+{
+private:
+ static std::vector<Menu*> last_menus;
+ static Menu* current_;
+
+ static void push_current(Menu* pmenu);
+ static void pop_current();
+
+public:
+ /** Set the current menu, if pmenu is NULL, hide the current menu */
+ static void set_current(Menu* pmenu);
+
+ /** Return the current active menu or NULL if none is active */
+ static Menu* current()
+ {
+ return current_;
+ }
+
+private:
+ /* Action done on the menu */
+ enum MenuAction {
+ MENU_ACTION_NONE = -1,
+ MENU_ACTION_UP,
+ MENU_ACTION_DOWN,
+ MENU_ACTION_LEFT,
+ MENU_ACTION_RIGHT,
+ MENU_ACTION_HIT,
+ MENU_ACTION_INPUT,
+ MENU_ACTION_REMOVE,
+ MENU_ACTION_BACK
+ };
+
+ /** Number of the item that got 'hit' (ie. pressed) in the last
+ event()/update() call, -1 if none */
+ int hit_item;
+
+ // position of the menu (ie. center of the menu, not top/left)
+ int pos_x;
+ int pos_y;
+
+ /** input event for the menu (up, down, left, right, etc.) */
+ MenuAction menuaction;
+
+ /* input implementation variables */
+ int delete_character;
+ char mn_input_char;
+ Uint32 menu_repeat_ticks;
+
+public:
+ static Font* default_font;
+ static Font* active_font;
+ static Font* deactive_font;
+ static Font* label_font;
+ static Font* field_font;
+
+ std::vector<MenuItem*> items;
+
+ Menu();
+ virtual ~Menu();
+
+ void add_hl();
+ void add_label(const std::string& text);
+ void add_entry(int id, const std::string& text);
+ void add_toggle(int id, const std::string& text, bool toggled = false);
+ void add_deactive(int id, const std::string& text);
+ void add_back(const std::string& text);
+ void add_submenu(const std::string& text, Menu* submenu, int id = -1);
+ void add_controlfield(int id, const std::string& text,
+ const std::string& mapping = "");
+
+ virtual void menu_action(MenuItem* item);
+
+ void update();
+
+ /** Remove all entries from the menu */
+ void clear();
+
+ /** Return the index of the menu item that was 'hit' (ie. the user
+ clicked on it) in the last event() call */
+ int check ();
+
+ MenuItem& get_item(int index)
+ {
+ return *(items[index]);
+ }
+ MenuItem& get_item_by_id(int id);
+ const MenuItem& get_item_by_id(int id) const;
+
+ int get_active_item_id();
+ void set_active_item(int id);
+
+ void draw(DrawingContext& context);
+ void set_pos(int x, int y, float rw = 0, float rh = 0);
+
+ void event(const SDL_Event& event);
+
+ bool is_toggled(int id) const;
+
+protected:
+ void additem(MenuItem* pmenu_item);
+ int get_width() const;
+ int get_height() const;
+
+private:
+ void check_controlfield_change_event(const SDL_Event& event);
+ void draw_item(DrawingContext& context, int index);
+ Uint32 effect_ticks;
+ int arrange_left;
+ int active_item;
+};
+
+extern Surface* checkbox;
+extern Surface* checkbox_checked;
+extern Surface* back;
+extern Surface* arrow_left;
+extern Surface* arrow_right;
+
+#endif
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "video/drawing_context.h"
-#include "gui/mousecursor.h"
-#include "main.h"
+#include "video/drawing_context.hpp"
+#include "gui/mousecursor.hpp"
+#include "main.hpp"
MouseCursor* MouseCursor::current_ = 0;
extern SDL_Surface* screen;
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_MOUSECURSOR_H
-#define SUPERTUX_MOUSECURSOR_H
-
-#include <string>
-
-#include "video/surface.h"
-
-#define MC_STATES_NB 3
-
-enum {
- MC_NORMAL = 0,
- MC_CLICK,
- MC_LINK,
- MC_HIDE
-};
-
-/// Mouse cursor.
-/** Used to create mouse cursors.
- The mouse cursors can be animated
- and can be used in four different states.
- (MC_NORMAL, MC_CLICK, MC_LINK or MC_HIDE) */
-class MouseCursor
-{
-public:
- /// Constructor of MouseCursor.
- /** Expects an imagefile for the cursor and the number of animation frames it contains. */
- MouseCursor(std::string cursor_file);
- ~MouseCursor();
- /// Get MouseCursor state.
- /** (MC_NORMAL, MC_CLICK, MC_LINK or MC_HIDE) */
- int state();
- /// Set MouseCursor state.
- /** (MC_NORMAL, MC_CLICK, MC_LINK or MC_HIDE) */
- void set_state(int nstate);
- /// Define the middle of a MouseCursor.
- /** Useful for cross mouse cursor images in example. */
- void set_mid(int x, int y);
-
- /// Draw MouseCursor on screen.
- void draw(DrawingContext& context);
-
- /// Return the current cursor.
- static MouseCursor* current()
- { return current_; };
- /// Set current cursor.
- static void set_current(MouseCursor* pcursor)
- { current_ = pcursor; };
-
-private:
- int mid_x, mid_y;
- static MouseCursor* current_;
- int state_before_click;
- int cur_state;
- Surface* cursor;
-};
-
-#endif /*SUPERTUX_MOUSECURSOR_H*/
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_MOUSECURSOR_H
+#define SUPERTUX_MOUSECURSOR_H
+
+#include <string>
+
+#include "video/surface.hpp"
+
+#define MC_STATES_NB 3
+
+enum {
+ MC_NORMAL = 0,
+ MC_CLICK,
+ MC_LINK,
+ MC_HIDE
+};
+
+/// Mouse cursor.
+/** Used to create mouse cursors.
+ The mouse cursors can be animated
+ and can be used in four different states.
+ (MC_NORMAL, MC_CLICK, MC_LINK or MC_HIDE) */
+class MouseCursor
+{
+public:
+ /// Constructor of MouseCursor.
+ /** Expects an imagefile for the cursor and the number of animation frames it contains. */
+ MouseCursor(std::string cursor_file);
+ ~MouseCursor();
+ /// Get MouseCursor state.
+ /** (MC_NORMAL, MC_CLICK, MC_LINK or MC_HIDE) */
+ int state();
+ /// Set MouseCursor state.
+ /** (MC_NORMAL, MC_CLICK, MC_LINK or MC_HIDE) */
+ void set_state(int nstate);
+ /// Define the middle of a MouseCursor.
+ /** Useful for cross mouse cursor images in example. */
+ void set_mid(int x, int y);
+
+ /// Draw MouseCursor on screen.
+ void draw(DrawingContext& context);
+
+ /// Return the current cursor.
+ static MouseCursor* current()
+ { return current_; };
+ /// Set current cursor.
+ static void set_current(MouseCursor* pcursor)
+ { current_ = pcursor; };
+
+private:
+ int mid_x, mid_y;
+ static MouseCursor* current_;
+ int state_before_click;
+ int cur_state;
+ Surface* cursor;
+};
+
+#endif /*SUPERTUX_MOUSECURSOR_H*/
#include <memory>
#include <stdexcept>
-#include "video/screen.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/list_iterator.h"
-#include "lisp/writer.h"
-#include "level.h"
-#include "physic.h"
-#include "sector.h"
-#include "tile.h"
-#include "resources.h"
-#include "file_system.h"
-#include "object/gameobjs.h"
-#include "object/camera.h"
-#include "object/tilemap.h"
-#include "object/coin.h"
+#include "video/screen.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/list_iterator.hpp"
+#include "lisp/writer.hpp"
+#include "level.hpp"
+#include "physic.hpp"
+#include "sector.hpp"
+#include "tile.hpp"
+#include "resources.hpp"
+#include "file_system.hpp"
+#include "object/gameobjs.hpp"
+#include "object/camera.hpp"
+#include "object/tilemap.hpp"
+#include "object/coin.hpp"
// test
-#include "flip_level_transformer.h"
+#include "flip_level_transformer.hpp"
using namespace std;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef SUPERTUX_LEVEL_H
-#define SUPERTUX_LEVEL_H
-
-#include <vector>
-#include <string>
-
-class Sector;
-
-namespace lisp {
-class Lisp;
-}
-
-class Level
-{
-public:
- std::string name;
- std::string author;
- typedef std::vector<Sector*> Sectors;
- Sectors sectors;
-
-public:
- Level();
- ~Level();
-
- // loads a levelfile
- void load(const std::string& filename);
- void save(const std::string& filename);
-
- const std::string& get_name() const
- { return name; }
-
- const std::string& get_author() const
- { return author; }
-
- void add_sector(Sector* sector);
-
- Sector* get_sector(const std::string& name);
-
- size_t get_sector_count();
- Sector* get_sector(size_t num);
-
- int get_total_badguys();
- int get_total_coins();
-
-private:
- void load_old_format(const lisp::Lisp& reader);
-};
-
-#endif /*SUPERTUX_LEVEL_H*/
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef SUPERTUX_LEVEL_H
+#define SUPERTUX_LEVEL_H
+
+#include <vector>
+#include <string>
+
+class Sector;
+
+namespace lisp {
+class Lisp;
+}
+
+class Level
+{
+public:
+ std::string name;
+ std::string author;
+ typedef std::vector<Sector*> Sectors;
+ Sectors sectors;
+
+public:
+ Level();
+ ~Level();
+
+ // loads a levelfile
+ void load(const std::string& filename);
+ void save(const std::string& filename);
+
+ const std::string& get_name() const
+ { return name; }
+
+ const std::string& get_author() const
+ { return author; }
+
+ void add_sector(Sector* sector);
+
+ Sector* get_sector(const std::string& name);
+
+ size_t get_sector_count();
+ Sector* get_sector(size_t num);
+
+ int get_total_badguys();
+ int get_total_coins();
+
+private:
+ void load_old_format(const lisp::Lisp& reader);
+};
+
+#endif /*SUPERTUX_LEVEL_H*/
#include <assert.h>
#include <unistd.h>
#include <physfs.h>
-#include "level.h"
-#include "resources.h"
-#include "file_system.h"
-#include "video/surface.h"
-#include "level_subset.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
+#include "level.hpp"
+#include "resources.hpp"
+#include "file_system.hpp"
+#include "video/surface.hpp"
+#include "level_subset.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
static bool has_suffix(const std::string& data, const std::string& suffix)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef SUPERTUX_LEVEL_SUBSET_H
-#define SUPERTUX_LEVEL_SUBSET_H
-
-#include <vector>
-#include <string>
-
-/** This type holds meta-information about a level-subset.
- It could be extended to handle manipulation of subsets. */
-class LevelSubset
-{
-private:
- /** Level filenames without the leading path ("level1.stl",
- "level3.stl", ...) */
- std::vector<std::string> levels;
-
-public:
- LevelSubset();
- ~LevelSubset();
-
- static void create(const std::string& subset_name);
- void load(const std::string& filename);
- void save();
-
- void add_level(const std::string& name);
-
- std::string get_level_filename(unsigned int i);
- std::string get_worldmap_filename();
- int get_num_levels() const;
-
- std::string name;
- std::string title;
- std::string description;
- bool hide_from_contribs;
- bool has_worldmap;
-
-private:
- void read_info_file(const std::string& info_file);
-};
-
-#endif
-
-/* Local Variables: */
-/* mode:c++ */
-/* End: */
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 SuperTux Development Team, see AUTHORS for details
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef SUPERTUX_LEVEL_SUBSET_H
+#define SUPERTUX_LEVEL_SUBSET_H
+
+#include <vector>
+#include <string>
+
+/** This type holds meta-information about a level-subset.
+ It could be extended to handle manipulation of subsets. */
+class LevelSubset
+{
+private:
+ /** Level filenames without the leading path ("level1.stl",
+ "level3.stl", ...) */
+ std::vector<std::string> levels;
+
+public:
+ LevelSubset();
+ ~LevelSubset();
+
+ static void create(const std::string& subset_name);
+ void load(const std::string& filename);
+ void save();
+
+ void add_level(const std::string& name);
+
+ std::string get_level_filename(unsigned int i);
+ std::string get_worldmap_filename();
+ int get_num_levels() const;
+
+ std::string name;
+ std::string title;
+ std::string description;
+ bool hide_from_contribs;
+ bool has_worldmap;
+
+private:
+ void read_info_file(const std::string& info_file);
+};
+
+#endif
+
+/* Local Variables: */
+/* mode:c++ */
+/* End: */
#include <config.h>
-#include "level_transformer.h"
-#include "level.h"
+#include "level_transformer.hpp"
+#include "level.hpp"
LevelTransformer::~LevelTransformer()
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __LEVEL_TRANSFORMER_H__
-#define __LEVEL_TRANSFORMER_H__
-
-class Level;
-class Sector;
-
-/**
- * This class is an abstract interface for algorithms that transform levels in
- * some way before they are played.
- */
-class LevelTransformer
-{
-public:
- virtual ~LevelTransformer();
-
- /** transform a complete Level, the standard implementation just calls
- * transformSector on each sector in the level.
- */
- virtual void transform(Level* level);
-
- virtual void transform_sector(Sector* sector) = 0;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __LEVEL_TRANSFORMER_H__
+#define __LEVEL_TRANSFORMER_H__
+
+class Level;
+class Sector;
+
+/**
+ * This class is an abstract interface for algorithms that transform levels in
+ * some way before they are played.
+ */
+class LevelTransformer
+{
+public:
+ virtual ~LevelTransformer();
+
+ /** transform a complete Level, the standard implementation just calls
+ * transformSector on each sector in the level.
+ */
+ virtual void transform(Level* level);
+
+ virtual void transform_sector(Sector* sector) = 0;
+};
+
+#endif
+
#include <stdexcept>
#include <iostream>
-#include "lexer.h"
+#include "lexer.hpp"
namespace lisp
{
+++ /dev/null
-// $Id$
-//
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
-// code in this file based on lispreader from Mark Probst
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef __LISPLEXER_H__
-#define __LISPLEXER_H__
-
-namespace lisp
-{
-
-class Lexer
-{
-public:
- enum TokenType {
- TOKEN_EOF,
- TOKEN_OPEN_PAREN,
- TOKEN_CLOSE_PAREN,
- TOKEN_SYMBOL,
- TOKEN_STRING,
- TOKEN_INTEGER,
- TOKEN_REAL,
- TOKEN_TRUE,
- TOKEN_FALSE
- };
-
- Lexer(std::istream& stream);
- ~Lexer();
-
- TokenType getNextToken();
- const char* getString() const
- { return token_string; }
- int getLineNumber() const
- { return linenumber; }
-
-private:
- enum {
- MAX_TOKEN_LENGTH = 16384,
- BUFFER_SIZE = 1024
- };
-
- inline void nextChar();
-
- std::istream& stream;
- bool eof;
- int linenumber;
- char buffer[BUFFER_SIZE+1];
- char* bufend;
- char* c;
- char token_string[MAX_TOKEN_LENGTH + 1];
- int token_length;
-};
-
-} // end of namespace lisp
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
+// code in this file based on lispreader from Mark Probst
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef __LISPLEXER_H__
+#define __LISPLEXER_H__
+
+namespace lisp
+{
+
+class Lexer
+{
+public:
+ enum TokenType {
+ TOKEN_EOF,
+ TOKEN_OPEN_PAREN,
+ TOKEN_CLOSE_PAREN,
+ TOKEN_SYMBOL,
+ TOKEN_STRING,
+ TOKEN_INTEGER,
+ TOKEN_REAL,
+ TOKEN_TRUE,
+ TOKEN_FALSE
+ };
+
+ Lexer(std::istream& stream);
+ ~Lexer();
+
+ TokenType getNextToken();
+ const char* getString() const
+ { return token_string; }
+ int getLineNumber() const
+ { return linenumber; }
+
+private:
+ enum {
+ MAX_TOKEN_LENGTH = 16384,
+ BUFFER_SIZE = 1024
+ };
+
+ inline void nextChar();
+
+ std::istream& stream;
+ bool eof;
+ int linenumber;
+ char buffer[BUFFER_SIZE+1];
+ char* bufend;
+ char* c;
+ char token_string[MAX_TOKEN_LENGTH + 1];
+ int token_length;
+};
+
+} // end of namespace lisp
+
+#endif
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "lisp.h"
+#include "lisp.hpp"
namespace lisp
{
+++ /dev/null
-// $Id$
-//
-// TuxKart - a fun racing game with go-kart
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
-// code in this file based on lispreader from Mark Probst
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef __LISPREADER_H__
-#define __LISPREADER_H__
-
-#include <string>
-#include <vector>
-
-namespace lisp
-{
-
-class Lisp
-{
-public:
- ~Lisp();
-
- enum LispType {
- TYPE_CONS,
- TYPE_SYMBOL,
- TYPE_INTEGER,
- TYPE_STRING,
- TYPE_REAL,
- TYPE_BOOLEAN
- };
-
- LispType get_type() const
- { return type; }
-
- Lisp* get_car() const
- { return v.cons.car; }
- Lisp* get_cdr() const
- { return v.cons.cdr; }
- bool get(std::string& val) const
- {
- if(type != TYPE_STRING && type != TYPE_SYMBOL)
- return false;
- val = v.string;
- return true;
- }
- bool get(unsigned int& val) const
- {
- if(type != TYPE_INTEGER)
- return false;
- val = v.integer;
- return true;
- }
- bool get(int& val) const
- {
- if(type != TYPE_INTEGER)
- return false;
- val = v.integer;
- return true;
- }
- bool get(float& val) const
- {
- if(type != TYPE_REAL) {
- if(type == TYPE_INTEGER) {
- val = v.integer;
- return true;
- }
- return false;
- }
- val = v.real;
- return true;
- }
- bool get(bool& val) const
- {
- if(type != TYPE_BOOLEAN)
- return false;
- val = v.boolean;
- return true;
- }
-
- /** conveniance functions which traverse the list until a child with a
- * specified name is found. The value part is then interpreted in a specific
- * way. The functions return true, if a child was found and could be
- * interpreted correctly, otherwise false is returned and the variable value
- * is not changed.
- * (Please note that searching the lisp structure is O(n) so these functions
- * are no good idea for performance critical areas)
- */
- template<class T>
- bool get(const char* name, T& val) const
- {
- const Lisp* lisp = get_lisp(name);
- if(!lisp)
- return false;
-
- if(lisp->get_type() != TYPE_CONS)
- return false;
- lisp = lisp->get_car();
- if(!lisp)
- return false;
- return lisp->get(val);
- }
-
- template<class T>
- bool get_vector(const char* name, std::vector<T>& vec) const
- {
- vec.clear();
-
- const Lisp* child = get_lisp(name);
- if(!child)
- return false;
-
- for( ; child != 0; child = child->get_cdr()) {
- T val;
- if(!child->get_car())
- continue;
- if(child->get_car()->get(val)) {
- vec.push_back(val);
- }
- }
-
- return true;
- }
-
- Lisp* get_lisp(const char* name) const;
- Lisp* get_lisp(const std::string& name) const
- { return get_lisp(name.c_str()); }
-
- // for debugging
- void print(int indent = 0) const;
-
-private:
- friend class Parser;
- Lisp(LispType newtype);
-
- LispType type;
- union
- {
- struct
- {
- Lisp* car;
- Lisp* cdr;
- } cons;
-
- char* string;
- int integer;
- bool boolean;
- float real;
- } v;
-};
-
-} // end of namespace lisp
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// TuxKart - a fun racing game with go-kart
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
+// code in this file based on lispreader from Mark Probst
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef __LISPREADER_H__
+#define __LISPREADER_H__
+
+#include <string>
+#include <vector>
+
+namespace lisp
+{
+
+class Lisp
+{
+public:
+ ~Lisp();
+
+ enum LispType {
+ TYPE_CONS,
+ TYPE_SYMBOL,
+ TYPE_INTEGER,
+ TYPE_STRING,
+ TYPE_REAL,
+ TYPE_BOOLEAN
+ };
+
+ LispType get_type() const
+ { return type; }
+
+ Lisp* get_car() const
+ { return v.cons.car; }
+ Lisp* get_cdr() const
+ { return v.cons.cdr; }
+ bool get(std::string& val) const
+ {
+ if(type != TYPE_STRING && type != TYPE_SYMBOL)
+ return false;
+ val = v.string;
+ return true;
+ }
+ bool get(unsigned int& val) const
+ {
+ if(type != TYPE_INTEGER)
+ return false;
+ val = v.integer;
+ return true;
+ }
+ bool get(int& val) const
+ {
+ if(type != TYPE_INTEGER)
+ return false;
+ val = v.integer;
+ return true;
+ }
+ bool get(float& val) const
+ {
+ if(type != TYPE_REAL) {
+ if(type == TYPE_INTEGER) {
+ val = v.integer;
+ return true;
+ }
+ return false;
+ }
+ val = v.real;
+ return true;
+ }
+ bool get(bool& val) const
+ {
+ if(type != TYPE_BOOLEAN)
+ return false;
+ val = v.boolean;
+ return true;
+ }
+
+ /** conveniance functions which traverse the list until a child with a
+ * specified name is found. The value part is then interpreted in a specific
+ * way. The functions return true, if a child was found and could be
+ * interpreted correctly, otherwise false is returned and the variable value
+ * is not changed.
+ * (Please note that searching the lisp structure is O(n) so these functions
+ * are no good idea for performance critical areas)
+ */
+ template<class T>
+ bool get(const char* name, T& val) const
+ {
+ const Lisp* lisp = get_lisp(name);
+ if(!lisp)
+ return false;
+
+ if(lisp->get_type() != TYPE_CONS)
+ return false;
+ lisp = lisp->get_car();
+ if(!lisp)
+ return false;
+ return lisp->get(val);
+ }
+
+ template<class T>
+ bool get_vector(const char* name, std::vector<T>& vec) const
+ {
+ vec.clear();
+
+ const Lisp* child = get_lisp(name);
+ if(!child)
+ return false;
+
+ for( ; child != 0; child = child->get_cdr()) {
+ T val;
+ if(!child->get_car())
+ continue;
+ if(child->get_car()->get(val)) {
+ vec.push_back(val);
+ }
+ }
+
+ return true;
+ }
+
+ Lisp* get_lisp(const char* name) const;
+ Lisp* get_lisp(const std::string& name) const
+ { return get_lisp(name.c_str()); }
+
+ // for debugging
+ void print(int indent = 0) const;
+
+private:
+ friend class Parser;
+ Lisp(LispType newtype);
+
+ LispType type;
+ union
+ {
+ struct
+ {
+ Lisp* car;
+ Lisp* cdr;
+ } cons;
+
+ char* string;
+ int integer;
+ bool boolean;
+ float real;
+ } v;
+};
+
+} // end of namespace lisp
+
+#endif
+
#include <config.h>
-#include "list_iterator.h"
+#include "list_iterator.hpp"
#include <stdexcept>
namespace lisp
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __LISP_ITERATOR_H__
-#define __LISP_ITERATOR_H__
-
-#include "lisp/lisp.h"
-
-namespace lisp
-{
-
-/**
- * Small and a bit hacky helper class that helps parsing lisp lists where all
- * entries are lists again themselves
- */
-class ListIterator
-{
-public:
- ListIterator(const lisp::Lisp* cur);
-
- const std::string& item() const
- { return current_item; }
- lisp::Lisp* lisp() const
- { return current_lisp; }
- lisp::Lisp* value() const
- { return current_lisp->get_car(); }
- bool next();
-
-private:
- std::string current_item;
- lisp::Lisp* current_lisp;
- const lisp::Lisp* cur;
-};
-
-}
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __LISP_ITERATOR_H__
+#define __LISP_ITERATOR_H__
+
+#include "lisp/lisp.hpp"
+
+namespace lisp
+{
+
+/**
+ * Small and a bit hacky helper class that helps parsing lisp lists where all
+ * entries are lists again themselves
+ */
+class ListIterator
+{
+public:
+ ListIterator(const lisp::Lisp* cur);
+
+ const std::string& item() const
+ { return current_item; }
+ lisp::Lisp* lisp() const
+ { return current_lisp; }
+ lisp::Lisp* value() const
+ { return current_lisp->get_car(); }
+ bool next();
+
+private:
+ std::string current_item;
+ lisp::Lisp* current_lisp;
+ const lisp::Lisp* cur;
+};
+
+}
+
+#endif
+
#include <cassert>
#include <iostream>
-#include "tinygettext/tinygettext.h"
-#include "physfs/physfs_stream.h"
-#include "resources.h"
-#include "parser.h"
-#include "lisp.h"
-#include "file_system.h"
+#include "tinygettext/tinygettext.hpp"
+#include "physfs/physfs_stream.hpp"
+#include "parser.hpp"
+#include "lisp.hpp"
namespace lisp
{
delete dictionary_manager;
}
+static std::string dirname(std::string filename)
+{
+ std::string::size_type p = filename.find_last_of('/');
+ if(p == std::string::npos)
+ return "";
+
+ return filename.substr(0, p+1);
+}
+
Lisp*
Parser::parse(const std::string& filename)
{
}
if(dictionary_manager) {
- dictionary_manager->add_directory(FileSystem::dirname(filename));
+ dictionary_manager->add_directory(dirname(filename));
dictionary = & (dictionary_manager->get_dictionary());
}
+++ /dev/null
-// $Id$
-//
-// TuxKart - a fun racing game with go-kart
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
-// code in this file based on lispreader from Mark Probst
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef __LISPPARSER_H__
-#define __LISPPARSER_H__
-
-#include <string>
-#include "lexer.h"
-
-namespace TinyGetText {
-class Dictionary;
-class DictionaryManager;
-}
-
-namespace lisp
-{
-
-class Lisp;
-
-class Parser
-{
-public:
- Parser(bool translate = true);
- ~Parser();
-
- Lisp* parse(const std::string& filename);
- Lisp* parse(std::istream& stream);
-
-private:
- Lisp* read();
-
- Lexer* lexer;
- TinyGetText::DictionaryManager* dictionary_manager;
- TinyGetText::Dictionary* dictionary;
- Lexer::TokenType token;
-};
-
-} // end of namespace lisp
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// TuxKart - a fun racing game with go-kart
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
+// code in this file based on lispreader from Mark Probst
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef __LISPPARSER_H__
+#define __LISPPARSER_H__
+
+#include <string>
+#include "lexer.hpp"
+
+namespace TinyGetText {
+class Dictionary;
+class DictionaryManager;
+}
+
+namespace lisp
+{
+
+class Lisp;
+
+class Parser
+{
+public:
+ Parser(bool translate = true);
+ ~Parser();
+
+ Lisp* parse(const std::string& filename);
+ Lisp* parse(std::istream& stream);
+
+private:
+ Lisp* read();
+
+ Lexer* lexer;
+ TinyGetText::DictionaryManager* dictionary_manager;
+ TinyGetText::Dictionary* dictionary;
+ Lexer::TokenType token;
+};
+
+} // end of namespace lisp
+
+#endif
+
#include <iostream>
-#include "writer.h"
-#include "physfs/physfs_stream.h"
+#include "writer.hpp"
+#include "physfs/physfs_stream.hpp"
namespace lisp
{
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef SUPERTUX_LISPWRITER_H
-#define SUPERTUX_LISPWRITER_H
-
-#include <iostream>
-#include <string>
-#include <vector>
-
-namespace lisp
-{
-
- class Writer
- {
- public:
- Writer(const std::string& filename);
- Writer(std::ostream* out);
- ~Writer();
-
- void write_comment(const std::string& comment);
-
- void start_list(const std::string& listname);
-
- void write_int(const std::string& name, int value);
- void write_float(const std::string& name, float value);
- void write_string(const std::string& name, const std::string& value,
- bool translatable = false);
- void write_bool(const std::string& name, bool value);
- void write_int_vector(const std::string& name, const std::vector<int>& value);
- void write_int_vector(const std::string& name, const std::vector<unsigned int>& value);
- // add more write-functions when needed...
-
- void end_list(const std::string& listname);
-
- private:
- void indent();
-
- std::ostream* out;
- bool out_owned;
- int indent_depth;
- std::vector<std::string> lists;
- };
-
-} //namespace lisp
-
-#endif //SUPERTUX_LISPWRITER_H
-
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef SUPERTUX_LISPWRITER_H
+#define SUPERTUX_LISPWRITER_H
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+namespace lisp
+{
+
+ class Writer
+ {
+ public:
+ Writer(const std::string& filename);
+ Writer(std::ostream* out);
+ ~Writer();
+
+ void write_comment(const std::string& comment);
+
+ void start_list(const std::string& listname);
+
+ void write_int(const std::string& name, int value);
+ void write_float(const std::string& name, float value);
+ void write_string(const std::string& name, const std::string& value,
+ bool translatable = false);
+ void write_bool(const std::string& name, bool value);
+ void write_int_vector(const std::string& name, const std::vector<int>& value);
+ void write_int_vector(const std::string& name, const std::vector<unsigned int>& value);
+ // add more write-functions when needed...
+
+ void end_list(const std::string& listname);
+
+ private:
+ void indent();
+
+ std::ostream* out;
+ bool out_owned;
+ int indent_depth;
+ std::vector<std::string> lists;
+ };
+
+} //namespace lisp
+
+#endif //SUPERTUX_LISPWRITER_H
+
#include <config.h>
#include <assert.h>
-#include "main.h"
+#include "main.hpp"
#include <stdexcept>
#include <iostream>
#include <SDL_image.h>
#include <SDL_opengl.h>
-#include "gameconfig.h"
-#include "resources.h"
-#include "gettext.h"
-#include "audio/sound_manager.h"
-#include "video/surface.h"
-#include "control/joystickkeyboardcontroller.h"
-#include "misc.h"
-#include "title.h"
-#include "game_session.h"
-#include "file_system.h"
-#include "physfs/physfs_sdl.h"
+#include "gameconfig.hpp"
+#include "resources.hpp"
+#include "gettext.hpp"
+#include "audio/sound_manager.hpp"
+#include "video/surface.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
+#include "misc.hpp"
+#include "title.hpp"
+#include "game_session.hpp"
+#include "file_system.hpp"
+#include "physfs/physfs_sdl.hpp"
SDL_Surface* screen = 0;
JoystickKeyboardController* main_controller = 0;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __MAIN_H__
-#define __MAIN_H__
-
-void init_video();
-void wait_for_event(float min_delay, float max_delay);
-
-static const int SCREEN_WIDTH = 800;
-static const int SCREEN_HEIGHT = 600;
-
-// global variables
-class JoystickKeyboardController;
-extern JoystickKeyboardController* main_controller;
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __MAIN_H__
+#define __MAIN_H__
+
+void init_video();
+void wait_for_event(float min_delay, float max_delay);
+
+static const int SCREEN_WIDTH = 800;
+static const int SCREEN_HEIGHT = 600;
+
+// global variables
+class JoystickKeyboardController;
+extern JoystickKeyboardController* main_controller;
+
+#endif
+++ /dev/null
-#ifndef __AATRIANGLE_H__
-#define __AATRIANGLE_H__
-
-#include "rect.h"
-
-/**
- * An axis aligned triangle (ie. a triangle where 2 sides are parallel to the x-
- * and y-axis.
- */
-class AATriangle : public Rect
-{
-public:
- /** Directions:
- *
- * SOUTHEWEST NORTHEAST SOUTHEAST NORTHWEST
- * * or *---* or * or *---*
- * | \ \ | / | | /
- * | \ \ | / | | /
- * *---* * *---* *
- *
- * Deform flags: (see docs/aatriangletypes.png for details)
- */
- enum Direction {
- SOUTHWEST = 0,
- NORTHEAST,
- SOUTHEAST,
- NORTHWEST,
- DIRECTION_MASK = 0x0003,
- DEFORM1 = 0x0010,
- DEFORM2 = 0x0020,
- DEFORM3 = 0x0030,
- DEFORM4 = 0x0040,
- DEFORM_MASK = 0x0070
- };
-
- AATriangle()
- : dir(SOUTHWEST)
- {
- }
- AATriangle(const Vector& v1, const Vector& v2, int newdir)
- : Rect(v1, v2), dir(newdir)
- {
- }
-
- int dir;
-};
-
-#endif
-
--- /dev/null
+#ifndef __AATRIANGLE_H__
+#define __AATRIANGLE_H__
+
+#include "rect.hpp"
+
+/**
+ * An axis aligned triangle (ie. a triangle where 2 sides are parallel to the x-
+ * and y-axis.
+ */
+class AATriangle : public Rect
+{
+public:
+ /** Directions:
+ *
+ * SOUTHEWEST NORTHEAST SOUTHEAST NORTHWEST
+ * * or *---* or * or *---*
+ * | \ \ | / | | /
+ * | \ \ | / | | /
+ * *---* * *---* *
+ *
+ * Deform flags: (see docs/aatriangletypes.png for details)
+ */
+ enum Direction {
+ SOUTHWEST = 0,
+ NORTHEAST,
+ SOUTHEAST,
+ NORTHWEST,
+ DIRECTION_MASK = 0x0003,
+ DEFORM1 = 0x0010,
+ DEFORM2 = 0x0020,
+ DEFORM3 = 0x0030,
+ DEFORM4 = 0x0040,
+ DEFORM_MASK = 0x0070
+ };
+
+ AATriangle()
+ : dir(SOUTHWEST)
+ {
+ }
+ AATriangle(const Vector& v1, const Vector& v2, int newdir)
+ : Rect(v1, v2), dir(newdir)
+ {
+ }
+
+ int dir;
+};
+
+#endif
+
+++ /dev/null
-#ifndef __RECT_H__
-#define __RECT_H__
-
-#include <assert.h>
-#include "vector.h"
-
-/** This class represents a rectangle.
- * (Implementation Note) We're using upper left and lower right point instead of
- * upper left and width/height here, because that makes the collision dectection
- * a little bit efficienter.
- */
-class Rect
-{
-public:
- Rect()
- { }
-
- Rect(const Vector& np1, const Vector& np2)
- : p1(np1), p2(np2)
- {
- }
-
- Rect(float x1, float y1, float x2, float y2)
- : p1(x1, y1), p2(x2, y2)
- {
- assert(p1.x <= p2.x && p1.y <= p2.y);
- }
-
- float get_width() const
- { return p2.x - p1.x; }
-
- float get_height() const
- { return p2.y - p1.y; }
-
- Vector get_middle() const
- { return Vector((p1.x+p2.x)/2, (p1.y+p2.y)/2); }
-
- void set_pos(const Vector& v)
- {
- move(v-p1);
- }
-
- void set_height(float height)
- {
- p2.y = p1.y + height;
- }
- void set_width(float width)
- {
- p2.x = p1.x + width;
- }
- void set_size(float width, float height)
- {
- set_width(width);
- set_height(height);
- }
-
- void move(const Vector& v)
- {
- p1 += v;
- p2 += v;
- }
-
- bool inside(const Vector& v) const
- {
- return v.x >= p1.x && v.y >= p1.y && v.x < p2.x && v.y < p2.y;
- }
- bool inside(const Rect& other) const
- {
- if(p1.x >= other.p2.x || other.p1.x >= p2.x)
- return false;
- if(p1.y >= other.p2.y || other.p1.y >= p2.y)
- return false;
-
- return true;
- }
-
- // leave these 2 public to safe the headaches of set/get functions for such
- // simple things :)
-
- /// upper left edge
- Vector p1;
- /// lower right edge
- Vector p2;
-};
-
-#endif
-
--- /dev/null
+#ifndef __RECT_H__
+#define __RECT_H__
+
+#include <assert.h>
+#include "vector.hpp"
+
+/** This class represents a rectangle.
+ * (Implementation Note) We're using upper left and lower right point instead of
+ * upper left and width/height here, because that makes the collision dectection
+ * a little bit efficienter.
+ */
+class Rect
+{
+public:
+ Rect()
+ { }
+
+ Rect(const Vector& np1, const Vector& np2)
+ : p1(np1), p2(np2)
+ {
+ }
+
+ Rect(float x1, float y1, float x2, float y2)
+ : p1(x1, y1), p2(x2, y2)
+ {
+ assert(p1.x <= p2.x && p1.y <= p2.y);
+ }
+
+ float get_width() const
+ { return p2.x - p1.x; }
+
+ float get_height() const
+ { return p2.y - p1.y; }
+
+ Vector get_middle() const
+ { return Vector((p1.x+p2.x)/2, (p1.y+p2.y)/2); }
+
+ void set_pos(const Vector& v)
+ {
+ move(v-p1);
+ }
+
+ void set_height(float height)
+ {
+ p2.y = p1.y + height;
+ }
+ void set_width(float width)
+ {
+ p2.x = p1.x + width;
+ }
+ void set_size(float width, float height)
+ {
+ set_width(width);
+ set_height(height);
+ }
+
+ void move(const Vector& v)
+ {
+ p1 += v;
+ p2 += v;
+ }
+
+ bool inside(const Vector& v) const
+ {
+ return v.x >= p1.x && v.y >= p1.y && v.x < p2.x && v.y < p2.y;
+ }
+ bool inside(const Rect& other) const
+ {
+ if(p1.x >= other.p2.x || other.p1.x >= p2.x)
+ return false;
+ if(p1.y >= other.p2.y || other.p1.y >= p2.y)
+ return false;
+
+ return true;
+ }
+
+ // leave these 2 public to safe the headaches of set/get functions for such
+ // simple things :)
+
+ /// upper left edge
+ Vector p1;
+ /// lower right edge
+ Vector p2;
+};
+
+#endif
+
#include <cmath>
-#include "math/vector.h"
+#include "math/vector.hpp"
Vector Vector::unit() const
{
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_VECTOR_H
-#define SUPERTUX_VECTOR_H
-
-/** Simple two dimensional vector. */
-class Vector
-{
-public:
- Vector(float nx, float ny)
- : x(nx), y(ny)
- { }
- Vector(const Vector& other)
- : x(other.x), y(other.y)
- { }
- Vector()
- : x(0), y(0)
- { }
-
- bool operator ==(const Vector& other) const
- {
- return x == other.x && y == other.y;
- }
-
- bool operator !=(const Vector& other) const
- {
- return !(x == other.x && y == other.y);
- }
-
- const Vector& operator=(const Vector& other)
- {
- x = other.x;
- y = other.y;
- return *this;
- }
-
- Vector operator+(const Vector& other) const
- {
- return Vector(x + other.x, y + other.y);
- }
-
- Vector operator-(const Vector& other) const
- {
- return Vector(x - other.x, y - other.y);
- }
-
- Vector operator*(float s) const
- {
- return Vector(x * s, y * s);
- }
-
- Vector operator/(float s) const
- {
- return Vector(x / s, y / s);
- }
-
- Vector operator-() const
- {
- return Vector(-x, -y);
- }
-
- const Vector& operator +=(const Vector& other)
- {
- x += other.x;
- y += other.y;
- return *this;
- }
-
- const Vector& operator *=(float val)
- {
- x *= val;
- y *= val;
- return *this;
- }
-
- const Vector& operator /=(float val)
- {
- x /= val;
- y /= val;
- return *this;
- }
-
- /// Scalar product of 2 vectors
- float operator*(const Vector& other) const
- {
- return x*other.x + y*other.y;
- }
-
- float norm() const;
- Vector unit() const;
-
- // ... add the other operators as needed, I'm too lazy now ...
-
- float x, y; // leave this public, get/set methods just give me headaches
- // for such simple stuff :)
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_VECTOR_H
+#define SUPERTUX_VECTOR_H
+
+/** Simple two dimensional vector. */
+class Vector
+{
+public:
+ Vector(float nx, float ny)
+ : x(nx), y(ny)
+ { }
+ Vector(const Vector& other)
+ : x(other.x), y(other.y)
+ { }
+ Vector()
+ : x(0), y(0)
+ { }
+
+ bool operator ==(const Vector& other) const
+ {
+ return x == other.x && y == other.y;
+ }
+
+ bool operator !=(const Vector& other) const
+ {
+ return !(x == other.x && y == other.y);
+ }
+
+ const Vector& operator=(const Vector& other)
+ {
+ x = other.x;
+ y = other.y;
+ return *this;
+ }
+
+ Vector operator+(const Vector& other) const
+ {
+ return Vector(x + other.x, y + other.y);
+ }
+
+ Vector operator-(const Vector& other) const
+ {
+ return Vector(x - other.x, y - other.y);
+ }
+
+ Vector operator*(float s) const
+ {
+ return Vector(x * s, y * s);
+ }
+
+ Vector operator/(float s) const
+ {
+ return Vector(x / s, y / s);
+ }
+
+ Vector operator-() const
+ {
+ return Vector(-x, -y);
+ }
+
+ const Vector& operator +=(const Vector& other)
+ {
+ x += other.x;
+ y += other.y;
+ return *this;
+ }
+
+ const Vector& operator *=(float val)
+ {
+ x *= val;
+ y *= val;
+ return *this;
+ }
+
+ const Vector& operator /=(float val)
+ {
+ x /= val;
+ y /= val;
+ return *this;
+ }
+
+ /// Scalar product of 2 vectors
+ float operator*(const Vector& other) const
+ {
+ return x*other.x + y*other.y;
+ }
+
+ float norm() const;
+ Vector unit() const;
+
+ // ... add the other operators as needed, I'm too lazy now ...
+
+ float x, y; // leave this public, get/set methods just give me headaches
+ // for such simple stuff :)
+};
+
+#endif
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "misc.h"
-#include "main.h"
-#include "gameconfig.h"
-#include "game_session.h"
-#include "gui/menu.h"
-#include "gui/button.h"
-#include "audio/sound_manager.h"
-#include "title.h"
-#include "resources.h"
-#include "worldmap.h"
-#include "gettext.h"
-#include "control/joystickkeyboardcontroller.h"
+#include "misc.hpp"
+#include "main.hpp"
+#include "gameconfig.hpp"
+#include "game_session.hpp"
+#include "gui/menu.hpp"
+#include "gui/button.hpp"
+#include "audio/sound_manager.hpp"
+#include "title.hpp"
+#include "resources.hpp"
+#include "worldmap.hpp"
+#include "gettext.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
Menu* main_menu = 0;
Menu* game_menu = 0;
+++ /dev/null
-// SuperTux
-// Copyright (C) 2004 Tobas Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_MISC_H
-#define SUPERTUX_MISC_H
-
-enum OptionsMenuIDs {
- MNID_FULLSCREEN,
- MNID_SOUND,
- MNID_MUSIC
-};
-
-/* Handle changes made to global settings in the options menu. */
-void process_options_menu();
-
-/* Create and setup menus. */
-void setup_menu();
-void free_menu();
-
-#endif
--- /dev/null
+// SuperTux
+// Copyright (C) 2004 Tobas Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_MISC_H
+#define SUPERTUX_MISC_H
+
+enum OptionsMenuIDs {
+ MNID_FULLSCREEN,
+ MNID_SOUND,
+ MNID_MUSIC
+};
+
+/* Handle changes made to global settings in the options menu. */
+void process_options_menu();
+
+/* Create and setup menus. */
+void setup_menu();
+void free_menu();
+
+#endif
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "moving_object.h"
+#include "moving_object.hpp"
MovingObject::MovingObject()
{
+++ /dev/null
-// $Id: moving_object.h 2295 2005-03-30 01:52:14Z matzebraun $
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_MOVING_OBJECT_H
-#define SUPERTUX_MOVING_OBJECT_H
-
-#include "game_object.h"
-#include "collision_hit.h"
-#include "math/vector.h"
-#include "math/rect.h"
-
-class Sector;
-class CollisionGrid;
-
-/**
- * Base class for all dynamic/moving game objects. This class contains things
- * for handling the bounding boxes and collision feedback.
- */
-class MovingObject : public GameObject
-{
-public:
- MovingObject();
- virtual ~MovingObject();
-
- /** this function is called when the object collided with any other object
- */
- virtual HitResponse collision(GameObject& other,
- const CollisionHit& hit) = 0;
-
- const Vector& get_pos() const
- {
- return bbox.p1;
- }
-
- /** returns the bounding box of the Object */
- const Rect& get_bbox() const
- {
- return bbox;
- }
-
- const Vector& get_movement() const
- {
- return movement;
- }
-
- /** places the moving object at a specific position. Be carefull when
- * using this function. There are no collision detection checks performed
- * here so bad things could happen.
- */
- virtual void set_pos(const Vector& pos)
- {
- bbox.set_pos(pos);
- }
-
-protected:
- friend class Sector;
- friend class CollisionGrid;
-
- /** The bounding box of the object (as used for collision detection, this
- * isn't necessarily the bounding box for graphics)
- */
- Rect bbox;
- /** The movement that will happen till next frame
- */
- Vector movement;
-};
-
-#endif
--- /dev/null
+// $Id: moving_object.h 2295 2005-03-30 01:52:14Z matzebraun $
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_MOVING_OBJECT_H
+#define SUPERTUX_MOVING_OBJECT_H
+
+#include "game_object.hpp"
+#include "collision_hit.hpp"
+#include "math/vector.hpp"
+#include "math/rect.hpp"
+
+class Sector;
+class CollisionGrid;
+
+/**
+ * Base class for all dynamic/moving game objects. This class contains things
+ * for handling the bounding boxes and collision feedback.
+ */
+class MovingObject : public GameObject
+{
+public:
+ MovingObject();
+ virtual ~MovingObject();
+
+ /** this function is called when the object collided with any other object
+ */
+ virtual HitResponse collision(GameObject& other,
+ const CollisionHit& hit) = 0;
+
+ const Vector& get_pos() const
+ {
+ return bbox.p1;
+ }
+
+ /** returns the bounding box of the Object */
+ const Rect& get_bbox() const
+ {
+ return bbox;
+ }
+
+ const Vector& get_movement() const
+ {
+ return movement;
+ }
+
+ /** places the moving object at a specific position. Be carefull when
+ * using this function. There are no collision detection checks performed
+ * here so bad things could happen.
+ */
+ virtual void set_pos(const Vector& pos)
+ {
+ bbox.set_pos(pos);
+ }
+
+protected:
+ friend class Sector;
+ friend class CollisionGrid;
+
+ /** The bounding box of the object (as used for collision detection, this
+ * isn't necessarily the bounding box for graphics)
+ */
+ Rect bbox;
+ /** The movement that will happen till next frame
+ */
+ Vector movement;
+};
+
+#endif
#include <math.h>
#include <stdexcept>
-#include "ambient_sound.h"
-#include "object_factory.h"
-#include "lisp/lisp.h"
-#include "sector.h"
-#include "audio/sound_manager.h"
-#include "audio/sound_source.h"
+#include "ambient_sound.hpp"
+#include "object_factory.hpp"
+#include "lisp/lisp.hpp"
+#include "sector.hpp"
+#include "audio/sound_manager.hpp"
+#include "audio/sound_source.hpp"
AmbientSound::AmbientSound(const lisp::Lisp& lisp)
{
+++ /dev/null
-// ambient_sound.h basti_
-//
-// SuperTux
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-/**
- * Ambient Sound Source, gamma version. Features:
- *
- * - "rounded rectancle" geometry with position, dimension and
- * "rounding radius" (extending in all directions) of a 100%
- * volume area, adjustable maximum volume, inverse square
- * falloff outside area.
- *
- * - degenerates gracefully to a disc for dimension=0
- *
- * - parameters:
- *
- * x, y position
- * width, height dimension
- * distance_factor high = steep fallofff
- * distance_bias high = big "100% disc"
- * silence_distance defaults reasonably.
- * sample sample to be played back in loop mode
- *
- * basti_
- */
-
-#ifndef __AMBIENT_SOUND_H__
-#define __AMBIENT_SOUND_H__
-
-#include "game_object.h"
-#include "resources.h"
-#include "player.h"
-#include "SDL_mixer.h"
-
-class SoundSource;
-
-class AmbientSound : public GameObject
-{
-public:
- AmbientSound(const lisp::Lisp& lisp);
- AmbientSound(Vector pos, float factor, float bias, float vol, std::string file);
- ~AmbientSound();
-protected:
- virtual void hit(Player& player);
- virtual void update(float time);
- virtual void draw(DrawingContext&);
- virtual void start_playing();
- virtual void stop_playing();
-private:
- Vector position;
- Vector dimension;
-
- std::string sample;
- SoundSource* sound_source;
- int latency;
-
- float distance_factor; /// distance scaling
- float distance_bias; /// 100% volume disc radius
- float silence_distance; /// not implemented yet
-
- float maximumvolume; /// maximum volume
- float targetvolume; /// how loud we want to be
- float currentvolume; /// how loud we are
-
- float * volume_ptr; /// this will be used by the volume adjustment effect.
-};
-
-#endif
-
--- /dev/null
+// ambient_sound.h basti_
+//
+// SuperTux
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+/**
+ * Ambient Sound Source, gamma version. Features:
+ *
+ * - "rounded rectancle" geometry with position, dimension and
+ * "rounding radius" (extending in all directions) of a 100%
+ * volume area, adjustable maximum volume, inverse square
+ * falloff outside area.
+ *
+ * - degenerates gracefully to a disc for dimension=0
+ *
+ * - parameters:
+ *
+ * x, y position
+ * width, height dimension
+ * distance_factor high = steep fallofff
+ * distance_bias high = big "100% disc"
+ * silence_distance defaults reasonably.
+ * sample sample to be played back in loop mode
+ *
+ * basti_
+ */
+
+#ifndef __AMBIENT_SOUND_H__
+#define __AMBIENT_SOUND_H__
+
+#include "game_object.hpp"
+#include "resources.hpp"
+#include "player.hpp"
+
+class SoundSource;
+
+class AmbientSound : public GameObject
+{
+public:
+ AmbientSound(const lisp::Lisp& lisp);
+ AmbientSound(Vector pos, float factor, float bias, float vol, std::string file);
+ ~AmbientSound();
+protected:
+ virtual void hit(Player& player);
+ virtual void update(float time);
+ virtual void draw(DrawingContext&);
+ virtual void start_playing();
+ virtual void stop_playing();
+private:
+ Vector position;
+ Vector dimension;
+
+ std::string sample;
+ SoundSource* sound_source;
+ int latency;
+
+ float distance_factor; /// distance scaling
+ float distance_bias; /// 100% volume disc radius
+ float silence_distance; /// not implemented yet
+
+ float maximumvolume; /// maximum volume
+ float targetvolume; /// how loud we want to be
+ float currentvolume; /// how loud we are
+
+ float * volume_ptr; /// this will be used by the volume adjustment effect.
+};
+
+#endif
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "background.h"
-#include "camera.h"
-#include "video/drawing_context.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "object_factory.h"
-#include "resources.h"
-#include "main.h"
+#include "background.hpp"
+#include "camera.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "object_factory.hpp"
+#include "resources.hpp"
+#include "main.hpp"
Background::Background()
: type(INVALID), layer(LAYER_BACKGROUND0), image(0)
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_BACKGROUND_H
-#define SUPERTUX_BACKGROUND_H
-
-#include "video/surface.h"
-#include "video/drawing_context.h"
-#include "game_object.h"
-#include "serializable.h"
-
-class DisplayManager;
-
-namespace lisp {
-class Lisp;
-}
-
-class Background : public GameObject, public Serializable
-{
-public:
- Background();
- Background(const lisp::Lisp& reader);
- virtual ~Background();
-
- virtual void write(lisp::Writer& writer);
-
- void set_image(const std::string& name, float bkgd_speed);
-
- void set_gradient(Color top, Color bottom);
-
- std::string get_image() const
- { return imagefile; }
- float get_speed() const
- { return speed; }
- Color get_gradient_top() const
- { return gradient_top; }
- Color get_gradient_bottom() const
- { return gradient_bottom; }
-
- virtual void update(float elapsed_time);
-
- virtual void draw(DrawingContext& context);
-
-private:
- enum Type {
- INVALID, GRADIENT, IMAGE
- };
-
- Type type;
- int layer;
- std::string imagefile;
- float speed;
- Surface* image;
- Color gradient_top, gradient_bottom;
-};
-
-#endif /*SUPERTUX_BACKGROUND_H*/
-
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_BACKGROUND_H
+#define SUPERTUX_BACKGROUND_H
+
+#include "video/surface.hpp"
+#include "video/drawing_context.hpp"
+#include "game_object.hpp"
+#include "serializable.hpp"
+
+class DisplayManager;
+
+namespace lisp {
+class Lisp;
+}
+
+class Background : public GameObject, public Serializable
+{
+public:
+ Background();
+ Background(const lisp::Lisp& reader);
+ virtual ~Background();
+
+ virtual void write(lisp::Writer& writer);
+
+ void set_image(const std::string& name, float bkgd_speed);
+
+ void set_gradient(Color top, Color bottom);
+
+ std::string get_image() const
+ { return imagefile; }
+ float get_speed() const
+ { return speed; }
+ Color get_gradient_top() const
+ { return gradient_top; }
+ Color get_gradient_bottom() const
+ { return gradient_bottom; }
+
+ virtual void update(float elapsed_time);
+
+ virtual void draw(DrawingContext& context);
+
+private:
+ enum Type {
+ INVALID, GRADIENT, IMAGE
+ };
+
+ Type type;
+ int layer;
+ std::string imagefile;
+ float speed;
+ Surface* image;
+ Color gradient_top, gradient_bottom;
+};
+
+#endif /*SUPERTUX_BACKGROUND_H*/
+
// 02111-1307, USA.
#include <config.h>
-#include "bell.h"
-#include "resources.h"
-#include "sprite/sprite_manager.h"
-#include "video/drawing_context.h"
-#include "player.h"
-#include "object_factory.h"
-#include "game_session.h"
-#include "sector.h"
+#include "bell.hpp"
+#include "resources.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
+#include "player.hpp"
+#include "object_factory.hpp"
+#include "game_session.hpp"
+#include "sector.hpp"
Bell::Bell(const lisp::Lisp& lisp)
: ringing(false)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __BELL_H__
-#define __BELL_H__
-
-#include "lisp/lisp.h"
-#include "moving_object.h"
-#include "sprite/sprite.h"
-#include "serializable.h"
-
-/**
- * A bell: When tux touches it, it begins ringing and you will respawn at this
- * position.
- */
-class Bell : public MovingObject, public Serializable
-{
-public:
- Bell(const lisp::Lisp& lisp);
- ~Bell();
-
- void write(lisp::Writer& writer);
- void update(float elapsed_time);
- void draw(DrawingContext& context);
- HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Sprite* sprite;
- bool ringing;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __BELL_H__
+#define __BELL_H__
+
+#include "lisp/lisp.hpp"
+#include "moving_object.hpp"
+#include "sprite/sprite.hpp"
+#include "serializable.hpp"
+
+/**
+ * A bell: When tux touches it, it begins ringing and you will respawn at this
+ * position.
+ */
+class Bell : public MovingObject, public Serializable
+{
+public:
+ Bell(const lisp::Lisp& lisp);
+ ~Bell();
+
+ void write(lisp::Writer& writer);
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+private:
+ Sprite* sprite;
+ bool ringing;
+};
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "block.h"
+#include "block.hpp"
#include <stdexcept>
-#include "resources.h"
-#include "player.h"
-#include "sector.h"
-#include "sprite/sprite.h"
-#include "sprite/sprite_manager.h"
-#include "video/drawing_context.h"
-#include "lisp/lisp.h"
-#include "gameobjs.h"
-#include "specialriser.h"
-#include "growup.h"
-#include "flower.h"
-#include "oneup.h"
-#include "star.h"
-#include "player_status.h"
-#include "badguy/badguy.h"
-#include "coin.h"
-#include "object_factory.h"
-#include "lisp/list_iterator.h"
-#include "object_factory.h"
+#include "resources.hpp"
+#include "player.hpp"
+#include "sector.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/lisp.hpp"
+#include "gameobjs.hpp"
+#include "specialriser.hpp"
+#include "growup.hpp"
+#include "flower.hpp"
+#include "oneup.hpp"
+#include "star.hpp"
+#include "player_status.hpp"
+#include "badguy/badguy.hpp"
+#include "coin.hpp"
+#include "object_factory.hpp"
+#include "lisp/list_iterator.hpp"
+#include "object_factory.hpp"
static const float BOUNCY_BRICK_MAX_OFFSET=8;
static const float BOUNCY_BRICK_SPEED=90;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __BLOCK_H__
-#define __BLOCK_H__
-
-#include "moving_object.h"
-#include "lisp/lisp.h"
-
-class Sprite;
-class Player;
-
-class Block : public MovingObject
-{
-public:
- Block(Sprite* sprite = 0);
- ~Block();
-
- virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-protected:
- virtual void hit(Player& player) = 0;
- void start_bounce();
-
- Sprite* sprite;
- bool bouncing;
- float bounce_dir;
- float bounce_offset;
- float original_y;
-};
-
-class BonusBlock : public Block
-{
-public:
- BonusBlock(const Vector& pos, int data);
- BonusBlock(const lisp::Lisp& lisp);
- virtual ~BonusBlock();
-
- void try_open();
-
-protected:
- virtual void hit(Player& player);
-
-private:
- enum Contents {
- CONTENT_COIN,
- CONTENT_FIREGROW,
- CONTENT_ICEGROW,
- CONTENT_STAR,
- CONTENT_1UP,
- CONTENT_CUSTOM
- };
-
- Contents contents;
- MovingObject* object;
-};
-
-class Brick : public Block
-{
-public:
- Brick(const Vector& pos, int data);
-
- void try_break(bool playerhit = false);
-
-protected:
- virtual void hit(Player& player);
-
-private:
- bool breakable;
- int coin_counter;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __BLOCK_H__
+#define __BLOCK_H__
+
+#include "moving_object.hpp"
+#include "lisp/lisp.hpp"
+
+class Sprite;
+class Player;
+
+class Block : public MovingObject
+{
+public:
+ Block(Sprite* sprite = 0);
+ ~Block();
+
+ virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+protected:
+ virtual void hit(Player& player) = 0;
+ void start_bounce();
+
+ Sprite* sprite;
+ bool bouncing;
+ float bounce_dir;
+ float bounce_offset;
+ float original_y;
+};
+
+class BonusBlock : public Block
+{
+public:
+ BonusBlock(const Vector& pos, int data);
+ BonusBlock(const lisp::Lisp& lisp);
+ virtual ~BonusBlock();
+
+ void try_open();
+
+protected:
+ virtual void hit(Player& player);
+
+private:
+ enum Contents {
+ CONTENT_COIN,
+ CONTENT_FIREGROW,
+ CONTENT_ICEGROW,
+ CONTENT_STAR,
+ CONTENT_1UP,
+ CONTENT_CUSTOM
+ };
+
+ Contents contents;
+ MovingObject* object;
+};
+
+class Brick : public Block
+{
+public:
+ Brick(const Vector& pos, int data);
+
+ void try_break(bool playerhit = false);
+
+protected:
+ virtual void hit(Player& player);
+
+private:
+ bool breakable;
+ int coin_counter;
+};
+
+#endif
+
#include <config.h>
#include <math.h>
-#include "bullet.h"
-#include "resources.h"
-#include "camera.h"
-#include "sector.h"
-#include "sprite/sprite_manager.h"
-#include "badguy/badguy.h"
-#include "main.h"
+#include "bullet.hpp"
+#include "resources.hpp"
+#include "camera.hpp"
+#include "sector.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "badguy/badguy.hpp"
+#include "main.hpp"
static const float BULLET_XM = 300;
static const float BULLET_STARTING_YM = 0;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __BULLET_H__
-#define __BULLET_H__
-
-#include "moving_object.h"
-#include "physic.h"
-#include "sprite/sprite.h"
-
-enum BulletsKind {
- FIRE_BULLET,
- ICE_BULLET
-};
-
-class Bullet : public MovingObject
-{
-public:
- Bullet(const Vector& pos, float xm, int dir, int kind);
- ~Bullet();
-
- void update(float elapsed_time);
- void draw(DrawingContext& context);
- HitResponse collision(GameObject& other, const CollisionHit& hit);
-
- int kind;
-
-private:
- int life_count;
- Physic physic;
- Sprite* sprite;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __BULLET_H__
+#define __BULLET_H__
+
+#include "moving_object.hpp"
+#include "physic.hpp"
+#include "sprite/sprite.hpp"
+
+enum BulletsKind {
+ FIRE_BULLET,
+ ICE_BULLET
+};
+
+class Bullet : public MovingObject
+{
+public:
+ Bullet(const Vector& pos, float xm, int dir, int kind);
+ ~Bullet();
+
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+ int kind;
+
+private:
+ int life_count;
+ Physic physic;
+ Sprite* sprite;
+};
+
+#endif
#include <sstream>
#include <cmath>
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "lisp/list_iterator.h"
-#include "camera.h"
-#include "player.h"
-#include "tilemap.h"
-#include "game_session.h"
-#include "sector.h"
-#include "main.h"
-#include "object_factory.h"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "lisp/list_iterator.hpp"
+#include "camera.hpp"
+#include "player.hpp"
+#include "tilemap.hpp"
+#include "game_session.hpp"
+#include "sector.hpp"
+#include "main.hpp"
+#include "object_factory.hpp"
Camera::Camera(Sector* newsector)
: sector(newsector), do_backscrolling(true), scrollchange(NONE),
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_CAMERA_H
-#define SUPERTUX_CAMERA_H
-
-#include <vector>
-#include <cassert>
-
-#include "math/vector.h"
-#include "game_object.h"
-#include "video/drawing_context.h"
-#include "serializable.h"
-#include "timer.h"
-
-namespace lisp {
-class Lisp;
-}
-
-class Sector;
-
-class Camera : public GameObject, public Serializable
-{
-public:
- Camera(Sector* sector);
- virtual ~Camera();
-
- /// parse camera mode from lisp file
- void parse(const lisp::Lisp& reader);
- /// write camera mode to a lisp file
- virtual void write(lisp::Writer& writer);
-
- /// reset camera postion
- virtual void reset(const Vector& tuxpos);
-
- /** return camera position */
- const Vector& get_translation() const;
-
- virtual void update(float elapsed_time);
-
- virtual void draw(DrawingContext& )
- {
- }
-
- // shake camera in a direction 1 time
- void shake(float speed, float x, float y);
-
- void set_scrolling(int scroll_x, int scroll_y)
- {
- translation.x = scroll_x;
- translation.y = scroll_y;
- }
-
- enum CameraMode
- {
- NORMAL, AUTOSCROLL, MANUAL
- };
- CameraMode mode;
-
-private:
- void scroll_normal(float elapsed_time);
- void scroll_autoscroll(float elapsed_time);
- void keep_in_bounds();
- void shake();
-
- enum LeftRightScrollChange
- {
- NONE, LEFT, RIGHT
- };
-
- Vector translation;
-
- Sector* sector;
-
- // normal mode
- bool do_backscrolling;
- LeftRightScrollChange scrollchange;
-
- // autoscroll mode
- class ScrollPoint {
- public:
- Vector position;
- float speed;
- };
- std::vector<ScrollPoint> scrollpoints;
- size_t auto_idx;
- float auto_t;
- Vector current_dir;
-
- // shaking
- Timer shaketimer;
- float shakespeed;
- float shakedepth_x;
- float shakedepth_y;
-};
-
-#endif /*SUPERTUX_CAMERA_H*/
-
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_CAMERA_H
+#define SUPERTUX_CAMERA_H
+
+#include <vector>
+#include <cassert>
+
+#include "math/vector.hpp"
+#include "game_object.hpp"
+#include "video/drawing_context.hpp"
+#include "serializable.hpp"
+#include "timer.hpp"
+
+namespace lisp {
+class Lisp;
+}
+
+class Sector;
+
+class Camera : public GameObject, public Serializable
+{
+public:
+ Camera(Sector* sector);
+ virtual ~Camera();
+
+ /// parse camera mode from lisp file
+ void parse(const lisp::Lisp& reader);
+ /// write camera mode to a lisp file
+ virtual void write(lisp::Writer& writer);
+
+ /// reset camera postion
+ virtual void reset(const Vector& tuxpos);
+
+ /** return camera position */
+ const Vector& get_translation() const;
+
+ virtual void update(float elapsed_time);
+
+ virtual void draw(DrawingContext& )
+ {
+ }
+
+ // shake camera in a direction 1 time
+ void shake(float speed, float x, float y);
+
+ void set_scrolling(int scroll_x, int scroll_y)
+ {
+ translation.x = scroll_x;
+ translation.y = scroll_y;
+ }
+
+ enum CameraMode
+ {
+ NORMAL, AUTOSCROLL, MANUAL
+ };
+ CameraMode mode;
+
+private:
+ void scroll_normal(float elapsed_time);
+ void scroll_autoscroll(float elapsed_time);
+ void keep_in_bounds();
+ void shake();
+
+ enum LeftRightScrollChange
+ {
+ NONE, LEFT, RIGHT
+ };
+
+ Vector translation;
+
+ Sector* sector;
+
+ // normal mode
+ bool do_backscrolling;
+ LeftRightScrollChange scrollchange;
+
+ // autoscroll mode
+ class ScrollPoint {
+ public:
+ Vector position;
+ float speed;
+ };
+ std::vector<ScrollPoint> scrollpoints;
+ size_t auto_idx;
+ float auto_t;
+ Vector current_dir;
+
+ // shaking
+ Timer shaketimer;
+ float shakespeed;
+ float shakedepth_x;
+ float shakedepth_y;
+};
+
+#endif /*SUPERTUX_CAMERA_H*/
+
#include <config.h>
-#include "coin.h"
-#include "resources.h"
-#include "video/drawing_context.h"
-#include "sprite/sprite_manager.h"
-#include "player.h"
-#include "sector.h"
-#include "player_status.h"
-#include "gameobjs.h"
-#include "statistics.h"
-#include "object_factory.h"
+#include "coin.hpp"
+#include "resources.hpp"
+#include "video/drawing_context.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "player.hpp"
+#include "sector.hpp"
+#include "player_status.hpp"
+#include "gameobjs.hpp"
+#include "statistics.hpp"
+#include "object_factory.hpp"
Coin::Coin(const Vector& pos)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __COIN_H__
-#define __COIN_H__
-
-#include "moving_object.h"
-#include "lisp/lisp.h"
-
-class Sprite;
-
-class Coin : public MovingObject
-{
-public:
- Coin(const Vector& pos);
- Coin(const lisp::Lisp& reader);
- ~Coin();
-
- HitResponse collision(GameObject& other, const CollisionHit& hit);
- void update(float elapsed_time);
- void draw(DrawingContext& context);
-
- void collect();
-
-private:
- Sprite* sprite;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __COIN_H__
+#define __COIN_H__
+
+#include "moving_object.hpp"
+#include "lisp/lisp.hpp"
+
+class Sprite;
+
+class Coin : public MovingObject
+{
+public:
+ Coin(const Vector& pos);
+ Coin(const lisp::Lisp& reader);
+ ~Coin();
+
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+
+ void collect();
+
+private:
+ Sprite* sprite;
+};
+
+#endif
+
#include <config.h>
-#include "display_effect.h"
+#include "display_effect.hpp"
#include <assert.h>
-#include "video/drawing_context.h"
-#include "main.h"
+#include "video/drawing_context.hpp"
+#include "main.hpp"
DisplayEffect::DisplayEffect()
: type(NO_FADE), fadetime(0), fading(0), black(false)
+++ /dev/null
-#ifndef __OBJECT_DISPLAY_EFFECT_H__
-#define __OBJECT_DISPLAY_EFFECT_H__
-
-#include "scripting/display_effect.h"
-#include "game_object.h"
-
-class DisplayEffect : public GameObject, public Scripting::DisplayEffect
-{
-public:
- DisplayEffect();
- virtual ~DisplayEffect();
-
- void update(float elapsed_time);
- void draw(DrawingContext& context);
-
- void fade_out(float fadetime);
- void fade_in(float fadetime);
- void set_black(bool enabled);
- bool is_black();
-
-private:
- enum FadeType {
- NO_FADE, FADE_IN, FADE_OUT
- };
- FadeType type;
- float fadetime;
- float fading;
- bool black;
-};
-
-#endif
-
--- /dev/null
+#ifndef __OBJECT_DISPLAY_EFFECT_H__
+#define __OBJECT_DISPLAY_EFFECT_H__
+
+#include "scripting/display_effect.hpp"
+#include "game_object.hpp"
+
+class DisplayEffect : public GameObject, public Scripting::DisplayEffect
+{
+public:
+ DisplayEffect();
+ virtual ~DisplayEffect();
+
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+
+ void fade_out(float fadetime);
+ void fade_in(float fadetime);
+ void set_black(bool enabled);
+ bool is_black();
+
+private:
+ enum FadeType {
+ NO_FADE, FADE_IN, FADE_OUT
+ };
+ FadeType type;
+ float fadetime;
+ float fading;
+ bool black;
+};
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "fireworks.h"
-#include "resources.h"
-#include "sector.h"
-#include "camera.h"
-#include "gameobjs.h"
-#include "main.h"
-#include "video/drawing_context.h"
-#include "audio/sound_manager.h"
+#include "fireworks.hpp"
+#include "resources.hpp"
+#include "sector.hpp"
+#include "camera.hpp"
+#include "gameobjs.hpp"
+#include "main.hpp"
+#include "video/drawing_context.hpp"
+#include "audio/sound_manager.hpp"
Fireworks::Fireworks()
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __FIREWORKS_H__
-#define __FIREWORKS_H__
-
-#include "video/drawing_context.h"
-#include "game_object.h"
-#include "timer.h"
-
-class Fireworks : public GameObject
-{
-public:
- Fireworks();
- ~Fireworks();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- Timer timer;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __FIREWORKS_H__
+#define __FIREWORKS_H__
+
+#include "video/drawing_context.hpp"
+#include "game_object.hpp"
+#include "timer.hpp"
+
+class Fireworks : public GameObject
+{
+public:
+ Fireworks();
+ ~Fireworks();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+private:
+ Timer timer;
+};
+
+#endif
+
#include <config.h>
#include <math.h>
-#include "flower.h"
-#include "resources.h"
-#include "camera.h"
-#include "sector.h"
-#include "player.h"
-#include "audio/sound_manager.h"
-#include "sprite/sprite_manager.h"
+#include "flower.hpp"
+#include "resources.hpp"
+#include "camera.hpp"
+#include "sector.hpp"
+#include "player.hpp"
+#include "audio/sound_manager.hpp"
+#include "sprite/sprite_manager.hpp"
Flower::Flower(Type _type)
: type(_type)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __FLOWER_H__
-#define __FLOWER_H__
-
-#include "moving_object.h"
-#include "sprite/sprite.h"
-#include "physic.h"
-
-class Flower : public MovingObject
-{
-public:
- enum Type {
- FIREFLOWER, ICEFLOWER
- };
- Flower(Type type);
- ~Flower();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
- virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Type type;
- Sprite* sprite;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __FLOWER_H__
+#define __FLOWER_H__
+
+#include "moving_object.hpp"
+#include "sprite/sprite.hpp"
+#include "physic.hpp"
+
+class Flower : public MovingObject
+{
+public:
+ enum Type {
+ FIREFLOWER, ICEFLOWER
+ };
+ Flower(Type type);
+ ~Flower();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+ virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+private:
+ Type type;
+ Sprite* sprite;
+};
+
+#endif
+
#include <iostream>
#include <cmath>
-#include "tile.h"
-#include "tile_manager.h"
-#include "game_session.h"
-#include "gameobjs.h"
-#include "sprite/sprite_manager.h"
-#include "resources.h"
-#include "sector.h"
-#include "tilemap.h"
-#include "video/drawing_context.h"
-#include "camera.h"
-#include "main.h"
+#include "tile.hpp"
+#include "tile_manager.hpp"
+#include "game_session.hpp"
+#include "gameobjs.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "resources.hpp"
+#include "sector.hpp"
+#include "tilemap.hpp"
+#include "video/drawing_context.hpp"
+#include "camera.hpp"
+#include "main.hpp"
BouncyCoin::BouncyCoin(const Vector& pos)
: position(pos)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef SUPERTUX_GAMEOBJS_H
-#define SUPERTUX_GAMEOBJS_H
-
-#include "video/surface.h"
-#include "timer.h"
-#include "physic.h"
-#include "game_object.h"
-#include "moving_object.h"
-#include "serializable.h"
-
-/* Bounciness of distros: */
-#define NO_BOUNCE 0
-#define BOUNCE 1
-
-class Sprite;
-
-class BouncyCoin : public GameObject
-{
-public:
- BouncyCoin(const Vector& pos);
- ~BouncyCoin();
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- Sprite* sprite;
- Vector position;
- Timer timer;
-};
-
-class BrokenBrick : public GameObject
-{
-public:
- BrokenBrick(Sprite* sprite, const Vector& pos, const Vector& movement);
- ~BrokenBrick();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- Timer timer;
- Sprite* sprite;
- Vector position;
- Vector movement;
-};
-
-class FloatingText : public GameObject
-{
-public:
- FloatingText(const Vector& pos, const std::string& text_);
- FloatingText(const Vector& pos, int s); // use this for score, for instance
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- Vector position;
- std::string text;
- Timer timer;
-};
-
-extern Sprite *img_smoke_cloud;
-
-class SmokeCloud : public GameObject
-{
-public:
- SmokeCloud(const Vector& pos);
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- Timer timer;
- Vector position;
-};
-
-class Particles : public GameObject
-{
-public:
- Particles(const Vector& epicenter, int min_angle, int max_angle,
- const Vector& initial_velocity, const Vector& acceleration,
- int number, Color color, int size, float life_time, int drawing_layer);
- ~Particles();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- Vector accel;
- Timer timer;
- bool live_forever;
-
- Color color;
- float size;
- int drawing_layer;
-
- struct Particle {
- Vector pos, vel;
-// float angle;
- };
- std::vector <Particle*> particles;
-};
-
-void load_object_gfx();
-void free_object_gfx();
-
-#endif
-
-/* Local Variables: */
-/* mode:c++ */
-/* End: */
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef SUPERTUX_GAMEOBJS_H
+#define SUPERTUX_GAMEOBJS_H
+
+#include "video/surface.hpp"
+#include "timer.hpp"
+#include "physic.hpp"
+#include "game_object.hpp"
+#include "moving_object.hpp"
+#include "serializable.hpp"
+
+/* Bounciness of distros: */
+#define NO_BOUNCE 0
+#define BOUNCE 1
+
+class Sprite;
+
+class BouncyCoin : public GameObject
+{
+public:
+ BouncyCoin(const Vector& pos);
+ ~BouncyCoin();
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+private:
+ Sprite* sprite;
+ Vector position;
+ Timer timer;
+};
+
+class BrokenBrick : public GameObject
+{
+public:
+ BrokenBrick(Sprite* sprite, const Vector& pos, const Vector& movement);
+ ~BrokenBrick();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+private:
+ Timer timer;
+ Sprite* sprite;
+ Vector position;
+ Vector movement;
+};
+
+class FloatingText : public GameObject
+{
+public:
+ FloatingText(const Vector& pos, const std::string& text_);
+ FloatingText(const Vector& pos, int s); // use this for score, for instance
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+private:
+ Vector position;
+ std::string text;
+ Timer timer;
+};
+
+extern Sprite *img_smoke_cloud;
+
+class SmokeCloud : public GameObject
+{
+public:
+ SmokeCloud(const Vector& pos);
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+private:
+ Timer timer;
+ Vector position;
+};
+
+class Particles : public GameObject
+{
+public:
+ Particles(const Vector& epicenter, int min_angle, int max_angle,
+ const Vector& initial_velocity, const Vector& acceleration,
+ int number, Color color, int size, float life_time, int drawing_layer);
+ ~Particles();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+private:
+ Vector accel;
+ Timer timer;
+ bool live_forever;
+
+ Color color;
+ float size;
+ int drawing_layer;
+
+ struct Particle {
+ Vector pos, vel;
+// float angle;
+ };
+ std::vector <Particle*> particles;
+};
+
+void load_object_gfx();
+void free_object_gfx();
+
+#endif
+
+/* Local Variables: */
+/* mode:c++ */
+/* End: */
#include <config.h>
#include <math.h>
-#include "growup.h"
-#include "resources.h"
-#include "camera.h"
-#include "sector.h"
-#include "player.h"
-#include "audio/sound_manager.h"
-#include "sprite/sprite_manager.h"
+#include "growup.hpp"
+#include "resources.hpp"
+#include "camera.hpp"
+#include "sector.hpp"
+#include "player.hpp"
+#include "audio/sound_manager.hpp"
+#include "sprite/sprite_manager.hpp"
GrowUp::GrowUp()
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __GROWUP_H__
-#define __GROWUP_H__
-
-#include "moving_object.h"
-#include "sprite/sprite.h"
-#include "physic.h"
-
-class GrowUp : public MovingObject
-{
-public:
- GrowUp();
- ~GrowUp();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
- virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Sprite* sprite;
- Physic physic;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __GROWUP_H__
+#define __GROWUP_H__
+
+#include "moving_object.hpp"
+#include "sprite/sprite.hpp"
+#include "physic.hpp"
+
+class GrowUp : public MovingObject
+{
+public:
+ GrowUp();
+ ~GrowUp();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+ virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+private:
+ Sprite* sprite;
+ Physic physic;
+};
+
+#endif
+
#include <config.h>
-#include "infoblock.h"
-#include "game_session.h"
-#include "resources.h"
-#include "sprite/sprite_manager.h"
-#include "object_factory.h"
-#include "lisp/lisp.h"
-#include "sector.h"
+#include "infoblock.hpp"
+#include "game_session.hpp"
+#include "resources.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "object_factory.hpp"
+#include "lisp/lisp.hpp"
+#include "sector.hpp"
InfoBlock::InfoBlock(const lisp::Lisp& lisp)
: Block(sprite_manager->create("infoblock"))
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __INFOBLOCK_H__
-#define __INFOBLOCK_H__
-
-#include "block.h"
-#include "object/ambient_sound.h"
-
-class InfoBlock : public Block
-{
-public:
- InfoBlock(const lisp::Lisp& lisp);
- virtual ~InfoBlock();
-
-protected:
- virtual void hit(Player& player);
- std::string message;
- AmbientSound* ringing;
- bool stopped;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __INFOBLOCK_H__
+#define __INFOBLOCK_H__
+
+#include "block.hpp"
+#include "object/ambient_sound.hpp"
+
+class InfoBlock : public Block
+{
+public:
+ InfoBlock(const lisp::Lisp& lisp);
+ virtual ~InfoBlock();
+
+protected:
+ virtual void hit(Player& player);
+ std::string message;
+ AmbientSound* ringing;
+ bool stopped;
+};
+
+#endif
+
#include <config.h>
-#include "invisible_block.h"
-#include "resources.h"
-#include "sprite/sprite.h"
-#include "sprite/sprite_manager.h"
-#include "video/drawing_context.h"
-#include "audio/sound_manager.h"
-#include "object_factory.h"
+#include "invisible_block.hpp"
+#include "resources.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
+#include "audio/sound_manager.hpp"
+#include "object_factory.hpp"
InvisibleBlock::InvisibleBlock(const Vector& pos)
: Block(sprite_manager->create("invisibleblock")), visible(false)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __INVISIBLE_BLOCK_H__
-#define __INVISIBLE_BLOCK_H__
-
-#include "block.h"
-
-class InvisibleBlock : public Block
-{
-public:
- InvisibleBlock(const Vector& pos);
-
- virtual void draw(DrawingContext& context);
-
-protected:
- virtual void hit(Player& player);
-
-private:
- bool visible;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __INVISIBLE_BLOCK_H__
+#define __INVISIBLE_BLOCK_H__
+
+#include "block.hpp"
+
+class InvisibleBlock : public Block
+{
+public:
+ InvisibleBlock(const Vector& pos);
+
+ virtual void draw(DrawingContext& context);
+
+protected:
+ virtual void hit(Player& player);
+
+private:
+ bool visible;
+};
+
+#endif
+
#include <config.h>
-#include "level_time.h"
+#include "level_time.hpp"
#include <stdexcept>
-#include "main.h"
-#include "resources.h"
-#include "sector.h"
-#include "gettext.h"
-#include "object_factory.h"
-#include "object/player.h"
-#include "video/drawing_context.h"
-#include "lisp/list_iterator.h"
+#include "main.hpp"
+#include "resources.hpp"
+#include "sector.hpp"
+#include "gettext.hpp"
+#include "object_factory.hpp"
+#include "object/player.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/list_iterator.hpp"
/** When to alert player they're low on time! */
static const float TIME_WARNING = 20;
+++ /dev/null
-#ifndef __LEVELTIME_H__
-#define __LEVELTIME_H__
-
-#include "game_object.h"
-#include "timer.h"
-#include "lisp/lisp.h"
-
-class LevelTime : public GameObject
-{
-public:
- LevelTime(const lisp::Lisp& reader);
- virtual ~LevelTime();
-
- void update(float elapsed_time);
- void draw(DrawingContext& context);
-
-private:
- Timer time_left;
-};
-
-#endif
-
--- /dev/null
+#ifndef __LEVELTIME_H__
+#define __LEVELTIME_H__
+
+#include "game_object.hpp"
+#include "timer.hpp"
+#include "lisp/lisp.hpp"
+
+class LevelTime : public GameObject
+{
+public:
+ LevelTime(const lisp::Lisp& reader);
+ virtual ~LevelTime();
+
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+
+private:
+ Timer time_left;
+};
+
+#endif
+
#include <config.h>
-#include "oneup.h"
-#include "resources.h"
-#include "player.h"
-#include "player_status.h"
-#include "sector.h"
-#include "sprite/sprite_manager.h"
-#include "video/drawing_context.h"
+#include "oneup.hpp"
+#include "resources.hpp"
+#include "player.hpp"
+#include "player_status.hpp"
+#include "sector.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
OneUp::OneUp(const Vector& pos)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __ONEUP_H__
-#define __ONEUP_H__
-
-#include "moving_object.h"
-#include "sprite/sprite.h"
-#include "physic.h"
-
-class OneUp : public MovingObject
-{
-public:
- OneUp(const Vector& pos);
- ~OneUp();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
- virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Sprite* sprite;
- Physic physic;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __ONEUP_H__
+#define __ONEUP_H__
+
+#include "moving_object.hpp"
+#include "sprite/sprite.hpp"
+#include "physic.hpp"
+
+class OneUp : public MovingObject
+{
+public:
+ OneUp(const Vector& pos);
+ ~OneUp();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+ virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+private:
+ Sprite* sprite;
+ Physic physic;
+};
+
+#endif
#include <iostream>
#include <cmath>
-#include "particlesystem.h"
-#include "video/drawing_context.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "resources.h"
-#include "main.h"
+#include "particlesystem.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "resources.hpp"
+#include "main.hpp"
ParticleSystem::ParticleSystem()
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_PARTICLESYSTEM_H
-#define SUPERTUX_PARTICLESYSTEM_H
-
-#include <vector>
-
-#include "video/surface.h"
-#include "game_object.h"
-#include "serializable.h"
-#include "sector.h"
-#include "math/vector.h"
-
-namespace lisp {
-class Lisp;
-}
-
-class DisplayManager;
-
-/**
- * This is the base class for particle systems. It is responsible for storing a
- * set of particles with each having an x- and y-coordinate the number of the
- * layer where it should be drawn and a texture.
- * The coordinate system used here is a virtual one. It would be a bad idea to
- * populate whole levels with particles. So we're using a virtual rectangle
- * here that is tiled onto the level when drawing. This rect.has the size
- * (virtual_width, virtual_height). We're using modulo on the particle
- * coordinates, so when a particle leaves left, it'll reenter at the right
- * side.
- *
- * Classes that implement a particle system should subclass from this class,
- * initialize particles in the constructor and move them in the simulate
- * function.
- */
-class ParticleSystem : public GameObject
-{
-public:
- ParticleSystem();
- virtual ~ParticleSystem();
-
- virtual void draw(DrawingContext& context);
-
-protected:
- int layer;
-
- class Particle
- {
- public:
- virtual ~Particle()
- { }
-
- Vector pos;
- Surface* texture;
- };
-
- std::vector<Particle*> particles;
- float virtual_width, virtual_height;
-};
-
-class SnowParticleSystem : public ParticleSystem, public Serializable
-{
-public:
- SnowParticleSystem();
- virtual ~SnowParticleSystem();
-
- void parse(const lisp::Lisp& lisp);
- void write(lisp::Writer& writer);
-
- virtual void update(float elapsed_time);
-
- std::string type() const
- { return "SnowParticleSystem"; }
-
-private:
- class SnowParticle : public Particle
- {
- public:
- float speed;
- };
-
- Surface* snowimages[3];
-};
-
-class GhostParticleSystem : public ParticleSystem, public Serializable
-{
-public:
- GhostParticleSystem();
- virtual ~GhostParticleSystem();
-
- void parse(const lisp::Lisp& lisp);
- void write(lisp::Writer& writer);
-
- virtual void update(float elapsed_time);
-
- std::string type() const
- { return "GhostParticleSystem"; }
-
-private:
- class GhostParticle : public Particle
- {
- public:
- float speed;
- };
-
- Surface* ghosts[2];
-};
-
-class CloudParticleSystem : public ParticleSystem, public Serializable
-{
-public:
- CloudParticleSystem();
- virtual ~CloudParticleSystem();
-
- void parse(const lisp::Lisp& lisp);
- void write(lisp::Writer& writer);
-
- virtual void update(float elapsed_time);
-
- std::string type() const
- { return "SnowParticleSystem"; }
-
-private:
- class CloudParticle : public Particle
- {
- public:
- float speed;
- };
-
- Surface* cloudimage;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_PARTICLESYSTEM_H
+#define SUPERTUX_PARTICLESYSTEM_H
+
+#include <vector>
+
+#include "video/surface.hpp"
+#include "game_object.hpp"
+#include "serializable.hpp"
+#include "sector.hpp"
+#include "math/vector.hpp"
+
+namespace lisp {
+class Lisp;
+}
+
+class DisplayManager;
+
+/**
+ * This is the base class for particle systems. It is responsible for storing a
+ * set of particles with each having an x- and y-coordinate the number of the
+ * layer where it should be drawn and a texture.
+ * The coordinate system used here is a virtual one. It would be a bad idea to
+ * populate whole levels with particles. So we're using a virtual rectangle
+ * here that is tiled onto the level when drawing. This rect.has the size
+ * (virtual_width, virtual_height). We're using modulo on the particle
+ * coordinates, so when a particle leaves left, it'll reenter at the right
+ * side.
+ *
+ * Classes that implement a particle system should subclass from this class,
+ * initialize particles in the constructor and move them in the simulate
+ * function.
+ */
+class ParticleSystem : public GameObject
+{
+public:
+ ParticleSystem();
+ virtual ~ParticleSystem();
+
+ virtual void draw(DrawingContext& context);
+
+protected:
+ int layer;
+
+ class Particle
+ {
+ public:
+ virtual ~Particle()
+ { }
+
+ Vector pos;
+ Surface* texture;
+ };
+
+ std::vector<Particle*> particles;
+ float virtual_width, virtual_height;
+};
+
+class SnowParticleSystem : public ParticleSystem, public Serializable
+{
+public:
+ SnowParticleSystem();
+ virtual ~SnowParticleSystem();
+
+ void parse(const lisp::Lisp& lisp);
+ void write(lisp::Writer& writer);
+
+ virtual void update(float elapsed_time);
+
+ std::string type() const
+ { return "SnowParticleSystem"; }
+
+private:
+ class SnowParticle : public Particle
+ {
+ public:
+ float speed;
+ };
+
+ Surface* snowimages[3];
+};
+
+class GhostParticleSystem : public ParticleSystem, public Serializable
+{
+public:
+ GhostParticleSystem();
+ virtual ~GhostParticleSystem();
+
+ void parse(const lisp::Lisp& lisp);
+ void write(lisp::Writer& writer);
+
+ virtual void update(float elapsed_time);
+
+ std::string type() const
+ { return "GhostParticleSystem"; }
+
+private:
+ class GhostParticle : public Particle
+ {
+ public:
+ float speed;
+ };
+
+ Surface* ghosts[2];
+};
+
+class CloudParticleSystem : public ParticleSystem, public Serializable
+{
+public:
+ CloudParticleSystem();
+ virtual ~CloudParticleSystem();
+
+ void parse(const lisp::Lisp& lisp);
+ void write(lisp::Writer& writer);
+
+ virtual void update(float elapsed_time);
+
+ std::string type() const
+ { return "SnowParticleSystem"; }
+
+private:
+ class CloudParticle : public Particle
+ {
+ public:
+ float speed;
+ };
+
+ Surface* cloudimage;
+};
+
+#endif
+
#include <iostream>
#include <cmath>
-#include "particlesystem_interactive.h"
-#include "video/drawing_context.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "resources.h"
-#include "main.h"
+#include "particlesystem_interactive.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "resources.hpp"
+#include "main.hpp"
-#include "tile.h"
-#include "tilemap.h"
-#include "math/aatriangle.h"
-#include "collision.h"
-#include "collision_hit.h"
-#include "object/camera.h"
-#include "object/rainsplash.h"
-#include "badguy/bomb.h"
+#include "tile.hpp"
+#include "tilemap.hpp"
+#include "math/aatriangle.hpp"
+#include "collision.hpp"
+#include "collision_hit.hpp"
+#include "object/camera.hpp"
+#include "object/rainsplash.hpp"
+#include "badguy/bomb.hpp"
//TODO: Find a way to make rain collide with objects like bonus blocks
// Add an option to set rain strength
+++ /dev/null
-// $Id: ParticleSystem_Interactive.h 2462 2005-05-10 15:38:16Z wansti $
-//
-// SuperTux
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_PARTICLESYSTEM_INTERACTIVE_H
-#define SUPERTUX_PARTICLESYSTEM_INTERACTIVE_H
-
-#include <vector>
-
-#include "video/surface.h"
-#include "game_object.h"
-#include "serializable.h"
-#include "sector.h"
-#include "math/vector.h"
-
-namespace lisp {
-class Lisp;
-}
-
-class DisplayManager;
-
-/**
- * This is an alternative class for particle systems. It is responsible for storing a
- * set of particles with each having an x- and y-coordinate the number of the
- * layer where it should be drawn and a texture.
- * This version of the particle system class doesn't use virtual screen coordinates,
- * but Interactive ones. Particle systems which need Interactive levels coordinates, such
- * as rain, should be implemented here.
- * Classes that implement a particle system should subclass from this class,
- * initialize particles in the constructor and move them in the simulate
- * function.
- */
-class ParticleSystem_Interactive : public GameObject
-{
-public:
- ParticleSystem_Interactive();
- virtual ~ParticleSystem_Interactive();
-
- virtual void draw(DrawingContext& context);
-
-protected:
- int layer;
-
- class Particle
- {
- public:
- virtual ~Particle()
- { }
-
- Vector pos;
- Surface* texture;
- };
-
- std::vector<Particle*> particles;
- float virtual_width, virtual_height;
- int collision(Particle* particle, Vector movement);
-};
-
-class RainParticleSystem : public ParticleSystem_Interactive, public Serializable
-{
-public:
- RainParticleSystem();
- virtual ~RainParticleSystem();
-
- void parse(const lisp::Lisp& lisp);
- void write(lisp::Writer& writer);
-
- virtual void update(float elapsed_time);
-
- std::string type() const
- { return "RainParticleSystem"; }
-
-private:
- class RainParticle : public Particle
- {
- public:
- float speed;
- };
-
- Surface* rainimages[2];
-};
-
-class CometParticleSystem : public ParticleSystem_Interactive, public Serializable
-{
-public:
- CometParticleSystem();
- virtual ~CometParticleSystem();
-
- void parse(const lisp::Lisp& lisp);
- void write(lisp::Writer& writer);
-
- virtual void update(float elapsed_time);
-
- std::string type() const
- { return "CometParticleSystem"; }
-
-private:
- class CometParticle : public Particle
- {
- public:
- float speed;
- };
-
- Surface* cometimages[2];
-};
-
-#endif
-
--- /dev/null
+// $Id: ParticleSystem_Interactive.h 2462 2005-05-10 15:38:16Z wansti $
+//
+// SuperTux
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_PARTICLESYSTEM_INTERACTIVE_H
+#define SUPERTUX_PARTICLESYSTEM_INTERACTIVE_H
+
+#include <vector>
+
+#include "video/surface.hpp"
+#include "game_object.hpp"
+#include "serializable.hpp"
+#include "sector.hpp"
+#include "math/vector.hpp"
+
+namespace lisp {
+class Lisp;
+}
+
+class DisplayManager;
+
+/**
+ * This is an alternative class for particle systems. It is responsible for storing a
+ * set of particles with each having an x- and y-coordinate the number of the
+ * layer where it should be drawn and a texture.
+ * This version of the particle system class doesn't use virtual screen coordinates,
+ * but Interactive ones. Particle systems which need Interactive levels coordinates, such
+ * as rain, should be implemented here.
+ * Classes that implement a particle system should subclass from this class,
+ * initialize particles in the constructor and move them in the simulate
+ * function.
+ */
+class ParticleSystem_Interactive : public GameObject
+{
+public:
+ ParticleSystem_Interactive();
+ virtual ~ParticleSystem_Interactive();
+
+ virtual void draw(DrawingContext& context);
+
+protected:
+ int layer;
+
+ class Particle
+ {
+ public:
+ virtual ~Particle()
+ { }
+
+ Vector pos;
+ Surface* texture;
+ };
+
+ std::vector<Particle*> particles;
+ float virtual_width, virtual_height;
+ int collision(Particle* particle, Vector movement);
+};
+
+class RainParticleSystem : public ParticleSystem_Interactive, public Serializable
+{
+public:
+ RainParticleSystem();
+ virtual ~RainParticleSystem();
+
+ void parse(const lisp::Lisp& lisp);
+ void write(lisp::Writer& writer);
+
+ virtual void update(float elapsed_time);
+
+ std::string type() const
+ { return "RainParticleSystem"; }
+
+private:
+ class RainParticle : public Particle
+ {
+ public:
+ float speed;
+ };
+
+ Surface* rainimages[2];
+};
+
+class CometParticleSystem : public ParticleSystem_Interactive, public Serializable
+{
+public:
+ CometParticleSystem();
+ virtual ~CometParticleSystem();
+
+ void parse(const lisp::Lisp& lisp);
+ void write(lisp::Writer& writer);
+
+ virtual void update(float elapsed_time);
+
+ std::string type() const
+ { return "CometParticleSystem"; }
+
+private:
+ class CometParticle : public Particle
+ {
+ public:
+ float speed;
+ };
+
+ Surface* cometimages[2];
+};
+
+#endif
+
#include <config.h>
-#include "platform.h"
-#include "video/drawing_context.h"
-#include "resources.h"
-#include "player.h"
-#include "sprite/sprite_manager.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "object_factory.h"
+#include "platform.hpp"
+#include "video/drawing_context.hpp"
+#include "resources.hpp"
+#include "player.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "object_factory.hpp"
Platform::Platform(const lisp::Lisp& reader)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __PLATFORM_H__
-#define __PLATFORM_H__
-
-#include "moving_object.h"
-#include "sprite/sprite.h"
-
-/**
- * This class is the base class for platforms that tux can stand on
- */
-class Platform : public MovingObject
-{
-public:
- Platform(const lisp::Lisp& reader);
- ~Platform();
-
- virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- int state;
- Sprite* sprite;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __PLATFORM_H__
+#define __PLATFORM_H__
+
+#include "moving_object.hpp"
+#include "sprite/sprite.hpp"
+
+/**
+ * This class is the base class for platforms that tux can stand on
+ */
+class Platform : public MovingObject
+{
+public:
+ Platform(const lisp::Lisp& reader);
+ ~Platform();
+
+ virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+private:
+ int state;
+ Sprite* sprite;
+};
+
+#endif
+
#include <iostream>
#include <cassert>
-#include "gettext.h"
-#include "sprite/sprite_manager.h"
-#include "audio/sound_manager.h"
-#include "player.h"
-#include "tile.h"
-#include "sprite/sprite.h"
-#include "sector.h"
-#include "resources.h"
-#include "video/screen.h"
-#include "statistics.h"
-#include "game_session.h"
-#include "object/tilemap.h"
-#include "object/camera.h"
-#include "object/gameobjs.h"
-#include "object/portable.h"
-#include "trigger/trigger_base.h"
-#include "control/joystickkeyboardcontroller.h"
-#include "main.h"
+#include "gettext.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "audio/sound_manager.hpp"
+#include "player.hpp"
+#include "tile.hpp"
+#include "sprite/sprite.hpp"
+#include "sector.hpp"
+#include "resources.hpp"
+#include "video/screen.hpp"
+#include "statistics.hpp"
+#include "game_session.hpp"
+#include "object/tilemap.hpp"
+#include "object/camera.hpp"
+#include "object/gameobjs.hpp"
+#include "object/portable.hpp"
+#include "trigger/trigger_base.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
+#include "main.hpp"
static const int TILES_FOR_BUTTJUMP = 3;
static const float SHOOTING_TIME = .150;
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_PLAYER_H
-#define SUPERTUX_PLAYER_H
-
-#include <vector>
-#include "SDL.h"
-
-#include "timer.h"
-#include "direction.h"
-#include "video/surface.h"
-#include "moving_object.h"
-#include "sprite/sprite.h"
-#include "physic.h"
-#include "control/controller.h"
-#include "player_status.h"
-
-class BadGuy;
-class Portable;
-
-/* Times: */
-static const float TUX_SAFE_TIME = 1.8;
-static const float TUX_INVINCIBLE_TIME = 10.0;
-static const float TUX_INVINCIBLE_TIME_WARNING = 2.0;
-static const float TUX_FLAPPING_TIME = 1; /* How long Tux can flap his wings to gain additional jump height */
-static const float TUX_FLAPPING_STRENGTH = 100; /* How much Y velocity Tux gains when flapping */
-static const float TUX_FLAPPING_LEAST_X = 30; /* How much X velocity Tux gains when flapping from vertical jump */
-static const float GROWING_TIME = 1.0;
-static const int GROWING_FRAMES = 7;
-
-class Camera;
-class PlayerStatus;
-
-extern Surface* growingtux_left[GROWING_FRAMES];
-extern Surface* growingtux_right[GROWING_FRAMES];
-
-class TuxBodyParts
-{
-public:
- TuxBodyParts()
- : head(0), body(0), arms(0), feet(0)
- { }
- ~TuxBodyParts() {
- delete head;
- delete body;
- delete arms;
- delete feet;
- }
-
- void set_action(std::string action, int loops = -1);
- void one_time_animation();
- void draw(DrawingContext& context, const Vector& pos, int layer);
-
- Sprite* head;
- Sprite* body;
- Sprite* arms;
- Sprite* feet;
-};
-
-extern TuxBodyParts* small_tux;
-extern TuxBodyParts* big_tux;
-extern TuxBodyParts* fire_tux;
-extern TuxBodyParts* ice_tux;
-
-class Player : public MovingObject
-{
-public:
- enum HurtMode { KILL, SHRINK };
- enum FallMode { ON_GROUND, JUMPING, TRAMPOLINE_JUMP, FALLING };
-
- Controller* controller;
- PlayerStatus* player_status;
- bool duck;
- bool dead;
-
-private:
- bool dying;
-public:
-
- Direction dir;
- Direction old_dir;
-
- float last_ground_y;
- FallMode fall_mode;
-
- bool on_ground_flag;
- bool jumping;
- bool flapping;
- bool can_jump;
- bool can_flap;
- bool falling_from_flap;
- bool enable_hover;
- bool butt_jump;
-
- float flapping_velocity;
-
- // Ricardo's flapping
- int flaps_nb;
-
- // temporary to help player's choosing a flapping
- // TODO: remove this after agreeing on flapstyle!
- enum { MAREK_FLAP, RICARDO_FLAP, RYAN_FLAP, NO_FLAP };
- int flapping_mode;
-
- Timer invincible_timer;
- Timer skidding_timer;
- Timer safe_timer;
- Timer kick_timer;
- Timer shooting_timer; // used to show the arm when Tux is shooting
- Timer dying_timer;
- Timer growing_timer;
- Timer idle_timer;
- Timer flapping_timer;
- Physic physic;
-
-public:
- Player(PlayerStatus* player_status);
- virtual ~Player();
-
- void set_controller(Controller* controller);
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
- virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
- void make_invincible();
- bool is_invincible() const
- {
- return invincible_timer.started();
- }
- bool is_dying() const
- {
- return dying;
- }
-
- void kill(HurtMode mode);
- void check_bounds(Camera* camera);
- void move(const Vector& vector);
- void set_bonus(BonusType type, bool animate = false);
- PlayerStatus* get_status()
- {
- return player_status;
- }
-
- void bounce(BadGuy& badguy);
-
- bool is_dead() const
- { return dead; }
- bool is_big();
-
-private:
- void handle_input();
- bool on_ground();
-
- void init();
-
- void handle_horizontal_input();
- void handle_vertical_input();
-
- Portable* grabbed_object;
-
- Sprite* smalltux_gameover;
- Sprite* smalltux_star;
- Sprite* bigtux_star;
-};
-
-#endif /*SUPERTUX_PLAYER_H*/
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_PLAYER_H
+#define SUPERTUX_PLAYER_H
+
+#include <vector>
+#include <SDL.h>
+
+#include "timer.hpp"
+#include "direction.hpp"
+#include "video/surface.hpp"
+#include "moving_object.hpp"
+#include "sprite/sprite.hpp"
+#include "physic.hpp"
+#include "control/controller.hpp"
+#include "player_status.hpp"
+
+class BadGuy;
+class Portable;
+
+/* Times: */
+static const float TUX_SAFE_TIME = 1.8;
+static const float TUX_INVINCIBLE_TIME = 10.0;
+static const float TUX_INVINCIBLE_TIME_WARNING = 2.0;
+static const float TUX_FLAPPING_TIME = 1; /* How long Tux can flap his wings to gain additional jump height */
+static const float TUX_FLAPPING_STRENGTH = 100; /* How much Y velocity Tux gains when flapping */
+static const float TUX_FLAPPING_LEAST_X = 30; /* How much X velocity Tux gains when flapping from vertical jump */
+static const float GROWING_TIME = 1.0;
+static const int GROWING_FRAMES = 7;
+
+class Camera;
+class PlayerStatus;
+
+extern Surface* growingtux_left[GROWING_FRAMES];
+extern Surface* growingtux_right[GROWING_FRAMES];
+
+class TuxBodyParts
+{
+public:
+ TuxBodyParts()
+ : head(0), body(0), arms(0), feet(0)
+ { }
+ ~TuxBodyParts() {
+ delete head;
+ delete body;
+ delete arms;
+ delete feet;
+ }
+
+ void set_action(std::string action, int loops = -1);
+ void one_time_animation();
+ void draw(DrawingContext& context, const Vector& pos, int layer);
+
+ Sprite* head;
+ Sprite* body;
+ Sprite* arms;
+ Sprite* feet;
+};
+
+extern TuxBodyParts* small_tux;
+extern TuxBodyParts* big_tux;
+extern TuxBodyParts* fire_tux;
+extern TuxBodyParts* ice_tux;
+
+class Player : public MovingObject
+{
+public:
+ enum HurtMode { KILL, SHRINK };
+ enum FallMode { ON_GROUND, JUMPING, TRAMPOLINE_JUMP, FALLING };
+
+ Controller* controller;
+ PlayerStatus* player_status;
+ bool duck;
+ bool dead;
+
+private:
+ bool dying;
+public:
+
+ Direction dir;
+ Direction old_dir;
+
+ float last_ground_y;
+ FallMode fall_mode;
+
+ bool on_ground_flag;
+ bool jumping;
+ bool flapping;
+ bool can_jump;
+ bool can_flap;
+ bool falling_from_flap;
+ bool enable_hover;
+ bool butt_jump;
+
+ float flapping_velocity;
+
+ // Ricardo's flapping
+ int flaps_nb;
+
+ // temporary to help player's choosing a flapping
+ // TODO: remove this after agreeing on flapstyle!
+ enum { MAREK_FLAP, RICARDO_FLAP, RYAN_FLAP, NO_FLAP };
+ int flapping_mode;
+
+ Timer invincible_timer;
+ Timer skidding_timer;
+ Timer safe_timer;
+ Timer kick_timer;
+ Timer shooting_timer; // used to show the arm when Tux is shooting
+ Timer dying_timer;
+ Timer growing_timer;
+ Timer idle_timer;
+ Timer flapping_timer;
+ Physic physic;
+
+public:
+ Player(PlayerStatus* player_status);
+ virtual ~Player();
+
+ void set_controller(Controller* controller);
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+ virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+ void make_invincible();
+ bool is_invincible() const
+ {
+ return invincible_timer.started();
+ }
+ bool is_dying() const
+ {
+ return dying;
+ }
+
+ void kill(HurtMode mode);
+ void check_bounds(Camera* camera);
+ void move(const Vector& vector);
+ void set_bonus(BonusType type, bool animate = false);
+ PlayerStatus* get_status()
+ {
+ return player_status;
+ }
+
+ void bounce(BadGuy& badguy);
+
+ bool is_dead() const
+ { return dead; }
+ bool is_big();
+
+private:
+ void handle_input();
+ bool on_ground();
+
+ void init();
+
+ void handle_horizontal_input();
+ void handle_vertical_input();
+
+ Portable* grabbed_object;
+
+ Sprite* smalltux_gameover;
+ Sprite* smalltux_star;
+ Sprite* bigtux_star;
+};
+
+#endif /*SUPERTUX_PLAYER_H*/
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __PORTABLE_H__
-#define __PORTABLE_H__
-
-#include "moving_object.h"
-
-/**
- * An object that inherits from this object is considered "portable" and can
- * be carried around by the player.
- * The object has to additionally set the PORTABLE flag (this allows to
- * make the object only temporarily portable by resetting the flag)
- */
-class Portable
-{
-public:
- virtual ~Portable()
- { }
-
- /**
- * called each frame when the object has been grabbed.
- */
- virtual void grab(MovingObject& object, const Vector& pos) = 0;
-
- /** called when object isn't grabbed anymore */
- virtual void ungrab(MovingObject& object)
- {
- (void) object;
- }
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __PORTABLE_H__
+#define __PORTABLE_H__
+
+#include "moving_object.hpp"
+
+/**
+ * An object that inherits from this object is considered "portable" and can
+ * be carried around by the player.
+ * The object has to additionally set the PORTABLE flag (this allows to
+ * make the object only temporarily portable by resetting the flag)
+ */
+class Portable
+{
+public:
+ virtual ~Portable()
+ { }
+
+ /**
+ * called each frame when the object has been grabbed.
+ */
+ virtual void grab(MovingObject& object, const Vector& pos) = 0;
+
+ /** called when object isn't grabbed anymore */
+ virtual void ungrab(MovingObject& object)
+ {
+ (void) object;
+ }
+};
+
+#endif
#include <config.h>
#include <math.h>
-#include "powerup.h"
-#include "resources.h"
-#include "player.h"
-#include "sprite/sprite_manager.h"
-#include "audio/sound_manager.h"
-#include "object_factory.h"
-#include "sector.h"
-#include "scripting/script_interpreter.h"
+#include "powerup.hpp"
+#include "resources.hpp"
+#include "player.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "audio/sound_manager.hpp"
+#include "object_factory.hpp"
+#include "sector.hpp"
+#include "scripting/script_interpreter.hpp"
PowerUp::PowerUp(const lisp::Lisp& lisp)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __POWERUP_H__
-#define __POWERUP_H__
-
-#include "moving_object.h"
-#include "lisp/lisp.h"
-#include "sprite/sprite.h"
-#include "collision_hit.h"
-#include "physic.h"
-
-class PowerUp : public MovingObject
-{
-public:
- PowerUp(const lisp::Lisp& lisp);
- ~PowerUp();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
- virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Sprite* sprite;
- Physic physic;
- std::string script;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __POWERUP_H__
+#define __POWERUP_H__
+
+#include "moving_object.hpp"
+#include "lisp/lisp.hpp"
+#include "sprite/sprite.hpp"
+#include "collision_hit.hpp"
+#include "physic.hpp"
+
+class PowerUp : public MovingObject
+{
+public:
+ PowerUp(const lisp::Lisp& lisp);
+ ~PowerUp();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+ virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+private:
+ Sprite* sprite;
+ Physic physic;
+ std::string script;
+};
+
+#endif
+
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
-#include "rainsplash.h"
-#include "sector.h"
+#include "rainsplash.hpp"
+#include "sector.hpp"
RainSplash::RainSplash(Vector pos, bool vertical)
{
+++ /dev/null
-// SuperTux
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __RAINSPLASH_H__
-#define __RAINSPLASH_H__
-
-
-#include "game_object.h"
-#include "resources.h"
-#include "player.h"
-#include "sprite/sprite.h"
-#include "sprite/sprite_manager.h"
-#include "video/drawing_context.h"
-
-class RainSplash : public GameObject
-{
-public:
- RainSplash(Vector pos, bool vertical);
- ~RainSplash();
-protected:
- virtual void hit(Player& );
- virtual void update(float time);
- virtual void draw(DrawingContext& context);
-private:
- Sprite* sprite;
- Vector position;
- int frame;
-};
-
-#endif
-
--- /dev/null
+// SuperTux
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __RAINSPLASH_H__
+#define __RAINSPLASH_H__
+
+
+#include "game_object.hpp"
+#include "resources.hpp"
+#include "player.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
+
+class RainSplash : public GameObject
+{
+public:
+ RainSplash(Vector pos, bool vertical);
+ ~RainSplash();
+protected:
+ virtual void hit(Player& );
+ virtual void update(float time);
+ virtual void draw(DrawingContext& context);
+private:
+ Sprite* sprite;
+ Vector position;
+ int frame;
+};
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "rock.h"
-#include "sprite/sprite.h"
-#include "sprite/sprite_manager.h"
-#include "lisp/writer.h"
-#include "video/drawing_context.h"
-#include "resources.h"
-#include "object_factory.h"
+#include "rock.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "lisp/writer.hpp"
+#include "video/drawing_context.hpp"
+#include "resources.hpp"
+#include "object_factory.hpp"
Rock::Rock(const lisp::Lisp& reader)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __ROCK_H__
-#define __ROCK_H__
-
-#include "moving_object.h"
-#include "physic.h"
-#include "lisp/lisp.h"
-#include "portable.h"
-#include "serializable.h"
-
-class Sprite;
-
-class Rock : public MovingObject, public Portable, public Serializable
-{
-public:
- Rock(const lisp::Lisp& reader);
- virtual ~Rock();
-
- HitResponse collision(GameObject& other, const CollisionHit& hit);
- void update(float elapsed_time);
- void draw(DrawingContext& context);
- void write(lisp::Writer& writer);
-
- void grab(MovingObject& object, const Vector& pos);
-
-private:
- bool grabbed;
- Sprite* sprite;
- Physic physic;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __ROCK_H__
+#define __ROCK_H__
+
+#include "moving_object.hpp"
+#include "physic.hpp"
+#include "lisp/lisp.hpp"
+#include "portable.hpp"
+#include "serializable.hpp"
+
+class Sprite;
+
+class Rock : public MovingObject, public Portable, public Serializable
+{
+public:
+ Rock(const lisp::Lisp& reader);
+ virtual ~Rock();
+
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+ void write(lisp::Writer& writer);
+
+ void grab(MovingObject& object, const Vector& pos);
+
+private:
+ bool grabbed;
+ Sprite* sprite;
+ Physic physic;
+};
+
+#endif
#include <stdexcept>
-#include "scripted_object.h"
-#include "video/drawing_context.h"
-#include "sprite/sprite_manager.h"
-#include "resources.h"
-#include "object_factory.h"
-#include "math/vector.h"
+#include "scripted_object.hpp"
+#include "video/drawing_context.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "resources.hpp"
+#include "object_factory.hpp"
+#include "math/vector.hpp"
ScriptedObject::ScriptedObject(const lisp::Lisp& lisp)
: solid(true), physic_enabled(true), visible(true), new_vel_set(false)
+++ /dev/null
-#ifndef __SCRIPTED_OBJECT_H__
-#define __SCRIPTED_OBJECT_H__
-
-#include <string>
-#include "physic.h"
-#include "sprite/sprite.h"
-#include "lisp/lisp.h"
-#include "moving_object.h"
-#include "scripting/scripted_object.h"
-
-class ScriptedObject : public MovingObject, public Scripting::ScriptedObject
-{
-public:
- ScriptedObject(const lisp::Lisp& lisp);
- virtual ~ScriptedObject();
-
- void update(float elapsed_time);
- void draw(DrawingContext& context);
- HitResponse collision(GameObject& other, const CollisionHit& hit);
-
- // --- Scripting Interface stuff ---
-
- void set_animation(const std::string& animation);
- std::string get_animation();
-
- void move(float x, float y);
- void set_pos(float x, float y);
- float get_pos_x();
- float get_pos_y();
- void set_velocity(float x, float y);
- float get_velocity_x();
- float get_velocity_y();
- void set_visible(bool visible);
- bool is_visible();
-
- std::string get_name();
-
-private:
- std::string name;
- bool solid;
- bool physic_enabled;
- bool visible;
- bool new_vel_set;
- Vector new_vel;
- Physic physic;
- Sprite* sprite;
-};
-
-#endif
-
--- /dev/null
+#ifndef __SCRIPTED_OBJECT_H__
+#define __SCRIPTED_OBJECT_H__
+
+#include <string>
+#include "physic.hpp"
+#include "sprite/sprite.hpp"
+#include "lisp/lisp.hpp"
+#include "moving_object.hpp"
+#include "scripting/scripted_object.hpp"
+
+class ScriptedObject : public MovingObject, public Scripting::ScriptedObject
+{
+public:
+ ScriptedObject(const lisp::Lisp& lisp);
+ virtual ~ScriptedObject();
+
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+ // --- Scripting Interface stuff ---
+
+ void set_animation(const std::string& animation);
+ std::string get_animation();
+
+ void move(float x, float y);
+ void set_pos(float x, float y);
+ float get_pos_x();
+ float get_pos_y();
+ void set_velocity(float x, float y);
+ float get_velocity_x();
+ float get_velocity_y();
+ void set_visible(bool visible);
+ bool is_visible();
+
+ std::string get_name();
+
+private:
+ std::string name;
+ bool solid;
+ bool physic_enabled;
+ bool visible;
+ bool new_vel_set;
+ Vector new_vel;
+ Physic physic;
+ Sprite* sprite;
+};
+
+#endif
+
#include <config.h>
#include <math.h>
-#include "specialriser.h"
-#include "resources.h"
-#include "camera.h"
-#include "sector.h"
-#include "sprite/sprite_manager.h"
+#include "specialriser.hpp"
+#include "resources.hpp"
+#include "camera.hpp"
+#include "sector.hpp"
+#include "sprite/sprite_manager.hpp"
SpecialRiser::SpecialRiser(Vector pos, MovingObject* _child)
: child(_child)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __SPECIALRISE_H__
-#define __SPECIALRISE_H__
-
-#include "moving_object.h"
-
-/**
- * special object that contains another object and slowly rises it out of a
- * bonus block.
- */
-class SpecialRiser : public GameObject
-{
-public:
- SpecialRiser(Vector pos, MovingObject* child);
- ~SpecialRiser();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- float offset;
- MovingObject* child;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __SPECIALRISE_H__
+#define __SPECIALRISE_H__
+
+#include "moving_object.hpp"
+
+/**
+ * special object that contains another object and slowly rises it out of a
+ * bonus block.
+ */
+class SpecialRiser : public GameObject
+{
+public:
+ SpecialRiser(Vector pos, MovingObject* child);
+ ~SpecialRiser();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+private:
+ float offset;
+ MovingObject* child;
+};
+
+#endif
+
#include <config.h>
-#include "star.h"
-#include "resources.h"
-#include "player.h"
-#include "player_status.h"
-#include "sprite/sprite_manager.h"
-#include "video/drawing_context.h"
+#include "star.hpp"
+#include "resources.hpp"
+#include "player.hpp"
+#include "player_status.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
static const float INITIALJUMP = 400;
static const float SPEED = 150;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __STAR_H__
-#define __STAR_H__
-
-#include "moving_object.h"
-#include "sprite/sprite.h"
-#include "physic.h"
-
-class Star : public MovingObject
-{
-public:
- Star(const Vector& pos);
- ~Star();
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
- virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Sprite* sprite;
- Physic physic;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __STAR_H__
+#define __STAR_H__
+
+#include "moving_object.hpp"
+#include "sprite/sprite.hpp"
+#include "physic.hpp"
+
+class Star : public MovingObject
+{
+public:
+ Star(const Vector& pos);
+ ~Star();
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+ virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+private:
+ Sprite* sprite;
+ Physic physic;
+};
+
+#endif
#include <config.h>
-#include "text_object.h"
-#include "resources.h"
-#include "video/drawing_context.h"
+#include "text_object.hpp"
+#include "resources.hpp"
+#include "video/drawing_context.hpp"
TextObject::TextObject()
: fading(0), fadetime(0), visible(false)
+++ /dev/null
-#ifndef __TEXTOBJECT_H__
-#define __TEXTOBJECT_H__
-
-#include "game_object.h"
-#include "scripting/text.h"
-
-class Font;
-
-/** A text object intended for scripts that want to tell a story */
-class TextObject : public GameObject, public Scripting::Text
-{
-public:
- TextObject();
- virtual ~TextObject();
-
- void set_text(const std::string& text);
- void set_font(const std::string& name);
- void fade_in(float fadetime);
- void fade_out(float fadetime);
- void set_visible(bool visible);
- bool is_visible();
-
- void draw(DrawingContext& context);
- void update(float elapsed_time);
-
-private:
- Font* font;
- std::string text;
- float fading;
- float fadetime;
- bool visible;
-};
-
-#endif
-
--- /dev/null
+#ifndef __TEXTOBJECT_H__
+#define __TEXTOBJECT_H__
+
+#include "game_object.hpp"
+#include "scripting/text.hpp"
+
+class Font;
+
+/** A text object intended for scripts that want to tell a story */
+class TextObject : public GameObject, public Scripting::Text
+{
+public:
+ TextObject();
+ virtual ~TextObject();
+
+ void set_text(const std::string& text);
+ void set_font(const std::string& name);
+ void fade_in(float fadetime);
+ void fade_out(float fadetime);
+ void set_visible(bool visible);
+ bool is_visible();
+
+ void draw(DrawingContext& context);
+ void update(float elapsed_time);
+
+private:
+ Font* font;
+ std::string text;
+ float fading;
+ float fadetime;
+ bool visible;
+};
+
+#endif
+
#include <stdexcept>
#include <cmath>
-#include "tilemap.h"
-#include "video/drawing_context.h"
-#include "level.h"
-#include "tile.h"
-#include "resources.h"
-#include "tile_manager.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "object_factory.h"
-#include "main.h"
+#include "tilemap.hpp"
+#include "video/drawing_context.hpp"
+#include "level.hpp"
+#include "tile.hpp"
+#include "resources.hpp"
+#include "tile_manager.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "object_factory.hpp"
+#include "main.hpp"
TileMap::TileMap()
: solid(false), speed(1), width(0), height(0), layer(LAYER_TILES),
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_TILEMAP_H
-#define SUPERTUX_TILEMAP_H
-
-#include <vector>
-#include <stdint.h>
-
-#include "game_object.h"
-#include "serializable.h"
-#include "math/vector.h"
-
-namespace lisp {
-class Lisp;
-}
-
-class Level;
-class TileManager;
-class Tile;
-
-/**
- * This class is reponsible for drawing the level tiles
- */
-class TileMap : public GameObject, public Serializable
-{
-public:
- TileMap();
- TileMap(const lisp::Lisp& reader, TileManager* tile_manager = 0);
- TileMap(int layer_, bool solid_, size_t width_, size_t height_);
- virtual ~TileMap();
-
- virtual void write(lisp::Writer& writer);
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
- void set(int width, int height, const std::vector<unsigned int>& vec,
- int layer, bool solid);
-
- /** resizes the tilemap to a new width and height (tries to not destroy the
- * existing map)
- */
- void resize(int newwidth, int newheight);
-
- size_t get_width() const
- { return width; }
-
- size_t get_height() const
- { return height; }
-
- int get_layer() const
- { return layer; }
-
- bool is_solid() const
- { return solid; }
-
- /// returns tile in row y and column y (of the tilemap)
- const Tile* get_tile(int x, int y) const;
- /// returns tile at position pos (in world coordinates)
- const Tile* get_tile_at(const Vector& pos) const;
-
- void change(int x, int y, uint32_t newtile);
-
- void change_at(const Vector& pos, uint32_t newtile);
-
- TileManager* get_tilemanager() const
- {
- return tilemanager;
- }
-
- void set_drawing_effect(int effect)
- {
- drawing_effect = effect;
- }
-
- int get_drawing_effect()
- {
- return drawing_effect;
- }
-
-private:
- typedef std::vector<uint32_t> Tiles;
- Tiles tiles;
-
-private:
- TileManager* tilemanager;
- bool solid;
- float speed;
- int width, height;
- int layer;
-
- int drawing_effect;
-};
-
-#endif /*SUPERTUX_TILEMAP_H*/
-
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_TILEMAP_H
+#define SUPERTUX_TILEMAP_H
+
+#include <vector>
+#include <stdint.h>
+
+#include "game_object.hpp"
+#include "serializable.hpp"
+#include "math/vector.hpp"
+
+namespace lisp {
+class Lisp;
+}
+
+class Level;
+class TileManager;
+class Tile;
+
+/**
+ * This class is reponsible for drawing the level tiles
+ */
+class TileMap : public GameObject, public Serializable
+{
+public:
+ TileMap();
+ TileMap(const lisp::Lisp& reader, TileManager* tile_manager = 0);
+ TileMap(int layer_, bool solid_, size_t width_, size_t height_);
+ virtual ~TileMap();
+
+ virtual void write(lisp::Writer& writer);
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+
+ void set(int width, int height, const std::vector<unsigned int>& vec,
+ int layer, bool solid);
+
+ /** resizes the tilemap to a new width and height (tries to not destroy the
+ * existing map)
+ */
+ void resize(int newwidth, int newheight);
+
+ size_t get_width() const
+ { return width; }
+
+ size_t get_height() const
+ { return height; }
+
+ int get_layer() const
+ { return layer; }
+
+ bool is_solid() const
+ { return solid; }
+
+ /// returns tile in row y and column y (of the tilemap)
+ const Tile* get_tile(int x, int y) const;
+ /// returns tile at position pos (in world coordinates)
+ const Tile* get_tile_at(const Vector& pos) const;
+
+ void change(int x, int y, uint32_t newtile);
+
+ void change_at(const Vector& pos, uint32_t newtile);
+
+ TileManager* get_tilemanager() const
+ {
+ return tilemanager;
+ }
+
+ void set_drawing_effect(int effect)
+ {
+ drawing_effect = effect;
+ }
+
+ int get_drawing_effect()
+ {
+ return drawing_effect;
+ }
+
+private:
+ typedef std::vector<uint32_t> Tiles;
+ Tiles tiles;
+
+private:
+ TileManager* tilemanager;
+ bool solid;
+ float speed;
+ int width, height;
+ int layer;
+
+ int drawing_effect;
+};
+
+#endif /*SUPERTUX_TILEMAP_H*/
+
#include <config.h>
-#include "unstable_tile.h"
-#include "lisp/lisp.h"
-#include "object_factory.h"
-#include "player.h"
-#include "sector.h"
-#include "resources.h"
-#include "sprite/sprite_manager.h"
-#include "sprite/sprite.h"
+#include "unstable_tile.hpp"
+#include "lisp/lisp.hpp"
+#include "object_factory.hpp"
+#include "player.hpp"
+#include "sector.hpp"
+#include "resources.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "sprite/sprite.hpp"
static const float CRACKTIME = 0.3;
static const float FALLTIME = 0.8;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __UNSTABLE_TILE_H__
-#define __UNSTABLE_TILE_H__
-
-#include "moving_object.h"
-#include "lisp/lisp.h"
-#include "physic.h"
-#include "timer.h"
-
-class Sprite;
-class Player;
-
-/** A tile that starts falling down if tux stands to long on it */
-class UnstableTile : public MovingObject
-{
-public:
- UnstableTile(const lisp::Lisp& lisp);
- ~UnstableTile();
-
- HitResponse collision(GameObject& other, const CollisionHit& hit);
- void update(float elapsed_time);
- void draw(DrawingContext& context);
-
-private:
- Physic physic;
- Sprite* sprite;
- Timer timer;
- bool hit;
- bool falling;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __UNSTABLE_TILE_H__
+#define __UNSTABLE_TILE_H__
+
+#include "moving_object.hpp"
+#include "lisp/lisp.hpp"
+#include "physic.hpp"
+#include "timer.hpp"
+
+class Sprite;
+class Player;
+
+/** A tile that starts falling down if tux stands to long on it */
+class UnstableTile : public MovingObject
+{
+public:
+ UnstableTile(const lisp::Lisp& lisp);
+ ~UnstableTile();
+
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+
+private:
+ Physic physic;
+ Sprite* sprite;
+ Timer timer;
+ bool hit;
+ bool falling;
+};
+
+#endif
+
#include <sstream>
#include <stdexcept>
-#include "lisp/lisp.h"
-#include "lisp/parser.h"
-#include "object_factory.h"
+#include "lisp/lisp.hpp"
+#include "lisp/parser.hpp"
+#include "object_factory.hpp"
Factories* object_factories = 0;
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef OBJECT_FACTORY_H
-#define OBJECT_FACTORY_H
-
-#include <string>
-#include <map>
-
-#include "lisp/lisp.h"
-#include "game_object.h"
-#include "math/vector.h"
-
-class Factory
-{
-public:
- virtual ~Factory()
- { }
-
- /** Creates a new gameobject from a lisp node.
- * Remember to delete the objects later
- */
- virtual GameObject* create_object(const lisp::Lisp& reader) = 0;
-};
-
-typedef std::map<std::string, Factory*> Factories;
-extern Factories* object_factories;
-
-GameObject* create_object(const std::string& name, const lisp::Lisp& reader);
-GameObject* create_object(const std::string& name, const Vector& pos);
-
-/** comment from Matze:
- * Yes I know macros are evil, but in this specific case they save
- * A LOT of typing and evil code duplication.
- * I'll happily accept alternatives if someone can present me one that does
- * not involve typing 4 or more lines for each object class
- */
-#define IMPLEMENT_FACTORY(CLASS, NAME) \
-class INTERN_##CLASS##Factory : public Factory \
-{ \
-public: \
- INTERN_##CLASS##Factory() \
- { \
- if(object_factories == 0) \
- object_factories = new Factories; \
- \
- object_factories->insert(std::make_pair(NAME, this)); \
- } \
- \
- virtual GameObject* create_object(const lisp::Lisp& reader) \
- { \
- return new CLASS(reader); \
- } \
-}; \
-static INTERN_##CLASS##Factory factory_##CLASS;
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef OBJECT_FACTORY_H
+#define OBJECT_FACTORY_H
+
+#include <string>
+#include <map>
+
+#include "lisp/lisp.hpp"
+#include "game_object.hpp"
+#include "math/vector.hpp"
+
+class Factory
+{
+public:
+ virtual ~Factory()
+ { }
+
+ /** Creates a new gameobject from a lisp node.
+ * Remember to delete the objects later
+ */
+ virtual GameObject* create_object(const lisp::Lisp& reader) = 0;
+};
+
+typedef std::map<std::string, Factory*> Factories;
+extern Factories* object_factories;
+
+GameObject* create_object(const std::string& name, const lisp::Lisp& reader);
+GameObject* create_object(const std::string& name, const Vector& pos);
+
+/** comment from Matze:
+ * Yes I know macros are evil, but in this specific case they save
+ * A LOT of typing and evil code duplication.
+ * I'll happily accept alternatives if someone can present me one that does
+ * not involve typing 4 or more lines for each object class
+ */
+#define IMPLEMENT_FACTORY(CLASS, NAME) \
+class INTERN_##CLASS##Factory : public Factory \
+{ \
+public: \
+ INTERN_##CLASS##Factory() \
+ { \
+ if(object_factories == 0) \
+ object_factories = new Factories; \
+ \
+ object_factories->insert(std::make_pair(NAME, this)); \
+ } \
+ \
+ virtual GameObject* create_object(const lisp::Lisp& reader) \
+ { \
+ return new CLASS(reader); \
+ } \
+}; \
+static INTERN_##CLASS##Factory factory_##CLASS;
+
+#endif
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __OBJECT_REMOVE_LISTENER_H__
-#define __OBJECT_REMOVE_LISTENER_H__
-
-class GameObject;
-
-class ObjectRemoveListener
-{
-public:
- virtual ~ObjectRemoveListener()
- {}
-
- virtual void object_removed(GameObject* object) = 0;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __OBJECT_REMOVE_LISTENER_H__
+#define __OBJECT_REMOVE_LISTENER_H__
+
+class GameObject;
+
+class ObjectRemoveListener
+{
+public:
+ virtual ~ObjectRemoveListener()
+ {}
+
+ virtual void object_removed(GameObject* object) = 0;
+};
+
+#endif
+
*/
#include <config.h>
-#include "physfs_sdl.h"
+#include "physfs_sdl.hpp"
#include <physfs.h>
+++ /dev/null
-/*
-Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-#ifndef __PHYSFSSDL_HPP__
-#define __PHYSFSSDL_HPP__
-
-#include <SDL.h>
-#include <string>
-
-SDL_RWops* get_physfs_SDLRWops(const std::string& filename);
-
-#endif
-
--- /dev/null
+/*
+Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#ifndef __PHYSFSSDL_HPP__
+#define __PHYSFSSDL_HPP__
+
+#include <SDL.h>
+#include <string>
+
+SDL_RWops* get_physfs_SDLRWops(const std::string& filename);
+
+#endif
+
*/
#include <config.h>
-#include "physfs_stream.h"
+#include "physfs_stream.hpp"
#include <assert.h>
#include <physfs.h>
+++ /dev/null
-/*
-Copyright (C) 2004 by Matthias Braun <matze@braunis.de>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-#ifndef __PHYSFSSTREAM_HPP__
-#define __PHYSFSSTREAM_HPP__
-
-#include <physfs.h>
-#include <string>
-#include <streambuf>
-#include <iostream>
-
-/** This class implements a C++ streambuf object for physfs files.
- * So that you can use normal istream operations on them
- */
-class IFileStreambuf : public std::streambuf
-{
-public:
- IFileStreambuf(const std::string& filename);
- ~IFileStreambuf();
-
-protected:
- virtual int underflow();
- virtual pos_type seekoff(off_type pos, std::ios_base::seekdir,
- std::ios_base::openmode);
- virtual pos_type seekpos(pos_type pos, std::ios_base::openmode);
-
-private:
- PHYSFS_file* file;
- char buf[1024];
-};
-
-class OFileStreambuf : public std::streambuf
-{
-public:
- OFileStreambuf(const std::string& filename);
- ~OFileStreambuf();
-
-protected:
- virtual int overflow(int c);
- virtual int sync();
-
-private:
- PHYSFS_file* file;
- char buf[1024];
-};
-
-class IFileStream : public std::istream
-{
-public:
- IFileStream(const std::string& filename);
- ~IFileStream();
-};
-
-class OFileStream : public std::ostream
-{
-public:
- OFileStream(const std::string& filename);
- ~OFileStream();
-};
-
-#endif
-
--- /dev/null
+/*
+Copyright (C) 2004 by Matthias Braun <matze@braunis.de>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#ifndef __PHYSFSSTREAM_HPP__
+#define __PHYSFSSTREAM_HPP__
+
+#include <physfs.h>
+#include <string>
+#include <streambuf>
+#include <iostream>
+
+/** This class implements a C++ streambuf object for physfs files.
+ * So that you can use normal istream operations on them
+ */
+class IFileStreambuf : public std::streambuf
+{
+public:
+ IFileStreambuf(const std::string& filename);
+ ~IFileStreambuf();
+
+protected:
+ virtual int underflow();
+ virtual pos_type seekoff(off_type pos, std::ios_base::seekdir,
+ std::ios_base::openmode);
+ virtual pos_type seekpos(pos_type pos, std::ios_base::openmode);
+
+private:
+ PHYSFS_file* file;
+ char buf[1024];
+};
+
+class OFileStreambuf : public std::streambuf
+{
+public:
+ OFileStreambuf(const std::string& filename);
+ ~OFileStreambuf();
+
+protected:
+ virtual int overflow(int c);
+ virtual int sync();
+
+private:
+ PHYSFS_file* file;
+ char buf[1024];
+};
+
+class IFileStream : public std::istream
+{
+public:
+ IFileStream(const std::string& filename);
+ ~IFileStream();
+};
+
+class OFileStream : public std::ostream
+{
+public:
+ OFileStream(const std::string& filename);
+ ~OFileStream();
+};
+
+#endif
+
// 02111-1307, USA.
#include <config.h>
-#include "physic.h"
+#include "physic.hpp"
Physic::Physic()
: ax(0), ay(0), vx(0), vy(0), gravity_enabled(true)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef SUPERTUX_PHYSIC_H
-#define SUPERTUX_PHYSIC_H
-
-#include "math/vector.h"
-
-/// Physics engine.
-/** This is a very simplistic physics engine handling accelerated and constant
- * movement along with gravity.
- */
-class Physic
-{
-public:
- Physic();
- ~Physic();
-
- /// Resets all velocities and accelerations to 0.
- void reset();
-
- /// Sets velocity to a fixed value.
- void set_velocity(float vx, float vy);
-
- void set_velocity_x(float vx);
- void set_velocity_y(float vy);
-
- /// Velocities invertion.
- void inverse_velocity_x();
- void inverse_velocity_y();
-
- float get_velocity_x();
- float get_velocity_y();
-
- /// Set acceleration.
- /** Sets acceleration applied to the object. (Note that gravity is
- * eventually added to the vertical acceleration)
- */
- void set_acceleration(float ax, float ay);
-
- void set_acceleration_x(float ax);
- void set_acceleration_y(float ay);
-
- float get_acceleration_x();
- float get_acceleration_y();
-
- /// Enables or disables handling of gravity.
- void enable_gravity(bool gravity_enabled);
-
- Vector get_movement(float elapsed_time);
-
-private:
- /// horizontal and vertical acceleration
- float ax, ay;
- /// horizontal and vertical velocity
- float vx, vy;
- /// should we respect gravity in out calculations?
- bool gravity_enabled;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef SUPERTUX_PHYSIC_H
+#define SUPERTUX_PHYSIC_H
+
+#include "math/vector.hpp"
+
+/// Physics engine.
+/** This is a very simplistic physics engine handling accelerated and constant
+ * movement along with gravity.
+ */
+class Physic
+{
+public:
+ Physic();
+ ~Physic();
+
+ /// Resets all velocities and accelerations to 0.
+ void reset();
+
+ /// Sets velocity to a fixed value.
+ void set_velocity(float vx, float vy);
+
+ void set_velocity_x(float vx);
+ void set_velocity_y(float vy);
+
+ /// Velocities invertion.
+ void inverse_velocity_x();
+ void inverse_velocity_y();
+
+ float get_velocity_x();
+ float get_velocity_y();
+
+ /// Set acceleration.
+ /** Sets acceleration applied to the object. (Note that gravity is
+ * eventually added to the vertical acceleration)
+ */
+ void set_acceleration(float ax, float ay);
+
+ void set_acceleration_x(float ax);
+ void set_acceleration_y(float ay);
+
+ float get_acceleration_x();
+ float get_acceleration_y();
+
+ /// Enables or disables handling of gravity.
+ void enable_gravity(bool gravity_enabled);
+
+ Vector get_movement(float elapsed_time);
+
+private:
+ /// horizontal and vertical acceleration
+ float ax, ay;
+ /// horizontal and vertical velocity
+ float vx, vy;
+ /// should we respect gravity in out calculations?
+ bool gravity_enabled;
+};
+
+#endif
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "lisp/writer.h"
-#include "lisp/lisp.h"
-#include "player_status.h"
-#include "resources.h"
-#include "gettext.h"
-#include "video/drawing_context.h"
-#include "audio/sound_manager.h"
-#include "main.h"
+#include "lisp/writer.hpp"
+#include "lisp/lisp.hpp"
+#include "player_status.hpp"
+#include "resources.hpp"
+#include "gettext.hpp"
+#include "video/drawing_context.hpp"
+#include "audio/sound_manager.hpp"
+#include "main.hpp"
static const int START_LIVES = 4;
static const int MAX_LIVES = 99;
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_PLAYERSTATUS_H
-#define SUPERTUX_PLAYERSTATUS_H
-
-#include "lisp/lisp.h"
-#include "timer.h"
-#include "serializable.h"
-
-enum BonusType {
- NO_BONUS, GROWUP_BONUS, FIRE_BONUS, ICE_BONUS
-};
-class DrawingContext;
-
-/**
- * This class memorizes player status between different game sessions (for
- * example when switching maps in the worldmap)
- */
-class PlayerStatus : public Serializable
-{
-public:
- PlayerStatus();
- void reset();
- void incLives();
- void incCoins();
-
- void write(lisp::Writer& writer);
- void read(const lisp::Lisp& lisp);
-
- void draw(DrawingContext& context);
-
- int coins;
- int lives;
- BonusType bonus;
-
- int score_multiplier;
- int max_score_multiplier;
-};
-
-// global player state
-extern PlayerStatus player_status;
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_PLAYERSTATUS_H
+#define SUPERTUX_PLAYERSTATUS_H
+
+#include "lisp/lisp.hpp"
+#include "timer.hpp"
+#include "serializable.hpp"
+
+enum BonusType {
+ NO_BONUS, GROWUP_BONUS, FIRE_BONUS, ICE_BONUS
+};
+class DrawingContext;
+
+/**
+ * This class memorizes player status between different game sessions (for
+ * example when switching maps in the worldmap)
+ */
+class PlayerStatus : public Serializable
+{
+public:
+ PlayerStatus();
+ void reset();
+ void incLives();
+ void incCoins();
+
+ void write(lisp::Writer& writer);
+ void read(const lisp::Lisp& lisp);
+
+ void draw(DrawingContext& context);
+
+ int coins;
+ int lives;
+ BonusType bonus;
+
+ int score_multiplier;
+ int max_score_multiplier;
+};
+
+// global player state
+extern PlayerStatus player_status;
+
+#endif
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "sprite/sprite_manager.h"
-#include "gui/menu.h"
-#include "gui/button.h"
-#include "resources.h"
-#include "file_system.h"
-#include "tile_manager.h"
-#include "object/gameobjs.h"
-#include "object/player.h"
+#include "sprite/sprite_manager.hpp"
+#include "gui/menu.hpp"
+#include "gui/button.hpp"
+#include "resources.hpp"
+#include "file_system.hpp"
+#include "tile_manager.hpp"
+#include "object/gameobjs.hpp"
+#include "object/player.hpp"
SpriteManager* sprite_manager = 0;
TileManager* tile_manager = 0;
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_RESOURCES_H
-#define SUPERTUX_RESOURCES_H
-
-#include <string>
-
-class SpriteManager;
-class Menu;
-class Font;
-class Surface;
-class SoundManager;
-class TileManager;
-class MouseCursor;
-
-extern Surface* img_super_bkgd;
-extern Surface* tux_life;
-
-extern SpriteManager* sprite_manager;
-extern TileManager* tile_manager;
-extern SoundManager* sound_manager;
-
-extern Menu* contrib_menu;
-extern Menu* contrib_subset_menu;
-extern Menu* main_menu;
-extern Menu* game_menu;
-extern Menu* options_menu;
-extern Menu* load_game_menu;
-
-extern MouseCursor* mouse_cursor;
-
-extern Font* gold_text;
-extern Font* white_text;
-extern Font* blue_text;
-extern Font* gray_text;
-extern Font* white_small_text;
-extern Font* white_big_text;
-extern Font* yellow_nums;
-
-void load_shared();
-void unload_shared();
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_RESOURCES_H
+#define SUPERTUX_RESOURCES_H
+
+#include <string>
+
+class SpriteManager;
+class Menu;
+class Font;
+class Surface;
+class SoundManager;
+class TileManager;
+class MouseCursor;
+
+extern Surface* img_super_bkgd;
+extern Surface* tux_life;
+
+extern SpriteManager* sprite_manager;
+extern TileManager* tile_manager;
+extern SoundManager* sound_manager;
+
+extern Menu* contrib_menu;
+extern Menu* contrib_subset_menu;
+extern Menu* main_menu;
+extern Menu* game_menu;
+extern Menu* options_menu;
+extern Menu* load_game_menu;
+
+extern MouseCursor* mouse_cursor;
+
+extern Font* gold_text;
+extern Font* white_text;
+extern Font* blue_text;
+extern Font* gray_text;
+extern Font* white_small_text;
+extern Font* white_big_text;
+extern Font* yellow_nums;
+
+void load_shared();
+void unload_shared();
+
+#endif
if $(MINISWIG)
{
wrapper_objects +=
- [ MiniSwigRule wrapper.cpp : wrapper.interface.h : supertux : --select-namespace Scripting ] ;
+ [ MiniSwigRule wrapper.cpp : wrapper.interface.hpp : supertux : --select-namespace Scripting ] ;
}
#include <string>
#include <stdio.h>
-#include "camera.h"
+#include "camera.hpp"
#define NOIMPL printf("%s not implemented.\n", __PRETTY_FUNCTION__);
+++ /dev/null
-#ifndef __CAMERA_H__
-#define __CAMERA_H__
-
-namespace Scripting
-{
-
-class Camera
-{
-public:
-#ifndef SCRIPTING_API
- Camera();
- ~Camera();
-#endif
-
- /** Shake the camera */
- void shake(float speed, float x, float y);
- /** Set camera to a specific coordinate */
- void set_pos(float x, float y);
- /** Set camera to a specific mode, can be "normal", "manual" */
- void set_mode(const std::string& mode);
-};
-
-}
-
-#endif
-
--- /dev/null
+#ifndef __CAMERA_H__
+#define __CAMERA_H__
+
+namespace Scripting
+{
+
+class Camera
+{
+public:
+#ifndef SCRIPTING_API
+ Camera();
+ ~Camera();
+#endif
+
+ /** Shake the camera */
+ void shake(float speed, float x, float y);
+ /** Set camera to a specific coordinate */
+ void set_pos(float x, float y);
+ /** Set camera to a specific mode, can be "normal", "manual" */
+ void set_mode(const std::string& mode);
+};
+
+}
+
+#endif
+
+++ /dev/null
-#ifndef __SCRIPTING_DISPLAY_EFFECT_H__
-#define __SCRIPTING_DISPLAY_EFFECT_H__
-
-namespace Scripting
-{
-
-class DisplayEffect
-{
-public:
-#ifndef SCRIPTING_API
- virtual ~DisplayEffect()
- {}
-#endif
-
- /// fade display to black
- virtual void fade_out(float fadetime) = 0;
- /// fade display from black to normal
- virtual void fade_in(float fadetime) = 0;
- /// set display black (or back to normal)
- virtual void set_black(bool enabled) = 0;
- /// check if display is set to black
- virtual bool is_black() = 0;
-
- // fade display until just a small visible circle is left
- // (like what happens in some cartoons at the end)
- // void shrink_fade(Vector goal, float radius, float fadetime);
-};
-
-}
-
-#endif
-
--- /dev/null
+#ifndef __SCRIPTING_DISPLAY_EFFECT_H__
+#define __SCRIPTING_DISPLAY_EFFECT_H__
+
+namespace Scripting
+{
+
+class DisplayEffect
+{
+public:
+#ifndef SCRIPTING_API
+ virtual ~DisplayEffect()
+ {}
+#endif
+
+ /// fade display to black
+ virtual void fade_out(float fadetime) = 0;
+ /// fade display from black to normal
+ virtual void fade_in(float fadetime) = 0;
+ /// set display black (or back to normal)
+ virtual void set_black(bool enabled) = 0;
+ /// check if display is set to black
+ virtual bool is_black() = 0;
+
+ // fade display until just a small visible circle is left
+ // (like what happens in some cartoons at the end)
+ // void shrink_fade(Vector goal, float radius, float fadetime);
+};
+
+}
+
+#endif
+
#include <string>
#include <squirrel.h>
#include <sqstdio.h>
-#include "textscroller.h"
-#include "functions.h"
-#include "script_interpreter.h"
-#include "tinygettext/tinygettext.h"
-#include "resources.h"
-#include "gettext.h"
+#include "textscroller.hpp"
+#include "functions.hpp"
+#include "script_interpreter.hpp"
+#include "tinygettext/tinygettext.hpp"
+#include "resources.hpp"
+#include "gettext.hpp"
namespace Scripting
{
+++ /dev/null
-#ifndef __FUNCTIONS_H__
-#define __FUNCTIONS_H__
-
-namespace Scripting
-{
-
-/** displays a text file and scrolls it over the screen */
-void display_text_file(const std::string& filename);
-/** Suspends the script execution for the specified number of seconds */
-void set_wakeup_time(float seconds);
-/** translates a give text into the users language (by looking it up in the .po
- * files)
- */
-std::string translate(const std::string& text);
-/** load a script file and executes it
- * This is typically used to import functions from external files.
- * */
-void import(HSQUIRRELVM v, const std::string& filename);
-
-}
-
-#endif
-
--- /dev/null
+#ifndef __FUNCTIONS_H__
+#define __FUNCTIONS_H__
+
+namespace Scripting
+{
+
+/** displays a text file and scrolls it over the screen */
+void display_text_file(const std::string& filename);
+/** Suspends the script execution for the specified number of seconds */
+void set_wakeup_time(float seconds);
+/** translates a give text into the users language (by looking it up in the .po
+ * files)
+ */
+std::string translate(const std::string& text);
+/** load a script file and executes it
+ * This is typically used to import functions from external files.
+ * */
+void import(HSQUIRRELVM v, const std::string& filename);
+
+}
+
+#endif
+
#include <string>
#include <stdio.h>
-#include "level.h"
-#include "game_session.h"
-#include "flip_level_transformer.h"
+#include "level.hpp"
+#include "game_session.hpp"
+#include "flip_level_transformer.hpp"
namespace Scripting
{
+++ /dev/null
-#ifndef __LEVEL_H__
-#define __LEVEL_H__
-
-namespace Scripting
-{
-
-class Level
-{
-public:
-#ifndef SCRIPTING_API
- Level();
- ~Level();
-#endif
-
- /** Instantly finish the currently played level */
- void finish();
- /** spawn tux at specified sector and spawnpoint */
- void spawn(const std::string& sector, const std::string& spawnpoint);
- /** Flip level vertically */
- void flip_vertically();
-};
-
-}
-
-#endif
-
--- /dev/null
+#ifndef __LEVEL_H__
+#define __LEVEL_H__
+
+namespace Scripting
+{
+
+class Level
+{
+public:
+#ifndef SCRIPTING_API
+ Level();
+ ~Level();
+#endif
+
+ /** Instantly finish the currently played level */
+ void finish();
+ /** spawn tux at specified sector and spawnpoint */
+ void spawn(const std::string& sector, const std::string& spawnpoint);
+ /** Flip level vertically */
+ void flip_vertically();
+};
+
+}
+
+#endif
+
+++ /dev/null
-#ifndef __PLAYER_H__
-#define __PLAYER_H__
-
-namespace Scripting
-{
-
-class Player
-{
-public:
-#ifndef SCRIPTING_API
- virtual ~Player()
- {}
-#endif
-
- /**
- * Set tux bonus.
- * This can be "grow", "fireflow" or "iceflower" at the moment
- */
- virtual void set_bonus(const std::string& bonus) = 0;
- /**
- * Make tux invicible for a short amount of time
- */
- virtual void make_invincible() = 0;
- /**
- * Give tux another life
- */
- virtual void add_life() = 0;
- /**
- * Give tux more coins
- */
- virtual void add_coins(int count) = 0;
-};
-
-}
-
-#endif
-
--- /dev/null
+#ifndef __PLAYER_H__
+#define __PLAYER_H__
+
+namespace Scripting
+{
+
+class Player
+{
+public:
+#ifndef SCRIPTING_API
+ virtual ~Player()
+ {}
+#endif
+
+ /**
+ * Set tux bonus.
+ * This can be "grow", "fireflow" or "iceflower" at the moment
+ */
+ virtual void set_bonus(const std::string& bonus) = 0;
+ /**
+ * Make tux invicible for a short amount of time
+ */
+ virtual void make_invincible() = 0;
+ /**
+ * Give tux another life
+ */
+ virtual void add_life() = 0;
+ /**
+ * Give tux more coins
+ */
+ virtual void add_coins(int count) = 0;
+};
+
+}
+
+#endif
+
#include <config.h>
-#include "script_interpreter.h"
+#include "script_interpreter.hpp"
#include <stdarg.h>
#include <stdexcept>
#include <sqstdmath.h>
#include <sqstdstring.h>
-#include "wrapper.h"
-#include "wrapper_util.h"
-#include "sector.h"
-#include "file_system.h"
-#include "game_session.h"
-#include "resources.h"
-#include "physfs/physfs_stream.h"
-#include "object/text_object.h"
-#include "object/scripted_object.h"
-#include "object/display_effect.h"
-#include "scripting/sound.h"
-#include "scripting/scripted_object.h"
-#include "scripting/display_effect.h"
+#include "wrapper.hpp"
+#include "wrapper_util.hpp"
+#include "sector.hpp"
+#include "file_system.hpp"
+#include "game_session.hpp"
+#include "resources.hpp"
+#include "physfs/physfs_stream.hpp"
+#include "object/text_object.hpp"
+#include "object/scripted_object.hpp"
+#include "object/display_effect.hpp"
+#include "scripting/sound.hpp"
+#include "scripting/scripted_object.hpp"
+#include "scripting/display_effect.hpp"
static void printfunc(HSQUIRRELVM, const char* str, ...)
{
+++ /dev/null
-#ifndef __SCRIPT_INTERPRETER_H__
-#define __SCRIPT_INTERPRETER_H__
-
-#include <squirrel.h>
-#include <iostream>
-#include "timer.h"
-#include "game_object.h"
-#include "scripting/sound.h"
-#include "scripting/level.h"
-
-class Sector;
-
-class ScriptInterpreter : public GameObject
-{
-public:
- ScriptInterpreter(const std::string& working_dir);
- ~ScriptInterpreter();
-
- void register_sector(Sector* sector);
-
- void draw(DrawingContext& );
- void update(float );
-
- void run_script(std::istream& in, const std::string& sourcename = "",
- bool remove_when_terminated = true);
-
- void expose_object(void* object, const std::string& name,
- const std::string& type);
-
- void set_wakeup_time(float seconds);
-
- /** helper function that parses a script, starts it and adds it to the sector
- * specified
- */
- static void add_script_object(Sector* sector, const std::string& scriptname,
- const std::string& script);
-
- static ScriptInterpreter* current()
- {
- return _current;
- }
-
- const std::string& get_working_directory() const
- {
- return working_directory;
- }
-
-private:
- HSQUIRRELVM v;
- static ScriptInterpreter* _current;
- Timer wakeup_timer;
-
- /// this directory is used as base for all filenames used in scripts
- std::string working_directory;
- Scripting::Sound* sound;
- Scripting::Level* level;
-};
-
-#endif
-
--- /dev/null
+#ifndef __SCRIPT_INTERPRETER_H__
+#define __SCRIPT_INTERPRETER_H__
+
+#include <squirrel.h>
+#include <iostream>
+#include "timer.hpp"
+#include "game_object.hpp"
+#include "scripting/sound.hpp"
+#include "scripting/level.hpp"
+
+class Sector;
+
+class ScriptInterpreter : public GameObject
+{
+public:
+ ScriptInterpreter(const std::string& working_dir);
+ ~ScriptInterpreter();
+
+ void register_sector(Sector* sector);
+
+ void draw(DrawingContext& );
+ void update(float );
+
+ void run_script(std::istream& in, const std::string& sourcename = "",
+ bool remove_when_terminated = true);
+
+ void expose_object(void* object, const std::string& name,
+ const std::string& type);
+
+ void set_wakeup_time(float seconds);
+
+ /** helper function that parses a script, starts it and adds it to the sector
+ * specified
+ */
+ static void add_script_object(Sector* sector, const std::string& scriptname,
+ const std::string& script);
+
+ static ScriptInterpreter* current()
+ {
+ return _current;
+ }
+
+ const std::string& get_working_directory() const
+ {
+ return working_directory;
+ }
+
+private:
+ HSQUIRRELVM v;
+ static ScriptInterpreter* _current;
+ Timer wakeup_timer;
+
+ /// this directory is used as base for all filenames used in scripts
+ std::string working_directory;
+ Scripting::Sound* sound;
+ Scripting::Level* level;
+};
+
+#endif
+
+++ /dev/null
-#ifndef __SCRIPTED_OBJECT_INTERFACE_H__
-#define __SCRIPTED_OBJECT_INTERFACE_H__
-
-namespace Scripting
-{
-
-class ScriptedObject
-{
-public:
-#ifndef SCRIPTING_API
- virtual ~ScriptedObject()
- {}
-#endif
-
- virtual void set_animation(const std::string& animation) = 0;
- virtual std::string get_animation() = 0;
-
- virtual void move(float x, float y) = 0;
- virtual void set_pos(float x, float y) = 0;
- virtual float get_pos_x() = 0;
- virtual float get_pos_y() = 0;
-
- virtual void set_velocity(float x, float y) = 0;
- virtual float get_velocity_x() = 0;
- virtual float get_velocity_y() = 0;
-
- virtual void set_visible(bool visible) = 0;
- virtual bool is_visible() = 0;
-
- virtual std::string get_name() = 0;
-};
-
-}
-
-#endif
-
--- /dev/null
+#ifndef __SCRIPTED_OBJECT_INTERFACE_H__
+#define __SCRIPTED_OBJECT_INTERFACE_H__
+
+namespace Scripting
+{
+
+class ScriptedObject
+{
+public:
+#ifndef SCRIPTING_API
+ virtual ~ScriptedObject()
+ {}
+#endif
+
+ virtual void set_animation(const std::string& animation) = 0;
+ virtual std::string get_animation() = 0;
+
+ virtual void move(float x, float y) = 0;
+ virtual void set_pos(float x, float y) = 0;
+ virtual float get_pos_x() = 0;
+ virtual float get_pos_y() = 0;
+
+ virtual void set_velocity(float x, float y) = 0;
+ virtual float get_velocity_x() = 0;
+ virtual float get_velocity_y() = 0;
+
+ virtual void set_visible(bool visible) = 0;
+ virtual bool is_visible() = 0;
+
+ virtual std::string get_name() = 0;
+};
+
+}
+
+#endif
+
#include <string>
#include <stdio.h>
-#include "sound.h"
-#include "resources.h"
-#include "audio/sound_manager.h"
+#include "sound.hpp"
+#include "resources.hpp"
+#include "audio/sound_manager.hpp"
namespace Scripting
{
+++ /dev/null
-#ifndef __SOUND_H__
-#define __SOUND_H__
-
-namespace Scripting
-{
-
-/**
- * This class allows manipulating the sound output of the game
- */
-class Sound
-{
-public:
- void play_music(const std::string& musicfile);
- /**
- * Play a sound effect. The name should be without path or .wav extension
- */
- void play(const std::string& soundfile);
-
-#ifndef SCRIPTING_API
- Sound();
- ~Sound();
-#endif
-};
-
-}
-
-#endif
-
--- /dev/null
+#ifndef __SOUND_H__
+#define __SOUND_H__
+
+namespace Scripting
+{
+
+/**
+ * This class allows manipulating the sound output of the game
+ */
+class Sound
+{
+public:
+ void play_music(const std::string& musicfile);
+ /**
+ * Play a sound effect. The name should be without path or .wav extension
+ */
+ void play(const std::string& soundfile);
+
+#ifndef SCRIPTING_API
+ Sound();
+ ~Sound();
+#endif
+};
+
+}
+
+#endif
+
+++ /dev/null
-#ifndef __TEXT_H__
-#define __TEXT_H__
-
-namespace Scripting
-{
-
-class Text
-{
-public:
-#ifndef SCRIPTING_API
- virtual ~Text()
- { }
-#endif
-
- virtual void set_text(const std::string& text) = 0;
- virtual void set_font(const std::string& fontname) = 0;
- virtual void fade_in(float fadetime) = 0;
- virtual void fade_out(float fadetime) = 0;
- virtual void set_visible(bool visible) = 0;
-};
-
-}
-
-#endif
-
--- /dev/null
+#ifndef __TEXT_H__
+#define __TEXT_H__
+
+namespace Scripting
+{
+
+class Text
+{
+public:
+#ifndef SCRIPTING_API
+ virtual ~Text()
+ { }
+#endif
+
+ virtual void set_text(const std::string& text) = 0;
+ virtual void set_font(const std::string& fontname) = 0;
+ virtual void fade_in(float fadetime) = 0;
+ virtual void fade_out(float fadetime) = 0;
+ virtual void set_visible(bool visible) = 0;
+};
+
+}
+
+#endif
+
/**
* WARNING: This file is automatically generated from:
- * 'src/scripting/wrapper.interface.h'
+ * 'src/scripting/wrapper.interface.hpp'
* DO NOT CHANGE
*/
#include <config.h>
#include <assert.h>
#include <string>
#include <squirrel.h>
-#include "wrapper_util.h"
-#include "wrapper.interface.h"
+#include "wrapper_util.hpp"
+#include "wrapper.interface.hpp"
using namespace Scripting;
+++ /dev/null
-/**
- * WARNING: This file is automatically generated from:
- * 'src/scripting/wrapper.interface.h'
- * DO NOT CHANGE
- */
-#ifndef __supertux_WRAPPER_H__
-#define __supertux_WRAPPER_H__
-
-#include "wrapper_util.h"
-
-extern WrappedFunction supertux_global_functions[];
-extern WrappedClass supertux_classes[];
-
-#endif
-
--- /dev/null
+/**
+ * WARNING: This file is automatically generated from:
+ * 'src/scripting/wrapper.interface.h'
+ * DO NOT CHANGE
+ */
+#ifndef __supertux_WRAPPER_H__
+#define __supertux_WRAPPER_H__
+
+#include "wrapper_util.hpp"
+
+extern WrappedFunction supertux_global_functions[];
+extern WrappedClass supertux_classes[];
+
+#endif
+
+++ /dev/null
-/* This file is processes by miniswig to produce the scripting API */
-#include "display_effect.h"
-#include "camera.h"
-#include "level.h"
-#include "scripted_object.h"
-#include "sound.h"
-#include "text.h"
-#include "functions.h"
-#include "player.h"
--- /dev/null
+/* This file is processes by miniswig to produce the scripting API */
+#include "display_effect.hpp"
+#include "camera.hpp"
+#include "level.hpp"
+#include "scripted_object.hpp"
+#include "sound.hpp"
+#include "text.hpp"
+#include "functions.hpp"
+#include "player.hpp"
#include <stdexcept>
#include <sstream>
-#include "wrapper_util.h"
+#include "wrapper_util.hpp"
static void register_function(HSQUIRRELVM v, SQFUNCTION func, const char* name)
{
+++ /dev/null
-#ifndef __WRAPPERUTIL_HPP__
-#define __WRAPPERUTIL_HPP__
-
-#include <squirrel.h>
-#include <exception>
-#include <string>
-
-struct WrappedFunction {
- const char* name;
- SQFUNCTION f;
-};
-struct WrappedClass {
- const char* name;
- WrappedFunction* functions;
-};
-
-class SquirrelError : public std::exception
-{
-public:
- SquirrelError(HSQUIRRELVM v, const std::string& message) throw();
- virtual ~SquirrelError() throw();
-
- const char* what() const throw();
-private:
- std::string message;
-};
-
-void register_functions(HSQUIRRELVM v, WrappedFunction* functions);
-void register_classes(HSQUIRRELVM v, WrappedClass* classes);
-
-void print_squirrel_stack(HSQUIRRELVM v);
-
-#endif
--- /dev/null
+#ifndef __WRAPPERUTIL_HPP__
+#define __WRAPPERUTIL_HPP__
+
+#include <squirrel.h>
+#include <exception>
+#include <string>
+
+struct WrappedFunction {
+ const char* name;
+ SQFUNCTION f;
+};
+struct WrappedClass {
+ const char* name;
+ WrappedFunction* functions;
+};
+
+class SquirrelError : public std::exception
+{
+public:
+ SquirrelError(HSQUIRRELVM v, const std::string& message) throw();
+ virtual ~SquirrelError() throw();
+
+ const char* what() const throw();
+private:
+ std::string message;
+};
+
+void register_functions(HSQUIRRELVM v, WrappedFunction* functions);
+void register_classes(HSQUIRRELVM v, WrappedClass* classes);
+
+void print_squirrel_stack(HSQUIRRELVM v);
+
+#endif
#include <sstream>
#include <stdexcept>
-#include "sector.h"
-#include "player_status.h"
-#include "object/gameobjs.h"
-#include "object/camera.h"
-#include "object/background.h"
-#include "object/particlesystem.h"
-#include "object/particlesystem_interactive.h"
-#include "object/tilemap.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "lisp/list_iterator.h"
-#include "tile.h"
-#include "audio/sound_manager.h"
-#include "game_session.h"
-#include "resources.h"
-#include "statistics.h"
-#include "collision_grid.h"
-#include "collision_grid_iterator.h"
-#include "object_factory.h"
-#include "collision.h"
-#include "spawn_point.h"
-#include "math/rect.h"
-#include "math/aatriangle.h"
-#include "object/coin.h"
-#include "object/block.h"
-#include "object/invisible_block.h"
-#include "object/bullet.h"
-#include "object/text_object.h"
-#include "badguy/jumpy.h"
-#include "badguy/spike.h"
-#include "trigger/sequence_trigger.h"
-#include "player_status.h"
-#include "scripting/script_interpreter.h"
-#include "scripting/sound.h"
-#include "scripting/scripted_object.h"
-#include "scripting/text.h"
+#include "sector.hpp"
+#include "player_status.hpp"
+#include "object/gameobjs.hpp"
+#include "object/camera.hpp"
+#include "object/background.hpp"
+#include "object/particlesystem.hpp"
+#include "object/particlesystem_interactive.hpp"
+#include "object/tilemap.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "lisp/list_iterator.hpp"
+#include "tile.hpp"
+#include "audio/sound_manager.hpp"
+#include "game_session.hpp"
+#include "resources.hpp"
+#include "statistics.hpp"
+#include "collision_grid.hpp"
+#include "collision_grid_iterator.hpp"
+#include "object_factory.hpp"
+#include "collision.hpp"
+#include "spawn_point.hpp"
+#include "math/rect.hpp"
+#include "math/aatriangle.hpp"
+#include "object/coin.hpp"
+#include "object/block.hpp"
+#include "object/invisible_block.hpp"
+#include "object/bullet.hpp"
+#include "object/text_object.hpp"
+#include "badguy/jumpy.hpp"
+#include "badguy/spike.hpp"
+#include "trigger/sequence_trigger.hpp"
+#include "player_status.hpp"
+#include "scripting/script_interpreter.hpp"
+#include "scripting/sound.hpp"
+#include "scripting/scripted_object.hpp"
+#include "scripting/text.hpp"
//#define USE_GRID
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_SECTOR_H
-#define SUPERTUX_SECTOR_H
-
-#include <string>
-#include <vector>
-
-#include "direction.h"
-#include "math/vector.h"
-#include "video/drawing_context.h"
-
-namespace lisp {
-class Lisp;
-class Writer;
-}
-
-class Rect;
-class Sprite;
-class GameObject;
-class Player;
-class Camera;
-class TileMap;
-class Bullet;
-class CollisionGrid;
-class ScriptInterpreter;
-class SpawnPoint;
-class MovingObject;
-
-enum MusicType {
- LEVEL_MUSIC,
- HERRING_MUSIC
-};
-
-/** This class holds a sector (a part of a level) and all the game objects
- * (badguys, player, background, tilemap, ...)
- */
-class Sector
-{
-public:
- Sector();
- ~Sector();
-
- /// read sector from lisp file
- void parse(const lisp::Lisp& lisp);
- void parse_old_format(const lisp::Lisp& lisp);
- /// write sector to lisp file
- void write(lisp::Writer& writer);
-
- /// activates this sector (change music, intialize player class, ...)
- void activate(const std::string& spawnpoint);
- void activate(const Vector& player_pos);
-
- void update(float elapsed_time);
- void update_game_objects();
-
- void draw(DrawingContext& context);
-
- /// adds a gameobject
- void add_object(GameObject* object);
-
- void set_name(const std::string& name)
- { this->name = name; }
- const std::string& get_name() const
- { return name; }
-
- /// tests if a given rectangle is inside the sector
- bool inside(const Rect& rectangle) const;
-
- void play_music(MusicType musictype);
- MusicType get_music_type();
-
- /** Checks for all possible collisions. And calls the
- collision_handlers, which the collision_objects provide for this
- case (or not). */
- void collision_handler();
-
- bool add_bullet(const Vector& pos, float xm, Direction dir);
- bool add_smoke_cloud(const Vector& pos);
- void add_floating_text(const Vector& pos, const std::string& text);
-
- /** get currently activated sector. */
- static Sector* current()
- { return _current; }
-
- /** Get total number of badguys */
- int get_total_badguys();
-
- // make this private again soon
- void collision_tilemap(MovingObject* object, int depth);
-
-private:
- void collision_object(MovingObject* object1, MovingObject* object2);
-
- GameObject* parse_object(const std::string& name, const lisp::Lisp& lisp);
-
- static Sector* _current;
-
- std::string name;
-
-public:
- std::string song_title;
- float gravity;
-
- // some special objects, where we need direct access
- Player* player;
- TileMap* solids;
- Camera* camera;
-
-private:
- std::vector<Bullet*> bullets;
-
- std::string init_script;
-
-public: // TODO make this private again
- typedef std::vector<GameObject*> GameObjects;
- GameObjects gameobjects;
- typedef std::vector<SpawnPoint*> SpawnPoints;
- SpawnPoints spawnpoints;
-
- Rect get_active_region();
-
-private:
- void fix_old_tiles();
-
- /// container for newly created objects, they'll be added in Sector::update
- GameObjects gameobjects_new;
-
- MusicType currentmusic;
-
- CollisionGrid* grid;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_SECTOR_H
+#define SUPERTUX_SECTOR_H
+
+#include <string>
+#include <vector>
+
+#include "direction.hpp"
+#include "math/vector.hpp"
+#include "video/drawing_context.hpp"
+
+namespace lisp {
+class Lisp;
+class Writer;
+}
+
+class Rect;
+class Sprite;
+class GameObject;
+class Player;
+class Camera;
+class TileMap;
+class Bullet;
+class CollisionGrid;
+class ScriptInterpreter;
+class SpawnPoint;
+class MovingObject;
+
+enum MusicType {
+ LEVEL_MUSIC,
+ HERRING_MUSIC
+};
+
+/** This class holds a sector (a part of a level) and all the game objects
+ * (badguys, player, background, tilemap, ...)
+ */
+class Sector
+{
+public:
+ Sector();
+ ~Sector();
+
+ /// read sector from lisp file
+ void parse(const lisp::Lisp& lisp);
+ void parse_old_format(const lisp::Lisp& lisp);
+ /// write sector to lisp file
+ void write(lisp::Writer& writer);
+
+ /// activates this sector (change music, intialize player class, ...)
+ void activate(const std::string& spawnpoint);
+ void activate(const Vector& player_pos);
+
+ void update(float elapsed_time);
+ void update_game_objects();
+
+ void draw(DrawingContext& context);
+
+ /// adds a gameobject
+ void add_object(GameObject* object);
+
+ void set_name(const std::string& name)
+ { this->name = name; }
+ const std::string& get_name() const
+ { return name; }
+
+ /// tests if a given rectangle is inside the sector
+ bool inside(const Rect& rectangle) const;
+
+ void play_music(MusicType musictype);
+ MusicType get_music_type();
+
+ /** Checks for all possible collisions. And calls the
+ collision_handlers, which the collision_objects provide for this
+ case (or not). */
+ void collision_handler();
+
+ bool add_bullet(const Vector& pos, float xm, Direction dir);
+ bool add_smoke_cloud(const Vector& pos);
+ void add_floating_text(const Vector& pos, const std::string& text);
+
+ /** get currently activated sector. */
+ static Sector* current()
+ { return _current; }
+
+ /** Get total number of badguys */
+ int get_total_badguys();
+
+ // make this private again soon
+ void collision_tilemap(MovingObject* object, int depth);
+
+private:
+ void collision_object(MovingObject* object1, MovingObject* object2);
+
+ GameObject* parse_object(const std::string& name, const lisp::Lisp& lisp);
+
+ static Sector* _current;
+
+ std::string name;
+
+public:
+ std::string song_title;
+ float gravity;
+
+ // some special objects, where we need direct access
+ Player* player;
+ TileMap* solids;
+ Camera* camera;
+
+private:
+ std::vector<Bullet*> bullets;
+
+ std::string init_script;
+
+public: // TODO make this private again
+ typedef std::vector<GameObject*> GameObjects;
+ GameObjects gameobjects;
+ typedef std::vector<SpawnPoint*> SpawnPoints;
+ SpawnPoints spawnpoints;
+
+ Rect get_active_region();
+
+private:
+ void fix_old_tiles();
+
+ /// container for newly created objects, they'll be added in Sector::update
+ GameObjects gameobjects_new;
+
+ MusicType currentmusic;
+
+ CollisionGrid* grid;
+};
+
+#endif
+
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_SERIALIZABLE_H
-#define SUPERTUX_SERIALIZABLE_H
-
-namespace lisp {
-class Writer;
-}
-
-class Serializable
-{
-public:
- virtual ~Serializable()
- { }
-
- virtual void write(lisp::Writer& writer) = 0;
-};
-
-#endif /*SUPERTUX_SERIALIZABLE_H*/
-
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_SERIALIZABLE_H
+#define SUPERTUX_SERIALIZABLE_H
+
+namespace lisp {
+class Writer;
+}
+
+class Serializable
+{
+public:
+ virtual ~Serializable()
+ { }
+
+ virtual void write(lisp::Writer& writer) = 0;
+};
+
+#endif /*SUPERTUX_SERIALIZABLE_H*/
+
#include <stdexcept>
#include <iostream>
-#include "spawn_point.h"
-#include "lisp/lisp.h"
-#include "lisp/list_iterator.h"
+#include "spawn_point.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/list_iterator.hpp"
SpawnPoint::SpawnPoint()
{}
+++ /dev/null
-#ifndef __SPAWN_POINT_H__
-#define __SPAWN_POINT_H__
-
-#include <string>
-#include "math/vector.h"
-#include "lisp/lisp.h"
-
-class SpawnPoint
-{
-public:
- SpawnPoint();
- SpawnPoint(const SpawnPoint& other);
- SpawnPoint(const lisp::Lisp* lisp);
-
- std::string name;
- Vector pos;
-};
-
-#endif
-
--- /dev/null
+#ifndef __SPAWN_POINT_H__
+#define __SPAWN_POINT_H__
+
+#include <string>
+#include "math/vector.hpp"
+#include "lisp/lisp.hpp"
+
+class SpawnPoint
+{
+public:
+ SpawnPoint();
+ SpawnPoint(const SpawnPoint& other);
+ SpawnPoint(const lisp::Lisp* lisp);
+
+ std::string name;
+ Vector pos;
+};
+
+#endif
+
#include <cassert>
#include <stdexcept>
-#include "sprite.h"
-#include "video/drawing_context.h"
+#include "sprite.hpp"
+#include "video/drawing_context.hpp"
Sprite::Sprite(SpriteData& newdata)
: data(newdata), frame(0), animation_loops(-1)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef SUPERTUX_SPRITE_H
-#define SUPERTUX_SPRITE_H
-
-#include <string>
-#include <vector>
-#include <cassert>
-#include <map>
-
-#include "video/surface.h"
-#include "math/vector.h"
-#include "sprite_data.h"
-
-class Sprite
-{
-public:
- Sprite(SpriteData& data);
- Sprite(const Sprite& other);
- ~Sprite();
-
- /** Draw sprite, automatically calculates next frame */
- void draw(DrawingContext& context, const Vector& pos, int layer);
-
- void draw_part(DrawingContext& context, const Vector& source,
- const Vector& size, const Vector& pos, int layer);
-
- /** Set action (or state) */
- void set_action(std::string act, int loops = -1);
-
- /* Stop animation */
- void stop_animation()
- { animation_loops = 0; }
- /** Check if animation is stopped or not */
- bool check_animation();
-
- float get_fps() const
- { return action->fps; }
- /** Get current action total frames */
- int get_frames() const
- { return action->surfaces.size(); }
- /** Get sprite's name */
- const std::string& get_name() const
- { return data.name; }
- /** Get current action name */
- const std::string& get_action_name() const
- { return action->name; }
-
- int get_width() const;
- int get_height() const;
-
- /** Get current frame */
- int get_frame() const
- { return (int)frame; }
- /** Set current frame */
- void set_frame(int frame_)
- { if(frame_ > get_frames()) frame = 0; else frame = frame_; }
- Surface* get_frame(unsigned int frame)
- {
- assert(frame < action->surfaces.size());
- return action->surfaces[frame];
- }
-
-private:
- void update();
-
- SpriteData& data;
-
- float frame;
- int animation_loops;
- Uint32 last_ticks;
-
- SpriteData::Action* action;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef SUPERTUX_SPRITE_H
+#define SUPERTUX_SPRITE_H
+
+#include <string>
+#include <vector>
+#include <cassert>
+#include <map>
+
+#include "video/surface.hpp"
+#include "math/vector.hpp"
+#include "sprite_data.hpp"
+
+class Sprite
+{
+public:
+ Sprite(SpriteData& data);
+ Sprite(const Sprite& other);
+ ~Sprite();
+
+ /** Draw sprite, automatically calculates next frame */
+ void draw(DrawingContext& context, const Vector& pos, int layer);
+
+ void draw_part(DrawingContext& context, const Vector& source,
+ const Vector& size, const Vector& pos, int layer);
+
+ /** Set action (or state) */
+ void set_action(std::string act, int loops = -1);
+
+ /* Stop animation */
+ void stop_animation()
+ { animation_loops = 0; }
+ /** Check if animation is stopped or not */
+ bool check_animation();
+
+ float get_fps() const
+ { return action->fps; }
+ /** Get current action total frames */
+ int get_frames() const
+ { return action->surfaces.size(); }
+ /** Get sprite's name */
+ const std::string& get_name() const
+ { return data.name; }
+ /** Get current action name */
+ const std::string& get_action_name() const
+ { return action->name; }
+
+ int get_width() const;
+ int get_height() const;
+
+ /** Get current frame */
+ int get_frame() const
+ { return (int)frame; }
+ /** Set current frame */
+ void set_frame(int frame_)
+ { if(frame_ > get_frames()) frame = 0; else frame = frame_; }
+ Surface* get_frame(unsigned int frame)
+ {
+ assert(frame < action->surfaces.size());
+ return action->surfaces[frame];
+ }
+
+private:
+ void update();
+
+ SpriteData& data;
+
+ float frame;
+ int animation_loops;
+ Uint32 last_ticks;
+
+ SpriteData::Action* action;
+};
+
+#endif
+
#include <sstream>
#include <stdexcept>
-#include "sprite_data.h"
-#include "resources.h"
-#include "video/drawing_context.h"
-#include "lisp/list_iterator.h"
+#include "sprite_data.hpp"
+#include "resources.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/list_iterator.hpp"
SpriteData::Action::Action()
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>,
-// (C) 2004 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_SPRITE_DATA_H
-#define SUPERTUX_SPRITE_DATA_H
-
-#include <string>
-#include <vector>
-#include <map>
-
-#include "lisp/lisp.h"
-#include "video/surface.h"
-
-class SpriteData
-{
-public:
- /** cur has to be a pointer to data in the form of ((x-offset 5)
- (y-offset 10) ...) */
- SpriteData(const lisp::Lisp* cur);
- ~SpriteData();
-
- const std::string& get_name() const
- {
- return name;
- }
-
-private:
- friend class Sprite;
-
- struct Action
- {
- Action();
- ~Action();
-
- std::string name;
-
- /** Position correction */
- int x_offset;
- int y_offset;
- /** Drawing priority in queue */
- int z_order;
-
- /** Frames per second */
- float fps;
-
- /** Mirror is used to avoid duplicating left and right side
- sprites */
- // bool mirror;
-
- std::vector<Surface*> surfaces;
- };
-
- typedef std::map <std::string, Action*> Actions;
- Actions actions;
-
- void parse_action(const lisp::Lisp* lispreader);
- /** Get an action */
- Action* get_action(std::string act);
-
- std::string name;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>,
+// (C) 2004 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_SPRITE_DATA_H
+#define SUPERTUX_SPRITE_DATA_H
+
+#include <string>
+#include <vector>
+#include <map>
+
+#include "lisp/lisp.hpp"
+#include "video/surface.hpp"
+
+class SpriteData
+{
+public:
+ /** cur has to be a pointer to data in the form of ((x-offset 5)
+ (y-offset 10) ...) */
+ SpriteData(const lisp::Lisp* cur);
+ ~SpriteData();
+
+ const std::string& get_name() const
+ {
+ return name;
+ }
+
+private:
+ friend class Sprite;
+
+ struct Action
+ {
+ Action();
+ ~Action();
+
+ std::string name;
+
+ /** Position correction */
+ int x_offset;
+ int y_offset;
+ /** Drawing priority in queue */
+ int z_order;
+
+ /** Frames per second */
+ float fps;
+
+ /** Mirror is used to avoid duplicating left and right side
+ sprites */
+ // bool mirror;
+
+ std::vector<Surface*> surfaces;
+ };
+
+ typedef std::map <std::string, Action*> Actions;
+ Actions actions;
+
+ void parse_action(const lisp::Lisp* lispreader);
+ /** Get an action */
+ Action* get_action(std::string act);
+
+ std::string name;
+};
+
+#endif
+
#include <sstream>
#include <stdexcept>
-#include "sprite_manager.h"
-#include "sprite_data.h"
-#include "sprite.h"
-#include "lisp/lisp.h"
-#include "lisp/parser.h"
-#include "lisp/list_iterator.h"
+#include "sprite_manager.hpp"
+#include "sprite_data.hpp"
+#include "sprite.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/list_iterator.hpp"
SpriteManager::SpriteManager(const std::string& filename)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef SUPERTUX_SPRITE_MANAGER_H
-#define SUPERTUX_SPRITE_MANAGER_H
-
-#include <map>
-
-#include "sprite.h"
-
-class SpriteManager
-{
-private:
- typedef std::map<std::string, SpriteData*> Sprites;
- Sprites sprites;
-public:
- SpriteManager(const std::string& filename);
- ~SpriteManager();
-
- void load_resfile(const std::string& filename);
- /** loads a sprite.
- * (contrary to the old api you have to delete the sprite!)
- */
- Sprite* create(const std::string& name);
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef SUPERTUX_SPRITE_MANAGER_H
+#define SUPERTUX_SPRITE_MANAGER_H
+
+#include <map>
+
+#include "sprite.hpp"
+
+class SpriteManager
+{
+private:
+ typedef std::map<std::string, SpriteData*> Sprites;
+ Sprites sprites;
+public:
+ SpriteManager(const std::string& filename);
+ ~SpriteManager();
+
+ void load_resfile(const std::string& filename);
+ /** loads a sprite.
+ * (contrary to the old api you have to delete the sprite!)
+ */
+ Sprite* create(const std::string& name);
+};
+
+#endif
#include <config.h>
-#include "video/drawing_context.h"
-#include "gettext.h"
-#include "lisp/lisp.h"
-#include "resources.h"
-#include "main.h"
-#include "statistics.h"
+#include "video/drawing_context.hpp"
+#include "gettext.hpp"
+#include "lisp/lisp.hpp"
+#include "resources.hpp"
+#include "main.hpp"
+#include "statistics.hpp"
Statistics global_stats;
+++ /dev/null
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef SUPERTUX_STATISTICS_H
-#define SUPERTUX_STATISTICS_H
-
-#include "timer.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-
-class DrawingContext;
-
-#define SPLAYER 0
-#define STOTAL 1
-
-enum {
- SCORE_STAT,
- COINS_COLLECTED_STAT,
- BADGUYS_KILLED_STAT,
- TIME_NEEDED_STAT,
- NUM_STATS
-};
-
-/** This class is a layer between level and worldmap to keep
- * track of stuff like scores, and minor, but funny things, like
- * number of jumps and stuff */
-
-class Statistics
-{
-public:
- // don't forget to call reset() to init stat
- Statistics();
- ~Statistics();
-
- /// read statistics from lisp file
- void parse(const lisp::Lisp& lisp);
- /// write statistics to lisp file
- void write(lisp::Writer& writer);
-
- /* Draw to the worldmap or a game message */
- // TODO: make this functions working
- void draw_worldmap_info(DrawingContext& context);
- void draw_message_info(DrawingContext& context, std::string title);
-
- /* Add / Set / Get points to/from one of the stats this can keep track of */
- void add_points(int stat, int points);
- void set_points(int stat, int points);
- int get_points(int stat);
-
- void set_total_points(int stat, int points);
-
- /* Reset statistics */
- void reset();
-
- /* Give another Statistics object, find the best of each one */
- void merge(Statistics& stats);
-
- /* Add two statistic objects */
- void operator+=(const Statistics& o);
-
-private:
- int stats[NUM_STATS][2];
-
- Timer timer;
- int display_stat;
-};
-
-extern Statistics global_stats;
-
-#endif /*SUPERTUX_STATISTICS_H*/
--- /dev/null
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef SUPERTUX_STATISTICS_H
+#define SUPERTUX_STATISTICS_H
+
+#include "timer.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+
+class DrawingContext;
+
+#define SPLAYER 0
+#define STOTAL 1
+
+enum {
+ SCORE_STAT,
+ COINS_COLLECTED_STAT,
+ BADGUYS_KILLED_STAT,
+ TIME_NEEDED_STAT,
+ NUM_STATS
+};
+
+/** This class is a layer between level and worldmap to keep
+ * track of stuff like scores, and minor, but funny things, like
+ * number of jumps and stuff */
+
+class Statistics
+{
+public:
+ // don't forget to call reset() to init stat
+ Statistics();
+ ~Statistics();
+
+ /// read statistics from lisp file
+ void parse(const lisp::Lisp& lisp);
+ /// write statistics to lisp file
+ void write(lisp::Writer& writer);
+
+ /* Draw to the worldmap or a game message */
+ // TODO: make this functions working
+ void draw_worldmap_info(DrawingContext& context);
+ void draw_message_info(DrawingContext& context, std::string title);
+
+ /* Add / Set / Get points to/from one of the stats this can keep track of */
+ void add_points(int stat, int points);
+ void set_points(int stat, int points);
+ int get_points(int stat);
+
+ void set_total_points(int stat, int points);
+
+ /* Reset statistics */
+ void reset();
+
+ /* Give another Statistics object, find the best of each one */
+ void merge(Statistics& stats);
+
+ /* Add two statistic objects */
+ void operator+=(const Statistics& o);
+
+private:
+ int stats[NUM_STATS][2];
+
+ Timer timer;
+ int display_stat;
+};
+
+extern Statistics global_stats;
+
+#endif /*SUPERTUX_STATISTICS_H*/
// 02111-1307, USA.
#include <config.h>
-#include "textscroller.h"
+#include "textscroller.hpp"
#include <stdexcept>
-#include "resources.h"
-#include "video/font.h"
-#include "video/drawing_context.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "audio/sound_manager.h"
-#include "main.h"
-#include "control/joystickkeyboardcontroller.h"
+#include "resources.hpp"
+#include "video/font.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "audio/sound_manager.hpp"
+#include "main.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
static const float DEFAULT_SPEED = .02;
static const float SCROLL = 60;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __TEXTSCROLLER_H__
-#define __TEXTSCROLLER_H__
-
-#include <vector>
-#include <string>
-
-class DrawingContext;
-
-/** This class is displaying a box with information text inside the game
- */
-class InfoBox
-{
-public:
- InfoBox(const std::string& text);
- ~InfoBox();
-
- void draw(DrawingContext& context);
- void scrolldown();
- void scrollup();
- void pagedown();
- void pageup();
-
-private:
- size_t firstline;
- std::vector<std::string> lines;
-};
-
-/** Reads a text file (using LispReader, so it as to be in its formatting)
- * and scroll it over the screen
- * (this call blocks until all text scrolled through or the user aborted the
- * textscrolling)
- */
-void display_text_file(const std::string& file);
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __TEXTSCROLLER_H__
+#define __TEXTSCROLLER_H__
+
+#include <vector>
+#include <string>
+
+class DrawingContext;
+
+/** This class is displaying a box with information text inside the game
+ */
+class InfoBox
+{
+public:
+ InfoBox(const std::string& text);
+ ~InfoBox();
+
+ void draw(DrawingContext& context);
+ void scrolldown();
+ void scrollup();
+ void pagedown();
+ void pageup();
+
+private:
+ size_t firstline;
+ std::vector<std::string> lines;
+};
+
+/** Reads a text file (using LispReader, so it as to be in its formatting)
+ * and scroll it over the screen
+ * (this call blocks until all text scrolled through or the user aborted the
+ * textscrolling)
+ */
+void display_text_file(const std::string& file);
+
+#endif
+
#include <iostream>
#include <stdexcept>
-#include "lisp/lisp.h"
-#include "tile.h"
-#include "resources.h"
-#include "timer.h"
-#include "math/vector.h"
-#include "video/drawing_context.h"
+#include "lisp/lisp.hpp"
+#include "tile.hpp"
+#include "resources.hpp"
+#include "timer.hpp"
+#include "math/vector.hpp"
+#include "video/drawing_context.hpp"
Tile::Tile()
: id(0), editor_image(0), attributes(0), data(0), anim_fps(1)
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef TILE_H
-#define TILE_H
-
-#include <vector>
-#include "video/surface.h"
-#include "math/rect.h"
-#include "lisp/lisp.h"
-
-/**
-Tile Class
-*/
-class Tile
-{
-public:
- /// bitset for tile attributes
- enum {
- /** solid tile that is indestructable by Tux */
- SOLID = 0x0001,
- /** uni-directional solid tile */
- UNISOLID = 0x0002,
- /** a brick that can be destroyed by jumping under it */
- BRICK = 0x0004,
- /** an ice brick that makes tux sliding more than usual */
- ICE = 0x0008,
- /** a water tile in which tux starts to swim */
- WATER = 0x0010,
- /** a tile that hurts the player if he touches it */
- SPIKE = 0x0020,
- /** Bonusbox, content is stored in \a data */
- FULLBOX = 0x0040,
- /** Tile is a coin */
- COIN = 0x0080,
- /** the level should be finished when touching a goaltile.
- * if data is 0 then the endsequence should be triggered, if data is 1
- * then we can finish the level instantly.
- */
- GOAL = 0x0100,
- /** slope tile */
- SLOPE = 0x0200,
- };
-
- /// worldmap flags
- enum {
- WORLDMAP_NORTH = 0x0001,
- WORLDMAP_SOUTH = 0x0002,
- WORLDMAP_EAST = 0x0004,
- WORLDMAP_WEST = 0x0008,
-
- WORLDMAP_STOP = 0x0010
- };
-
-private:
- unsigned int id;
-
- struct ImageSpec {
- ImageSpec(const std::string& newfile, const Rect& newrect)
- : file(newfile), rect(newrect)
- { }
-
- std::string file;
- Rect rect;
- };
- std::vector<ImageSpec> imagespecs;
- std::vector<Surface*> images;
-
- std::string editor_imagefile;
- Surface* editor_image;
-
- /** tile attributes */
- Uint32 attributes;
-
- /** General purpose data attached to a tile (content of a box, type of coin)*/
- int data;
-
- float anim_fps;
-
-public:
- ~Tile();
-
- /** Draw a tile on the screen */
- void draw(DrawingContext& context, const Vector& pos, int layer) const;
-
- Surface* get_editor_image() const;
-
- unsigned int getID() const
- { return id; }
-
- Uint32 getAttributes() const
- { return attributes; }
-
- int getData() const
- { return data; }
-
- /// returns the width of the tile in pixels
- int getWidth() const
- {
- if(!images.size())
- return 0;
- return images[0]->w;
- }
-
- /// returns the height of the tiles in pixels
- int getHeight() const
- {
- if(!images.size())
- return 0;
- return images[0]->h;
- }
-
-protected:
- friend class TileManager;
- Tile();
-
- void load_images(const std::string& tilesetpath);
-
- /// parses the tile and returns it's id number
- void parse(const lisp::Lisp& reader);
- void parse_images(const lisp::Lisp& cur);
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef TILE_H
+#define TILE_H
+
+#include <vector>
+#include "video/surface.hpp"
+#include "math/rect.hpp"
+#include "lisp/lisp.hpp"
+
+/**
+Tile Class
+*/
+class Tile
+{
+public:
+ /// bitset for tile attributes
+ enum {
+ /** solid tile that is indestructable by Tux */
+ SOLID = 0x0001,
+ /** uni-directional solid tile */
+ UNISOLID = 0x0002,
+ /** a brick that can be destroyed by jumping under it */
+ BRICK = 0x0004,
+ /** an ice brick that makes tux sliding more than usual */
+ ICE = 0x0008,
+ /** a water tile in which tux starts to swim */
+ WATER = 0x0010,
+ /** a tile that hurts the player if he touches it */
+ SPIKE = 0x0020,
+ /** Bonusbox, content is stored in \a data */
+ FULLBOX = 0x0040,
+ /** Tile is a coin */
+ COIN = 0x0080,
+ /** the level should be finished when touching a goaltile.
+ * if data is 0 then the endsequence should be triggered, if data is 1
+ * then we can finish the level instantly.
+ */
+ GOAL = 0x0100,
+ /** slope tile */
+ SLOPE = 0x0200,
+ };
+
+ /// worldmap flags
+ enum {
+ WORLDMAP_NORTH = 0x0001,
+ WORLDMAP_SOUTH = 0x0002,
+ WORLDMAP_EAST = 0x0004,
+ WORLDMAP_WEST = 0x0008,
+
+ WORLDMAP_STOP = 0x0010
+ };
+
+private:
+ unsigned int id;
+
+ struct ImageSpec {
+ ImageSpec(const std::string& newfile, const Rect& newrect)
+ : file(newfile), rect(newrect)
+ { }
+
+ std::string file;
+ Rect rect;
+ };
+ std::vector<ImageSpec> imagespecs;
+ std::vector<Surface*> images;
+
+ std::string editor_imagefile;
+ Surface* editor_image;
+
+ /** tile attributes */
+ Uint32 attributes;
+
+ /** General purpose data attached to a tile (content of a box, type of coin)*/
+ int data;
+
+ float anim_fps;
+
+public:
+ ~Tile();
+
+ /** Draw a tile on the screen */
+ void draw(DrawingContext& context, const Vector& pos, int layer) const;
+
+ Surface* get_editor_image() const;
+
+ unsigned int getID() const
+ { return id; }
+
+ Uint32 getAttributes() const
+ { return attributes; }
+
+ int getData() const
+ { return data; }
+
+ /// returns the width of the tile in pixels
+ int getWidth() const
+ {
+ if(!images.size())
+ return 0;
+ return images[0]->w;
+ }
+
+ /// returns the height of the tiles in pixels
+ int getHeight() const
+ {
+ if(!images.size())
+ return 0;
+ return images[0]->h;
+ }
+
+protected:
+ friend class TileManager;
+ Tile();
+
+ void load_images(const std::string& tilesetpath);
+
+ /// parses the tile and returns it's id number
+ void parse(const lisp::Lisp& reader);
+ void parse_images(const lisp::Lisp& cur);
+};
+
+#endif
#include <memory>
#include <stdexcept>
#include <assert.h>
-#include "video/drawing_context.h"
-#include "lisp/lisp.h"
-#include "lisp/parser.h"
-#include "lisp/list_iterator.h"
-#include "tile.h"
-#include "tile_manager.h"
-#include "resources.h"
+#include "video/drawing_context.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/list_iterator.hpp"
+#include "tile.hpp"
+#include "tile_manager.hpp"
+#include "resources.hpp"
TileManager::TileManager(const std::string& filename)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef HEADER_TILE_MANAGER_HXX
-#define HEADER_TILE_MANAGER_HXX
-
-#include <set>
-#include <vector>
-#include <string>
-#include <map>
-#include <stdint.h>
-#include <assert.h>
-#include "tile.h"
-
-struct TileGroup
-{
- friend bool operator<(const TileGroup& lhs, const TileGroup& rhs)
- { return lhs.name < rhs.name; };
- friend bool operator>(const TileGroup& lhs, const TileGroup& rhs)
- { return lhs.name > rhs.name; };
-
- std::string name;
- std::vector<int> tiles;
-};
-
-class TileManager
-{
-private:
- typedef std::vector<Tile*> Tiles;
- Tiles tiles;
-
- static TileManager* instance_ ;
- std::set<TileGroup> tilegroups;
-
- std::string tiles_path;
-
- void load_tileset(std::string filename);
-
-public:
- TileManager(const std::string& filename);
- ~TileManager();
-
- const std::set<TileGroup>& get_tilegroups() const
- {
- return tilegroups;
- }
-
- const Tile* get(uint32_t id) const
- {
- //FIXME: Commenting out tiles in sprites.strf makes tiles.size() fail - it's being set to the first tile commented out.
- assert(id < tiles.size());
- Tile* tile = tiles[id];
- if(!tile) {
- std::cout << "TileManager: Invalid tile: " << id << std::endl;
- return tiles[0];
- }
-
- if(tile->images.size() == 0 && tile->imagespecs.size() != 0)
- tile->load_images(tiles_path);
-
- return tile;
- }
-
- uint32_t get_max_tileid() const
- {
- return tiles.size();
- }
-
- int get_default_width() const
- {
- return 32;
- }
-
- int get_default_height() const
- {
- return 32;
- }
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef HEADER_TILE_MANAGER_HXX
+#define HEADER_TILE_MANAGER_HXX
+
+#include <set>
+#include <vector>
+#include <string>
+#include <map>
+#include <stdint.h>
+#include <assert.h>
+#include "tile.hpp"
+
+struct TileGroup
+{
+ friend bool operator<(const TileGroup& lhs, const TileGroup& rhs)
+ { return lhs.name < rhs.name; };
+ friend bool operator>(const TileGroup& lhs, const TileGroup& rhs)
+ { return lhs.name > rhs.name; };
+
+ std::string name;
+ std::vector<int> tiles;
+};
+
+class TileManager
+{
+private:
+ typedef std::vector<Tile*> Tiles;
+ Tiles tiles;
+
+ static TileManager* instance_ ;
+ std::set<TileGroup> tilegroups;
+
+ std::string tiles_path;
+
+ void load_tileset(std::string filename);
+
+public:
+ TileManager(const std::string& filename);
+ ~TileManager();
+
+ const std::set<TileGroup>& get_tilegroups() const
+ {
+ return tilegroups;
+ }
+
+ const Tile* get(uint32_t id) const
+ {
+ //FIXME: Commenting out tiles in sprites.strf makes tiles.size() fail - it's being set to the first tile commented out.
+ assert(id < tiles.size());
+ Tile* tile = tiles[id];
+ if(!tile) {
+ std::cout << "TileManager: Invalid tile: " << id << std::endl;
+ return tiles[0];
+ }
+
+ if(tile->images.size() == 0 && tile->imagespecs.size() != 0)
+ tile->load_images(tiles_path);
+
+ return tile;
+ }
+
+ uint32_t get_max_tileid() const
+ {
+ return tiles.size();
+ }
+
+ int get_default_width() const
+ {
+ return 32;
+ }
+
+ int get_default_height() const
+ {
+ return 32;
+ }
+};
+
+#endif
#include <config.h>
#include <math.h>
-#include "timer.h"
+#include "timer.hpp"
float global_time = 0;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __SUPERTUX_TIMER_H__
-#define __SUPERTUX_TIMER_H__
-
-extern float global_time;
-
-/**
- * new simpler timer designed to be used in the update functions of objects
- */
-class Timer
-{
-public:
- Timer();
- ~Timer();
-
- /** start the timer with the given period (in seconds).
- * If cyclic=true then the timer willl be reset after each period.
- * Set period to zero if you want to disable the timer.
- */
- void start(float period, bool cyclic = false);
- /** returns true if a period (or more) passed since start call or last
- * successfull check
- */
- bool check();
- /** stop the timer */
- void stop()
- { start(0); }
-
- /** returns the period of the timer or 0 if it isn't started */
- float get_period() const
- { return period; }
- float get_timeleft() const
- { return period - (global_time - cycle_start); }
- float get_timegone() const
- { return global_time - cycle_start; }
- bool started() const
- { return period != 0 && get_timeleft() > 0; }
-
-private:
- float period;
- float cycle_start;
- bool cyclic;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __SUPERTUX_TIMER_H__
+#define __SUPERTUX_TIMER_H__
+
+extern float global_time;
+
+/**
+ * new simpler timer designed to be used in the update functions of objects
+ */
+class Timer
+{
+public:
+ Timer();
+ ~Timer();
+
+ /** start the timer with the given period (in seconds).
+ * If cyclic=true then the timer willl be reset after each period.
+ * Set period to zero if you want to disable the timer.
+ */
+ void start(float period, bool cyclic = false);
+ /** returns true if a period (or more) passed since start call or last
+ * successfull check
+ */
+ bool check();
+ /** stop the timer */
+ void stop()
+ { start(0); }
+
+ /** returns the period of the timer or 0 if it isn't started */
+ float get_period() const
+ { return period; }
+ float get_timeleft() const
+ { return period - (global_time - cycle_start); }
+ float get_timegone() const
+ { return global_time - cycle_start; }
+ bool started() const
+ { return period != 0 && get_timeleft() > 0; }
+
+private:
+ float period;
+ float cycle_start;
+ bool cyclic;
+};
+
+#endif
+
#include <ctype.h>
#include <errno.h>
-#include "tinygettext.h"
-#include "physfs/physfs_stream.h"
+#include "tinygettext.hpp"
+#include "physfs/physfs_stream.hpp"
//#define TRANSLATION_DEBUG
+++ /dev/null
-// $Id$
-//
-// TinyGetText - A small flexible gettext() replacement
-// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef HEADER_TINYGETTEXT_H
-#define HEADER_TINYGETTEXT_H
-
-#include <map>
-#include <vector>
-#include <set>
-#include <string>
-
-namespace TinyGetText {
-
-typedef int (*PluralFunc)(int n);
-
-struct LanguageDef {
- const char* code;
- const char* name;
- int nplural;
- PluralFunc plural;
-
- LanguageDef(const char* code_, const char* name_, int nplural_, PluralFunc plural_)
- : code(code_), name(name_), nplural(nplural_), plural(plural_)
- {}
-};
-
-/** A simple dictionary class that mimics gettext() behaviour. Each
- Dictionary only works for a single language, for managing multiple
- languages and .po files at once use the DictionaryManager. */
-class Dictionary
-{
-private:
- typedef std::map<std::string, std::string> Entries;
- Entries entries;
-
- typedef std::map<std::string, std::map<int, std::string> > PluralEntries;
- PluralEntries plural_entries;
-
- LanguageDef language;
- std::string charset;
-public:
- /** */
- Dictionary(const LanguageDef& language_, const std::string& charset = "");
-
- Dictionary();
-
- /** Return the charset used for this dictionary */
- std::string get_charset() const;
-
- /** Set a charset for this dictionary, this will NOT convert stuff,
- it is for information only, you have to convert stuff yourself
- when you add it with \a add_translation() */
- void set_charset(const std::string& charset);
-
- /** Set the language that is used for this dictionary, this is
- mainly needed to evaluate plural forms */
- void set_language(const LanguageDef& lang);
-
- /** Translate the string \a msgid to its correct plural form, based
- on the number of items given by \a num. \a msgid2 is \a msgid in
- plural form. */
- std::string translate(const std::string& msgid, const std::string& msgid2, int num);
-
- /** Translate the string \a msgid. */
- std::string translate(const std::string& msgid);
- /** Translate the string \a msgid. */
- const char* translate(const char* msgid);
-
- /** Add a translation from \a msgid to \a msgstr to the dictionary,
- where \a msgid is the singular form of the message, msgid2 the
- plural form and msgstrs a table of translations. The right
- translation will be calculated based on the \a num argument to
- translate(). */
- void add_translation(const std::string& msgid, const std::string& msgid2,
- const std::map<int, std::string>& msgstrs);
-
- /** Add a translation from \a msgid to \a msgstr to the
- dictionary */
- void add_translation(const std::string& msgid, const std::string& msgstr);
-};
-
-/** Manager class for dictionaries, you give it a bunch of directories
- with .po files and it will then automatically load the right file
- on demand depending on which language was set. */
-class DictionaryManager
-{
-private:
- typedef std::map<std::string, Dictionary> Dictionaries;
- Dictionaries dictionaries;
- typedef std::vector<std::string> SearchPath;
- SearchPath search_path;
- typedef std::map<std::string, std::string> Aliases;
- Aliases language_aliases;
- std::string charset;
- std::string language;
- Dictionary* current_dict;
- Dictionary empty_dict;
-
-public:
- DictionaryManager();
-
- /** Return the currently active dictionary, if none is set, an empty
- dictionary is returned. */
- Dictionary& get_dictionary()
- { return *current_dict; }
-
- /** Get dictionary for lang */
- Dictionary& get_dictionary(const std::string& langspec);
-
- /** Set a language based on a four? letter country code */
- void set_language(const std::string& langspec);
-
- /** returns the (normalized) country code of the currently used language */
- const std::string& get_language() const;
-
- /** Set a charset that will be set on the returned dictionaries */
- void set_charset(const std::string& charset);
-
- /** Define an alias for a language */
- void set_language_alias(const std::string& alias, const std::string& lang);
-
- /** Add a directory to the search path for dictionaries */
- void add_directory(const std::string& pathname);
-
- /** Return a set of the available languages in their country code */
- std::set<std::string> get_languages();
-
-private:
- void parseLocaleAliases();
- /// returns the language part in a language spec (like de_DE.UTF-8 -> de)
- std::string get_language_from_spec(const std::string& spec);
-};
-
-/** Read the content of the .po file given as \a in into the
- dictionary given as \a dict */
-void read_po_file(Dictionary& dict, std::istream& in);
-LanguageDef& get_language_def(const std::string& name);
-
-} // namespace TinyGetText
-
-#endif
-
-/* EOF */
--- /dev/null
+// $Id$
+//
+// TinyGetText - A small flexible gettext() replacement
+// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef HEADER_TINYGETTEXT_H
+#define HEADER_TINYGETTEXT_H
+
+#include <map>
+#include <vector>
+#include <set>
+#include <string>
+
+namespace TinyGetText {
+
+typedef int (*PluralFunc)(int n);
+
+struct LanguageDef {
+ const char* code;
+ const char* name;
+ int nplural;
+ PluralFunc plural;
+
+ LanguageDef(const char* code_, const char* name_, int nplural_, PluralFunc plural_)
+ : code(code_), name(name_), nplural(nplural_), plural(plural_)
+ {}
+};
+
+/** A simple dictionary class that mimics gettext() behaviour. Each
+ Dictionary only works for a single language, for managing multiple
+ languages and .po files at once use the DictionaryManager. */
+class Dictionary
+{
+private:
+ typedef std::map<std::string, std::string> Entries;
+ Entries entries;
+
+ typedef std::map<std::string, std::map<int, std::string> > PluralEntries;
+ PluralEntries plural_entries;
+
+ LanguageDef language;
+ std::string charset;
+public:
+ /** */
+ Dictionary(const LanguageDef& language_, const std::string& charset = "");
+
+ Dictionary();
+
+ /** Return the charset used for this dictionary */
+ std::string get_charset() const;
+
+ /** Set a charset for this dictionary, this will NOT convert stuff,
+ it is for information only, you have to convert stuff yourself
+ when you add it with \a add_translation() */
+ void set_charset(const std::string& charset);
+
+ /** Set the language that is used for this dictionary, this is
+ mainly needed to evaluate plural forms */
+ void set_language(const LanguageDef& lang);
+
+ /** Translate the string \a msgid to its correct plural form, based
+ on the number of items given by \a num. \a msgid2 is \a msgid in
+ plural form. */
+ std::string translate(const std::string& msgid, const std::string& msgid2, int num);
+
+ /** Translate the string \a msgid. */
+ std::string translate(const std::string& msgid);
+ /** Translate the string \a msgid. */
+ const char* translate(const char* msgid);
+
+ /** Add a translation from \a msgid to \a msgstr to the dictionary,
+ where \a msgid is the singular form of the message, msgid2 the
+ plural form and msgstrs a table of translations. The right
+ translation will be calculated based on the \a num argument to
+ translate(). */
+ void add_translation(const std::string& msgid, const std::string& msgid2,
+ const std::map<int, std::string>& msgstrs);
+
+ /** Add a translation from \a msgid to \a msgstr to the
+ dictionary */
+ void add_translation(const std::string& msgid, const std::string& msgstr);
+};
+
+/** Manager class for dictionaries, you give it a bunch of directories
+ with .po files and it will then automatically load the right file
+ on demand depending on which language was set. */
+class DictionaryManager
+{
+private:
+ typedef std::map<std::string, Dictionary> Dictionaries;
+ Dictionaries dictionaries;
+ typedef std::vector<std::string> SearchPath;
+ SearchPath search_path;
+ typedef std::map<std::string, std::string> Aliases;
+ Aliases language_aliases;
+ std::string charset;
+ std::string language;
+ Dictionary* current_dict;
+ Dictionary empty_dict;
+
+public:
+ DictionaryManager();
+
+ /** Return the currently active dictionary, if none is set, an empty
+ dictionary is returned. */
+ Dictionary& get_dictionary()
+ { return *current_dict; }
+
+ /** Get dictionary for lang */
+ Dictionary& get_dictionary(const std::string& langspec);
+
+ /** Set a language based on a four? letter country code */
+ void set_language(const std::string& langspec);
+
+ /** returns the (normalized) country code of the currently used language */
+ const std::string& get_language() const;
+
+ /** Set a charset that will be set on the returned dictionaries */
+ void set_charset(const std::string& charset);
+
+ /** Define an alias for a language */
+ void set_language_alias(const std::string& alias, const std::string& lang);
+
+ /** Add a directory to the search path for dictionaries */
+ void add_directory(const std::string& pathname);
+
+ /** Return a set of the available languages in their country code */
+ std::set<std::string> get_languages();
+
+private:
+ void parseLocaleAliases();
+ /// returns the language part in a language spec (like de_DE.UTF-8 -> de)
+ std::string get_language_from_spec(const std::string& spec);
+};
+
+/** Read the content of the .po file given as \a in into the
+ dictionary given as \a dict */
+void read_po_file(Dictionary& dict, std::istream& in);
+LanguageDef& get_language_def(const std::string& name);
+
+} // namespace TinyGetText
+
+#endif
+
+/* EOF */
#include <SDL_image.h>
#include <physfs.h>
-#include "title.h"
-#include "video/screen.h"
-#include "video/surface.h"
-#include "audio/sound_manager.h"
-#include "gui/menu.h"
-#include "timer.h"
-#include "lisp/lisp.h"
-#include "lisp/parser.h"
-#include "level.h"
-#include "level_subset.h"
-#include "game_session.h"
-#include "worldmap.h"
-#include "player_status.h"
-#include "tile.h"
-#include "sector.h"
-#include "object/tilemap.h"
-#include "object/camera.h"
-#include "object/player.h"
-#include "resources.h"
-#include "gettext.h"
-#include "misc.h"
-#include "textscroller.h"
-#include "file_system.h"
-#include "control/joystickkeyboardcontroller.h"
-#include "control/codecontroller.h"
-#include "main.h"
+#include "title.hpp"
+#include "video/screen.hpp"
+#include "video/surface.hpp"
+#include "audio/sound_manager.hpp"
+#include "gui/menu.hpp"
+#include "timer.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/parser.hpp"
+#include "level.hpp"
+#include "level_subset.hpp"
+#include "game_session.hpp"
+#include "worldmap.hpp"
+#include "player_status.hpp"
+#include "tile.hpp"
+#include "sector.hpp"
+#include "object/tilemap.hpp"
+#include "object/camera.hpp"
+#include "object/player.hpp"
+#include "resources.hpp"
+#include "gettext.hpp"
+#include "misc.hpp"
+#include "textscroller.hpp"
+#include "file_system.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
+#include "control/codecontroller.hpp"
+#include "main.hpp"
static Surface* bkg_title;
static Surface* logo;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// 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
- };
-
-void title();
-
-#endif //SUPERTUX_TITLE_H
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// 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
+ };
+
+void title();
+
+#endif //SUPERTUX_TITLE_H
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "door.h"
-#include "game_session.h"
-#include "resources.h"
-#include "object_factory.h"
-#include "sprite/sprite.h"
-#include "sprite/sprite_manager.h"
-#include "video/drawing_context.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
+#include "door.hpp"
+#include "game_session.hpp"
+#include "resources.hpp"
+#include "object_factory.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
Door::Door(const lisp::Lisp& reader)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_DOOR_H
-#define SUPERTUX_DOOR_H
-
-#include <string>
-
-#include "video/surface.h"
-#include "sprite/sprite.h"
-#include "trigger_base.h"
-#include "serializable.h"
-#include "timer.h"
-
-class Door : public TriggerBase, public Serializable
-{
-public:
- Door(const lisp::Lisp& reader);
- Door(int x, int y, std::string sector, std::string spawnpoint);
- virtual ~Door();
-
- virtual void write(lisp::Writer& writer);
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
- virtual void event(Player& player, EventType type);
-
-private:
- std::string target_sector;
- std::string target_spawnpoint;
- Sprite* sprite;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_DOOR_H
+#define SUPERTUX_DOOR_H
+
+#include <string>
+
+#include "video/surface.hpp"
+#include "sprite/sprite.hpp"
+#include "trigger_base.hpp"
+#include "serializable.hpp"
+#include "timer.hpp"
+
+class Door : public TriggerBase, public Serializable
+{
+public:
+ Door(const lisp::Lisp& reader);
+ Door(int x, int y, std::string sector, std::string spawnpoint);
+ virtual ~Door();
+
+ virtual void write(lisp::Writer& writer);
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+ virtual void event(Player& player, EventType type);
+
+private:
+ std::string target_sector;
+ std::string target_spawnpoint;
+ Sprite* sprite;
+};
+
+#endif
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "hatch.h"
-#include "game_session.h"
-#include "resources.h"
-#include "object_factory.h"
-#include "sprite/sprite.h"
-#include "sprite/sprite_manager.h"
-#include "video/drawing_context.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
+#include "hatch.hpp"
+#include "game_session.hpp"
+#include "resources.hpp"
+#include "object_factory.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
Hatch::Hatch(const lisp::Lisp& reader)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_HATCH_H
-#define SUPERTUX_HATCH_H
-
-#include <string>
-
-#include "video/surface.h"
-#include "sprite/sprite.h"
-#include "trigger_base.h"
-#include "serializable.h"
-#include "timer.h"
-
-class Hatch : public TriggerBase, public Serializable
-{
-public:
- Hatch(const lisp::Lisp& reader);
- Hatch(int x, int y, std::string sector, std::string spawnpoint);
- virtual ~Hatch();
-
- virtual void write(lisp::Writer& writer);
-
- virtual void update(float elapsed_time);
- virtual void draw(DrawingContext& context);
- virtual void event(Player& player, EventType type);
-
-private:
- std::string target_sector;
- std::string target_spawnpoint;
- Sprite* sprite;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_HATCH_H
+#define SUPERTUX_HATCH_H
+
+#include <string>
+
+#include "video/surface.hpp"
+#include "sprite/sprite.hpp"
+#include "trigger_base.hpp"
+#include "serializable.hpp"
+#include "timer.hpp"
+
+class Hatch : public TriggerBase, public Serializable
+{
+public:
+ Hatch(const lisp::Lisp& reader);
+ Hatch(int x, int y, std::string sector, std::string spawnpoint);
+ virtual ~Hatch();
+
+ virtual void write(lisp::Writer& writer);
+
+ virtual void update(float elapsed_time);
+ virtual void draw(DrawingContext& context);
+ virtual void event(Player& player, EventType type);
+
+private:
+ std::string target_sector;
+ std::string target_spawnpoint;
+ Sprite* sprite;
+};
+
+#endif
#include <stdexcept>\r
#include <memory>\r
\r
-#include "scripttrigger.h"\r
-#include "game_session.h"\r
-#include "lisp/lisp.h"\r
-#include "lisp/writer.h"\r
-#include "object_factory.h"\r
-#include "scripting/script_interpreter.h"\r
-#include "sector.h"\r
+#include "scripttrigger.hpp"\r
+#include "game_session.hpp"\r
+#include "lisp/lisp.hpp"\r
+#include "lisp/writer.hpp"\r
+#include "object_factory.hpp"\r
+#include "scripting/script_interpreter.hpp"\r
+#include "sector.hpp"\r
\r
ScriptTrigger::ScriptTrigger(const lisp::Lisp& reader)\r
{\r
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __SCRIPTTRIGGER_H__
-#define __SCRIPTTRIGGER_H__
-
-#include "trigger_base.h"
-#include "serializable.h"
-
-class ScriptTrigger : public TriggerBase, public Serializable
-{
-public:
- ScriptTrigger(const lisp::Lisp& reader);
- ScriptTrigger(const Vector& pos, const std::string& script);
- ~ScriptTrigger();
-
- void write(lisp::Writer& writer);
- void event(Player& player, EventType type);
-
-private:
- EventType triggerevent;
- std::string script;
-};
-
-#endif
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __SCRIPTTRIGGER_H__
+#define __SCRIPTTRIGGER_H__
+
+#include "trigger_base.hpp"
+#include "serializable.hpp"
+
+class ScriptTrigger : public TriggerBase, public Serializable
+{
+public:
+ ScriptTrigger(const lisp::Lisp& reader);
+ ScriptTrigger(const Vector& pos, const std::string& script);
+ ~ScriptTrigger();
+
+ void write(lisp::Writer& writer);
+ void event(Player& player, EventType type);
+
+private:
+ EventType triggerevent;
+ std::string script;
+};
+
+#endif
// 02111-1307, USA.
#include <config.h>
-#include "secretarea_trigger.h"
-#include "game_session.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "object_factory.h"
-#include "main.h"
+#include "secretarea_trigger.hpp"
+#include "game_session.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "object_factory.hpp"
+#include "main.hpp"
static const float MESSAGE_TIME=3.5;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef __SECRETAREA_TRIGGER_H__
-#define __SECRETAREA_TRIGGER_H__
-
-#include "trigger_base.h"
-#include "serializable.h"
-#include "resources.h"
-#include "video/drawing_context.h"
-#include "timer.h"
-
-class SecretAreaTrigger : public TriggerBase, public Serializable
-{
-public:
- SecretAreaTrigger(const lisp::Lisp& reader);
- SecretAreaTrigger(const Rect& area);
- ~SecretAreaTrigger();
-
- void write(lisp::Writer& writer);
- void event(Player& player, EventType type);
- void draw(DrawingContext& context);
-
-private:
- std::string message;
- Timer message_timer;
- bool message_displayed;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef __SECRETAREA_TRIGGER_H__
+#define __SECRETAREA_TRIGGER_H__
+
+#include "trigger_base.hpp"
+#include "serializable.hpp"
+#include "resources.hpp"
+#include "video/drawing_context.hpp"
+#include "timer.hpp"
+
+class SecretAreaTrigger : public TriggerBase, public Serializable
+{
+public:
+ SecretAreaTrigger(const lisp::Lisp& reader);
+ SecretAreaTrigger(const Rect& area);
+ ~SecretAreaTrigger();
+
+ void write(lisp::Writer& writer);
+ void event(Player& player, EventType type);
+ void draw(DrawingContext& context);
+
+private:
+ std::string message;
+ Timer message_timer;
+ bool message_displayed;
+};
+
+#endif
+
#include <config.h>
-#include "sequence_trigger.h"
-#include "game_session.h"
-#include "lisp/lisp.h"
-#include "lisp/writer.h"
-#include "object_factory.h"
+#include "sequence_trigger.hpp"
+#include "game_session.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
+#include "object_factory.hpp"
SequenceTrigger::SequenceTrigger(const lisp::Lisp& reader)
{
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-
-#ifndef __SEQUENCE_TRIGGER_H__
-#define __SEQUENCE_TRIGGER_H__
-
-#include "trigger_base.h"
-#include "serializable.h"
-
-class SequenceTrigger : public TriggerBase, public Serializable
-{
-public:
- SequenceTrigger(const lisp::Lisp& reader);
- SequenceTrigger(const Vector& pos, const std::string& sequence);
- ~SequenceTrigger();
-
- void write(lisp::Writer& writer);
- void event(Player& player, EventType type);
-
-private:
- EventType triggerevent;
- std::string sequence_name;
-};
-
-#endif
-
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
+#ifndef __SEQUENCE_TRIGGER_H__
+#define __SEQUENCE_TRIGGER_H__
+
+#include "trigger_base.hpp"
+#include "serializable.hpp"
+
+class SequenceTrigger : public TriggerBase, public Serializable
+{
+public:
+ SequenceTrigger(const lisp::Lisp& reader);
+ SequenceTrigger(const Vector& pos, const std::string& sequence);
+ ~SequenceTrigger();
+
+ void write(lisp::Writer& writer);
+ void event(Player& player, EventType type);
+
+private:
+ EventType triggerevent;
+ std::string sequence_name;
+};
+
+#endif
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
-#include "trigger_base.h"
-#include "video/drawing_context.h"
-#include "object/player.h"
+#include "trigger_base.hpp"
+#include "video/drawing_context.hpp"
+#include "object/player.hpp"
TriggerBase::TriggerBase()
: sprite(0)
+++ /dev/null
-// $Id$
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_TRIGGER_BASE_H
-#define SUPERTUX_TRIGGER_BASE_H
-
-#include "moving_object.h"
-#include "math/rect.h"
-#include "sprite/sprite.h"
-
-class Player;
-
-/** This class is the base class for all objects you can interact with in some
- * way. There are several interaction types defined like touch and activate
- */
-class TriggerBase : public MovingObject
-{
-public:
- enum EventType {
- EVENT_TOUCH, EVENT_ACTIVATE
- };
-
- TriggerBase();
- ~TriggerBase();
-
- void update(float elapsed_time);
- void draw(DrawingContext& context);
- HitResponse collision(GameObject& other, const CollisionHit& hit);
-
- /**
- * Receive trigger events
- */
- virtual void event(Player& player, EventType type) = 0;
-
-private:
- Sprite* sprite;
- bool lasthit;
- bool hit;
-};
-
-#endif /*SUPERTUX_INTERACTIVE_OBJECT_H*/
-
--- /dev/null
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_TRIGGER_BASE_H
+#define SUPERTUX_TRIGGER_BASE_H
+
+#include "moving_object.hpp"
+#include "math/rect.hpp"
+#include "sprite/sprite.hpp"
+
+class Player;
+
+/** This class is the base class for all objects you can interact with in some
+ * way. There are several interaction types defined like touch and activate
+ */
+class TriggerBase : public MovingObject
+{
+public:
+ enum EventType {
+ EVENT_TOUCH, EVENT_ACTIVATE
+ };
+
+ TriggerBase();
+ ~TriggerBase();
+
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+
+ /**
+ * Receive trigger events
+ */
+ virtual void event(Player& player, EventType type) = 0;
+
+private:
+ Sprite* sprite;
+ bool lasthit;
+ bool hit;
+};
+
+#endif /*SUPERTUX_INTERACTIVE_OBJECT_H*/
+
#include <cassert>
#include <iostream>
-#include "drawing_context.h"
-#include "surface.h"
-#include "font.h"
-#include "main.h"
-#include "gameconfig.h"
+#include "drawing_context.hpp"
+#include "surface.hpp"
+#include "font.hpp"
+#include "main.hpp"
+#include "gameconfig.hpp"
DrawingContext::DrawingContext(SDL_Surface* targetsurface)
{
+++ /dev/null
-// $Id: drawing_context.h 2334 2005-04-04 16:26:14Z grumbel $
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_DRAWINGCONTEXT_H
-#define SUPERTUX_DRAWINGCONTEXT_H
-
-#include <vector>
-#include <string>
-#include <stdint.h>
-
-#include <SDL.h>
-#include <stdint.h>
-
-#include "math/vector.h"
-#include "video/screen.h"
-#include "video/surface.h"
-#include "video/font.h"
-
-class Surface;
-
-// some constants for predefined layer values
-enum {
- LAYER_BACKGROUND0 = -300,
- LAYER_BACKGROUND1 = -200,
- LAYER_BACKGROUNDTILES = -100,
- LAYER_TILES = 0,
- LAYER_OBJECTS = 100,
- LAYER_FOREGROUNDTILES = 200,
- LAYER_FOREGROUND0 = 300,
- LAYER_FOREGROUND1 = 400,
- LAYER_GUI = 500
-};
-
-/// Handles drawing of things.
-/**
- * This class provides functions for drawing things on screen. It also
- * maintains a stack of transforms that are applied to graphics.
- */
-class DrawingContext
-{
-public:
- DrawingContext(SDL_Surface* targetsurface = 0);
- ~DrawingContext();
-
- /// Adds a drawing request for a surface into the request list.
- void draw_surface(const Surface* surface, const Vector& position,
- int layer);
- /// Adds a drawing request for part of a surface.
- void draw_surface_part(const Surface* surface, const Vector& source,
- const Vector& size, const Vector& dest, int layer);
- /// Draws a text.
- void draw_text(const Font* font, const std::string& text,
- const Vector& position, FontAlignment alignment, int layer);
-
- /// Draws text on screen center (feed Vector.x with a 0).
- /// This is the same as draw_text() with a SCREEN_WIDTH/2 position and
- /// alignment set to LEFT_ALLIGN
- void draw_center_text(const Font* font, const std::string& text,
- const Vector& position, int layer);
- /// Draws a color gradient onto the whole screen */
- void draw_gradient(Color from, Color to, int layer);
- /// Fills a rectangle.
- void draw_filled_rect(const Vector& topleft, const Vector& size,
- Color color, int layer);
-
- /// Processes all pending drawing requests and flushes the list.
- void do_drawing();
-
- const Vector& get_translation() const
- { return transform.translation; }
-
- void set_translation(const Vector& newtranslation)
- { transform.translation = newtranslation; }
-
- void push_transform();
- void pop_transform();
-
- /// Apply that effect in the next draws (effects are listed on surface.h).
- void set_drawing_effect(uint32_t effect);
- /// return currently applied drawing effect
- uint32_t get_drawing_effect() const;
- /// apply that zoom in the next draws */
- void set_zooming(float zoom);
- /// apply that alpha in the next draws */
- void set_alpha(uint8_t alpha);
- /// return currently set alpha
- uint8_t get_alpha() const;
-
-private:
- class Transform
- {
- public:
- Vector translation;
- uint32_t drawing_effect;
- float zoom;
- uint8_t alpha;
-
- Transform()
- : drawing_effect(NONE_EFFECT), zoom(1), alpha(255)
- { }
-
- Vector apply(const Vector& v) const
- {
- return v - translation;
- }
- };
-
- /// the transform stack
- std::vector<Transform> transformstack;
- /// the currently active transform
- Transform transform;
-
- enum RequestType
- {
- SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT
- };
-
- struct SurfacePartRequest
- {
- const Surface* surface;
- Vector source, size;
- };
-
- struct TextRequest
- {
- const Font* font;
- std::string text;
- FontAlignment alignment;
- };
-
- struct GradientRequest
- {
- Color top, bottom;
- Vector size;
- };
-
- struct FillRectRequest
- {
- Color color;
- Vector size;
- };
-
- struct DrawingRequest
- {
- RequestType type;
- Vector pos;
-
- int layer;
- uint32_t drawing_effect;
- float zoom;
- int alpha;
-
- void* request_data;
-
- bool operator<(const DrawingRequest& other) const
- {
- return layer < other.layer;
- }
- };
-
- void draw_surface_part(DrawingRequest& request);
- void draw_text(DrawingRequest& request);
- void draw_text_center(DrawingRequest& request);
- void draw_gradient(DrawingRequest& request);
- void draw_filled_rect(DrawingRequest& request);
-
- typedef std::vector<DrawingRequest> DrawingRequests;
- DrawingRequests drawingrequests;
-
- SDL_Surface* screen;
-};
-
-#endif
--- /dev/null
+// $Id: drawing_context.h 2334 2005-04-04 16:26:14Z grumbel $
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_DRAWINGCONTEXT_H
+#define SUPERTUX_DRAWINGCONTEXT_H
+
+#include <vector>
+#include <string>
+#include <stdint.h>
+
+#include <SDL.h>
+#include <stdint.h>
+
+#include "math/vector.hpp"
+#include "video/screen.hpp"
+#include "video/surface.hpp"
+#include "video/font.hpp"
+
+class Surface;
+
+// some constants for predefined layer values
+enum {
+ LAYER_BACKGROUND0 = -300,
+ LAYER_BACKGROUND1 = -200,
+ LAYER_BACKGROUNDTILES = -100,
+ LAYER_TILES = 0,
+ LAYER_OBJECTS = 100,
+ LAYER_FOREGROUNDTILES = 200,
+ LAYER_FOREGROUND0 = 300,
+ LAYER_FOREGROUND1 = 400,
+ LAYER_GUI = 500
+};
+
+/// Handles drawing of things.
+/**
+ * This class provides functions for drawing things on screen. It also
+ * maintains a stack of transforms that are applied to graphics.
+ */
+class DrawingContext
+{
+public:
+ DrawingContext(SDL_Surface* targetsurface = 0);
+ ~DrawingContext();
+
+ /// Adds a drawing request for a surface into the request list.
+ void draw_surface(const Surface* surface, const Vector& position,
+ int layer);
+ /// Adds a drawing request for part of a surface.
+ void draw_surface_part(const Surface* surface, const Vector& source,
+ const Vector& size, const Vector& dest, int layer);
+ /// Draws a text.
+ void draw_text(const Font* font, const std::string& text,
+ const Vector& position, FontAlignment alignment, int layer);
+
+ /// Draws text on screen center (feed Vector.x with a 0).
+ /// This is the same as draw_text() with a SCREEN_WIDTH/2 position and
+ /// alignment set to LEFT_ALLIGN
+ void draw_center_text(const Font* font, const std::string& text,
+ const Vector& position, int layer);
+ /// Draws a color gradient onto the whole screen */
+ void draw_gradient(Color from, Color to, int layer);
+ /// Fills a rectangle.
+ void draw_filled_rect(const Vector& topleft, const Vector& size,
+ Color color, int layer);
+
+ /// Processes all pending drawing requests and flushes the list.
+ void do_drawing();
+
+ const Vector& get_translation() const
+ { return transform.translation; }
+
+ void set_translation(const Vector& newtranslation)
+ { transform.translation = newtranslation; }
+
+ void push_transform();
+ void pop_transform();
+
+ /// Apply that effect in the next draws (effects are listed on surface.h).
+ void set_drawing_effect(uint32_t effect);
+ /// return currently applied drawing effect
+ uint32_t get_drawing_effect() const;
+ /// apply that zoom in the next draws */
+ void set_zooming(float zoom);
+ /// apply that alpha in the next draws */
+ void set_alpha(uint8_t alpha);
+ /// return currently set alpha
+ uint8_t get_alpha() const;
+
+private:
+ class Transform
+ {
+ public:
+ Vector translation;
+ uint32_t drawing_effect;
+ float zoom;
+ uint8_t alpha;
+
+ Transform()
+ : drawing_effect(NONE_EFFECT), zoom(1), alpha(255)
+ { }
+
+ Vector apply(const Vector& v) const
+ {
+ return v - translation;
+ }
+ };
+
+ /// the transform stack
+ std::vector<Transform> transformstack;
+ /// the currently active transform
+ Transform transform;
+
+ enum RequestType
+ {
+ SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT
+ };
+
+ struct SurfacePartRequest
+ {
+ const Surface* surface;
+ Vector source, size;
+ };
+
+ struct TextRequest
+ {
+ const Font* font;
+ std::string text;
+ FontAlignment alignment;
+ };
+
+ struct GradientRequest
+ {
+ Color top, bottom;
+ Vector size;
+ };
+
+ struct FillRectRequest
+ {
+ Color color;
+ Vector size;
+ };
+
+ struct DrawingRequest
+ {
+ RequestType type;
+ Vector pos;
+
+ int layer;
+ uint32_t drawing_effect;
+ float zoom;
+ int alpha;
+
+ void* request_data;
+
+ bool operator<(const DrawingRequest& other) const
+ {
+ return layer < other.layer;
+ }
+ };
+
+ void draw_surface_part(DrawingRequest& request);
+ void draw_text(DrawingRequest& request);
+ void draw_text_center(DrawingRequest& request);
+ void draw_gradient(DrawingRequest& request);
+ void draw_filled_rect(DrawingRequest& request);
+
+ typedef std::vector<DrawingRequest> DrawingRequests;
+ DrawingRequests drawingrequests;
+
+ SDL_Surface* screen;
+};
+
+#endif
#include <cstring>
#include <stdexcept>
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "screen.h"
-#include "font.h"
-#include "drawing_context.h"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "screen.hpp"
+#include "font.hpp"
+#include "drawing_context.hpp"
Font::Font(const std::string& file, FontType ntype, int nw, int nh,
int nshadowsize)
+++ /dev/null
-// $Id: font.h 2298 2005-03-30 12:01:02Z matzebraun $
-//
-// SuperTux
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef SUPERTUX_FONT_H
-#define SUPERTUX_FONT_H
-
-#include <string>
-#include <stdint.h>
-
-#include "video/surface.h"
-#include "math/vector.h"
-
-enum FontAlignment {
- LEFT_ALLIGN,
- CENTER_ALLIGN,
- RIGHT_ALLIGN
-};
-
-class Font
-{
-public:
- enum FontType {
- TEXT, // images for all characters
- NUM // only images for numbers
- };
-
- Font(const std::string& file, FontType type, int w, int h,
- int shadowsize=2);
- ~Font();
-
- /** returns the width of a given text. (Note that I won't add a normal
- * get_width function here, as we might switch to variable width fonts in the
- * future.)
- * Supports breaklines.
- */
- float get_text_width(const std::string& text) const;
-
- /** returns the height of a given text. This function supports breaklines.
- * In case, you are positive that your text doesn't use break lines, you can
- * just use get_height().
- */
- float get_text_height(const std::string& text) const;
- /// returns the height of the font.
- float get_height() const;
-
- /** Draws the given text to the screen. Also needs the position.
- * Type of alignment, drawing effect and alpha are optional. */
- void draw(const std::string& text, const Vector& pos,
- FontAlignment allignment = LEFT_ALLIGN,
- uint32_t drawing_effect = NONE_EFFECT, uint8_t alpha = 255) const;
-
-private:
- friend class DrawingContext;
-
- void draw_text(const std::string& text, const Vector& pos,
- uint32_t drawing_effect = NONE_EFFECT, uint8_t alpha = 255) const;
-
- void draw_chars(Surface* pchars, const std::string& text,
- const Vector& position, uint32_t drawing_effect, uint8_t alpha) const;
-
- Surface* chars;
- Surface* shadow_chars;
- FontType type;
- int w;
- int h;
- int shadowsize;
-
- /// the number of the first character that is represented in the font
- uint32_t first_char;
- /// the number of the last character that is represented in the font
- uint32_t char_count;
-};
-
-#endif
--- /dev/null
+// $Id: font.h 2298 2005-03-30 12:01:02Z matzebraun $
+//
+// SuperTux
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef SUPERTUX_FONT_H
+#define SUPERTUX_FONT_H
+
+#include <string>
+#include <stdint.h>
+
+#include "video/surface.hpp"
+#include "math/vector.hpp"
+
+enum FontAlignment {
+ LEFT_ALLIGN,
+ CENTER_ALLIGN,
+ RIGHT_ALLIGN
+};
+
+class Font
+{
+public:
+ enum FontType {
+ TEXT, // images for all characters
+ NUM // only images for numbers
+ };
+
+ Font(const std::string& file, FontType type, int w, int h,
+ int shadowsize=2);
+ ~Font();
+
+ /** returns the width of a given text. (Note that I won't add a normal
+ * get_width function here, as we might switch to variable width fonts in the
+ * future.)
+ * Supports breaklines.
+ */
+ float get_text_width(const std::string& text) const;
+
+ /** returns the height of a given text. This function supports breaklines.
+ * In case, you are positive that your text doesn't use break lines, you can
+ * just use get_height().
+ */
+ float get_text_height(const std::string& text) const;
+ /// returns the height of the font.
+ float get_height() const;
+
+ /** Draws the given text to the screen. Also needs the position.
+ * Type of alignment, drawing effect and alpha are optional. */
+ void draw(const std::string& text, const Vector& pos,
+ FontAlignment allignment = LEFT_ALLIGN,
+ uint32_t drawing_effect = NONE_EFFECT, uint8_t alpha = 255) const;
+
+private:
+ friend class DrawingContext;
+
+ void draw_text(const std::string& text, const Vector& pos,
+ uint32_t drawing_effect = NONE_EFFECT, uint8_t alpha = 255) const;
+
+ void draw_chars(Surface* pchars, const std::string& text,
+ const Vector& position, uint32_t drawing_effect, uint8_t alpha) const;
+
+ Surface* chars;
+ Surface* shadow_chars;
+ FontType type;
+ int w;
+ int h;
+ int shadowsize;
+
+ /// the number of the first character that is represented in the font
+ uint32_t first_char;
+ /// the number of the last character that is represented in the font
+ uint32_t char_count;
+};
+
+#endif
#include <ctype.h>
#endif
-#include "gameconfig.h"
-#include "screen.h"
-#include "main.h"
-#include "video/drawing_context.h"
-#include "math/vector.h"
+#include "gameconfig.hpp"
+#include "screen.hpp"
+#include "main.hpp"
+#include "video/drawing_context.hpp"
+#include "math/vector.hpp"
static const float LOOP_DELAY = 20.0;
extern SDL_Surface* screen;
+++ /dev/null
-// $Id: screen.h 1850 2004-08-27 20:34:56Z rmcruz $
-//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_SCREEN_H
-#define SUPERTUX_SCREEN_H
-
-#include <SDL.h>
-#include <SDL_opengl.h>
-#include <iostream>
-
-#include <vector>
-#include "math/vector.h"
-
-/** Stores 8bit RGBA values. */
-class Color
-{
-public:
- Color()
- : red(0), green(0), blue(0), alpha(255)
- {}
-
- Color(Uint8 red_, Uint8 green_, Uint8 blue_, Uint8 alpha_ = 255)
- : red(red_), green(green_), blue(blue_), alpha(alpha_)
- {}
-
- Color(std::vector <unsigned int> color)
- : red(0), green(0), blue(0), alpha(255)
- { if(color.size() >= 3) { red = color[0]; green = color[1]; blue = color[2]; }
- if(color.size() == 4) alpha = color[3]; }
-
- Color(std::vector <int> color)
- : red(0), green(0), blue(0), alpha(255)
- { if(color.size() >= 3) { red = color[0]; green = color[1]; blue = color[2]; }
- if(color.size() == 4) alpha = color[3]; }
-
- Color(const Color& o)
- : red(o.red), green(o.green), blue(o.blue), alpha(o.alpha)
- { }
-
- bool operator==(const Color& o)
- {
- if(red == o.red && green == o.green &&
- blue == o.blue && alpha == o.alpha)
- return true;
- return false;
- }
-
- Uint32 map_rgb(SDL_Surface* surface)
- { return SDL_MapRGB(surface->format, red, green, blue); }
- Uint32 map_rgba(SDL_Surface* surface)
- { return SDL_MapRGBA(surface->format, red, green, blue, alpha); }
-
- Uint8 red, green, blue, alpha;
-};
-
-Uint32 getpixel(SDL_Surface* surface, int x, int y);
-void putpixel(SDL_Surface* surface, int x, int y, Uint32 pixel);
-void drawpixel(int x, int y, Uint32 pixel);
-void fillrect(float x, float y, float w, float h, int r, int g, int b, int a = 255);
-void draw_line(float x1, float y1, float x2, float y2, int r, int g, int b, int a = 255);
-
-void fadeout(int fade_time);
-void shrink_fade(const Vector& point, int fade_time);
-
-#endif
--- /dev/null
+// $Id: screen.h 1850 2004-08-27 20:34:56Z rmcruz $
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_SCREEN_H
+#define SUPERTUX_SCREEN_H
+
+#include <SDL.h>
+#include <SDL_opengl.h>
+#include <iostream>
+
+#include <vector>
+#include "math/vector.hpp"
+
+/** Stores 8bit RGBA values. */
+class Color
+{
+public:
+ Color()
+ : red(0), green(0), blue(0), alpha(255)
+ {}
+
+ Color(Uint8 red_, Uint8 green_, Uint8 blue_, Uint8 alpha_ = 255)
+ : red(red_), green(green_), blue(blue_), alpha(alpha_)
+ {}
+
+ Color(std::vector <unsigned int> color)
+ : red(0), green(0), blue(0), alpha(255)
+ { if(color.size() >= 3) { red = color[0]; green = color[1]; blue = color[2]; }
+ if(color.size() == 4) alpha = color[3]; }
+
+ Color(std::vector <int> color)
+ : red(0), green(0), blue(0), alpha(255)
+ { if(color.size() >= 3) { red = color[0]; green = color[1]; blue = color[2]; }
+ if(color.size() == 4) alpha = color[3]; }
+
+ Color(const Color& o)
+ : red(o.red), green(o.green), blue(o.blue), alpha(o.alpha)
+ { }
+
+ bool operator==(const Color& o)
+ {
+ if(red == o.red && green == o.green &&
+ blue == o.blue && alpha == o.alpha)
+ return true;
+ return false;
+ }
+
+ Uint32 map_rgb(SDL_Surface* surface)
+ { return SDL_MapRGB(surface->format, red, green, blue); }
+ Uint32 map_rgba(SDL_Surface* surface)
+ { return SDL_MapRGBA(surface->format, red, green, blue, alpha); }
+
+ Uint8 red, green, blue, alpha;
+};
+
+Uint32 getpixel(SDL_Surface* surface, int x, int y);
+void putpixel(SDL_Surface* surface, int x, int y, Uint32 pixel);
+void drawpixel(int x, int y, Uint32 pixel);
+void fillrect(float x, float y, float w, float h, int r, int g, int b, int a = 255);
+void draw_line(float x1, float y1, float x2, float y2, int r, int g, int b, int a = 255);
+
+void fadeout(int fade_time);
+void shrink_fade(const Vector& point, int fade_time);
+
+#endif
#include <SDL.h>
#include <SDL_image.h>
-#include "gameconfig.h"
-#include "physfs/physfs_sdl.h"
-#include "video/surface.h"
-#include "video/screen.h"
+#include "gameconfig.hpp"
+#include "physfs/physfs_sdl.hpp"
+#include "video/surface.hpp"
+#include "video/screen.hpp"
Surface::Surfaces Surface::surfaces;
+++ /dev/null
-// $Id: surface.h 2175 2004-11-24 19:02:49Z sik0fewl $
-//
-// SuperTux
-// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-// 02111-1307, USA.
-#ifndef SUPERTUX_TEXTURE_H
-#define SUPERTUX_TEXTURE_H
-
-#include <string>
-#include <list>
-
-#include <SDL.h>
-#include <SDL_opengl.h>
-
-#include "math/vector.h"
-#include "video/screen.h"
-
-void apply_filter_to_surface(SDL_Surface *surface, int filter, int value);
-SDL_Surface* sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, bool use_alpha);
-SDL_Surface* sdl_surface_from_nothing();
-
-class SurfaceImpl;
-class SurfaceSDL;
-class SurfaceOpenGL;
-class DrawingContext;
-
-/// bitset for drawing effects
-enum {
- /** Don't apply anything */
- NONE_EFFECT = 0x0000,
- /** Draw the Surface upside down */
- VERTICAL_FLIP = 0x0001,
- /** Draw the Surface from left to down */
- HORIZONTAL_FLIP = 0x0002,
- /** Draw the Surface with alpha equal to 128 */
- SEMI_TRANSPARENT = 0x0004
-};
-
-/// types of filters
-enum {
- HORIZONTAL_FLIP_FILTER,
- MASK_FILTER,
- NONE_FILTER
-};
-
-/** This class holds all the data necessary to construct a surface */
-class SurfaceData
-{
-public:
- enum ConstructorType { LOAD, LOAD_PART, SURFACE, GRADIENT };
- ConstructorType type;
- SDL_Surface* surface;
- std::string file;
-
- struct Filter { int type; Color color; };
- std::vector<Filter> applied_filters;
-
- bool use_alpha;
- int x;
- int y;
- int w;
- int h;
- Color top_gradient;
- Color bottom_gradient;
-
- SurfaceData(SDL_Surface* surf, bool use_alpha_);
- SurfaceData(const std::string& file_, bool use_alpha_);
- SurfaceData(const std::string& file_, int x_, int y_, int w_, int h_, bool use_alpha_);
- SurfaceData(Color top_gradient_, Color bottom_gradient_, int w_, int h_);
- ~SurfaceData();
-
- SurfaceSDL* create_SurfaceSDL();
- SurfaceOpenGL* create_SurfaceOpenGL();
- SurfaceImpl* create();
-};
-
-
-/** Container class that holds a surface, necessary so that we can
- * switch Surface implementations (OpenGL, SDL) on the fly
- */
-class Surface
-{
-public:
- SurfaceImpl* impl;
- SurfaceData data;
- int w;
- int h;
-
- typedef std::list<Surface*> Surfaces;
- static Surfaces surfaces;
-public:
- static void reload_all();
- static void debug_check();
-
- Surface(SDL_Surface* surf, bool use_alpha);
- Surface(const std::string& file, bool use_alpha);
- Surface(const std::string& file, int x, int y, int w, int h, bool use_alpha);
- Surface(Color top_gradient, Color bottom_gradient, int w_, int h_);
- ~Surface();
-
- /** Reload the surface, which is necesarry in case of a mode swich */
- void reload();
-
- void apply_filter(int filter, Color color = Color(0,0,0));
-};
-
-/** Surface implementation, all implementation have to inherit from
- this class */
-class SurfaceImpl
-{
-protected:
- SDL_Surface* sdl_surface;
-
-public:
- int w;
- int h;
-
-public:
- SurfaceImpl();
- virtual ~SurfaceImpl();
-
- /** Return 0 on success, -2 if surface needs to be reloaded */
- virtual int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
- virtual int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
- virtual int draw_stretched(float x, float y, int w, int h, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
-
-
- SDL_Surface* get_sdl_surface() const; // @evil@ try to avoid this function
-
- virtual void apply_filter(int filter, Color color = Color(0,0,0)) = 0;
-};
-
-class SurfaceSDL : public SurfaceImpl
-{
-public:
- SurfaceSDL(SDL_Surface* surf, bool use_alpha);
- SurfaceSDL(const std::string& file, bool use_alpha);
- SurfaceSDL(const std::string& file, int x, int y, int w_, int h_, bool use_alpha);
- SurfaceSDL(Color top_gradient, Color bottom_gradient, int w, int h);
- virtual ~SurfaceSDL();
-
- int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT);
- int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT);
- int draw_stretched(float x, float y, int w, int h, Uint8 alpha, Uint32 effect = NONE_EFFECT);
-
- void apply_filter(int filter, Color color);
-};
-
-class SurfaceOpenGL : public SurfaceImpl
-{
-public:
- GLuint gl_texture;
-
-public:
- SurfaceOpenGL(SDL_Surface* surf, bool use_alpha);
- SurfaceOpenGL(const std::string& file, bool use_alpha);
- SurfaceOpenGL(const std::string& file, int x, int y, int w, int h, bool use_alpha);
- SurfaceOpenGL(Color top_gradient, Color bottom_gradient, int w, int h);
-
- virtual ~SurfaceOpenGL();
-
- int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT);
- int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT);
- int draw_stretched(float x, float y, int w, int h, Uint8 alpha, Uint32 effect = NONE_EFFECT);
-
- void apply_filter(int filter, Color color);
-
-private:
- void create_gl(SDL_Surface * surf, GLuint * tex);
-};
-
-#endif
--- /dev/null
+// $Id: surface.h 2175 2004-11-24 19:02:49Z sik0fewl $
+//
+// SuperTux
+// Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+#ifndef SUPERTUX_TEXTURE_H
+#define SUPERTUX_TEXTURE_H
+
+#include <string>
+#include <list>
+
+#include <SDL.h>
+#include <SDL_opengl.h>
+
+#include "math/vector.hpp"
+#include "video/screen.hpp"
+
+void apply_filter_to_surface(SDL_Surface *surface, int filter, int value);
+SDL_Surface* sdl_surface_from_sdl_surface(SDL_Surface* sdl_surf, bool use_alpha);
+SDL_Surface* sdl_surface_from_nothing();
+
+class SurfaceImpl;
+class SurfaceSDL;
+class SurfaceOpenGL;
+class DrawingContext;
+
+/// bitset for drawing effects
+enum {
+ /** Don't apply anything */
+ NONE_EFFECT = 0x0000,
+ /** Draw the Surface upside down */
+ VERTICAL_FLIP = 0x0001,
+ /** Draw the Surface from left to down */
+ HORIZONTAL_FLIP = 0x0002,
+ /** Draw the Surface with alpha equal to 128 */
+ SEMI_TRANSPARENT = 0x0004
+};
+
+/// types of filters
+enum {
+ HORIZONTAL_FLIP_FILTER,
+ MASK_FILTER,
+ NONE_FILTER
+};
+
+/** This class holds all the data necessary to construct a surface */
+class SurfaceData
+{
+public:
+ enum ConstructorType { LOAD, LOAD_PART, SURFACE, GRADIENT };
+ ConstructorType type;
+ SDL_Surface* surface;
+ std::string file;
+
+ struct Filter { int type; Color color; };
+ std::vector<Filter> applied_filters;
+
+ bool use_alpha;
+ int x;
+ int y;
+ int w;
+ int h;
+ Color top_gradient;
+ Color bottom_gradient;
+
+ SurfaceData(SDL_Surface* surf, bool use_alpha_);
+ SurfaceData(const std::string& file_, bool use_alpha_);
+ SurfaceData(const std::string& file_, int x_, int y_, int w_, int h_, bool use_alpha_);
+ SurfaceData(Color top_gradient_, Color bottom_gradient_, int w_, int h_);
+ ~SurfaceData();
+
+ SurfaceSDL* create_SurfaceSDL();
+ SurfaceOpenGL* create_SurfaceOpenGL();
+ SurfaceImpl* create();
+};
+
+
+/** Container class that holds a surface, necessary so that we can
+ * switch Surface implementations (OpenGL, SDL) on the fly
+ */
+class Surface
+{
+public:
+ SurfaceImpl* impl;
+ SurfaceData data;
+ int w;
+ int h;
+
+ typedef std::list<Surface*> Surfaces;
+ static Surfaces surfaces;
+public:
+ static void reload_all();
+ static void debug_check();
+
+ Surface(SDL_Surface* surf, bool use_alpha);
+ Surface(const std::string& file, bool use_alpha);
+ Surface(const std::string& file, int x, int y, int w, int h, bool use_alpha);
+ Surface(Color top_gradient, Color bottom_gradient, int w_, int h_);
+ ~Surface();
+
+ /** Reload the surface, which is necesarry in case of a mode swich */
+ void reload();
+
+ void apply_filter(int filter, Color color = Color(0,0,0));
+};
+
+/** Surface implementation, all implementation have to inherit from
+ this class */
+class SurfaceImpl
+{
+protected:
+ SDL_Surface* sdl_surface;
+
+public:
+ int w;
+ int h;
+
+public:
+ SurfaceImpl();
+ virtual ~SurfaceImpl();
+
+ /** Return 0 on success, -2 if surface needs to be reloaded */
+ virtual int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
+ virtual int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
+ virtual int draw_stretched(float x, float y, int w, int h, Uint8 alpha, Uint32 effect = NONE_EFFECT) = 0;
+
+
+ SDL_Surface* get_sdl_surface() const; // @evil@ try to avoid this function
+
+ virtual void apply_filter(int filter, Color color = Color(0,0,0)) = 0;
+};
+
+class SurfaceSDL : public SurfaceImpl
+{
+public:
+ SurfaceSDL(SDL_Surface* surf, bool use_alpha);
+ SurfaceSDL(const std::string& file, bool use_alpha);
+ SurfaceSDL(const std::string& file, int x, int y, int w_, int h_, bool use_alpha);
+ SurfaceSDL(Color top_gradient, Color bottom_gradient, int w, int h);
+ virtual ~SurfaceSDL();
+
+ int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT);
+ int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT);
+ int draw_stretched(float x, float y, int w, int h, Uint8 alpha, Uint32 effect = NONE_EFFECT);
+
+ void apply_filter(int filter, Color color);
+};
+
+class SurfaceOpenGL : public SurfaceImpl
+{
+public:
+ GLuint gl_texture;
+
+public:
+ SurfaceOpenGL(SDL_Surface* surf, bool use_alpha);
+ SurfaceOpenGL(const std::string& file, bool use_alpha);
+ SurfaceOpenGL(const std::string& file, int x, int y, int w, int h, bool use_alpha);
+ SurfaceOpenGL(Color top_gradient, Color bottom_gradient, int w, int h);
+
+ virtual ~SurfaceOpenGL();
+
+ int draw(float x, float y, Uint8 alpha, Uint32 effect = NONE_EFFECT);
+ int draw_part(float sx, float sy, float x, float y, float w, float h, Uint8 alpha, Uint32 effect = NONE_EFFECT);
+ int draw_stretched(float x, float y, int w, int h, Uint8 alpha, Uint32 effect = NONE_EFFECT);
+
+ void apply_filter(int filter, Color color);
+
+private:
+ void create_gl(SDL_Surface * surf, GLuint * tex);
+};
+
+#endif
#include <sstream>
#include <unistd.h>
-#include "gettext.h"
-#include "video/surface.h"
-#include "video/screen.h"
-#include "video/drawing_context.h"
-#include "sprite/sprite_manager.h"
-#include "audio/sound_manager.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/list_iterator.h"
-#include "lisp/writer.h"
-#include "game_session.h"
-#include "sector.h"
-#include "worldmap.h"
-#include "resources.h"
-#include "misc.h"
-#include "player_status.h"
-#include "textscroller.h"
-#include "main.h"
-#include "spawn_point.h"
-#include "file_system.h"
-#include "gui/menu.h"
-#include "gui/mousecursor.h"
-#include "control/joystickkeyboardcontroller.h"
-#include "object/background.h"
-#include "object/tilemap.h"
-#include "scripting/script_interpreter.h"
+#include "gettext.hpp"
+#include "video/surface.hpp"
+#include "video/screen.hpp"
+#include "video/drawing_context.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "audio/sound_manager.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/list_iterator.hpp"
+#include "lisp/writer.hpp"
+#include "game_session.hpp"
+#include "sector.hpp"
+#include "worldmap.hpp"
+#include "resources.hpp"
+#include "misc.hpp"
+#include "player_status.hpp"
+#include "textscroller.hpp"
+#include "main.hpp"
+#include "spawn_point.hpp"
+#include "file_system.hpp"
+#include "gui/menu.hpp"
+#include "gui/mousecursor.hpp"
+#include "control/joystickkeyboardcontroller.hpp"
+#include "object/background.hpp"
+#include "object/tilemap.hpp"
+#include "scripting/script_interpreter.hpp"
Menu* worldmap_menu = 0;
+++ /dev/null
-// $Id$
-//
-// SuperTux
-// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef SUPERTUX_WORLDMAP_H
-#define SUPERTUX_WORLDMAP_H
-
-#include <vector>
-#include <string>
-
-#include "math/vector.h"
-#include "video/screen.h"
-#include "lisp/lisp.h"
-#include "control/controller.h"
-#include "statistics.h"
-#include "timer.h"
-#include "tile_manager.h"
-#include "game_object.h"
-
-class Sprite;
-class Menu;
-class SpawnPoint;
-class GameObject;
-class TileMap;
-extern Menu* worldmap_menu;
-
-namespace WorldMapNS {
-
-enum WorldMapMenuIDs {
- MNID_RETURNWORLDMAP,
- MNID_QUITWORLDMAP
-};
-
-// For one way tiles
-enum {
- BOTH_WAYS,
- NORTH_SOUTH_WAY,
- SOUTH_NORTH_WAY,
- EAST_WEST_WAY,
- WEST_EAST_WAY
-};
-
-enum Direction { D_NONE, D_WEST, D_EAST, D_NORTH, D_SOUTH };
-
-std::string direction_to_string(Direction d);
-Direction string_to_direction(const std::string& d);
-Direction reverse_dir(Direction d);
-
-class WorldMap;
-
-class Tux : public GameObject
-{
-public:
- Direction back_direction;
-private:
- WorldMap* worldmap;
- Sprite* tux_sprite;
- Controller* controller;
-
- Direction input_direction;
- Direction direction;
- Vector tile_pos;
- /** Length by which tux is away from its current tile, length is in
- input_direction direction */
- float offset;
- bool moving;
-
- void stop();
-public:
- Tux(WorldMap* worldmap_);
- ~Tux();
-
- void draw(DrawingContext& context);
- void update(float elapsed_time);
-
- void set_direction(Direction dir);
-
- bool is_moving() const { return moving; }
- Vector get_pos();
- Vector get_tile_pos() const { return tile_pos; }
- void set_tile_pos(Vector p) { tile_pos = p; }
-};
-
-/** */
-class WorldMap
-{
-private:
- Tux* tux;
-
- bool quit;
-
- Surface* leveldot_green;
- Surface* leveldot_red;
- Surface* messagedot;
- Surface* teleporterdot;
-
- std::string name;
- std::string music;
-
- typedef std::vector<GameObject*> GameObjects;
- GameObjects game_objects;
- TileMap* solids;
-
- TileManager* tile_manager;
-
-public:
- struct SpecialTile
- {
- Vector pos;
-
- /** Optional flags: */
-
- /** Position to swap to player */
- Vector teleport_dest;
-
- /** Message to show in the Map */
- std::string map_message;
- bool passive_message;
-
- /** Hide special tile */
- bool invisible;
-
- /** Only applies actions (ie. passive messages) when going to that direction */
- bool apply_action_north;
- bool apply_action_east;
- bool apply_action_south;
- bool apply_action_west;
- };
-
- struct Level
- {
- Vector pos;
-
- std::string name;
- std::string title;
- bool solved;
-
- /** Statistics for level tiles */
- Statistics statistics;
-
- /** Optional flags: */
-
- /** Check if this level should be vertically flipped */
- bool vertical_flip;
-
- /** Script that is run when the level is successfully finished */
- std::string extro_script;
-
- /** Go to this world */
- std::string next_worldmap;
-
- /** Quit the worldmap */
- bool quit_worldmap;
-
- /** If false, disables the auto walking after finishing a level */
- bool auto_path;
-
- // Directions which are walkable from this level
- bool north;
- bool east;
- bool south;
- bool west;
- };
-
- /** Variables to deal with the passive map messages */
- Timer passive_message_timer;
- std::string passive_message;
-
-private:
- std::string map_filename;
- std::string levels_path;
-
- typedef std::vector<SpecialTile> SpecialTiles;
- SpecialTiles special_tiles;
- typedef std::vector<Level> Levels;
- Levels levels;
- typedef std::vector<SpawnPoint*> SpawnPoints;
- SpawnPoints spawn_points;
-
- Vector offset;
- std::string savegame_file;
-
- std::string intro_script;
- bool intro_displayed;
-
- void get_level_title(Level& level);
-
- void draw_status(DrawingContext& context);
-
- // to avoid calculating total stats all the time. This way only
- // when need, it is calculated.
- Statistics total_stats;
- void calculate_total_stats();
-
-public:
- WorldMap();
- ~WorldMap();
-
- /** Busy loop */
- void display();
-
- void load_map();
-
- void get_input();
-
- void add_object(GameObject* object);
- void clear_objects();
-
- /** Update Tux position */
- void update(float delta);
-
- /** Draw one frame */
- void draw(DrawingContext& context);
-
- Vector get_next_tile(Vector pos, Direction direction);
- const Tile* at(Vector pos);
-
- WorldMap::Level* at_level();
- WorldMap::SpecialTile* at_special_tile();
-
- /** Check if it is possible to walk from \a pos into \a direction,
- if possible, write the new position to \a new_pos */
- bool path_ok(Direction direction, Vector pos, Vector* new_pos);
-
- /* Save map to slot */
- void savegame(const std::string& filename);
- /* Load map from slot
- You should call set_map_filename() before this */
- void loadgame(const std::string& filename);
- /* Load map directly from file */
- void loadmap(const std::string& filename);
-
- const std::string& get_world_title() const
- { return name; }
-
- void set_map_filename(std::string filename)
- { map_filename = filename; }
-
-private:
- void on_escape_press();
- void parse_special_tile(const lisp::Lisp* lisp);
- void parse_level_tile(const lisp::Lisp* lisp);
-};
-
-} // namespace WorldMapNS
-
-#endif
-
-/* Local Variables: */
-/* mode:c++ */
-/* End: */
--- /dev/null
+// $Id$
+//
+// SuperTux
+// Copyright (C) 2004 Ingo Ruhnke <grumbel@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#ifndef SUPERTUX_WORLDMAP_H
+#define SUPERTUX_WORLDMAP_H
+
+#include <vector>
+#include <string>
+
+#include "math/vector.hpp"
+#include "video/screen.hpp"
+#include "lisp/lisp.hpp"
+#include "control/controller.hpp"
+#include "statistics.hpp"
+#include "timer.hpp"
+#include "tile_manager.hpp"
+#include "game_object.hpp"
+
+class Sprite;
+class Menu;
+class SpawnPoint;
+class GameObject;
+class TileMap;
+extern Menu* worldmap_menu;
+
+namespace WorldMapNS {
+
+enum WorldMapMenuIDs {
+ MNID_RETURNWORLDMAP,
+ MNID_QUITWORLDMAP
+};
+
+// For one way tiles
+enum {
+ BOTH_WAYS,
+ NORTH_SOUTH_WAY,
+ SOUTH_NORTH_WAY,
+ EAST_WEST_WAY,
+ WEST_EAST_WAY
+};
+
+enum Direction { D_NONE, D_WEST, D_EAST, D_NORTH, D_SOUTH };
+
+std::string direction_to_string(Direction d);
+Direction string_to_direction(const std::string& d);
+Direction reverse_dir(Direction d);
+
+class WorldMap;
+
+class Tux : public GameObject
+{
+public:
+ Direction back_direction;
+private:
+ WorldMap* worldmap;
+ Sprite* tux_sprite;
+ Controller* controller;
+
+ Direction input_direction;
+ Direction direction;
+ Vector tile_pos;
+ /** Length by which tux is away from its current tile, length is in
+ input_direction direction */
+ float offset;
+ bool moving;
+
+ void stop();
+public:
+ Tux(WorldMap* worldmap_);
+ ~Tux();
+
+ void draw(DrawingContext& context);
+ void update(float elapsed_time);
+
+ void set_direction(Direction dir);
+
+ bool is_moving() const { return moving; }
+ Vector get_pos();
+ Vector get_tile_pos() const { return tile_pos; }
+ void set_tile_pos(Vector p) { tile_pos = p; }
+};
+
+/** */
+class WorldMap
+{
+private:
+ Tux* tux;
+
+ bool quit;
+
+ Surface* leveldot_green;
+ Surface* leveldot_red;
+ Surface* messagedot;
+ Surface* teleporterdot;
+
+ std::string name;
+ std::string music;
+
+ typedef std::vector<GameObject*> GameObjects;
+ GameObjects game_objects;
+ TileMap* solids;
+
+ TileManager* tile_manager;
+
+public:
+ struct SpecialTile
+ {
+ Vector pos;
+
+ /** Optional flags: */
+
+ /** Position to swap to player */
+ Vector teleport_dest;
+
+ /** Message to show in the Map */
+ std::string map_message;
+ bool passive_message;
+
+ /** Hide special tile */
+ bool invisible;
+
+ /** Only applies actions (ie. passive messages) when going to that direction */
+ bool apply_action_north;
+ bool apply_action_east;
+ bool apply_action_south;
+ bool apply_action_west;
+ };
+
+ struct Level
+ {
+ Vector pos;
+
+ std::string name;
+ std::string title;
+ bool solved;
+
+ /** Statistics for level tiles */
+ Statistics statistics;
+
+ /** Optional flags: */
+
+ /** Check if this level should be vertically flipped */
+ bool vertical_flip;
+
+ /** Script that is run when the level is successfully finished */
+ std::string extro_script;
+
+ /** Go to this world */
+ std::string next_worldmap;
+
+ /** Quit the worldmap */
+ bool quit_worldmap;
+
+ /** If false, disables the auto walking after finishing a level */
+ bool auto_path;
+
+ // Directions which are walkable from this level
+ bool north;
+ bool east;
+ bool south;
+ bool west;
+ };
+
+ /** Variables to deal with the passive map messages */
+ Timer passive_message_timer;
+ std::string passive_message;
+
+private:
+ std::string map_filename;
+ std::string levels_path;
+
+ typedef std::vector<SpecialTile> SpecialTiles;
+ SpecialTiles special_tiles;
+ typedef std::vector<Level> Levels;
+ Levels levels;
+ typedef std::vector<SpawnPoint*> SpawnPoints;
+ SpawnPoints spawn_points;
+
+ Vector offset;
+ std::string savegame_file;
+
+ std::string intro_script;
+ bool intro_displayed;
+
+ void get_level_title(Level& level);
+
+ void draw_status(DrawingContext& context);
+
+ // to avoid calculating total stats all the time. This way only
+ // when need, it is calculated.
+ Statistics total_stats;
+ void calculate_total_stats();
+
+public:
+ WorldMap();
+ ~WorldMap();
+
+ /** Busy loop */
+ void display();
+
+ void load_map();
+
+ void get_input();
+
+ void add_object(GameObject* object);
+ void clear_objects();
+
+ /** Update Tux position */
+ void update(float delta);
+
+ /** Draw one frame */
+ void draw(DrawingContext& context);
+
+ Vector get_next_tile(Vector pos, Direction direction);
+ const Tile* at(Vector pos);
+
+ WorldMap::Level* at_level();
+ WorldMap::SpecialTile* at_special_tile();
+
+ /** Check if it is possible to walk from \a pos into \a direction,
+ if possible, write the new position to \a new_pos */
+ bool path_ok(Direction direction, Vector pos, Vector* new_pos);
+
+ /* Save map to slot */
+ void savegame(const std::string& filename);
+ /* Load map from slot
+ You should call set_map_filename() before this */
+ void loadgame(const std::string& filename);
+ /* Load map directly from file */
+ void loadmap(const std::string& filename);
+
+ const std::string& get_world_title() const
+ { return name; }
+
+ void set_map_filename(std::string filename)
+ { map_filename = filename; }
+
+private:
+ void on_escape_press();
+ void parse_special_tile(const lisp::Lisp* lisp);
+ void parse_level_tile(const lisp::Lisp* lisp);
+};
+
+} // namespace WorldMapNS
+
+#endif
+
+/* Local Variables: */
+/* mode:c++ */
+/* End: */
<< "#ifndef __" << modulename << "_WRAPPER_H__\n"
<< "#define __" << modulename << "_WRAPPER_H__\n"
<< "\n"
- << "#include \"wrapper_util.h\"\n"
+ << "#include \"wrapper_util.hpp\"\n"
<< "\n"
<< "extern WrappedFunction " << modulename << "_global_functions[];\n"
<< "extern WrappedClass " << modulename << "_classes[];\n"
<< "#include <assert.h>\n"
<< "#include <string>\n"
<< "#include <squirrel.h>\n"
- << "#include \"wrapper_util.h\"\n"
- << "#include \"wrapper.interface.h\"\n"
+ << "#include \"wrapper_util.hpp\"\n"
+ << "#include \"wrapper.interface.hpp\"\n"
<< "\n";
if(selected_namespace != "") {
out << "using namespace " << selected_namespace << ";\n";