[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldmap manager.cxx,1.19,1.20 manage
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldmap manager.cxx,1.19,1.20 manager.hxx,1.13,1.14 path_drawable.cxx,1.4,1.5 path_drawable.hxx,1.2,1.3 path_graph.cxx,1.16,1.17 path_graph.hxx,1.7,1.8 worldmap.cxx,1.26,1.27 worldmap.hxx,1.18,1.19 |
Date: |
3 Nov 2002 23:31:37 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldmap
In directory dark:/tmp/cvs-serv2721/src/worldmap
Modified Files:
manager.cxx manager.hxx path_drawable.cxx path_drawable.hxx
path_graph.cxx path_graph.hxx worldmap.cxx worldmap.hxx
Log Message:
- added some debugging stuff to worldmap
- removed story menu, since it was pretty useless
Index: manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/manager.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- manager.cxx 29 Oct 2002 12:48:33 -0000 1.19
+++ manager.cxx 3 Nov 2002 23:31:35 -0000 1.20
@@ -98,6 +98,14 @@
}
void
+WorldMapManager::WorldMapComponent::on_secondary_button_press (int x, int y)
+{
+ //std::cout << "Buton press" << std::endl;
+ /** Fixme: insert Co. translation here */
+ WorldMapManager::instance ()->worldmap->on_secondary_button_press (x, y);
+}
+
+void
WorldMapManager::change_map (const std::string& filename, NodeId node)
{
// Create the new worldmap and make it the current one
Index: manager.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/manager.hxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- manager.hxx 12 Oct 2002 23:34:43 -0000 1.13
+++ manager.hxx 3 Nov 2002 23:31:35 -0000 1.14
@@ -47,6 +47,7 @@
WorldMapComponent () { }
void on_primary_button_press (int x, int y);
+ void on_secondary_button_press (int x, int y);
void draw (GraphicContext& gc);
void update (float delta);
Index: path_drawable.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/path_drawable.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- path_drawable.cxx 14 Oct 2002 00:38:22 -0000 1.4
+++ path_drawable.cxx 3 Nov 2002 23:31:35 -0000 1.5
@@ -33,15 +33,12 @@
{
Path::iterator prev = path.begin();
- //std::cout << "<<<<<< Path start" << std::endl;
for(Path::iterator next = prev + 1; next != path.end(); ++next)
{
- //std::cout << "Pos: " << *prev << " " << *next << std::endl;
gc.draw_line(*prev, *next,
1.0, 1.0, 1.0);
prev = next;
}
- //std::cout << ">>>>>> Path end" << std::endl;
}
void
Index: path_drawable.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/path_drawable.hxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- path_drawable.hxx 13 Oct 2002 19:28:34 -0000 1.2
+++ path_drawable.hxx 3 Nov 2002 23:31:35 -0000 1.3
@@ -37,7 +37,7 @@
void draw(GraphicContext& gc);
void update();
- float get_z_pos() const { return 1000; }
+ float get_z_pos() const { return 10000; }
private:
PathDrawable (const PathDrawable&);
PathDrawable& operator= (const PathDrawable&);
Index: path_graph.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/path_graph.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- path_graph.cxx 20 Oct 2002 18:28:49 -0000 1.16
+++ path_graph.cxx 3 Nov 2002 23:31:35 -0000 1.17
@@ -27,6 +27,7 @@
#include "pathfinder.hxx"
#include "path_graph.hxx"
#include "path_drawable.hxx"
+#include "../globals.hxx"
namespace WorldMapNS {
@@ -161,7 +162,8 @@
float cost = full_path.length();
// FIXME: Memory leak
- //worldmap->add_drawable(new PathDrawable(full_path));
+ if (pingus_debug_flags & PINGUS_DEBUG_WORLDMAP)
+ worldmap->add_drawable(new PathDrawable(full_path));
// FIXME: No error checking,
EdgeId id1 = graph.add_edge(path, // FIXME: Memory leak!
@@ -252,6 +254,15 @@
return *i;
}
return 0;
+}
+
+NodeId
+PathGraph::get_id(Dot* dot)
+{
+ for(std::vector<Dot*>::iterator i = dots.begin(); i != dots.end(); ++i)
+ if (dot == *i)
+ return i - dots.begin();
+ return NoNode;
}
} // namespace WorldMapNS
Index: path_graph.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/path_graph.hxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- path_graph.hxx 16 Oct 2002 09:14:45 -0000 1.7
+++ path_graph.hxx 3 Nov 2002 23:31:35 -0000 1.8
@@ -69,6 +69,8 @@
/** Get a node by it id */
Dot* get_dot(NodeId id);
+ NodeId get_id(Dot*);
+
/** Get a node by its position */
Dot* get_dot(float x, float y);
Index: worldmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/worldmap.cxx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- worldmap.cxx 2 Nov 2002 14:46:29 -0000 1.26
+++ worldmap.cxx 3 Nov 2002 23:31:35 -0000 1.27
@@ -220,28 +220,50 @@
{
const Vector& click_pos = display_gc.screen_to_world(Vector(x, y));
- std::cout << "<position>\n"
- << " <x-pos>" << click_pos.x << "</x-pos>\n"
- << " <y-pos>" << click_pos.y << "</y-pos>\n"
- << " <z-pos>0</z-pos>\n"
- << "</position>\n\n" << std::endl;
+ if (pingus_debug_flags & PINGUS_DEBUG_WORLDMAP)
+ {
+ std::cout
+ << "\n<leveldot>\n"
+ << " <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"
+ << " </position>\n"
+ << " </dot>\n"
+ << " <levelname>level10.xml</levelname>\n"
+ << "</leveldot>\n" << std::endl;
+ }
Dot* dot = path_graph->get_dot(click_pos.x, click_pos.y);
if (dot)
{
- std::cout << "Clicked on: " << dot->get_name() << std::endl;
+ std::cout << "WorldMap: Clicked on: " << dot->get_name() << std::endl;
if (path_graph->lookup_node(dot->get_name()) == pingus->get_node())
{
- std::cout << "Pingu is on node, issue on_click()" << std::endl;
+ std::cout << "WorldMap: 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;
+ std::cout << "WorldMap: NO PATH TO NODE FOUND!" << std::endl;
}
}
+ }
+}
+
+void
+WorldMap::on_secondary_button_press(int x, int y)
+{
+ const Vector& click_pos = display_gc.screen_to_world(Vector(x, y));
+ Dot* dot = path_graph->get_dot(click_pos.x, click_pos.y);
+ if (dot)
+ { // FIXME: Dot NodeID missmatch...
+ NodeId id = path_graph->get_id(dot);
+ pingus->set_position(id);
}
}
Index: worldmap.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldmap/worldmap.hxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- worldmap.hxx 2 Nov 2002 14:46:29 -0000 1.18
+++ worldmap.hxx 3 Nov 2002 23:31:35 -0000 1.19
@@ -92,6 +92,7 @@
/** x,y are in WorldMap CO, not ScreenCO */
void on_primary_button_press(int x, int y);
+ void on_secondary_button_press(int x, int y);
private:
#if 0
/** @return the node at the given position. x and y are in
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldmap manager.cxx,1.19,1.20 manager.hxx,1.13,1.14 path_drawable.cxx,1.4,1.5 path_drawable.hxx,1.2,1.3 path_graph.cxx,1.16,1.17 path_graph.hxx,1.7,1.8 worldmap.cxx,1.26,1.27 worldmap.hxx,1.18,1.19,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src pingus_main.cxx,1.34,1.35 pingus_menu_manager.cxx,1.15,1.16 pingus_menu_manager.hxx,1.14,1.15 surface_button.cxx,1.16,1.17 story.cxx,1.14,NONE story.hxx,1.10,NONE
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src force_vector.cxx,1.8,NONE force_vector.hxx,1.7,NONE
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src pingus_main.cxx,1.34,1.35 pingus_menu_manager.cxx,1.15,1.16 pingus_menu_manager.hxx,1.14,1.15 surface_button.cxx,1.16,1.17 story.cxx,1.14,NONE story.hxx,1.10,NONE
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src force_vector.cxx,1.8,NONE force_vector.hxx,1.7,NONE
- Index(es):