more fixes for Kugelblitz and Rain
[supertux.git] / src / badguy / stalactite.cpp
index 788683b..4b697f0 100644 (file)
@@ -1,6 +1,26 @@
+//  $Id$
+// 
+//  SuperTux
+//  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+//  02111-1307, USA.
+
 #include <config.h>
 
-#include "stalactite.h"
+#include "stalactite.hpp"
 
 static const int SHAKE_RANGE = 40;
 static const float SHAKE_TIME = .8;
@@ -13,6 +33,7 @@ Stalactite::Stalactite(const lisp::Lisp& lisp)
   bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("stalactite");
   state = STALACTITE_HANGING;
+  countMe = false;
 }
 
 void
@@ -25,7 +46,7 @@ Stalactite::write(lisp::Writer& writer)
 }
 
 void
-Stalactite::active_action(float elapsed_time)
+Stalactite::active_update(float elapsed_time)
 {
   if(state == STALACTITE_HANGING) {
     Player* player = Sector::current()->player;
@@ -82,6 +103,9 @@ Stalactite::kill_fall()
 void
 Stalactite::draw(DrawingContext& context)
 {
+  if(get_state() != STATE_ACTIVE)
+    return;
+    
   if(state == STALACTITE_SHAKING) {
     sprite->draw(context, get_pos() + Vector((rand() % 6)-3, 0), LAYER_OBJECTS);
   } else {