[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2658 - in branches/pingus_sdl: . data/worldmaps src src/wo
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r2658 - in branches/pingus_sdl: . data/worldmaps src src/worldmap |
Date: |
Mon, 15 Jan 2007 22:29:29 +0100 |
Author: grumbel
Date: 2007-01-15 22:29:28 +0100 (Mon, 15 Jan 2007)
New Revision: 2658
Added:
branches/pingus_sdl/data/worldmaps/tutorial.worldmap
Modified:
branches/pingus_sdl/src/file_reader.cxx
branches/pingus_sdl/src/file_reader.hxx
branches/pingus_sdl/src/pingus_main.cxx
branches/pingus_sdl/src/worldmap/level_dot.cxx
branches/pingus_sdl/src/worldmap/manager.cxx
branches/pingus_sdl/src/worldmap/manager.hxx
branches/pingus_sdl/src/worldmap/path_graph.cxx
branches/pingus_sdl/src/worldmap/worldmap.cxx
branches/pingus_sdl/xml2sexpr.rb
Log:
- worldmap loads partially now
Added: branches/pingus_sdl/data/worldmaps/tutorial.worldmap
===================================================================
--- branches/pingus_sdl/data/worldmaps/tutorial.worldmap 2007-01-15
16:21:21 UTC (rev 2657)
+++ branches/pingus_sdl/data/worldmaps/tutorial.worldmap 2007-01-15
21:29:28 UTC (rev 2658)
@@ -0,0 +1,374 @@
+;; generated by xml2sexpr.rb convert script from 'data/worldmaps/tutorial.xml'
+(pingus-worldmap
+ (head
+ (name "Tutorial Island")
+ (short-name "tutorial")
+ (description "Learn the basics")
+ (music "pingus-1.it")
+ (author "Ingo Ruhnke")
+ (email "address@hidden")
+ (width 1161)
+ (height 600)
+ (default-node "leveldot_1")
+ (final-node "leveldot_19"))
+ (intro_story
+ (title "The Journey Begins")
+ (music "pingus-4.it")
+ (pages
+ (page00
+ (surface
+ (image "story/story0")
+ (modifier "ROT0"))
+ (text "For a long time, the Pingus have lived happily in peace on the
South Pole "
+ "along with all the other animals. Everything was in balance and
it seemed "
+ "like nothing could disrupt their peace. The Pingus were happy
and it seemed "
+ "like this could never end."))
+ (page01
+ (surface
+ (image "story/story1")
+ (modifier "ROT0"))
+ (text "But then one day, things began to change slowly: the sky got
darker and the "
+ "earth got warmer. Firstly, they thought this was just a normal
fluctuation "
+ "in the world's climate, but things seemed to get worse and
worse with every "
+ "year."))
+ (page02
+ (surface
+ (image "story/story2")
+ (modifier "ROT0"))
+ (text "The snow began to melt away in a few areas and food became an
issue. Other "
+ "animals tried to leave the region to search for colder areas,
but the Pingus "
+ "knew that this wouldn't help: they knew that they had to do
something about "
+ "it."))
+ (page03
+ (surface
+ (image "story/story3")
+ (modifier "ROT0"))
+ (text "So the circle of the eldest came together to decide what to do
about it. "
+ "They decided to send out an expedition around the world to find
the cause "
+ "of this warming. The expedition consisted of hundreds of the
bravest Pingus "
+ "on the South Pole."))
+ (page04
+ (surface
+ (image "story/story4")
+ (modifier "ROT0"))
+ (text "And they picked you to lead them on their journey around the
world. Since "
+ "the journey will be dangerous and difficult, your first goal is
the Island "
+ "of Mogorok, also known as the Tutorial Island. According to the
eldest, this "
+ "island has always been the first stop of Pingus that were sent
out into the "
+ "world."))
+ (page05
+ (surface
+ (image "story/story5")
+ (modifier "ROT0"))
+ (text "The island consists of many areas that are ideal to teach the
Pingus their "
+ "abilities. The Pingus can learn to build bridges, climb, bash
and use many "
+ "other talents which they will need on their long and dangerous
journey."))
+ (page06
+ (surface
+ (image "story/story6")
+ (modifier "ROT0"))
+ (text "While there, you can practice your abilities in commanding and
guiding the "
+ "Pingus. You can also get familiar with all the abilities the
Pingus provide "
+ "and learn to master them, since you will need all of them on
your journey "
+ "around the world."))
+ (page07
+ (surface
+ (image "story/story6")
+ (modifier "ROT0"))
+ (text "Now that you and the Pingus have arrived at Tutorial Island it
is time to "
+ "take command and begin your mission. Good Luck!"))))
+ (end_story
+ (title "The Journey Continues")
+ (music "pingus-4.it")
+ (pages
+ (page01
+ (surface
+ (image "story/credits1")
+ (modifier "ROT0"))
+ (text "Now after you and the Pingus have learned the basics and
practiced a bit "
+ "it is time to move on and begin the journey into the world.
Since the ice "
+ "floe with which the Pingus traveled to the Tutorial Island
isn't going to "
+ "hold on the whole way into the warmer climates the Pingus have
to find something "
+ "else to guide them on their journey."))
+ (page02
+ (surface
+ (image "story/credits2")
+ (modifier "ROT0"))
+ (text "But as the eldest have said, the Tutorial Island provides not
only a good "
+ "way to practice, but it is also the starting point into the
world. After "
+ "some searching the Pingus discovered the meaning of this, and
they found "
+ "the large tree at the end of the island which gave them wood to
construct "
+ "a float."))
+ (page03
+ (surface
+ (image "story/credits3")
+ (modifier "ROT0"))
+ (text "So the Pingus set out and constructed some large rafts, enough
to carry them "
+ "all. After also packing a bunch of provisions they were
prepared to start "
+ "their journey and leave their familiar ground and enter the
unknown parts "
+ "of the world."))
+ (page04
+ (surface
+ (image "story/credits4")
+ (modifier "ROT0"))
+ (text "So the Pingus sit on their raft, worrying about what's to come
and where "
+ "to go, while floating into the sunset. To be continued..."))))
+ (graph
+ (nodes
+ (leveldot
+ (dot
+ (name "leveldot_1")
+ (position 135 414 0))
+ (levelname "tutorial/digger-tutorial2-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_2")
+ (position 240 404 0))
+ (levelname "tutorial/floater-tutorial-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_3")
+ (position 326 360 -55))
+ (levelname "tutorial/snow8-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_4")
+ (position 415 325 -55))
+ (levelname "tutorial/basher-tutorial-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_5")
+ (position 520 288 0))
+ (levelname "tutorial/snow9-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_6")
+ (position 595 280 0))
+ (levelname "tutorial/snow10-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_7")
+ (position 658 216 0))
+ (levelname "tutorial/jumper-tutorial-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_8")
+ (position 739 213 0))
+ (levelname "tutorial/miner-tutorial2-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_9")
+ (position 819.5 298.5 0))
+ (levelname "tutorial/bomber-tutorial2-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_10")
+ (position 736 330 0))
+ (levelname "tutorial/solid-tutorial-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_11")
+ (position 594 376 5000))
+ (levelname "tutorial/snow14-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_12")
+ (position 481 373 5000))
+ (levelname "tutorial/snow19-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_13")
+ (position 373 418 5000))
+ (levelname "tutorial/snow21-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_14")
+ (position 454 460 5000))
+ (levelname "tutorial/snow15-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_15")
+ (position 630 467 150))
+ (levelname "tutorial/snow20-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_16")
+ (position 718 473 150))
+ (levelname "tutorial/snow17-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_17")
+ (position 844 445 150))
+ (levelname "tutorial/snow12-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_18")
+ (position 962 383 0))
+ (levelname "tutorial/snow7-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_19")
+ (position 1028 388 0))
+ (levelname "tutorial/snow11-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_20")
+ (position 729 403 0))
+ (levelname "tutorial/snow16-grumbel"))
+ (leveldot
+ (dot
+ (name "leveldot_21")
+ (position 870 377 0))
+ (levelname "tutorial/snow22-grumbel")))
+ (edges
+ (edge
+ (name "egde_1")
+ (source "leveldot_1")
+ (destination "leveldot_2")
+ (positions ))
+ (edge
+ (name "egde_2")
+ (source "leveldot_2")
+ (destination "leveldot_3")
+ (positions
+ (position 269 393 0)))
+ (edge
+ (name "egde_3")
+ (source "leveldot_3")
+ (destination "leveldot_4")
+ (positions ))
+ (edge
+ (name "egde_4")
+ (source "leveldot_4")
+ (destination "leveldot_5")
+ (positions ))
+ (edge
+ (name "egde_5")
+ (source "leveldot_5")
+ (destination "leveldot_6")
+ (positions ))
+ (edge
+ (name "egde_6")
+ (source "leveldot_6")
+ (destination "leveldot_7")
+ (positions
+ (position 637 228 0)))
+ (edge
+ (name "egde_7")
+ (source "leveldot_7")
+ (destination "leveldot_8")
+ (positions ))
+ (edge
+ (name "egde_8")
+ (source "leveldot_7")
+ (destination "leveldot_8")
+ (positions ))
+ (edge
+ (name "egde_9")
+ (source "leveldot_8")
+ (destination "leveldot_9")
+ (positions
+ (position 761 229 0)
+ (position 784 256 0)
+ (position 818 285 0)))
+ (edge
+ (name "egde_10")
+ (source "leveldot_9")
+ (destination "leveldot_10")
+ (positions ))
+ (edge
+ (name "egde_11")
+ (source "leveldot_10")
+ (destination "leveldot_11")
+ (positions
+ (position 678 347 5000)))
+ (edge
+ (name "egde_12")
+ (source "leveldot_11")
+ (destination "leveldot_12")
+ (positions ))
+ (edge
+ (name "egde_13")
+ (source "leveldot_12")
+ (destination "leveldot_13")
+ (positions
+ (position 444 379 5000)
+ (position 389 403 5000)))
+ (edge
+ (name "egde_22")
+ (source "leveldot_13")
+ (destination "leveldot_14")
+ (positions ))
+ (edge
+ (name "egde_14")
+ (source "leveldot_14")
+ (destination "leveldot_15")
+ (positions
+ (position 503 470 5000)
+ (position 568 471 250)))
+ (edge
+ (name "egde_15")
+ (source "leveldot_15")
+ (destination "leveldot_16")
+ (positions ))
+ (edge
+ (name "egde_16")
+ (source "leveldot_16")
+ (destination "leveldot_17")
+ (positions ))
+ (edge
+ (name "egde_17")
+ (source "leveldot_17")
+ (destination "leveldot_18")
+ (positions
+ (position 905 417 250)))
+ (edge
+ (name "egde_18")
+ (source "leveldot_18")
+ (destination "leveldot_19")
+ (positions ))
+ (edge
+ (name "egde_19")
+ (source "leveldot_15")
+ (destination "leveldot_20")
+ (positions
+ (position 678 449 150)))
+ (edge
+ (name "egde_20")
+ (source "leveldot_20")
+ (destination "leveldot_21")
+ (positions
+ (position 787 384 0)))
+ (edge
+ (name "egde_21")
+ (source "leveldot_21")
+ (destination "leveldot_18")
+ (positions ))))
+ (objects
+ (surface
+ (name "background_1")
+ (surface
+ (image "worldmaps/tutorial/layer0")
+ (modifer ))
+ (position 0 0 -100))
+ (surface
+ (name "background_1")
+ (surface
+ (image "worldmaps/tutorial/layer3")
+ (modifer ))
+ (position 701 405 100))
+ (surface
+ (name "mountain_1")
+ (surface
+ (image "worldmaps/tutorial/layer1")
+ (modifer ))
+ (position 208 309 -50)
+ (auto-uncover 1))
+ (surface
+ (name "mountain_2")
+ (surface
+ (image "worldmaps/tutorial/layer2")
+ (modifer ))
+ (position 788 343 100)
+ (auto-uncover 0))))
+;; EOF ;;
Modified: branches/pingus_sdl/src/file_reader.cxx
===================================================================
--- branches/pingus_sdl/src/file_reader.cxx 2007-01-15 16:21:21 UTC (rev
2657)
+++ branches/pingus_sdl/src/file_reader.cxx 2007-01-15 21:29:28 UTC (rev
2658)
@@ -17,6 +17,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include "sexpr_file_reader.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
#include "file_reader.hxx"
#include "file_reader_impl.hxx"
@@ -155,4 +158,19 @@
return reader;
}
+FileReader
+FileReader::parse(const std::string& filename)
+{
+ // FIXME: memory leak, somebody must delete the lisp::Lisp
+ lisp::Lisp* sexpr = lisp::Parser::parse(filename);
+ if (sexpr)
+ {
+ return SExprFileReader(sexpr->get_list_elem(0));
+ }
+ else
+ {
+ return FileReader();
+ }
+}
+
/* EOF */
Modified: branches/pingus_sdl/src/file_reader.hxx
===================================================================
--- branches/pingus_sdl/src/file_reader.hxx 2007-01-15 16:21:21 UTC (rev
2657)
+++ branches/pingus_sdl/src/file_reader.hxx 2007-01-15 21:29:28 UTC (rev
2658)
@@ -72,6 +72,8 @@
std::vector<std::string> get_section_names() const;
std::vector<FileReader> get_sections() const;
+
+ static FileReader parse(const std::string& filename);
private:
SharedPtr<FileReaderImpl> impl;
};
Modified: branches/pingus_sdl/src/pingus_main.cxx
===================================================================
--- branches/pingus_sdl/src/pingus_main.cxx 2007-01-15 16:21:21 UTC (rev
2657)
+++ branches/pingus_sdl/src/pingus_main.cxx 2007-01-15 21:29:28 UTC (rev
2658)
@@ -73,12 +73,12 @@
// #include "pingu_action_factory.hxx"
// #include "credits.hxx"
#include "sound/sound.hxx"
-// #include "worldmap/manager.hxx"
+#include "worldmap/manager.hxx"
#include "cheat.hxx"
// #include "blitter_test.hxx"
// #include "preview_renderer.hxx"
-// #include "worldmap/manager.hxx"
-// #include "worldobj_factory.hxx"
+#include "worldmap/manager.hxx"
+//#include "worldobj_factory.hxx"
// #include "editor/editor_screen.hxx"
@@ -746,8 +746,8 @@
}
else if (!worldmapfile.empty())
{
- //WorldMapNS::WorldMapManager::instance()->load(worldmapfile);
-
//ScreenManager::instance()->push_screen(WorldMapNS::WorldMapManager::instance());
+ WorldMapNS::WorldMapManager::instance()->load(worldmapfile);
+
ScreenManager::instance()->push_screen(WorldMapNS::WorldMapManager::instance());
}
else if (editor == true)
{
Modified: branches/pingus_sdl/src/worldmap/level_dot.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/level_dot.cxx 2007-01-15 16:21:21 UTC
(rev 2657)
+++ branches/pingus_sdl/src/worldmap/level_dot.cxx 2007-01-15 21:29:28 UTC
(rev 2658)
@@ -58,8 +58,8 @@
void
LevelDot::draw(DrawingContext& gc)
{
- Vector3f mpos =
gc.screen_to_world(Vector3f(Input::Controller::get_current()->get_pointer()->get_x_pos(),
-
Input::Controller::get_current()->get_pointer()->get_y_pos()));
+ Vector3f mpos; //// =
gc.screen_to_world(Vector3f(Input::Controller::get_current()->get_pointer()->get_x_pos(),
+ ////
Input::Controller::get_current()->get_pointer()->get_y_pos()));
float x = mpos.x - pos.x;
float y = mpos.y - pos.y;
Modified: branches/pingus_sdl/src/worldmap/manager.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/manager.cxx 2007-01-15 16:21:21 UTC
(rev 2657)
+++ branches/pingus_sdl/src/worldmap/manager.cxx 2007-01-15 21:29:28 UTC
(rev 2658)
@@ -219,8 +219,8 @@
: is_init(false),
exit_worldmap(false),
worldmap(0),
- new_worldmap(0),
- metamap(new MetaMap(path_manager.complete("metamap/metamap.xml")))
+ new_worldmap(0)
+ ////metamap(new MetaMap(path_manager.complete("metamap/metamap.xml")))
{
// FIXME: a bit ugly because of the proteced member, but should work
// FIXME: well enough. GUIScreen could also use multi-inheritage,
@@ -239,7 +239,7 @@
if (worldmap)
delete worldmap;
- worldmap = new WorldMap (filename);
+ worldmap = new WorldMap(filename);
bool credits_unlocked = false;
StatManager::instance()->get_bool(worldmap->get_shortname() +
"-endstory-seen",
@@ -253,23 +253,25 @@
void
WorldMapManager::on_startup ()
{
- exit_worldmap = false;
- Sound::PingusSound::stop_music();
+ exit_worldmap = false;
+ Sound::PingusSound::stop_music();
- if (!worldmap)
- {
- load(path_manager.complete("worldmaps/" +
metamap->get_default_worldmap()));
- }
+#if 0
+ if (!worldmap)
+ {
+ load(path_manager.complete("worldmaps/" +
metamap->get_default_worldmap()));
+ }
+#endif
- if (worldmap)
- worldmap->on_startup ();
+ if (worldmap)
+ worldmap->on_startup ();
}
WorldMapManager::~WorldMapManager ()
{
delete worldmap;
delete new_worldmap;
- delete metamap;
+ ////delete metamap;
}
void
Modified: branches/pingus_sdl/src/worldmap/manager.hxx
===================================================================
--- branches/pingus_sdl/src/worldmap/manager.hxx 2007-01-15 16:21:21 UTC
(rev 2657)
+++ branches/pingus_sdl/src/worldmap/manager.hxx 2007-01-15 21:29:28 UTC
(rev 2658)
@@ -27,7 +27,6 @@
namespace WorldMapNS {
typedef int NodeId;
-class MetaMap;
class WorldMap;
/** The WorldMapManager manages the worldmaps and the translation
@@ -69,7 +68,7 @@
WorldMap* worldmap;
WorldMap* new_worldmap;
- MetaMap* metamap;
+ //MetaMap* metamap;
WorldMapManager ();
public:
@@ -93,7 +92,7 @@
/** @}*/
WorldMap* get_worldmap() { return worldmap; }
- MetaMap* get_metamap() { return metamap; }
+ //// MetaMap* get_metamap() { return metamap; }
/** Change the current map to the given map
Modified: branches/pingus_sdl/src/worldmap/path_graph.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/path_graph.cxx 2007-01-15 16:21:21 UTC
(rev 2657)
+++ branches/pingus_sdl/src/worldmap/path_graph.cxx 2007-01-15 21:29:28 UTC
(rev 2658)
@@ -34,33 +34,33 @@
PathGraph::PathGraph(WorldMap* arg_worldmap, FileReader &reader)
: worldmap(arg_worldmap)
- ////metamap(0)
+ ////metamap(0)
{
parse_nodes(reader.read_section("nodes"));
parse_edges(reader.read_section("edges"));
- init_cache();
+ init_cache();
}
PathGraph::PathGraph(MetaMap* arg_metamap, FileReader &reader)
: worldmap(0),
- metamap(arg_metamap)
+ metamap(arg_metamap)
{
parse_nodes(reader.read_section("nodes"));
parse_edges(reader.read_section("edges"));
- init_cache();
+ init_cache();
}
void delete_Path(Edge<Path*> x)
{
- delete x.data;
+ delete x.data;
}
PathGraph::~PathGraph()
{
- graph.for_each_edge(delete_Path);
+ graph.for_each_edge(delete_Path);
}
void
@@ -81,10 +81,10 @@
node_lookup[dot->get_name()] = id;
// add the dot to the list of drawables
- if (worldmap)
- worldmap->add_drawable(dot);
- else
- metamap->add_drawable(dot);
+ if (worldmap)
+ worldmap->add_drawable(dot);
+ else
+ metamap->add_drawable(dot);
// FIXME: should be use this for freeing the stuff?
dots.push_back(dot);
@@ -274,11 +274,11 @@
void
PathGraph::init_cache()
{
- // Init the pathfinder cache
- pathfinder_cache.resize(graph.max_node_handler_value());
- for(PFinderCache::iterator i = pathfinder_cache.begin();
- i != pathfinder_cache.end(); ++i)
- *i = 0;
+ // Init the pathfinder cache
+ pathfinder_cache.resize(graph.max_node_handler_value());
+ for(PFinderCache::iterator i = pathfinder_cache.begin();
+ i != pathfinder_cache.end(); ++i)
+ *i = 0;
}
} // namespace WorldMapNS
Modified: branches/pingus_sdl/src/worldmap/worldmap.cxx
===================================================================
--- branches/pingus_sdl/src/worldmap/worldmap.cxx 2007-01-15 16:21:21 UTC
(rev 2657)
+++ branches/pingus_sdl/src/worldmap/worldmap.cxx 2007-01-15 21:29:28 UTC
(rev 2658)
@@ -65,11 +65,7 @@
parse_file(XMLFileReader(root));
#endif
- lisp::Lisp* sexpr = lisp::Parser::parse(filename);
- if (sexpr)
- {
- parse_file(SExprFileReader(sexpr->get_list_elem(0)));
- }
+ parse_file(FileReader::parse(filename));
pingus = new Pingus(path_graph);
set_starting_node();
@@ -405,7 +401,7 @@
{
if (dot->finished())
{
-
WorldMapManager::instance()->get_metamap()->finish_node(short_name);
+
////WorldMapManager::instance()->get_metamap()->finish_node(short_name);
////ScreenManager::instance()->replace_screen(new
StoryScreen(get_end_story()), true);
}
}
@@ -444,7 +440,7 @@
bool
WorldMap::is_final_map()
{
- return (WorldMapManager::instance()->get_metamap()->get_final_worldmap() ==
short_name);
+ return false;
////(WorldMapManager::instance()->get_metamap()->get_final_worldmap() ==
short_name);
}
} // namespace WorldMapNS
Modified: branches/pingus_sdl/xml2sexpr.rb
===================================================================
--- branches/pingus_sdl/xml2sexpr.rb 2007-01-15 16:21:21 UTC (rev 2657)
+++ branches/pingus_sdl/xml2sexpr.rb 2007-01-15 21:29:28 UTC (rev 2658)
@@ -4,7 +4,7 @@
# Script to convert Pingus 0.6 level files to new sexpr format
-$typespec =
+$typespec_worldmap =
[
[/^\/pingus-worldmap$/, :section],
[/^\/pingus-worldmap\/head$/, :section],
@@ -44,7 +44,65 @@
[/^\/pingus-worldmap\/graph\/edges\/edge\/positions$/, :section],
[/^\/pingus-worldmap\/graph\/edges\/edge\/positions\/position$/, :vector],
[/^\/pingus-worldmap\/objects$/, :section],
+ ]
+$typespec_level =
+ [
+ [/^\/pingus-level$/, :section],
+ [/^\/pingus-level\/version$/, :integer],
+ [/^\/pingus-level\/head$/, :section],
+ [/^\/pingus-level\/head\/levelname$/, :string],
+ [/^\/pingus-level\/head\/description$/, :string],
+ [/^\/pingus-level\/head\/author$/, :string],
+ [/^\/pingus-level\/head\/number-of-pingus$/, :integer],
+ [/^\/pingus-level\/head\/number-to-save$/, :integer],
+ [/^\/pingus-level\/head\/time$/, :integer],
+ [/^\/pingus-level\/head\/difficulty$/, :integer],
+ [/^\/pingus-level\/head\/playable$/, :integer],
+ [/^\/pingus-level\/head\/comment$/, :string],
+ [/^\/pingus-level\/head\/music$/, :string],
+ [/^\/pingus-level\/head\/actions$/, :section],
+ [/^\/pingus-level\/head\/actions\/[a-z]+$/, :integer],
+ [/^\/pingus-level\/head\/levelsize$/, :size],
+ [/^\/pingus-level\/objects$/, :section],
+ [/^\/pingus-level\/objects\/surface-background$/, :section],
+ [/^\/pingus-level\/objects\/surface-background\/scroll-x$/, :integer],
+ [/^\/pingus-level\/objects\/surface-background\/scroll-y$/, :integer],
+ [/^\/pingus-level\/objects\/surface-background\/para-x$/, :integer],
+ [/^\/pingus-level\/objects\/surface-background\/para-y$/, :integer],
+ [/^\/pingus-level\/objects\/surface-background\/stretch-x$/, :integer],
+ [/^\/pingus-level\/objects\/surface-background\/stretch-y$/, :integer],
+ [/^\/pingus-level\/objects\/surface-background\/keep-aspect$/, :integer],
+# [/^\/pingus-level\/objects\/surface-background\/position$/, :vector],
+ [/^\/pingus-level\/objects\/hotspot$/, :section],
+ [/^\/pingus-level\/objects\/hotspot\/parallax$/, :integer],
+ [/^\/pingus-level\/objects\/hotspot\/speed$/, :integer],
+
+ [/^\/pingus-level\/objects\/groundpiece$/, :section],
+ [/^\/pingus-level\/objects\/groundpiece\/type$/, :string],
+
+ [/^\/pingus-level\/objects\/exit$/, :section],
+ [/^\/pingus-level\/objects\/exit\/owner-id$/, :integer],
+
+ [/^\/pingus-level\/objects\/entrance$/, :section],
+ [/^\/pingus-level\/objects\/entrance\/type$/, :string],
+ [/^\/pingus-level\/objects\/entrance\/direction$/, :string],
+ [/^\/pingus-level\/objects\/entrance\/release-rate$/, :integer],
+ [/^\/pingus-level\/objects\/entrance\/owner-id$/, :integer],
+
+ [/^\/pingus-level\/objects\/spike$/, :section],
+
+ [/^\/pingus-level\/objects\/liquid$/, :section],
+ [/^\/pingus-level\/objects\/liquid\/width$/, :integer],
+ [/^\/pingus-level\/objects\/liquid\/speed$/, :integer],
+]
+
+$typespec_generic =
+ [
+ [/color$/, :color],
+
+ [/position$/, :vector],
+
[/surface$/, :section],
[/surface\/image$/, :string],
[/surface\/modifer$/, :string],
@@ -52,6 +110,8 @@
[/surface\/auto-uncover$/, :integer],
]
+$typespec = $typespec_worldmap + $typespec_generic
+
def get_type(section)
$typespec.each{|pair|
if section.match(pair[0]) then
@@ -98,6 +158,8 @@
else
if section != ""
puts "unknown: section: #{section} #{el.value}"
+ puts el.inspect
+ exit 1
end
end
@@ -139,6 +201,25 @@
print " "
print el.elements["z"][0].value
print ")"
+
+ when :color
+ print "#{indent}(#{el.name} "
+ print el.elements["red"][0].value
+ print " "
+ print el.elements["green"][0].value
+ print " "
+ print el.elements["blue"][0].value
+ print " "
+ print el.elements["alpha"][0].value
+ print ")"
+
+ when :size
+ print "#{indent}(#{el.name} "
+ print el.elements["width"][0].value
+ print " "
+ print el.elements["height"][0].value
+ print ")"
+
else
puts "#{indent}(#{el.name} "
el.children.each{|child|
@@ -160,8 +241,8 @@
i = 0
dir = File.dirname(arg)
doc = REXML::Document.new(File.new(arg))
+ puts ";; generated by xml2sexpr.rb convert script from '#{arg}'"
doc.children.each{ |el|
- puts ";; generated by xml2sexpr.rb convert script"
xml2array("", "", el)
}
puts "\n;; EOF ;;"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2658 - in branches/pingus_sdl: . data/worldmaps src src/worldmap,
grumbel at BerliOS <=