temporarily disabled ringing because it needs fixing
[supertux.git] / src / object / infoblock.cpp
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 // 
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 //  02111-1307, USA.
20
21 #include <config.h>
22
23 #include "infoblock.h"
24 #include "game_session.h"
25 #include "resources.h"
26 #include "sprite/sprite_manager.h"
27 #include "object_factory.h"
28 #include "lisp/lisp.h"
29 #include "audio/sound_manager.h"
30 #include "sector.h"
31 #include "player.h"
32
33 InfoBlock::InfoBlock(const lisp::Lisp& lisp)
34   : Block(sprite_manager->create("infoblock"))
35 {
36   Vector pos;
37   lisp.get("x", pos.x);
38   lisp.get("y", pos.y);
39   bbox.set_pos(pos);
40
41   if(!lisp.get("message", message)) {
42     std::cerr << "No message in InfoBlock!\n";
43   }
44   ringing = false;
45 }
46
47 InfoBlock::~InfoBlock()
48 {
49 }
50
51 void
52 InfoBlock::update(float elapsed_time)
53 {
54   elapsed_time = 0;
55   if (ringing) sound_manager->play_sound("phone",get_pos(),Sector::current()->player->get_pos());
56 }
57
58 void
59 InfoBlock::hit(Player& )
60 {
61   GameSession::current()->display_info_box(message);
62   ringing = false;
63   start_bounce();
64 }
65
66 IMPLEMENT_FACTORY(InfoBlock, "infoblock")