From: Daniel Karbach Date: Wed, 8 Aug 2012 14:52:01 +0000 (+0200) Subject: added realistic test data X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=4e3c919944d011835702f5a63f65a7bb395d3eab;p=l2e.git added realistic test data --- diff --git a/src/battle/Hero.h b/src/battle/Hero.h index d7f6a49..b1982b0 100644 --- a/src/battle/Hero.h +++ b/src/battle/Hero.h @@ -31,7 +31,7 @@ public: Uint16 MaxMana() const { return maxMana; } Uint16 Mana() const { return mana; } - int RelativeMana(int max) const { return mana * max / maxMana; } + int RelativeMana(int max) const { return maxMana == 0 ? 0 : mana * max / maxMana; } Uint8 IP() const { return ip; } int RelativeIP(int max) const { return ip * max / 255; } diff --git a/src/main.cpp b/src/main.cpp index 850907f..c8668dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -72,17 +72,53 @@ int main(int argc, char **argv) { Monster monster; monster.SetSprite(&dummySprite); - SDL_Surface *heroImg(IMG_Load("test-data/hero.png")); - Sprite heroSprite(heroImg, 64, 64); - Hero hero; - hero.SetName("Name"); - hero.SetLevel(34); - hero.SetSprite(&heroSprite); - hero.SetMaxHealth(100); - hero.SetHealth(50); - hero.SetMaxMana(100); - hero.SetMana(100); - hero.SetIP(255); + SDL_Surface *maximImg(IMG_Load("test-data/maxim.png")); + Sprite maximSprite(maximImg, 64, 64); + Hero maxim; + maxim.SetName("Maxim"); + maxim.SetLevel(1); + maxim.SetSprite(&maximSprite); + maxim.SetMaxHealth(33); + maxim.SetHealth(33); + maxim.SetMaxMana(20); + maxim.SetMana(20); + maxim.SetIP(0); + + SDL_Surface *selanImg(IMG_Load("test-data/selan.png")); + Sprite selanSprite(selanImg, 64, 64); + Hero selan; + selan.SetName("Selan"); + selan.SetLevel(1); + selan.SetSprite(&selanSprite); + selan.SetMaxHealth(28); + selan.SetHealth(28); + selan.SetMaxMana(23); + selan.SetMana(23); + selan.SetIP(0); + + SDL_Surface *guyImg(IMG_Load("test-data/guy.png")); + Sprite guySprite(guyImg, 64, 64); + Hero guy; + guy.SetName("Guy"); + guy.SetLevel(1); + guy.SetSprite(&guySprite); + guy.SetMaxHealth(38); + guy.SetHealth(38); + guy.SetMaxMana(0); + guy.SetMana(0); + guy.SetIP(0); + + SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png")); + Sprite dekarSprite(dekarImg, 64, 64); + Hero dekar; + dekar.SetName("Dekar"); + dekar.SetLevel(1); + dekar.SetSprite(&dekarSprite); + dekar.SetMaxHealth(38); + dekar.SetHealth(38); + dekar.SetMaxMana(0); + dekar.SetMana(0); + dekar.SetIP(0); SDL_Surface *attackIcons(IMG_Load("test-data/attack-type-icons.png")); Sprite attackIconsSprite(attackIcons, 32, 32); @@ -107,10 +143,10 @@ int main(int argc, char **argv) { battleState->AddMonster(monster); battleState->AddMonster(monster); battleState->AddMonster(monster); - battleState->AddHero(hero); - battleState->AddHero(hero); - battleState->AddHero(hero); - battleState->AddHero(hero); + battleState->AddHero(maxim); + battleState->AddHero(selan); + battleState->AddHero(guy); + battleState->AddHero(dekar); Application app(&screen, battleState); app.Buttons().MapKey(SDLK_w, Input::PAD_UP); app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT); diff --git a/test-data/dekar.png b/test-data/dekar.png new file mode 100644 index 0000000..f032da1 Binary files /dev/null and b/test-data/dekar.png differ diff --git a/test-data/guy.png b/test-data/guy.png new file mode 100644 index 0000000..0f1c2fe Binary files /dev/null and b/test-data/guy.png differ diff --git a/test-data/hero.png b/test-data/hero.png deleted file mode 100644 index ce5df5c..0000000 Binary files a/test-data/hero.png and /dev/null differ diff --git a/test-data/maxim.png b/test-data/maxim.png new file mode 100644 index 0000000..ce5df5c Binary files /dev/null and b/test-data/maxim.png differ diff --git a/test-data/selan.png b/test-data/selan.png new file mode 100644 index 0000000..028cba4 Binary files /dev/null and b/test-data/selan.png differ