X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbadguy%2Fsnail.cpp;h=797e06ecde8dee105f793acc6a1ee5732970a448;hb=08813a74da6ac1fd045a105e4e8105f1d7f716f0;hp=c3216b7ab05e7aa07f518d7163c5212d5a3d004b;hpb=f406067af6cbeb0a638078fe1d386d092583909c;p=supertux.git diff --git a/src/badguy/snail.cpp b/src/badguy/snail.cpp index c3216b7ab..797e06ecd 100644 --- a/src/badguy/snail.cpp +++ b/src/badguy/snail.cpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux - Badguy "Snail" // 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 @@ -14,30 +12,29 @@ // 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 "snail.hpp" +#include "badguy/snail.hpp" -#include "object/block.hpp" -#include "lisp/writer.hpp" -#include "sprite/sprite.hpp" -#include "object_factory.hpp" #include "audio/sound_manager.hpp" #include "object/player.hpp" +#include "sprite/sprite.hpp" +#include "supertux/object_factory.hpp" #include namespace { - const float KICKSPEED = 500; - const int MAXSQUISHES = 10; - const float KICKSPEED_Y = -500; /**< y-velocity gained when kicked */ +const float KICKSPEED = 500; +const int MAXSQUISHES = 10; +const float KICKSPEED_Y = -500; /**< y-velocity gained when kicked */ } -Snail::Snail(const lisp::Lisp& reader) - : WalkingBadguy(reader, "images/creatures/snail/snail.sprite", "left", "right"), state(STATE_NORMAL), squishcount(0) +Snail::Snail(const Reader& reader) : + WalkingBadguy(reader, "images/creatures/snail/snail.sprite", "left", "right"), + state(STATE_NORMAL), + flat_timer(), + kicked_delay_timer(), + squishcount(0) { walk_speed = 80; max_drop_height = 600; @@ -46,8 +43,12 @@ Snail::Snail(const lisp::Lisp& reader) sound_manager->preload("sounds/kick.wav"); } -Snail::Snail(const Vector& pos, Direction d) - : WalkingBadguy(pos, d, "images/creatures/snail/snail.sprite", "left", "right"), state(STATE_NORMAL), squishcount(0) +Snail::Snail(const Vector& pos, Direction d) : + WalkingBadguy(pos, d, "images/creatures/snail/snail.sprite", "left", "right"), + state(STATE_NORMAL), + flat_timer(), + kicked_delay_timer(), + squishcount(0) { walk_speed = 80; max_drop_height = 600; @@ -57,14 +58,6 @@ Snail::Snail(const Vector& pos, Direction d) } void -Snail::write(lisp::Writer& writer) -{ - writer.start_list("snail"); - WalkingBadguy::write(writer); - writer.end_list("snail"); -} - -void Snail::initialize() { WalkingBadguy::initialize(); @@ -109,7 +102,7 @@ Snail::be_kicked() bool Snail::can_break(){ - return state == STATE_KICKED; + return state == STATE_KICKED; } void @@ -220,18 +213,18 @@ Snail::collision_squished(GameObject& object) case STATE_KICKED: case STATE_NORMAL: - { - Player* player = dynamic_cast(&object); - squishcount++; - if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) { - kill_fall(); - return true; - } + { + Player* player = dynamic_cast(&object); + squishcount++; + if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) { + kill_fall(); + return true; } + } - sound_manager->play("sounds/stomp.wav", get_pos()); - be_flat(); - break; + sound_manager->play("sounds/stomp.wav", get_pos()); + be_flat(); + break; case STATE_FLAT: sound_manager->play("sounds/kick.wav", get_pos()); @@ -256,4 +249,6 @@ Snail::collision_squished(GameObject& object) return true; } -IMPLEMENT_FACTORY(Snail, "snail") +IMPLEMENT_FACTORY(Snail, "snail"); + +/* EOF */