// $Id$
//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+// 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
// 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>
-#include "door.h"
-#include "utils/lispreader.h"
-#include "utils/lispwriter.h"
-#include "gameloop.h"
-#include "resources.h"
-#include "special/sprite.h"
-#include "special/sprite_manager.h"
-#include "video/drawing_context.h"
-#include "app/globals.h"
+#include <config.h>
-using namespace SuperTux;
+#include "door.hpp"
+#include "game_session.hpp"
+#include "resources.hpp"
+#include "object_factory.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "video/drawing_context.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/writer.hpp"
-Door::Door(LispReader& reader)
+Door::Door(const lisp::Lisp& reader)
{
- reader.read_float("x", bbox.p1.x);
- reader.read_float("y", bbox.p1.y);
+ reader.get("x", bbox.p1.x);
+ reader.get("y", bbox.p1.y);
bbox.set_size(32, 64);
- reader.read_string("sector", target_sector);
- reader.read_string("spawnpoint", target_spawnpoint);
+ reader.get("sector", target_sector);
+ reader.get("spawnpoint", target_spawnpoint);
- sprite = sprite_manager->create("door");
+ sprite = sprite_manager->create("images/objects/door/door.sprite");
}
Door::Door(int x, int y, std::string sector, std::string spawnpoint)
target_sector = sector;
target_spawnpoint = spawnpoint;
- sprite = sprite_manager->create("door");
+ sprite = sprite_manager->create("images/objects/door/door.sprite");
}
Door::~Door()
}
void
-Door::write(LispWriter& writer)
+Door::write(lisp::Writer& writer)
{
writer.start_list("door");
}
void
-Door::action(float )
+Door::update(float )
{
//Check if door animation is complete
- if (!sprite->check_animation()) {
+ if(sprite->animation_done()) {
+ sprite->set_action("normal");
GameSession::current()->respawn(target_sector, target_spawnpoint);
}
}
}
}
+IMPLEMENT_FACTORY(Door, "door");