[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src spot_map.cxx,1.15,1.16 worldobj_data_
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src spot_map.cxx,1.15,1.16 worldobj_data_factory.cxx,1.19,1.20 xml_plf.cxx,1.19,1.20 |
Date: |
17 Sep 2002 01:04:01 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv20340/src
Modified Files:
spot_map.cxx worldobj_data_factory.cxx xml_plf.cxx
Log Message:
new groundpiece code, compile with -DNEW_GROUNDPIECES to use it
Index: spot_map.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/spot_map.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- spot_map.cxx 16 Sep 2002 20:31:09 -0000 1.15
+++ spot_map.cxx 17 Sep 2002 01:03:59 -0000 1.16
@@ -47,7 +47,8 @@
{
}
-MapTileSurface MapTileSurface::operator= (const MapTileSurface& old)
+MapTileSurface
+MapTileSurface::operator= (const MapTileSurface& old)
{
if (this == &old)
return *this;
@@ -105,7 +106,9 @@
{
colmap = 0;
load(plf);
+#ifndef NEW_GROUNDPIECES
gen_tiles();
+#endif
}
PingusSpotMap::~PingusSpotMap(void)
@@ -169,6 +172,7 @@
surfaces = plf->get_groundpieces();
+#ifndef NEW_GROUNDPIECES
for (vector<GroundpieceData>::iterator i = surfaces.begin();
i != surfaces.end();
++i) // WIN32BUG
@@ -176,6 +180,8 @@
i->surface = PingusResource::load_surface(i->desc);
}
create_map();
+#endif
+
}
void
@@ -238,6 +244,27 @@
{
//std::cout << "Draw: " << " x_pos: " << x_pos << " y_pos: "
//<< " w: " << w << " h: " << h << " s: " << s << std::endl;
+
+#if 0
+ { // calculate number of tiles
+ int tiles_total = 0;
+ int tiles_empty = 0;
+ int tiles_used = 0;
+ for(TileIter x=0; x < tile.size(); ++x)
+ {
+ for(TileIter y=0; y < tile[x].size(); ++y)
+ {
+ if (tile[x][y].is_empty())
+ ++tiles_empty;
+ else
+ ++tiles_used;
+ ++tiles_total;
+ }
+ }
+ std::cout << "Tiles: " << tiles_total << " " << tiles_empty << "/" <<
tiles_used << std::endl;
+ std::cout << " " << float(tiles_used)/float(tiles_total) * 100.0f << "%
of the map are used" << std::endl;
+ }
+#endif
// FIXME: delete the next four lines and replace them with gc.get_clip_rect()
int w = CL_Display::get_width ();
@@ -458,7 +485,7 @@
if (tile[ix][iy].surface == 0)
{
CL_Canvas* canvas;
- std::cout << "PingusSpotMap: Drawing to an emtpy tile: " << ix <<
" " << iy << std::endl;
+ //std::cout << "PingusSpotMap: Drawing to an emtpy tile: " << ix
<< " " << iy << std::endl;
canvas = new CL_Canvas(tile_size, tile_size);
Blitter::clear_canvas(canvas);
@@ -523,6 +550,7 @@
std::cout << "PingusSpotMap: Generating Colision Map..." << std::flush;
}
+#ifndef NEW_GROUNDPIECES
for(std::vector<GroundpieceData>::iterator i2 = surfaces.begin();
i2 != surfaces.end();
i2++)
@@ -532,7 +560,7 @@
else
colmap->put(i2->surface, (int) i2->pos.x, (int) i2->pos.y,
i2->gptype);
}
-
+#endif
if (verbose)
std::cout << "done " << timer.stop() << std::endl;
Index: worldobj_data_factory.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobj_data_factory.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- worldobj_data_factory.cxx 16 Sep 2002 20:52:22 -0000 1.19
+++ worldobj_data_factory.cxx 17 Sep 2002 01:03:59 -0000 1.20
@@ -113,29 +113,36 @@
WorldObjDataFactory::create (xmlDocPtr doc, xmlNodePtr cur)
{
std::cout << "WorldObjDataFactory::create (xmlDocPtr doc, xmlNodePtr cur)"
<< std::endl;
- char* type = XMLhelper::get_prop(cur, "type");
- if (type)
+
+ // Compatibility stuff
+ if (XMLhelper::equal_str(cur->name, "hotspot"))
{
- return create (type, doc, cur);
+ return create ("hotspot", doc, cur);
+ }
+ else if (XMLhelper::equal_str(cur->name, "exit"))
+ {
+ return create ("exit", doc, cur);
+ }
+ else if (XMLhelper::equal_str(cur->name, "entrance"))
+ {
+ return create ("entrance", doc, cur);
+ }
+ else if (XMLhelper::equal_str(cur->name, "groundpiece"))
+ {
+ return create ("groundpiece", doc, cur);
}
else
{
- // Compatibility stuff
- if (XMLhelper::equal_str(cur->name, "hotspot"))
- {
- return create ("hotspot", doc, cur);
- }
- else if (XMLhelper::equal_str(cur->name, "exit"))
+ char* type = XMLhelper::get_prop(cur, "type");
+ if (type)
{
- return create ("exit", doc, cur);
+ return create (type, doc, cur);
}
- else if (XMLhelper::equal_str(cur->name, "entrance"))
+ else
{
- return create ("entrance", doc, cur);
+ PingusError::raise ("WorldObjDataFactory::create: Error, no type
given. - "
+ + std::string((char*) cur->name));
}
- else
- PingusError::raise ("WorldObjDataFactory::create: Error, no type given.
- "
- + std::string((char*) cur->name));
}
return 0; //never reached
Index: xml_plf.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/xml_plf.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- xml_plf.cxx 16 Sep 2002 20:31:09 -0000 1.19
+++ xml_plf.cxx 17 Sep 2002 01:03:59 -0000 1.20
@@ -111,7 +111,12 @@
}
else if (XMLhelper::equal_str(cur->name, "groundpiece"))
{
+#ifdef NEW_GROUNDPIECES
+ // FIXME: This is *not* backward compatible and wreck the levels
+ worldobjs_data.push_back(WorldObjDataFactory::instance()->create
(doc, cur));
+#else
parse_groundpiece(cur);
+#endif
}
else if (XMLhelper::equal_str(cur->name, "exit"))
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src spot_map.cxx,1.15,1.16 worldobj_data_factory.cxx,1.19,1.20 xml_plf.cxx,1.19,1.20,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/data/levels large1.xml,1.2,1.3
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata info_box_data.cxx,1.3,1.4 info_box_data.hxx,1.1,1.2
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/data/levels large1.xml,1.2,1.3
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata info_box_data.cxx,1.3,1.4 info_box_data.hxx,1.1,1.2
- Index(es):