Thread: [Super-tux-commit] supertux/src player.cpp,1.88,1.88.2.1 setup.cpp,1.79,1.79.2.1 worldmap.cpp,1.68.2
Brought to you by:
wkendrick
From: Marek M. <wa...@us...> - 2004-07-10 21:53:17
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6209/src Modified Files: Tag: supertux_0_1_1_branch player.cpp setup.cpp worldmap.cpp worldmap.h Log Message: fixed autoscrolling problems added new world map properties (start_pos_x) and (start_pos_y), changed worldmap.stwm accordingly added bonus island levels and world map loading of world maps other than "worldmap.stwm" now possible (currently, the bonus island is loaded by default) Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.88 retrieving revision 1.88.2.1 diff -u -d -r1.88 -r1.88.2.1 --- player.cpp 10 May 2004 19:06:02 -0000 1.88 +++ player.cpp 10 Jul 2004 21:53:08 -0000 1.88.2.1 @@ -761,7 +761,7 @@ if(hor_autoscroll) { if(base.x == scroll_x) - if(issolid(base.x+32, base.y) || (size != SMALL && issolid(base.x+32, base.y+32))) + if((issolid(base.x+32, base.y) || (size != SMALL && !duck && issolid(base.x+32, base.y+32))) && (dying == DYING_NOT)) kill(KILL); if(base.x + base.width > scroll_x + screen->w) Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.68.2.2 retrieving revision 1.68.2.3 diff -u -d -r1.68.2.2 -r1.68.2.3 --- worldmap.cpp 16 May 2004 17:30:12 -0000 1.68.2.2 +++ worldmap.cpp 10 Jul 2004 21:53:08 -0000 1.68.2.3 @@ -172,8 +172,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; } @@ -344,22 +344,25 @@ WorldMap::WorldMap() { tile_manager = new TileManager(); - 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); - + + map_file = datadir + "/levels/default/worldmap.stwm"; + input_direction = D_NONE; enter_level = false; name = "<no file>"; music = "SALCON.MOD"; - load_map(); } WorldMap::~WorldMap() @@ -373,13 +376,18 @@ } void +WorldMap::set_map_file(std::string mapfile) +{ + map_file = datadir + "/levels/default/" + mapfile; +} + +void WorldMap::load_map() { - std::string filename = datadir + "/levels/default/worldmap.stwm"; - lisp_object_t* root_obj = lisp_read_from_file(filename); + lisp_object_t* root_obj = lisp_read_from_file(map_file); if (!root_obj) - st_abort("Couldn't load file", filename); + st_abort("Couldn't load file", map_file); if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-worldmap") == 0) { @@ -401,6 +409,8 @@ LispReader reader(lisp_cdr(element)); reader.read_string("name", &name); 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) { @@ -443,7 +453,8 @@ } } - lisp_free(root_obj); + lisp_free(root_obj); + tux = new Tux(this); } void WorldMap::get_level_title(Levels::pointer level) Index: worldmap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v retrieving revision 1.28.2.1 retrieving revision 1.28.2.2 diff -u -d -r1.28.2.1 -r1.28.2.2 --- worldmap.h 15 May 2004 22:22:54 -0000 1.28.2.1 +++ worldmap.h 10 Jul 2004 21:53:08 -0000 1.28.2.2 @@ -141,6 +141,9 @@ std::vector<int> tilemap; int width; int height; + + int start_x; + int start_y; TileManager* tile_manager; @@ -175,6 +178,7 @@ Point offset; std::string savegame_file; + std::string map_file; void get_level_title(Levels::pointer level); @@ -183,6 +187,8 @@ WorldMap(); ~WorldMap(); + void set_map_file(std::string mapfile); + /** Busy loop */ void display(); @@ -206,6 +212,13 @@ void savegame(const std::string& filename); void loadgame(const std::string& filename); + + const int& get_start_x() const + { return start_x; } + + const int& get_start_y() const + { return start_y; } + private: void on_escape_press(); }; Index: setup.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v retrieving revision 1.79 retrieving revision 1.79.2.1 diff -u -d -r1.79 -r1.79.2.1 --- setup.cpp 10 May 2004 16:09:49 -0000 1.79 +++ setup.cpp 10 Jul 2004 21:53:08 -0000 1.79.2.1 @@ -507,6 +507,10 @@ fadeout(); WorldMapNS::WorldMap worldmap; + + //TODO: Define the circumstances under which BonusIsland is chosen + worldmap.set_map_file("bonusisland.stwm"); + worldmap.load_map(); // Load the game or at least set the savegame_file variable worldmap.loadgame(slotfile); |