[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata switch_door_data.cxx,NO
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata switch_door_data.cxx,NONE,1.1 switch_door_data.hxx,NONE,1.1 Makefile.am,1.2,1.3 |
Date: |
11 Sep 2002 15:27:22 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjsdata
In directory dark:/tmp/cvs-serv15619/worldobjsdata
Modified Files:
Makefile.am
Added Files:
switch_door_data.cxx switch_door_data.hxx
Log Message:
splitted SwitchDoor
--- NEW FILE: switch_door_data.cxx ---
// $Id: switch_door_data.cxx,v 1.1 2002/09/11 15:27:19 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <fstream>
#include "../pingus_resource.hxx"
#include "../xml_helper.hxx"
#include "../editorobjs/switch_door_obj.hxx"
#include "../editorobjs/switch_door_switch_obj.hxx"
#include "../worldobjs/switch_door.hxx"
#include "switch_door_data.hxx"
namespace WorldObjsData {
SwitchDoorData::SwitchDoorData ()
: door_box (PingusResource::load_surface("switchdoor_box" ,
"worldobjs")),
door_tile (PingusResource::load_surface("switchdoor_tile" ,
"worldobjs")),
door_tile_cmap(PingusResource::load_surface("switchdoor_tile_cmap",
"worldobjs")),
switch_sur (PingusResource::load_surface("switchdoor_switch" ,
"worldobjs")),
door_height(10)
{
}
SwitchDoorData::SwitchDoorData (xmlDocPtr doc, xmlNodePtr cur)
{
cur = cur->children;
while (cur)
{
if (xmlIsBlankNode(cur)) {
cur = cur->next;
continue;
}
if (XMLhelper::equal_str(cur->name, "switch"))
{
xmlNodePtr subcur = cur->children;
while (subcur)
{
if (xmlIsBlankNode(subcur)) {
subcur = subcur->next;
continue;
}
if (XMLhelper::equal_str(subcur->name, "position"))
{
switch_pos = XMLhelper::parse_vector(doc, subcur);
}
else
std::cout << "SwitchDoorData: switch: Unhandled " <<
subcur->name << std::endl;
subcur = subcur->next;
}
}
else if (XMLhelper::equal_str(cur->name, "door"))
{
xmlNodePtr subcur = cur->children;
while (subcur)
{
if (xmlIsBlankNode(subcur)) {
subcur = subcur->next;
continue;
}
if (XMLhelper::equal_str(subcur->name, "position"))
{
door_pos = XMLhelper::parse_vector(doc, subcur);
}
else if (XMLhelper::equal_str(subcur->name, "height"))
{
door_height = XMLhelper::parse_int(doc, subcur);
}
else
std::cout << "SwitchDoor::door: Unhandled " << subcur->name <<
std::endl;
subcur = subcur->next;
}
}
cur = cur->next;
}
}
SwitchDoorData::SwitchDoorData (const SwitchDoorData& old)
: WorldObjData(old),
door_box(old.door_box),
door_tile(old.door_tile),
door_tile_cmap(old.door_tile_cmap),
switch_sur(old.switch_sur),
door_pos(old.door_pos),
switch_pos(old.switch_pos),
door_height(old.door_height)
{
}
void
SwitchDoorData::write_xml (std::ostream& xml)
{
xml << " <worldobj type=\"switchdoor\">\n";
xml << " <switch>\n";
XMLhelper::write_vector_xml(xml, switch_pos);
xml << " </switch>\n"
<< " <door>\n"
<< " <height>\n" << door_height << "</height>\n";
XMLhelper::write_vector_xml(xml, door_pos);
xml << " </door>\n"
<< " </worldobj>\n" << std::endl;
}
/** Create an WorldObj from the given data object */
WorldObj*
SwitchDoorData::create_WorldObj ()
{
return new WorldObjs::SwitchDoor (this);
}
/** Create an EditorObj from the given data object */
EditorObjLst
SwitchDoorData::create_EditorObj ()
{
EditorObjLst lst(2);
EditorObjs::SwitchDoorObj* obj = new EditorObjs::SwitchDoorObj(this);
lst[0] = obj;
lst[1] = new EditorObjs::SwitchDoorSwitchObj(obj);
return lst;
}
} // namespace WorldObjsData
/* EOF */
--- NEW FILE: switch_door_data.hxx ---
// $Id: switch_door_data.hxx,v 1.1 2002/09/11 15:27:19 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_PINGUS_WORLDOBJSDATA_SWITCH_DOOR_DATA_HXX
#define HEADER_PINGUS_WORLDOBJSDATA_SWITCH_DOOR_DATA_HXX
#include <ClanLib/Core/Math/cl_vector.h>
#include <ClanLib/Display/Display/surface.h>
#include "../worldobj_data.hxx"
#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
{
public:
CL_Surface door_box;
CL_Surface door_tile;
CL_Surface door_tile_cmap;
CL_Surface switch_sur;
/// The upper/middle pos of the door
CL_Vector door_pos;
/// The bottom/middle pos of the switch
CL_Vector switch_pos;
// The height of the door in graphic tiles
int door_height;
SwitchDoorData ();
SwitchDoorData (xmlDocPtr doc, xmlNodePtr cur);
SwitchDoorData (const SwitchDoorData& 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 ();
private:
SwitchDoorData operator= (const SwitchDoorData&);
};
} // namespace WorldObjsData
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjsdata/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Makefile.am 9 Sep 2002 16:13:44 -0000 1.2
+++ Makefile.am 11 Sep 2002 15:27:19 -0000 1.3
@@ -18,13 +18,14 @@
noinst_LIBRARIES = libpingus_worldobjsdata.a
libpingus_worldobjsdata_a_SOURCES = \
- bumper_data.cxx bumper_data.hxx \
- fake_exit_data.cxx fake_exit_data.hxx \
- guillotine_data.cxx guillotine_data.hxx \
- hammer_data.cxx hammer_data.hxx \
- laser_exit_data.cxx laser_exit_data.hxx \
- smasher_data.cxx smasher_data.hxx \
- spike_data.cxx spike_data.hxx \
- teleporter_data.cxx teleporter_data.hxx
+ bumper_data.cxx bumper_data.hxx \
+ fake_exit_data.cxx fake_exit_data.hxx \
+ guillotine_data.cxx guillotine_data.hxx \
+ hammer_data.cxx hammer_data.hxx \
+ laser_exit_data.cxx laser_exit_data.hxx \
+ smasher_data.cxx smasher_data.hxx \
+ spike_data.cxx spike_data.hxx \
+ switch_door_data.cxx switch_door_data.hxx \
+ teleporter_data.cxx teleporter_data.hxx
# EOF #
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata switch_door_data.cxx,NONE,1.1 switch_door_data.hxx,NONE,1.1 Makefile.am,1.2,1.3,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor object_selector.cxx,1.13,1.14
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs switch_door.cxx,1.13,1.14 switch_door.hxx,1.10,1.11
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor object_selector.cxx,1.13,1.14
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs switch_door.cxx,1.13,1.14 switch_door.hxx,1.10,1.11
- Index(es):