pt.po updates from José JORGE <lists.jjorge@free.fr>
[supertux.git] / src / trigger / door.cpp
index 29220d2..f8d2b72 100644 (file)
@@ -40,7 +40,7 @@ Door::Door(const lisp::Lisp& reader)
 
   sprite = sprite_manager->create("images/objects/door/door.sprite");
   sprite->set_action("closed");
-  bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());  
+  bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
 }
 
 Door::Door(int x, int y, std::string sector, std::string spawnpoint)
@@ -52,7 +52,7 @@ Door::Door(int x, int y, std::string sector, std::string spawnpoint)
 
   sprite = sprite_manager->create("images/objects/door/door.sprite");
   sprite->set_action("closed");
-  bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());  
+  bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
 }
 
 Door::~Door()
@@ -69,7 +69,7 @@ Door::write(lisp::Writer& writer)
   writer.write_float("y", bbox.p1.y);
   writer.write_float("width", bbox.get_width());
   writer.write_float("height", bbox.get_height());
-  
+
   writer.write_string("sector", target_sector);
   writer.write_string("spawnpoint", target_spawnpoint);
   sound_manager->preload("sounds/door.wav");
@@ -110,7 +110,7 @@ Door::update(float )
 void
 Door::draw(DrawingContext& context)
 {
-  sprite->draw(context, bbox.p1, LAYER_TILES);
+  sprite->draw(context, bbox.p1, LAYER_BACKGROUNDTILES+1);
 }
 
 void
@@ -121,6 +121,7 @@ Door::event(Player& , EventType type)
       // if door was activated, start opening it
       if (type == EVENT_ACTIVATE) {
        state = OPENING;
+        sound_manager->play("sounds/door.wav");
        sprite->set_action("opening", 1);
       }
       break;
@@ -142,7 +143,6 @@ Door::collision(GameObject& other, const CollisionHit& hit)
     case OPENING:
       break;
     case OPEN:
-sound_manager->play("sounds/door.wav");
       {
         // if door is open and was touched by a player, teleport the player
        Player* player = dynamic_cast<Player*> (&other);