[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2512 - in trunk: data/levels/volcano data/worldmaps src sr
From: |
jave27 |
Subject: |
[Pingus-CVS] r2512 - in trunk: data/levels/volcano data/worldmaps src src/worldmap |
Date: |
Fri, 18 Nov 2005 22:08:19 +0100 |
Author: jave27
Date: 2005-11-18 22:08:07 +0100 (Fri, 18 Nov 2005)
New Revision: 2512
Modified:
trunk/data/levels/volcano/hellmouth14-grumbel.pingus
trunk/data/worldmaps/volcano.xml
trunk/src/savegame.cxx
trunk/src/savegame.hxx
trunk/src/savegame_manager.cxx
trunk/src/worldmap/graph.hxx
trunk/src/worldmap/manager.cxx
trunk/src/worldmap/path_graph.cxx
trunk/src/worldmap/worldmap.cxx
trunk/src/worldmap/worldmap.hxx
trunk/src/xml_file_writer.cxx
Log:
Cleaned up the savegame manager XML code.
Fixed the worldmap so it pulls worldmap information from the XML file instead
of hard-coding it.
More general cleanup to get rid of some compiler warnings.
Made the exit visible on the hellmouth14-grumbel.pingus level.
Some of the leveldots are inaccessible in volcano still.
Modified: trunk/data/levels/volcano/hellmouth14-grumbel.pingus
===================================================================
--- trunk/data/levels/volcano/hellmouth14-grumbel.pingus 2005-11-18
16:22:08 UTC (rev 2511)
+++ trunk/data/levels/volcano/hellmouth14-grumbel.pingus 2005-11-18
21:08:07 UTC (rev 2512)
@@ -126,7 +126,7 @@
<position>
<x>1080</x>
<y>265</y>
-<z>-5</z>
+<z>0</z>
</position>
<surface>
<image>exits/stone</image>
Modified: trunk/data/worldmaps/volcano.xml
===================================================================
--- trunk/data/worldmaps/volcano.xml 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/data/worldmaps/volcano.xml 2005-11-18 21:08:07 UTC (rev 2512)
@@ -1,12 +1,12 @@
<pingus-worldmap>
- <properties>
+ <head>
<name>Volcano Island</name>
- <music>pingus-1.it</music>
+ <music>gd-myla.it</music>
<author>Ingo Ruhnke</author>
<email>address@hidden</email>
- <width>1161</width>
+ <width>800</width>
<height>600</height>
- </properties>
+ </head>
<!-- The graph specifies the path on which the pingu can walk -->
<graph>
Modified: trunk/src/savegame.cxx
===================================================================
--- trunk/src/savegame.cxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/savegame.cxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -76,9 +76,8 @@
}
void
-Savegame::write_xml(std::ostream& xml)
+Savegame::write_xml(XMLFileWriter& writer)
{
- XMLFileWriter writer(xml);
writer.begin_section("level");
writer.write_string ("name", levelname);
writer.write_enum ("status", status, status_to_string);
Modified: trunk/src/savegame.hxx
===================================================================
--- trunk/src/savegame.hxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/savegame.hxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -25,6 +25,8 @@
namespace Pingus {
+ class XMLFileWriter;
+
/** The Savegame class holds savegame informations for a single
level */
class Savegame
@@ -52,7 +54,7 @@
Savegame(std::string arg_levelname, S_Status arg_status, int arg_time, int
arg_saved_pingus);
void read_xml(FileReader node);
- void write_xml(std::ostream& xml);
+ void write_xml(XMLFileWriter& xml);
};
} // namespace Pingus
Modified: trunk/src/savegame_manager.cxx
===================================================================
--- trunk/src/savegame_manager.cxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/savegame_manager.cxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -24,6 +24,7 @@
#include "system.hxx"
#include "pingus_error.hxx"
#include "xml_file_reader.hxx"
+#include "xml_file_writer.hxx"
#include "savegame_manager.hxx"
namespace Pingus {
@@ -141,18 +142,18 @@
void
SavegameManager::flush()
{
- std::ofstream xml(filename.c_str());
- xml << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n"
- << "<pingus-savegame>\n";
+ std::ofstream out(filename.c_str());
+ XMLFileWriter xml(out);
+ xml.begin_section("pingus-savegame");
+
for(SavegameTable::iterator i = savegames.begin(); i != savegames.end(); ++i)
{
assert(i->second);
i->second->write_xml(xml);
}
- xml << "</pingus-savegame>\n"
- << std::endl;
+ xml.end_section(); // pingus-savegame
}
} // namespace Pingus
Modified: trunk/src/worldmap/graph.hxx
===================================================================
--- trunk/src/worldmap/graph.hxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/worldmap/graph.hxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -106,7 +106,7 @@
{
Edge<EdgeType> new_edge (data, a, b, cost);
edges.push_back (new_edge);
- resolve_node (a).next.push_back (edges.size ()-1);
+ resolve_node(a).next.push_back ((int)edges.size()-1);
return EdgeId (edges.size ()-1);
}
@@ -175,7 +175,7 @@
}
int max_node_handler_value () {
- return nodes.size ();
+ return (int)nodes.size ();
}
};
Modified: trunk/src/worldmap/manager.cxx
===================================================================
--- trunk/src/worldmap/manager.cxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/worldmap/manager.cxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -100,7 +100,7 @@
WorldMapManagerCreditsButton::draw (DrawingContext& gc)
{
SurfaceButton::draw(gc);
- gc.print_left(Fonts::chalk_small, CL_Display::get_width() - 150 + 15, 5,
_("Show Ending?"));
+ gc.print_left(Fonts::chalk_small, (float)(CL_Display::get_width() - 150 +
15), 5, _("Show Ending?"));
}
void
@@ -158,7 +158,7 @@
WorldMapManagerCloseButton::draw (DrawingContext& gc)
{
SurfaceButton::draw(gc);
- gc.print_left(Fonts::chalk_small, 10, CL_Display::get_height() - 20,
_("Leave?"));
+ gc.print_left(Fonts::chalk_small, 10, (float)CL_Display::get_height() - 20,
_("Leave?"));
}
void
@@ -190,14 +190,14 @@
{
if (WorldMapManager::instance()->get_worldmap()->get_pingus()->is_walking())
{
- gc.draw(button_surface, Vector(x_pos, y_pos));
+ gc.draw(button_surface, Vector((float)x_pos, (float)y_pos));
}
else
{
SurfaceButton::draw(gc);
gc.print_left(Fonts::chalk_small,
- CL_Display::get_width() - 100,
- CL_Display::get_height() - 20,
+ (float)CL_Display::get_width() - 100,
+ (float)CL_Display::get_height() - 20,
_("Enter?"));
}
}
Modified: trunk/src/worldmap/path_graph.cxx
===================================================================
--- trunk/src/worldmap/path_graph.cxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/worldmap/path_graph.cxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -256,7 +256,7 @@
{
for(std::vector<Dot*>::iterator i = dots.begin(); i != dots.end(); ++i)
if (dot == *i)
- return i - dots.begin();
+ return (int)(i - dots.begin());
return NoNode;
}
Modified: trunk/src/worldmap/worldmap.cxx
===================================================================
--- trunk/src/worldmap/worldmap.cxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/worldmap/worldmap.cxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -53,7 +53,6 @@
WorldMap::WorldMap(const std::string& arg_filename)
: filename(arg_filename),
- width(1161), height(600), // FIXME: ugly..
mouse_x(0),
mouse_y(0)
{
@@ -156,7 +155,12 @@
void
WorldMap::parse_properties(FileReader reader)
{
- UNUSED_ARG(reader);
+ reader.read_string("music", music);
+ reader.read_string("author", author);
+ reader.read_string("name", name);
+ reader.read_string("email", email);
+ reader.read_int("width", width);
+ reader.read_int("height", height);
}
void
@@ -239,6 +243,7 @@
void
WorldMap::on_startup()
{
+ Sound::PingusSound::play_music(music);
update_locked_nodes();
}
@@ -279,9 +284,9 @@
<< " <dot>\n"
<< " <name>leveldot_X</name>\n"
<< " <position>\n"
- << " <x-pos>" << (int)click_pos.x << "</x-pos>\n"
- << " <y-pos>" << (int)click_pos.y << "</y-pos>\n"
- << " <z-pos>0</z-pos>\n"
+ << " <x>" << (int)click_pos.x << "</x>\n"
+ << " <y>" << (int)click_pos.y << "</y>\n"
+ << " <z>0</z>\n"
<< " </position>\n"
<< " </dot>\n"
<< " <levelname>level10.pingus</levelname>\n"
Modified: trunk/src/worldmap/worldmap.hxx
===================================================================
--- trunk/src/worldmap/worldmap.hxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/worldmap/worldmap.hxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -62,6 +62,11 @@
int width;
int height;
+ std::string name;
+ std::string author;
+ std::string email;
+ std::string music;
+
Pingus* pingus;
GraphicContextState gc_state;
Modified: trunk/src/xml_file_writer.cxx
===================================================================
--- trunk/src/xml_file_writer.cxx 2005-11-18 16:22:08 UTC (rev 2511)
+++ trunk/src/xml_file_writer.cxx 2005-11-18 21:08:07 UTC (rev 2512)
@@ -27,8 +27,8 @@
XMLFileWriter::XMLFileWriter(std::ostream& out_)
: out(&out_)
{
- if ((*out).out)
- (*out) << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";}
+ (*out) << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
+}
XMLFileWriter::~XMLFileWriter()
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2512 - in trunk: data/levels/volcano data/worldmaps src src/worldmap,
jave27 <=