X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fobject%2Fpushbutton.cpp;h=5488de3451b3043c70d99a9cc5d5e3faecc0de5d;hb=84abfaeb33c5bf8dac0cfd9499d9d4c3e7d39881;hp=38f1119802ef35356714bd0e29b0880b5b12a807;hpb=714a30abd887def6331a193216387e66cbfbd1bb;p=supertux.git diff --git a/src/object/pushbutton.cpp b/src/object/pushbutton.cpp index 38f111980..5488de345 100644 --- a/src/object/pushbutton.cpp +++ b/src/object/pushbutton.cpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux - PushButton running a script // 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,27 +12,24 @@ // 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 -#include +// along with this program. If not, see . -#include "pushbutton.hpp" -#include "object_factory.hpp" -#include "player.hpp" #include "audio/sound_manager.hpp" -#include "sprite/sprite_manager.hpp" -#include "sector.hpp" -#include "log.hpp" +#include "object/player.hpp" +#include "object/pushbutton.hpp" +#include "sprite/sprite.hpp" +#include "supertux/object_factory.hpp" +#include "supertux/sector.hpp" namespace { - const std::string BUTTON_SOUND = "sounds/switch.ogg"; - //14 -> 8 +const std::string BUTTON_SOUND = "sounds/switch.ogg"; +//14 -> 8 } -PushButton::PushButton(const lisp::Lisp& lisp) - : MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), state(OFF) +PushButton::PushButton(const Reader& lisp) : + MovingSprite(lisp, "images/objects/pushbutton/pushbutton.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_MOVING), + script(), + state(OFF) { sound_manager->preload(BUTTON_SOUND); set_action("off", -1); @@ -53,10 +48,10 @@ PushButton::collision(GameObject& other, const CollisionHit& hit) { Player* player = dynamic_cast(&other); if (!player) return FORCE_MOVE; - float vy = player->physic.vy; + float vy = player->get_physic().get_velocity_y(); //player->add_velocity(Vector(0, -150)); - player->physic.vy = -150; + player->get_physic().set_velocity_y(-150); if (state != OFF) return FORCE_MOVE; if (!hit.top) return FORCE_MOVE; @@ -71,7 +66,7 @@ PushButton::collision(GameObject& other, const CollisionHit& hit) // play sound sound_manager->play(BUTTON_SOUND); - + // run script std::istringstream stream(script); Sector::current()->run_script(stream, "PushButton"); @@ -81,3 +76,4 @@ PushButton::collision(GameObject& other, const CollisionHit& hit) IMPLEMENT_FACTORY(PushButton, "pushbutton"); +/* EOF */