[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.2,1.3 conveyor
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.2,1.3 conveyor_belt.cxx,1.9,1.10 conveyor_belt.hxx,1.7,1.8 fake_exit.hxx,1.2,1.3 guillotine.cxx,1.2,1.3 guillotine.hxx,1.2,1.3 hammer.cxx,1.2,1.3 info_box.cxx,1.9,1.10 info_box.hxx,1.8,1.9 laser_exit.cxx,1.2,1.3 laser_exit.hxx,1.2,1.3 smasher.cxx,1.2,1.3 smasher.hxx,1.2,1.3 spike.cxx,1.2,1.3 spike.hxx,1.2,1.3 switch_door.cxx,1.10,1.11 switch_door.hxx,1.8,1.9 teleporter.cxx,1.8,1.9 teleporter.hxx,1.11,1.12 |
Date: |
10 Sep 2002 19:24:22 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv5031/src/worldobjs
Modified Files:
bumper.cxx conveyor_belt.cxx conveyor_belt.hxx fake_exit.hxx
guillotine.cxx guillotine.hxx hammer.cxx 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 teleporter.cxx teleporter.hxx
Log Message:
changed indention of namespaces in a few places
Index: bumper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/bumper.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- bumper.cxx 5 Sep 2002 11:26:35 -0000 1.2
+++ bumper.cxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -29,78 +29,78 @@
namespace WorldObjs {
- Bumper::Bumper (WorldObjsData::BumperData* data_) : upwards(false),
- count(0),
- data(new
WorldObjsData::BumperData(*data_))
- {
- assert(data);
- }
+Bumper::Bumper (WorldObjsData::BumperData* data_) : upwards(false),
+ count(0),
+ data(new
WorldObjsData::BumperData(*data_))
+{
+ assert(data);
+}
- Bumper::~Bumper ()
- {
- delete data;
- }
+Bumper::~Bumper ()
+{
+ delete data;
+}
- float
- Bumper::get_z_pos () const
- {
- return data->pos.z;
+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);
}
- 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;
+ }
}
-
- 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;
+ UNUSED_ARG(delta);
+}
- 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_colmap()
+{
+ std::cout << "Drawing colmap entry" << std::endl;
- void
- Bumper::draw (GraphicContext& gc)
- {
- gc.draw (data->surface, data->pos, count);
- }
+ 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::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;
- }
+void
+Bumper::draw (GraphicContext& gc)
+{
+ gc.draw (data->surface, data->pos, count);
+}
- 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));
- }
- }
- }
+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));
+ }
+ }
}
+
+} // namespace WorldObjs
/* EOF */
Index: conveyor_belt.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- conveyor_belt.cxx 4 Sep 2002 19:40:20 -0000 1.9
+++ conveyor_belt.cxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -28,6 +28,8 @@
#include "conveyor_belt.hxx"
#include "../pingu.hxx"
+namespace WorldObjsData {
+
ConveyorBeltData::ConveyorBeltData () : width(5), speed(2)
{
}
@@ -98,21 +100,25 @@
WorldObj*
ConveyorBeltData::create_WorldObj ()
{
- return new ConveyorBelt (this);
+ return new WorldObjs::ConveyorBelt (this);
}
EditorObjLst
ConveyorBeltData::create_EditorObj ()
{
EditorObjLst lst;
- lst.push_back(new EditorConveyorBeltObj (*this));
+ lst.push_back(new EditorObjs::EditorConveyorBeltObj (*this));
return lst;
}
+} // namespace WorldObjsData
+
/***********************/
/* ConveyorBelt */
/***********************/
+namespace WorldObjs {
+
ConveyorBelt::ConveyorBelt (WorldObjData* data)
{
left_sur = PingusResource::load_surface ("conveyorbelt_left", "worldobjs");
@@ -175,10 +181,14 @@
}
}
+} // namespace WorldObjs
+
/*************************/
/* EditorConveyorBeltObj */
/*************************/
+namespace EditorObjs {
+
EditorConveyorBeltObj::EditorConveyorBeltObj (const ConveyorBeltData& data)
: ConveyorBeltData (data)
{
@@ -267,5 +277,7 @@
if (ConveyorBeltData::width < 0)
ConveyorBeltData::width = 0;
}
+
+} // namespace EditorObjs
/* EOF */
Index: conveyor_belt.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- conveyor_belt.hxx 4 Sep 2002 19:40:20 -0000 1.7
+++ conveyor_belt.hxx 10 Sep 2002 19:24:19 -0000 1.8
@@ -24,6 +24,8 @@
#include "../worldobj_data.hxx"
#include "../editor/rect_editorobj.hxx"
+namespace WorldObjsData {
+
class ConveyorBeltData : public WorldObjData
{
public:
@@ -49,7 +51,13 @@
EditorObjLst create_EditorObj ();
};
-class ConveyorBelt : private ConveyorBeltData,
+} // namespace WorldObjsData
+
+
+namespace WorldObjs {
+
+// FIXME: Make ConveyorBeltData
+class ConveyorBelt : private WorldObjsData::ConveyorBeltData,
public WorldObj
{
private:
@@ -71,8 +79,12 @@
ConveyorBelt operator= (const ConveyorBelt&);
};
+} // namespace WorldObjs
+
+namespace EditorObjs {
+
class EditorConveyorBeltObj : public RectEditorObj,
- public ConveyorBeltData
+ public WorldObjsData::ConveyorBeltData
{
private:
CL_Surface left_sur;
@@ -112,6 +124,8 @@
EditorConveyorBeltObj (const EditorConveyorBeltObj&);
EditorConveyorBeltObj operator= (const EditorConveyorBeltObj&);
};
+
+} // namespace EditorObjs
#endif
Index: fake_exit.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/fake_exit.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fake_exit.hxx 5 Sep 2002 11:26:35 -0000 1.2
+++ fake_exit.hxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -22,38 +22,41 @@
#include "../worldobj.hxx"
-namespace WorldObjsData {
- class FakeExitData;
-}
-
class Pingu;
+namespace WorldObjsData {
+class FakeExitData;
+} // namespace WorldObjsData
+
namespace WorldObjs {
- class FakeExit : public WorldObj
- {
- private:
- bool smashing;
- WorldObjsData::FakeExitData* const data;
+/** The FakeExit is an object that looks similar to the traditional
+ IceExit, but is really a trap that smashed all pingus that try to
+ enter it. */
+class FakeExit : public WorldObj
+{
+private:
+ bool smashing;
+ WorldObjsData::FakeExitData* const data;
- public:
- FakeExit (WorldObjsData::FakeExitData* data_);
- ~FakeExit ();
+public:
+ FakeExit (WorldObjsData::FakeExitData* data_);
+ ~FakeExit ();
- float get_z_pos () const;
+ float get_z_pos () const;
- void draw (GraphicContext& gc);
+ void draw (GraphicContext& gc);
- void update (float delta);
+ void update (float delta);
- private:
- void catch_pingu (Pingu*);
+private:
+ void catch_pingu (Pingu*);
- FakeExit (const FakeExit&);
- FakeExit operator= (const FakeExit&);
- };
+ FakeExit (const FakeExit&);
+ FakeExit operator= (const FakeExit&);
+};
-}
+} // namespace WorldObjs
#endif
Index: guillotine.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/guillotine.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- guillotine.cxx 4 Sep 2002 19:40:20 -0000 1.2
+++ guillotine.cxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -28,82 +28,83 @@
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;
+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;
- }
+ 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;
- }
+Guillotine::~Guillotine ()
+{
+ delete data;
+}
- void
- Guillotine::draw (GraphicContext& gc)
- {
- if (killing) {
- if (data->direction.is_left())
- gc.draw(data->surface, data->pos, data->counter);
- else
- gc.draw (data->surface, data->pos, data->counter + 12);
- } else {
- gc.draw (data->idle_surf, data->pos, data->idle_counter);
- }
- }
+void
+Guillotine::draw (GraphicContext& gc)
+{
+ if (killing) {
+ if (data->direction.is_left())
+ gc.draw(data->surface, data->pos, data->counter);
+ else
+ gc.draw (data->surface, data->pos, data->counter + 12);
+ } else {
+ gc.draw (data->idle_surf, data->pos, data->idle_counter);
+ }
+}
- float
- Guillotine::get_z_pos () const
- {
- return data->pos.z;
+float
+Guillotine::get_z_pos () const
+{
+ return data->pos.z;
+}
+
+void
+Guillotine::update (float delta)
+{
+ if (data->counter.finished()) {
+ data->counter = 0;
+ killing = false;
}
- 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);
- 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);
+}
- if (killing) {
- ++data->counter;
- } else {
- ++data->idle_counter;
+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;
+ }
}
-
- 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;
- }
- }
- }
+} // namespace WorldObjs
-}
/* EOF */
Index: guillotine.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/guillotine.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- guillotine.hxx 4 Sep 2002 19:40:20 -0000 1.2
+++ guillotine.hxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -23,7 +23,7 @@
#include "../worldobj.hxx"
namespace WorldObjsData {
- class GuillotineData;
+class GuillotineData;
}
class Pingu;
@@ -31,29 +31,29 @@
namespace WorldObjs {
- class Guillotine : public WorldObj
- {
- private:
- bool killing;
- WorldObjsData::GuillotineData* const data;
+class Guillotine : public WorldObj
+{
+private:
+ bool killing;
+ WorldObjsData::GuillotineData* const data;
- public:
- Guillotine (WorldObjsData::GuillotineData* data_);
- ~Guillotine ();
+public:
+ Guillotine (WorldObjsData::GuillotineData* data_);
+ ~Guillotine ();
- float get_z_pos () const;
+ float get_z_pos () const;
- void update (float delta);
- void draw (GraphicContext& gc);
- protected:
- void catch_pingu (Pingu*);
+ void update (float delta);
+ void draw (GraphicContext& gc);
+protected:
+ void catch_pingu (Pingu*);
- private:
- Guillotine (const Guillotine&);
- Guillotine operator= (const Guillotine&);
- };
+private:
+ Guillotine (const Guillotine&);
+ Guillotine operator= (const Guillotine&);
+};
-}
+} // namespace WorldObjs
#endif
Index: hammer.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/hammer.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- hammer.cxx 5 Sep 2002 11:26:35 -0000 1.2
+++ hammer.cxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -26,66 +26,66 @@
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 (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;
- }
+Hammer::~Hammer ()
+{
+ delete data;
+}
- float
- Hammer::get_z_pos () const
- {
- return data->pos.z;
- }
+float
+Hammer::get_z_pos () const
+{
+ return data->pos.z;
+}
- void
- Hammer::draw (GraphicContext& gc)
- {
- gc.draw (data->surface, data->pos, data->counter.value());
- }
+void
+Hammer::draw (GraphicContext& gc)
+{
+ gc.draw (data->surface, data->pos, data->counter.value());
+}
- void
- Hammer::update (float delta)
- {
- if ( !data->counter)
- particle_thrown = false;
+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);
- }
+ 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;
- /*
+ 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);
+ 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);
- }
+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);
}
-
}
+
+} // namespace WorldObjs
/* EOF */
Index: info_box.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/info_box.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- info_box.cxx 10 Sep 2002 14:33:08 -0000 1.9
+++ info_box.cxx 10 Sep 2002 19:24:19 -0000 1.10
@@ -28,6 +28,8 @@
#include "info_box.hxx"
#include "../pingu.hxx"
+namespace WorldObjsData {
+
InfoBoxData::InfoBoxData ()
{
}
@@ -39,14 +41,14 @@
WorldObj*
InfoBoxData::create_WorldObj()
{
- return new InfoBox (*this);
+ return new WorldObjs::InfoBox (*this);
}
EditorObjLst
InfoBoxData::create_EditorObj()
{
EditorObjLst lst;
- lst.push_back (new EditorInfoBox (*this));
+ lst.push_back (new EditorObjs::EditorInfoBox (*this));
return lst;
}
@@ -106,7 +108,11 @@
<< " </worldobj>\n" << std::endl;
}
-InfoBox::InfoBox (const InfoBoxData& data)
+} // namespace WorldObjsData
+
+namespace WorldObjs {
+
+InfoBox::InfoBox (const WorldObjsData::InfoBoxData& data)
: InfoBoxData (data),
sprite ("infobox", "worldobjs"),
is_open (false)
@@ -157,6 +163,10 @@
}
}
+} // namespace WorldObjs
+
+namespace EditorObjs {
+
EditorInfoBox::EditorInfoBox(const InfoBoxData& data)
: InfoBoxData (data),
SpriteEditorObj ("infobox", "worldobjs", &pos)
@@ -202,5 +212,7 @@
{
return "InfoBox";
}
+
+} // namespace EditorObjs
/* EOF */
Index: info_box.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/info_box.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- info_box.hxx 4 Sep 2002 19:40:20 -0000 1.8
+++ info_box.hxx 10 Sep 2002 19:24:19 -0000 1.9
@@ -29,6 +29,8 @@
#include "../libxmlfwd.hxx"
+namespace WorldObjsData {
+
class InfoBoxData : public WorldObjData
{
public:
@@ -50,8 +52,13 @@
EditorObjLst create_EditorObj();
};
-class InfoBox : public InfoBoxData,
- public WorldObj
+} // namespace WorldObjsData
+
+namespace WorldObjs {
+
+// FIXME: Split data into member var
+class InfoBox : public WorldObjsData::InfoBoxData,
+ public WorldObj
{
private:
Sprite sprite;
@@ -70,8 +77,12 @@
InfoBox operator= (const InfoBox&);
};
-class EditorInfoBox : public InfoBoxData,
- public SpriteEditorObj
+} // namespace WorldObjs
+
+namespace EditorObjs {
+
+class EditorInfoBox : public WorldObjsData::InfoBoxData,
+ public SpriteEditorObj
{
public:
EditorInfoBox (const InfoBoxData& data);
@@ -86,6 +97,8 @@
EditorInfoBox (const EditorInfoBox& old);
EditorInfoBox operator= (const EditorInfoBox& old);
};
+
+} // namespace EditorObjs
#endif
Index: laser_exit.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/laser_exit.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- laser_exit.cxx 5 Sep 2002 11:26:35 -0000 1.2
+++ laser_exit.cxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -27,70 +27,70 @@
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;
- }
+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;
+}
- float
- LaserExit::get_z_pos () const
- {
- return data->pos.z;
- }
+LaserExit::~LaserExit ()
+{
+ delete data;
+}
- void
- LaserExit::draw (GraphicContext& gc)
- {
- gc.draw (data->surface, data->pos, data->counter.value());
- }
+float
+LaserExit::get_z_pos () const
+{
+ return data->pos.z;
+}
- void
- LaserExit::update (float delta)
- {
+void
+LaserExit::draw (GraphicContext& gc)
+{
+ gc.draw (data->surface, data->pos, data->counter.value());
+}
- PinguHolder* holder = world->get_pingu_p ();
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
- catch_pingu(*pingu);
- }
+void
+LaserExit::update (float delta)
+{
- if (killing) {
- if (data->counter.finished()) {
- data->counter = 0;
- killing = false;
- } else {
- ++data->counter;
- }
- }
-
- UNUSED_ARG(delta);
+ PinguHolder* holder = world->get_pingu_p ();
+ for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
+ catch_pingu(*pingu);
}
- 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);
- }
- }
- }
+ 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);
+ }
+ }
+ }
}
+
+} // namespace WorldObjs
/* EOF */
Index: laser_exit.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/laser_exit.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- laser_exit.hxx 5 Sep 2002 11:26:35 -0000 1.2
+++ laser_exit.hxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -23,39 +23,37 @@
#include "../worldobj.hxx"
namespace WorldObjsData {
- class LaserExitData;
-}
+class LaserExitData;
+} // namespace WorldObjsData
class Pingu;
-
namespace WorldObjs {
- class LaserExit : public WorldObj
- {
- private:
- bool killing;
- WorldObjsData::LaserExitData* const data;
+class LaserExit : public WorldObj
+{
+private:
+ bool killing;
+ WorldObjsData::LaserExitData* const data;
- public:
- LaserExit (WorldObjsData::LaserExitData* data_);
- ~LaserExit ();
-
- float get_z_pos () const;
+public:
+ LaserExit (WorldObjsData::LaserExitData* data_);
+ ~LaserExit ();
- void draw (GraphicContext& gc);
- void update (float delta);
+ float get_z_pos () const;
- protected:
- void catch_pingu (Pingu*);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- private:
- LaserExit (const LaserExit&);
- LaserExit operator= (const LaserExit&);
- };
+protected:
+ void catch_pingu (Pingu*);
-}
+private:
+ LaserExit (const LaserExit&);
+ LaserExit operator= (const LaserExit&);
+};
+} // namespace WorldObjs
#endif
Index: smasher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/smasher.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- smasher.cxx 5 Sep 2002 11:26:35 -0000 1.2
+++ smasher.cxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -31,119 +31,119 @@
namespace WorldObjs {
- Smasher::Smasher (WorldObjsData::SmasherData* data_) : smashing(false),
- downwards(false),
- count(0),
- data (new
WorldObjsData::SmasherData(*data_))
- {
- }
+Smasher::Smasher (WorldObjsData::SmasherData* data_) : smashing(false),
+ downwards(false),
+ count(0),
+ data (new
WorldObjsData::SmasherData(*data_))
+{
+}
- Smasher::~Smasher ()
- {
- delete data;
- }
+Smasher::~Smasher ()
+{
+ delete data;
+}
- float
- Smasher::get_z_pos () const
- {
- return data->pos.z;
- }
+float
+Smasher::get_z_pos () const
+{
+ return data->pos.z;
+}
- void
- Smasher::update (float delta)
- {
+void
+Smasher::update (float delta)
+{
- PinguHolder* holder = world->get_pingu_p();
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
- catch_pingu(*pingu);
+ 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);
+ 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(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;
+ 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);
- }
+ UNUSED_ARG(delta);
+}
- void
- Smasher::draw (GraphicContext& gc)
- {
- gc.draw (data->surface, data->pos, count);
- }
+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::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;
- }
- }
- }
+void
+Smasher::draw (GraphicContext& gc)
+{
+ gc.draw (data->surface, data->pos, 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;
+ }
+ }
}
+
+} // namespace WorldObjs
/* EOF */
Index: smasher.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/smasher.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- smasher.hxx 5 Sep 2002 11:26:35 -0000 1.2
+++ smasher.hxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -23,41 +23,40 @@
#include "../worldobj.hxx"
namespace WorldObjsData {
- class SmasherData;
+class SmasherData;
}
class Pingu;
-
namespace WorldObjs {
- class Smasher : public WorldObj
- {
- private:
- bool smashing;
- bool downwards;
- int count;
- WorldObjsData::SmasherData* const data;
+class Smasher : public WorldObj
+{
+private:
+ bool smashing;
+ bool downwards;
+ int count;
+ WorldObjsData::SmasherData* const data;
- public:
- Smasher (WorldObjsData::SmasherData* data_);
- ~Smasher ();
+public:
+ Smasher (WorldObjsData::SmasherData* data_);
+ ~Smasher ();
- float get_z_pos () const;
+ float get_z_pos () const;
- void draw (GraphicContext& gc);
- void draw_colmap ();
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void draw_colmap ();
+ void update (float delta);
- protected:
- void catch_pingu (Pingu* pingu);
+protected:
+ void catch_pingu (Pingu* pingu);
- private:
- Smasher (const Smasher&);
- Smasher operator= (const Smasher&);
- };
+private:
+ Smasher (const Smasher&);
+ Smasher operator= (const Smasher&);
+};
-}
+} // namespace WorldObjs
#endif
Index: spike.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/spike.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- spike.cxx 5 Sep 2002 11:26:35 -0000 1.2
+++ spike.cxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -26,73 +26,73 @@
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 (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;
- }
+Spike::~Spike ()
+{
+ delete data;
+}
- float
- Spike::get_z_pos () const
- {
- return data->pos.z;
- }
+float
+Spike::get_z_pos () const
+{
+ return data->pos.z;
+}
- void
- Spike::draw (GraphicContext& gc)
- {
- if (killing) {
- gc.draw (data->surface, data->pos, data->counter);
- } else {
- // do nothing
- }
+void
+Spike::draw (GraphicContext& gc)
+{
+ if (killing) {
+ gc.draw (data->surface, data->pos, 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);
- }
+void
+Spike::update (float /*delta*/)
+{
+ if (killing)
+ ++data->counter;
- if (data->counter == static_cast<int>(data->surface.get_num_frames()) - 1)
{
- killing = false;
- data->counter = 0;
- }
+ PinguHolder* holder = world->get_pingu_p ();
+ for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu){
+ catch_pingu(*pingu);
}
- 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);
- }
- }
+ 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);
+ }
+ }
}
+
+} // namespace WorldObjs
/* EOF */
Index: spike.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/spike.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- spike.hxx 5 Sep 2002 11:26:35 -0000 1.2
+++ spike.hxx 10 Sep 2002 19:24:19 -0000 1.3
@@ -23,38 +23,38 @@
#include "../worldobj.hxx"
namespace WorldObjsData {
- class SpikeData;
-}
+class SpikeData;
+} // namespace WorldObjsData
class Pingu;
namespace WorldObjs {
- class Spike : public WorldObj
- {
- private:
- bool killing;
- WorldObjsData::SpikeData* data;
+class Spike : public WorldObj
+{
+private:
+ bool killing;
+ WorldObjsData::SpikeData* data;
- public:
- Spike (WorldObjsData::SpikeData* data_);
- ~Spike ();
+public:
+ Spike (WorldObjsData::SpikeData* data_);
+ ~Spike ();
- float get_z_pos () const;
+ float get_z_pos () const;
- void draw (GraphicContext& gc);
- void update (float delta);
+ void draw (GraphicContext& gc);
+ void update (float delta);
- protected:
- void catch_pingu (Pingu*);
+protected:
+ void catch_pingu (Pingu*);
- private:
- Spike (const Spike&);
- Spike operator= (const Spike&);
- };
+private:
+ Spike (const Spike&);
+ Spike operator= (const Spike&);
+};
-}
+} // namespace WorldObjs
#endif
Index: switch_door.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- switch_door.cxx 10 Sep 2002 14:33:08 -0000 1.10
+++ switch_door.cxx 10 Sep 2002 19:24:19 -0000 1.11
@@ -27,6 +27,8 @@
#include "switch_door.hxx"
#include "../pingu.hxx"
+namespace WorldObjsData {
+
SwitchDoorData::SwitchDoorData () : door_height(10)
{
}
@@ -132,7 +134,7 @@
WorldObj*
SwitchDoorData::create_WorldObj ()
{
- return new SwitchDoor (*this);
+ return new WorldObjs::SwitchDoor (*this);
}
/** Create an EditorObj from the given data object */
@@ -140,15 +142,18 @@
SwitchDoorData::create_EditorObj ()
{
EditorObjLst lst;
- EditorSwitchDoorObj* obj = new EditorSwitchDoorObj (*this);
+ EditorObjs::EditorSwitchDoorObj* obj = new EditorObjs::EditorSwitchDoorObj
(*this);
lst.push_back(obj);
- lst.push_back(new EditorSwitchDoorSwitchObj (obj));
+ lst.push_back(new EditorObjs::EditorSwitchDoorSwitchObj (obj));
return lst;
}
+} // namespace WorldObjsData
+
////////////////
// SwitchDoor //
////////////////
+namespace WorldObjs {
SwitchDoor::SwitchDoor (const SwitchDoorData& data)
: SwitchDoorData (data)
@@ -225,10 +230,14 @@
}
}
+} // namespace WorldObjs
+
///////////////////////////////
// EditorSwitchDoorSwitchObj //
///////////////////////////////
+namespace EditorObjs {
+
EditorSwitchDoorSwitchObj::EditorSwitchDoorSwitchObj (EditorSwitchDoorObj*
data)
: SpriteEditorObj ("switchdoor_switch", "worldobjs"),
door (data)
@@ -329,5 +338,7 @@
{
door_pos += offset;
}
+
+} // namespace EditorObjs
/* EOF */
Index: switch_door.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- switch_door.hxx 5 Sep 2002 11:26:35 -0000 1.8
+++ switch_door.hxx 10 Sep 2002 19:24:19 -0000 1.9
@@ -26,6 +26,8 @@
#include "../libxmlfwd.hxx"
+namespace WorldObjsData {
+
/** A variable height door which can block the way and which can be
opened by a switch */
class SwitchDoorData : public WorldObjData
@@ -57,9 +59,13 @@
EditorObjLst create_EditorObj ();
};
+} // namespace WorldObjsData
+
+namespace WorldObjs {
+
/** A door and a switch, if a pingu is passing the switch, the door
will open. */
-class SwitchDoor : public SwitchDoorData,
+class SwitchDoor : public WorldObjsData::SwitchDoorData,
public WorldObj
{
private:
@@ -89,6 +95,11 @@
SwitchDoor operator= (const SwitchDoor&);
};
+} // namespace WorldObjs
+
+
+namespace EditorObjs {
+
class EditorSwitchDoorObj;
/** A dummy object to represent the switch for a switchdoor, all real
@@ -111,7 +122,7 @@
EditorSwitchDoorSwitchObj operator= (const EditorSwitchDoorSwitchObj&);
};
-class EditorSwitchDoorObj : public SwitchDoorData,
+class EditorSwitchDoorObj : public WorldObjsData::SwitchDoorData,
public RectEditorObj
{
private:
@@ -148,6 +159,8 @@
EditorSwitchDoorObj (const EditorSwitchDoorObj&);
EditorSwitchDoorObj operator= (const EditorSwitchDoorObj&);
};
+
+} // namespace EditorObjs
#endif
Index: teleporter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/teleporter.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- teleporter.cxx 9 Sep 2002 16:13:44 -0000 1.8
+++ teleporter.cxx 10 Sep 2002 19:24:19 -0000 1.9
@@ -26,51 +26,51 @@
namespace WorldObjs {
- Teleporter::Teleporter (WorldObjsData::TeleporterData* data_)
- : data(new WorldObjsData::TeleporterData(*data_))
-
- {
- data->sprite.set_align_center_bottom();
- data->target_sprite.set_align_center();
+Teleporter::Teleporter (WorldObjsData::TeleporterData* data_)
+ : data(new WorldObjsData::TeleporterData(*data_))
- //FIXME: we need a Sprite::set_frame()
+{
+ data->sprite.set_align_center_bottom();
+ data->target_sprite.set_align_center();
- std::cout << "Teleporter: pos: " << data->pos.x << " " << data->pos.y <<
" " << data->pos.z << std::endl;
- }
+ //FIXME: we need a Sprite::set_frame()
- float
- Teleporter::get_z_pos () const
- {
- return data->pos.z;
- }
+ std::cout << "Teleporter: pos: " << data->pos.x << " " << data->pos.y << "
" << data->pos.z << std::endl;
+}
- void
- Teleporter::draw (GraphicContext& gc)
- {
- gc.draw(data->sprite, data->pos);
- gc.draw(data->target_sprite, data->target_pos);
- }
+float
+Teleporter::get_z_pos () const
+{
+ return data->pos.z;
+}
- void
- Teleporter::update (float delta)
- {
- data->sprite.update(delta);
- data->target_sprite.update(delta);
+void
+Teleporter::draw (GraphicContext& gc)
+{
+ gc.draw(data->sprite, data->pos);
+ gc.draw(data->target_sprite, data->target_pos);
+}
- PinguHolder* holder = world->get_pingu_p();
+void
+Teleporter::update (float delta)
+{
+ data->sprite.update(delta);
+ data->target_sprite.update(delta);
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
- {
- if ( (*pingu)->get_x() > data->pos.x - 3 && (*pingu)->get_x() <
data->pos.x + 3
- && (*pingu)->get_y() > data->pos.y - 52 && (*pingu)->get_y() <
data->pos.y)
- {
- (*pingu)->set_pos (static_cast<int>(data->target_pos.x),
static_cast<int>(data->target_pos.y));
- data->sprite.reset ();
- data->target_sprite.reset ();
- }
- }
- }
+ PinguHolder* holder = world->get_pingu_p();
+ for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
+ {
+ if ( (*pingu)->get_x() > data->pos.x - 3 && (*pingu)->get_x() <
data->pos.x + 3
+ && (*pingu)->get_y() > data->pos.y - 52 && (*pingu)->get_y() <
data->pos.y)
+ {
+ (*pingu)->set_pos (static_cast<int>(data->target_pos.x),
static_cast<int>(data->target_pos.y));
+ data->sprite.reset ();
+ data->target_sprite.reset ();
+ }
+ }
}
+
+} // namespace WorldObjs
/* EOF */
Index: teleporter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/teleporter.hxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- teleporter.hxx 9 Sep 2002 16:13:44 -0000 1.11
+++ teleporter.hxx 10 Sep 2002 19:24:19 -0000 1.12
@@ -23,30 +23,30 @@
#include "../worldobj.hxx"
namespace WorldObjsData {
- class TeleporterData;
+class TeleporterData;
}
namespace WorldObjs {
- class Teleporter : public WorldObj
- {
- private:
- WorldObjsData::TeleporterData* const data;
- public:
- Teleporter (WorldObjsData::TeleporterData* data_);
+class Teleporter : public WorldObj
+{
+private:
+ WorldObjsData::TeleporterData* const data;
+public:
+ Teleporter (WorldObjsData::TeleporterData* data_);
- int get_z_pos () { return 0; }
+ int get_z_pos () { return 0; }
- void draw (GraphicContext& gc);
- void update (float delta);
- float get_z_pos () const;
+ void draw (GraphicContext& gc);
+ void update (float delta);
+ float get_z_pos () const;
- private:
- Teleporter (const Teleporter&);
- Teleporter operator= (const Teleporter&);
- };
+private:
+ Teleporter (const Teleporter&);
+ Teleporter operator= (const Teleporter&);
+};
-}
+} // namespace WorldObjs
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.2,1.3 conveyor_belt.cxx,1.9,1.10 conveyor_belt.hxx,1.7,1.8 fake_exit.hxx,1.2,1.3 guillotine.cxx,1.2,1.3 guillotine.hxx,1.2,1.3 hammer.cxx,1.2,1.3 info_box.cxx,1.9,1.10 info_box.hxx,1.8,1.9 laser_exit.cxx,1.2,1.3 laser_exit.hxx,1.2,1.3 smasher.cxx,1.2,1.3 smasher.hxx,1.2,1.3 spike.cxx,1.2,1.3 spike.hxx,1.2,1.3 switch_door.cxx,1.10,1.11 switch_door.hxx,1.8,1.9 teleporter.cxx,1.8,1.9 teleporter.hxx,1.11,1.12,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata bumper_data.cxx,1.2,1.3 bumper_data.hxx,1.1,1.2 fake_exit_data.cxx,1.2,1.3 fake_exit_data.hxx,1.1,1.2 guillotine_data.cxx,1.2,1.3 guillotine_data.hxx,1.1,1.2 hammer_data.cxx,1.2,1.3 hammer_data.hxx,1.1,1.2 laser_exit_data.cxx,1.2,1.3 laser_exit_data.hxx,1.1,1.2 smasher_data.hxx,1.1,1.2 spike_data.cxx,1.2,1.3 spike_data.hxx,1.1,1.2 teleporter_data.cxx,1.1,1.2
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.9,1.10 angel.hxx,1.9,1.10 basher.cxx,1.13,1.14 basher.hxx,1.9,1.10 blocker.cxx,1.7,1.8 blocker.hxx,1.8,1.9 boarder.cxx,1.7,1.8 boarder.hxx,1.8,1.9 bomber.cxx,1.11,1.12 bomber.hxx,1.10,1.11 bridger.cxx,1.13,1.14 bridger.hxx,1.10,1.11 climber.cxx,1.9,1.10 climber.hxx,1.7,1.8 digger.cxx,1.11,1.12 digger.hxx,1.7,1.8 drown.cxx,1.6,1.7 drown.hxx,1.7,1.8 exiter.cxx,1.6,1.7 exiter.hxx,1.7,1.8 faller.cxx,1.20,1.21 faller.hxx,1.12,1.13 floater.cxx,1.13,1.14 floater.hxx,1.9,1.10 jumper.cxx,1.9,1.10 jumper.hxx,1.7,1.8 laser_kill.cxx,1.4,1.5 laser_kill.hxx,1.7,1.8 miner.cxx,1.9,1.10 miner.hxx,1.7,1.8 rocket_launcher.cxx,1.7,1.8 rocket_launcher.hxx,1.7,1.8 slider.cxx,1.7,1.8 slider.hxx,1.7,1.8 smashed.cxx,1.5,1.6 smashed.hxx,1.7,1.8 splashed.cxx,1.6,1.7 splashed.hxx,1.7,1.8 superman.cxx,1.5,1.6 superman.hxx,1.8,1.9 teleported.cxx,1.6,1.7 teleported.hxx,1.7,1.8 waiter.cxx,1.6,1.7 waiter.hxx,1.7,1.8 walker.cxx,1.20,1.21 walker.hxx,1.7,1.8
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata bumper_data.cxx,1.2,1.3 bumper_data.hxx,1.1,1.2 fake_exit_data.cxx,1.2,1.3 fake_exit_data.hxx,1.1,1.2 guillotine_data.cxx,1.2,1.3 guillotine_data.hxx,1.1,1.2 hammer_data.cxx,1.2,1.3 hammer_data.hxx,1.1,1.2 laser_exit_data.cxx,1.2,1.3 laser_exit_data.hxx,1.1,1.2 smasher_data.hxx,1.1,1.2 spike_data.cxx,1.2,1.3 spike_data.hxx,1.1,1.2 teleporter_data.cxx,1.1,1.2
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/actions angel.cxx,1.9,1.10 angel.hxx,1.9,1.10 basher.cxx,1.13,1.14 basher.hxx,1.9,1.10 blocker.cxx,1.7,1.8 blocker.hxx,1.8,1.9 boarder.cxx,1.7,1.8 boarder.hxx,1.8,1.9 bomber.cxx,1.11,1.12 bomber.hxx,1.10,1.11 bridger.cxx,1.13,1.14 bridger.hxx,1.10,1.11 climber.cxx,1.9,1.10 climber.hxx,1.7,1.8 digger.cxx,1.11,1.12 digger.hxx,1.7,1.8 drown.cxx,1.6,1.7 drown.hxx,1.7,1.8 exiter.cxx,1.6,1.7 exiter.hxx,1.7,1.8 faller.cxx,1.20,1.21 faller.hxx,1.12,1.13 floater.cxx,1.13,1.14 floater.hxx,1.9,1.10 jumper.cxx,1.9,1.10 jumper.hxx,1.7,1.8 laser_kill.cxx,1.4,1.5 laser_kill.hxx,1.7,1.8 miner.cxx,1.9,1.10 miner.hxx,1.7,1.8 rocket_launcher.cxx,1.7,1.8 rocket_launcher.hxx,1.7,1.8 slider.cxx,1.7,1.8 slider.hxx,1.7,1.8 smashed.cxx,1.5,1.6 smashed.hxx,1.7,1.8 splashed.cxx,1.6,1.7 splashed.hxx,1.7,1.8 superman.cxx,1.5,1.6 superman.hxx,1.8,1.9 teleported.cxx,1.6,1.7 teleported.hxx,1.7,1.8 waiter.cxx,1.6,1.7 waiter.hxx,1.7,1.8 walker.cxx,1.20,1.21 walker.hxx,1.7,1.8
- Index(es):