From: mathnerd314 Date: Mon, 7 Mar 2011 00:58:41 +0000 (+0000) Subject: Secret area messages X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=bb4b6649a0d1979cbdb9d1e61cfdd8f5b60129a8;p=supertux.git Secret area messages git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6677 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- diff --git a/src/trigger/secretarea_trigger.cpp b/src/trigger/secretarea_trigger.cpp index d23348816..097c5e77e 100644 --- a/src/trigger/secretarea_trigger.cpp +++ b/src/trigger/secretarea_trigger.cpp @@ -31,6 +31,7 @@ static const float MESSAGE_TIME=3.5; SecretAreaTrigger::SecretAreaTrigger(const Reader& reader) : message_timer(), message_displayed(), + message(), fade_tilemap() { reader.get("x", bbox.p1.x); @@ -40,6 +41,10 @@ SecretAreaTrigger::SecretAreaTrigger(const Reader& reader) : reader.get("height", h); bbox.set_size(w, h); reader.get("fade-tilemap", fade_tilemap); + reader.get("message", message); + if(message == "") { + message = _("You found a secret area!"); + } message_displayed = false; } @@ -64,7 +69,7 @@ SecretAreaTrigger::draw(DrawingContext& context) context.push_transform(); context.set_translation(Vector(0, 0)); Vector pos = Vector(0, SCREEN_HEIGHT/2 - Resources::normal_font->get_height()/2); - context.draw_center_text(Resources::normal_font, _("You found a secret area!"), pos, LAYER_HUD, SecretAreaTrigger::text_color); + context.draw_center_text(Resources::normal_font, message, pos, LAYER_HUD, SecretAreaTrigger::text_color); context.pop_transform(); } if (message_timer.check()) { diff --git a/src/trigger/secretarea_trigger.hpp b/src/trigger/secretarea_trigger.hpp index 65fbf1b05..8a17f229d 100644 --- a/src/trigger/secretarea_trigger.hpp +++ b/src/trigger/secretarea_trigger.hpp @@ -41,6 +41,7 @@ private: Timer message_timer; bool message_displayed; std::string fade_tilemap; /**< tilemap to fade away when trigger is activated, or empty if you don't care */ + std::string message; /**< message to display, default "You found a secret area!" */ }; #endif