--- /dev/null
+/*
+ * 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 <vector>
+#include <SDL.h>
+
+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<int> &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<Code> text;
+ app::Timer<Uint32> timer;
+ struct AnimationMemo {
+ graphics::Animation *animation;
+ geometry::Point<int> position;
+ };
+ std::vector<AnimationMemo> animations;
+ std::vector<graphics::Animation *> foreignAnimations;
+ int cursor;
+
+};
+
+}
+
+#endif /* BATTLE_ATTACKANIMATION_H_ */