-// $Id$
-//
// SuperTux
// Copyright (C) 2006 Matthias Braun <matze@braunis.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 "badguy.hpp"
+#include "badguy/badguy.hpp"
#include "audio/sound_manager.hpp"
-#include "game_session.hpp"
-#include "level.hpp"
-#include "log.hpp"
-#include "main.hpp"
#include "object/bullet.hpp"
-#include "object/camera.hpp"
-#include "object/particles.hpp"
#include "object/player.hpp"
-#include "object/tilemap.hpp"
-#include "random_generator.hpp"
-#include "sector.hpp"
-#include "statistics.hpp"
-#include "tile.hpp"
+#include "supertux/level.hpp"
+#include "supertux/sector.hpp"
+#include "supertux/tile.hpp"
#include <math.h>
static const float X_OFFSCREEN_DISTANCE = 1600;
static const float Y_OFFSCREEN_DISTANCE = 1200;
-BadGuy::BadGuy(const Vector& pos, const std::string& sprite_name, int layer)
- : MovingSprite(pos, sprite_name, layer, COLGROUP_DISABLED), countMe(true), is_initialized(false),
- dir(LEFT), start_dir(AUTO), frozen(false), ignited(false),
- state(STATE_INIT), on_ground_flag(false), colgroup_active(COLGROUP_MOVING)
+BadGuy::BadGuy(const Vector& pos, const std::string& sprite_name, int layer) :
+ MovingSprite(pos, sprite_name, layer, COLGROUP_DISABLED),
+ physic(),
+ countMe(true),
+ is_initialized(false),
+ start_position(),
+ dir(LEFT),
+ start_dir(AUTO),
+ frozen(false),
+ ignited(false),
+ dead_script(),
+ state(STATE_INIT),
+ is_active_flag(),
+ state_timer(),
+ on_ground_flag(false),
+ floor_normal(),
+ colgroup_active(COLGROUP_MOVING)
{
start_position = bbox.p1;
dir = (start_dir == AUTO) ? LEFT : start_dir;
}
-BadGuy::BadGuy(const Vector& pos, Direction direction, const std::string& sprite_name, int layer)
- : MovingSprite(pos, sprite_name, layer, COLGROUP_DISABLED), countMe(true), is_initialized(false),
- dir(direction), start_dir(direction), frozen(false), ignited(false),
- state(STATE_INIT), on_ground_flag(false), colgroup_active(COLGROUP_MOVING)
+BadGuy::BadGuy(const Vector& pos, Direction direction, const std::string& sprite_name, int layer) :
+ MovingSprite(pos, sprite_name, layer, COLGROUP_DISABLED),
+ physic(),
+ countMe(true),
+ is_initialized(false),
+ start_position(),
+ dir(direction),
+ start_dir(direction),
+ frozen(false),
+ ignited(false),
+ dead_script(),
+ state(STATE_INIT),
+ is_active_flag(),
+ state_timer(),
+ on_ground_flag(false),
+ floor_normal(),
+ colgroup_active(COLGROUP_MOVING)
{
start_position = bbox.p1;
dir = (start_dir == AUTO) ? LEFT : start_dir;
}
-BadGuy::BadGuy(const lisp::Lisp& reader, const std::string& sprite_name, int layer)
- : MovingSprite(reader, sprite_name, layer, COLGROUP_DISABLED), countMe(true), is_initialized(false), dir(LEFT), start_dir(AUTO), frozen(false), ignited(false), state(STATE_INIT), on_ground_flag(false), colgroup_active(COLGROUP_MOVING)
+BadGuy::BadGuy(const Reader& reader, const std::string& sprite_name, int layer) :
+ MovingSprite(reader, sprite_name, layer, COLGROUP_DISABLED),
+ physic(),
+ countMe(true),
+ is_initialized(false),
+ start_position(),
+ dir(LEFT),
+ start_dir(AUTO),
+ frozen(false),
+ ignited(false),
+ dead_script(),
+ state(STATE_INIT),
+ is_active_flag(),
+ state_timer(),
+ on_ground_flag(false),
+ floor_normal(),
+ colgroup_active(COLGROUP_MOVING)
{
start_position = bbox.p1;
void
BadGuy::draw(DrawingContext& context)
{
- if(!sprite)
+ if(!sprite.get())
return;
if(state == STATE_INIT || state == STATE_INACTIVE)
return;
}
void
-BadGuy::write(lisp::Writer& )
-{
- log_warning << "tried to write out a generic badguy" << std::endl;
-}
-
-void
BadGuy::active_update(float elapsed_time)
{
movement = physic.get_movement(elapsed_time);
BadGuy::run_dead_script()
{
if (countMe)
- Sector::current()->get_level()->stats.badguys++;
+ Sector::current()->get_level()->stats.badguys++;
countMe = false;
- // start dead-script
+ // start dead-script
if(dead_script != "") {
std::istringstream stream(dead_script);
Sector::current()->run_script(stream, "dead-script");
if (state == STATE_ACTIVE) set_group(group);
}
+/* EOF */