Merged changes from branches/supertux-milestone2-grumbel/ to trunk/supertux/
[supertux.git] / src / badguy / yeti.cpp
index f6cc57a..08631e5 100644 (file)
@@ -1,13 +1,11 @@
-//  $Id$
-//
 //  SuperTux - Boss "Yeti"
 //  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
 //  Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.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 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 3 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
 //  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>
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#include "yeti.hpp"
+#include "badguy/yeti.hpp"
 
-#include "object/camera.hpp"
-#include "yeti_stalactite.hpp"
-#include "bouncing_snowball.hpp"
-#include "game_session.hpp"
-#include "level.hpp"
-#include "lisp/writer.hpp"
-#include "object_factory.hpp"
 #include "audio/sound_manager.hpp"
-#include "sector.hpp"
+#include "badguy/bouncing_snowball.hpp"
+#include "badguy/yeti_stalactite.hpp"
+#include "object/camera.hpp"
 #include "object/player.hpp"
 #include "sprite/sprite.hpp"
+#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
 
-#include <math.h>
 #include <float.h>
+#include <math.h>
 
 namespace {
-  const float JUMP_DOWN_VX = 250; /**< horizontal speed while jumping off the dais */
-  const float JUMP_DOWN_VY = -250; /**< vertical speed while jumping off the dais */
+const float JUMP_DOWN_VX = 250; /**< horizontal speed while jumping off the dais */
+const float JUMP_DOWN_VY = -250; /**< vertical speed while jumping off the dais */
 
-  const float RUN_VX = 350; /**< horizontal speed while running */
+const float RUN_VX = 350; /**< horizontal speed while running */
 
-  const float JUMP_UP_VX = 350; /**< horizontal speed while jumping on the dais */
-  const float JUMP_UP_VY = -800; /**< vertical speed while jumping on the dais */
+const float JUMP_UP_VX = 350; /**< horizontal speed while jumping on the dais */
+const float JUMP_UP_VY = -800; /**< vertical speed while jumping on the dais */
 
-  const float STOMP_VY = -250; /** vertical speed while stomping on the dais */
+const float STOMP_VY = -250; /** vertical speed while stomping on the dais */
 
-  const float LEFT_STAND_X = 16; /**< x-coordinate of left dais' end position */
-  const float RIGHT_STAND_X = 800-60-16; /**< x-coordinate of right dais' end position */
-  const float LEFT_JUMP_X = LEFT_STAND_X+224; /**< x-coordinate of from where to jump on the left dais */
-  const float RIGHT_JUMP_X = RIGHT_STAND_X-224; /**< x-coordinate of from where to jump on the right dais */
-  const float STOMP_WAIT = .5; /**< time we stay on the dais before jumping again */
-  const float SAFE_TIME = .5; /**< the time we are safe when tux just hit us */
-  const int INITIAL_HITPOINTS = 3; /**< number of hits we can take */
+const float LEFT_STAND_X = 16; /**< x-coordinate of left dais' end position */
+const float RIGHT_STAND_X = 800-60-16; /**< x-coordinate of right dais' end position */
+const float LEFT_JUMP_X = LEFT_STAND_X+224; /**< x-coordinate of from where to jump on the left dais */
+const float RIGHT_JUMP_X = RIGHT_STAND_X-224; /**< x-coordinate of from where to jump on the right dais */
+const float STOMP_WAIT = .5; /**< time we stay on the dais before jumping again */
+const float SAFE_TIME = .5; /**< the time we are safe when tux just hit us */
+const int INITIAL_HITPOINTS = 3; /**< number of hits we can take */
 
-  const float SQUISH_TIME = 5;
+const float SQUISH_TIME = 5;
 }
 
-Yeti::Yeti(const lisp::Lisp& reader)
-  : BadGuy(reader, "images/creatures/yeti/yeti.sprite")
+Yeti::Yeti(const Reader& reader) :
+  BadGuy(reader, "images/creatures/yeti/yeti.sprite"),
+  state(),
+  state_timer(),
+  safe_timer(),
+  stomp_count(),
+  hit_points(),
+  hud_head()
 {
   hit_points = INITIAL_HITPOINTS;
   countMe = false;
@@ -245,17 +242,6 @@ Yeti::kill_fall()
 }
 
 void
-Yeti::write(lisp::Writer& writer)
-{
-  writer.start_list("yeti");
-
-  writer.write("x", start_position.x);
-  writer.write("y", start_position.y);
-
-  writer.end_list("yeti");
-}
-
-void
 Yeti::drop_stalactite()
 {
   // make a stalactite falling down and shake camera a bit
@@ -324,4 +310,6 @@ Yeti::collision_solid(const CollisionHit& hit)
   }
 }
 
-IMPLEMENT_FACTORY(Yeti, "yeti")
+IMPLEMENT_FACTORY(Yeti, "yeti");
+
+/* EOF */