[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/traps bumper.cxx,NONE,1.1 bumper.hxx,
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/traps bumper.cxx,NONE,1.1 bumper.hxx,NONE,1.1 fake_exit.cxx,NONE,1.1 fake_exit.hxx,NONE,1.1 guillotine.cxx,NONE,1.1 guillotine.hxx,NONE,1.1 hammer.cxx,NONE,1.1 hammer.hxx,NONE,1.1 laser_exit.cxx,NONE,1.1 laser_exit.hxx,NONE,1.1 smasher.cxx,NONE,1.1 smasher.hxx,NONE,1.1 spike.cxx,NONE,1.1 spike.hxx,NONE,1.1 Makefile.am,1.6,1.7 Bumper.cc,1.23,NONE Bumper.hh,1.10,NONE FakeExit.cc,1.21,NONE FakeExit.hh,1.10,NONE Guillotine.cc,1.18,NONE Guillotine.hh,1.11,NONE LaserExit.cc,1.21,NONE LaserExit.hh,1.10,NONE Spike.cc,1.18,NONE Spike.hh,1.10,NONE hammer.cc,1.20,NONE hammer.hh,1.10,NONE smasher.cc,1.35,NONE smasher.hh,1.12,NONE |
Date: |
12 Jun 2002 19:11:34 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/traps
In directory dark:/tmp/cvs-serv13225/traps
Modified Files:
Makefile.am
Added Files:
bumper.cxx bumper.hxx fake_exit.cxx fake_exit.hxx
guillotine.cxx guillotine.hxx hammer.cxx hammer.hxx
laser_exit.cxx laser_exit.hxx smasher.cxx smasher.hxx
spike.cxx spike.hxx
Removed Files:
Bumper.cc Bumper.hh FakeExit.cc FakeExit.hh Guillotine.cc
Guillotine.hh LaserExit.cc LaserExit.hh Spike.cc Spike.hh
hammer.cc hammer.hh smasher.cc smasher.hh
Log Message:
The big rename...
--- NEW FILE: bumper.cxx ---
// $Id: bumper.cxx,v 1.1 2002/06/12 19:11:32 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 <ClanLib/Display/Display/surfaceprovider.h>
#include "../world.hxx"
#include "../action_holder.hxx"
#include "../pingus_resource.hxx"
#include "../sound.hxx"
#include "../algo.hxx"
#include "../col_map.hxx"
#include "../pingu_holder.hxx"
#include "bumper.hxx"
#include "../pingu.hxx"
Bumper::Bumper(const TrapData& data) : count(0)
{
pos = data.pos;
surface = PingusResource::load_surface("Traps/bumper", "traps");
}
Bumper::~Bumper()
{
}
void
Bumper::update(float /*delta*/)
{
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu) {
catch_pingu(*pingu);
}
if (upwards)
{
++count;
if (count >= (int)surface.get_num_frames())
{
count = 0;
upwards = false;
}
}
}
void
Bumper::draw_colmap()
{
std::cout << "Drawing colmap entry" << std::endl;
CL_SurfaceProvider* prov = CL_SurfaceProvider::load("Traps/bumper_cmap",
PingusResource::get("traps"));
world->get_colmap()->put(prov, (int) pos.x, (int) pos.y,
GroundpieceData::GP_SOLID);
}
void
Bumper::draw_offset(int x, int y, float /*s*/)
{
surface.put_screen(int(pos.x + x), int(pos.y + y), count);
}
void
Bumper::catch_pingu(Pingu* pingu)
{
// if (!pingu->is_alive())
// return;
if (pingu->get_y() > pos.y + 60 && pingu->get_y() < pos.y + 100)
{
if (pingu->get_x() > pos.x + 28 && pingu->get_x() < pos.x + 32)
{
if (!upwards)
upwards = true;
}
if (upwards && pingu->get_x() > pos.x + 0 && pingu->get_x() < pos.x + 60)
{
pingu->apply_force(CL_Vector((pingu->get_x() - 30)/6, -5));
}
}
}
/* EOF */
--- NEW FILE: bumper.hxx ---
// $Id: bumper.hxx,v 1.1 2002/06/12 19:11:32 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 BUMPER_HH
#define BUMPER_HH
#include "../trap.hxx"
///
class Bumper : public Trap
{
private:
bool upwards;
int count;
public:
Bumper(const TrapData& data);
virtual ~Bumper();
void draw_offset(int x, int y, float s);
void draw_colmap();
void update(float delta);
void catch_pingu(Pingu* pingu);
};
#endif
/* EOF */
--- NEW FILE: fake_exit.cxx ---
// $Id: fake_exit.cxx,v 1.1 2002/06/12 19:11:32 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 "../world.hxx"
#include "../pingus_resource.hxx"
#include "../pingu_action_factory.hxx"
#include "../pingu_holder.hxx"
#include "../pingu.hxx"
#include "fake_exit.hxx"
FakeExit::FakeExit(const TrapData& data)
{
surface = PingusResource::load_surface("Traps/fake_exit", "traps");
pos = data.pos;
counter.set_size(surface.get_num_frames());
counter.set_type(GameCounter::once);
counter.set_speed(2.5);
counter = surface.get_num_frames() - 1;
smashing = false;
}
FakeExit::~FakeExit()
{
}
void
FakeExit::update(float /*delta*/)
{
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
catch_pingu(*pingu);
}
if (smashing)
++counter;
}
void
FakeExit::catch_pingu(Pingu* pingu)
{
// if (!pingu->is_alive())
// return false;
if (counter.finished()) {
smashing = false;
}
if (pingu->get_x() > pos.x + 31 && pingu->get_x() < pos.x + 31 + 15
&& pingu->get_y() > pos.y + 56 && pingu->get_y() < pos.y + 56+56)
{
if (!smashing) {
counter = 0;
smashing = true;
}
if (counter >= 3 && counter <= 5) {
pingu->set_action(PinguActionFactory::instance ()->create ("smashed"));
}
}
}
/* EOF */
--- NEW FILE: fake_exit.hxx ---
// $Id: fake_exit.hxx,v 1.1 2002/06/12 19:11:32 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 FAKE_EXIT_HH
#define FAKE_EXIT_HH
#include "../trap.hxx"
class TrapData;
///
class FakeExit : public Trap
{
private:
bool smashing;
public:
FakeExit(const TrapData& data);
virtual ~FakeExit();
void update(float delta);
void catch_pingu(Pingu*);
};
#endif
/* EOF */
--- NEW FILE: guillotine.cxx ---
// $Id: guillotine.cxx,v 1.1 2002/06/12 19:11:32 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 "../pingus_resource.hxx"
#include "guillotine.hxx"
#include "../pingu_holder.hxx"
#include "../world.hxx"
#include "../pingu.hxx"
Guillotine::Guillotine(const TrapData& data)
{
killing = false;
pos = data.pos;
surface = PingusResource::load_surface("Traps/guillotinekill", "traps");
idle_surf = PingusResource::load_surface("Traps/guillotineidle", "traps");
counter.set_size(surface.get_num_frames()/2);
counter.set_type(GameCounter::once);
counter.set_speed(0.7);
counter = 0;
idle_counter.set_size(idle_surf.get_num_frames());
idle_counter.set_type(GameCounter::loop);
idle_counter.set_speed(0.3);
idle_counter = 0;
}
Guillotine::~Guillotine()
{
}
void
Guillotine::draw_offset(int x, int y, float /*s*/)
{
if (killing) {
if (direction.is_left())
surface.put_screen(int(pos.x + x), int(pos.y + y), counter);
else
surface.put_screen(int(pos.x + x), int(pos.y + y), counter + 12);
} else {
idle_surf.put_screen(int(pos.x + x), int(pos.y + y), idle_counter);
}
}
void
Guillotine::update(float /*delta*/)
{
if (counter.finished()) {
counter = 0;
killing = false;
}
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu) {
catch_pingu(*pingu);
}
if (killing) {
++counter;
} else {
++idle_counter;
}
}
void
Guillotine::catch_pingu(Pingu* pingu)
{
if (!killing)
{
if (pingu->is_inside (int(pos.x + 38), int(pos.y + 90),
int(pos.x + 42), int(pos.y + 98)))
{
killing = true;
pingu->set_status(PS_DEAD);
direction = pingu->direction;
}
}
}
/* EOF */
--- NEW FILE: guillotine.hxx ---
// $Id: guillotine.hxx,v 1.1 2002/06/12 19:11:32 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 GUILLOTINE_HH
#define GUILLOTINE_HH
#include "../direction.hxx"
#include "../trap.hxx"
class TrapData;
///
class Guillotine : public Trap
{
private:
bool killing;
CL_Surface idle_surf;
Direction direction;
GameCounter idle_counter;
public:
Guillotine(const TrapData& data);
virtual ~Guillotine();
void update(float delta);
void draw_offset(int x, int y, float s);
void catch_pingu(Pingu*);
};
#endif
/* EOF */
--- NEW FILE: hammer.cxx ---
// $Id: hammer.cxx,v 1.1 2002/06/12 19:11:32 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 "../world.hxx"
#include "hammer.hxx"
#include "../particles/ground_particle.hxx"
#include "../pingus_resource.hxx"
#include "../algo.hxx"
#include "../action_holder.hxx"
#include "../pingu_action_factory.hxx"
#include "../pingu_holder.hxx"
#include "../pingu.hxx"
Hammer::Hammer(const TrapData& data)
{
pos = data.pos;
surface = PingusResource::load_surface("Traps/hammer", "traps");
counter.set_size(surface.get_num_frames());
counter.set_type(GameCounter::ping_pong);
counter.set_speed(1);
}
Hammer::~Hammer()
{
}
void
Hammer::update(float /*delta*/)
{
if (counter == 0)
particle_thrown = false;
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
catch_pingu(*pingu);
}
if (counter == (int)(surface.get_num_frames()) - 3 && !particle_thrown) {
particle_thrown = true;
/*
for(int i=0; i < 5; ++i)
particle->add_particle(new GroundParticle(x_pos + 67 + rand() % 40 - 20 ,
y_pos + 177,
frand() * 2 - 1,
frand() * - 1.5));
*/
}
++counter;
}
void
Hammer::catch_pingu(Pingu* pingu)
{
if (counter >= (int)(surface.get_num_frames()) - 3) {
if (pingu->get_x() > pos.x + 55 && pingu->get_x() < pos.x + 77
&& pingu->get_y() > pos.y + 146 && pingu->get_y() < pos.y + 185)
pingu->set_action(PinguActionFactory::instance ()->create ("smashed"));
}
}
/* EOF */
--- NEW FILE: hammer.hxx ---
// $Id: hammer.hxx,v 1.1 2002/06/12 19:11:32 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 HAMMER_HH
#define HAMMER_HH
#include "../trap.hxx"
class TrapData;
///
class Hammer : public Trap
{
private:
bool particle_thrown;
public:
Hammer(const TrapData& data);
virtual ~Hammer();
void update(float delta);
void catch_pingu(Pingu*);
};
#endif
/* EOF */
--- NEW FILE: laser_exit.cxx ---
// $Id: laser_exit.cxx,v 1.1 2002/06/12 19:11:32 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 "../world.hxx"
#include "../action_holder.hxx"
#include "../pingus_resource.hxx"
#include "../pingu_action_factory.hxx"
#include "../pingu_holder.hxx"
#include "laser_exit.hxx"
#include "../pingu.hxx"
#include "../pingu_action.hxx"
LaserExit::LaserExit(const TrapData& data)
{
killing = false;
pos = data.pos;
surface = PingusResource::load_surface("Traps/laser_exit", "traps");
counter.set_size(surface.get_num_frames());
counter.set_type(GameCounter::once);
counter.set_speed(5);
counter = 0;
}
LaserExit::~LaserExit()
{
}
void
LaserExit::update(float /*delta*/)
{
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
catch_pingu(*pingu);
}
if (killing) {
if (counter.finished()) {
counter = 0;
killing = 0;
} else {
++counter;
}
}
}
void
LaserExit::catch_pingu(Pingu* pingu)
{
//if (!pingu->is_alive())
//return;
if (!killing)
{
if (pingu->get_x () < pos.x + 34 + 10 && pingu->get_x () > pos.x + 34
&& pingu->get_y () < pos.y + 43 + 20 && pingu->get_y () > pos.y + 43)
{
if (!(pingu->get_action() && pingu->get_action()->get_name() ==
"LaserKill"))
{
killing = true;
pingu->set_action(PinguActionFactory::instance ()->create
("laserkill"));
}
}
}
}
/* EOF */
--- NEW FILE: laser_exit.hxx ---
// $Id: laser_exit.hxx,v 1.1 2002/06/12 19:11:32 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 LASEREXIT_HH
#define LASEREXIT_HH
#include "../trap.hxx"
class TrapData;
///
class LaserExit : public Trap
{
private:
bool killing;
public:
LaserExit(const TrapData&);
virtual ~LaserExit();
void update(float delta);
void catch_pingu(Pingu*);
};
#endif
/* EOF */
--- NEW FILE: smasher.cxx ---
// $Id: smasher.cxx,v 1.1 2002/06/12 19:11:32 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 "../col_map.hxx"
#include "../world.hxx"
#include "../action_holder.hxx"
#include "../pingu_holder.hxx"
#include "../pingus_resource.hxx"
#include "../sound.hxx"
#include "../particles/smoke_particle.hxx"
#include "../particles/particle_holder.hxx"
#include "../actions/splashed.hxx"
#include "../algo.hxx"
#include "smasher.hxx"
#include "../pingu_action_factory.hxx"
#include "../pingu.hxx"
Smasher::Smasher(const TrapData& data)
{
smashing = false;
pos = data.pos;
surface = PingusResource::load_surface("Traps/smasher", "traps");
count = 0;
}
Smasher::~Smasher()
{
}
void
Smasher::update(float /*delta*/)
{
PinguHolder* holder = world->get_pingu_p();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
catch_pingu(*pingu);
if (smashing)
{
if (downwards)
{
if (count >= 5)
{
// SMASH!!! The thing hitten earth and kills the pingus
downwards = false;
--count;
PingusSound::play_sound("sounds/tenton.wav", 0.7f);
for(int i=0; i < 20; i++)
{
world->get_particle_holder()
->add_particle(new SmokeParticle(int(pos.x + 20 + rand() %
260),
int(pos.y + 180),
frand()-0.5, frand()-0.5));
}
for (PinguIter pingu = holder->begin (); pingu != holder->end ();
++pingu)
{
if ((*pingu)->is_inside (int(pos.x + 30), int(pos.y + 90),
int(pos.x + 250), int(pos.y + 190)))
{
(*pingu)->set_action (PinguActionFactory::instance
()->create ("splashed"));
}
}
}
else
{
++count;
}
}
else
{
if (count <= 0) {
count = 0;
smashing = false;
} else {
--count;
}
}
}
}
void
Smasher::draw_colmap()
{
std::cout << "Drawing colmap entry" << std::endl;
CL_Surface prov(PingusResource::load_surface("Traps/smasher_cmap", "traps"));
world->get_colmap()->put(prov, (int) pos.x, (int) pos.y,
GroundpieceData::GP_SOLID);
}
void
Smasher::draw_offset(int x, int y, float /*s*/)
{
surface.put_screen(int(pos.x + x), int(pos.y + y), count);
}
void
Smasher::catch_pingu(Pingu* pingu)
{
// Activate the smasher if a Pingu is under it
if ((pingu->direction.is_left()
&& pingu->get_x() > pos.x + 65 && pingu->get_x() < pos.x + 85)
||
(pingu->direction.is_right()
&& pingu->get_x() > pos.x + 190 && pingu->get_x() < pos.x + 210))
{
if (!smashing)
{
count = 0;
downwards = true;
smashing = true;
}
}
}
/* EOF */
--- NEW FILE: smasher.hxx ---
// $Id: smasher.hxx,v 1.1 2002/06/12 19:11:32 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 SMASHER_HH
#define SMASHER_HH
#include "../trap.hxx"
class TrapData;
///
class Smasher : public Trap
{
private:
bool smashing;
bool downwards;
int count;
public:
Smasher(const TrapData& data);
virtual ~Smasher();
void draw_offset(int x, int y, float s);
void draw_colmap();
void update(float delta);
void catch_pingu(Pingu* pingu);
};
#endif
/* EOF */
--- NEW FILE: spike.cxx ---
// $Id: spike.cxx,v 1.1 2002/06/12 19:11:32 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 "../pingus_resource.hxx"
#include "../pingu_holder.hxx"
#include "../world.hxx"
#include "../pingu.hxx"
#include "spike.hxx"
Spike::Spike(const TrapData& data)
{
killing = false;
pos = data.pos;
surface = PingusResource::load_surface("Traps/spike", "traps");
counter.set_size(surface.get_num_frames());
counter.set_type(GameCounter::once);
counter.set_speed(1);
counter = 0;
}
Spike::~Spike()
{
}
void
Spike::draw_offset(int x, int y, float /*s*/)
{
if (killing) {
surface.put_screen(int(pos.x + x), int(pos.y + y), counter);
} else {
// do nothing
}
}
void
Spike::update(float /*delta*/)
{
if (killing)
++counter;
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
catch_pingu(*pingu);
}
if (counter == (int)(surface.get_num_frames()) - 1) {
killing = false;
counter = 0;
}
}
void
Spike::catch_pingu(Pingu* pingu)
{
if (!killing) {
if (pingu->get_x () > pos.x + 16 - 5 && pingu->get_x () < pos.x + 16 + 5
&& pingu->get_y () > pos.y && pingu->get_y () < pos.y + 32)
{
counter = 0;
killing = true;
}
} else {
if (counter == 3 && pingu->get_x () > pos.x +16 - 12 && pingu->get_x () <
pos.x + 16 + 12
&& pingu->get_y () > pos.y && pingu->get_y () < pos.y + 32)
{
pingu->set_status(PS_DEAD);
}
}
}
/* EOF */
--- NEW FILE: spike.hxx ---
// $Id: spike.hxx,v 1.1 2002/06/12 19:11:32 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 SPIKE_HH
#define SPIKE_HH
#include "../trap.hxx"
class TrapData;
///
class Spike : public Trap
{
private:
bool killing;
public:
Spike(const TrapData& data);
virtual ~Spike();
void draw_offset(int x_of, int y_of, float s = 1.0);
void update(float delta);
void catch_pingu(Pingu*);
};
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/traps/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile.am 1 Jun 2002 18:01:45 -0000 1.6
+++ Makefile.am 12 Jun 2002 19:11:32 -0000 1.7
@@ -21,15 +21,10 @@
EXTRA_DIST = README
-libpingu_traps_a_SOURCES = \
- smasher.cc smasher.hh \
- hammer.cc hammer.hh \
- FakeExit.cc FakeExit.hh \
- Spike.cc Spike.hh \
- Guillotine.cc Guillotine.hh \
- LaserExit.cc LaserExit.hh \
- Bumper.cc Bumper.hh
-
-# Teleport.cc Teleport.hh
+libpingu_traps_a_SOURCES = \
+bumper.hxx guillotine.hxx laser_exit.hxx spike.hxx \
+fake_exit.hxx hammer.hxx smasher.hxx \
+bumper.cxx guillotine.cxx laser_exit.cxx spike.cxx \
+fake_exit.cxx hammer.cxx smasher.cxx
## EOF ##
--- Bumper.cc DELETED ---
--- Bumper.hh DELETED ---
--- FakeExit.cc DELETED ---
--- FakeExit.hh DELETED ---
--- Guillotine.cc DELETED ---
--- Guillotine.hh DELETED ---
--- LaserExit.cc DELETED ---
--- LaserExit.hh DELETED ---
--- Spike.cc DELETED ---
--- Spike.hh DELETED ---
--- hammer.cc DELETED ---
--- hammer.hh DELETED ---
--- smasher.cc DELETED ---
--- smasher.hh DELETED ---
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/traps bumper.cxx,NONE,1.1 bumper.hxx,NONE,1.1 fake_exit.cxx,NONE,1.1 fake_exit.hxx,NONE,1.1 guillotine.cxx,NONE,1.1 guillotine.hxx,NONE,1.1 hammer.cxx,NONE,1.1 hammer.hxx,NONE,1.1 laser_exit.cxx,NONE,1.1 laser_exit.hxx,NONE,1.1 smasher.cxx,NONE,1.1 smasher.hxx,NONE,1.1 spike.cxx,NONE,1.1 spike.hxx,NONE,1.1 Makefile.am,1.6,1.7 Bumper.cc,1.23,NONE Bumper.hh,1.10,NONE FakeExit.cc,1.21,NONE FakeExit.hh,1.10,NONE Guillotine.cc,1.18,NONE Guillotine.hh,1.11,NONE LaserExit.cc,1.21,NONE LaserExit.hh,1.10,NONE Spike.cc,1.18,NONE Spike.hh,1.10,NONE hammer.cc,1.20,NONE hammer.hh,1.10,NONE smasher.cc,1.35,NONE smasher.hh,1.12,NONE,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/generic list_helper.hxx,NONE,1.1 ListHelper.hh,1.5,NONE
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.cxx,NONE,1.1 explosive_particle.hxx,NONE,1.1 ground_particle.cxx,NONE,1.1 ground_particle.hxx,NONE,1.1 particle.cxx,NONE,1.1 particle.hxx,NONE,1.1 particle_cache.cxx,NONE,1.1 particle_cache.hxx,NONE,1.1 particle_holder.cxx,NONE,1.1 particle_holder.hxx,NONE,1.1 pingu_particle.cxx,NONE,1.1 pingu_particle.hxx,NONE,1.1 rain_generator.cxx,NONE,1.1 rain_generator.hxx,NONE,1.1 rain_particle.cxx,NONE,1.1 rain_particle.hxx,NONE,1.1 smoke_particle.cxx,NONE,1.1 smoke_particle.hxx,NONE,1.1 snow_generator.cxx,NONE,1.1 snow_generator.hxx,NONE,1.1 snow_particle.cxx,NONE,1.1 snow_particle.hxx,NONE,1.1 weather_generator.cxx,NONE,1.1 weather_generator.hxx,NONE,1.1 Makefile.am,1.6,1.7 ExplosiveParticle.cc,1.5,NONE ExplosiveParticle.hh,1.2,NONE GroundParticle.cc,1.10,NONE GroundParticle.hh,1.7,NONE Particle.cc,1.12,NONE Particle.hh,1.13,NONE ParticleCache.cc,1.7,NONE ParticleCache.hh,1.6,NONE ParticleHolder.cc,1.7,NONE ParticleHolder.hh,1.9,NONE PinguParticle.cc,1.16,NONE PinguParticle.hh,1.10,NONE RainGenerator.cc,1.13,NONE RainGenerator.hh,1.5,NONE RainParticle.cc,1.11,NONE RainParticle.hh,1.8,NONE SmokeParticle.cc,1.12,NONE SmokeParticle.hh,1.8,NONE SnowGenerator.cc,1.12,NONE SnowGenerator.hh,1.5,NONE SnowParticle.cc,1.17,NONE SnowParticle.hh,1.8,NONE WeatherGenerator.cc,1.8,NONE WeatherGenerator.hh,1.10,NONE
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/generic list_helper.hxx,NONE,1.1 ListHelper.hh,1.5,NONE
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.cxx,NONE,1.1 explosive_particle.hxx,NONE,1.1 ground_particle.cxx,NONE,1.1 ground_particle.hxx,NONE,1.1 particle.cxx,NONE,1.1 particle.hxx,NONE,1.1 particle_cache.cxx,NONE,1.1 particle_cache.hxx,NONE,1.1 particle_holder.cxx,NONE,1.1 particle_holder.hxx,NONE,1.1 pingu_particle.cxx,NONE,1.1 pingu_particle.hxx,NONE,1.1 rain_generator.cxx,NONE,1.1 rain_generator.hxx,NONE,1.1 rain_particle.cxx,NONE,1.1 rain_particle.hxx,NONE,1.1 smoke_particle.cxx,NONE,1.1 smoke_particle.hxx,NONE,1.1 snow_generator.cxx,NONE,1.1 snow_generator.hxx,NONE,1.1 snow_particle.cxx,NONE,1.1 snow_particle.hxx,NONE,1.1 weather_generator.cxx,NONE,1.1 weather_generator.hxx,NONE,1.1 Makefile.am,1.6,1.7 ExplosiveParticle.cc,1.5,NONE ExplosiveParticle.hh,1.2,NONE GroundParticle.cc,1.10,NONE GroundParticle.hh,1.7,NONE Particle.cc,1.12,NONE Particle.hh,1.13,NONE ParticleCache.cc,1.7,NONE ParticleCache.hh,1.6,NONE ParticleHolder.cc,1.7,NONE ParticleHolder.hh,1.9,NONE PinguParticle.cc,1.16,NONE PinguParticle.hh,1.10,NONE RainGenerator.cc,1.13,NONE RainGenerator.hh,1.5,NONE RainParticle.cc,1.11,NONE RainParticle.hh,1.8,NONE SmokeParticle.cc,1.12,NONE SmokeParticle.hh,1.8,NONE SnowGenerator.cc,1.12,NONE SnowGenerator.hh,1.5,NONE SnowParticle.cc,1.17,NONE SnowParticle.hh,1.8,NONE WeatherGenerator.cc,1.8,NONE WeatherGenerator.hh,1.10,NONE
- Index(es):