Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31846/src
Modified Files:
worldmap.cpp worldmap.h
Log Message:
Made Tux' starting position on the world map settable in the stwm file
(In Worldmap class, Tux is initialized at the end of load_worldmap, I hope this doesn't cause trouble elsewhere)
Updated levels and worldmap accordingly
Index: worldmap.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- worldmap.cpp 9 Jul 2004 22:16:50 -0000 1.92
+++ worldmap.cpp 10 Jul 2004 10:59:00 -0000 1.93
@@ -177,8 +177,8 @@
offset = 0;
moving = false;
- tile_pos.x = 4;
- tile_pos.y = 5;
+ tile_pos.x = worldmap->get_start_x();
+ tile_pos.y = worldmap->get_start_y();
direction = D_NONE;
input_direction = D_NONE;
}
@@ -349,11 +349,14 @@
WorldMap::WorldMap()
{
tile_manager = new TileManager();
- tux = new Tux(this);
-
+ //tux = new Tux(this);
+
width = 20;
height = 15;
-
+
+ start_x = 4;
+ start_y = 5;
+
level_sprite = new Surface(datadir + "/images/worldmap/levelmarker.png", USE_ALPHA);
leveldot_green = new Surface(datadir + "/images/worldmap/leveldot_green.png", USE_ALPHA);
leveldot_red = new Surface(datadir + "/images/worldmap/leveldot_red.png", USE_ALPHA);
@@ -404,6 +407,8 @@
LispReader reader(lisp_cdr(element));
reader.read_string("name", name, true);
reader.read_string("music", music);
+ reader.read_int("start_pos_x", start_x);
+ reader.read_int("start_pos_y", start_y);
}
else if (strcmp(lisp_symbol(lisp_car(element)), "levels") == 0)
{
@@ -447,6 +452,7 @@
}
lisp_free(root_obj);
+ tux = new Tux(this);
}
void WorldMap::get_level_title(Level& level)
Index: worldmap.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- worldmap.h 9 Jul 2004 18:18:11 -0000 1.35
+++ worldmap.h 10 Jul 2004 10:59:00 -0000 1.36
@@ -124,6 +124,9 @@
std::vector<int> tilemap;
int width;
int height;
+
+ int start_x;
+ int start_y;
TileManager* tile_manager;
@@ -201,6 +204,12 @@
const std::string& get_world_title() const
{ return name; }
+
+ const int& get_start_x() const
+ { return start_x; }
+
+ const int& get_start_y() const
+ { return start_y; }
private:
void on_escape_press();
|