void active_update(float elapsed_time);
void kill_fall();
+ virtual AngryStone* clone() const { return new AngryStone(*this); }
+
protected:
Vector attackDirection; /**< 1-normalized vector of current attack direction */
Vector oldWallDirection; /**< if wall was hit during last attack: 1-normalized vector of last attack direction, (0,0) otherwise */
set_group(COLGROUP_DISABLED);
}
+BadGuy::BadGuy(const BadGuy& other)
+ : MovingObject(other), Serializable(other), countMe(other.countMe), physic(other.physic), activated(other.activated), start_position(other.start_position), dir(other.dir), layer(other.layer), state(other.state), state_timer(other.state_timer)
+{
+ sprite = new Sprite(*other.sprite);
+}
+
BadGuy::~BadGuy()
{
delete sprite;
{
public:
BadGuy();
+ BadGuy(const BadGuy& badguy);
~BadGuy();
/** Called when the badguy is drawn. The default implementation simply draws
* during runtime. */
bool countMe;
+ virtual BadGuy* clone() const = 0;
+
protected:
enum State {
STATE_INIT,
void kill_fall();
void explode();
+ virtual Bomb* clone() const { return new Bomb(*this); }
+
private:
enum State {
STATE_TICKING,
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+ virtual BouncingSnowball* clone() const { return new BouncingSnowball(*this); }
+
protected:
bool collision_squished(Player& player);
bool set_direction;
countMe = false;
}
+Dart::Dart(const Dart& other)
+ : BadGuy(other), set_direction(other.set_direction), initial_direction(other.initial_direction), parent(other.parent)
+{
+ soundSource = sound_manager->create_sound_source("sounds/flame.wav");
+}
+
Dart::~Dart()
{
delete soundSource;
}
+bool
+Dart::updatePointers(const GameObject* from_object, GameObject* to_object)
+{
+ if (from_object == parent) {
+ parent = dynamic_cast<Dart*>(to_object);
+ return true;
+ }
+ return false;
+}
+
void
Dart::write(lisp::Writer& writer)
{
public:
Dart(const lisp::Lisp& reader);
Dart(float pos_x, float pos_y, Direction d, const BadGuy* parent);
+ Dart(const Dart& dart);
~Dart();
void activate();
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
HitResponse collision_player(Player& player, const CollisionHit& hit);
+ virtual Dart* clone() const { return new Dart(*this); }
+
+ virtual bool updatePointers(const GameObject* from_object, GameObject* to_object);
+
protected:
bool set_direction;
Direction initial_direction;
void active_update(float elapsed_time);
HitResponse collision_player(Player& player, const CollisionHit& hit);
+ virtual DartTrap* clone() const { return new DartTrap(*this); }
+
protected:
enum State {
IDLE, LOADING
void write(lisp::Writer& writer);
void active_update(float elapsed_time);
+ virtual Dispenser* clone() const { return new Dispenser(*this); }
+
protected:
bool collision_squished(Player& player);
void launch_badguy();
void write(lisp::Writer& );
void active_update(float);
+ virtual Fish* clone() const { return new Fish(*this); }
+
private:
HitResponse hit(const CollisionHit& );
void start_waiting();
layer = LAYER_FLOATINGOBJECTS;
}
-Flame::~Flame()
+Flame::Flame(const Flame& other)
+ : BadGuy(other), angle(other.angle), radius(other.radius), speed(other.speed)
{
+ if (sound_manager->is_sound_enabled()) {
+ source.reset(sound_manager->create_sound_source("sounds/flame.wav"));
+ }
}
void
{
public:
Flame(const lisp::Lisp& reader);
- ~Flame();
+ Flame(const Flame& flame);
void activate();
void deactivate();
void active_update(float elapsed_time);
void kill_fall();
+ virtual Flame* clone() const { return new Flame(*this); }
+
private:
float angle;
float radius;
void write(lisp::Writer& writer);
void active_update(float elapsed_time);
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+
+ virtual FlyingSnowBall* clone() const { return new FlyingSnowBall(*this); }
+
protected:
enum FlyingSnowballMode {
FLY_UP,
void active_update(float elapsed_time);
+ virtual Igel* clone() const { return new Igel(*this); }
+
protected:
bool collision_squished(Player& player);
void be_normal(); /**< switch to state STATE_NORMAL */
void write(lisp::Writer& writer);
void active_update(float);
+ virtual Jumpy* clone() const { return new Jumpy(*this); }
+
private:
HitResponse hit(const CollisionHit& hit);
Vector pos_groundhit;
void kill_fall();
void explode();
+ virtual Kugelblitz* clone() const { return new Kugelblitz(*this); }
+
private:
void try_activate();
HitResponse hit(const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
void kill_fall();
+ virtual MrBomb* clone() const { return new MrBomb(*this); }
+
protected:
bool collision_squished(Player& player);
bool set_direction;
void grab(MovingObject& object, const Vector& pos, Direction dir);
void ungrab(MovingObject& object, Direction dir);
+ virtual MrIceBlock* clone() const { return new MrIceBlock(*this); }
+
protected:
bool collision_squished(Player& player);
void write(lisp::Writer& writer);
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+ virtual MrRocket* clone() const { return new MrRocket(*this); }
+
protected:
bool collision_squished(Player& player);
bool set_direction;
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+ virtual MrTree* clone() const { return new MrTree(*this); }
+
protected:
enum MyState {
STATE_BIG, STATE_INVINCIBLE, STATE_NORMAL
void active_update(float elapsed_time);
void kill_fall();
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
-
+
+ virtual Nolok_01* clone() const { return new Nolok_01(*this); }
+
protected:
bool collision_squished(Player& player);
Timer action_timer;
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
void active_update(float elapsed_time);
+ virtual Plant* clone() const { return new Plant(*this); }
+
protected:
Timer timer;
void write(lisp::Writer& writer);
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
-
+
+ virtual PoisonIvy* clone() const { return new PoisonIvy(*this); }
+
protected:
bool collision_squished(Player& player);
bool set_direction;
void kill_fall();
void explode();
+ virtual RocketExplosion* clone() const { return new RocketExplosion(*this); }
+
private:
Timer timer;
};
bool collision_squished(Player& player);
void active_update(float elapsed_time);
+ virtual SkullyHop* clone() const { return new SkullyHop(*this); }
+
protected:
enum SkullyHopState {
STANDING,
void active_update(float elapsed_time);
+ virtual Snail* clone() const { return new Snail(*this); }
+
protected:
bool collision_squished(Player& player);
void be_normal(); /**< switch to state STATE_NORMAL */
void write(lisp::Writer& writer);
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit);
-
+
+ virtual SnowBall* clone() const { return new SnowBall(*this); }
+
protected:
bool collision_squished(Player& player);
bool set_direction;
void write(lisp::Writer& writer);
void active_update(float elapsed_time);
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
+
+ virtual SpiderMite* clone() const { return new SpiderMite(*this); }
+
protected:
enum SpiderMiteMode {
FLY_UP,
void active_update(float elapsed_time);
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+
+ virtual Spiky* clone() const { return new Spiky(*this); }
+
};
#endif
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
void active_update(float elapsed_time);
+ virtual SSpiky* clone() const { return new SSpiky(*this); }
+
protected:
Timer timer;
void draw(DrawingContext& context);
void deactivate();
+ virtual Stalactite* clone() const { return new Stalactite(*this); }
+
protected:
Timer timer;
bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
}
+Totem::Totem(const Totem& other)
+ : BadGuy(other), carrying(other.carrying), carried_by(other.carried_by)
+{
+}
+
Totem::~Totem()
{
if (carrying) carrying->jump_off();
if (carried_by) jump_off();
}
+bool
+Totem::updatePointers(const GameObject* from_object, GameObject* to_object)
+{
+ if (from_object == carrying) {
+ carrying = dynamic_cast<Totem*>(to_object);
+ return true;
+ }
+ if (from_object == carried_by) {
+ carried_by = dynamic_cast<Totem*>(to_object);
+ return true;
+ }
+ return false;
+}
+
void
Totem::write(lisp::Writer& writer)
{
{
public:
Totem(const lisp::Lisp& reader);
+ Totem(const Totem& totem);
~Totem();
void activate();
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+ virtual Totem* clone() const { return new Totem(*this); }
+ virtual bool updatePointers(const GameObject* from_object, GameObject* to_object);
+
protected:
Totem* carrying; /**< Totem we are currently carrying (or 0) */
Totem* carried_by; /**< Totem by which we are currently carried (or 0) */
layer = LAYER_FLOATINGOBJECTS;
}
+WillOWisp::WillOWisp(const WillOWisp& other)
+ : BadGuy(other), mystate(other.mystate), target_sector(other.target_sector), target_spawnpoint(other.target_spawnpoint)
+{
+ soundSource = sound_manager->create_sound_source("sounds/willowisp.wav");
+}
+
WillOWisp::~WillOWisp()
{
delete soundSource;
{
public:
WillOWisp(const lisp::Lisp& reader);
+ WillOWisp(const WillOWisp& willowisp);
~WillOWisp();
void activate();
virtual void draw(DrawingContext& context);
+ virtual WillOWisp* clone() const { return new WillOWisp(*this); }
+
protected:
HitResponse collision_player(Player& player, const CollisionHit& hit);
void kill_squished(Player& player);
void kill_fall();
+ virtual Yeti* clone() const { return new Yeti(*this); }
+
private:
void run();
void jump_up();
void active_update(float elapsed_time);
void start_shaking();
bool is_hanging();
+
+ virtual YetiStalactite* clone() const { return new YetiStalactite(*this); }
};
#endif
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
void active_update(float elapsed_time);
+ virtual Zeekling* clone() const { return new Zeekling(*this); }
+
protected:
bool collision_squished(Player& player);
bool set_direction;