[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.9,1.10 angel.hxx,
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.9,1.10 angel.hxx,1.9,1.10 basher.cxx,1.13,1.14 basher.hxx,1.9,1.10 blocker.cxx,1.7,1.8 blocker.hxx,1.8,1.9 boarder.cxx,1.7,1.8 boarder.hxx,1.8,1.9 bomber.cxx,1.11,1.12 bomber.hxx,1.10,1.11 bridger.cxx,1.13,1.14 bridger.hxx,1.10,1.11 climber.cxx,1.9,1.10 climber.hxx,1.7,1.8 digger.cxx,1.11,1.12 digger.hxx,1.7,1.8 drown.cxx,1.6,1.7 drown.hxx,1.7,1.8 exiter.cxx,1.6,1.7 exiter.hxx,1.7,1.8 faller.cxx,1.20,1.21 faller.hxx,1.12,1.13 floater.cxx,1.13,1.14 floater.hxx,1.9,1.10 jumper.cxx,1.9,1.10 jumper.hxx,1.7,1.8 laser_kill.cxx,1.4,1.5 laser_kill.hxx,1.7,1.8 miner.cxx,1.9,1.10 miner.hxx,1.7,1.8 rocket_launcher.cxx,1.7,1.8 rocket_launcher.hxx,1.7,1.8 slider.cxx,1.7,1.8 slider.hxx,1.7,1.8 smashed.cxx,1.5,1.6 smashed.hxx,1.7,1.8 splashed.cxx,1.6,1.7 splashed.hxx,1.7,1.8 superman.cxx,1.5,1.6 superman.hxx,1.8,1.9 teleported.cxx,1.6,1.7 teleported.hxx,1.7,1.8 waiter.cxx,1.6,1.7 waiter.hxx,1.7,1.8 walker.cxx,1.20,1.21 walker.hxx,1.7,1.8 |
Date: |
10 Sep 2002 19:24:22 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/actions
In directory dark:/tmp/cvs-serv5031/src/actions
Modified Files:
angel.cxx angel.hxx basher.cxx basher.hxx blocker.cxx
blocker.hxx boarder.cxx boarder.hxx bomber.cxx bomber.hxx
bridger.cxx bridger.hxx climber.cxx climber.hxx digger.cxx
digger.hxx drown.cxx drown.hxx exiter.cxx exiter.hxx
faller.cxx faller.hxx floater.cxx floater.hxx jumper.cxx
jumper.hxx laser_kill.cxx laser_kill.hxx miner.cxx miner.hxx
rocket_launcher.cxx rocket_launcher.hxx slider.cxx slider.hxx
smashed.cxx smashed.hxx splashed.cxx splashed.hxx superman.cxx
superman.hxx teleported.cxx teleported.hxx waiter.cxx
waiter.hxx walker.cxx walker.hxx
Log Message:
changed indention of namespaces in a few places
Index: angel.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/angel.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- angel.cxx 4 Sep 2002 20:30:29 -0000 1.9
+++ angel.cxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -25,38 +25,39 @@
namespace Actions {
- Angel::Angel () : counter(0.0), x_pos(0)
- {
- }
-
- void
- Angel::init ()
- {
- x_pos = pingu->get_x();
- counter = 0.0;
- sprite = Sprite (PingusResource::load_surface
- ("Pingus/angel" + to_string(pingu->get_owner ()),
- "pingus"));
- sprite.set_align_center_bottom ();
- }
+Angel::Angel () : counter(0.0), x_pos(0)
+{
+}
- void
- Angel::update (float delta)
- {
- sprite.update (delta);
- counter += delta;
- pingu->set_pos(x_pos + 20 * sin (counter * 3.0), pingu->get_y() - 50.0f *
delta);
+void
+Angel::init ()
+{
+ x_pos = pingu->get_x();
+ counter = 0.0;
+ sprite = Sprite (PingusResource::load_surface
+ ("Pingus/angel" + to_string(pingu->get_owner ()),
+ "pingus"));
+ sprite.set_align_center_bottom ();
+}
- // Out of screen, let the pingu die
- if (pingu->get_y() < -32)
- pingu->set_status (PS_DEAD);
- }
+void
+Angel::update (float delta)
+{
+ sprite.update (delta);
+ counter += delta;
+ pingu->set_pos(x_pos + 20 * sin (counter * 3.0), pingu->get_y() - 50.0f *
delta);
- void
- Angel::draw (GraphicContext& gc)
- {
- gc.draw (sprite, pingu->get_pos ());
- }
+ // Out of screen, let the pingu die
+ if (pingu->get_y() < -32)
+ pingu->set_status (PS_DEAD);
+}
+void
+Angel::draw (GraphicContext& gc)
+{
+ gc.draw (sprite, pingu->get_pos ());
}
+
+} // namespace Actions
+
/* EOF */
Index: angel.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/angel.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- angel.hxx 4 Sep 2002 20:30:29 -0000 1.9
+++ angel.hxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -26,28 +26,28 @@
namespace Actions {
- class Angel : public PinguAction
- {
- private:
- double counter;
- double x_pos;
- Sprite sprite;
+class Angel : public PinguAction
+{
+private:
+ double counter;
+ double x_pos;
+ Sprite sprite;
- public:
- Angel ();
- void init ();
- std::string get_name () const { return "Angel"; }
- ActionName get_type () const { return Actions::Angel; }
+public:
+ Angel ();
+ void init ();
+ std::string get_name () const { return "Angel"; }
+ ActionName get_type () const { return Actions::Angel; }
- void update (float delta);
- void draw (GraphicContext& gc);
+ void update (float delta);
+ void draw (GraphicContext& gc);
- private:
- Angel (const Angel&);
- Angel operator= (const Angel&);
- };
+private:
+ Angel (const Angel&);
+ Angel operator= (const Angel&);
+};
-}
+} // namespace Actions
#endif
Index: basher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- basher.cxx 4 Sep 2002 20:30:29 -0000 1.13
+++ basher.cxx 10 Sep 2002 19:24:19 -0000 1.14
@@ -29,109 +29,109 @@
namespace Actions {
- Basher::Basher () : basher_c(0), first_bash(true)
- {
- }
+Basher::Basher () : basher_c(0), first_bash(true)
+{
+}
- void
- Basher::init (void)
- {
- bash_radius = PingusResource::load_surface ("Other/bash_radius", "pingus");
- bash_radius_gfx = PingusResource::load_surface ("Other/bash_radius_gfx",
"pingus");
- sprite = Sprite (PingusResource::load_surface ("Pingus/basher0",
"pingus"));
- sprite.set_align_center_bottom ();
+void
+Basher::init (void)
+{
+ bash_radius = PingusResource::load_surface ("Other/bash_radius", "pingus");
+ bash_radius_gfx = PingusResource::load_surface ("Other/bash_radius_gfx",
"pingus");
+ sprite = Sprite (PingusResource::load_surface ("Pingus/basher0", "pingus"));
+ sprite.set_align_center_bottom ();
- // Start a bash even so the action will stops instantly after the
- // first bash
- bash ();
- }
+ // Start a bash even so the action will stops instantly after the
+ // first bash
+ bash ();
+}
- void
- Basher::draw (GraphicContext& gc)
- {
- if (pingu->direction.is_left())
- sprite.set_direction (Sprite::LEFT);
- else
- sprite.set_direction (Sprite::RIGHT);
+void
+Basher::draw (GraphicContext& gc)
+{
+ if (pingu->direction.is_left())
+ sprite.set_direction (Sprite::LEFT);
+ else
+ sprite.set_direction (Sprite::RIGHT);
- gc.draw (sprite, pingu->get_pos());
- }
+ gc.draw (sprite, pingu->get_pos());
+}
- void
- Basher::update (float delta)
- {
- sprite.update (delta);
+void
+Basher::update (float delta)
+{
+ sprite.update (delta);
- ++basher_c;
- if (basher_c % 3 == 0)
- {
- walk_forward();
+ ++basher_c;
+ if (basher_c % 3 == 0)
+ {
+ walk_forward();
- if (have_something_to_dig())
- {
- // We only bash every second step, cause the Pingus would
- // get trapped otherwise in the bashing area.
- if (basher_c % 2 == 0)
- bash();
- }
- else if (sprite.get_progress () > 0.6f)
- {
- pingu->set_action(Actions::Walker);
- }
- }
- }
+ if (have_something_to_dig())
+ {
+ // We only bash every second step, cause the Pingus would
+ // get trapped otherwise in the bashing area.
+ if (basher_c % 2 == 0)
+ bash();
+ }
+ else if (sprite.get_progress () > 0.6f)
+ {
+ pingu->set_action(Actions::Walker);
+ }
+ }
+}
- void
- Basher::bash()
- {
- WorldObj::get_world()->get_colmap()->remove(bash_radius,
- static_cast<int>(pingu->get_x () -
(bash_radius.get_width()/2)),
- static_cast<int>(pingu->get_y () -
31));
- WorldObj::get_world()->get_gfx_map()->remove(bash_radius_gfx,
- static_cast<int>(pingu->get_x ()
- (bash_radius_gfx.get_width()/2)),
+void
+Basher::bash()
+{
+ WorldObj::get_world()->get_colmap()->remove(bash_radius,
+ static_cast<int>(pingu->get_x ()
- (bash_radius.get_width()/2)),
static_cast<int>(pingu->get_y ()
- 31));
- }
+ WorldObj::get_world()->get_gfx_map()->remove(bash_radius_gfx,
+ static_cast<int>(pingu->get_x ()
- (bash_radius_gfx.get_width()/2)),
+ static_cast<int>(pingu->get_y ()
- 31));
+}
- void
- Basher::walk_forward()
- {
- if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING) {
- // We are in the air... lets fall...
- pingu->set_action(Actions::Faller);
- } else {
- // On ground, walk forward...
- pingu->set_x(pingu->get_x() + static_cast<int>(pingu->direction));
- }
+void
+Basher::walk_forward()
+{
+ if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING) {
+ // We are in the air... lets fall...
+ pingu->set_action(Actions::Faller);
+ } else {
+ // On ground, walk forward...
+ pingu->set_x(pingu->get_x() + static_cast<int>(pingu->direction));
}
+}
- bool
- Basher::have_something_to_dig()
- {
- if (first_bash)
- {
- first_bash = false;
- return true;
- }
-
- for(int i = 0; i < 16; ++i)
- {
- // Check that there is a high enough wall (i.e. not 1 pixel) to bash.
- // Probably best to check from where Pingu can't automatically walk up
- // up to head collision height.
- for (int j = bash_height + 1; j <= 26; ++j)
- {
- if (rel_getpixel(i,j) == GroundpieceData::GP_GROUND)
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Basher: Found something to
dig..." << std::endl;
- return true;
- }
- }
- }
+bool
+Basher::have_something_to_dig()
+{
+ if (first_bash)
+ {
+ first_bash = false;
+ return true;
+ }
- cout << "nothing to dig found" << endl;
- return false;
- }
+ for(int i = 0; i < 16; ++i)
+ {
+ // Check that there is a high enough wall (i.e. not 1 pixel) to bash.
+ // Probably best to check from where Pingu can't automatically walk up
+ // up to head collision height.
+ for (int j = bash_height + 1; j <= 26; ++j)
+ {
+ if (rel_getpixel(i,j) == GroundpieceData::GP_GROUND)
+ {
+ pout(PINGUS_DEBUG_ACTIONS) << "Basher: Found something to dig..."
<< std::endl;
+ return true;
+ }
+ }
+ }
+ cout << "nothing to dig found" << endl;
+ return false;
}
+
+} // namespace Actions
/* EOF */
Index: basher.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/basher.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- basher.hxx 4 Sep 2002 20:30:29 -0000 1.9
+++ basher.hxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -25,38 +25,38 @@
namespace Actions {
- class Basher : public PinguAction
- {
- private:
- Sprite sprite;
- CL_Surface bash_radius;
- CL_Surface bash_radius_gfx;
- int basher_c;
- bool first_bash;
+class Basher : public PinguAction
+{
+private:
+ Sprite sprite;
+ CL_Surface bash_radius;
+ CL_Surface bash_radius_gfx;
+ int basher_c;
+ bool first_bash;
- /// Defines "wall" height needed so as to determine whether it should be
bashed.
- enum { bash_height = 4 };
+ /// Defines "wall" height needed so as to determine whether it should be
bashed.
+ enum { bash_height = 4 };
- public:
- Basher ();
- void init (void);
+public:
+ Basher ();
+ void init (void);
- std::string get_name () const { return "Basher"; }
- ActionName get_type () const { return Actions::Basher; }
+ std::string get_name () const { return "Basher"; }
+ ActionName get_type () const { return Actions::Basher; }
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- bool have_something_to_dig ();
- void walk_forward ();
- void bash ();
+ bool have_something_to_dig ();
+ void walk_forward ();
+ void bash ();
- private:
- Basher (const Basher&);
- Basher operator= (const Basher&);
- };
+private:
+ Basher (const Basher&);
+ Basher operator= (const Basher&);
+};
-}
+} // namespace Actions
#endif
Index: blocker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/blocker.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- blocker.cxx 4 Sep 2002 20:30:29 -0000 1.7
+++ blocker.cxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -28,84 +28,84 @@
namespace Actions {
- Blocker::Blocker()
- {
- }
+Blocker::Blocker()
+{
+}
- void
- Blocker::init(void)
- {
- sprite = Sprite(PingusResource::load_surface ("Pingus/blocker"
- + to_string (pingu->get_owner
()),
- "pingus"));
- sprite.set_align_center_bottom ();
+void
+Blocker::init(void)
+{
+ sprite = Sprite(PingusResource::load_surface ("Pingus/blocker"
+ + to_string (pingu->get_owner
()),
+ "pingus"));
+ sprite.set_align_center_bottom ();
- if (rel_getpixel(0,-1) == GroundpieceData::GP_NOTHING
- && rel_getpixel(0, -2) == GroundpieceData::GP_GROUND)
- {
- pingu->set_x(pingu->get_x() + 1);
- }
- else if (rel_getpixel(0,-1) == GroundpieceData::GP_NOTHING
- && rel_getpixel(0, -2) == GroundpieceData::GP_NOTHING
- && rel_getpixel(0,-3) == GroundpieceData::GP_GROUND)
- {
- pingu->set_y(pingu->get_y() + 2);
- }
- }
+ if (rel_getpixel(0,-1) == GroundpieceData::GP_NOTHING
+ && rel_getpixel(0, -2) == GroundpieceData::GP_GROUND)
+ {
+ pingu->set_x(pingu->get_x() + 1);
+ }
+ else if (rel_getpixel(0,-1) == GroundpieceData::GP_NOTHING
+ && rel_getpixel(0, -2) == GroundpieceData::GP_NOTHING
+ && rel_getpixel(0,-3) == GroundpieceData::GP_GROUND)
+ {
+ pingu->set_y(pingu->get_y() + 2);
+ }
+}
- void
- Blocker::update(float delta)
- {
- if (!standing_on_ground())
- {
- pingu->set_action(Actions::Faller);
- }
+void
+Blocker::update(float delta)
+{
+ if (!standing_on_ground())
+ {
+ pingu->set_action(Actions::Faller);
+ }
- UNUSED_ARG(delta);
- }
+ UNUSED_ARG(delta);
+}
- void
- Blocker::draw (GraphicContext& gc)
- {
- gc.draw(sprite, pingu->get_pos());
- }
+void
+Blocker::draw (GraphicContext& gc)
+{
+ gc.draw(sprite, pingu->get_pos());
+}
- bool
- Blocker::standing_on_ground()
- {
- return (rel_getpixel(0,-1) != GroundpieceData::GP_NOTHING);
- }
+bool
+Blocker::standing_on_ground()
+{
+ return (rel_getpixel(0,-1) != GroundpieceData::GP_NOTHING);
+}
- bool
- Blocker::need_catch()
- {
- return true;
- }
+bool
+Blocker::need_catch()
+{
+ return true;
+}
- void
- Blocker::catch_pingu(Pingu* target)
- {
- if (target->get_x () > pingu->get_x () - 16
- && target->get_x () < pingu->get_x () + 16
- && target->get_y () > pingu->get_y () - 32
- && target->get_y () < pingu->get_y () + 5
- )
- {
- if (target->get_x () > pingu->get_x ()) {
- target->direction.right();
- } else {
- target->direction.left();
- }
+void
+Blocker::catch_pingu(Pingu* target)
+{
+ if (target->get_x () > pingu->get_x () - 16
+ && target->get_x () < pingu->get_x () + 16
+ && target->get_y () > pingu->get_y () - 32
+ && target->get_y () < pingu->get_y () + 5
+ )
+ {
+ if (target->get_x () > pingu->get_x ()) {
+ target->direction.right();
+ } else {
+ target->direction.left();
}
- }
-
- int
- Blocker::y_offset(void)
- {
- return -33;
- }
+ }
+}
+int
+Blocker::y_offset(void)
+{
+ return -33;
}
+
+} // namespace Actions
/* EOF */
Index: blocker.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/blocker.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- blocker.hxx 4 Sep 2002 20:30:29 -0000 1.8
+++ blocker.hxx 10 Sep 2002 19:24:19 -0000 1.9
@@ -25,33 +25,33 @@
namespace Actions {
- class Blocker : public PinguAction
- {
- private:
- Sprite sprite;
+class Blocker : public PinguAction
+{
+private:
+ Sprite sprite;
- public:
- Blocker ();
- void init ();
+public:
+ Blocker ();
+ void init ();
- int y_offset ();
+ int y_offset ();
- std::string get_name () const { return "Blocker"; }
- ActionName get_type() const { return Actions::Blocker; }
+ std::string get_name () const { return "Blocker"; }
+ ActionName get_type() const { return Actions::Blocker; }
- void draw (GraphicContext& gc);
- void update(float delta);
- bool standing_on_ground();
+ void draw (GraphicContext& gc);
+ void update(float delta);
+ bool standing_on_ground();
- bool need_catch();
- void catch_pingu(Pingu* pingu);
+ bool need_catch();
+ void catch_pingu(Pingu* pingu);
- private:
- Blocker (const Blocker&);
- Blocker operator= (const Blocker&);
- };
+private:
+ Blocker (const Blocker&);
+ Blocker operator= (const Blocker&);
+};
-}
+} // namespace Actions
#endif
Index: boarder.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/boarder.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- boarder.cxx 4 Sep 2002 20:30:29 -0000 1.7
+++ boarder.cxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,77 +25,77 @@
namespace Actions {
- Boarder::Boarder () : x_pos(0), speed(0.0)
- {
- }
+Boarder::Boarder () : x_pos(0), speed(0.0)
+{
+}
- void
- Boarder::init()
- {
- x_pos = pingu->get_x();
- speed = 0.0;
- sprite = Sprite (PingusResource::load_surface
- ("Pingus/boarder" + to_string(pingu->get_owner ()),
- "pingus"));
- sprite.set_align_center_bottom ();
- }
+void
+Boarder::init()
+{
+ x_pos = pingu->get_x();
+ speed = 0.0;
+ sprite = Sprite (PingusResource::load_surface
+ ("Pingus/boarder" + to_string(pingu->get_owner ()),
+ "pingus"));
+ sprite.set_align_center_bottom ();
+}
- void
- Boarder::update(float delta)
- {
- if (pingu->direction.is_left ())
- sprite.set_direction(Sprite::LEFT);
- else
- sprite.set_direction(Sprite::RIGHT);
- sprite.update (delta);
+void
+Boarder::update(float delta)
+{
+ if (pingu->direction.is_left ())
+ sprite.set_direction(Sprite::LEFT);
+ else
+ sprite.set_direction(Sprite::RIGHT);
+ sprite.update (delta);
- if (on_ground ())
- {
- if (speed < 15.0)
- speed += 15.0 * delta;
- else {
- speed = 15.0;
- }
+ if (on_ground ())
+ {
+ if (speed < 15.0)
+ speed += 15.0 * delta;
+ else {
+ speed = 15.0;
+ }
- // Incremental update so that we don't skip pixels
- double new_x_pos = pingu->get_pos().x + pingu->direction * speed;
- while (new_x_pos != pingu->get_x())
- {
- double old_pos = pingu->get_pos().x;
- pingu->set_x(old_pos + (pingu->get_x() < new_x_pos) ? 1 : -1);
+ // Incremental update so that we don't skip pixels
+ double new_x_pos = pingu->get_pos().x + pingu->direction * speed;
+ while (new_x_pos != pingu->get_x())
+ {
+ double old_pos = pingu->get_pos().x;
+ pingu->set_x(old_pos + (pingu->get_x() < new_x_pos) ? 1 : -1);
- if (pingu->rel_getpixel (1, 0))
- {
- // Hit a wall
- pingu->set_x(old_pos); // + (pingu->direction * 10);
- ////pingu->pos.y = 10;
-
- pingu->apply_force (CL_Vector(speed * pingu->direction * 0.5,
- -speed * abs(pingu->direction) *
0.5));
- pingu->set_action(Actions::Walker);
- return;
- }
- }
- }
- else
- {
- pingu->apply_force (CL_Vector(speed * pingu->direction, 0));
- pingu->set_action(Actions::Walker);
- }
- }
+ if (pingu->rel_getpixel (1, 0))
+ {
+ // Hit a wall
+ pingu->set_x(old_pos); // + (pingu->direction * 10);
+ ////pingu->pos.y = 10;
- void
- Boarder::draw (GraphicContext& gc)
- {
- gc.draw(sprite, pingu->get_pos ());
- }
+ pingu->apply_force (CL_Vector(speed * pingu->direction * 0.5,
+ -speed * abs(pingu->direction) *
0.5));
+ pingu->set_action(Actions::Walker);
+ return;
+ }
+ }
+ }
+ else
+ {
+ pingu->apply_force (CL_Vector(speed * pingu->direction, 0));
+ pingu->set_action(Actions::Walker);
+ }
+}
- bool
- Boarder::on_ground ()
- {
- return pingu->rel_getpixel (0, -1) || pingu->rel_getpixel (0, -2);
- }
+void
+Boarder::draw (GraphicContext& gc)
+{
+ gc.draw(sprite, pingu->get_pos ());
+}
+bool
+Boarder::on_ground ()
+{
+ return pingu->rel_getpixel (0, -1) || pingu->rel_getpixel (0, -2);
}
+
+} // namespace Actions
/* EOF */
Index: boarder.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/boarder.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- boarder.hxx 4 Sep 2002 20:30:29 -0000 1.8
+++ boarder.hxx 10 Sep 2002 19:24:19 -0000 1.9
@@ -25,33 +25,33 @@
namespace Actions {
- /** The Boarder action causes a pingu to use a skateboard to move
- forward. */
- class Boarder : public PinguAction
- {
- private:
- //double counter;
- double x_pos;
- double speed;
- Sprite sprite;
- public:
- Boarder ();
- void init();
+/** The Boarder action causes a pingu to use a skateboard to move
+ forward. */
+class Boarder : public PinguAction
+{
+private:
+ //double counter;
+ double x_pos;
+ double speed;
+ Sprite sprite;
+public:
+ Boarder ();
+ void init();
- std::string get_name () const { return "Boarder"; }
- ActionName get_type () const { return Actions::Boarder; }
+ std::string get_name () const { return "Boarder"; }
+ ActionName get_type () const { return Actions::Boarder; }
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- private:
- bool on_ground ();
+private:
+ bool on_ground ();
- Boarder (const Boarder&);
- Boarder operator= (const Boarder&);
- };
+ Boarder (const Boarder&);
+ Boarder operator= (const Boarder&);
+};
-}
+} // namespace Actions
#endif
Index: bomber.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bomber.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- bomber.cxx 4 Sep 2002 20:30:29 -0000 1.11
+++ bomber.cxx 10 Sep 2002 19:24:19 -0000 1.12
@@ -31,109 +31,109 @@
namespace Actions {
- bool Bomber::static_surface_loaded = false;
- CL_Surface Bomber::bomber_radius;
- CL_Surface Bomber::bomber_radius_gfx;
+bool Bomber::static_surface_loaded = false;
+CL_Surface Bomber::bomber_radius;
+CL_Surface Bomber::bomber_radius_gfx;
- Bomber::Bomber()
- : particle_thrown(false),
- sound_played(false),
- gfx_exploded(false),
- colmap_exploded(false)
- {
- }
+Bomber::Bomber()
+ : particle_thrown(false),
+ sound_played(false),
+ gfx_exploded(false),
+ colmap_exploded(false)
+{
+}
- void
- Bomber::on_successfull_apply (Pingu* pingu)
- {
- WorldObj::get_world()->play_wav("sounds/ohno.wav", pingu->get_pos ());
- }
+void
+Bomber::on_successfull_apply (Pingu* pingu)
+{
+ WorldObj::get_world()->play_wav("sounds/ohno.wav", pingu->get_pos ());
+}
- void
- Bomber::init ()
- {
- // Only load the surface again if no static_surface is available
- if (!static_surface_loaded)
- {
- static_surface_loaded = true;
- bomber_radius = PingusResource::load_surface ("Other/bomber_radius",
"pingus");
- bomber_radius_gfx = PingusResource::load_surface
("Other/bomber_radius_gfx", "pingus");
- }
+void
+Bomber::init ()
+{
+ // Only load the surface again if no static_surface is available
+ if (!static_surface_loaded)
+ {
+ static_surface_loaded = true;
+ bomber_radius = PingusResource::load_surface ("Other/bomber_radius",
"pingus");
+ bomber_radius_gfx = PingusResource::load_surface
("Other/bomber_radius_gfx", "pingus");
+ }
- explo_surf = PingusResource::load_surface ("Other/explo" + to_string
(pingu->get_owner ()), "pingus");
- sprite = Sprite(PingusResource::load_surface ("Pingus/bomber" +
to_string(pingu->get_owner ()), "pingus"),
- 17.0f, Sprite::NONE, Sprite::ONCE);
- sprite.set_align_center_bottom ();
+ explo_surf = PingusResource::load_surface ("Other/explo" + to_string
(pingu->get_owner ()), "pingus");
+ sprite = Sprite(PingusResource::load_surface ("Pingus/bomber" +
to_string(pingu->get_owner ()), "pingus"),
+ 17.0f, Sprite::NONE, Sprite::ONCE);
+ sprite.set_align_center_bottom ();
- sound_played = false;
- }
+ sound_played = false;
+}
- void
- Bomber::draw (GraphicContext& gc)
- {
- if (sprite.get_frame () >= 13 && !gfx_exploded)
- {
- gc.draw (explo_surf, CL_Vector(static_cast<int>(pingu->get_x () - 32),
- static_cast<int>(pingu->get_y () - 48)));
- gfx_exploded = true;
- }
+void
+Bomber::draw (GraphicContext& gc)
+{
+ if (sprite.get_frame () >= 13 && !gfx_exploded)
+ {
+ gc.draw (explo_surf, CL_Vector(static_cast<int>(pingu->get_x () - 32),
+ static_cast<int>(pingu->get_y () - 48)));
+ gfx_exploded = true;
+ }
- gc.draw(sprite, pingu->get_pos ());
- }
+ gc.draw(sprite, pingu->get_pos ());
+}
- void
- Bomber::update (float delta)
- {
- sprite.update (delta);
+void
+Bomber::update (float delta)
+{
+ sprite.update (delta);
- if (sprite.get_frame () > 9 && !sound_played) {
- WorldObj::get_world()->play_wav("sounds/plop.wav", pingu->get_pos ());
- sound_played = true;
- }
+ if (sprite.get_frame () > 9 && !sound_played) {
+ WorldObj::get_world()->play_wav("sounds/plop.wav", pingu->get_pos ());
+ sound_played = true;
+ }
- // Throwing particles
- if (sprite.get_frame () > 12 && !particle_thrown)
- {
- particle_thrown = true;
-
WorldObj::get_world()->get_particle_holder()->add_pingu_explo(static_cast<int>(pingu->get_x()),
-
static_cast<int>(pingu->get_y()) - 5);
- }
+ // Throwing particles
+ if (sprite.get_frame () > 12 && !particle_thrown)
+ {
+ particle_thrown = true;
+
WorldObj::get_world()->get_particle_holder()->add_pingu_explo(static_cast<int>(pingu->get_x()),
+
static_cast<int>(pingu->get_y()) - 5);
+ }
- if (sprite.get_frame () >= 13 && !colmap_exploded)
- {
- colmap_exploded = true;
+ if (sprite.get_frame () >= 13 && !colmap_exploded)
+ {
+ colmap_exploded = true;
- WorldObj::get_world()->get_colmap()->remove(bomber_radius,
- static_cast<int>(pingu->get_x
() - (bomber_radius.get_width()/2)),
- static_cast<int>(pingu->get_y
() - 16 - (bomber_radius.get_width()/2)));
- WorldObj::get_world()->get_gfx_map()->remove(bomber_radius_gfx,
+ WorldObj::get_world()->get_colmap()->remove(bomber_radius,
static_cast<int>(pingu->get_x
() - (bomber_radius.get_width()/2)),
static_cast<int>(pingu->get_y
() - 16 - (bomber_radius.get_width()/2)));
+ WorldObj::get_world()->get_gfx_map()->remove(bomber_radius_gfx,
+
static_cast<int>(pingu->get_x () - (bomber_radius.get_width()/2)),
+
static_cast<int>(pingu->get_y () - 16 - (bomber_radius.get_width()/2)));
- // Add an explosion to the forces list
- ForcesHolder::add_force(ExplosionForce(5,30,CL_Vector(pingu->get_x (),
- pingu->get_y ()
- 20)));
- }
+ // Add an explosion to the forces list
+ ForcesHolder::add_force(ExplosionForce(5,30,CL_Vector(pingu->get_x (),
+ pingu->get_y () -
20)));
+ }
- // The pingu explode
- if (sprite.finished ())
- {
- pingu->set_status(PS_DEAD);
- }
- }
+ // The pingu explode
+ if (sprite.finished ())
+ {
+ pingu->set_status(PS_DEAD);
+ }
+}
- void
- Bomber::update_position(float delta)
- {
- // Apply all forces
- pingu->set_velocity(ForcesHolder::apply_forces(pingu->get_pos(),
pingu->get_velocity()));
- pingu->set_pos(pingu->get_pos() + pingu->get_velocity());
+void
+Bomber::update_position(float delta)
+{
+ // Apply all forces
+ pingu->set_velocity(ForcesHolder::apply_forces(pingu->get_pos(),
pingu->get_velocity()));
+ pingu->set_pos(pingu->get_pos() + pingu->get_velocity());
- UNUSED_ARG(delta);
- }
-
+ UNUSED_ARG(delta);
}
+
+} // namespace Actions
/* EOF */
Index: bomber.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bomber.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- bomber.hxx 4 Sep 2002 20:30:29 -0000 1.10
+++ bomber.hxx 10 Sep 2002 19:24:19 -0000 1.11
@@ -25,44 +25,44 @@
namespace Actions {
- /** An action with lets the Pingu explode. After the explosion the the
- Pingu leaves a hole inside the ground. */
- class Bomber : public PinguAction
- {
- private:
- bool particle_thrown;
- bool sound_played;
- bool gfx_exploded;
- bool colmap_exploded;
+/** An action with lets the Pingu explode. After the explosion the the
+ Pingu leaves a hole inside the ground. */
+class Bomber : public PinguAction
+{
+private:
+ bool particle_thrown;
+ bool sound_played;
+ bool gfx_exploded;
+ bool colmap_exploded;
- static bool static_surface_loaded;
- Sprite sprite;
- static CL_Surface bomber_radius;
- static CL_Surface bomber_radius_gfx;
+ static bool static_surface_loaded;
+ Sprite sprite;
+ static CL_Surface bomber_radius;
+ static CL_Surface bomber_radius_gfx;
- CL_Surface explo_surf;
+ CL_Surface explo_surf;
- public:
- Bomber ();
+public:
+ Bomber ();
- void init (void);
- std::string get_name () const { return "Bomber"; }
- ActionName get_type() const { return Actions::Bomber; }
- ActionType get_activation_mode() const { return COUNTDOWN_TRIGGERED; }
+ void init (void);
+ std::string get_name () const { return "Bomber"; }
+ ActionName get_type() const { return Actions::Bomber; }
+ ActionType get_activation_mode() const { return COUNTDOWN_TRIGGERED; }
- void draw (GraphicContext& gc);
- void update(float delta);
+ void draw (GraphicContext& gc);
+ void update(float delta);
- void update_position(float delta);
- int activation_time() { return 50; }
- void on_successfull_apply (Pingu*);
+ void update_position(float delta);
+ int activation_time() { return 50; }
+ void on_successfull_apply (Pingu*);
- private:
- Bomber (const Bomber&);
- Bomber operator= (const Bomber&);
- };
+private:
+ Bomber (const Bomber&);
+ Bomber operator= (const Bomber&);
+};
-}
+} // namespace Actions
#endif
Index: bridger.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bridger.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- bridger.cxx 4 Sep 2002 20:30:29 -0000 1.13
+++ bridger.cxx 10 Sep 2002 19:24:19 -0000 1.14
@@ -32,200 +32,200 @@
namespace Actions {
- bool Bridger::static_surfaces_loaded = false;
- CL_Surface Bridger::brick_l;
- CL_Surface Bridger::brick_r;
- CL_Surface Bridger::static_surface;
+bool Bridger::static_surfaces_loaded = false;
+CL_Surface Bridger::brick_l;
+CL_Surface Bridger::brick_r;
+CL_Surface Bridger::static_surface;
- Bridger::Bridger () : mode(B_BUILDING),
- bricks(MAX_BRICKS),
- block_build(false),
- name("Bridger (" + to_string(bricks) + ")")
+Bridger::Bridger () : mode(B_BUILDING),
+ bricks(MAX_BRICKS),
+ block_build(false),
+ name("Bridger (" + to_string(bricks) + ")")
- {
- }
+{
+}
- void
- Bridger::init (void)
- {
- if (!static_surfaces_loaded)
- {
- static_surface = PingusResource::load_surface ("Pingus/bridger0",
"pingus");
- brick_l = PingusResource::load_surface ("Other/brick_left", "pingus");
- brick_r = PingusResource::load_surface ("Other/brick_right", "pingus");
- static_surfaces_loaded = true;
- }
- build_sprite = Sprite ("Pingus/bridger_build" + to_string(pingu->get_owner
()),
- "pingus", 15.0f, Sprite::NONE, Sprite::ONCE);
- walk_sprite = Sprite ("Pingus/bridger_walk" + to_string(pingu->get_owner
()),
- "pingus", 15.0f, Sprite::NONE, Sprite::ONCE);
- build_sprite.set_align_center_bottom ();
- walk_sprite.set_align_center_bottom ();
+void
+Bridger::init (void)
+{
+ if (!static_surfaces_loaded)
+ {
+ static_surface = PingusResource::load_surface ("Pingus/bridger0",
"pingus");
+ brick_l = PingusResource::load_surface ("Other/brick_left", "pingus");
+ brick_r = PingusResource::load_surface ("Other/brick_right", "pingus");
+ static_surfaces_loaded = true;
+ }
+ build_sprite = Sprite ("Pingus/bridger_build" + to_string(pingu->get_owner
()),
+ "pingus", 15.0f, Sprite::NONE, Sprite::ONCE);
+ walk_sprite = Sprite ("Pingus/bridger_walk" + to_string(pingu->get_owner ()),
+ "pingus", 15.0f, Sprite::NONE, Sprite::ONCE);
+ build_sprite.set_align_center_bottom ();
+ walk_sprite.set_align_center_bottom ();
- last_pos = pingu->get_pos();
- }
+ last_pos = pingu->get_pos();
+}
- void
- Bridger::draw (GraphicContext& gc)
- {
- int x_offset(6), y_offset(4);
+void
+Bridger::draw (GraphicContext& gc)
+{
+ int x_offset(6), y_offset(4);
- if (bricks == MAX_BRICKS) {
- x_offset = -4;
- y_offset = 0;
+ if (bricks == MAX_BRICKS) {
+ x_offset = -4;
+ y_offset = 0;
- } else if (bricks == MAX_BRICKS - 1) {
- x_offset = 0;
- y_offset = 1;
- } else if (bricks == MAX_BRICKS - 2) {
- x_offset = 3;
- y_offset = 2;
- }
+ } else if (bricks == MAX_BRICKS - 1) {
+ x_offset = 0;
+ y_offset = 1;
+ } else if (bricks == MAX_BRICKS - 2) {
+ x_offset = 3;
+ y_offset = 2;
+ }
- switch (mode)
- {
- case B_BUILDING:
- if (pingu->direction.is_left ())
- build_sprite.set_direction (Sprite::LEFT);
- else
- build_sprite.set_direction (Sprite::RIGHT);
+ switch (mode)
+ {
+ case B_BUILDING:
+ if (pingu->direction.is_left ())
+ build_sprite.set_direction (Sprite::LEFT);
+ else
+ build_sprite.set_direction (Sprite::RIGHT);
- gc.draw(build_sprite, CL_Vector(pingu->get_x () - (x_offset *
pingu->direction),
- pingu->get_y () + y_offset));
- break;
+ gc.draw(build_sprite, CL_Vector(pingu->get_x () - (x_offset *
pingu->direction),
+ pingu->get_y () + y_offset));
+ break;
- case B_WALKING:
- if (pingu->direction.is_left ())
- walk_sprite.set_direction (Sprite::LEFT);
- else
- walk_sprite.set_direction (Sprite::RIGHT);
- gc.draw (walk_sprite, CL_Vector(static_cast<int>(pingu->get_x () -
(x_offset * pingu->direction)),
- static_cast<int>(pingu->get_y () +
y_offset)));
- break;
- }
- }
+ case B_WALKING:
+ if (pingu->direction.is_left ())
+ walk_sprite.set_direction (Sprite::LEFT);
+ else
+ walk_sprite.set_direction (Sprite::RIGHT);
+ gc.draw (walk_sprite, CL_Vector(static_cast<int>(pingu->get_x () -
(x_offset * pingu->direction)),
+ static_cast<int>(pingu->get_y () +
y_offset)));
+ break;
+ }
+}
- void
- Bridger::update(float delta)
- {
- switch (mode)
- {
- case B_BUILDING:
- update_build (delta);
- break;
+void
+Bridger::update(float delta)
+{
+ switch (mode)
+ {
+ case B_BUILDING:
+ update_build (delta);
+ break;
- case B_WALKING:
- update_walk (delta);
- break;
- }
+ case B_WALKING:
+ update_walk (delta);
+ break;
+ }
- last_pos = pingu->get_pos();
- }
+ last_pos = pingu->get_pos();
+}
- void
- Bridger::update_walk (float delta)
- {
- if (walk_sprite.finished ())
- {
- if (way_is_free())
- {
- mode = B_BUILDING;
- block_build = false;
- walk_sprite.reset ();
- walk_one_step_up();
- }
- else // We reached a wall...
- {
- pingu->direction.change ();
- pingu->set_action (Actions::Walker);
- pingu->set_pos(last_pos);
- return;
- }
- }
- else
- {
- walk_sprite.update (delta);
- }
- }
+void
+Bridger::update_walk (float delta)
+{
+ if (walk_sprite.finished ())
+ {
+ if (way_is_free())
+ {
+ mode = B_BUILDING;
+ block_build = false;
+ walk_sprite.reset ();
+ walk_one_step_up();
+ }
+ else // We reached a wall...
+ {
+ pingu->direction.change ();
+ pingu->set_action (Actions::Walker);
+ pingu->set_pos(last_pos);
+ return;
+ }
+ }
+ else
+ {
+ walk_sprite.update (delta);
+ }
+}
- void
- Bridger::update_build (float delta)
- {
- build_sprite.update (delta);
+void
+Bridger::update_build (float delta)
+{
+ build_sprite.update (delta);
- if (build_sprite.get_frame () >= 7 && !block_build)
- {
- block_build = true;
+ if (build_sprite.get_frame () >= 7 && !block_build)
+ {
+ block_build = true;
- if (bricks > 0)
- {
- place_a_brick();
- }
- else // Out of bricks
- {
- pingu->set_action(Actions::Waiter);
- }
- }
+ if (bricks > 0)
+ {
+ place_a_brick();
+ }
+ else // Out of bricks
+ {
+ pingu->set_action(Actions::Waiter);
+ }
+ }
- if (build_sprite.finished ())
- {
- mode = B_WALKING;
- build_sprite.reset ();
- }
- }
+ if (build_sprite.finished ())
+ {
+ mode = B_WALKING;
+ build_sprite.reset ();
+ }
+}
- bool
- Bridger::way_is_free()
- {
- return (rel_getpixel(4,2) == GroundpieceData::GP_NOTHING)
- && !head_collision_on_walk(4, 2)
- && !head_collision_on_walk(8, 4);
- }
+bool
+Bridger::way_is_free()
+{
+ return (rel_getpixel(4,2) == GroundpieceData::GP_NOTHING)
+ && !head_collision_on_walk(4, 2)
+ && !head_collision_on_walk(8, 4);
+}
- void
- Bridger::place_a_brick()
- {
- bricks--;
- name = "Bridger (" + to_string(bricks) + ")";
+void
+Bridger::place_a_brick()
+{
+ bricks--;
+ name = "Bridger (" + to_string(bricks) + ")";
- if (bricks < 4)
- PingusSound::play_sound("sounds/ting.wav");
+ if (bricks < 4)
+ PingusSound::play_sound("sounds/ting.wav");
- if (pingu->direction.is_right())
- {
- WorldObj::get_world()->get_colmap()->put(brick_r,
- static_cast<int>(pingu->get_x() +
10 - brick_r.get_width()),
- static_cast<int>(pingu->get_y()),
- GroundpieceData::GP_BRIDGE);
- WorldObj::get_world()->get_gfx_map()->put(brick_r,
+ if (pingu->direction.is_right())
+ {
+ WorldObj::get_world()->get_colmap()->put(brick_r,
static_cast<int>(pingu->get_x()
+ 10 - brick_r.get_width()),
-
static_cast<int>(pingu->get_y()));
- }
- else
- {
- WorldObj::get_world()->get_colmap()->put(brick_r,
-
static_cast<int>(pingu->get_x() - 10),
-
static_cast<int>(pingu->get_y()),
- GroundpieceData::GP_BRIDGE);
- WorldObj::get_world()->get_gfx_map()->put(brick_l,
-
static_cast<int>(pingu->get_x() - 10),
-
static_cast<int>(pingu->get_y()));
- }
- }
-
- void
- Bridger::walk_one_step_up()
- {
- pingu->set_pos(pingu->get_x() + 4.0 * pingu->direction, pingu->get_y() -
2);
- counter = 0;
- }
+ static_cast<int>(pingu->get_y()),
+ GroundpieceData::GP_BRIDGE);
+ WorldObj::get_world()->get_gfx_map()->put(brick_r,
+ static_cast<int>(pingu->get_x()
+ 10 - brick_r.get_width()),
+
static_cast<int>(pingu->get_y()));
+ }
+ else
+ {
+ WorldObj::get_world()->get_colmap()->put(brick_r,
+ static_cast<int>(pingu->get_x()
- 10),
+ static_cast<int>(pingu->get_y()),
+ GroundpieceData::GP_BRIDGE);
+ WorldObj::get_world()->get_gfx_map()->put(brick_l,
+ static_cast<int>(pingu->get_x()
- 10),
+
static_cast<int>(pingu->get_y()));
+ }
+}
- std::string
- Bridger::get_name () const
- {
- return name;
- }
+void
+Bridger::walk_one_step_up()
+{
+ pingu->set_pos(pingu->get_x() + 4.0 * pingu->direction, pingu->get_y() - 2);
+ counter = 0;
+}
+std::string
+Bridger::get_name () const
+{
+ return name;
}
+
+} // namespace Actions
/* EOF */
Index: bridger.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bridger.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- bridger.hxx 4 Sep 2002 20:30:29 -0000 1.10
+++ bridger.hxx 10 Sep 2002 19:24:19 -0000 1.11
@@ -27,54 +27,54 @@
namespace Actions {
- class Bridger : public PinguAction
- {
- private:
- enum Mode { B_WALKING, B_BUILDING } mode;
- enum { MAX_BRICKS = 15 };
+class Bridger : public PinguAction
+{
+private:
+ enum Mode { B_WALKING, B_BUILDING } mode;
+ enum { MAX_BRICKS = 15 };
- private:
- Sprite walk_sprite;
- Sprite build_sprite;
+private:
+ Sprite walk_sprite;
+ Sprite build_sprite;
- GameCounter counter;
+ GameCounter counter;
- static bool static_surfaces_loaded;
- static CL_Surface static_surface;
- static CL_Surface brick_l;
- static CL_Surface brick_r;
+ static bool static_surfaces_loaded;
+ static CL_Surface static_surface;
+ static CL_Surface brick_l;
+ static CL_Surface brick_r;
- int bricks;
- //int step;
- //int do_steps;
- bool block_build;
+ int bricks;
+ //int step;
+ //int do_steps;
+ bool block_build;
- CL_Vector last_pos;
+ CL_Vector last_pos;
- std::string name;
- public:
- Bridger();
+ std::string name;
+public:
+ Bridger();
- void init ();
- std::string get_name () const;
- ActionName get_type () const { return Actions::Bridger; }
+ void init ();
+ std::string get_name () const;
+ ActionName get_type () const { return Actions::Bridger; }
- void update (float delta);
- void update_build (float delta);
- void update_walk (float delta);
+ void update (float delta);
+ void update_build (float delta);
+ void update_walk (float delta);
- void draw (GraphicContext& gc);
+ void draw (GraphicContext& gc);
- bool way_is_free ();
- void place_a_brick ();
- void walk_one_step_up ();
+ bool way_is_free ();
+ void place_a_brick ();
+ void walk_one_step_up ();
- private:
- Bridger (const Bridger&);
- Bridger operator= (const Bridger&);
- };
+private:
+ Bridger (const Bridger&);
+ Bridger operator= (const Bridger&);
+};
-}
+} // namespace Actions
#endif
Index: climber.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/climber.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- climber.cxx 4 Sep 2002 20:30:29 -0000 1.9
+++ climber.cxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -23,85 +23,85 @@
namespace Actions {
- Climber::Climber()
- {
- }
+Climber::Climber()
+{
+}
- void
- Climber::init(void)
- {
- sprite = Sprite ("Pingus/climber0", "pingus");
+void
+Climber::init(void)
+{
+ sprite = Sprite ("Pingus/climber0", "pingus");
- // these alignments are necessary to prevent climber walking
- // inside the wall.
- sprite_height = sprite.get_height();
- sprite_width = sprite.get_width();
- if (pingu->direction.is_left ()) {
- sprite.set_align (0, -sprite_height/2);
- sprite.set_direction (Sprite::LEFT);
- } else {
- sprite.set_align (-sprite_width, -sprite_height/2);
- sprite.set_direction (Sprite::RIGHT);
- }
+ // these alignments are necessary to prevent climber walking
+ // inside the wall.
+ sprite_height = sprite.get_height();
+ sprite_width = sprite.get_width();
+ if (pingu->direction.is_left ()) {
+ sprite.set_align (0, -sprite_height/2);
+ sprite.set_direction (Sprite::LEFT);
+ } else {
+ sprite.set_align (-sprite_width, -sprite_height/2);
+ sprite.set_direction (Sprite::RIGHT);
}
+}
- void
- Climber::update(float delta)
- {
- /*
- std::cout << "Climer update()" << std::endl;
- std::cout << "Direction: " << pingu->direction << std::endl;
- printf("%3d %3d %3d\n", rel_getpixel(1,1), rel_getpixel(0,1),
rel_getpixel(-1,1));
- printf("%3d %3d %3d\n", rel_getpixel(1,0), rel_getpixel(0,0),
rel_getpixel(-1,0));
- printf("%3d %3d %3d\n", rel_getpixel(1,-1),
rel_getpixel(0,-1),rel_getpixel(-1, -1));
- */
+void
+Climber::update(float delta)
+{
+ /*
+ std::cout << "Climer update()" << std::endl;
+ std::cout << "Direction: " << pingu->direction << std::endl;
+ printf("%3d %3d %3d\n", rel_getpixel(1,1), rel_getpixel(0,1),
rel_getpixel(-1,1));
+ printf("%3d %3d %3d\n", rel_getpixel(1,0), rel_getpixel(0,0),
rel_getpixel(-1,0));
+ printf("%3d %3d %3d\n", rel_getpixel(1,-1),
rel_getpixel(0,-1),rel_getpixel(-1, -1));
+ */
- sprite.update(delta);
+ sprite.update(delta);
- // If above is free
- if (rel_getpixel(0, 1) == GroundpieceData::GP_NOTHING
- || rel_getpixel (0, 1) == GroundpieceData::GP_BRIDGE)
- {
- // and there is still ground to walk on
- if (rel_getpixel(1, 1) != GroundpieceData::GP_NOTHING)
- {
- pingu->set_pos(pingu->get_y() - 1);
- return;
- }
- else if (rel_getpixel(1, 1) == GroundpieceData::GP_NOTHING)
- {
- // std::cout << "Climber failed, no more wall" << std::endl;
+ // If above is free
+ if (rel_getpixel(0, 1) == GroundpieceData::GP_NOTHING
+ || rel_getpixel (0, 1) == GroundpieceData::GP_BRIDGE)
+ {
+ // and there is still ground to walk on
+ if (rel_getpixel(1, 1) != GroundpieceData::GP_NOTHING)
+ {
+ pingu->set_pos(pingu->get_y() - 1);
+ return;
+ }
+ else if (rel_getpixel(1, 1) == GroundpieceData::GP_NOTHING)
+ {
+ // std::cout << "Climber failed, no more wall" << std::endl;
- // If Pingu able to get to new position without head collision
- if (!head_collision_on_walk(pingu->direction, 1))
- {
+ // If Pingu able to get to new position without head collision
+ if (!head_collision_on_walk(pingu->direction, 1))
+ {
// Get ready to walk
pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y()
- 1);
- }
- else
- {
+ }
+ else
+ {
// Get ready to fall
pingu->direction.change();
- }
-
- // Finish climbing.
- pingu->set_action(Actions::Walker);
- }
- }
- else
- {
- // std::cout << "Climber failed, falling down" << std::endl;
- pingu->direction.change();
- pingu->set_action(Actions::Walker);
- }
- }
+ }
- void
- Climber::draw (GraphicContext& gc)
- {
- gc.draw (sprite, pingu->get_pos());
- }
+ // Finish climbing.
+ pingu->set_action(Actions::Walker);
+ }
+ }
+ else
+ {
+ // std::cout << "Climber failed, falling down" << std::endl;
+ pingu->direction.change();
+ pingu->set_action(Actions::Walker);
+ }
+}
+void
+Climber::draw (GraphicContext& gc)
+{
+ gc.draw (sprite, pingu->get_pos());
}
+
+} // namespace Actions
/* EOF */
Index: climber.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/climber.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- climber.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ climber.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,31 +25,31 @@
namespace Actions {
- class Climber : public PinguAction
- {
- private:
- Sprite sprite;
- int sprite_width, sprite_height;
- public:
- Climber ();
- void init ();
+class Climber : public PinguAction
+{
+private:
+ Sprite sprite;
+ int sprite_width, sprite_height;
+public:
+ Climber ();
+ void init ();
- std::string get_name () const { return "Climber"; }
- ActionName get_type () const { return Actions::Climber; }
- ActionType get_activation_mode () const { return WALL_TRIGGERED; }
+ std::string get_name () const { return "Climber"; }
+ ActionName get_type () const { return Actions::Climber; }
+ ActionType get_activation_mode () const { return WALL_TRIGGERED; }
- void draw (GraphicContext& gc);
+ void draw (GraphicContext& gc);
- void update (float delta);
+ void update (float delta);
- char get_persistent_char () { return 'c'; }
+ char get_persistent_char () { return 'c'; }
- private:
- Climber (const Climber&);
- Climber operator= (const Climber&);
- };
+private:
+ Climber (const Climber&);
+ Climber operator= (const Climber&);
+};
-}
+} // namespace Actions
#endif
Index: digger.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/digger.cxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- digger.cxx 4 Sep 2002 20:30:29 -0000 1.11
+++ digger.cxx 10 Sep 2002 19:24:19 -0000 1.12
@@ -30,81 +30,81 @@
namespace Actions {
- Digger::Digger () : digger_c(0)
- {
- }
+Digger::Digger () : digger_c(0)
+{
+}
- void
- Digger::init (void)
- {
- digger_radius = PingusResource::load_surface ("Other/digger_radius",
"pingus");
- digger_radius_gfx = PingusResource::load_surface
("Other/digger_radius_gfx", "pingus");
- sprite = Sprite (std::string("Pingus/digger") + to_string(pingu->get_owner
()),
- "pingus");
+void
+Digger::init (void)
+{
+ digger_radius = PingusResource::load_surface ("Other/digger_radius",
"pingus");
+ digger_radius_gfx = PingusResource::load_surface ("Other/digger_radius_gfx",
"pingus");
+ sprite = Sprite (std::string("Pingus/digger") + to_string(pingu->get_owner
()),
+ "pingus");
#if 0
- // FIXME: Just an idea...
- sprite = Sprite (std::string("Pingus/digger") + to_string(pingu->get_owner
()),
- "pingus", PropertyMgr::instance()->get_int
("actions/digger/sprite-fps", 20));
+ // FIXME: Just an idea...
+ sprite = Sprite (std::string("Pingus/digger") + to_string(pingu->get_owner
()),
+ "pingus", PropertyMgr::instance()->get_int
("actions/digger/sprite-fps", 20));
#endif
- sprite.set_align_center_bottom ();
- }
+ sprite.set_align_center_bottom ();
+}
- void
- Digger::update (float delta)
- {
- sprite.update (delta);
+void
+Digger::update (float delta)
+{
+ sprite.update (delta);
- if (++digger_c >= 3)
- {
- digger_c = 0;
- dig();
- }
+ if (++digger_c >= 3)
+ {
+ digger_c = 0;
+ dig();
+ }
- if (!have_something_to_dig())
- {
- dig ();
- pingu->set_action(Actions::Walker);
- }
- }
+ if (!have_something_to_dig())
+ {
+ dig ();
+ pingu->set_action(Actions::Walker);
+ }
+}
- bool
- Digger::have_something_to_dig ()
- {
- if (rel_getpixel(0, -1) != GroundpieceData::GP_NOTHING)
- {
- if (rel_getpixel(0, -1) == GroundpieceData::GP_SOLID)
- {
- PingusSound::play_sound("sounds/chink.wav");
- return false;
- }
- else
- return true;
- }
- else
- {
- return false;
- }
- }
+bool
+Digger::have_something_to_dig ()
+{
+ if (rel_getpixel(0, -1) != GroundpieceData::GP_NOTHING)
+ {
+ if (rel_getpixel(0, -1) == GroundpieceData::GP_SOLID)
+ {
+ PingusSound::play_sound("sounds/chink.wav");
+ return false;
+ }
+ else
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
- void
- Digger::dig ()
- {
- WorldObj::get_world()->get_colmap()->remove(digger_radius,
- static_cast<int>(pingu->get_x
() - 16),
- static_cast<int>(pingu->get_y()
- 14));
- WorldObj::get_world()->get_gfx_map()->remove(digger_radius_gfx,
- static_cast<int>(pingu->get_x
() - 16),
-
static_cast<int>(pingu->get_y() - 14));
+void
+Digger::dig ()
+{
+ WorldObj::get_world()->get_colmap()->remove(digger_radius,
+ static_cast<int>(pingu->get_x ()
- 16),
+ static_cast<int>(pingu->get_y() -
14));
+ WorldObj::get_world()->get_gfx_map()->remove(digger_radius_gfx,
+ static_cast<int>(pingu->get_x ()
- 16),
+ static_cast<int>(pingu->get_y()
- 14));
- pingu->set_y(pingu->get_y() + 1);
- }
-
- void
- Digger::draw (GraphicContext& gc)
- {
- gc.draw(sprite, pingu->get_pos ());
- }
+ pingu->set_y(pingu->get_y() + 1);
+}
+void
+Digger::draw (GraphicContext& gc)
+{
+ gc.draw(sprite, pingu->get_pos ());
}
+
+} // namespace Actions
/* EOF */
Index: digger.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/digger.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- digger.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ digger.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,33 +25,33 @@
namespace Actions {
- /** FIXME: Not delta capable! */
- class Digger : public PinguAction
- {
- private:
- CL_Surface digger_radius;
- CL_Surface digger_radius_gfx;
- Sprite sprite;
- int digger_c;
- public:
- Digger();
- void init (void);
+/** FIXME: Not delta capable! */
+class Digger : public PinguAction
+{
+private:
+ CL_Surface digger_radius;
+ CL_Surface digger_radius_gfx;
+ Sprite sprite;
+ int digger_c;
+public:
+ Digger();
+ void init (void);
- std::string get_name () const { return "Digger"; }
- ActionName get_type () const { return Actions::Digger; }
+ std::string get_name () const { return "Digger"; }
+ ActionName get_type () const { return Actions::Digger; }
- bool have_something_to_dig ();
- void dig ();
+ bool have_something_to_dig ();
+ void dig ();
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- private:
- Digger (const Digger&);
- Digger operator= (const Digger&);
- };
+private:
+ Digger (const Digger&);
+ Digger operator= (const Digger&);
+};
-}
+} // namespace Actions
#endif
Index: drown.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/drown.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- drown.cxx 4 Sep 2002 20:30:29 -0000 1.6
+++ drown.cxx 10 Sep 2002 19:24:19 -0000 1.7
@@ -23,41 +23,41 @@
namespace Actions {
- void
- Drown::init ()
- {
- //if (pingu->environment == ENV_AIR)
- sprite = Sprite("Pingus/drownfall0", "pingus", 60.0f,
- Sprite::NONE, Sprite::ONCE);
- //else
- //sprite = Sprite ("Pingus/drownwalk0", "pingus", 30.0f,
- // Sprite::NONE, Sprite::ONCE);
-
- sprite.set_align_center_bottom();
- }
+void
+Drown::init ()
+{
+ //if (pingu->environment == ENV_AIR)
+ sprite = Sprite("Pingus/drownfall0", "pingus", 60.0f,
+ Sprite::NONE, Sprite::ONCE);
+ //else
+ //sprite = Sprite ("Pingus/drownwalk0", "pingus", 30.0f,
+ // Sprite::NONE, Sprite::ONCE);
- void
- Drown::draw (GraphicContext& gc)
- {
- // FIXME: Direction handling is ugly
- if (pingu->direction.is_left())
- sprite.set_direction(Sprite::LEFT);
- else
- sprite.set_direction(Sprite::RIGHT);
+ sprite.set_align_center_bottom();
+}
- gc.draw(sprite, pingu->get_pos ());
- }
+void
+Drown::draw (GraphicContext& gc)
+{
+ // FIXME: Direction handling is ugly
+ if (pingu->direction.is_left())
+ sprite.set_direction(Sprite::LEFT);
+ else
+ sprite.set_direction(Sprite::RIGHT);
- void
- Drown::update (float delta)
- {
- sprite.update(delta);
- if (sprite.finished())
- {
- pingu->set_status(PS_DEAD);
- }
- }
+ gc.draw(sprite, pingu->get_pos ());
+}
+void
+Drown::update (float delta)
+{
+ sprite.update(delta);
+ if (sprite.finished())
+ {
+ pingu->set_status(PS_DEAD);
+ }
}
+
+} // namespace Actions
/* EOF */
Index: drown.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/drown.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- drown.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ drown.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,29 +25,29 @@
namespace Actions {
- class Drown : public PinguAction
- {
- private:
- Sprite sprite;
+class Drown : public PinguAction
+{
+private:
+ Sprite sprite;
- public:
- Drown () { }
- void init ();
+public:
+ Drown () { }
+ void init ();
- std::string get_name () const { return "Drown"; }
- ActionName get_type () const { return Actions::Drown; }
+ std::string get_name () const { return "Drown"; }
+ ActionName get_type () const { return Actions::Drown; }
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- bool catchable () { return false; }
+ bool catchable () { return false; }
- private:
- Drown (const Drown&);
- Drown operator= (const Drown&);
- };
+private:
+ Drown (const Drown&);
+ Drown operator= (const Drown&);
+};
-}
+} // namespace Actions
#endif
Index: exiter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/exiter.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- exiter.cxx 4 Sep 2002 20:30:29 -0000 1.6
+++ exiter.cxx 10 Sep 2002 19:24:19 -0000 1.7
@@ -24,39 +24,39 @@
namespace Actions {
- void
- Exiter::init (void)
- {
- sprite = Sprite("Pingus/exit0", "pingus", 10.0f, Sprite::NONE,
Sprite::ONCE);
- sprite.set_align_center_bottom();
- }
+void
+Exiter::init (void)
+{
+ sprite = Sprite("Pingus/exit0", "pingus", 10.0f, Sprite::NONE, Sprite::ONCE);
+ sprite.set_align_center_bottom();
+}
- void
- Exiter::update (float delta)
- {
- sprite.update(delta);
+void
+Exiter::update (float delta)
+{
+ sprite.update(delta);
- if (sprite.finished())
- {
- if (pingu->get_status() != PS_EXITED)
- {
- PingusSound::play_sound("sounds/yipee.wav");
- pingu->set_status(PS_EXITED);
- }
- }
- }
+ if (sprite.finished())
+ {
+ if (pingu->get_status() != PS_EXITED)
+ {
+ PingusSound::play_sound("sounds/yipee.wav");
+ pingu->set_status(PS_EXITED);
+ }
+ }
+}
- void
- Exiter::draw (GraphicContext& gc)
- {
- if (pingu->direction.is_left())
- sprite.set_direction(Sprite::LEFT);
- else
- sprite.set_direction(Sprite::RIGHT);
+void
+Exiter::draw (GraphicContext& gc)
+{
+ if (pingu->direction.is_left())
+ sprite.set_direction(Sprite::LEFT);
+ else
+ sprite.set_direction(Sprite::RIGHT);
- gc.draw(sprite, pingu->get_pos ());
- }
-
+ gc.draw(sprite, pingu->get_pos ());
}
+
+} // namespace Actions
/* EOF */
Index: exiter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/exiter.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- exiter.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ exiter.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,26 +25,26 @@
namespace Actions {
- class Exiter : public PinguAction
- {
- private:
- Sprite sprite;
+class Exiter : public PinguAction
+{
+private:
+ Sprite sprite;
- public:
- Exiter () { }
- void init(void);
- std::string get_name () const { return "Exiter"; }
- ActionName get_type() const { return Actions::Exiter; }
+public:
+ Exiter () { }
+ void init(void);
+ std::string get_name () const { return "Exiter"; }
+ ActionName get_type() const { return Actions::Exiter; }
- void draw (GraphicContext& gc);
- void update(float delta);
+ void draw (GraphicContext& gc);
+ void update(float delta);
- private:
- Exiter (const Exiter&);
- Exiter operator= (const Exiter&);
- };
+private:
+ Exiter (const Exiter&);
+ Exiter operator= (const Exiter&);
+};
-}
+} // namespace Actions
#endif
Index: faller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- faller.cxx 4 Sep 2002 22:11:24 -0000 1.20
+++ faller.cxx 10 Sep 2002 19:24:19 -0000 1.21
@@ -29,156 +29,157 @@
namespace Actions {
- const float Faller::deadly_velocity = 20.0f;
+const float Faller::deadly_velocity = 20.0f;
- Faller::Faller() : falling(0) { }
+Faller::Faller() : falling(0) { }
- Faller::~Faller() { }
+Faller::~Faller() { }
- void
- Faller::init(void)
- {
- faller = Sprite("Pingus/faller" + to_string(pingu->get_owner ()),
"pingus");
- faller.set_align_center_bottom ();
+void
+Faller::init(void)
+{
+ faller = Sprite("Pingus/faller" + to_string(pingu->get_owner ()), "pingus");
+ faller.set_align_center_bottom ();
- // FIXME: we can save some cpu cycles & memory if we do this when it
- // is necessary
- tumbler = Sprite("Pingus/tumble" + to_string(pingu->get_owner()),
"pingus");
- tumbler.set_align_center_bottom ();
- }
-
- void
- Faller::update (float delta)
- {
- tumbler.update (delta);
- faller.update (delta);
+ // FIXME: we can save some cpu cycles & memory if we do this when it
+ // is necessary
+ tumbler = Sprite("Pingus/tumble" + to_string(pingu->get_owner()), "pingus");
+ tumbler.set_align_center_bottom ();
+}
- // Pingu stands on ground
- if (rel_getpixel(0, -1) != GroundpieceData::GP_NOTHING)
- {
- pingu->set_action (Actions::Walker);
- return;
- }
+void
+Faller::update (float delta)
+{
+ tumbler.update (delta);
+ faller.update (delta);
- // FIXME: This should be triggered at a later point, when close to
- // FIXME: deadly_velocity or something like that
- if (pingu->get_velocity().y > 5.0 && pingu->request_fall_action())
+ // Pingu stands on ground
+ if (rel_getpixel(0, -1) != GroundpieceData::GP_NOTHING)
+ {
+ pingu->set_action (Actions::Walker);
return;
+ }
- // Apply all forces
- pingu->set_velocity(ForcesHolder::apply_forces(pingu->get_pos(),
pingu->get_velocity()));
+ // FIXME: This should be triggered at a later point, when close to
+ // FIXME: deadly_velocity or something like that
+ if (pingu->get_velocity().y > 5.0 && pingu->request_fall_action())
+ return;
+
+ // Apply all forces
+ pingu->set_velocity(ForcesHolder::apply_forces(pingu->get_pos(),
pingu->get_velocity()));
- CL_Vector newp = pingu->get_velocity();
- CL_Vector last_pos;
+ CL_Vector newp = pingu->get_velocity();
+ CL_Vector last_pos;
- // Update x and y by moving the penguin to it's target *slowly*
- // and checking if the penguin has hit the bottom at each loop
- while(rel_getpixel(0, 0) == GroundpieceData::GP_NOTHING
- && (fabs(newp.x) >= 1 || fabs(newp.y) >= 1))
- {
- last_pos = pingu->get_pos();
+ // Update x and y by moving the penguin to it's target *slowly*
+ // and checking if the penguin has hit the bottom at each loop
+ while(rel_getpixel(0, 0) == GroundpieceData::GP_NOTHING
+ && (fabs(newp.x) >= 1 || fabs(newp.y) >= 1))
+ {
+ last_pos = pingu->get_pos();
- if (fabs(newp.x) >= 1)
- {
- // Since the velocity might be a
- // fraction stop when we are within 1 unit of the target
- if (newp.x > 0)
- {
- pingu->set_x(pingu->get_x() + 1);
- newp.x--;
- }
- else
- {
- pingu->set_x(pingu->get_x() - 1);
- newp.x++;
- }
- }
+ if (fabs(newp.x) >= 1)
+ {
+ // Since the velocity might be a
+ // fraction stop when we are within 1 unit of the target
+ if (newp.x > 0)
+ {
+ pingu->set_x(pingu->get_x() + 1);
+ newp.x--;
+ }
+ else
+ {
+ pingu->set_x(pingu->get_x() - 1);
+ newp.x++;
+ }
+ }
- if (fabs(newp.y) >= 1)
- {
- if (newp.y > 0)
- {
- pingu->set_y(pingu->get_y() + 1);
- newp.y--;
- }
- else
- {
- pingu->set_y(pingu->get_y() - 1);
- newp.y++;
- }
- }
- }
+ if (fabs(newp.y) >= 1)
+ {
+ if (newp.y > 0)
+ {
+ pingu->set_y(pingu->get_y() + 1);
+ newp.y--;
+ }
+ else
+ {
+ pingu->set_y(pingu->get_y() - 1);
+ newp.y++;
+ }
+ }
+ }
- // Now that the Pingu is moved, check if he hits the ground.
- if (rel_getpixel(0, 0) == GroundpieceData::GP_NOTHING)
- { // if pingu is not on ground
- ++falling;
+ // Now that the Pingu is moved, check if he hits the ground.
+ if (rel_getpixel(0, 0) == GroundpieceData::GP_NOTHING)
+ { // if pingu is not on ground
+ ++falling;
- //if (falling > 3) //FIXME: insert floater check here
- //pingu->environment = ENV_AIR;
- }
- else // Ping is on ground/water/something
- {
- if (rel_getpixel(0, 0) == GroundpieceData::GP_WATER)
- {
- pingu->set_action(Actions::Drown);
- return;
- }
- else
- {
- // Did we stop too fast?
- if (fabs(pingu->get_velocity().y) > deadly_velocity)
- {
- pingu->set_action(Actions::Splashed);
- return;
- }
- else if (fabs(pingu->get_velocity().x) > deadly_velocity)
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Pingu: x Smashed on ground,
jumping" << std::endl;
- }
- }
- // Reset the velocity
- pingu->set_velocity(CL_Vector(-(pingu->get_velocity().x/3), 0));
- pingu->set_pos(last_pos);
-
- // FIXME: UGLY!
- //pingu->set_action (Walker);
- }
- }
+ //if (falling > 3) //FIXME: insert floater check here
+ //pingu->environment = ENV_AIR;
+ }
+ else // Ping is on ground/water/something
+ {
+ if (rel_getpixel(0, 0) == GroundpieceData::GP_WATER)
+ {
+ pingu->set_action(Actions::Drown);
+ return;
+ }
+ else
+ {
+ // Did we stop too fast?
+ if (fabs(pingu->get_velocity().y) > deadly_velocity)
+ {
+ pingu->set_action(Actions::Splashed);
+ return;
+ }
+ else if (fabs(pingu->get_velocity().x) > deadly_velocity)
+ {
+ pout(PINGUS_DEBUG_ACTIONS) << "Pingu: x Smashed on ground,
jumping" << std::endl;
+ }
+ }
+ // Reset the velocity
+ pingu->set_velocity(CL_Vector(-(pingu->get_velocity().x/3), 0));
+ pingu->set_pos(last_pos);
- void
- Faller::draw (GraphicContext& gc)
- {
- if (is_tumbling()) {
- gc.draw(tumbler, pingu->get_pos ());
- } else {
- gc.draw(tumbler, pingu->get_pos ());
+ // FIXME: UGLY!
+ //pingu->set_action (Walker);
}
- }
+}
- bool
- Faller::is_tumbling () const
- {
- // If we are going fast enough to get smashed, start tumbling
- if ( fabs(pingu->get_velocity().x) > deadly_velocity
- || fabs(pingu->get_velocity().y) > deadly_velocity)
- {
- return true;
- }
- else
- {
- return false;
- }
+void
+Faller::draw (GraphicContext& gc)
+{
+ if (is_tumbling()) {
+ gc.draw(tumbler, pingu->get_pos ());
+ } else {
+ gc.draw(tumbler, pingu->get_pos ());
}
+}
- bool
- Faller::change_allowed (ActionName new_action)
- {
- if (new_action == Actions::Floater)
+bool
+Faller::is_tumbling () const
+{
+ // If we are going fast enough to get smashed, start tumbling
+ if ( fabs(pingu->get_velocity().x) > deadly_velocity
+ || fabs(pingu->get_velocity().y) > deadly_velocity)
+ {
return true;
- else
+ }
+ else
+ {
return false;
- }
+ }
+}
+
+bool
+Faller::change_allowed (ActionName new_action)
+{
+ if (new_action == Actions::Floater)
+ return true;
+ else
+ return false;
}
+
+} // namespace Actions
/* EOF */
Index: faller.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.hxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- faller.hxx 4 Sep 2002 20:30:29 -0000 1.12
+++ faller.hxx 10 Sep 2002 19:24:19 -0000 1.13
@@ -25,37 +25,37 @@
namespace Actions {
- class Faller : public PinguAction
- {
- private:
- Sprite faller;
- Sprite tumbler;
+class Faller : public PinguAction
+{
+private:
+ Sprite faller;
+ Sprite tumbler;
- int falling;
+ int falling;
- static const float deadly_velocity;
+ static const float deadly_velocity;
- public:
- Faller();
- virtual ~Faller();
+public:
+ Faller();
+ virtual ~Faller();
- void init(void);
+ void init(void);
- void draw (GraphicContext& gc);
- void update(float delta);
+ void draw (GraphicContext& gc);
+ void update(float delta);
- bool change_allowed (Actions::ActionName new_action);
+ bool change_allowed (Actions::ActionName new_action);
- std::string get_name() const { return "Faller"; }
- ActionName get_type() const { return Actions::Faller; }
- bool is_tumbling () const;
+ std::string get_name() const { return "Faller"; }
+ ActionName get_type() const { return Actions::Faller; }
+ bool is_tumbling () const;
- private:
- Faller (const Faller&);
- Faller operator= (const Faller&);
- };
+private:
+ Faller (const Faller&);
+ Faller operator= (const Faller&);
+};
-}
+} // namespace Actions
#endif
Index: floater.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/floater.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- floater.cxx 4 Sep 2002 20:30:29 -0000 1.13
+++ floater.cxx 10 Sep 2002 19:24:19 -0000 1.14
@@ -23,48 +23,48 @@
namespace Actions {
- Floater::Floater() : falling_depth(0), step(0)
- {
- }
+Floater::Floater() : falling_depth(0), step(0)
+{
+}
- void
- Floater::init(void)
- {
- falling_depth = 0;
- step = 0;
- sprite = Sprite ("Pingus/floater0", "pingus");
- sprite.set_align_center_bottom ();
- }
+void
+Floater::init(void)
+{
+ falling_depth = 0;
+ step = 0;
+ sprite = Sprite ("Pingus/floater0", "pingus");
+ sprite.set_align_center_bottom ();
+}
- void
- Floater::update(float delta)
- {
- sprite.update (delta);
+void
+Floater::update(float delta)
+{
+ sprite.update (delta);
- pingu->set_velocity(CL_Vector(0.0, 0.0));
- if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING) {
- ++step;
- if (step > 0) {
- pingu->set_y(pingu->get_y() + 1);
- step = 0;
- }
- } else {
- pingu->set_action (Actions::Walker);
+ pingu->set_velocity(CL_Vector(0.0, 0.0));
+ if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING) {
+ ++step;
+ if (step > 0) {
+ pingu->set_y(pingu->get_y() + 1);
+ step = 0;
}
+ } else {
+ pingu->set_action (Actions::Walker);
}
+}
- void
- Floater::draw (GraphicContext& gc)
- {
- gc.draw (sprite, pingu->get_pos());
- }
-
- bool
- Floater::change_allowed (ActionName)
- {
- return false;
- }
+void
+Floater::draw (GraphicContext& gc)
+{
+ gc.draw (sprite, pingu->get_pos());
+}
+bool
+Floater::change_allowed (ActionName)
+{
+ return false;
}
+
+} // namespace Actions
/* EOF */
Index: floater.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/floater.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- floater.hxx 4 Sep 2002 20:30:29 -0000 1.9
+++ floater.hxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -25,33 +25,33 @@
namespace Actions {
- class Floater : public PinguAction
- {
- private:
- int falling_depth;
- int step;
- Sprite sprite;
- public:
- Floater();
+class Floater : public PinguAction
+{
+private:
+ int falling_depth;
+ int step;
+ Sprite sprite;
+public:
+ Floater();
- std::string get_name() const { return "Floater"; }
- ActionName get_type() const { return Actions::Floater; }
- ActionType get_activation_mode() const { return FALL_TRIGGERED; }
+ std::string get_name() const { return "Floater"; }
+ ActionName get_type() const { return Actions::Floater; }
+ ActionType get_activation_mode() const { return FALL_TRIGGERED; }
- void init(void);
+ void init(void);
- void draw (GraphicContext& gc);
- void update(float delta);
+ void draw (GraphicContext& gc);
+ void update(float delta);
- char get_persistent_char () { return 'f'; }
- bool change_allowed (ActionName new_action);
+ char get_persistent_char () { return 'f'; }
+ bool change_allowed (ActionName new_action);
- private:
- Floater (const Floater&);
- Floater operator= (const Floater&);
- };
+private:
+ Floater (const Floater&);
+ Floater operator= (const Floater&);
+};
-}
+} // namespace Actions
#endif
Index: jumper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/jumper.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- jumper.cxx 4 Sep 2002 20:30:29 -0000 1.9
+++ jumper.cxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -24,43 +24,43 @@
namespace Actions {
- Jumper::Jumper ()
- {
- // do nothing
- }
+Jumper::Jumper ()
+{
+ // do nothing
+}
- void
- Jumper::init ()
- {
- sprite = Sprite("Pingus/jumper" + to_string(pingu->get_owner ()),
- "pingus");
- }
+void
+Jumper::init ()
+{
+ sprite = Sprite("Pingus/jumper" + to_string(pingu->get_owner ()),
+ "pingus");
+}
- void
- Jumper::draw (GraphicContext& gc)
- {
- gc.draw(sprite, pingu->get_pos ());
- }
+void
+Jumper::draw (GraphicContext& gc)
+{
+ gc.draw(sprite, pingu->get_pos ());
+}
- void
- Jumper::update (float delta)
- {
- //FIXME CL_Vector
- CL_Vector temp(pingu->get_velocity());
+void
+Jumper::update (float delta)
+{
+ //FIXME CL_Vector
+ CL_Vector temp(pingu->get_velocity());
- if (pingu->direction.is_right()) {
- pingu->set_velocity(temp + CL_Vector(10.0, -10.0));
- } else {
- pingu->set_velocity(temp + CL_Vector(-10.0, -10.0));
- }
-
- // Move the pingu in the air, so that it can start 'falling'
- pingu->set_y(pingu->get_y() - 1);
-
- pingu->set_action (Actions::Faller);
- UNUSED_ARG(delta);
+ if (pingu->direction.is_right()) {
+ pingu->set_velocity(temp + CL_Vector(10.0, -10.0));
+ } else {
+ pingu->set_velocity(temp + CL_Vector(-10.0, -10.0));
}
+ // Move the pingu in the air, so that it can start 'falling'
+ pingu->set_y(pingu->get_y() - 1);
+
+ pingu->set_action (Actions::Faller);
+ UNUSED_ARG(delta);
}
+
+} // namespace Actions
/* EOF */
Index: jumper.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/jumper.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- jumper.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ jumper.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,26 +25,26 @@
namespace Actions {
- class Jumper : public PinguAction
- {
- private:
- Sprite sprite;
- public:
- Jumper();
+class Jumper : public PinguAction
+{
+private:
+ Sprite sprite;
+public:
+ Jumper();
- void init(void);
- std::string get_name() const { return "Jumper"; }
- ActionName get_type() const { return Actions::Jumper; }
+ void init(void);
+ std::string get_name() const { return "Jumper"; }
+ ActionName get_type() const { return Actions::Jumper; }
- void draw (GraphicContext& gc);
- void update(float delta);
+ void draw (GraphicContext& gc);
+ void update(float delta);
- private:
- Jumper (const Jumper&);
- Jumper operator= (const Jumper&);
- };
+private:
+ Jumper (const Jumper&);
+ Jumper operator= (const Jumper&);
+};
-}
+} // namespace Actions
#endif
Index: laser_kill.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/laser_kill.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- laser_kill.cxx 4 Sep 2002 20:30:29 -0000 1.4
+++ laser_kill.cxx 10 Sep 2002 19:24:19 -0000 1.5
@@ -22,31 +22,31 @@
namespace Actions {
- LaserKill::LaserKill()
- {
- }
-
- void
- LaserKill::init(void)
- {
- sprite = Sprite ("Other/laser_kill0", "pingus");
- }
+LaserKill::LaserKill()
+{
+}
- void
- LaserKill::draw (GraphicContext& gc)
- {
- gc.draw(sprite, pingu->get_pos ());
- }
+void
+LaserKill::init(void)
+{
+ sprite = Sprite ("Other/laser_kill0", "pingus");
+}
- void
- LaserKill::update(float /*delta*/)
- {
- //if (counter >= (int)(surface.get_num_frames()) - 1)
- //{
- pingu->set_status(PS_DEAD);
- //}
- }
+void
+LaserKill::draw (GraphicContext& gc)
+{
+ gc.draw(sprite, pingu->get_pos ());
+}
+void
+LaserKill::update(float /*delta*/)
+{
+ //if (counter >= (int)(surface.get_num_frames()) - 1)
+ //{
+ pingu->set_status(PS_DEAD);
+ //}
}
+
+} // namespace Actions
/* EOF */
Index: laser_kill.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/laser_kill.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- laser_kill.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ laser_kill.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,28 +25,28 @@
namespace Actions {
- class LaserKill : public PinguAction
- {
- private:
- Sprite sprite;
+class LaserKill : public PinguAction
+{
+private:
+ Sprite sprite;
- public:
- LaserKill ();
- std::string get_name () const { return "LaserKill"; }
- ActionName get_type () const { return Actions::Laserkill; }
- void init (void);
+public:
+ LaserKill ();
+ std::string get_name () const { return "LaserKill"; }
+ ActionName get_type () const { return Actions::Laserkill; }
+ void init (void);
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- bool catchable () { return false; }
+ bool catchable () { return false; }
- private:
- LaserKill (const LaserKill&);
- LaserKill operator= (const LaserKill&);
- };
+private:
+ LaserKill (const LaserKill&);
+ LaserKill operator= (const LaserKill&);
+};
-}
+} // namespace Actions
#endif
Index: miner.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/miner.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- miner.cxx 4 Sep 2002 20:30:29 -0000 1.9
+++ miner.cxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -97,6 +97,6 @@
gc.draw (sprite, pingu->get_pos());
}
-}
+} // namespace Actions
/* EOF */
Index: miner.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/miner.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- miner.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ miner.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,30 +25,30 @@
namespace Actions {
- class Miner : public PinguAction
- {
- private:
- CL_Surface miner_radius;
- CL_Surface miner_radius_gfx;
- Sprite sprite;
- int slow_count;
- public:
- Miner ();
- virtual ~Miner () {}
+class Miner : public PinguAction
+{
+private:
+ CL_Surface miner_radius;
+ CL_Surface miner_radius_gfx;
+ Sprite sprite;
+ int slow_count;
+public:
+ Miner ();
+ virtual ~Miner () {}
- void init (void);
- std::string get_name () const { return "Miner"; }
- ActionName get_type () const { return Actions::Miner; }
+ void init (void);
+ std::string get_name () const { return "Miner"; }
+ ActionName get_type () const { return Actions::Miner; }
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- private:
- Miner (const Miner&);
- Miner operator= (const Miner&);
- };
+private:
+ Miner (const Miner&);
+ Miner operator= (const Miner&);
+};
-}
+} // namespace Actions
#endif
Index: rocket_launcher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/rocket_launcher.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rocket_launcher.cxx 4 Sep 2002 20:30:29 -0000 1.7
+++ rocket_launcher.cxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -28,44 +28,44 @@
namespace Actions {
- void
- RocketLauncher::init ()
- {
- sprite = Sprite (PingusResource::load_surface
- ("Pingus/rocketlauncher" + to_string(pingu->get_owner ()),
- "pingus"), 10.0f, Sprite::NONE, Sprite::ONCE);
- sprite.set_align_center_bottom();
- launched = false;
+void
+RocketLauncher::init ()
+{
+ sprite = Sprite (PingusResource::load_surface
+ ("Pingus/rocketlauncher" + to_string(pingu->get_owner ()),
+ "pingus"), 10.0f, Sprite::NONE, Sprite::ONCE);
+ sprite.set_align_center_bottom();
+ launched = false;
- WorldObj::get_world()->get_particle_holder()->add_particle
- (new ExplosiveParticle (static_cast<int>(pingu->get_x()),
- static_cast<int>(pingu->get_y()) - 12,
- pingu->direction.is_left() ? -400.0f : 400.0f,
- 0.0f));
- }
+ WorldObj::get_world()->get_particle_holder()->add_particle
+ (new ExplosiveParticle (static_cast<int>(pingu->get_x()),
+ static_cast<int>(pingu->get_y()) - 12,
+ pingu->direction.is_left() ? -400.0f : 400.0f,
+ 0.0f));
+}
- void
- RocketLauncher::update (float delta)
- {
- if (sprite.finished())
- {
- pingu->set_action(Actions::Walker);
- }
+void
+RocketLauncher::update (float delta)
+{
+ if (sprite.finished())
+ {
+ pingu->set_action(Actions::Walker);
+ }
- sprite.update(delta);
- }
+ sprite.update(delta);
+}
- void
- RocketLauncher::draw (GraphicContext& gc)
- {
- if (pingu->direction.is_left())
- sprite.set_direction(Sprite::LEFT);
- else
- sprite.set_direction(Sprite::RIGHT);
+void
+RocketLauncher::draw (GraphicContext& gc)
+{
+ if (pingu->direction.is_left())
+ sprite.set_direction(Sprite::LEFT);
+ else
+ sprite.set_direction(Sprite::RIGHT);
- gc.draw (sprite, pingu->get_pos());
- }
-
+ gc.draw (sprite, pingu->get_pos());
}
+
+} // namespace Actions
/* EOF */
Index: rocket_launcher.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/rocket_launcher.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rocket_launcher.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ rocket_launcher.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,29 +25,29 @@
namespace Actions {
- class RocketLauncher : public PinguAction
- {
- private:
- Sprite sprite;
- bool launched;
- public:
- RocketLauncher () {}
- ~RocketLauncher () {}
+class RocketLauncher : public PinguAction
+{
+private:
+ Sprite sprite;
+ bool launched;
+public:
+ RocketLauncher () {}
+ ~RocketLauncher () {}
- void init ();
+ void init ();
- std::string get_name () const { return "RocketLauncher"; }
- ActionName get_type () const { return Actions::Rocketlauncher; }
+ std::string get_name () const { return "RocketLauncher"; }
+ ActionName get_type () const { return Actions::Rocketlauncher; }
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- private:
- RocketLauncher (const RocketLauncher&);
- RocketLauncher operator= (const RocketLauncher&);
- };
+private:
+ RocketLauncher (const RocketLauncher&);
+ RocketLauncher operator= (const RocketLauncher&);
+};
-}
+} // namespace Actions
#endif
Index: slider.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/slider.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- slider.cxx 4 Sep 2002 20:30:29 -0000 1.7
+++ slider.cxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -24,60 +24,60 @@
namespace Actions {
- Slider::Slider ()
- {
- }
+Slider::Slider ()
+{
+}
- void
- Slider::init (void)
- {
- sprite = Sprite("Pingus/slider" + to_string(pingu->get_owner ()),
- "pingus");
- sprite.set_align_center_bottom();
- speed = 10;
- }
+void
+Slider::init (void)
+{
+ sprite = Sprite("Pingus/slider" + to_string(pingu->get_owner ()),
+ "pingus");
+ sprite.set_align_center_bottom();
+ speed = 10;
+}
- void
- Slider::update (float delta)
- {
- if (pingu->direction.is_left())
- sprite.set_direction(Sprite::LEFT);
- else
- sprite.set_direction(Sprite::RIGHT);
+void
+Slider::update (float delta)
+{
+ if (pingu->direction.is_left())
+ sprite.set_direction(Sprite::LEFT);
+ else
+ sprite.set_direction(Sprite::RIGHT);
- sprite.update (delta);
+ sprite.update (delta);
- for (int i = 0; i < speed; ++i)
- {
- pingu->set_x(pingu->get_x() + pingu->direction);
+ for (int i = 0; i < speed; ++i)
+ {
+ pingu->set_x(pingu->get_x() + pingu->direction);
- if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING)
- {
- speed = (speed > 5) ? 5 : speed;
-
- //FIXME CL_Vector
- CL_Vector temp(pingu->get_velocity());
- if (pingu->direction.is_right()) {
- pingu->set_velocity(temp + CL_Vector(speed, 0.0));
- } else {
- pingu->set_velocity(temp + CL_Vector(-speed, 0.0));
- }
+ if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING)
+ {
+ speed = (speed > 5) ? 5 : speed;
- pingu->set_action(Actions::Walker);
+ //FIXME CL_Vector
+ CL_Vector temp(pingu->get_velocity());
+ if (pingu->direction.is_right()) {
+ pingu->set_velocity(temp + CL_Vector(speed, 0.0));
+ } else {
+ pingu->set_velocity(temp + CL_Vector(-speed, 0.0));
}
- }
- speed -= 7 * delta;
- if (speed < 1)
- pingu->set_action(Actions::Walker);
- }
+ pingu->set_action(Actions::Walker);
+ }
+ }
- void
- Slider::draw (GraphicContext& gc)
- {
- gc.draw (sprite, pingu->get_pos() + CL_Vector(0, -2));
- }
+ speed -= 7 * delta;
+ if (speed < 1)
+ pingu->set_action(Actions::Walker);
+}
+void
+Slider::draw (GraphicContext& gc)
+{
+ gc.draw (sprite, pingu->get_pos() + CL_Vector(0, -2));
}
+
+} // namespace Actions
/* EOF */
Index: slider.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/slider.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- slider.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ slider.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,27 +25,27 @@
namespace Actions {
- class Slider : public PinguAction
- {
- private:
- Sprite sprite;
- float speed;
- public:
- Slider ();
+class Slider : public PinguAction
+{
+private:
+ Sprite sprite;
+ float speed;
+public:
+ Slider ();
- void init(void);
- std::string get_name() const { return "Slider"; }
- ActionName get_type() const { return Actions::Slider; }
+ void init(void);
+ std::string get_name() const { return "Slider"; }
+ ActionName get_type() const { return Actions::Slider; }
- void draw (GraphicContext& gc);
- void update(float delta);
+ void draw (GraphicContext& gc);
+ void update(float delta);
- private:
- Slider (const Slider&);
- Slider operator= (const Slider&);
- };
+private:
+ Slider (const Slider&);
+ Slider operator= (const Slider&);
+};
-}
+} // namespace Actions
#endif
Index: smashed.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/smashed.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- smashed.cxx 4 Sep 2002 20:30:29 -0000 1.5
+++ smashed.cxx 10 Sep 2002 19:24:19 -0000 1.6
@@ -22,25 +22,26 @@
namespace Actions {
- void
- Smashed::init (void)
- {
- sprite = Sprite ("Pingus/bomber0", "pingus");
- sound_played = false;
- }
-
- void
- Smashed::draw (GraphicContext& gc)
- {
- gc.draw (sprite, pingu->get_pos ());
- }
+void
+Smashed::init (void)
+{
+ sprite = Sprite ("Pingus/bomber0", "pingus");
+ sound_played = false;
+}
- void
- Smashed::update(float /*delta*/)
- {
- // pingu->particle->add_pingu_explo(pingu->x_pos, pingu->y_pos - 16);
- pingu->set_status(PS_DEAD);
- }
+void
+Smashed::draw (GraphicContext& gc)
+{
+ gc.draw (sprite, pingu->get_pos ());
+}
+void
+Smashed::update(float /*delta*/)
+{
+ // pingu->particle->add_pingu_explo(pingu->x_pos, pingu->y_pos - 16);
+ pingu->set_status(PS_DEAD);
}
+
+} // namespace Actions
+
/* EOF */
Index: smashed.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/smashed.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- smashed.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ smashed.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,30 +25,30 @@
namespace Actions {
- class Smashed : public PinguAction
- {
- private:
- bool particle_thrown;
- bool sound_played;
- Sprite sprite;
+class Smashed : public PinguAction
+{
+private:
+ bool particle_thrown;
+ bool sound_played;
+ Sprite sprite;
- public:
- Smashed () { }
- void init (void);
- std::string get_name () const { return "Smashed"; }
- ActionName get_type () const { return Actions::Smashed; }
+public:
+ Smashed () { }
+ void init (void);
+ std::string get_name () const { return "Smashed"; }
+ ActionName get_type () const { return Actions::Smashed; }
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- bool catchable () { return false; }
+ bool catchable () { return false; }
- private:
- Smashed (const Smashed&);
- Smashed operator= (const Smashed&);
- };
+private:
+ Smashed (const Smashed&);
+ Smashed operator= (const Smashed&);
+};
-}
+} // namespace Actions
#endif
Index: splashed.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/splashed.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- splashed.cxx 4 Sep 2002 20:30:29 -0000 1.6
+++ splashed.cxx 10 Sep 2002 19:24:19 -0000 1.7
@@ -26,44 +26,44 @@
namespace Actions {
- Splashed::Splashed (void)
- {
- }
+Splashed::Splashed (void)
+{
+}
- void
- Splashed::init (void)
- {
- sprite = Sprite("Pingus/splat0", "pingus", 30.0f,
- Sprite::NONE, Sprite::ONCE);
- sprite.set_align_center_bottom();
+void
+Splashed::init (void)
+{
+ sprite = Sprite("Pingus/splat0", "pingus", 30.0f,
+ Sprite::NONE, Sprite::ONCE);
+ sprite.set_align_center_bottom();
- sound_played = false;
- particle_thrown = false;
- }
+ sound_played = false;
+ particle_thrown = false;
+}
- void
- Splashed::update (float delta)
- {
- sprite.update (delta);
+void
+Splashed::update (float delta)
+{
+ sprite.update (delta);
- if (!particle_thrown)
- {
- particle_thrown = true;
- WorldObj::get_world()->play_wav("sounds/splash.wav", pingu->get_pos());
- }
+ if (!particle_thrown)
+ {
+ particle_thrown = true;
+ WorldObj::get_world()->play_wav("sounds/splash.wav", pingu->get_pos());
+ }
- if (sprite.finished())
+ if (sprite.finished())
{
pingu->set_status(PS_DEAD);
}
- }
-
- void
- Splashed::draw (GraphicContext& gc)
- {
- gc.draw (sprite, pingu->get_pos ());
- }
+}
+void
+Splashed::draw (GraphicContext& gc)
+{
+ gc.draw (sprite, pingu->get_pos ());
}
+
+} // namespace Actions
/* EOF */
Index: splashed.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/splashed.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- splashed.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ splashed.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,30 +25,30 @@
namespace Actions {
- class Splashed : public PinguAction
- {
- private:
- bool particle_thrown;
- bool sound_played;
- Sprite sprite;
- public:
- Splashed();
- void init (void);
+class Splashed : public PinguAction
+{
+private:
+ bool particle_thrown;
+ bool sound_played;
+ Sprite sprite;
+public:
+ Splashed();
+ void init (void);
- std::string get_name () const { return "Splashed"; }
- ActionName get_type () const { return Actions::Splashed; }
+ std::string get_name () const { return "Splashed"; }
+ ActionName get_type () const { return Actions::Splashed; }
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- bool catchable () { return false; }
+ bool catchable () { return false; }
- private:
- Splashed (const Splashed&);
- Splashed operator= (const Splashed&);
- };
+private:
+ Splashed (const Splashed&);
+ Splashed operator= (const Splashed&);
+};
-}
+} // namespace Actions
#endif
Index: superman.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/superman.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- superman.cxx 4 Sep 2002 20:30:29 -0000 1.5
+++ superman.cxx 10 Sep 2002 19:24:19 -0000 1.6
@@ -24,38 +24,38 @@
namespace Actions {
- Superman::Superman ()
- {
- }
-
- void
- Superman::init ()
- {
- x_pos = pingu->get_x();
- counter = 0.0;
- sprite = Sprite (PingusResource::load_surface
- ("Pingus/superman" + to_string(pingu->get_owner ()),
- "pingus"));
- sprite.set_align_center_bottom();
- }
+Superman::Superman ()
+{
+}
- void
- Superman::update (float delta)
- {
- sprite.update(delta);
- counter += delta;
- pingu->set_pos(pingu->get_x() + 40.0f * delta, pingu->get_y() - 200.0f *
delta);
+void
+Superman::init ()
+{
+ x_pos = pingu->get_x();
+ counter = 0.0;
+ sprite = Sprite (PingusResource::load_surface
+ ("Pingus/superman" + to_string(pingu->get_owner ()),
+ "pingus"));
+ sprite.set_align_center_bottom();
+}
- if (pingu->get_y() < -32)
- pingu->set_status(PS_DEAD);
- }
+void
+Superman::update (float delta)
+{
+ sprite.update(delta);
+ counter += delta;
+ pingu->set_pos(pingu->get_x() + 40.0f * delta, pingu->get_y() - 200.0f *
delta);
- void
- Superman::draw (GraphicContext& gc)
- {
- gc.draw(sprite, pingu->get_pos ());
- }
+ if (pingu->get_y() < -32)
+ pingu->set_status(PS_DEAD);
+}
+void
+Superman::draw (GraphicContext& gc)
+{
+ gc.draw(sprite, pingu->get_pos ());
}
+
+} // namespace Actions
/* EOF */
Index: superman.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/superman.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- superman.hxx 4 Sep 2002 20:30:29 -0000 1.8
+++ superman.hxx 10 Sep 2002 19:24:19 -0000 1.9
@@ -25,28 +25,28 @@
namespace Actions {
- class Superman : public PinguAction
- {
- private:
- double counter;
- double x_pos;
- Sprite sprite;
+class Superman : public PinguAction
+{
+private:
+ double counter;
+ double x_pos;
+ Sprite sprite;
- public:
- Superman ();
- void init ();
- std::string get_name () const { return "Superman"; }
- ActionName get_type () const { return Actions::Superman; }
+public:
+ Superman ();
+ void init ();
+ std::string get_name () const { return "Superman"; }
+ ActionName get_type () const { return Actions::Superman; }
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- private:
- Superman (const Superman&);
- Superman operator= (const Superman&);
- };
+private:
+ Superman (const Superman&);
+ Superman operator= (const Superman&);
+};
-}
+} // namespace Actions
#endif
Index: teleported.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/teleported.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- teleported.cxx 4 Sep 2002 20:30:29 -0000 1.6
+++ teleported.cxx 10 Sep 2002 19:24:19 -0000 1.7
@@ -22,32 +22,32 @@
namespace Actions {
- Teleported::Teleported(void) : sound_played(false)
- {
- }
-
- void
- Teleported::init(void)
- {
- sprite = Sprite ("Pingus/bomber0", "pingus");
- }
+Teleported::Teleported(void) : sound_played(false)
+{
+}
+void
+Teleported::init(void)
+{
+ sprite = Sprite ("Pingus/bomber0", "pingus");
+}
- void
- Teleported::draw (GraphicContext& gc)
- {
- gc.draw(sprite, pingu->get_pos ());
- }
+void
+Teleported::draw (GraphicContext& gc)
+{
+ gc.draw(sprite, pingu->get_pos ());
+}
- void
- Teleported::update(float /*delta*/)
- {
- pingu->set_pos (x_target, y_target);
- pingu->set_status(PS_ALIVE);
- pingu->set_action(Actions::Walker);
- }
+void
+Teleported::update(float /*delta*/)
+{
+ pingu->set_pos (x_target, y_target);
+ pingu->set_status(PS_ALIVE);
+ pingu->set_action(Actions::Walker);
}
+
+} // namespace Actions
/* EOF */
Index: teleported.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/teleported.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- teleported.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ teleported.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -23,30 +23,30 @@
namespace Actions {
- class Teleported : public PinguAction
- {
- private:
- //bool particle_thrown;
- bool sound_played;
- Sprite sprite;
- public:
- Teleported();
+class Teleported : public PinguAction
+{
+private:
+ //bool particle_thrown;
+ bool sound_played;
+ Sprite sprite;
+public:
+ Teleported();
- std::string get_name() const { return "Teleported"; }
- ActionName get_type() const { return Actions::Teleported; }
- void init(void);
+ std::string get_name() const { return "Teleported"; }
+ ActionName get_type() const { return Actions::Teleported; }
+ void init(void);
- void draw (GraphicContext& gc);
- void update(float delta);
+ void draw (GraphicContext& gc);
+ void update(float delta);
- bool catchable () { return false; }
+ bool catchable () { return false; }
- int x_target, y_target; // <- FIXME: Ugly!
+ int x_target, y_target; // <- FIXME: Ugly!
- private:
- Teleported (const Teleported&);
- Teleported operator= (const Teleported&);
- };
+private:
+ Teleported (const Teleported&);
+ Teleported operator= (const Teleported&);
+};
}
Index: waiter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/waiter.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- waiter.cxx 4 Sep 2002 20:30:29 -0000 1.6
+++ waiter.cxx 10 Sep 2002 19:24:19 -0000 1.7
@@ -24,35 +24,35 @@
namespace Actions {
- Waiter::Waiter ()
- {
- }
+Waiter::Waiter ()
+{
+}
- void
- Waiter::update (float delta)
- {
- sprite.update(delta);
+void
+Waiter::update (float delta)
+{
+ sprite.update(delta);
- if (countdown < 0)
- pingu->set_action(Actions::Walker);
+ if (countdown < 0)
+ pingu->set_action(Actions::Walker);
- countdown -= delta;
- }
-
- void
- Waiter::init ()
- {
- sprite = PingusResource::load_surface("Pingus/blocker0", "pingus");
- sprite.set_align_center_bottom();
- countdown = 2.0;
- }
+ countdown -= delta;
+}
- void
- Waiter::draw (GraphicContext& gc)
- {
- gc.draw(sprite, pingu->get_pos ());
- }
+void
+Waiter::init ()
+{
+ sprite = PingusResource::load_surface("Pingus/blocker0", "pingus");
+ sprite.set_align_center_bottom();
+ countdown = 2.0;
+}
+void
+Waiter::draw (GraphicContext& gc)
+{
+ gc.draw(sprite, pingu->get_pos ());
}
+
+} // namespace Actions
/* EOF */
Index: waiter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/waiter.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- waiter.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ waiter.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,31 +25,31 @@
namespace Actions {
- /** A Waiting action for the bridger, it gets activated when the
- bridger is out of bridges. It then waits two seconds (meanwhile doing a
- funny animation) and then he changes back to a normal walker. */
- class Waiter : public PinguAction
- {
- private:
- float countdown;
- Sprite sprite;
+/** A Waiting action for the bridger, it gets activated when the
+ bridger is out of bridges. It then waits two seconds (meanwhile doing a
+ funny animation) and then he changes back to a normal walker. */
+class Waiter : public PinguAction
+{
+private:
+ float countdown;
+ Sprite sprite;
- public:
- Waiter();
- void init();
+public:
+ Waiter();
+ void init();
- std::string get_name() const { return "Waiter"; }
- ActionName get_type() const { return Actions::Waiter; }
+ std::string get_name() const { return "Waiter"; }
+ ActionName get_type() const { return Actions::Waiter; }
- void draw (GraphicContext& gc);
- void update(float delta);
+ void draw (GraphicContext& gc);
+ void update(float delta);
- private:
- Waiter (const Waiter&);
- Waiter operator= (const Waiter&);
- };
+private:
+ Waiter (const Waiter&);
+ Waiter operator= (const Waiter&);
+};
-}
+} // namespace Actions
#endif
Index: walker.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/walker.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- walker.cxx 4 Sep 2002 22:10:47 -0000 1.20
+++ walker.cxx 10 Sep 2002 19:24:19 -0000 1.21
@@ -26,186 +26,186 @@
namespace Actions {
- void
- Walker::init (void)
- {
- walker = Sprite("Pingus/walker" + to_string(pingu->get_owner ()),
"pingus");
- walker.set_align_center_bottom();
+void
+Walker::init (void)
+{
+ walker = Sprite("Pingus/walker" + to_string(pingu->get_owner ()), "pingus");
+ walker.set_align_center_bottom();
- // Reset the velocity
- pingu->set_velocity(CL_Vector());
- }
+ // Reset the velocity
+ pingu->set_velocity(CL_Vector());
+}
- void
- Walker::update (float delta)
- {
- // update the sprite
- walker.update(delta);
+void
+Walker::update (float delta)
+{
+ // update the sprite
+ walker.update(delta);
- CL_Vector last_pos = pingu->get_pos();
+ CL_Vector last_pos = pingu->get_pos();
- /* How should this code work?
+ /* How should this code work?
- 1) Check that the Pingu stands still on ground, if not turn it into
- a faller or drown. The reason we do so, is that we catch situations
- where a digger or a similar action removed the ground under the
- walker.
+ 1) Check that the Pingu stands still on ground, if not turn it into
+ a faller or drown. The reason we do so, is that we catch situations
+ where a digger or a similar action removed the ground under the
+ walker.
- 2) If pingu is still on ground, we can preprare the next step
+ 2) If pingu is still on ground, we can preprare the next step
- 3) Check if up-hill or down-hill is required
+ 3) Check if up-hill or down-hill is required
- 4)
+ 4)
- */
+ */
- if (rel_getpixel(0, -1) == GroundpieceData::GP_WATER)
- {
- pingu->set_action(Actions::Drown);
- return;
- }
+ if (rel_getpixel(0, -1) == GroundpieceData::GP_WATER)
+ {
+ pingu->set_action(Actions::Drown);
+ return;
+ }
- // The Pingu stands no longer on ground, the cause for this could be
- // a digger, miner or a bomber
- if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING)
- {
- // We search for the nearest ground below the pingu, if we can't
- // find anything within a few pixels, we will turn into a faller
- bool found_ground = false;
- int i;
- for (i = -2; i > -5; --i)
- {
- if (!(rel_getpixel(0, i) == GroundpieceData::GP_NOTHING))
- {
- found_ground = true;
- break;
- }
- }
+ // The Pingu stands no longer on ground, the cause for this could be
+ // a digger, miner or a bomber
+ if (rel_getpixel(0, -1) == GroundpieceData::GP_NOTHING)
+ {
+ // We search for the nearest ground below the pingu, if we can't
+ // find anything within a few pixels, we will turn into a faller
+ bool found_ground = false;
+ int i;
+ for (i = -2; i > -5; --i)
+ {
+ if (!(rel_getpixel(0, i) == GroundpieceData::GP_NOTHING))
+ {
+ found_ground = true;
+ break;
+ }
+ }
- if (found_ground)
- {
- pingu->set_y(pingu->get_y() - i);
- }
- else
- {
- pingu->set_action(Actions::Faller);
- return;
- }
- }
+ if (found_ground)
+ {
+ pingu->set_y(pingu->get_y() - i);
+ }
+ else
+ {
+ pingu->set_action(Actions::Faller);
+ return;
+ }
+ }
- // FIXME: here we could/should scan more pixels
- if (rel_getpixel(1, 0) == GroundpieceData::GP_BRIDGE
- && !head_collision_on_walk(1, 1)) // bridge
- {
- // simple, stupid, but working bridge code
- // FIXME: We don't check if we 'drift' into a solid ground block
- pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() - 1);
// pingus 'float' through bridges
- }
- else
- {
- // Non of the trivial moves worked, so we do up-hill or down-hill
walking
- // FIXME: currently the pingu takes multiple steps at once when
- // FIXME: working uphill, this looks kind of ugly
+ // FIXME: here we could/should scan more pixels
+ if (rel_getpixel(1, 0) == GroundpieceData::GP_BRIDGE
+ && !head_collision_on_walk(1, 1)) // bridge
+ {
+ // simple, stupid, but working bridge code
+ // FIXME: We don't check if we 'drift' into a solid ground block
+ pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() - 1);
// pingus 'float' through bridges
+ }
+ else
+ {
+ // Non of the trivial moves worked, so we do up-hill or down-hill walking
+ // FIXME: currently the pingu takes multiple steps at once when
+ // FIXME: working uphill, this looks kind of ugly
- // FIXME: rel_getpixel works on the current pos, so modifing pos
- // FIXME: is evil, a backup copy might help
+ // FIXME: rel_getpixel works on the current pos, so modifing pos
+ // FIXME: is evil, a backup copy might help
- // if infront is a pixel
- // Pingu is walking up the mountain
- // we can continue walking up. search for the correct y_pos
- int y_inc = 0;
- int possible_y_step = 0;
- bool found_next_step = false;
- for (y_inc = -max_steps; y_inc <= max_steps; ++y_inc)
- {// up/down-hill scan
- if (( rel_getpixel(1, y_inc) == GroundpieceData::GP_NOTHING
- || rel_getpixel(1, y_inc) == GroundpieceData::GP_BRIDGE)
// FIXME: This causes a rather huge step
- && rel_getpixel(1, y_inc - 1) != GroundpieceData::GP_NOTHING)
- { // FIXME:
- found_next_step = true;
- possible_y_step = y_inc;
- // No break here, since we always want to use the highest
possible position
- //break;
- }
- }
+ // if infront is a pixel
+ // Pingu is walking up the mountain
+ // we can continue walking up. search for the correct y_pos
+ int y_inc = 0;
+ int possible_y_step = 0;
+ bool found_next_step = false;
+ for (y_inc = -max_steps; y_inc <= max_steps; ++y_inc)
+ {// up/down-hill scan
+ if (( rel_getpixel(1, y_inc) == GroundpieceData::GP_NOTHING
+ || rel_getpixel(1, y_inc) == GroundpieceData::GP_BRIDGE)
// FIXME: This causes a rather huge step
+ && rel_getpixel(1, y_inc - 1) != GroundpieceData::GP_NOTHING)
+ { // FIXME:
+ found_next_step = true;
+ possible_y_step = y_inc;
+ // No break here, since we always want to use the highest
possible position
+ //break;
+ }
+ }
- if (found_next_step)
- {
- // pos.y has a reversed co-system to rel_getpixel()?
- pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() -
possible_y_step);
- }
- else
- {
- if (rel_getpixel(1, 0) != GroundpieceData::GP_NOTHING)
- {
- // We reached a wall
- if (pingu->request_wall_action())
- {
- pout(PINGUS_DEBUG_ACTIONS)
- << "Pingu: We are in front of a wall, setting persistant
action" << std::endl;
- return;
- }
+ if (found_next_step)
+ {
+ // pos.y has a reversed co-system to rel_getpixel()?
+ pingu->set_pos(pingu->get_x() + pingu->direction, pingu->get_y() -
possible_y_step);
+ }
+ else
+ {
+ if (rel_getpixel(1, 0) != GroundpieceData::GP_NOTHING)
+ {
+ // We reached a wall
+ if (pingu->request_wall_action())
+ {
+ pout(PINGUS_DEBUG_ACTIONS)
+ << "Pingu: We are in front of a wall, setting persistant
action" << std::endl;
+ return;
+ }
- // No persitent action found, so change the direction
- pingu->direction.change();
- }
- else
- {
- // We take the step, so that we are in the air
- pingu->set_x(pingu->get_x() + pingu->direction);
- // We reached a cliff
- pingu->set_action(Actions::Faller);
- return;
- }
- }
- }
+ // No persitent action found, so change the direction
+ pingu->direction.change();
+ }
+ else
+ {
+ // We take the step, so that we are in the air
+ pingu->set_x(pingu->get_x() + pingu->direction);
+ // We reached a cliff
+ pingu->set_action(Actions::Faller);
+ return;
+ }
+ }
+ }
- // This is moved here to fix the bug where pingu stuck turning both
- // sides indefinetely when a head collision occured. the fix needs the
- // above downhill walk being done before head collision check.
- if (head_collision_on_walk(0, 0))
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Pingu: Head collision" << std::endl;
+ // This is moved here to fix the bug where pingu stuck turning both
+ // sides indefinetely when a head collision occured. the fix needs the
+ // above downhill walk being done before head collision check.
+ if (head_collision_on_walk(0, 0))
+ {
+ pout(PINGUS_DEBUG_ACTIONS) << "Pingu: Head collision" << std::endl;
- //if the new position causes a head collision, we are already
- //stuck in a wall, so lets go back to the old position
- pingu->direction.change();
- pingu->set_pos(last_pos);
- return;
- }
-
- /*
- for(int y_inc=1; y_inc <= max_steps; ++y_inc)
- {
- if (rel_getpixel(1, -y_inc) == ColMap::WATER)
- {
- pingu->set_paction ("drown");
+ //if the new position causes a head collision, we are already
+ //stuck in a wall, so lets go back to the old position
+ pingu->direction.change();
+ pingu->set_pos(last_pos);
return;
- }
- else if(rel_getpixel(1, -y_inc) != ColMap::NOTHING)
- { // there is land
- pingu->pos.y += y_inc - 1;
- break;
- }
- }
- */
- }
-
- void
- Walker::draw (GraphicContext& gc)
- {
- if (pingu->direction.is_left())
- walker.set_direction(Sprite::LEFT);
- else
- walker.set_direction(Sprite::RIGHT);
+ }
+
+ /*
+ for(int y_inc=1; y_inc <= max_steps; ++y_inc)
+ {
+ if (rel_getpixel(1, -y_inc) == ColMap::WATER)
+ {
+ pingu->set_paction ("drown");
+ return;
+ }
+ else if(rel_getpixel(1, -y_inc) != ColMap::NOTHING)
+ { // there is land
+ pingu->pos.y += y_inc - 1;
+ break;
+ }
+ }
+ */
+}
- gc.draw (walker, pingu->get_pos() + CL_Vector (0, +2));
- }
+void
+Walker::draw (GraphicContext& gc)
+{
+ if (pingu->direction.is_left())
+ walker.set_direction(Sprite::LEFT);
+ else
+ walker.set_direction(Sprite::RIGHT);
+ gc.draw (walker, pingu->get_pos() + CL_Vector (0, +2));
}
+
+} // namespace Actions
/* EOF */
Index: walker.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/walker.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- walker.hxx 4 Sep 2002 20:30:29 -0000 1.7
+++ walker.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -25,29 +25,29 @@
namespace Actions {
- class Walker : public PinguAction
- {
- private:
- Sprite walker;
+class Walker : public PinguAction
+{
+private:
+ Sprite walker;
- enum { max_steps = 5 }; // max nr. of pixels that pingu can walk up/down
+ enum { max_steps = 5 }; // max nr. of pixels that pingu can walk up/down
- public:
- Walker () { }
- void init (void);
+public:
+ Walker () { }
+ void init (void);
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- std::string get_name () const { return "Walker"; }
- ActionName get_type () const { return Actions::Walker; }
+ std::string get_name () const { return "Walker"; }
+ ActionName get_type () const { return Actions::Walker; }
- private:
- Walker (const Walker&);
- Walker operator= (const Walker&);
- };
+private:
+ Walker (const Walker&);
+ Walker operator= (const Walker&);
+};
-}
+} // namespace Actions
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.9,1.10 angel.hxx,1.9,1.10 basher.cxx,1.13,1.14 basher.hxx,1.9,1.10 blocker.cxx,1.7,1.8 blocker.hxx,1.8,1.9 boarder.cxx,1.7,1.8 boarder.hxx,1.8,1.9 bomber.cxx,1.11,1.12 bomber.hxx,1.10,1.11 bridger.cxx,1.13,1.14 bridger.hxx,1.10,1.11 climber.cxx,1.9,1.10 climber.hxx,1.7,1.8 digger.cxx,1.11,1.12 digger.hxx,1.7,1.8 drown.cxx,1.6,1.7 drown.hxx,1.7,1.8 exiter.cxx,1.6,1.7 exiter.hxx,1.7,1.8 faller.cxx,1.20,1.21 faller.hxx,1.12,1.13 floater.cxx,1.13,1.14 floater.hxx,1.9,1.10 jumper.cxx,1.9,1.10 jumper.hxx,1.7,1.8 laser_kill.cxx,1.4,1.5 laser_kill.hxx,1.7,1.8 miner.cxx,1.9,1.10 miner.hxx,1.7,1.8 rocket_launcher.cxx,1.7,1.8 rocket_launcher.hxx,1.7,1.8 slider.cxx,1.7,1.8 slider.hxx,1.7,1.8 smashed.cxx,1.5,1.6 smashed.hxx,1.7,1.8 splashed.cxx,1.6,1.7 splashed.hxx,1.7,1.8 superman.cxx,1.5,1.6 superman.hxx,1.8,1.9 teleported.cxx,1.6,1.7 teleported.hxx,1.7,1.8 waiter.cxx,1.6,1.7 waiter.hxx,1.7,1.8 walker.cxx,1.20,1.21 walker.hxx,1.7,1.8,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.2,1.3 conveyor_belt.cxx,1.9,1.10 conveyor_belt.hxx,1.7,1.8 fake_exit.hxx,1.2,1.3 guillotine.cxx,1.2,1.3 guillotine.hxx,1.2,1.3 hammer.cxx,1.2,1.3 info_box.cxx,1.9,1.10 info_box.hxx,1.8,1.9 laser_exit.cxx,1.2,1.3 laser_exit.hxx,1.2,1.3 smasher.cxx,1.2,1.3 smasher.hxx,1.2,1.3 spike.cxx,1.2,1.3 spike.hxx,1.2,1.3 switch_door.cxx,1.10,1.11 switch_door.hxx,1.8,1.9 teleporter.cxx,1.8,1.9 teleporter.hxx,1.11,1.12
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/backgrounds solidcolor_background.cxx,1.4,1.5 starfield_background.cxx,1.8,1.9 surface_background_data.cxx,1.4,1.5 thunderstorm_background_data.cxx,1.5,1.6
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.2,1.3 conveyor_belt.cxx,1.9,1.10 conveyor_belt.hxx,1.7,1.8 fake_exit.hxx,1.2,1.3 guillotine.cxx,1.2,1.3 guillotine.hxx,1.2,1.3 hammer.cxx,1.2,1.3 info_box.cxx,1.9,1.10 info_box.hxx,1.8,1.9 laser_exit.cxx,1.2,1.3 laser_exit.hxx,1.2,1.3 smasher.cxx,1.2,1.3 smasher.hxx,1.2,1.3 spike.cxx,1.2,1.3 spike.hxx,1.2,1.3 switch_door.cxx,1.10,1.11 switch_door.hxx,1.8,1.9 teleporter.cxx,1.8,1.9 teleporter.hxx,1.11,1.12
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/backgrounds solidcolor_background.cxx,1.4,1.5 starfield_background.cxx,1.8,1.9 surface_background_data.cxx,1.4,1.5 thunderstorm_background_data.cxx,1.5,1.6
- Index(es):