X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Fscripted_object.cpp;h=56a1fd5da8ab784b98cebb39c9fff63d0a494ae8;hb=78ac7aef674f518549f96160c6354b589553f952;hp=65dffb49e45ee59e57f49e4f6e305b1be81a1887;hpb=6ad89403a5692bcc347d1d3c15ec4653d79c0877;p=supertux.git diff --git a/src/object/scripted_object.cpp b/src/object/scripted_object.cpp index 65dffb49e..56a1fd5da 100644 --- a/src/object/scripted_object.cpp +++ b/src/object/scripted_object.cpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux // Copyright (C) 2006 Matthias Braun // -// 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,23 +12,26 @@ // 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 -#include +#include "object/scripted_object.hpp" -#include "scripted_object.hpp" -#include "video/drawing_context.hpp" -#include "scripting/squirrel_util.hpp" -#include "resources.hpp" -#include "object_factory.hpp" -#include "math/vector.hpp" +#include -ScriptedObject::ScriptedObject(const lisp::Lisp& lisp) - : MovingSprite(lisp, LAYER_OBJECTS, COLGROUP_MOVING), - solid(true), physic_enabled(true), visible(true), new_vel_set(false) +#include "scripting/squirrel_util.hpp" +#include "sprite/sprite.hpp" +#include "supertux/object_factory.hpp" +#include "util/reader.hpp" + +ScriptedObject::ScriptedObject(const Reader& lisp) : + MovingSprite(lisp, LAYER_OBJECTS, COLGROUP_MOVING_STATIC), + physic(), + name(), + solid(true), + physic_enabled(true), + visible(true), + new_vel_set(false), + new_vel() { lisp.get("name", name); if(name == "") @@ -48,11 +49,7 @@ ScriptedObject::ScriptedObject(const lisp::Lisp& lisp) lisp.get("visible", visible); lisp.get("z-pos", layer); if( solid ){ - if( physic_enabled ){ - set_group( COLGROUP_MOVING ); - } else { - set_group( COLGROUP_STATIC ); - } + set_group( COLGROUP_MOVING_STATIC ); } else { set_group( COLGROUP_DISABLED ); } @@ -134,11 +131,7 @@ ScriptedObject::set_solid(bool solid) { this->solid = solid; if( solid ){ - if( physic_enabled ){ - set_group( COLGROUP_MOVING ); - } else { - set_group( COLGROUP_STATIC ); - } + set_group( COLGROUP_MOVING_STATIC ); } else { set_group( COLGROUP_DISABLED ); } @@ -150,7 +143,6 @@ ScriptedObject::is_solid() return solid; } - void ScriptedObject::set_action(const std::string& animation) { @@ -201,7 +193,7 @@ ScriptedObject::collision_solid(const CollisionHit& hit) if(physic.get_velocity_y() > 0) physic.set_velocity_y(0); } else if(hit.top) { - physic.set_velocity_y(.1); + physic.set_velocity_y(.1f); } if(hit.left || hit.right) { @@ -216,3 +208,5 @@ ScriptedObject::collision(GameObject& , const CollisionHit& ) } IMPLEMENT_FACTORY(ScriptedObject, "scriptedobject"); + +/* EOF */