made the phone (infoblock) ringing until tux picks it up
authorMarek Moeckel <wansti@gmx.de>
Sun, 22 May 2005 17:32:41 +0000 (17:32 +0000)
committerMarek Moeckel <wansti@gmx.de>
Sun, 22 May 2005 17:32:41 +0000 (17:32 +0000)
SVN-Revision: 2534

src/object/infoblock.cpp
src/object/infoblock.h

index 5430e26..f9f0464 100644 (file)
@@ -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();
 }
 
index 136e821..11f9927 100644 (file)
@@ -31,7 +31,9 @@ public:
   
 protected:
   virtual void hit(Player& player);
+  virtual void update(float elapsed_time);
   std::string message;
+  bool ringing;
 };
 
 #endif