From: Daniel Karbach Date: Mon, 20 Aug 2012 21:37:28 +0000 (+0200) Subject: added animation runners to Hero and Monster X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=e3a38cbb756b2f0b77afcf91bf2a397bb1677bce;p=l2e.git added animation runners to Hero and Monster --- diff --git a/src/battle/Hero.h b/src/battle/Hero.h index 5676cf9..fd90a1b 100644 --- a/src/battle/Hero.h +++ b/src/battle/Hero.h @@ -9,6 +9,7 @@ #define BATTLE_HERO_H_ #include "Stats.h" +#include "../graphics/Animation.h" #include #include @@ -18,7 +19,6 @@ namespace common { class Spell; } namespace graphics { - class Animation; class Sprite; } @@ -75,11 +75,12 @@ public: bool HasRing() const { return ring; } bool HasJewel() const { return jewel; } - graphics::Animation *MeleeAnimation() { return meleeAnimation; } + graphics::AnimationRunner &GetAnimation() { return animation; } + const graphics::AnimationRunner &GetAnimation() const { return animation; } + void SetAnimation(const graphics::AnimationRunner &a) { animation = a; } + const graphics::Animation *MeleeAnimation() const { return meleeAnimation; } - graphics::Animation *AttackAnimation() { return attackAnimation; } const graphics::Animation *AttackAnimation() const { return attackAnimation; } - graphics::Animation *SpellAnimation() { return spellAnimation; } const graphics::Animation *SpellAnimation() const { return spellAnimation; } // temporary setters until loader is implemented @@ -105,9 +106,9 @@ public: void AddSpell(const common::Spell *s) { spells.push_back(s); } - void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; } - void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; } - void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; } + void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; } + void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; } + void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; } private: const char *name; @@ -120,9 +121,11 @@ private: common::Item *ring; common::Item *jewel; - graphics::Animation *meleeAnimation; - graphics::Animation *attackAnimation; - graphics::Animation *spellAnimation; + const graphics::Animation *meleeAnimation; + const graphics::Animation *attackAnimation; + const graphics::Animation *spellAnimation; + + graphics::AnimationRunner animation; // TODO: vector does not seem to be a good choice std::vector spells; diff --git a/src/battle/Monster.h b/src/battle/Monster.h index 6013ebe..0891a2d 100644 --- a/src/battle/Monster.h +++ b/src/battle/Monster.h @@ -9,12 +9,12 @@ #define BATTLE_MONSTER_H_ #include "Stats.h" +#include "../graphics/Animation.h" #include namespace common { class Item; } namespace graphics { - class Animation; class Sprite; } @@ -52,11 +52,12 @@ public: const /* Script */ void *AttackScript() { return attackScript; } const /* Script */ void *DefenseScript() { return defenseScript; } - graphics::Animation *MeleeAnimation() { return meleeAnimation; } + graphics::AnimationRunner &GetAnimation() { return animation; } + const graphics::AnimationRunner &GetAnimation() const { return animation; } + void SetAnimation(const graphics::AnimationRunner &a) { animation = a; } + const graphics::Animation *MeleeAnimation() const { return meleeAnimation; } - graphics::Animation *AttackAnimation() { return attackAnimation; } const graphics::Animation *AttackAnimation() const { return attackAnimation; } - graphics::Animation *SpellAnimation() { return spellAnimation; } const graphics::Animation *SpellAnimation() const { return spellAnimation; } // temporary setters until loader is implemented @@ -71,9 +72,9 @@ public: void SetStats(const Stats &s) { stats = s; } void SetReward(Uint16 exp, Uint16 gold) { expReward = exp; goldReward = gold; } - void SetMeleeAnimation(graphics::Animation *a) { meleeAnimation = a; } - void SetAttackAnimation(graphics::Animation *a) { attackAnimation = a; } - void SetSpellAnimation(graphics::Animation *a) { spellAnimation = a; } + void SetMeleeAnimation(const graphics::Animation *a) { meleeAnimation = a; } + void SetAttackAnimation(const graphics::Animation *a) { attackAnimation = a; } + void SetSpellAnimation(const graphics::Animation *a) { spellAnimation = a; } private: const char *name; @@ -82,9 +83,11 @@ private: /* Script */ void *attackScript; /* Script */ void *defenseScript; - graphics::Animation *meleeAnimation; - graphics::Animation *attackAnimation; - graphics::Animation *spellAnimation; + const graphics::Animation *meleeAnimation; + const graphics::Animation *attackAnimation; + const graphics::Animation *spellAnimation; + + graphics::AnimationRunner animation; Uint16 maxHealth, health; Uint16 maxMana, mana;