From: Ingo Ruhnke Date: Sun, 18 Apr 2004 22:36:03 +0000 (+0000) Subject: - commited start_pos patch from sik0fewl X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=9ca86ab4672a4f71a3c6d4351093d9dcbcb02e34;p=supertux.git - commited start_pos patch from sik0fewl SVN-Revision: 564 --- diff --git a/src/level.cpp b/src/level.cpp index b83bdb4c9..e21be8752 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -213,6 +213,8 @@ Level::init_defaults() song_title = "Mortimers_chipdisko.mod"; bkgd_image = "arctis.png"; width = 21; + start_pos_x = 100; + start_pos_y = 170; time_left = 100; gravity = 10.; bkgd_top.red = 0; @@ -285,9 +287,10 @@ Level::load(const std::string& filename) if (strcmp(lisp_symbol(lisp_car(root_obj)), "supertux-level") == 0) { LispReader reader(lisp_cdr(root_obj)); - reader.read_int("version", &version); reader.read_int("width", &width); + if (!reader.read_int("start_pos_x", &start_pos_x)) start_pos_x = 100; + if (!reader.read_int("start_pos_y", &start_pos_y)) start_pos_y = 170; reader.read_int("time", &time_left); reader.read_int("bkgd_top_red", &bkgd_top.red); diff --git a/src/level.h b/src/level.h index 3f4bf10bb..f09368338 100644 --- a/src/level.h +++ b/src/level.h @@ -68,6 +68,8 @@ class Level Color bkgd_top; Color bkgd_bottom; int width; + int start_pos_x; + int start_pos_y; int endpos; float gravity; diff --git a/src/player.cpp b/src/player.cpp index cc50bdd82..cb36fe780 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -64,15 +64,16 @@ void player_input_init(player_input_type* pplayer_input) void Player::init() { + Level* plevel = World::current()->get_level(); + base.width = 32; base.height = 32; size = SMALL; got_coffee = false; - // FIXME: Make the start position configurable via the levelfile - base.x = 100; - base.y = 170; + base.x = plevel->start_pos_x; + base.y = plevel->start_pos_y; base.xm = 0; base.ym = 0; previous_base = old_base = base;