[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldmap dot.hxx,1.4,1.5 level_dot.cx
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldmap dot.hxx,1.4,1.5 level_dot.cxx,1.4,1.5 level_dot.hxx,1.3,1.4 path.cxx,1.3,1.4 worldmap.cxx,1.23,1.24 |
Date: |
17 Oct 2002 16:06:23 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv14204/src/worldmap
Modified Files:
dot.hxx level_dot.cxx level_dot.hxx path.cxx worldmap.cxx
Log Message:
clicking on leveldots starts now a level
Index: dot.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/dot.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dot.hxx 13 Oct 2002 19:28:34 -0000 1.4
+++ dot.hxx 17 Oct 2002 16:06:21 -0000 1.5
@@ -39,6 +39,9 @@
Vector get_pos() { return pos; }
float get_z_pos() const { return pos.z; }
+
+ virtual void on_click() =0;
+
private:
Dot (const Dot&);
Dot& operator= (const Dot&);
Index: level_dot.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/level_dot.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- level_dot.cxx 13 Oct 2002 19:28:34 -0000 1.4
+++ level_dot.cxx 17 Oct 2002 16:06:21 -0000 1.5
@@ -21,6 +21,10 @@
#include "../xml_helper.hxx"
#include "../pingus_resource.hxx"
#include "../graphic_context.hxx"
+#include "../plf.hxx"
+#include "../path_manager.hxx"
+#include "../screen_manager.hxx"
+#include "../game_session.hxx"
#include "level_dot.hxx"
namespace WorldMapNS {
@@ -28,10 +32,37 @@
LevelDot::LevelDot(xmlDocPtr doc, xmlNodePtr cur)
: Dot(doc, XMLhelper::skip_blank(cur->children)),
green_dot_sur("misc/dot_green", "core"),
- red_dot_sur("misc/dot_red", "core")
+ red_dot_sur("misc/dot_red", "core"),
+ plf(0)
{
green_dot_sur.set_align_center();
red_dot_sur.set_align_center();
+
+ cur = cur->children;
+ // Skip dot entry
+ cur = cur->next;
+ cur = XMLhelper::skip_blank(cur);
+
+ cur = cur->next;
+ cur = XMLhelper::skip_blank(cur);
+
+
+ while(cur)
+ {
+ if (XMLhelper::equal_str(cur->name, "levelname"))
+ {
+ levelname = XMLhelper::parse_string(doc, cur);
+ std::cout << "Levelname: " << levelname << std::endl;
+ plf = PLF::create(path_manager.complete("levels/") + levelname);
+ }
+ else
+ {
+ std::cout << "92834Unknown: " << cur->name << std::endl;
+ }
+
+ cur = cur->next;
+ cur = XMLhelper::skip_blank(cur);
+ }
}
void
@@ -44,6 +75,14 @@
void
LevelDot::update()
{
+}
+
+void
+LevelDot::on_click()
+{
+ std::cout << "Starting level: " << levelname << std::endl;
+ ScreenManager::instance()->push_screen(new PingusGameSession
(path_manager.complete("levels/") + levelname),
+ true);
}
} // namespace WorldMapNS
Index: level_dot.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/level_dot.hxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- level_dot.hxx 13 Oct 2002 16:39:17 -0000 1.3
+++ level_dot.hxx 17 Oct 2002 16:06:21 -0000 1.4
@@ -23,6 +23,8 @@
#include "../sprite.hxx"
#include "dot.hxx"
+class PLF;
+
namespace WorldMapNS {
/** */
@@ -31,12 +33,16 @@
private:
Sprite green_dot_sur;
Sprite red_dot_sur;
+ std::string levelname;
+ PLF* plf;
public:
LevelDot(xmlDocPtr doc, xmlNodePtr cur);
void draw(GraphicContext& gc);
void update();
+
+ void on_click();
private:
LevelDot (const LevelDot&);
Index: path.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/path.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- path.cxx 15 Oct 2002 21:58:50 -0000 1.3
+++ path.cxx 17 Oct 2002 16:06:21 -0000 1.4
@@ -58,7 +58,6 @@
}
else
{
- std::cout << "Edgepath size: " << vec.size() << std::endl;
float length = 0;
Vec::iterator prev = vec.begin();
for(Vec::iterator next = prev + 1; next != vec.end(); ++next)
Index: worldmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/worldmap.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- worldmap.cxx 15 Oct 2002 22:22:59 -0000 1.23
+++ worldmap.cxx 17 Oct 2002 16:06:21 -0000 1.24
@@ -210,9 +210,17 @@
if (dot)
{
std::cout << "Clicked on: " << dot->get_name() << std::endl;
- if (!pingus->walk_to_node(path_graph->lookup_node(dot->get_name())))
+ if (path_graph->lookup_node(dot->get_name()) == pingus->get_node())
{
- std::cout << "NO PATH TO NODE FOUND!" << std::endl;
+ std::cout << "Pingu is on node, issue on_click()" << std::endl;
+ dot->on_click();
+ }
+ else
+ {
+ if (!pingus->walk_to_node(path_graph->lookup_node(dot->get_name())))
+ {
+ std::cout << "NO PATH TO NODE FOUND!" << std::endl;
+ }
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldmap dot.hxx,1.4,1.5 level_dot.cxx,1.4,1.5 level_dot.hxx,1.3,1.4 path.cxx,1.3,1.4 worldmap.cxx,1.23,1.24,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src blitter_impl.hxx,NONE,1.1 Makefile.am,1.117,1.118 blitter.cxx,1.18,1.19
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldmap path.hxx,1.2,1.3
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src blitter_impl.hxx,NONE,1.1 Makefile.am,1.117,1.118 blitter.cxx,1.18,1.19
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldmap path.hxx,1.2,1.3
- Index(es):