#include "sdl/InitScreen.h"
#include "sdl/InitSDL.h"
+#include <cstdlib>
+#include <ctime>
#include <exception>
#include <iostream>
#include <SDL.h>
const int framerate = 33;
+// std::srand(std::time(0));
+
try {
InitSDL sdl;
InitImage image(IMG_INIT_PNG);
heroesLayout.AddPosition(Point<Uint8>(160, 152));
SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
- Sprite dummySprite(monsterImg, 64, 64);
+ Sprite monsterSprite(monsterImg, 64, 64);
Monster monster;
monster.SetName("Lizard");
- monster.SetSprite(&dummySprite);
+ monster.SetSprite(&monsterSprite);
monster.SetLevel(1);
monster.SetMaxHealth(8);
monster.SetHealth(8);
monster.SetStats(Stats(14, 6, 6, 6, 6, 6, 6));
monster.SetReward(3, 5);
+ ComplexAnimation monsterAttackAnimation(&monsterSprite, 4 * framerate);
+ monsterAttackAnimation.AddFrame(0, 1, Vector<int>(0, 16));
+ monsterAttackAnimation.AddFrame(0, 0, Vector<int>(0, 16));
+ monsterAttackAnimation.AddFrame(0, 1, Vector<int>(0, 16));
+ monster.SetAttackAnimation(&monsterAttackAnimation);
+ SDL_Surface *monsterMeleeImg(IMG_Load("test-data/attack-monster.png"));
+ Sprite monsterMeleeSprite(monsterMeleeImg, 96, 64);
+ SimpleAnimation monsterMeleeAnimation(&monsterMeleeSprite, framerate, 14);
+ monster.SetMeleeAnimation(&monsterMeleeAnimation);
SDL_Surface *maximImg(IMG_Load("test-data/maxim.png"));
Sprite maximSprite(maximImg, 64, 64);
Font largeFont(&largeFontSprite, 0, -2);
battleRes.titleFont = &largeFont;
- battleRes.numberAnimationPrototype = ComplexAnimation(0, framerate);
- battleRes.numberAnimationPrototype.AddFrame(0, 0);
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -48));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
- battleRes.numberAnimationPrototype.AddFrame(0, 0);
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -24));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
- battleRes.numberAnimationPrototype.AddFrame(0, 0);
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
- battleRes.numberAnimationPrototype.AddFrames(0, 0, Vector<int>(), 14);
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -36));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -32));
- battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -18));
+ ComplexAnimation numberAnimationPrototype(0, framerate);
+ numberAnimationPrototype.AddFrame(0, 0);
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -48));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
+ numberAnimationPrototype.AddFrame(0, 0);
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -24));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
+ numberAnimationPrototype.AddFrame(0, 0);
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
+ numberAnimationPrototype.AddFrames(0, 0, Vector<int>(), 14);
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -36));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -32));
+ numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -18));
+ battleRes.numberAnimationPrototype = &numberAnimationPrototype;
SDL_Surface *bigNumbersImg(IMG_Load("test-data/big-numbers.png"));
Sprite bigNumbersSprite(bigNumbersImg, 16, 32);
Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
battleRes.weaponTargetCursor = &weaponTargetCursor;
- // TODO: add image for magic targeting cursor
battleRes.magicTargetCursor = &magicTargetCursor;
- // TODO: add image for item targeting cursor
battleRes.itemTargetCursor = &itemTargetCursor;
Spell resetSpell;
Item zircoSword;
zircoSword.SetName("Zirco sword");
zircoSword.SetMenuIcon(&swordIcon);
+ zircoSword.GetTargetingMode().TargetSingleEnemy();
Ikari firestorm;
firestorm.SetName("Firestorm");
firestorm.SetCost(224);
Item zircoWhip;
zircoWhip.SetName("Zirco whip");
zircoWhip.SetMenuIcon(&rodIcon);
+ zircoWhip.GetTargetingMode().TargetSingleEnemy();
Ikari thundershriek;
thundershriek.SetName("Thundershriek");
thundershriek.SetCost(224);
Item zircoAx;
zircoAx.SetName("Zirco ax");
zircoAx.SetMenuIcon(&axIcon);
+ zircoAx.GetTargetingMode().TargetSingleEnemy();
Ikari torrent;
torrent.SetName("Torrent");
torrent.SetCost(224);
Item lizardBlow;
lizardBlow.SetName("Lizard blow");
lizardBlow.SetMenuIcon(&swordIcon);
+ lizardBlow.GetTargetingMode().TargetSingleEnemy();
Ikari dragonRush;
dragonRush.SetName("Dragon rush");
dragonRush.SetCost(164);