Index: Games/Pingus/configure.in =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/configure.in,v retrieving revision 1.74 diff -u -r1.74 configure.in --- Games/Pingus/configure.in 12 Oct 2002 23:43:19 -0000 1.74 +++ Games/Pingus/configure.in 25 Jan 2003 03:33:18 -0000 @@ -335,7 +335,8 @@ AC_OUTPUT( Makefile src/Makefile src/actions/Makefile - src/caimagemanipulation/Makefile + src/caimagemanipulation/Makefile + src/colliders/Makefile src/editor/Makefile src/editorobjs/Makefile src/gui/Makefile Index: Games/Pingus/src/Makefile.am =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/Makefile.am,v retrieving revision 1.124 diff -u -r1.124 Makefile.am --- Games/Pingus/src/Makefile.am 1 Dec 2002 17:45:21 -0000 1.124 +++ Games/Pingus/src/Makefile.am 25 Jan 2003 03:33:20 -0000 @@ -27,6 +27,7 @@ SUBDIRS = \ actions \ caimagemanipulation \ + colliders \ editor \ editorobjs \ gui \ @@ -53,6 +54,7 @@ @LIBS@ \ \ caimagemanipulation/libcaimagemanipulation.a \ + colliders/libpingus_colliders.a \ editorobjs/libpingus_editorobjs.a \ worldobjs/entrances/libpingus_worldobjs_entrances.a \ worldobjsdata/libpingus_worldobjsdata.a \ @@ -183,6 +185,7 @@ math.hxx \ menu_background.cxx \ menu_background.hxx \ +mover.hxx \ multiline_text.cxx \ multiline_text.hxx \ my_gettext.hxx \ @@ -196,6 +199,8 @@ pingu_action.hxx \ pingu_action_factory.cxx \ pingu_action_factory.hxx \ +collider.cxx \ +collider.hxx \ pingu_enums.cxx \ pingu_enums.hxx \ pingu_holder.cxx \ Index: Games/Pingus/src/pingu_action.cxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action.cxx,v retrieving revision 1.21 diff -u -r1.21 pingu_action.cxx --- Games/Pingus/src/pingu_action.cxx 26 Nov 2002 21:30:37 -0000 1.21 +++ Games/Pingus/src/pingu_action.cxx 25 Jan 2003 03:33:21 -0000 @@ -28,10 +28,6 @@ #include "worldobj.hxx" #include "actions/faller.hxx" -// Initialise class static. -const int PinguAction::pingu_height = 26; -const float deadly_velocity = 20.0f; - PinguAction::PinguAction (Pingu* p) : pingu (p) { Index: Games/Pingus/src/pingu_action.hxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_action.hxx,v retrieving revision 1.24 diff -u -r1.24 pingu_action.hxx --- Games/Pingus/src/pingu_action.hxx 3 Nov 2002 13:29:09 -0000 1.24 +++ Games/Pingus/src/pingu_action.hxx 25 Jan 2003 03:33:22 -0000 @@ -44,9 +44,6 @@ /** A pointer to the pingu, which hold the action. */ Pingu* pingu; - /// Height of Pingu. Used in head collision. - static const int pingu_height; - public: PinguAction(Pingu* p); virtual ~PinguAction(); Index: Games/Pingus/src/pingu_enums.cxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_enums.cxx,v retrieving revision 1.2 diff -u -r1.2 pingu_enums.cxx --- Games/Pingus/src/pingu_enums.cxx 25 Aug 2002 09:08:48 -0000 1.2 +++ Games/Pingus/src/pingu_enums.cxx 25 Jan 2003 03:33:22 -0000 @@ -19,6 +19,10 @@ #include "pingu_enums.hxx" +// Pingu "globals" +const int pingu_height = 26; +const float deadly_velocity = 20.0f; + namespace Actions { std::string action_to_string(ActionName action) { Index: Games/Pingus/src/pingu_enums.hxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/pingu_enums.hxx,v retrieving revision 1.9 diff -u -r1.9 pingu_enums.hxx --- Games/Pingus/src/pingu_enums.hxx 2 Nov 2002 17:43:10 -0000 1.9 +++ Games/Pingus/src/pingu_enums.hxx 25 Jan 2003 03:33:23 -0000 @@ -68,6 +68,9 @@ } // namespace Actions +// Pingu "globals" +extern const int pingu_height; +extern const float deadly_velocity; #endif Index: Games/Pingus/src/actions/bomber.cxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bomber.cxx,v retrieving revision 1.25 diff -u -r1.25 bomber.cxx --- Games/Pingus/src/actions/bomber.cxx 3 Nov 2002 17:32:25 -0000 1.25 +++ Games/Pingus/src/actions/bomber.cxx 25 Jan 2003 03:33:24 -0000 @@ -28,9 +28,14 @@ #include "../pingus_resource.hxx" #include "../string_converter.hxx" #include "../world.hxx" +#include "../vector.hxx" +#include "../colliders/upright_pingu_collider.hxx" +#include "../movers/linear_mover.hxx" #include "../particles/particle_holder.hxx" #include "bomber.hxx" +using namespace Colliders; + namespace Actions { bool Bomber::static_surface_loaded = false; @@ -79,25 +84,34 @@ { sprite.update (); - // Do something according to the action that was in use before - switch (pingu->get_previous_action()) - { - case Actions::Faller: - move_with_forces(); - break; - case Actions::Floater: - if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING) - pingu->set_y(pingu->get_y() + 0.5f); - break; - default: - break; - } + Movers::LinearMover mover(WorldObj::get_world(), + pingu->get_pos()); + + Vector velocity = pingu->get_velocity(); + + // Move the Pingu with different colliders depending on whether the Pingu is + // moving up (i.e. can go through Bridges) or moving down (i.e. can't go + // through Bridges) + if (velocity.y < 0.0f) + mover.update(velocity, UprightPinguCollider(false)); + else + mover.update(velocity, UprightPinguCollider(true)); + + pingu->set_pos(mover.get_pos()); // If the Bomber hasn't 'exploded' yet and it has hit Water or Lava if (sprite.get_frame () <= 9 && (rel_getpixel(0, -1) == Groundtype::GP_WATER || rel_getpixel(0, -1) == Groundtype::GP_LAVA)) { pingu->set_action(Actions::Drown); + return; + } + + // If the Bomber hasn't 'exploded' yet and it has hit the ground too quickly + if (sprite.get_frame () <= 9 && rel_getpixel(0, -1) != Groundtype::GP_NOTHING + && velocity.y > 20.0f) + { + pingu->set_action(Actions::Splashed); return; } Index: Games/Pingus/src/actions/faller.cxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.cxx,v retrieving revision 1.34 diff -u -r1.34 faller.cxx --- Games/Pingus/src/actions/faller.cxx 3 Nov 2002 22:20:29 -0000 1.34 +++ Games/Pingus/src/actions/faller.cxx 25 Jan 2003 03:33:24 -0000 @@ -28,8 +28,6 @@ namespace Actions { -const float Faller::deadly_velocity = 20.0f; - Faller::Faller (Pingu* p) : PinguAction(p), faller(Sprite("Pingus/faller" + to_string(pingu->get_owner ()), "pingus")), Index: Games/Pingus/src/actions/faller.hxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.hxx,v retrieving revision 1.17 diff -u -r1.17 faller.hxx --- Games/Pingus/src/actions/faller.hxx 3 Nov 2002 20:30:38 -0000 1.17 +++ Games/Pingus/src/actions/faller.hxx 25 Jan 2003 03:33:25 -0000 @@ -34,8 +34,6 @@ int falling; public: - static const float deadly_velocity; - Faller(Pingu*); virtual ~Faller(); Index: Games/Pingus/src/actions/floater.cxx =================================================================== RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/floater.cxx,v retrieving revision 1.21 diff -u -r1.21 floater.cxx --- Games/Pingus/src/actions/floater.cxx 13 Oct 2002 20:25:00 -0000 1.21 +++ Games/Pingus/src/actions/floater.cxx 25 Jan 2003 03:33:25 -0000 @@ -38,7 +38,7 @@ { sprite.update (); - pingu->set_velocity(Vector(0.0, 0.0)); + pingu->set_velocity(Vector(0.0f, 1.0f)); if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING) {