X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbadguy%2Fyeti.cpp;h=08631e55d9bbe961e565710fe6d326425cac4906;hb=08813a74da6ac1fd045a105e4e8105f1d7f716f0;hp=f6cc57adc81dd7b039c5b500c389ca0703f04ffb;hpb=f406067af6cbeb0a638078fe1d386d092583909c;p=supertux.git diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index f6cc57adc..08631e55d 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -1,13 +1,11 @@ -// $Id$ -// // SuperTux - Boss "Yeti" // Copyright (C) 2005 Matthias Braun // Copyright (C) 2006 Christoph Sommer // -// 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 @@ -15,53 +13,52 @@ // 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 +// along with this program. If not, see . -#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 #include +#include 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 */