[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,NONE,1.1 bumper.
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs 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 conveyor_belt.cxx,1.7,1.8 ice_block.cxx,1.8,1.9 switch_door.cxx,1.7,1.8 teleporter.cxx,1.5,1.6 |
Date: |
4 Sep 2002 14:55:15 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv11465/worldobjs
Modified Files:
Makefile.am conveyor_belt.cxx ice_block.cxx switch_door.cxx
teleporter.cxx
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
Log Message:
- removed traps
- various cleanup
--- NEW FILE: bumper.cxx ---
// $Id: bumper.cxx,v 1.1 2002/09/04 14:55:13 torangan 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 "bumper.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../col_map.hxx"
#include "../pingu_holder.hxx"
#include "../pingu.hxx"
#include "../xml_helper.hxx"
#include "../worldobjsdata/bumper_data.hxx"
namespace WorldObjs {
Bumper::Bumper (WorldObjsData::BumperData* data_) : upwards(false),
count(0),
data(new
WorldObjsData::BumperData(*data_))
{
assert(data);
}
Bumper::~Bumper ()
{
delete data;
}
float
Bumper::get_z_pos () const
{
return data->pos.z;
}
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 >= static_cast<int>(data->surface.get_num_frames()) )
{
count = 0;
upwards = false;
}
}
UNUSED_ARG(delta);
}
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, static_cast<int>(data->pos.x),
static_cast<int>(data->pos.y), GroundpieceData::GP_SOLID);
}
void
Bumper::draw_offset(int x, int y, float s)
{
data->surface.put_screen(static_cast<int>(data->pos.x) + x,
static_cast<int>(data->pos.y) + y, count);
UNUSED_ARG(s);
}
void
Bumper::catch_pingu(Pingu* pingu)
{
if (pingu->get_y() > data->pos.y + 60 && pingu->get_y() < data->pos.y + 100)
{
if (pingu->get_x() > data->pos.x + 28 && pingu->get_x() < data->pos.x +
32)
{
if (!upwards)
upwards = true;
}
if (upwards && pingu->get_x() > data->pos.x + 0 && pingu->get_x() <
data->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/09/04 14:55:13 torangan 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 HEADER_PINGUS_WORLDOBJS_BUMPER_HXX
#define HEADER_PINGUS_WORLDOBJS_BUMPER_HXX
#include "../worldobj.hxx"
namespace WorldObjsData {
class BumperData;
}
class Pingu;
namespace WorldObjs {
class Bumper : public WorldObj
{
private:
bool upwards;
int count;
WorldObjsData::BumperData* const data;
public:
Bumper (WorldObjsData::BumperData* data_);
~Bumper ();
float get_z_pos () const;
void draw_offset (int x, int y, float s);
void draw_colmap ();
void update (float delta);
private:
void catch_pingu (Pingu* pingu);
Bumper (const Bumper&);
Bumper operator= (const Bumper&);
};
}
#endif
/* EOF */
--- NEW FILE: fake_exit.cxx ---
// $Id: fake_exit.cxx,v 1.1 2002/09/04 14:55:13 torangan 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 "fake_exit.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../pingu_holder.hxx"
#include "../pingu.hxx"
#include "../worldobjsdata/fake_exit_data.hxx"
namespace WorldObjs {
FakeExit::FakeExit (WorldObjsData::FakeExitData* data_) : smashing(false),
data (new
WorldObjsData::FakeExitData(*data_))
{
data->counter.set_size(data->surface.get_num_frames());
data->counter.set_type(GameCounter::once);
data->counter.set_speed(2.5);
data->counter = data->surface.get_num_frames() - 1;
}
FakeExit::~FakeExit()
{
delete data;
}
float
FakeExit::get_z_pos () const
{
return data->pos.z;
}
void
FakeExit::draw_offset (int x, int y, float s)
{
if (s == 1.0) {
data->surface.put_screen(static_cast<int>(data->pos.x) + x,
static_cast<int>(data->pos.y) + y,
data->counter.value());
} else {
data->surface.put_screen(static_cast<int>((data->pos.x + x) * s),
static_cast<int>((data->pos.y + y) * s),
s, s, data->counter.value());
}
}
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)
++data->counter;
UNUSED_ARG(delta);
}
void
FakeExit::catch_pingu (Pingu* pingu)
{
if (data->counter.finished()) {
smashing = false;
}
if ( pingu->get_x() > data->pos.x + 31 && pingu->get_x() < data->pos.x +
31 + 15
&& pingu->get_y() > data->pos.y + 56 && pingu->get_y() < data->pos.y +
56 + 56)
{
if (!smashing) {
data->counter = 0;
smashing = true;
}
if (data->counter >= 3 && data->counter <= 5) {
pingu->set_action(Actions::Smashed);
}
}
}
}
/* EOF */
--- NEW FILE: fake_exit.hxx ---
// $Id: fake_exit.hxx,v 1.1 2002/09/04 14:55:13 torangan 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 HEADER_PINGUS_TRAPS_FAKE_EXIT_HXX
#define HEADER_PINGUS_TRAPS_FAKE_EXIT_HXX
#include "../worldobj.hxx"
namespace WorldObjsData {
class FakeExitData;
}
class Pingu;
namespace WorldObjs {
class FakeExit : public WorldObj
{
private:
bool smashing;
WorldObjsData::FakeExitData* const data;
public:
FakeExit (WorldObjsData::FakeExitData* data_);
~FakeExit ();
float get_z_pos () const;
void draw_offset (int x, int y, float s);
void update (float delta);
private:
void catch_pingu (Pingu*);
FakeExit (const FakeExit&);
FakeExit operator= (const FakeExit&);
};
}
#endif
/* EOF */
--- NEW FILE: guillotine.cxx ---
// $Id: guillotine.cxx,v 1.1 2002/09/04 14:55:13 torangan 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 "guillotine.hxx"
#include "../pingus_resource.hxx"
#include "../pingu_holder.hxx"
#include "../world.hxx"
#include "../pingu.hxx"
#include "../worldobj.hxx"
#include "../worldobjsdata/guillotine_data.hxx"
namespace WorldObjs {
Guillotine::Guillotine (WorldObjsData::GuillotineData* data_)
: killing(false),
data (new WorldObjsData::GuillotineData(*data_))
{
data->counter.set_size(data->surface.get_num_frames()/2);
data->counter.set_type(GameCounter::once);
data->counter.set_speed(0.7);
data->counter = 0;
data->idle_counter.set_size(data->idle_surf.get_num_frames());
data->idle_counter.set_type(GameCounter::loop);
data->idle_counter.set_speed(0.3);
data->idle_counter = 0;
}
Guillotine::~Guillotine ()
{
delete data;
}
void
Guillotine::draw_offset (int x, int y, float s)
{
if (killing) {
if (data->direction.is_left())
data->surface.put_screen(static_cast<int>(data->pos.x + x),
static_cast<int>(data->pos.y + y), data->counter);
else
data->surface.put_screen(static_cast<int>(data->pos.x + x),
static_cast<int>(data->pos.y + y), data->counter + 12);
} else {
data->idle_surf.put_screen(static_cast<int>(data->pos.x + x),
static_cast<int>(data->pos.y + y), data->idle_counter);
}
UNUSED_ARG(s);
}
float
Guillotine::get_z_pos () const
{
return data->pos.z;
}
void
Guillotine::update (float delta)
{
if (data->counter.finished()) {
data->counter = 0;
killing = false;
}
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
catch_pingu(*pingu);
if (killing) {
++data->counter;
} else {
++data->idle_counter;
}
UNUSED_ARG(delta);
}
void
Guillotine::catch_pingu (Pingu* pingu)
{
if (!killing)
{
if (pingu->is_inside (static_cast<int>(data->pos.x + 38),
static_cast<int>(data->pos.y + 90),
static_cast<int>(data->pos.x + 42),
static_cast<int>(data->pos.y + 98)))
{
killing = true;
pingu->set_status(PS_DEAD);
data->direction = pingu->direction;
}
}
}
}
/* EOF */
--- NEW FILE: guillotine.hxx ---
// $Id: guillotine.hxx,v 1.1 2002/09/04 14:55:13 torangan 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 HEADER_PINGUS_WORLDOBJS_GUILLOTINE_HXX
#define HEADER_PINGUS_WORLDOBJS_GUILLOTINE_HXX
#include "../worldobj.hxx"
namespace WorldObjsData {
class GuillotineData;
}
class Pingu;
namespace WorldObjs {
class Guillotine : public WorldObj
{
private:
bool killing;
WorldObjsData::GuillotineData* const data;
public:
Guillotine (WorldObjsData::GuillotineData* data_);
~Guillotine ();
float get_z_pos () const;
void update (float delta);
void draw_offset (int x, int y, float s);
protected:
void catch_pingu (Pingu*);
private:
Guillotine (const Guillotine&);
Guillotine operator= (const Guillotine&);
};
}
#endif
/* EOF */
--- NEW FILE: hammer.cxx ---
// $Id: hammer.cxx,v 1.1 2002/09/04 14:55:13 torangan 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 "hammer.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../pingu_holder.hxx"
#include "../pingu.hxx"
#include "../worldobjsdata/hammer_data.hxx"
namespace WorldObjs {
Hammer::Hammer (WorldObjsData::HammerData* data_) : particle_thrown(false),
data (new
WorldObjsData::HammerData(*data_))
{
data->counter.set_size(data->surface.get_num_frames());
data->counter.set_type(GameCounter::ping_pong);
data->counter.set_speed(1);
}
Hammer::~Hammer ()
{
delete data;
}
float
Hammer::get_z_pos () const
{
return data->pos.z;
}
void
Hammer::draw_offset (int x, int y, float s)
{
if (s == 1.0) {
data->surface.put_screen(static_cast<int>(data->pos.x + x),
static_cast<int>(data->pos.y + y),
data->counter.value());
} else {
data->surface.put_screen(static_cast<int>((data->pos.x + x) * s),
static_cast<int>((data->pos.y + y) * s),
s, s, data->counter.value());
}
}
void
Hammer::update (float delta)
{
if ( !data->counter)
particle_thrown = false;
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
catch_pingu(*pingu);
}
if ( !particle_thrown && data->counter ==
static_cast<int>(data->surface.get_num_frames() - 3)) {
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));
*/
}
++data->counter;
UNUSED_ARG(delta);
}
void
Hammer::catch_pingu (Pingu* pingu)
{
if (data->counter >= static_cast<int>(data->surface.get_num_frames() - 3)) {
if ( pingu->get_x() > data->pos.x + 55 && pingu->get_x() < data->pos.x
+ 77
&& pingu->get_y() > data->pos.y + 146 && pingu->get_y() < data->pos.y
+ 185)
pingu->set_action(Actions::Smashed);
}
}
}
/* EOF */
--- NEW FILE: hammer.hxx ---
// $Id: hammer.hxx,v 1.1 2002/09/04 14:55:13 torangan 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 HEADER_PINGUS_WORLDOBJS_HAMMER_HXX
#define HEADER_PINGUS_WORLDOBJS_HAMMER_HXX
#include "../worldobj.hxx"
namespace WorldObjsData {
class HammerData;
}
class Pingu;
namespace WorldObjs {
class Hammer : public WorldObj
{
private:
bool particle_thrown;
WorldObjsData::HammerData* const data;
public:
Hammer (WorldObjsData::HammerData* data_);
~Hammer ();
float get_z_pos () const;
void draw_offset (int x, int y, float s);
void update (float delta);
protected:
void catch_pingu (Pingu*);
private:
Hammer (const Hammer&);
Hammer operator= (const Hammer&);
};
}
#endif
/* EOF */
--- NEW FILE: laser_exit.cxx ---
// $Id: laser_exit.cxx,v 1.1 2002/09/04 14:55:13 torangan 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 "laser_exit.hxx"
#include "../world.hxx"
#include "../pingus_resource.hxx"
#include "../pingu_holder.hxx"
#include "../pingu.hxx"
#include "../pingu_action.hxx"
#include "../worldobjsdata/laser_exit_data.hxx"
namespace WorldObjs {
LaserExit::LaserExit (WorldObjsData::LaserExitData* data_) : killing(false),
data (new
WorldObjsData::LaserExitData(*data_))
{
data->counter.set_size(data->surface.get_num_frames());
data->counter.set_type(GameCounter::once);
data->counter.set_speed(5);
data->counter = 0;
}
LaserExit::~LaserExit ()
{
delete data;
}
float
LaserExit::get_z_pos () const
{
return data->pos.z;
}
void
LaserExit::draw_offset (int x, int y, float s)
{
if (s == 1.0) {
data->surface.put_screen(static_cast<int>(data->pos.x + x),
static_cast<int>(data->pos.y + y),
data->counter.value());
} else {
data->surface.put_screen(static_cast<int>((data->pos.x + x) * s),
static_cast<int>((data->pos.y + y) * s),
s, s, data->counter.value());
}
}
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 (data->counter.finished()) {
data->counter = 0;
killing = false;
} else {
++data->counter;
}
}
UNUSED_ARG(delta);
}
void
LaserExit::catch_pingu (Pingu* pingu)
{
if (!killing)
{
if ( pingu->get_x () < data->pos.x + 34 + 10 && pingu->get_x () >
data->pos.x + 34
&& pingu->get_y () < data->pos.y + 43 + 20 && pingu->get_y () >
data->pos.y + 43)
{
if (pingu->get_action()->get_type() != Actions::Laserkill)
{
killing = true;
pingu->set_action(Actions::Laserkill);
}
}
}
}
}
/* EOF */
--- NEW FILE: laser_exit.hxx ---
// $Id: laser_exit.hxx,v 1.1 2002/09/04 14:55:13 torangan 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 HEADER_PINGUS_WORLDOBJS_LASER_EXIT_HXX
#define HEADER_PINGUS_WORLDOBJS_LASER_EXIT_HXX
#include "../worldobj.hxx"
namespace WorldObjsData {
class LaserExitData;
}
class Pingu;
namespace WorldObjs {
class LaserExit : public WorldObj
{
private:
bool killing;
WorldObjsData::LaserExitData* const data;
public:
LaserExit (WorldObjsData::LaserExitData* data_);
~LaserExit ();
float get_z_pos () const;
void draw_offset (int x, int y, float s);
void update (float delta);
protected:
void catch_pingu (Pingu*);
private:
LaserExit (const LaserExit&);
LaserExit operator= (const LaserExit&);
};
}
#endif
/* EOF */
--- NEW FILE: smasher.cxx ---
// $Id: smasher.cxx,v 1.1 2002/09/04 14:55:13 torangan 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 "smasher.hxx"
#include "../col_map.hxx"
#include "../world.hxx"
#include "../pingu_holder.hxx"
#include "../pingus_resource.hxx"
#include "../sound.hxx"
#include "../particles/smoke_particle.hxx"
#include "../particles/particle_holder.hxx"
#include "../algo.hxx"
#include "../pingu.hxx"
#include "../worldobjsdata/smasher_data.hxx"
namespace WorldObjs {
Smasher::Smasher (WorldObjsData::SmasherData* data_) : smashing(false),
downwards(false),
count(0),
data (new
WorldObjsData::SmasherData(*data_))
{
}
Smasher::~Smasher ()
{
delete data;
}
float
Smasher::get_z_pos () const
{
return data->pos.z;
}
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(static_cast<int>(data->pos.x + 20
+ rand() % 260),
static_cast<int>(data->pos.y +
180),
frand()-0.5, frand()-0.5));
}
for (PinguIter pingu = holder->begin (); pingu != holder->end
(); ++pingu)
{
if ((*pingu)->is_inside(static_cast<int>(data->pos.x + 30),
static_cast<int>(data->pos.y + 90),
static_cast<int>(data->pos.x + 250),
static_cast<int>(data->pos.y +
190)))
{
(*pingu)->set_action(Actions::Splashed);
}
}
}
else
{
++count;
}
}
else
{
if (count <= 0) {
count = 0;
smashing = false;
} else {
--count;
}
}
}
UNUSED_ARG(delta);
}
void
Smasher::draw_colmap ()
{
std::cout << "Drawing colmap entry" << std::endl;
world->get_colmap()->put(PingusResource::load_surface("Traps/smasher_cmap",
"traps"),
static_cast<int>(data->pos.x),
static_cast<int>(data->pos.y),
GroundpieceData::GP_SOLID);
}
void
Smasher::draw_offset (int x, int y, float /*s*/)
{
data->surface.put_screen (static_cast<int>(data->pos.x + x),
static_cast<int>(data->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() > data->pos.x + 65
&& pingu->get_x() < data->pos.x + 85)
||
( pingu->direction.is_right()
&& pingu->get_x() > data->pos.x + 190
&& pingu->get_x() < data->pos.x + 210))
{
if (!smashing)
{
count = 0;
downwards = true;
smashing = true;
}
}
}
}
/* EOF */
--- NEW FILE: smasher.hxx ---
// $Id: smasher.hxx,v 1.1 2002/09/04 14:55:13 torangan 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 HEADER_PINGUS_WORLDOBJS_SMASHER_HXX
#define HEADER_PINGUS_WORLDOBJS_SMASHER_HXX
#include "../worldobj.hxx"
namespace WorldObjsData {
class SmasherData;
}
class Pingu;
namespace WorldObjs {
class Smasher : public WorldObj
{
private:
bool smashing;
bool downwards;
int count;
WorldObjsData::SmasherData* const data;
public:
Smasher (WorldObjsData::SmasherData* data_);
~Smasher ();
float get_z_pos () const;
void draw_offset (int x, int y, float s);
void draw_colmap ();
void update (float delta);
protected:
void catch_pingu (Pingu* pingu);
private:
Smasher (const Smasher&);
Smasher operator= (const Smasher&);
};
}
#endif
/* EOF */
--- NEW FILE: spike.cxx ---
// $Id: spike.cxx,v 1.1 2002/09/04 14:55:13 torangan 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"
#include "../worldobjsdata/spike_data.hxx"
namespace WorldObjs {
Spike::Spike (WorldObjsData::SpikeData* data_) : killing(false),
data (new
WorldObjsData::SpikeData(*data_))
{
data->counter.set_size(data->surface.get_num_frames());
data->counter.set_type(GameCounter::once);
data->counter.set_speed(1);
data->counter = 0;
}
Spike::~Spike ()
{
delete data;
}
float
Spike::get_z_pos () const
{
return data->pos.z;
}
void
Spike::draw_offset (int x, int y, float /*s*/)
{
if (killing) {
data->surface.put_screen(static_cast<int>(data->pos.x + x),
static_cast<int>(data->pos.y + y),
data->counter);
} else {
// do nothing
}
}
void
Spike::update (float /*delta*/)
{
if (killing)
++data->counter;
PinguHolder* holder = world->get_pingu_p ();
for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
catch_pingu(*pingu);
}
if (data->counter == static_cast<int>(data->surface.get_num_frames()) - 1) {
killing = false;
data->counter = 0;
}
}
void
Spike::catch_pingu (Pingu* pingu)
{
if (!killing) {
if ( pingu->get_x () > data->pos.x + 16 - 5 && pingu->get_x () <
data->pos.x + 16 + 5
&& pingu->get_y () > data->pos.y && pingu->get_y () <
data->pos.y + 32)
{
data->counter = 0;
killing = true;
}
} else {
if ( data->counter == 3
&& pingu->get_x () > data->pos.x +16 - 12 && pingu->get_x () <
data->pos.x + 16 + 12
&& pingu->get_y () > data->pos.y && pingu->get_y () <
data->pos.y + 32)
{
pingu->set_status(PS_DEAD);
}
}
}
}
/* EOF */
--- NEW FILE: spike.hxx ---
// $Id: spike.hxx,v 1.1 2002/09/04 14:55:13 torangan 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 HEADER_PINGUS_TRAPS_SPIKE_HXX
#define HEADER_PINGUS_TRAPS_SPIKE_HXX
#include "../worldobj.hxx"
namespace WorldObjsData {
class SpikeData;
}
class Pingu;
namespace WorldObjs {
class Spike : public WorldObj
{
private:
bool killing;
WorldObjsData::SpikeData* data;
public:
Spike (WorldObjsData::SpikeData* data_);
~Spike ();
float get_z_pos () const;
void draw_offset (int x_of, int y_of, float s = 1.0);
void update (float delta);
protected:
void catch_pingu (Pingu*);
private:
Spike (const Spike&);
Spike operator= (const Spike&);
};
}
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile.am 12 Jun 2002 19:03:10 -0000 1.6
+++ Makefile.am 4 Sep 2002 14:55:12 -0000 1.7
@@ -20,10 +20,17 @@
noinst_LIBRARIES = libpingus_worldobjs.a
libpingus_worldobjs_a_SOURCES = \
- teleporter.cxx teleporter.hxx \
- ice_block.cxx ice_block.hxx \
+ bumper.cxx bumper.hxx \
conveyor_belt.cxx conveyor_belt.hxx \
+ fake_exit.cxx fake_exit.hxx \
+ guillotine.cxx guillotine.hxx \
+ hammer.cxx hammer.hxx \
+ ice_block.cxx ice_block.hxx \
+ info_box.cxx info_box.hxx \
+ laser_exit.cxx laser_exit.hxx \
+ smasher.cxx smasher.hxx \
+ spike.cxx spike.hxx \
switch_door.cxx switch_door.hxx \
- info_box.cxx info_box.hxx
+ teleporter.cxx teleporter.hxx
## EOF ##
Index: conveyor_belt.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- conveyor_belt.cxx 23 Aug 2002 15:49:57 -0000 1.7
+++ conveyor_belt.cxx 4 Sep 2002 14:55:13 -0000 1.8
@@ -227,8 +227,8 @@
std::string
EditorConveyorBeltObj::status_line()
{
- char str[1024];
- sprintf (str, "ConveyorBelt - (%f, %f, %f) Speed: %f", pos.x, pos.y, pos.z,
speed);
+ char str[256];
+ snprintf (str, 256, "ConveyorBelt - (%f, %f, %f) Speed: %f", pos.x, pos.y,
pos.z, speed);
return str;
}
Index: ice_block.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ice_block.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ice_block.cxx 23 Aug 2002 15:49:57 -0000 1.8
+++ ice_block.cxx 4 Sep 2002 14:55:13 -0000 1.9
@@ -42,7 +42,6 @@
<< " </worldobj>\n" << std::endl;
}
-///
IceBlockData::IceBlockData (xmlDocPtr doc, xmlNodePtr cur)
{
cur = cur->children;
@@ -92,7 +91,6 @@
last_contact = 0;
}
-///
void
IceBlock::draw_colmap()
{
@@ -168,8 +166,8 @@
std::string
EditorIceBlockObj::status_line()
{
- char str[1024];
- sprintf (str, "IceBlock - %f %f %f", pos.x, pos.y, pos.z);
+ char str[256];
+ snprintf (str, 256, "IceBlock - %f %f %f", pos.x, pos.y, pos.z);
return str;
}
Index: switch_door.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- switch_door.cxx 23 Aug 2002 15:49:57 -0000 1.7
+++ switch_door.cxx 4 Sep 2002 14:55:13 -0000 1.8
@@ -289,8 +289,8 @@
std::string
EditorSwitchDoorObj::status_line()
{
- char str[1024];
- sprintf (str, "SwitchDoor - (%f %f %f)",
+ char str[128];
+ snprintf (str, 128, "SwitchDoor - (%f %f %f)",
door_pos.x, door_pos.y, door_pos.z);
return str;
}
Index: teleporter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/teleporter.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- teleporter.cxx 23 Aug 2002 15:49:57 -0000 1.5
+++ teleporter.cxx 4 Sep 2002 14:55:13 -0000 1.6
@@ -236,10 +236,9 @@
std::string
EditorTeleporterObj::status_line()
{
- // FIXME: replace with string streams
- char str[1024];
- sprintf (str, "Teleporter - %f %f %f",
- pos.x, pos.y, pos.z);
+ char str[128];
+ snprintf (str, 128, "Teleporter - %f %f %f",
+ pos.x, pos.y, pos.z);
return str;
}
@@ -257,9 +256,9 @@
std::string
EditorTeleporterTargetObj::status_line()
{
- char str[1024];
- sprintf (str, "TeleporterTarget - %f %f %f",
- pos_ref.x, pos_ref.y, pos_ref.z);
+ char str[128];
+ snprintf (str, 128, "TeleporterTarget - %f %f %f",
+ pos_ref.x, pos_ref.y, pos_ref.z);
return str;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjs 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 conveyor_belt.cxx,1.7,1.8 ice_block.cxx,1.8,1.9 switch_door.cxx,1.7,1.8 teleporter.cxx,1.5,1.6,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.7,1.8 angel.hxx,1.7,1.8 basher.cxx,1.11,1.12 basher.hxx,1.7,1.8 blocker.cxx,1.5,1.6 boarder.cxx,1.5,1.6 bomber.cxx,1.9,1.10 bridger.cxx,1.11,1.12 climber.cxx,1.7,1.8 digger.cxx,1.9,1.10 drown.cxx,1.4,1.5 exiter.cxx,1.4,1.5 faller.cxx,1.16,1.17 floater.cxx,1.11,1.12 jumper.cxx,1.7,1.8 miner.cxx,1.7,1.8 rocket_launcher.cxx,1.5,1.6 slider.cxx,1.5,1.6 smashed.cxx,1.3,1.4 splashed.cxx,1.4,1.5 superman.cxx,1.3,1.4 waiter.cxx,1.4,1.5 walker.cxx,1.17,1.18
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.91,1.92 blitter.cxx,1.12,1.13 button_panel.hxx,1.9,1.10 capture_rectangle.cxx,1.5,1.6 client.cxx,1.17,1.18 config.cxx,1.4,1.5 console.hxx,1.7,1.8 credits.cxx,1.9,1.10 direction.hxx,1.4,1.5 fps_counter.cxx,1.3,1.4 fps_counter.hxx,1.3,1.4 game_counter.hxx,1.4,1.5 groundpiece_data.hxx,1.11,1.12 level_desc.cxx,1.6,1.7 level_result.cxx,1.3,1.4 multiplayer_client_child.cxx,1.9,1.10 pingu.cxx,1.20,1.21 pingu.hxx,1.11,1.12 pingu_action.cxx,1.6,1.7 pingu_action.hxx,1.12,1.13 pingu_holder.cxx,1.4,1.5 pingu_info.cxx,1.3,1.4 pingus_counter.cxx,1.4,1.5 pingus_menu.hxx,1.6,1.7 pingus_menu_manager.hxx,1.9,1.10 pingus_resource.hxx,1.7,1.8 playfield.cxx,1.18,1.19 plt_parser.cxx,1.4,1.5 res_descriptor.hxx,1.6,1.7 screenshot.cxx,1.5,1.6 server.cxx,1.12,1.13 server.hxx,1.4,1.5 smallmap.cxx,1.11,1.12 sound_real.cxx,1.6,1.7 spot_map.cxx,1.8,1.9 string_converter.cxx,1.5,1.6 time_display.cxx,1.4,1.5 trap_data.cxx,1.6,1.7 worldobj.cxx,1.3,1.4 worldobj.hxx,1.4,1.5 worldobj_data.hxx,1.5,1.6 worldobj_data_factory.cxx,1.3,1.4 xml_plf.cxx,1.11,1.12 xml_plf.hxx,1.4,1.5
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.7,1.8 angel.hxx,1.7,1.8 basher.cxx,1.11,1.12 basher.hxx,1.7,1.8 blocker.cxx,1.5,1.6 boarder.cxx,1.5,1.6 bomber.cxx,1.9,1.10 bridger.cxx,1.11,1.12 climber.cxx,1.7,1.8 digger.cxx,1.9,1.10 drown.cxx,1.4,1.5 exiter.cxx,1.4,1.5 faller.cxx,1.16,1.17 floater.cxx,1.11,1.12 jumper.cxx,1.7,1.8 miner.cxx,1.7,1.8 rocket_launcher.cxx,1.5,1.6 slider.cxx,1.5,1.6 smashed.cxx,1.3,1.4 splashed.cxx,1.4,1.5 superman.cxx,1.3,1.4 waiter.cxx,1.4,1.5 walker.cxx,1.17,1.18
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src Makefile.am,1.91,1.92 blitter.cxx,1.12,1.13 button_panel.hxx,1.9,1.10 capture_rectangle.cxx,1.5,1.6 client.cxx,1.17,1.18 config.cxx,1.4,1.5 console.hxx,1.7,1.8 credits.cxx,1.9,1.10 direction.hxx,1.4,1.5 fps_counter.cxx,1.3,1.4 fps_counter.hxx,1.3,1.4 game_counter.hxx,1.4,1.5 groundpiece_data.hxx,1.11,1.12 level_desc.cxx,1.6,1.7 level_result.cxx,1.3,1.4 multiplayer_client_child.cxx,1.9,1.10 pingu.cxx,1.20,1.21 pingu.hxx,1.11,1.12 pingu_action.cxx,1.6,1.7 pingu_action.hxx,1.12,1.13 pingu_holder.cxx,1.4,1.5 pingu_info.cxx,1.3,1.4 pingus_counter.cxx,1.4,1.5 pingus_menu.hxx,1.6,1.7 pingus_menu_manager.hxx,1.9,1.10 pingus_resource.hxx,1.7,1.8 playfield.cxx,1.18,1.19 plt_parser.cxx,1.4,1.5 res_descriptor.hxx,1.6,1.7 screenshot.cxx,1.5,1.6 server.cxx,1.12,1.13 server.hxx,1.4,1.5 smallmap.cxx,1.11,1.12 sound_real.cxx,1.6,1.7 spot_map.cxx,1.8,1.9 string_converter.cxx,1.5,1.6 time_display.cxx,1.4,1.5 trap_data.cxx,1.6,1.7 worldobj.cxx,1.3,1.4 worldobj.hxx,1.4,1.5 worldobj_data.hxx,1.5,1.6 worldobj_data_factory.cxx,1.3,1.4 xml_plf.cxx,1.11,1.12 xml_plf.hxx,1.4,1.5
- Index(es):