X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FAttackAnimation.h;fp=src%2Fbattle%2FAttackAnimation.h;h=a8ec014ecc43de3a3c003a75a10711b168d19d2d;hb=c98665e575f49251dd9b123204063eefdc10e681;hp=0000000000000000000000000000000000000000;hpb=24369a427910299e6ebf5167279dcb26ae0cdf9a;p=l2e.git diff --git a/src/battle/AttackAnimation.h b/src/battle/AttackAnimation.h new file mode 100644 index 0000000..a8ec014 --- /dev/null +++ b/src/battle/AttackAnimation.h @@ -0,0 +1,88 @@ +/* + * AttackAnimation.h + * + * Created on: Aug 13, 2012 + * Author: holy + */ + +#ifndef BATTLE_ATTACKANIMATION_H_ +#define BATTLE_ATTACKANIMATION_H_ + +#include "../app/Timer.h" +#include "../geometry/Point.h" +#include "../geometry/Vector.h" + +#include +#include + +namespace app { class State; } +namespace graphics { class Animation; } + +namespace battle { + +class BattleState; + +class AttackAnimation { + +public: + AttackAnimation() : battle(0), state(0), cursor(0) { } + ~AttackAnimation(); + +public: + void Wait(int ms); + void WaitForAnimation(); + void PlayAttackAnimation(); + void PlaySpellAnimation(); + void PlayTargetAnimation(graphics::Animation *); + void PlayFullscreenAnimation(graphics::Animation *); + +public: + void Start(BattleState *, app::State *); + void Update(); + bool Finished() const; + void Render(SDL_Surface *screen, const geometry::Vector &offset) const; + +private: + bool ExecuteCommand(); + + bool ExecuteWait(); + bool ExecuteWaitAnimation(); + bool ExecuteAttackAnimation(); + bool ExecuteSpellAnimation(); + bool ExecuteTargetAnimation(); + bool ExecuteFullscreenAnimation(); + +private: + enum Command { + WAIT, + WAIT_ANIMATION, + ATTACK_ANIMATION, + SPELL_ANIMATION, + TARGET_ANIMATION, + FULLSCREEN_ANIMATION, + }; + union Code { + Code(Command c) : command(c) { } + Code(int n) : number(n) { } + Code(void *p) : ptr(p) { } + Command command; + int number; + void *ptr; + }; + BattleState *battle; + app::State *state; + std::vector text; + app::Timer timer; + struct AnimationMemo { + graphics::Animation *animation; + geometry::Point position; + }; + std::vector animations; + std::vector foreignAnimations; + int cursor; + +}; + +} + +#endif /* BATTLE_ATTACKANIMATION_H_ */