[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.3,1.4 conveyor
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.3,1.4 conveyor_belt.cxx,1.12,1.13 conveyor_belt.hxx,1.9,1.10 fake_exit.cxx,1.3,1.4 guillotine.cxx,1.3,1.4 hammer.cxx,1.3,1.4 hammer.hxx,1.3,1.4 ice_block.cxx,1.12,1.13 ice_block.hxx,1.8,1.9 info_box.cxx,1.12,1.13 info_box.hxx,1.10,1.11 laser_exit.cxx,1.4,1.5 smasher.cxx,1.3,1.4 spike.cxx,1.3,1.4 switch_door.cxx,1.14,1.15 switch_door.hxx,1.11,1.12 teleporter.cxx,1.9,1.10 teleporter.hxx,1.12,1.13 |
Date: |
14 Sep 2002 19:06:37 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv10275/worldobjs
Modified Files:
bumper.cxx conveyor_belt.cxx conveyor_belt.hxx fake_exit.cxx
guillotine.cxx hammer.cxx hammer.hxx ice_block.cxx
ice_block.hxx info_box.cxx info_box.hxx laser_exit.cxx
smasher.cxx spike.cxx switch_door.cxx switch_door.hxx
teleporter.cxx teleporter.hxx
Log Message:
- splitted IceBlock / ConveyorBelt
- removed unrequired includes (ignoring system headers)
Index: bumper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/bumper.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- bumper.cxx 10 Sep 2002 19:24:19 -0000 1.3
+++ bumper.cxx 14 Sep 2002 19:06:34 -0000 1.4
@@ -18,14 +18,14 @@
// 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 "../graphic_context.hxx"
#include "../pingu.hxx"
-#include "../xml_helper.hxx"
+#include "../pingu_holder.hxx"
+#include "../pingus_resource.hxx"
+#include "../world.hxx"
#include "../worldobjsdata/bumper_data.hxx"
+#include "bumper.hxx"
namespace WorldObjs {
Index: conveyor_belt.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- conveyor_belt.cxx 11 Sep 2002 12:45:59 -0000 1.12
+++ conveyor_belt.cxx 14 Sep 2002 19:06:34 -0000 1.13
@@ -18,266 +18,80 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <fstream>
-#include "../graphic_context.hxx"
#include "../col_map.hxx"
-#include "../editor/editor_view.hxx"
-#include "../world.hxx"
+#include "../graphic_context.hxx"
+#include "../pingu.hxx"
#include "../pingu_holder.hxx"
#include "../pingus_resource.hxx"
-#include "../xml_helper.hxx"
+#include "../world.hxx"
+#include "../worldobjsdata/conveyor_belt_data.hxx"
#include "conveyor_belt.hxx"
-#include "../pingu.hxx"
-
-namespace WorldObjsData {
-
-ConveyorBeltData::ConveyorBeltData () : width(5), speed(2)
-{
-}
-
-ConveyorBeltData::ConveyorBeltData (xmlDocPtr doc, xmlNodePtr cur)
-{
- cur = cur->children;
-
- while (cur)
- {
- if (xmlIsBlankNode(cur))
- {
- cur = cur->next;
- continue;
- }
- else if (XMLhelper::equal_str(cur->name, "position"))
- {
- pos = XMLhelper::parse_vector (doc, cur);
- }
- else if (XMLhelper::equal_str(cur->name, "width"))
- {
- width = XMLhelper::parse_int (doc, cur);
- }
- else if (XMLhelper::equal_str(cur->name, "speed"))
- {
- speed = XMLhelper::parse_int (doc, cur);
- }
- else
- std::cout << "ConveyorBeltData::create (): Unhandled " << cur->name <<
std::endl;
- cur = cur->next;
- }
-}
-
-ConveyorBeltData::ConveyorBeltData (const ConveyorBeltData& old) :
WorldObjData(old),
-
pos(old.pos),
-
width(old.width),
-
speed(old.speed)
-{
-}
-
-ConveyorBeltData
-ConveyorBeltData::operator= (const ConveyorBeltData& old)
-{
- if (this == &old)
- return *this;
-
- WorldObjData::operator=(old);
-
- pos = old.pos;
- width = old.width;
- speed = old.speed;
-
- return *this;
-}
-
-/** Writte the content of this object formated as xml to the given
- stream */
-void
-ConveyorBeltData::write_xml(std::ostream& xml)
-{
- xml << " <worldobj type=\"conveyorbelt\">";
- XMLhelper::write_vector_xml (xml, pos);
- xml << " <width>" << width << "</width>\n"
- << " <speed>" << speed << "</speed>\n"
- << " </worldobj>\n" << std::endl;
-}
-
-WorldObj*
-ConveyorBeltData::create_WorldObj ()
-{
- return new WorldObjs::ConveyorBelt (this);
-}
-
-EditorObjLst
-ConveyorBeltData::create_EditorObj ()
-{
- EditorObjLst lst;
- lst.push_back(new EditorObjs::EditorConveyorBeltObj (*this));
- return lst;
-}
-
-} // namespace WorldObjsData
-
-/***********************/
-/* ConveyorBelt */
-/***********************/
namespace WorldObjs {
-ConveyorBelt::ConveyorBelt (WorldObjData* data)
+ConveyorBelt::ConveyorBelt (WorldObjsData::ConveyorBeltData* data_)
+ : data(new WorldObjsData::ConveyorBeltData(*data_))
{
- left_sur = PingusResource::load_surface ("conveyorbelt_left", "worldobjs");
- right_sur = PingusResource::load_surface ("conveyorbelt_right",
"worldobjs");
- middle_sur = PingusResource::load_surface ("conveyorbelt_middle",
"worldobjs");
-
- ConveyorBeltData* obj = dynamic_cast<ConveyorBeltData*>(data);
-
- pos = obj->pos;
- speed = obj->speed;
- width = obj->width;
- counter = 0;
}
void
ConveyorBelt::draw (GraphicContext& gc)
{
- gc.draw(left_sur, pos, int(counter));
- for (int i=0; i < width; ++i)
- gc.draw(middle_sur,
- int(pos.x + left_sur.get_width () + i * middle_sur.get_width ()),
- int(pos.y),
- int(counter));
+ gc.draw(data->left_sur, data->pos, static_cast<int>(data->counter));
+ for (int i=0; i < data->width; ++i)
+ gc.draw(data->middle_sur,
+ static_cast<int>(data->pos.x + data->left_sur.get_width() + i *
data->middle_sur.get_width()),
+ static_cast<int>(data->pos.y),
+ static_cast<int>(data->counter));
- gc.draw(right_sur,
- int(pos.x + left_sur.get_width () + width*middle_sur.get_width ()),
- int(pos.y), int(counter));
+ gc.draw(data->right_sur,
+ static_cast<int>(data->pos.x + data->left_sur.get_width() +
data->width * data->middle_sur.get_width()),
+ static_cast<int>(data->pos.y),
+ static_cast<int>(data->counter));
}
void
ConveyorBelt::draw_colmap ()
{
CL_Surface sur(PingusResource::load_surface("conveyorbelt_cmap",
"worldobjs"));
- for (int i=0; i < (width+2); ++i)
- world->get_colmap()->put(sur, int(pos.x) + (15*i), int(pos.y),
GroundpieceData::GP_SOLID);
+ for (int i=0; i < (data->width + 2); ++i)
+ world->get_colmap()->put(sur,
+ static_cast<int>(data->pos.x) + (15 * i),
+ static_cast<int>(data->pos.y),
+ GroundpieceData::GP_SOLID);
}
void
-ConveyorBelt::update(float delta)
+ConveyorBelt::update (float delta)
{
- counter += speed * delta;
+ data->counter += data->speed * delta;
- if (counter >= 14.0f)
- counter = 0.0f;
- else if (counter < 0.0f)
- counter = middle_sur.get_num_frames () - 1;
+ if (data->counter >= 14.0f)
+ data->counter = 0.0f;
+ else if (data->counter < 0.0f)
+ data->counter = data->middle_sur.get_num_frames() - 1;
PinguHolder* holder = world->get_pingu_p();
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); ++pingu)
+ for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
{
- if ((*pingu)->get_x() > pos.x
- && (*pingu)->get_x() < pos.x + 15*(width+2)
- && (*pingu)->get_y() > pos.y - 2
- && (*pingu)->get_y() < pos.y + 10)
+ if ( (*pingu)->get_x() > data->pos.x
+ && (*pingu)->get_x() < data->pos.x + 15 * (data->width + 2)
+ && (*pingu)->get_y() > data->pos.y - 2
+ && (*pingu)->get_y() < data->pos.y + 10)
{
- CL_Vector pos = (*pingu)->get_pos ();
- pos.x -= speed * delta;
- (*pingu)->set_pos (pos);
+ CL_Vector pos = (*pingu)->get_pos();
+ data->pos.x -= data->speed * delta;
+ (*pingu)->set_pos(pos);
}
}
}
-} // namespace WorldObjs
-
-/*************************/
-/* EditorConveyorBeltObj */
-/*************************/
-
-namespace EditorObjs {
-
-EditorConveyorBeltObj::EditorConveyorBeltObj (const ConveyorBeltData& data)
- : ConveyorBeltData (data)
-{
- left_sur = PingusResource::load_surface ("conveyorbelt_left", "worldobjs");
- right_sur = PingusResource::load_surface ("conveyorbelt_right",
"worldobjs");
- middle_sur = PingusResource::load_surface ("conveyorbelt_middle",
"worldobjs");
-
- counter = 0.0f;
-}
-
-EditorObj*
-EditorConveyorBeltObj::duplicate()
-{
- return new EditorConveyorBeltObj (static_cast<ConveyorBeltData> (*this));
-}
-
-void
-EditorConveyorBeltObj::draw (EditorNS::EditorView * view)
-{
- view->draw (left_sur, pos, int(counter));
- for (int i=0; i < ConveyorBeltData::width; ++i)
- view->draw (middle_sur, int(pos.x) + left_sur.get_width () +
i*middle_sur.get_width (),
- int(pos.y),
- int(counter));
- view->draw (right_sur,
- int(pos.x) + left_sur.get_width () +
ConveyorBeltData::width*middle_sur.get_width (),
- int(pos.y), int(counter));
- counter += speed;
- if (counter > 14)
- counter = 0;
- else if (counter < 0)
- counter = middle_sur.get_num_frames () - 1;
-
-}
-
-void
-EditorConveyorBeltObj::draw_scroll_map(int /*x_pos*/, int /*y_pos*/, int
/*arg_width*/, int /*arg_height*/)
-{
- // not supported
-}
-
-EditorObjLst
-EditorConveyorBeltObj::create (const CL_Vector& pos)
-{
- ConveyorBeltData data;
- data.pos = pos;
- return data.create_EditorObj ();
-}
-
-std::string
-EditorConveyorBeltObj::status_line()
-{
- char str[256];
- snprintf (str, 256, "ConveyorBelt - (%f, %f, %f) Speed: %f", pos.x, pos.y,
pos.z, speed);
- return str;
-}
-
-int
-EditorConveyorBeltObj::get_width ()
-{
- return left_sur.get_width() + right_sur.get_width() + width *
middle_sur.get_width ();
-}
-
-int
-EditorConveyorBeltObj::get_height ()
-{
- return middle_sur.get_height ();
-}
-
-void
-EditorConveyorBeltObj::set_position_offset(const CL_Vector& offset)
-{
- pos += offset;
-}
-
-void
-EditorConveyorBeltObj::make_larger ()
-{
- ConveyorBeltData::width += 1;
-}
-
-void
-EditorConveyorBeltObj::make_smaller ()
+float
+ConveyorBelt::get_z_pos () const
{
- ConveyorBeltData::width -= 1;
- if (ConveyorBeltData::width < 0)
- ConveyorBeltData::width = 0;
+ return data->pos.z;
}
-} // namespace EditorObjs
+} // namespace WorldObjs
/* EOF */
Index: conveyor_belt.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- conveyor_belt.hxx 11 Sep 2002 12:45:59 -0000 1.9
+++ conveyor_belt.hxx 14 Sep 2002 19:06:34 -0000 1.10
@@ -25,54 +25,23 @@
#include "../editor/rect_editorobj.hxx"
namespace WorldObjsData {
-
-class ConveyorBeltData : public WorldObjData
-{
-public:
- CL_Vector pos;
- int width;
- double speed;
-
- ConveyorBeltData ();
- ConveyorBeltData (xmlDocPtr doc, xmlNodePtr cur);
-
- ConveyorBeltData (const ConveyorBeltData& old);
- ConveyorBeltData operator= (const ConveyorBeltData& old);
-
- /** Write the content of this object formatted as xml to the given
- stream */
- void write_xml(std::ostream& xml);
- ///
-
- /** Create an WorldObj from the given data object */
- WorldObj* create_WorldObj ();
-
- /** Create an EditorObj from the given data object */
- EditorObjLst create_EditorObj ();
-};
-
-} // namespace WorldObjsData
-
+class ConveyorBeltData;
+}
namespace WorldObjs {
-// FIXME: Make ConveyorBeltData
-class ConveyorBelt : private WorldObjsData::ConveyorBeltData,
- public WorldObj
+class ConveyorBelt : public WorldObj
{
private:
- CL_Surface left_sur;
- CL_Surface right_sur;
- CL_Surface middle_sur;
- float counter;
-
+ WorldObjsData::ConveyorBeltData* const data;
+
public:
- ConveyorBelt (WorldObjData*);
+ ConveyorBelt (WorldObjsData::ConveyorBeltData* data_);
void draw (GraphicContext& gc);
- void draw_colmap();
- void update(float delta);
- float get_z_pos() const { return pos.z; }
+ void draw_colmap ();
+ void update (float delta);
+ float get_z_pos () const;
private:
ConveyorBelt (const ConveyorBelt&);
@@ -80,52 +49,6 @@
};
} // namespace WorldObjs
-
-namespace EditorObjs {
-
-class EditorConveyorBeltObj : public RectEditorObj,
- public WorldObjsData::ConveyorBeltData
-{
-private:
- CL_Surface left_sur;
- CL_Surface right_sur;
- CL_Surface middle_sur;
- float counter;
-
-public:
- EditorConveyorBeltObj (const ConveyorBeltData&);
-
- EditorObj* duplicate();
- void draw (EditorNS::EditorView * view);
- void draw_scroll_map(int x_pos, int y_pos, int arg_width, int arg_height);
-
- int get_width ();
- int get_height ();
-
- float get_z_pos () { return pos.z; }
-
- void set_position_offset(const CL_Vector &);
-
- /// The saving will be done in EditorTeleporterObj::save_xml
- static EditorObjLst create (WorldObjData* obj);
-
- /** Create the object with reasonable defaults */
- static EditorObjLst create (const CL_Vector& pos);
-
- CL_Vector get_upper_left_corner() { return pos; }
-
- void write_xml (std::ostream& xml) { ConveyorBeltData::write_xml (xml); }
- std::string status_line();
-
- void make_larger ();
- void make_smaller ();
-
-private:
- EditorConveyorBeltObj (const EditorConveyorBeltObj&);
- EditorConveyorBeltObj operator= (const EditorConveyorBeltObj&);
-};
-
-} // namespace EditorObjs
#endif
Index: fake_exit.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/fake_exit.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fake_exit.cxx 10 Sep 2002 15:36:44 -0000 1.3
+++ fake_exit.cxx 14 Sep 2002 19:06:34 -0000 1.4
@@ -17,12 +17,12 @@
// 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 "../graphic_context.hxx"
#include "../pingu.hxx"
+#include "../pingu_holder.hxx"
+#include "../world.hxx"
#include "../worldobjsdata/fake_exit_data.hxx"
+#include "fake_exit.hxx"
namespace WorldObjs {
Index: guillotine.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/guillotine.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- guillotine.cxx 10 Sep 2002 19:24:19 -0000 1.3
+++ guillotine.cxx 14 Sep 2002 19:06:34 -0000 1.4
@@ -18,13 +18,11 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../graphic_context.hxx"
-#include "guillotine.hxx"
-#include "../pingus_resource.hxx"
+#include "../pingu.hxx"
#include "../pingu_holder.hxx"
#include "../world.hxx"
-#include "../pingu.hxx"
-#include "../worldobj.hxx"
#include "../worldobjsdata/guillotine_data.hxx"
+#include "guillotine.hxx"
namespace WorldObjs {
Index: hammer.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/hammer.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- hammer.cxx 10 Sep 2002 19:24:19 -0000 1.3
+++ hammer.cxx 14 Sep 2002 19:06:34 -0000 1.4
@@ -17,12 +17,12 @@
// 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 "../graphic_context.hxx"
#include "../pingu.hxx"
+#include "../pingu_holder.hxx"
+#include "../world.hxx"
#include "../worldobjsdata/hammer_data.hxx"
+#include "hammer.hxx"
namespace WorldObjs {
Index: hammer.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/hammer.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- hammer.hxx 9 Sep 2002 16:55:07 -0000 1.3
+++ hammer.hxx 14 Sep 2002 19:06:34 -0000 1.4
@@ -38,7 +38,7 @@
public:
Hammer (WorldObjsData::HammerData* data_);
- ~Hammer ();
+ ~Hammer ();
float get_z_pos () const;
Index: ice_block.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ice_block.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- ice_block.cxx 10 Sep 2002 21:03:33 -0000 1.12
+++ ice_block.cxx 14 Sep 2002 19:06:34 -0000 1.13
@@ -18,164 +18,87 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <fstream>
-#include "../graphic_context.hxx"
#include "../col_map.hxx"
-#include "../world.hxx"
+#include "../game_time.hxx"
+#include "../graphic_context.hxx"
+#include "../pingu.hxx"
#include "../pingu_holder.hxx"
-#include "../pingus_resource.hxx"
-#include "../xml_helper.hxx"
#include "../pingu_map.hxx"
-#include "../game_time.hxx"
+#include "../pingus_resource.hxx"
+#include "../world.hxx"
+#include "../worldobjsdata/ice_block_data.hxx"
#include "ice_block.hxx"
-#include "../pingu.hxx"
-#include "../game_time.hxx"
-
-IceBlockData::IceBlockData () : width(1)
-{
-}
-
-void
-IceBlockData::write_xml(std::ostream& xml)
-{
- xml << " <worldobj type=\"iceblock\">";
- XMLhelper::write_vector_xml (xml, pos);
- xml << " <width>" << width << "</width>\n"
- << " </worldobj>\n" << std::endl;
-}
-
-IceBlockData::IceBlockData (xmlDocPtr doc, xmlNodePtr cur)
-{
- cur = cur->children;
-
- while (cur)
- {
- if (xmlIsBlankNode(cur))
- {
- cur = cur->next;
- continue;
- }
- else if (XMLhelper::equal_str(cur->name, "position"))
- {
- pos = XMLhelper::parse_vector (doc, cur);
- }
- else if (XMLhelper::equal_str(cur->name, "width"))
- {
- width = XMLhelper::parse_int (doc, cur);
- }
- else
- std::cout << "IceBlockData::creata (): Unhandled " << cur->name <<
std::endl;
- cur = cur->next;
- }
-}
-WorldObj*
-IceBlockData::create_WorldObj ()
-{
- return new IceBlock (*this);
-}
+namespace WorldObjs {
-EditorObjLst
-IceBlockData::create_EditorObj ()
+IceBlock::IceBlock (WorldObjsData::IceBlockData* data_) : thickness(1.0),
+ is_finished(false),
+ last_contact(0),
+ data(new
WorldObjsData::IceBlockData(*data_))
{
- EditorObjLst lst;
- lst.push_back(new EditorIceBlockObj (*this));
- return lst;
}
-IceBlock::IceBlock (const IceBlockData& data)
+IceBlock::~IceBlock ()
{
- pos = data.pos;
- width = data.width;
- block_sur = PingusResource::load_surface ("iceblock", "worldobjs");
- thickness = 1.0;
- is_finished = false;
- last_contact = 0;
+ delete data;
}
void
-IceBlock::draw_colmap()
+IceBlock::draw_colmap ()
{
- CL_Surface surf (PingusResource::load_surface("iceblock_cmap", "worldobjs"));
+ CL_Surface surf(PingusResource::load_surface("iceblock_cmap", "worldobjs"));
- world->get_colmap()->put(surf, (int)pos.x, (int)pos.y,
GroundpieceData::GP_GROUND);
+ world->get_colmap()->put(surf,
+ static_cast<int>(data->pos.x),
+ static_cast<int>(data->pos.y),
+ GroundpieceData::GP_GROUND);
}
-///
void
IceBlock::draw (GraphicContext& gc)
{
if (is_finished)
return;
- gc.draw (block_sur, pos, (int)((1.0 - thickness) * (block_sur.get_num_frames
() - 1)));
+ gc.draw(data->block_sur,
+ data->pos,
+ static_cast<int>((1.0 - thickness) *
(data->block_sur.get_num_frames() - 1)));
}
-///
void
-IceBlock::update(float /*delta*/)
+IceBlock::update (float /*delta*/)
{
if (is_finished)
return;
PinguHolder* holder = world->get_pingu_p();
- for (PinguIter pingu = holder->begin (); pingu != holder->end (); pingu++)
+ for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
{
- if ((*pingu)->get_x() > pos.x && (*pingu)->get_x() < pos.x +
block_sur.get_width()
- && (*pingu)->get_y() > pos.y - 4 && (*pingu)->get_y() < pos.y +
block_sur.get_height())
+ if ( (*pingu)->get_x() > data->pos.x && (*pingu)->get_x() <
data->pos.x + data->block_sur.get_width()
+ && (*pingu)->get_y() > data->pos.y - 4 && (*pingu)->get_y() <
data->pos.y + data->block_sur.get_height())
{
- last_contact = world->get_game_time()->get_ticks ();
+ last_contact = world->get_game_time()->get_ticks();
}
}
- if (last_contact && last_contact + 1000 > world->get_game_time ()->get_ticks
())
+ if (last_contact && last_contact + 1000 >
world->get_game_time()->get_ticks())
{
//std::cout << "IceBlock: Catched Pingu: " << thickness << std::endl;
thickness -= 0.01f;
- if (thickness < 0.0)
+ if (thickness < 0)
{
is_finished = true;
- thickness = 0.0;
+ thickness = 0;
CL_Surface surf(PingusResource::load_surface("iceblock_cmap",
"worldobjs"));
- world->get_colmap()->remove(surf, (int)pos.x, (int)pos.y);
- world->get_gfx_map()->remove(surf, (int)pos.x, (int)pos.y);
+ world->get_colmap ()->remove(surf, static_cast<int>(data->pos.x),
static_cast<int>(data->pos.y));
+ world->get_gfx_map()->remove(surf, static_cast<int>(data->pos.x),
static_cast<int>(data->pos.y));
return;
}
}
}
-EditorIceBlockObj::EditorIceBlockObj (const IceBlockData& data)
- : SpriteEditorObj ("iceblock", "worldobjs", &pos)
-{
- pos = data.pos;
- IceBlockData::width = data.width;
-}
-
-/** Create the object with resonable defaults */
-EditorObjLst
-EditorIceBlockObj::create (const CL_Vector& pos)
-{
- IceBlockData data;
-
- data.pos = pos;
-
- return data.create_EditorObj ();
-}
-
-std::string
-EditorIceBlockObj::status_line()
-{
- char str[256];
- snprintf (str, 256, "IceBlock - %f %f %f", pos.x, pos.y, pos.z);
- return str;
-}
-
-EditorObj*
-EditorIceBlockObj::duplicate()
-{
- std::cout << "EditorIceBlockObj::duplicate(): Not implemented" << std::endl;
- return 0;
-}
+} // namespace WorldObjs
/* EOF */
Index: ice_block.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ice_block.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ice_block.hxx 4 Sep 2002 19:40:20 -0000 1.8
+++ ice_block.hxx 14 Sep 2002 19:06:34 -0000 1.9
@@ -20,48 +20,25 @@
#ifndef HEADER_PINGUS_WORLDOBJS_ICE_BLOCK_HXX
#define HEADER_PINGUS_WORLDOBJS_ICE_BLOCK_HXX
-#include "../worldobj_data.hxx"
-#include "../editor/sprite_editorobj.hxx"
-
-class WorldObj;
-
-class IceBlockData : public WorldObjData
-{
-public:
- /// The upper/left position of the iceblock's
- CL_Vector pos;
- /** The number of iceblocks, only complete blocks are supported */
- int width;
-
- int last_contact;
-
- IceBlockData ();
- IceBlockData (xmlDocPtr doc, xmlNodePtr cur);
+#include "../worldobj.hxx"
- /** Write the content of this object formatted as xml to the given
- stream */
- void write_xml(std::ostream& xml);
-
- /** Create an WorldObj from the given data object */
- WorldObj* create_WorldObj ();
+namespace WorldObjsData {
+class IceBlockData;
+}
- /** Create an EditorObj from the given data object */
- EditorObjLst create_EditorObj ();
-
-private:
- IceBlockData (const IceBlockData&);
- IceBlockData operator= (const IceBlockData&);
-};
+namespace WorldObjs {
-class IceBlock : public IceBlockData,
- public WorldObj
+class IceBlock : public WorldObj
{
private:
- CL_Surface block_sur;
float thickness;
- bool is_finished;
+ bool is_finished;
+ int last_contact;
+ WorldObjsData::IceBlockData* const data;
+
public:
- IceBlock (const IceBlockData& data);
+ IceBlock (WorldObjsData::IceBlockData* data_);
+ ~IceBlock ();
float get_z_pos () const { return 100; }
void draw_colmap ();
@@ -73,30 +50,8 @@
IceBlock operator= (const IceBlock&);
};
-
-class EditorIceBlockObj : public IceBlockData,
- public SpriteEditorObj
-{
-private:
-
-public:
- EditorIceBlockObj (const IceBlockData& data);
-
- /** Create the object with resonable defaults */
- static EditorObjLst create (const CL_Vector& pos);
-
- void write_xml(std::ostream& xml) { IceBlockData::write_xml (xml); }
- EditorObj* duplicate();
- std::string status_line();
-
-private:
- EditorIceBlockObj (const EditorIceBlockObj&);
- EditorIceBlockObj operator= (const EditorIceBlockObj&);
-};
+} // namespace WorldObjs
#endif
/* EOF */
-
-
-
Index: info_box.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/info_box.cxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- info_box.cxx 14 Sep 2002 13:35:38 -0000 1.12
+++ info_box.cxx 14 Sep 2002 19:06:34 -0000 1.13
@@ -21,10 +21,9 @@
#include <ClanLib/Display/Font/font.h>
#include <ClanLib/Display/Display/display.h>
#include "../graphic_context.hxx"
+#include "../pingu.hxx"
#include "../pingu_holder.hxx"
#include "../world.hxx"
-#include "../pingus_resource.hxx"
-#include "../pingu.hxx"
#include "../worldobjsdata/info_box_data.hxx"
#include "info_box.hxx"
@@ -34,6 +33,11 @@
: is_open (false),
data(new WorldObjsData::InfoBoxData(*data_))
{
+}
+
+InfoBox::~InfoBox ()
+{
+ delete data;
}
void
Index: info_box.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/info_box.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- info_box.hxx 14 Sep 2002 13:35:38 -0000 1.10
+++ info_box.hxx 14 Sep 2002 19:06:34 -0000 1.11
@@ -37,6 +37,7 @@
public:
InfoBox (WorldObjsData::InfoBoxData* data_);
+ ~InfoBox ();
void draw (GraphicContext& gc);
void update (float delta);
Index: laser_exit.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/laser_exit.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- laser_exit.cxx 13 Sep 2002 18:28:26 -0000 1.4
+++ laser_exit.cxx 14 Sep 2002 19:06:34 -0000 1.5
@@ -17,13 +17,13 @@
// 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 "../graphic_context.hxx"
#include "../pingu.hxx"
#include "../pingu_action.hxx"
+#include "../pingu_holder.hxx"
+#include "../world.hxx"
#include "../worldobjsdata/laser_exit_data.hxx"
+#include "laser_exit.hxx"
namespace WorldObjs {
Index: smasher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/smasher.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- smasher.cxx 10 Sep 2002 19:24:19 -0000 1.3
+++ smasher.cxx 14 Sep 2002 19:06:34 -0000 1.4
@@ -17,17 +17,18 @@
// 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 "../algo.hxx"
#include "../col_map.hxx"
-#include "../world.hxx"
-#include "../pingu_holder.hxx"
-#include "../pingus_resource.hxx"
-#include "../sound.hxx"
+#include "../graphic_context.hxx"
#include "../particles/smoke_particle.hxx"
#include "../particles/particle_holder.hxx"
-#include "../algo.hxx"
#include "../pingu.hxx"
+#include "../pingu_holder.hxx"
+#include "../pingus_resource.hxx"
+#include "../sound.hxx"
+#include "../world.hxx"
#include "../worldobjsdata/smasher_data.hxx"
+#include "smasher.hxx"
namespace WorldObjs {
Index: spike.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/spike.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- spike.cxx 10 Sep 2002 19:24:19 -0000 1.3
+++ spike.cxx 14 Sep 2002 19:06:34 -0000 1.4
@@ -17,12 +17,12 @@
// 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 "../graphic_context.hxx"
+#include "../pingu.hxx"
#include "../pingu_holder.hxx"
#include "../world.hxx"
-#include "../pingu.hxx"
-#include "spike.hxx"
#include "../worldobjsdata/spike_data.hxx"
+#include "spike.hxx"
namespace WorldObjs {
Index: switch_door.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- switch_door.cxx 11 Sep 2002 15:27:19 -0000 1.14
+++ switch_door.cxx 14 Sep 2002 19:06:34 -0000 1.15
@@ -19,10 +19,10 @@
#include <fstream>
#include "../col_map.hxx"
-#include "../world.hxx"
-#include "../pingu_holder.hxx"
-#include "../xml_helper.hxx"
+#include "../graphic_context.hxx"
#include "../pingu.hxx"
+#include "../pingu_holder.hxx"
+#include "../world.hxx"
#include "../worldobjsdata/switch_door_data.hxx"
#include "switch_door.hxx"
@@ -33,6 +33,11 @@
current_door_height(data->door_height),
data(new WorldObjsData::SwitchDoorData(*data_))
{
+}
+
+SwitchDoor::~SwitchDoor ()
+{
+ delete data;
}
void
Index: switch_door.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.hxx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- switch_door.hxx 11 Sep 2002 15:27:19 -0000 1.11
+++ switch_door.hxx 14 Sep 2002 19:06:34 -0000 1.12
@@ -44,6 +44,7 @@
public:
SwitchDoor (WorldObjsData::SwitchDoorData* data_);
+ ~SwitchDoor ();
void draw_colmap ();
void draw (GraphicContext& gc);
Index: teleporter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/teleporter.cxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- teleporter.cxx 10 Sep 2002 19:24:19 -0000 1.9
+++ teleporter.cxx 14 Sep 2002 19:06:34 -0000 1.10
@@ -18,11 +18,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <fstream>
-#include "teleporter.hxx"
-#include "../world.hxx"
-#include "../pingu_holder.hxx"
+#include "../graphic_context.hxx"
#include "../pingu.hxx"
+#include "../pingu_holder.hxx"
+#include "../world.hxx"
#include "../worldobjsdata/teleporter_data.hxx"
+#include "teleporter.hxx"
namespace WorldObjs {
@@ -36,6 +37,11 @@
//FIXME: we need a Sprite::set_frame()
std::cout << "Teleporter: pos: " << data->pos.x << " " << data->pos.y << "
" << data->pos.z << std::endl;
+}
+
+Teleporter::~Teleporter ()
+{
+ delete data;
}
float
Index: teleporter.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/teleporter.hxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- teleporter.hxx 10 Sep 2002 19:24:19 -0000 1.12
+++ teleporter.hxx 14 Sep 2002 19:06:34 -0000 1.13
@@ -34,6 +34,7 @@
WorldObjsData::TeleporterData* const data;
public:
Teleporter (WorldObjsData::TeleporterData* data_);
+ ~Teleporter ();
int get_z_pos () { return 0; }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjs bumper.cxx,1.3,1.4 conveyor_belt.cxx,1.12,1.13 conveyor_belt.hxx,1.9,1.10 fake_exit.cxx,1.3,1.4 guillotine.cxx,1.3,1.4 hammer.cxx,1.3,1.4 hammer.hxx,1.3,1.4 ice_block.cxx,1.12,1.13 ice_block.hxx,1.8,1.9 info_box.cxx,1.12,1.13 info_box.hxx,1.10,1.11 laser_exit.cxx,1.4,1.5 smasher.cxx,1.3,1.4 spike.cxx,1.3,1.4 switch_door.cxx,1.14,1.15 switch_door.hxx,1.11,1.12 teleporter.cxx,1.9,1.10 teleporter.hxx,1.12,1.13,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata conveyor_belt_data.cxx,NONE,1.1 conveyor_belt_data.hxx,NONE,1.1 ice_block_data.cxx,NONE,1.1 ice_block_data.hxx,NONE,1.1 Makefile.am,1.4,1.5 guillotine_data.cxx,1.4,1.5 info_box_data.cxx,1.1,1.2 switch_door_data.cxx,1.1,1.2
- Next by Date:
[Pingus-CVS] Further splitting of WorldObjs aka backgrounds
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata conveyor_belt_data.cxx,NONE,1.1 conveyor_belt_data.hxx,NONE,1.1 ice_block_data.cxx,NONE,1.1 ice_block_data.hxx,NONE,1.1 Makefile.am,1.4,1.5 guillotine_data.cxx,1.4,1.5 info_box_data.cxx,1.1,1.2 switch_door_data.cxx,1.1,1.2
- Next by thread:
[Pingus-CVS] Further splitting of WorldObjs aka backgrounds
- Index(es):