X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ftrigger%2Fdoor.hpp;h=0e93611c7428c62f542e5c61e9a8391e38495c06;hb=729bc6717bf68314dc9fad25db3a9f728062263e;hp=ed0fdc9b19e94dc0901719de581f9e801bcac90a;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/trigger/door.hpp b/src/trigger/door.hpp index ed0fdc9b1..0e93611c7 100644 --- a/src/trigger/door.hpp +++ b/src/trigger/door.hpp @@ -1,12 +1,10 @@ -// $Id$ +// SuperTux +// Copyright (C) 2006 Matthias Braun // -// SuperTux - A Jump'n Run -// Copyright (C) 2004 Matthias Braun . -#include +#ifndef HEADER_SUPERTUX_TRIGGER_DOOR_HPP +#define HEADER_SUPERTUX_TRIGGER_DOOR_HPP -#include "video/surface.hpp" #include "sprite/sprite.hpp" -#include "trigger_base.hpp" -#include "serializable.hpp" -#include "timer.hpp" +#include "trigger/trigger_base.hpp" + +class Player; -class Door : public TriggerBase, public Serializable +class Door : public TriggerBase { public: - Door(const lisp::Lisp& reader); + Door(const Reader& reader); Door(int x, int y, std::string sector, std::string spawnpoint); virtual ~Door(); - virtual void write(lisp::Writer& writer); - virtual void update(float elapsed_time); virtual void draw(DrawingContext& context); virtual void event(Player& player, EventType type); + virtual HitResponse collision(GameObject& other, const CollisionHit& hit); private: - std::string target_sector; - std::string target_spawnpoint; - Sprite* sprite; + enum DoorState { + CLOSED, + OPENING, + OPEN, + CLOSING + }; + +private: + DoorState state; /**< current state of the door */ + std::string target_sector; /**< target sector to teleport to */ + std::string target_spawnpoint; /**< target spawnpoint to teleport to */ + std::auto_ptr sprite; /**< "door" sprite to render */ + Timer stay_open_timer; /**< time until door will close again */ }; #endif + +/* EOF */