From 81a9cc55cbb542fc0410ecbf21b0268d84f2e87a Mon Sep 17 00:00:00 2001 From: Marek Moeckel Date: Sun, 22 May 2005 17:32:41 +0000 Subject: [PATCH] made the phone (infoblock) ringing until tux picks it up SVN-Revision: 2534 --- src/object/infoblock.cpp | 12 ++++++++++++ src/object/infoblock.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/object/infoblock.cpp b/src/object/infoblock.cpp index 5430e26e4..f9f046433 100644 --- a/src/object/infoblock.cpp +++ b/src/object/infoblock.cpp @@ -26,6 +26,9 @@ #include "sprite/sprite_manager.h" #include "object_factory.h" #include "lisp/lisp.h" +#include "audio/sound_manager.h" +#include "sector.h" +#include "player.h" InfoBlock::InfoBlock(const lisp::Lisp& lisp) : Block(sprite_manager->create("infoblock")) @@ -38,6 +41,7 @@ InfoBlock::InfoBlock(const lisp::Lisp& lisp) if(!lisp.get("message", message)) { std::cerr << "No message in InfoBlock!\n"; } + ringing = true; } InfoBlock::~InfoBlock() @@ -45,9 +49,17 @@ InfoBlock::~InfoBlock() } void +InfoBlock::update(float elapsed_time) +{ + elapsed_time = 0; + if (ringing) sound_manager->play_sound("phone",get_pos(),Sector::current()->player->get_pos()); +} + +void InfoBlock::hit(Player& ) { GameSession::current()->display_info_box(message); + ringing = false; start_bounce(); } diff --git a/src/object/infoblock.h b/src/object/infoblock.h index 136e8216d..11f9927c6 100644 --- a/src/object/infoblock.h +++ b/src/object/infoblock.h @@ -31,7 +31,9 @@ public: protected: virtual void hit(Player& player); + virtual void update(float elapsed_time); std::string message; + bool ringing; }; #endif -- 2.11.0