1
// $Id: PingusWorldMapGraph.hh,v 1.14 2002/01/15 10:48:53 grumbel Exp $
3
// Pingus - A free Lemmings clone
4
// Copyright (C) 2000 Ingo Ruhnke <grumbel@gmx.de>
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#ifndef PINGUSWORLDMAPGRAPH_HH
21
#define PINGUSWORLDMAPGRAPH_HH
26
#include "../Sprite.hh"
27
#include "../ResDescriptor.hh"
28
#include "../Position.hh"
29
#include "../XMLhelper.hh"
31
//#include "../generic/Graph.hh"
33
/** An object on the worldmap */
34
class PingusWorldMapNode
42
PingusWorldMapNode () {}
43
virtual ~PingusWorldMapNode () {}
45
virtual void on_click () =0;
46
virtual void mark (bool value) {}
47
virtual void draw (CL_Vector offset) {}
48
virtual std::map<std::string, std::string> get_string () =0;
51
/** A wrap object which brings you to the next worldmap */
52
class PingusWorldMapTubeNode
53
: public PingusWorldMapNode
56
std::string worldmap_name;
60
PingusWorldMapTubeNode ();
62
void draw (CL_Vector offset);
63
std::map<std::string, std::string> get_string ();
66
/** The entrance to a level */
67
class PingusWorldMapLevelNode
68
: public PingusWorldMapNode
76
boost::shared_ptr<PLF> plf;
79
std::string levelname;
81
boost::shared_ptr<PLF> get_plf ();
83
PingusWorldMapLevelNode ()
84
: green_dot ("worldmap/dot_green", "core"),
85
red_dot ("worldmap/dot_red", "core"),
86
dot_border ("Game/dot_border", "game"),
87
green_flag ("worldmap/flaggreen", "core")
92
green_flag.set_align (-24, -36);
93
green_dot.set_align_center ();
94
red_dot.set_align_center ();
95
dot_border.set_align_center ();
99
void mark (bool value);
100
void draw (CL_Vector offset);
101
std::map<std::string, std::string> get_string ();
104
class PingusWorldMapGraph
107
//Graph<PingusWorldMapNode>* graph;
108
ResDescriptor bg_desc;
113
std::list<boost::shared_ptr<PingusWorldMapNode> > nodes;
114
typedef std::list<boost::shared_ptr<PingusWorldMapNode> >::iterator iterator;
116
PingusWorldMapGraph ();
117
~PingusWorldMapGraph ();
119
ResDescriptor get_background ();
120
//Graph<PingusWorldMapNode>* get_graph ();
121
std::string get_music ();
123
void draw (const CL_Vector&);
125
/// Some functions to parse the data out of an xml file
127
void parse_file (std::string filename);
129
void parse_node_list (xmlNodePtr);
130
void parse_node (xmlNodePtr);
131
void parse_tube (xmlNodePtr);
132
void parse_music (xmlNodePtr);
133
void parse_background (xmlNodePtr);