pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,NONE,1.1 angel.hxx,


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,NONE,1.1 angel.hxx,NONE,1.1 basher.cxx,NONE,1.1 basher.hxx,NONE,1.1 blocker.cxx,NONE,1.1 blocker.hxx,NONE,1.1 boarder.cxx,NONE,1.1 boarder.hxx,NONE,1.1 bomber.cxx,NONE,1.1 bomber.hxx,NONE,1.1 bridger.cxx,NONE,1.1 bridger.hxx,NONE,1.1 climber.cxx,NONE,1.1 climber.hxx,NONE,1.1 digger.cxx,NONE,1.1 digger.hxx,NONE,1.1 drown.cxx,NONE,1.1 drown.hxx,NONE,1.1 exiter.cxx,NONE,1.1 exiter.hxx,NONE,1.1 faller.cxx,NONE,1.1 faller.hxx,NONE,1.1 floater.cxx,NONE,1.1 floater.hxx,NONE,1.1 jumper.cxx,NONE,1.1 jumper.hxx,NONE,1.1 laser_kill.cxx,NONE,1.1 laser_kill.hxx,NONE,1.1 miner.cxx,NONE,1.1 miner.hxx,NONE,1.1 rocket_launcher.cxx,NONE,1.1 rocket_launcher.hxx,NONE,1.1 slider.cxx,NONE,1.1 slider.hxx,NONE,1.1 smashed.cxx,NONE,1.1 smashed.hxx,NONE,1.1 splashed.cxx,NONE,1.1 splashed.hxx,NONE,1.1 superman.cxx,NONE,1.1 superman.hxx,NONE,1.1 teleported.cxx,NONE,1.1 teleported.hxx,NONE,1.1 waiter.cxx,NONE,1.1 waiter.hxx,NONE,1.1 walker.cxx,NONE,1.1 walker.hxx,NONE,1.1 Makefile.am,1.10,1.11 Angel.cc,1.6,NONE Angel.hh,1.4,NONE Boarder.cc,1.6,NONE Boarder.hh,1.5,NONE Drown.cc,1.14,NONE Drown.hh,1.11,NONE Faller.cc,1.15,NONE Faller.hh,1.6,NONE Jumper.cc,1.19,NONE Jumper.hh,1.13,NONE LaserKill.cc,1.14,NONE LaserKill.hh,1.13,NONE RocketLauncher.cc,1.7,NONE RocketLauncher.hh,1.4,NONE Slider.cc,1.4,NONE Slider.hh,1.1,NONE Splashed.cc,1.23,NONE Splashed.hh,1.13,NONE Superman.cc,1.7,NONE Superman.hh,1.5,NONE Waiter.cc,1.17,NONE Waiter.hh,1.10,NONE Walker.cc,1.16,NONE Walker.hh,1.6,NONE basher.cc,1.30,NONE basher.hh,1.18,NONE blocker.cc,1.21,NONE blocker.hh,1.13,NONE bomber.cc,1.31,NONE bomber.hh,1.19,NONE bridger.cc,1.52,NONE bridger.hh,1.18,NONE climber.cc,1.20,NONE climber.hh,1.14,NONE digger.cc,1.36,NONE digger.hh,1.15,NONE exiter.cc,1.23,NONE exiter.hh,1.12,NONE floater.cc,1.16,NONE floater.hh,1.11,NONE miner.cc,1.31,NONE miner.hh,1.14,NONE smashed.cc,1.14,NONE smashed.hh,1.10,NONE teleported.cc,1.14,NONE teleported.hh,1.9,NONE
Date: 12 Jun 2002 19:01:45 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/actions
In directory dark:/tmp/cvs-serv12581

Modified Files:
        Makefile.am 
Added 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 
Removed Files:
        Angel.cc Angel.hh Boarder.cc Boarder.hh Drown.cc Drown.hh 
        Faller.cc Faller.hh Jumper.cc Jumper.hh LaserKill.cc 
        LaserKill.hh RocketLauncher.cc RocketLauncher.hh Slider.cc 
        Slider.hh Splashed.cc Splashed.hh Superman.cc Superman.hh 
        Waiter.cc Waiter.hh Walker.cc Walker.hh basher.cc basher.hh 
        blocker.cc blocker.hh bomber.cc bomber.hh bridger.cc 
        bridger.hh climber.cc climber.hh digger.cc digger.hh exiter.cc 
        exiter.hh floater.cc floater.hh miner.cc miner.hh smashed.cc 
        smashed.hh teleported.cc teleported.hh 
Log Message:
The big rename...

--- NEW FILE: angel.cxx ---
//  $Id: angel.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "../string_converter.hxx"
#include "angel.hxx"

Angel::Angel ()
{
}

void
Angel::init()
{
  x_pos = pingu->pos.x;
  counter = 0.0;
  sprite = Sprite (PingusResource::load_surface 
                   ("Pingus/angel" + to_string(pingu->get_owner ()),
                    "pingus"));
  sprite.set_align_center_bottom (); 
}

void  
Angel::update(float delta)
{
  sprite.update (delta);
  counter += delta;
  pingu->pos.x = x_pos + 20 * sin (counter * 3.0);
  pingu->pos.y -= 50.0f * delta;

  // Out of screen, let the pingu die
  if (pingu->pos.y < -32)
    pingu->set_status (PS_DEAD);
}

void   
Angel::draw_offset(int x_of, int y_of, float /*s*/)
{
  sprite.put_screen (pingu->get_x () + x_of,
                     pingu->get_y () + y_of);
}

/* EOF */

--- NEW FILE: angel.hxx ---
//  $Id: angel.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef ANGEL_HH
#define ANGEL_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

class Angel : public PinguAction
{
private:
  double counter;
  double x_pos;
  Sprite sprite;
public:
  Angel ();
  void  init();
  std::string get_name() const { return "Angel"; }
  PinguEnvironment get_environment() const { return ENV_ALWAYS; }
  void  update(float delta);
  void  draw_offset(int, int, float s);

};

#endif

/* EOF */

--- NEW FILE: basher.cxx ---
//  $Id: basher.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../col_map.hxx"
#include "../pingu_map.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../particles/ground_particle.hxx"
#include "../globals.hxx"
#include "../pingu.hxx"
#include "basher.hxx"

using namespace std;

// Initialise class static.
const int Basher::bash_height = 4;

Basher::Basher()
{
}

void
Basher::init(void)
{
  bash_radius = PingusResource::load_surface ("Other/bash_radius", "pingus");
  sprite = Sprite (PingusResource::load_surface ("Pingus/basher0", "pingus"));
  sprite.set_align_center_bottom ();
  first_bash = true;
}

void
Basher::draw_offset(int x, int y, float /*s*/)
{
  if (pingu->direction.is_left ())
    sprite.set_direction (Sprite::LEFT);
  else
    sprite.set_direction (Sprite::RIGHT);

  sprite.put_screen (pingu->get_pos () + CL_Vector(x, y));
}

void
Basher::update(float delta)
{
  sprite.update (delta);

  ++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)
        {
          is_finished = true;
        }
    }
}

void
Basher::bash()
{
  pingu->get_world()->get_colmap()->remove(bash_radius,
                                           pingu->get_x () - 
(bash_radius.get_width()/2), pingu->get_y () - 31);
  pingu->get_world()->get_gfx_map()->remove(bash_radius,
                                            pingu->get_x () - 
(bash_radius.get_width()/2), pingu->get_y () - 31);
}

void
Basher::walk_forward()
{
  if (rel_getpixel(0, -1) == ColMap::NOTHING) {
    // We ar e in the air... lets fall...
    is_finished = true;
  } else {
    // On ground, walk forward...
    pingu->pos.x += pingu->direction;
  }
}

bool
Basher::have_something_to_dig()
{
  if (first_bash)
    {
      first_bash = false;
      return true;
    }

  for(int i = 0; is_finished == false && 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) & ColMap::WALL)
            {
              if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
                std::cout << "Basher: Found something to dig..." << std::endl;
              return true;
            }
        }
    }

  cout << "nothing to dig found" << endl;
  return false;
}

/* EOF */

--- NEW FILE: basher.hxx ---
//  $Id: basher.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef BASHER_HH
#define BASHER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
class Basher : public PinguAction
{
private:
  Sprite sprite;
  CL_Surface bash_radius;
  int basher_c;
  bool first_bash;
public:
  Basher();
  virtual ~Basher() {}
  
  void   init(void);
  std::string get_name () const { return "Basher"; }
  PinguEnvironment get_environment() const { return PinguEnvironment(ENV_LAND); 
}
  void draw_offset(int x, int y, float s);
  void update(float delta);
  bool have_something_to_dig();
  void walk_forward();
  void bash();
  
  /// Defines "wall" height needed so as to determine whether it should be 
bashed.
  static const int bash_height;
};

#endif

/* EOF */

--- NEW FILE: blocker.cxx ---
//  $Id: blocker.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include <iostream>

#include "../col_map.hxx"
#include "../sprite.hxx"
#include "../pingus_resource.hxx"
#include "../pingu.hxx"
#include "../string_converter.hxx"
#include "blocker.hxx"

Blocker::Blocker()
{
}

void
Blocker::init(void)
{
  sprite = Sprite(PingusResource::load_surface ("Pingus/blocker" 
                                                + to_string (pingu->get_owner 
()),
                                                "pingus"));
  sprite.set_align_center_bottom ();

  is_finished = false;

  if (rel_getpixel(0,-1) == ColMap::NOTHING && rel_getpixel(0, -2) == 
ColMap::WALL) 
    {
      ++pingu->pos.x;
    } 
  else if (rel_getpixel(0,-1) == ColMap::NOTHING && rel_getpixel(0, -2) == 
ColMap::NOTHING
           && rel_getpixel(0,-3) == ColMap::WALL) 
    {
      ++pingu->pos.y;
      ++pingu->pos.y;
    }
}

void
Blocker::update(float /*delta*/)
{
  if (!standing_on_ground())
    {
      is_finished = true;
    }
}

void
Blocker::draw_offset(int x, int y, float /*s*/)
{
  sprite.put_screen (pingu->pos + CL_Vector(x, y));
}

bool
Blocker::standing_on_ground()
{
  return (rel_getpixel(0,-1) != ColMap::NOTHING);
}

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();
      }
    }
}

int
Blocker::y_offset(void)
{
  return -33;
}

/* EOF */

--- NEW FILE: blocker.hxx ---
//  $Id: blocker.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef BLOCKER_HH
#define BLOCKER_HH

#include "../pingu_action.hxx"

class Sprite;

///
class Blocker : public PinguAction
{
private:
  Sprite sprite;
public:
  ///
  Blocker();
  ///
  int   y_offset();
  ///
  void  init();
  std::string get_name () const { return "Blocker"; }
  PinguEnvironment get_environment() const { return PinguEnvironment(ENV_LAND); 
}
 
  void  update(float delta);
  void   draw_offset(int, int, float s);
  bool  standing_on_ground();
  ///
  bool  need_catch();
  ///
  void  catch_pingu(Pingu* pingu);
};

#endif

/* EOF */

--- NEW FILE: boarder.cxx ---
//  $Id: boarder.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "../string_converter.hxx"
#include "boarder.hxx"

Boarder::Boarder ()
{
}

void
Boarder::init()
{
  x_pos = pingu->pos.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);

  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->pos.x + pingu->direction * speed;
      while (int(new_x_pos) != int(pingu->pos.x) && !is_finished)
        {
          double old_pos = pingu->pos.x;
          pingu->pos.x += (int(pingu->pos.x) < int(new_x_pos)) ? 1 : -1;
          
          if (pingu->rel_getpixel (1, 0))
            {
              // Hit a wall
              pingu->pos.x = old_pos;// + (pingu->direction * 10);
              ////pingu->pos.y = 10;

              pingu->direction.change ();
              is_finished = true;
              pingu->apply_force (CL_Vector(speed * pingu->direction * 0.5,
                                            -speed * abs(pingu->direction) * 
0.5));
            }
        }
    }
  else
    {
      is_finished = true;
      pingu->apply_force (CL_Vector(speed * pingu->direction, 0));
    }
}

void   
Boarder::draw_offset(int x_of, int y_of, float /*s*/)
{
  sprite.put_screen (pingu->get_x () + x_of,
                     pingu->get_y () + y_of);
}

bool
Boarder::on_ground ()
{
  return pingu->rel_getpixel (0, -1) || pingu->rel_getpixel (0, -2);
}

/* EOF */

--- NEW FILE: boarder.hxx ---
//  $Id: boarder.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef BOARDER_HH
#define BOARDER_HH

#include "../pingu_action.hxx"
#include "../sprite.hxx"

/** 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"; }
  PinguEnvironment get_environment() const { return ENV_LAND; }
  void  update(float delta);
  void  draw_offset(int, int, float s);
private:
  bool on_ground ();
};

#endif

/* EOF */

--- NEW FILE: bomber.cxx ---
//  $Id: bomber.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu_map.hxx"
#include "../col_map.hxx"
#include "../world.hxx"
#include "../globals.hxx"
#include "../algo.hxx"
#include "../pingus_resource.hxx"
#include "../force_vector.hxx"
#include "../string_converter.hxx"
#include "../pingu.hxx"
#include "bomber.hxx"
#include "../particles/particle_holder.hxx"

bool Bomber::static_surface_loaded = false;
CL_Surface Bomber::bomber_radius;
CL_Surface Bomber::bomber_radius_gfx;

Bomber::Bomber()
{
}

void
Bomber::init()
{
  particle_thrown = false;
  exploded = false;
  
  // 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 ();

  sound_played = false;
}

void
Bomber::draw_offset(int x, int y, float /*s*/)
{
  if (sprite.get_frame () >= 13 && !exploded) 
    {
      explo_surf.put_screen(pingu->get_x () - 32 + x, pingu->get_y () - 48 + y);
      exploded = true;
    }

  sprite.put_screen(pingu->get_x () + x, pingu->get_y () + y);
}

void
Bomber::update(float delta)
{
  sprite.update (delta);

  if (sprite.get_frame () > 9 && !sound_played) {
    pingu->get_world ()->play_wav("sounds/explode.wav", pingu->get_pos ());
    sound_played = true;
  }

  // Throwing particles
  if (sprite.get_frame () > 12 && !particle_thrown) 
    {
      particle_thrown = true;
      pingu->get_world()->get_particle_holder()->add_pingu_explo(pingu->get_x 
(), pingu->get_y () - 5);
    }

  // The pingu explode
  if (sprite.finished ())
    {
      pingu->set_status(PS_DEAD);
      pingu->get_world()->get_colmap()->remove(bomber_radius,
                                               pingu->get_x () - 
(bomber_radius.get_width()/2),
                                               pingu->get_y () - 16 - 
(bomber_radius.get_width()/2));
      pingu->get_world()->get_gfx_map()->remove(bomber_radius_gfx, 
                                                pingu->get_x () - 
(bomber_radius.get_width()/2),
                                                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)));
    }
}

/* EOF */

--- NEW FILE: bomber.hxx ---
//  $Id: bomber.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef BOMBER_HH
#define BOMBER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

/** 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 exploded; 
  ///
  static bool static_surface_loaded;
  Sprite sprite;
  static CL_Surface bomber_radius;
  static CL_Surface bomber_radius_gfx;
  ///
  CL_Surface explo_surf;

public:
  Bomber();
  
  void   init(void);
  std::string get_name () const { return "Bomber"; }
  PinguEnvironment get_environment() const { return 
PinguEnvironment(ENV_LAND|ENV_AIR); }
  void   draw_offset(int x, int y, float s);
  void   update(float delta);
  int    activation_time() { return 50; }
};

#endif

/* EOF */

--- NEW FILE: bridger.cxx ---
//  $Id: bridger.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include <cassert>
#include "../pingu_map.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../sound.hxx"
#include "../algo.hxx"
#include "../action_holder.hxx"
#include "../col_map.hxx"
#include "../string_converter.hxx"
#include "../pingu.hxx"
#include "bridger.hxx"

using namespace std;

bool Bridger::static_surfaces_loaded = false;
CL_Surface Bridger::brick_l;
CL_Surface Bridger::brick_r;
CL_Surface Bridger::static_surface;

Bridger::Bridger()
{
}

void
Bridger::init(void)
{
  bricks = 15;
  mode = B_BUILDING;
  block_build = false;

  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::draw_offset(int x, int y, float /*s*/)
{
  switch (mode)
    {
    case B_BUILDING:
      if (pingu->direction.is_left ())
        build_sprite.set_direction (Sprite::LEFT);
      else
        build_sprite.set_direction (Sprite::RIGHT);
      
      build_sprite.put_screen(pingu->get_x () + x - (6*pingu->direction),
                              pingu->get_y () + y + 4);
      break;
      
    case B_WALKING:
      if (pingu->direction.is_left ())
        walk_sprite.set_direction (Sprite::LEFT);
      else
        walk_sprite.set_direction (Sprite::RIGHT);
      
      walk_sprite.put_screen(pingu->get_x () + x - (6*pingu->direction),
                              pingu->get_y () + y + 5);
      break;
    }
}

void
Bridger::update(float delta)
{
  switch (mode)
    {
    case B_BUILDING:
      update_build (delta);
      break;

    case B_WALKING:
      update_walk (delta);
      break;
    }
}

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...
         {
           // Let Walker sort out change of direction
           is_finished = true;
         }
    }
  else
    {
      walk_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 (bricks > 0)
        {
          place_a_brick();
        }
      else // Out of bricks
        {
          pingu->set_action("waiter");
        }     
    }

  if (build_sprite.finished ())
    {
      mode = B_WALKING;
      build_sprite.reset ();
    }
}

bool
Bridger::way_is_free()
{
  bool ret_val;
  
  if (rel_getpixel(4,2) == ColMap::NOTHING)
    {
      ret_val = true;
    }
  else
    {
      //cout << "Touched a wall" << endl;
      return false;
    }

  if (!head_collision_on_walk(4, 2))
    {
      ret_val = true;
    }
  else
    {
      //cout << "Ouch, my head" << endl;
      return false;
    }

  return ret_val;
}

void
Bridger::place_a_brick()
{
  bricks--; 

  if (bricks < 4)
    PingusSound::play_sound("sounds/ting.wav");
 
  if (pingu->direction.is_right())
    {
      pingu->get_world()->get_colmap()->put(brick_r, 
                                            pingu->get_x () + 10 - 
brick_r.get_width(),
                                            pingu->get_y (),
                                            GroundpieceData::GP_BRIDGE);
      pingu->get_world()->get_gfx_map()->put(brick_r,
                                             (int) pingu->get_x () + 10 - 
brick_r.get_width(),
                                             pingu->get_y ());
    }
  else
    {
      pingu->get_world()->get_colmap()->put(brick_r, pingu->get_x () - 10,
                                            pingu->get_y (),
                                            GroundpieceData::GP_BRIDGE);
      pingu->get_world()->get_gfx_map()->put(brick_l,
                                             pingu->get_x () - 10,
                                             pingu->get_y ());
    }
}

void
Bridger::walk_one_step_up()
{
  pingu->pos.x += 4.0 * pingu->direction;
  pingu->pos.y -= 2.0;
  counter = 0;
}

std::string
Bridger::get_name () const
{ 
  // FIXME: Could need caching
  return "Bridger (" + to_string(bricks) + ")";
}

/* EOF */

--- NEW FILE: bridger.hxx ---
//  $Id: bridger.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef BRIDGER_HH
#define BRIDGER_HH

#include "../game_counter.hxx"
#include "../pingu_action.hxx"
#include "../sprite.hxx"

/** 
 */
class Bridger : public PinguAction
{
private:
  Sprite walk_sprite;
  Sprite build_sprite;

  GameCounter counter;

  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;

  enum Mode { B_WALKING, B_BUILDING } mode;
public:
  Bridger();

  void   init();
  std::string get_name () const;
  PinguEnvironment get_environment() const { return ENV_LAND; }
  void   update(float delta);
  void   update_build (float delta);
  void   update_walk (float delta);
  void   draw_offset(int, int, float s);
  bool   way_is_free();
  void   place_a_brick();
  void   walk_one_step_up();
};

#endif

/* EOF */

--- NEW FILE: climber.cxx ---
//  $Id: climber.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../col_map.hxx"
#include "../pingus_resource.hxx"
#include "climber.hxx"

Climber::Climber()
{
}

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);
  }
}

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);

  // If above is free
  if (rel_getpixel(0, 1) == ColMap::NOTHING
      || rel_getpixel (0, 1) & ColMap::BRIDGE)
    {
      // and there is still ground to walk on
      if (rel_getpixel(1, 1) & ColMap::WALL) 
        {
          --pingu->pos.y;
          return;
        }
      else if (rel_getpixel(1, 1) == ColMap::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))
            {
            // Get ready to walk
          --pingu->pos.y;
            pingu->pos.x += pingu->direction;
            }
          else
            {
            // Get ready to fall
            pingu->direction.change();
            }

          // Finish climbing.
          is_finished = true;
        }
    }
  else 
    {
      //    std::cout << "Climber failed, falling down" << std::endl;
      pingu->direction.change();
      is_finished = true;
    }
}

void
Climber::draw_offset(int x, int y, float /*s*/)
{
  sprite.put_screen (pingu->get_pos () + CL_Vector (x, y));
}

/* EOF */

--- NEW FILE: climber.hxx ---
//  $Id: climber.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef CLIMBER_HH
#define CLIMBER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
class Climber : public PinguAction
{
private:
  Sprite sprite;
  int sprite_width, sprite_height;
public:
  Climber();
  void   init();
  std::string get_name () const { return "Climber"; }
  PinguEnvironment get_environment() const { return 
PinguEnvironment(ENV_LAND|ENV_AIR); }
  void draw_offset(int x, int y, float s=1.0);
  void update(float delta);
  ActionType get_type(void) { return (ActionType)WALL; }
  char get_persistent_char () { return 'c'; }
};

#endif

/* EOF */

--- NEW FILE: digger.cxx ---
//  $Id: digger.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include <cstdio>

#include "../col_map.hxx"
#include "../pingu_map.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../sound.hxx"
#include "../particles/ground_particle.hxx"
#include "../algo.hxx"
#include "../string_converter.hxx"
#include "../pingu.hxx"
#include "digger.hxx"

Digger::Digger()
{
}

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");
  sprite.set_align_center_bottom ();
}

void
Digger::update(float delta)
{
  sprite.update (delta);
  
  if (++digger_c >= 3)
    {
      digger_c = 0;
      dig();
    }

  if (!have_something_to_dig())
    { 
      dig ();
      is_finished = true;
    }
}

bool   
Digger::have_something_to_dig()
{
  if (rel_getpixel(0, -1) != ColMap::NOTHING)
    {
      if (rel_getpixel(0, -1) & ColMap::SOLID)
        {
          PingusSound::play_sound("sounds/chink.wav");
          return false;  
        }
      else
        return true;
    }
  else
    {
      return false;
    }
}

void
Digger::dig()
{
  pingu->get_world()->get_colmap()->remove(digger_radius, pingu->get_x () - 16, 
pingu->get_y() - 14);
  pingu->get_world()->get_gfx_map()->remove(digger_radius_gfx, pingu->get_x () 
- 16, pingu->get_y() - 14);
      
  ++pingu->pos.y;
}

void  
Digger::draw_offset(int x, int y, float /*s*/)
{
  //std::cout << "DRawing digger" << std::endl;
  sprite.put_screen (int(pingu->pos.x + x), int(pingu->pos.y + y));
}

/* EOF */

--- NEW FILE: digger.hxx ---
//  $Id: digger.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef DIGGER_HH
#define DIGGER_HH

#include "../pingu_action.hxx"
#include "../sprite.hxx"

/** 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"; }
  PinguEnvironment get_environment() const { return ENV_LAND; }
  bool have_something_to_dig();
  void dig();
  void update(float delta);
  void draw_offset(int x, int y, float s);
};

#endif

/* EOF */

--- NEW FILE: drown.cxx ---
//  $Id: drown.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "drown.hxx"

///
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::draw_offset(int x, int y, float /*s*/)
{
  // FIXME: Direction handling is ugly
  if (pingu->direction.is_left ())
    sprite.set_direction (Sprite::LEFT);
  else
    sprite.set_direction (Sprite::RIGHT);

  sprite.put_screen (pingu->pos + CL_Vector(x, y));
}

///
void 
Drown::update(float delta)
{
  sprite.update (delta);
  if (sprite.finished ())
    {
      pingu->set_status(PS_DEAD);
    }
}

/* EOF */

--- NEW FILE: drown.hxx ---
//  $Id: drown.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef DROWN_HH
#define DROWN_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

class Drown : public PinguAction
{
private:
  Sprite sprite;
public:
  void init();
  std::string get_name() const { return "Drown"; }
  PinguEnvironment get_environment() const { return ENV_ALWAYS; }
  void update(float delta);
  void draw_offset(int x, int y, float s);
  bool catchable () { return false; }
};

#endif

/* EOF */

--- NEW FILE: exiter.cxx ---
//  $Id: exiter.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../globals.hxx"
#include "../sound.hxx"
#include "../pingus_resource.hxx"
#include "../algo.hxx"
#include "exiter.hxx"

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);

  if (sprite.finished ())
    {
      if (pingu->get_status() != PS_EXITED)
        {
          PingusSound::play_sound("sounds/oing.wav");
          pingu->set_status(PS_EXITED); 
        }
    }
}

void 
Exiter::draw_offset(int x, int y, float /*s*/)
{
  if (pingu->direction.is_left ())
    sprite.set_direction (Sprite::LEFT);
  else
    sprite.set_direction (Sprite::RIGHT);
      
  sprite.put_screen (pingu->pos + CL_Vector (x, y));
}

/* EOF */

--- NEW FILE: exiter.hxx ---
//  $Id: exiter.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef EXITER_HH
#define EXITER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
class Exiter : public PinguAction
{
private:
  Sprite sprite;
public:
  void init(void);
  std::string get_name () const { return "Exiter"; }
  PinguEnvironment get_environment() const { return (PinguEnvironment)ENV_LAND; 
}
  void update(float delta);
  void draw_offset(int x, int y, float s);
};

#endif

/* EOF */

--- NEW FILE: faller.cxx ---
//  $Id: faller.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../action_holder.hxx"
#include "../col_map.hxx"
#include "../pingu_map.hxx"
#include "../globals.hxx"
#include "../sprite.hxx"
#include "../force_vector.hxx"
#include "../world.hxx"
#include "../string_converter.hxx"
#include "../pingu.hxx"
#include "faller.hxx"

const float Faller::deadly_velocity = 20.0f;

void
Faller::init(void)
{
  faller = Sprite("Pingus/faller" + to_string(pingu->owner_id), "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->owner_id), "pingus");
  tumbler.set_align_center_bottom ();
}

void
Faller::update (float delta)
{
  tumbler.update (delta);
  faller.update (delta);

 for (unsigned int i=0; i < pingu->persist.size(); ++i) {
       if (pingu->persist[i]->get_name() == "Floater") {
               pingu->set_paction("floater");
               return;
       }
 }
 
  // Apply all forces
  pingu->velocity = ForcesHolder::apply_forces(pingu->pos, pingu->velocity);
    
  CL_Vector newp = pingu->velocity;
          
  // 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, -1) == ColMap::NOTHING
        && (fabs(newp.x) >= 1 || fabs(newp.y) >= 1))
    {
      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->pos.x++;
              newp.x--;
            }
          else
            {
              pingu->pos.x--;
              newp.x++;
            }
        }

      if (fabs(newp.y) >= 1)
        {
          if (newp.y > 0)
            {
              pingu->pos.y++;
              newp.y--;
            }
          else 
            {
              pingu->pos.y--;
              newp.y++;
            }
        }
    }

  // Now that the Pingu is moved, check if he hits the ground.
  if (rel_getpixel(0, -1) == ColMap::NOTHING)
    { // if pingu is not on ground
      ++falling;
          
      if (falling > 3) 
        pingu->environment = ENV_AIR; 
    }
  else // Ping is on ground
    {
      if (rel_getpixel(0, -1) & ColMap::WATER)
        {
          pingu->set_paction("drown");
          return;
        }
      else
        {
          // Did we stop too fast?
          if (fabs(pingu->velocity.y) > deadly_velocity) 
            {
              pingu->set_paction("splashed");
              return;
            }
          else if (fabs(pingu->velocity.x) > deadly_velocity)
            {
              if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
                std::cout << "Pingu: x Smashed on ground, jumping" << std::endl;
            }
        }
      // Reset the velocity
      pingu->velocity.x = 0;
      pingu->velocity.y = 0;
      // FIXME: UGLY!
      pingu->set_action ("walker");
    }
}

void 
Faller::draw_offset(int x, int y, float /*s*/)
{
  if (is_tumbling ()) {
    tumbler.put_screen (int(pingu->pos.x + x), int(pingu->pos.y + y));
  } else {
    faller.put_screen (int(pingu->pos.x + x), int(pingu->pos.y + y));
  }
}

bool
Faller::is_tumbling () const
{
  // If we are going fast enough to get smashed, start tumbling
  if (fabs(pingu->velocity.x) > deadly_velocity
      || fabs(pingu->velocity.y) > deadly_velocity)
    {
      return true;
    }
  else
    {
      return false;
    }
}

/* EOF */

--- NEW FILE: faller.hxx ---
//  $Id: faller.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef FALLER_HH
#define FALLER_HH

#include "../pingu_action.hxx"


class Faller : public PinguAction
{
private:
  Sprite faller;
  Sprite tumbler;

  int falling;

  static const float deadly_velocity;

public:
  void  init(void);
  
  void  update(float delta);
  void  draw_offset(int x, int y, float s);
  
  PinguEnvironment get_environment() const { return ENV_ALWAYS; }
  std::string get_name() const { return "Faller"; }
  bool is_tumbling () const;
};

#endif

/* EOF */

--- NEW FILE: floater.cxx ---
//  $Id: floater.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "floater.hxx"

Floater::Floater()
{
}

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);

  pingu->velocity = CL_Vector(0.0, 0.0);
  if (rel_getpixel(0, -1) == 0) {
    ++step;
    if (step > 0) {
      ++(pingu->pos.y);
      step = 0;
    }
  } else {
    is_finished = true;
  }
}

void 
Floater::draw_offset (int x, int y, float /*s*/)
{
  sprite.put_screen (pingu->pos + CL_Vector (x, y));
}

/* EOF */

--- NEW FILE: floater.hxx ---
//  $Id: floater.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef FLOATER_HH
#define FLOATER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
class Floater : public PinguAction
{
private:
  int falling_depth;
  int step;
  Sprite sprite;
public:
  ///
  Floater();

  std::string get_name() const { return "Floater"; }
  PinguEnvironment get_environment() const { return 
PinguEnvironment(ENV_LAND|ENV_AIR); }
  ActionType get_type(void) { return FALL; };
  void init(void);
  void update(float delta);
  void draw_offset (int x, int y, float s);
  char get_persistent_char () { return 'f'; }
};

#endif

/* EOF */

--- NEW FILE: jumper.cxx ---
//  $Id: jumper.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "../string_converter.hxx"
#include "jumper.hxx"

Jumper::Jumper()
{
  // do nothing
}

void
Jumper::init(void)
{
  sprite = Sprite("Pingus/jumper" + to_string(pingu->get_owner ()),
                  "pingus");
}

void 
Jumper::draw_offset(int x, int y, float /*s*/)
{
  // FIXME: Huh! Does this work?!
  sprite.put_screen (x, y);
}

void
Jumper::update(float /*delta*/)
{
  if (pingu->direction.is_right()) {
    pingu->velocity += CL_Vector(10.0, -10.0);
  } else {
    pingu->velocity += CL_Vector(-10.0, -10.0);
  }

  pingu->pos.y -= 1;

  is_finished = true;
}

/* EOF */

--- NEW FILE: jumper.hxx ---
//  $Id: jumper.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef JUMPER_HH
#define JUMPER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
class Jumper : public PinguAction
{
private:
  Sprite sprite;
public:
  Jumper();

  void  init(void);
  PinguEnvironment get_environment () const { return 
(PinguEnvironment)ENV_LAND; }
  std::string get_name() const { return "Jumper"; }
  void  update(float delta);
  void  draw_offset(int x, int y, float s);
};

#endif

/* EOF */

--- NEW FILE: laser_kill.cxx ---
//  $Id: laser_kill.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include <cstdio>

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "laser_kill.hxx"
#include "../particles/ground_particle.hxx"
#include "../algo.hxx"

LaserKill::LaserKill()
{
}

void
LaserKill::init(void)
{
  sprite = Sprite ("Other/laser_kill0", "pingus");
}

void 
LaserKill::draw_offset(int x, int y, float /*s*/)
{
  sprite.put_screen (x, y);
}

void
LaserKill::update(float /*delta*/)
{
  //if (counter >= (int)(surface.get_num_frames()) - 1) 
  //{
      pingu->set_status(PS_DEAD);
      //}
}

/* EOF */

--- NEW FILE: laser_kill.hxx ---
//  $Id: laser_kill.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef LASERKILL_HH
#define LASERKILL_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
class LaserKill : public PinguAction
{
private:
  Sprite sprite;
public:
  ///
  LaserKill();
  std::string get_name() const { return "LaserKill"; }
  PinguEnvironment get_environment() const { return (PinguEnvironment)ENV_LAND; 
}
  void init(void);
  void update(float delta);
  void draw_offset(int x, int y, float s);
  bool catchable () { return false; }
};

#endif

/* EOF */

--- NEW FILE: miner.cxx ---
// $Id: miner.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu_map.hxx"
#include "../col_map.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../sound.hxx"
#include "../algo.hxx"
#include "../pingu.hxx"
#include "miner.hxx"

Miner::Miner()
{
}

void
Miner::init(void)
{
  miner_radius = PingusResource::load_surface ("Other/bash_radius", "pingus");
  miner_radius_gfx = PingusResource::load_surface ("Other/bash_radius_gfx", 
"pingus");
  sprite = Sprite ("Pingus/miner0", "pingus", 20.0f);
  sprite.set_align_center_bottom ();
  slow_count = 0;
}

void
Miner::update(float delta)
{
  sprite.update (delta);
  
  // FIXME: Direction handling is ugly
  if (pingu->direction.is_left ())
    sprite.set_direction (Sprite::LEFT);
  else
    sprite.set_direction (Sprite::RIGHT);

  ++slow_count;
  if (slow_count % 4  == 0) 
    {
      if (slow_count % 3 == 0) 
        {
          pingu->get_world()->get_colmap()->remove(miner_radius.get_provider(), 
                                                   pingu->get_x () - 16 + 
pingu->direction, 
                                                   pingu->get_y () - 31);
          
pingu->get_world()->get_gfx_map()->remove(miner_radius_gfx.get_provider(), 
                                                    pingu->get_x () - 16 + 
pingu->direction, 
                                                    pingu->get_y () - 31);
        }

      pingu->pos.x += pingu->direction;
      pingu->pos.y += 1;
    }
  
  if (rel_getpixel(0, -1) == ColMap::NOTHING)
    {
      pingu->get_world()->get_colmap()->remove(miner_radius, 
                                               pingu->get_x () - 16 + 
pingu->direction, 
                                               pingu->get_y () - 29);
      pingu->get_world()->get_gfx_map()->remove(miner_radius_gfx,
                                                pingu->get_x () - 16 + 
pingu->direction, 
                                                pingu->get_y () - 29);
      is_finished = true;
    }
  else if (rel_getpixel(0, -1) & ColMap::SOLID)
    {
      PingusSound::play_sound("sounds/chink.wav");
      pingu->get_world()->get_colmap()->remove(miner_radius, pingu->get_x () - 
16 + pingu->direction, 
                                               pingu->get_y () - 31);
      pingu->get_world()->get_gfx_map()->remove(miner_radius_gfx, pingu->get_x 
() - 16 + pingu->direction, 
                                                pingu->get_y () - 31);
      is_finished = true;
    }
}

void 
Miner::draw_offset(int x, int y, float /*s*/)
{
  sprite.put_screen (pingu->get_pos () + CL_Vector(x, y));
}

/* EOF */

--- NEW FILE: miner.hxx ---
//  $Id: miner.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef MINER_HH
#define MINER_HH

#include "../pingu_action.hxx"
#include "../sprite.hxx"

///
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"; }
  PinguEnvironment get_environment() const { return (PinguEnvironment)ENV_LAND; 
}
  void update(float delta);
  void draw_offset(int x, int y, float s);
};

#endif

/* EOF */

--- NEW FILE: rocket_launcher.cxx ---
//  $Id: rocket_launcher.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu_map.hxx"
#include "../particles/particle_holder.hxx"
#include "../col_map.hxx"
#include "../particles/explosive_particle.hxx"
#include "../world.hxx"
#include "../string_converter.hxx"
#include "../pingus_resource.hxx"
#include "../pingu.hxx"
#include "rocket_launcher.hxx"

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;

  pingu->get_world ()->get_particle_holder()->add_particle 
    (new ExplosiveParticle ((int) pingu->pos.x, (int)pingu->pos.y - 12, 
                            pingu->direction.is_left() ? -400.0f : 400.0f,
                            0.0f));
}

void
RocketLauncher::update(float delta)
{
  if (sprite.finished ())
    {
      is_finished = true;
    }

  sprite.update (delta);
}

void
RocketLauncher::draw_offset(int x, int y, float /*s*/)
{
  if (pingu->direction.is_left ())
    sprite.set_direction (Sprite::LEFT);
  else
    sprite.set_direction (Sprite::RIGHT);
  sprite.put_screen (pingu->pos + CL_Vector (x, y));
}

/* EOF */

--- NEW FILE: rocket_launcher.hxx ---
//  $Id: rocket_launcher.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef ROCKETLAUNCHER_HH
#define ROCKETLAUNCHER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

class RocketLauncher
  : public PinguAction
{
private:
  Sprite sprite;
  bool launched;
public:
  RocketLauncher () {}
  ~RocketLauncher () {}

  void  init();
  std::string get_name() const { return "RocketLauncher"; }
  PinguEnvironment get_environment() const { return ENV_LAND; }
  void  update(float delta);
  void  draw_offset(int, int, float s);
};

#endif

/* EOF */

--- NEW FILE: slider.cxx ---
//  $Id: slider.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../col_map.hxx"
#include "../string_converter.hxx"
#include "../pingu.hxx"
#include "slider.hxx"

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::update(float delta)
{
  if (pingu->direction.is_left ())
    sprite.set_direction (Sprite::LEFT);
  else
    sprite.set_direction (Sprite::RIGHT);

  sprite.update (delta);

  for (int i = 0; i < speed; ++i)
    {
      pingu->pos.x += pingu->direction;
      
      if (rel_getpixel(0, -1) == ColMap::NOTHING)
        {
          speed = (speed > 5 ? 5 : speed);

          if (pingu->direction.is_right()) {
            pingu->velocity += CL_Vector(speed, 0.0);
          } else {
            pingu->velocity += CL_Vector(-speed, 0.0);
          }

          is_finished = true;
        }
    }

  speed -= 7 * delta;
  if (speed < 1)
    is_finished = true;
}

void
Slider::draw_offset(int x, int y, float /*s*/)
{
  sprite.put_screen (pingu->pos + CL_Vector(x, y - 2));
}

/* EOF */

--- NEW FILE: slider.hxx ---
//  $Id: slider.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef SLIDER_HH
#define SLIDER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

class Slider : public PinguAction
{
private:
  Sprite sprite;
  float  speed;
public:
  Slider ();

  void  init(void);
  PinguEnvironment get_environment () const { return 
(PinguEnvironment)ENV_LAND; }
  std::string get_name() const { return "Slider"; }
  void  update(float delta);
  void  draw_offset(int x, int y, float s);
};

#endif

/* EOF */

--- NEW FILE: smashed.cxx ---
//  $Id: smashed.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "smashed.hxx"

void
Smashed::init(void)
{
  sprite = Sprite ("Pingus/bomber0", "pingus");
  sound_played = false;  
}

void 
Smashed::draw_offset(int x, int y, float /*s*/)
{
  sprite.put_screen (x, y);
}

void
Smashed::update(float /*delta*/)
{
  //  pingu->particle->add_pingu_explo(pingu->x_pos, pingu->y_pos - 16);
  pingu->set_status(PS_DEAD);
}

/* EOF */

--- NEW FILE: smashed.hxx ---
//  $Id: smashed.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef SMASHED_HH
#define SMASHED_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
class Smashed : public PinguAction
{
private:
  bool particle_thrown;
  bool sound_played;
  Sprite sprite;
public:
  void   init(void);
  std::string get_name() const { return "Smashed"; }
  PinguEnvironment get_environment() const { return (PinguEnvironment)ENV_LAND; 
}
  void update(float delta);
  void draw_offset(int x, int y, float s);
  bool catchable () { return false; }
};

#endif

/* EOF */

--- NEW FILE: splashed.cxx ---
//  $Id: splashed.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "../sound.hxx"
#include "../algo.hxx"
#include "splashed.hxx"

Splashed::Splashed(void)
{
}

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;
}

void
Splashed::update(float delta)
{
  sprite.update (delta);

  if (!particle_thrown)
    {
      particle_thrown = true;
      PingusSound::play_sound("sounds/splat.wav");
    }

  if (sprite.finished ())
  {
    pingu->set_status(PS_DEAD);
  }
}

void 
Splashed::draw_offset(int x_of, int y_of, float /*s*/)
{
  sprite.put_screen (pingu->get_x () + x_of,
                     pingu->get_y () + y_of);
}

/* EOF */

--- NEW FILE: splashed.hxx ---
//  $Id: splashed.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef SPLASHED_HH
#define SPLASHED_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
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"; }
  PinguEnvironment get_environment() const { return ENV_LAND; }
  void update(float delta);
  void draw_offset(int x, int y, float s);
  bool catchable () { return false; }
};

#endif

/* EOF */

--- NEW FILE: superman.cxx ---
//  $Id: superman.cxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "../sprite.hxx"
#include "../string_converter.hxx"
#include "superman.hxx"

Superman::Superman ()
{
}

void
Superman::init()
{
  x_pos = pingu->pos.x;
  counter = 0.0;
  sprite = Sprite (PingusResource::load_surface 
                   ("Pingus/superman" + to_string(pingu->get_owner ()),
                    "pingus"));
  sprite.set_align_center_bottom (); 
}

void  
Superman::update(float delta)
{
  sprite.update (delta);
  counter += delta;
  pingu->pos.x += 40.0f * delta;
  pingu->pos.y -= 200.0f * delta;

  if (pingu->pos.y < -32)
    {
      pingu->set_status (PS_DEAD);
    }
}

void   
Superman::draw_offset(int x_of, int y_of, float /*s*/)
{
  sprite.put_screen (pingu->get_x () + x_of,
                     pingu->get_y () + y_of);
}

/* EOF */

--- NEW FILE: superman.hxx ---
//  $Id: superman.hxx,v 1.1 2002/06/12 19:01:42 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef SUPERMAN_HH
#define SUPERMAN_HH

#include "../pingu_action.hxx"

class Superman : public PinguAction
{
private:
  double counter;
  double x_pos;
  Sprite sprite;
public:
  Superman ();
  void  init();
  std::string get_name() const { return "Superman"; }
  PinguEnvironment get_environment() const { return ENV_ALWAYS; }
  void  update(float delta);
  void  draw_offset(int, int, float s);

};

#endif

/* EOF */

--- NEW FILE: teleported.cxx ---
//  $Id: teleported.cxx,v 1.1 2002/06/12 19:01:43 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "teleported.hxx"

Teleported::Teleported(void)
{
}

void
Teleported::init(void)
{
  sprite = Sprite ("Pingus/bomber0", "pingus");
  sound_played = false;
}


void 
Teleported::draw_offset(int x, int y, float /*s*/)
{
  sprite.put_screen (x, y);
}


void
Teleported::update(float /*delta*/)
{
  pingu->set_pos (x_target, y_target);
  pingu->set_status(PS_ALIVE);
  is_finished = true;
}

/* EOF */

--- NEW FILE: teleported.hxx ---
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef TELEPORTED_HH
#define TELEPORTED_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

///
class Teleported : public PinguAction
{
private:
  bool particle_thrown;
  bool sound_played;
  Sprite sprite;
public:
  Teleported();

  std::string get_name() const { return "LaserKill"; }
  PinguEnvironment get_environment() const { return (PinguEnvironment)ENV_LAND; 
}
  void init(void);
  void update(float delta);
  void draw_offset(int x, int y, float s);
  bool catchable () { return false; }

  int x_target, y_target; // <- FIXME: Ugly!
};

#endif

/* EOF */

--- NEW FILE: waiter.cxx ---
//  $Id: waiter.cxx,v 1.1 2002/06/12 19:01:43 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu.hxx"
#include "../pingus_resource.hxx"
#include "waiter.hxx"

Waiter::Waiter()
{
}

void
Waiter::update(float delta)
{
  sprite.update (delta);
  
  if (countdown < 0)
    is_finished = true;
  
  countdown -= delta;
}

void
Waiter::init()
{
  sprite = PingusResource::load_surface ("Pingus/blocker0", "pingus");
  sprite.set_align_center_bottom ();
  countdown = 2.0;
}

void
Waiter::draw_offset(int x, int y, float /*s*/)
{
  sprite.put_screen (pingu->get_pos () + CL_Vector(x, y));
}

/* EOF */

--- NEW FILE: waiter.hxx ---
//  $Id: waiter.hxx,v 1.1 2002/06/12 19:01:43 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef WAITER_HH
#define WAITER_HH

#include "../sprite.hxx"
#include "../pingu_action.hxx"

/** 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();
  std::string get_name() const { return "Waiter"; }
  PinguEnvironment get_environment() const { return ENV_LAND; }
  void update(float delta);
  void  draw_offset(int x, int y, float s);
};

#endif

/* EOF */

--- NEW FILE: walker.cxx ---
//  $Id: walker.cxx,v 1.1 2002/06/12 19:01:43 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "../pingu_map.hxx"
#include "../action_holder.hxx"
#include "../col_map.hxx"
#include "../world.hxx"
#include "../globals.hxx"
#include "../string_converter.hxx"
#include "../pingu.hxx"
#include "walker.hxx"

const int Walker::max_steps=4;

void
Walker::init(void)
{
  walker = Sprite ("Pingus/walker" + to_string(pingu->owner_id), "pingus");
  walker.set_align_center_bottom ();
}

void
Walker::update(float delta)
{
  int y_inc = 0;
  walker.update (delta);

  pingu->environment = ENV_LAND;

  if (rel_getpixel(1, 0) == ColMap::NOTHING) 
    { // if infront is free
      pingu->pos.x += pingu->direction;
    }
  else if (rel_getpixel(1, 0)  & ColMap::BRIDGE)  // bridge
    {
      pingu->pos.x += pingu->direction;
      pingu->pos.y -= 1;
    }
  else 
    { // if infront is a pixel 
      // Pingu is walking up the mountain 
      if (pingu->rel_getpixel(1, max_steps + 1) == ColMap::NOTHING) 
        { // we can continue walking up. search for the correct y_pos
          for(y_inc=1; y_inc <= max_steps; y_inc++)
            if (rel_getpixel(1, y_inc) == ColMap::NOTHING)
               break; 
          pingu->pos.y -= y_inc;
          pingu->pos.x += pingu->direction;
        }
      else
        { // WALL
          for (unsigned int i=0; i < pingu->persist.size(); ++i) 
            {
              if (pingu->persist[i]->get_type() & (ActionType)WALL) 
                {
                  if (pingu->action && pingu->persist[i]->get_name() == 
pingu->action->get_name()) 
                    {
                      if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
                        std::cout << "Pingu: Not using action, we already did." 
<< std::endl;
                    } 
                  else 
                    {
                      if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
                        std::cout << "Pingu: We are in front of a wall, setting 
persistant action" << std::endl;
                      // pingu->set_paction(pingu->persist[i]->get_name());
                      // FIXME: above fails because of Capitalised name
                      // returned from get_name(). May be we should 
                      // use capitalised names everywhere. 
  
                      // Do we set  any other action here?
                      pingu->set_paction("climber");
                    }
                  return;
                }
            }
          pingu->direction.change();
        }
    }
  

  if (rel_getpixel(0, -1) == ColMap::NOTHING) // in front there is a step 
    {
      
      for(y_inc=2; y_inc <= max_steps + 1; y_inc++) 
       {
         if (rel_getpixel(0, -y_inc) & ColMap::WATER) 
          {
            pingu->set_paction ("drown");
            return;
          } 
         else if(rel_getpixel(0, -y_inc) != ColMap::NOTHING)
          { // there is land
            pingu->pos.y += y_inc - 1;
            break;
          }
        }

       if (rel_getpixel(0,-y_inc) == ColMap::NOTHING)
        { // out of loop still not land. we should fall.
          pingu->set_action("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 (rel_getpixel(0, 26) != ColMap::NOTHING && !(rel_getpixel(0, 26) & 
ColMap::BRIDGE))
    {
      if (pingus_debug_flags & PINGUS_DEBUG_ACTIONS)
        std::cout << "Pingu: Head collision" << std::endl;
      pingu->direction.change();
      return;
    }

}

void  
Walker::draw_offset(int x, int y, float /*s*/)
{
  if (pingu->direction.is_left ())
    walker.set_direction (Sprite::LEFT);
  else
    walker.set_direction (Sprite::RIGHT);

  walker.put_screen (pingu->pos + CL_Vector (x, y));
}

/* EOF */

--- NEW FILE: walker.hxx ---
//  $Id: walker.hxx,v 1.1 2002/06/12 19:01:43 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef WALKER_HH
#define WALKER_HH

#include "../pingu_action.hxx"
#include "../sprite.hxx"

class Walker : public PinguAction
{
private:
  Sprite walker; 

  static const int max_steps; // max nr. of pixels that pingu can walk up/down

public:
  void  init(void);

  void  update(float delta);
  void  draw_offset(int x, int y, float s);

  PinguEnvironment get_environment() const { return ENV_ALWAYS; }
  std::string get_name() const { return "Walker"; }
};

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am 26 Jan 2002 00:36:40 -0000      1.10
+++ Makefile.am 12 Jun 2002 19:01:42 -0000      1.11
@@ -50,28 +50,28 @@
 noinst_LIBRARIES = libpingu_actions.a
 
 libpingu_actions_a_SOURCES =       \
-         basher.cc   basher.hh     \
-         blocker.cc  blocker.hh    \
-         bomber.cc   bomber.hh     \
-         bridger.cc  bridger.hh    \
-         climber.cc  climber.hh    \
-         digger.cc   digger.hh     \
-         exiter.cc   exiter.hh     \
-         floater.cc  floater.hh    \
-         Jumper.cc   Jumper.hh     \
-         miner.cc    miner.hh      \
-         smashed.cc  smashed.hh    \
-         LaserKill.cc LaserKill.hh \
-         teleported.cc teleported.hh \
-         Splashed.cc Splashed.hh \
-        Waiter.cc   Waiter.hh \
-         Drown.cc    Drown.hh \
-         Angel.cc    Angel.hh \
-         Superman.cc Superman.hh \
-         Boarder.cc  Boarder.hh \
-         Faller.cc   Faller.hh \
-         Walker.cc   Walker.hh \
-         RocketLauncher.cc  RocketLauncher.hh \
-         Slider.cc   Slider.hh
+         basher.cxx   basher.hxx     \
+         blocker.cxx  blocker.hxx    \
+         bomber.cxx   bomber.hxx     \
+         bridger.cxx  bridger.hxx    \
+         climber.cxx  climber.hxx    \
+         digger.cxx   digger.hxx     \
+         exiter.cxx   exiter.hxx     \
+         floater.cxx  floater.hxx    \
+         jumper.cxx   jumper.hxx     \
+         miner.cxx    miner.hxx      \
+         smashed.cxx  smashed.hxx    \
+         laser_kill.cxx laser_kill.hxx \
+         teleported.cxx teleported.hxx \
+         splashed.cxx splashed.hxx \
+        waiter.cxx   waiter.hxx \
+         drown.cxx    drown.hxx \
+         angel.cxx    angel.hxx \
+         superman.cxx superman.hxx \
+         boarder.cxx  boarder.hxx \
+         faller.cxx   faller.hxx \
+         walker.cxx   walker.hxx \
+         rocket_launcher.cxx  rocket_launcher.hxx \
+         slider.cxx   slider.hxx
 
 # EOF #

--- Angel.cc DELETED ---

--- Angel.hh DELETED ---

--- Boarder.cc DELETED ---

--- Boarder.hh DELETED ---

--- Drown.cc DELETED ---

--- Drown.hh DELETED ---

--- Faller.cc DELETED ---

--- Faller.hh DELETED ---

--- Jumper.cc DELETED ---

--- Jumper.hh DELETED ---

--- LaserKill.cc DELETED ---

--- LaserKill.hh DELETED ---

--- RocketLauncher.cc DELETED ---

--- RocketLauncher.hh DELETED ---

--- Slider.cc DELETED ---

--- Slider.hh DELETED ---

--- Splashed.cc DELETED ---

--- Splashed.hh DELETED ---

--- Superman.cc DELETED ---

--- Superman.hh DELETED ---

--- Waiter.cc DELETED ---

--- Waiter.hh DELETED ---

--- Walker.cc DELETED ---

--- Walker.hh DELETED ---

--- basher.cc DELETED ---

--- basher.hh DELETED ---

--- blocker.cc DELETED ---

--- blocker.hh DELETED ---

--- bomber.cc DELETED ---

--- bomber.hh DELETED ---

--- bridger.cc DELETED ---

--- bridger.hh DELETED ---

--- climber.cc DELETED ---

--- climber.hh DELETED ---

--- digger.cc DELETED ---

--- digger.hh DELETED ---

--- exiter.cc DELETED ---

--- exiter.hh DELETED ---

--- floater.cc DELETED ---

--- floater.hh DELETED ---

--- miner.cc DELETED ---

--- miner.hh DELETED ---

--- smashed.cc DELETED ---

--- smashed.hh DELETED ---

--- teleported.cc DELETED ---

--- teleported.hh DELETED ---




reply via email to

[Prev in Thread] Current Thread [Next in Thread]