From f5560865fe3013de79e832b2715447354dfe2e53 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 7 Apr 2006 14:12:29 +0000 Subject: [PATCH] more smaller fixes SVN-Revision: 3263 --- data/levels/world1/de.po | 2 +- data/locale/de.po | 6 ++--- src/game_session.cpp | 14 ++-------- src/scripting/functions.cpp | 2 +- src/scripting/functions.hpp | 4 +++ src/worldmap.cpp | 64 +++++++++++++++++++++++---------------------- 6 files changed, 44 insertions(+), 48 deletions(-) diff --git a/data/levels/world1/de.po b/data/levels/world1/de.po index 6ce9dc6a1..271d7b0d1 100644 --- a/data/levels/world1/de.po +++ b/data/levels/world1/de.po @@ -60,7 +60,7 @@ msgstr "" "#hast keine Chance! -Nolok\"\n" "\n" "#Tux blickte auf und sah Noloks Festung in\n" -"#der Ferne. Fest entschlossen seine gelibte\n" +"#der Ferne. Fest entschlossen seine geliebte\n" "#Penny zu retten machte er sich auf den Weg." #: basest/levels/world1/worldmap.stwm:4 diff --git a/data/locale/de.po b/data/locale/de.po index eb1b48d05..8beef1ca5 100644 --- a/data/locale/de.po +++ b/data/locale/de.po @@ -315,14 +315,14 @@ msgstr "OpenGL (nicht vorhanden)" #: src/misc.cpp:111 msgid "Fullscreen" -msgstr "Ganzer Bildschirm" +msgstr "Vollbild" #: src/misc.cpp:114 src/misc.cpp:119 -msgid "Sound " +msgid "Sound" msgstr "Sound" #: src/misc.cpp:115 src/misc.cpp:120 -msgid "Music " +msgid "Music" msgstr "Musik" #: src/misc.cpp:122 diff --git a/src/game_session.cpp b/src/game_session.cpp index 7269678d0..5a8ad88b0 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -394,13 +394,6 @@ GameSession::consoleCommand(std::string command) msg_info("You are at x " << tux.get_pos().x << ", y " << tux.get_pos().y); return true; } -#if 0 - if(command == "grid")) { - // toggle debug grid - debug_grid = !debug_grid; - return true; - } -#endif if (command == "gotoend") { // goes to the end of the level tux.move(Vector( @@ -410,15 +403,12 @@ GameSession::consoleCommand(std::string command) return true; } if (command == "flip") { - FlipLevelTransformer flip_transformer; + FlipLevelTransformer flip_transformer; flip_transformer.transform(GameSession::current()->get_current_level()); return true; } if (command == "finish") { - if(WorldMap::current() != NULL) { - WorldMap::current()->finished_level(levelfile); - } - + finish(true); return true; } if (command == "camera") { diff --git a/src/scripting/functions.cpp b/src/scripting/functions.cpp index 050ec72db..30afc98db 100644 --- a/src/scripting/functions.cpp +++ b/src/scripting/functions.cpp @@ -27,7 +27,7 @@ std::string translate(const std::string& text) void display_text_file(const std::string& filename) { std::string file - = ScriptInterpreter::current()->get_working_directory() + filename; + = ScriptInterpreter::current()->get_working_directory() + filename; main_loop->push_screen(new TextScroller(file)); } diff --git a/src/scripting/functions.hpp b/src/scripting/functions.hpp index ba0d36ab8..7321c79d5 100644 --- a/src/scripting/functions.hpp +++ b/src/scripting/functions.hpp @@ -18,18 +18,22 @@ static const int KEY_GOLD = 0x010; /** displays a text file and scrolls it over the screen */ void display_text_file(const std::string& filename); + /** * Suspends the script execution for the specified number of seconds */ void wait(float seconds) __suspend; + /** translates a give text into the users language (by looking it up in the .po * files) */ std::string translate(const std::string& text); + /** load a script file and executes it * This is typically used to import functions from external files. */ void import(HSQUIRRELVM v, const std::string& filename); + /** add a key to the inventory */ void add_key(int new_key); diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 26fb7be62..d1ba8162b 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -45,6 +45,7 @@ #include "worldmap.hpp" #include "resources.hpp" #include "misc.hpp" +#include "msg.hpp" #include "player_status.hpp" #include "textscroller.hpp" #include "main.hpp" @@ -440,6 +441,8 @@ WorldMap::load_map() parse_level_tile(iter.lisp()); } else if(iter.item() == "special-tile") { parse_special_tile(iter.lisp()); + } else if(iter.item() == "name") { + // skip } else { msg_warning("Unknown token '" << iter.item() << "' in worldmap"); } @@ -722,6 +725,26 @@ WorldMap::finished_level(const std::string& filename) tux->set_direction(dir); } } + + if (level->extro_script != "") { + try { + std::auto_ptr interpreter + (new ScriptInterpreter(levels_path)); + std::istringstream in(level->extro_script); + interpreter->run_script(in, "level-extro-script"); + add_object(interpreter.release()); + } catch(std::exception& e) { + msg_fatal("Couldn't run level-extro-script:" << e.what()); + } + } + + if (!level->next_worldmap.empty()) { + // Load given worldmap + loadmap(level->next_worldmap); + } + + if (level->quit_worldmap) + main_loop->exit_screen(); } void @@ -808,7 +831,6 @@ WorldMap::update(float delta) } /* Check level action */ - bool level_finished = true; Level* level = at_level(); if (!level) { msg_warning("No level to enter at: " @@ -816,40 +838,20 @@ WorldMap::update(float delta) return; } - if (level->pos == tux->get_tile_pos()) - { - // do a shriking fade to the level - shrink_fade(Vector((level->pos.x*32 + 16 + offset.x), - (level->pos.y*32 + 16 + offset.y)), 500); + if (level->pos == tux->get_tile_pos()) { + // do a shriking fade to the level + shrink_fade(Vector((level->pos.x*32 + 16 + offset.x), + (level->pos.y*32 + 16 + offset.y)), 500); + try { GameSession *session = - new GameSession(levels_path + level->name, - ST_GL_LOAD_LEVEL_FILE, &level->statistics); + new GameSession(levels_path + level->name, + ST_GL_LOAD_LEVEL_FILE, &level->statistics); main_loop->push_screen(session); + } catch(std::exception& e) { + msg_fatal("Couldn't load level: " << e.what()); } - /* The porpose of the next checking is that if the player lost - the level (in case there is one), don't show anything */ - if(level_finished) { - if (level->extro_script != "") { - try { - std::auto_ptr interpreter - (new ScriptInterpreter(levels_path)); - std::istringstream in(level->extro_script); - interpreter->run_script(in, "level-extro-script"); - add_object(interpreter.release()); - } catch(std::exception& e) { - msg_warning("Couldn't run level-extro-script:" << e.what()); - } - } - - if (!level->next_worldmap.empty()) - { - // Load given worldmap - loadmap(level->next_worldmap); - } - if (level->quit_worldmap) - main_loop->exit_screen(); - } + } } else { -- 2.11.0