4 * Created on: Aug 1, 2012
8 #include "app/Application.h"
10 #include "battle/BattleState.h"
11 #include "battle/Hero.h"
12 #include "battle/Monster.h"
13 #include "battle/PartyLayout.h"
14 #include "battle/Resources.h"
15 #include "common/Ikari.h"
16 #include "common/Inventory.h"
17 #include "common/Item.h"
18 #include "common/Spell.h"
19 #include "geometry/Point.h"
20 #include "geometry/Vector.h"
21 #include "graphics/ComplexAnimation.h"
22 #include "graphics/Font.h"
23 #include "graphics/Frame.h"
24 #include "graphics/Gauge.h"
25 #include "graphics/Menu.h"
26 #include "graphics/SimpleAnimation.h"
27 #include "graphics/Sprite.h"
28 #include "sdl/InitImage.h"
29 #include "sdl/InitScreen.h"
30 #include "sdl/InitSDL.h"
35 #include <SDL_image.h>
37 using app::Application;
39 using battle::BattleState;
41 using battle::Monster;
42 using battle::PartyLayout;
44 using common::Inventory;
47 using geometry::Point;
48 using geometry::Vector;
49 using graphics::ComplexAnimation;
51 using graphics::Frame;
52 using graphics::Gauge;
54 using graphics::SimpleAnimation;
55 using graphics::Sprite;
57 using sdl::InitScreen;
65 int main(int argc, char **argv) {
66 const int width = 800;
67 const int height = 480;
71 InitImage image(IMG_INIT_PNG);
72 InitScreen screen(width, height);
74 // temporary test data
75 SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
76 PartyLayout monstersLayout;
77 monstersLayout.AddPosition(Point<Uint8>(88, 88));
78 monstersLayout.AddPosition(Point<Uint8>(128, 88));
79 monstersLayout.AddPosition(Point<Uint8>(168, 88));
80 monstersLayout.AddPosition(Point<Uint8>(208, 88));
81 PartyLayout heroesLayout;
82 heroesLayout.AddPosition(Point<Uint8>(48, 136));
83 heroesLayout.AddPosition(Point<Uint8>(128, 136));
84 heroesLayout.AddPosition(Point<Uint8>(80, 152));
85 heroesLayout.AddPosition(Point<Uint8>(160, 152));
87 SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
88 Sprite dummySprite(monsterImg, 64, 64);
90 monster.SetName("Monster");
91 monster.SetSprite(&dummySprite);
92 monster.SetMaxHealth(10);
93 monster.SetHealth(10);
95 SDL_Surface *maximImg(IMG_Load("test-data/maxim.png"));
96 Sprite maximSprite(maximImg, 64, 64);
98 maxim.SetName("Maxim");
100 maxim.SetSprite(&maximSprite);
101 maxim.SetMaxHealth(33);
103 maxim.SetMaxMana(20);
106 ComplexAnimation maximAttackAnimation(&maximSprite, 30);
107 maximAttackAnimation.AddFrame(1, 0, Vector<int>(2, 0));
108 maximAttackAnimation.AddFrame(1, 0, Vector<int>(2, -1));
109 maximAttackAnimation.AddFrames(2, 0, Vector<int>(2, -2), 2);
110 maximAttackAnimation.AddFrame(2, 0, Vector<int>(4, -2));
111 maximAttackAnimation.AddFrame(2, 0, Vector<int>(3, -1));
112 maximAttackAnimation.AddFrames(2, 1, Vector<int>(3, -1), 2);
113 maximAttackAnimation.AddFrame(2, 1);
114 maximAttackAnimation.AddFrames(2, 2, Vector<int>(), 2);
115 maxim.SetAttackAnimation(&maximAttackAnimation);
116 ComplexAnimation maximSpellAnimation(&maximSprite, 150);
117 maximSpellAnimation.AddFrames(3, 0, Vector<int>(), 2);
118 maximSpellAnimation.AddFrame(3, 1);
119 maxim.SetSpellAnimation(&maximSpellAnimation);
120 SDL_Surface *maximMeleeImg(IMG_Load("test-data/melee-maxim.png"));
121 Sprite maximMeleeSprite(maximMeleeImg, 96, 96);
122 SimpleAnimation maximMeleeAnimation(&maximMeleeSprite, 30, 4);
123 maxim.SetMeleeAnimation(&maximMeleeAnimation);
125 SDL_Surface *selanImg(IMG_Load("test-data/selan.png"));
126 Sprite selanSprite(selanImg, 64, 64);
128 selan.SetName("Selan");
130 selan.SetSprite(&selanSprite);
131 selan.SetMaxHealth(28);
133 selan.SetMaxMana(23);
136 ComplexAnimation selanAttackAnimation(&selanSprite, 30);
137 selanAttackAnimation.AddFrames(1, 0, Vector<int>(4, 0), 2);
138 selanAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
139 selanAttackAnimation.AddFrame(2, 0, Vector<int>(10, 4));
140 selanAttackAnimation.AddFrame(2, 0, Vector<int>(14, 4));
141 selanAttackAnimation.AddFrames(2, 0, Vector<int>(12, 2), 3);
142 selanAttackAnimation.AddFrames(2, 1, Vector<int>(14, 2), 2);
143 selanAttackAnimation.AddFrame(2, 1, Vector<int>(2, 0));
144 selanAttackAnimation.AddFrame(2, 2, Vector<int>(-2, -4));
145 selanAttackAnimation.AddFrame(2, 2, Vector<int>(-8, -8));
146 selanAttackAnimation.AddFrame(2, 2);
147 selan.SetAttackAnimation(&selanAttackAnimation);
148 ComplexAnimation selanSpellAnimation(&selanSprite, 30);
149 selanSpellAnimation.AddFrames(2, 0, Vector<int>(), 3);
150 selanSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
151 selanSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
152 selanSpellAnimation.AddFrames(2, 3, Vector<int>(), 2);
153 selan.SetSpellAnimation(&selanSpellAnimation);
154 SDL_Surface *selanMeleeImg(IMG_Load("test-data/melee-selan.png"));
155 Sprite selanMeleeSprite(selanMeleeImg, 96, 96);
156 SimpleAnimation selanMeleeAnimation(&selanMeleeSprite, 30, 4);
157 selan.SetMeleeAnimation(&selanMeleeAnimation);
159 SDL_Surface *guyImg(IMG_Load("test-data/guy.png"));
160 Sprite guySprite(guyImg, 64, 64);
164 guy.SetSprite(&guySprite);
165 guy.SetMaxHealth(38);
170 ComplexAnimation guyAttackAnimation(&guySprite, 30);
171 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-4, 0), 2);
172 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-8, 0), 2);
173 guyAttackAnimation.AddFrames(2, 0, Vector<int>(-8, 0), 2);
174 guyAttackAnimation.AddFrame(2, 0, Vector<int>(-4, 0));
175 guyAttackAnimation.AddFrames(2, 0, Vector<int>(), 2);
176 guyAttackAnimation.AddFrame(2, 1);
177 guyAttackAnimation.AddFrame(2, 1, Vector<int>(4, 0));
178 guyAttackAnimation.AddFrame(2, 1, Vector<int>(10, 0));
179 guyAttackAnimation.AddFrame(2, 2, Vector<int>(10, 0));
180 guyAttackAnimation.AddFrame(2, 2);
181 guy.SetAttackAnimation(&guyAttackAnimation);
182 SDL_Surface *guyMeleeImg(IMG_Load("test-data/melee-guy.png"));
183 Sprite guyMeleeSprite(guyMeleeImg, 96, 96);
184 SimpleAnimation guyMeleeAnimation(&guyMeleeSprite, 30, 4);
185 guy.SetMeleeAnimation(&guyMeleeAnimation);
187 SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png"));
188 Sprite dekarSprite(dekarImg, 64, 64);
190 dekar.SetName("Dekar");
192 dekar.SetSprite(&dekarSprite);
193 dekar.SetMaxHealth(38);
198 ComplexAnimation dekarAttackAnimation(&dekarSprite, 30);
199 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(4, 0));
200 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
201 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(12, 4));
202 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(16, 4));
203 dekarAttackAnimation.AddFrames(2, 0, Vector<int>(10, 2), 4);
204 dekarAttackAnimation.AddFrame(2, 1, Vector<int>(6, 2));
205 dekarAttackAnimation.AddFrame(2, 1, Vector<int>());
206 dekarAttackAnimation.AddFrame(2, 2, Vector<int>(-2, 0));
207 dekarAttackAnimation.AddFrames(2, 2, Vector<int>(0, 0), 3);
208 dekar.SetAttackAnimation(&dekarAttackAnimation);
209 ComplexAnimation dekarSpellAnimation(&dekarSprite, 30);
210 dekarSpellAnimation.AddFrames(2, 0, Vector<int>(), 6);
211 dekarSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
212 dekarSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
213 dekar.SetSpellAnimation(&dekarSpellAnimation);
214 SDL_Surface *dekarMeleeImg(IMG_Load("test-data/melee-dekar.png"));
215 Sprite dekarMeleeSprite(dekarMeleeImg, 96, 96);
216 SimpleAnimation dekarMeleeAnimation(&dekarMeleeSprite, 30, 4);
217 dekar.SetMeleeAnimation(&dekarMeleeAnimation);
219 battle::Resources battleRes;
221 SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png"));
222 Sprite swapCursorSprite(swapCursorImg, 32, 32);
223 battleRes.swapCursor = &swapCursorSprite;
224 SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
225 Sprite attackIconsSprite(attackIconsImg, 32, 32);
226 battleRes.attackIcons = &attackIconsSprite;
227 SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
228 Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
229 battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
230 SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
231 Sprite moveIconsSprite(moveIconsImg, 32, 32);
232 battleRes.moveIcons = &moveIconsSprite;
234 SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png"));
235 Frame titleFrame(titleFrameImg, 16, 16);
236 battleRes.titleFrame = &titleFrame;
238 SDL_Surface *largeFontImg(IMG_Load("test-data/large-font.png"));
239 Sprite largeFontSprite(largeFontImg, 16, 32);
240 Font largeFont(&largeFontSprite, 0, -2);
241 battleRes.titleFont = &largeFont;
243 battleRes.numberAnimationPrototype = ComplexAnimation(0, 30);
244 battleRes.numberAnimationPrototype.AddFrame(0, 0);
245 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
246 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
247 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -48));
248 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
249 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
250 battleRes.numberAnimationPrototype.AddFrame(0, 0);
251 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
252 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
253 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -24));
254 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
255 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
256 battleRes.numberAnimationPrototype.AddFrame(0, 0);
257 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
258 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
259 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
260 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
261 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
262 battleRes.numberAnimationPrototype.AddFrames(0, 0, Vector<int>(), 14);
263 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -36));
264 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -32));
265 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -18));
267 SDL_Surface *bigNumbersImg(IMG_Load("test-data/big-numbers.png"));
268 Sprite bigNumbersSprite(bigNumbersImg, 16, 32);
269 battleRes.bigNumberSprite = &bigNumbersSprite;
270 SDL_Surface *bigGreenNumbersImg(IMG_Load("test-data/big-green-numbers.png"));
271 Sprite bigGreenNumbersSprite(bigGreenNumbersImg, 16, 32);
272 battleRes.greenNumberSprite = &bigGreenNumbersSprite;
274 SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png"));
275 Sprite heroTagSprite(heroTagImg, 32, 16);
276 battleRes.heroTagLabels = &heroTagSprite;
277 battleRes.levelLabelCol = 0;
278 battleRes.levelLabelRow = 0;
279 battleRes.healthLabelCol = 0;
280 battleRes.healthLabelRow = 1;
281 battleRes.manaLabelCol = 0;
282 battleRes.manaLabelRow = 2;
283 battleRes.moveLabelCol = 0;
284 battleRes.moveLabelRow = 3;
285 battleRes.ikariLabelCol = 0;
286 battleRes.ikariLabelRow = 4;
288 SDL_Surface *numbersImg(IMG_Load("test-data/numbers.png"));
289 Sprite numbersSprite(numbersImg, 16, 16);
290 Font heroTagFont(&numbersSprite, 0, -3);
291 battleRes.heroTagFont = &heroTagFont;
292 SDL_Surface *tagFramesImg(IMG_Load("test-data/tag-frames.png"));
293 Frame heroTagFrame(tagFramesImg, 16, 16, 1, 1, 0, 33);
294 battleRes.heroTagFrame = &heroTagFrame;
295 Frame activeHeroTagFrame(tagFramesImg, 16, 16);
296 battleRes.activeHeroTagFrame = &activeHeroTagFrame;
297 SDL_Surface *smallTagFrameImg(IMG_Load("test-data/small-tag-frame.png"));
298 Frame smallTagFrame(smallTagFrameImg, 8, 16);
299 battleRes.smallHeroTagFrame = &smallTagFrame;
300 Frame lastSmallTagFrame(smallTagFrameImg, 8, 16, 1, 1, 0, 33);
301 battleRes.lastSmallHeroTagFrame = &lastSmallTagFrame;
302 battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31);
304 SDL_Surface *gauges(IMG_Load("test-data/gauges.png"));
305 Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6);
306 battleRes.healthGauge = &healthGauge;
307 Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
308 battleRes.manaGauge = &manaGauge;
309 Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
310 battleRes.ikariGauge = &ikariGauge;
312 SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png"));
313 Frame selectFrame(selectFrameImg, 16, 16);
314 battleRes.selectFrame = &selectFrame;
316 SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png"));
317 Sprite normalFontSprite(normalFontImg, 16, 16);
318 Font normalFont(&normalFontSprite, 0, -2);
319 battleRes.normalFont = &normalFont;
321 SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png"));
322 Sprite disabledFontSprite(disabledFontImg, 16, 16);
323 Font disabledFont(&disabledFontSprite, 0, -2);
324 battleRes.disabledFont = &disabledFont;
326 SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png"));
327 Sprite handCursorSprite(handCursorImg, 32, 32);
328 battleRes.menuCursor = &handCursorSprite;
330 SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png"));
331 Sprite weaponTargetCursor(targetingIconsImg, 32, 32);
332 Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
333 Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
334 battleRes.weaponTargetCursor = &weaponTargetCursor;
335 // TODO: add image for magic targeting cursor
336 battleRes.magicTargetCursor = &magicTargetCursor;
337 // TODO: add image for item targeting cursor
338 battleRes.itemTargetCursor = &itemTargetCursor;
341 resetSpell.SetName("Reset");
342 maxim.AddSpell(&resetSpell);
344 strongSpell.SetName("Strong");
345 strongSpell.SetCost(3);
346 strongSpell.SetUsableInBattle();
347 strongSpell.GetTargetingMode().TargetMultipleAllies();
348 maxim.AddSpell(&strongSpell);
349 selan.AddSpell(&strongSpell);
351 strongerSpell.SetName("Stronger");
352 strongerSpell.SetCost(8);
353 strongerSpell.SetUsableInBattle();
354 strongerSpell.GetTargetingMode().TargetMultipleAllies();
355 maxim.AddSpell(&strongerSpell);
356 selan.AddSpell(&strongerSpell);
358 championSpell.SetName("Champion");
359 championSpell.SetCost(16);
360 championSpell.SetUsableInBattle();
361 championSpell.GetTargetingMode().TargetMultipleAllies();
362 maxim.AddSpell(&championSpell);
363 selan.AddSpell(&championSpell);
365 rallySpell.SetName("Rally");
366 rallySpell.SetCost(10);
367 rallySpell.SetUsableInBattle();
368 rallySpell.GetTargetingMode().TargetMultipleAllies();
369 maxim.AddSpell(&rallySpell);
370 selan.AddSpell(&rallySpell);
372 escapeSpell.SetName("Escape");
373 escapeSpell.SetCost(8);
374 selan.AddSpell(&escapeSpell);
376 valorSpell.SetName("Valor");
377 valorSpell.SetCost(30);
378 valorSpell.SetUsableInBattle();
379 valorSpell.GetTargetingMode().TargetMultipleAllies();
380 maxim.AddSpell(&valorSpell);
381 selan.AddSpell(&valorSpell);
383 battleRes.spellMenuHeadline = "Please choose a spell.";
384 battleRes.spellMenuPrototype = Menu<const Spell *>(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':');
386 SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png"));
387 Sprite potionIcon(itemIcons, 16, 16);
388 Sprite ballIcon(itemIcons, 16, 16, 0, 16);
389 Sprite crankIcon(itemIcons, 16, 16, 0, 32);
390 Sprite spearIcon(itemIcons, 16, 16, 0, 48);
391 Sprite swordIcon(itemIcons, 16, 16, 0, 64);
392 Sprite axIcon(itemIcons, 16, 16, 0, 80);
393 Sprite rodIcon(itemIcons, 16, 16, 0, 96);
394 Sprite armorIcon(itemIcons, 16, 16, 0, 112);
395 Sprite shieldIcon(itemIcons, 16, 16, 0, 128);
396 Sprite helmetIcon(itemIcons, 16, 16, 0, 144);
397 Sprite ringIcon(itemIcons, 16, 16, 0, 160);
398 Sprite jewelIcon(itemIcons, 16, 16, 0, 176);
400 battleRes.weaponMenuIcon = &swordIcon;
401 battleRes.armorMenuIcon = &armorIcon;
402 battleRes.shieldMenuIcon = &shieldIcon;
403 battleRes.helmetMenuIcon = &helmetIcon;
404 battleRes.ringMenuIcon = &ringIcon;
405 battleRes.jewelMenuIcon = &jewelIcon;
409 antidote.SetName("Antidote");
410 antidote.SetMenuIcon(&potionIcon);
411 antidote.SetUsableInBattle();
412 antidote.GetTargetingMode().TargetSingleAlly();
413 inventory.Add(&antidote, 9);
415 magicJar.SetName("Magic jar");
416 magicJar.SetMenuIcon(&potionIcon);
417 magicJar.SetUsableInBattle();
418 magicJar.GetTargetingMode().TargetSingleAlly();
419 inventory.Add(&magicJar, 4);
421 hiPotion.SetName("Hi-Potion");
422 hiPotion.SetMenuIcon(&potionIcon);
423 hiPotion.SetUsableInBattle();
424 hiPotion.GetTargetingMode().TargetSingleAlly();
425 inventory.Add(&hiPotion, 4);
427 powerPotion.SetName("Power potion");
428 powerPotion.SetMenuIcon(&potionIcon);
429 inventory.Add(&powerPotion, 4);
431 escape.SetName("Escape");
432 inventory.Add(&escape, 2);
434 sleepBall.SetName("Sleep ball");
435 sleepBall.SetMenuIcon(&ballIcon);
436 sleepBall.SetUsableInBattle();
437 sleepBall.GetTargetingMode().TargetSingleEnemy();
438 inventory.Add(&sleepBall, 1);
440 multiBall.SetName("Multi-ball!");
441 multiBall.SetMenuIcon(&ballIcon);
442 multiBall.SetUsableInBattle();
443 multiBall.GetTargetingMode().TargetMultipleEnemies();
444 inventory.Add(&multiBall, 1);
446 figgoru.SetName("Figgoru");
447 figgoru.SetMenuIcon(&crankIcon);
448 figgoru.GetTargetingMode().TargetAllEnemies();
449 inventory.Add(&figgoru, 1);
450 battleRes.inventory = &inventory;
452 battleRes.itemMenuHeadline = "Please choose an item.";
453 battleRes.itemMenuPrototype = Menu<const common::Item *>(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':');
456 zircoSword.SetName("Zirco sword");
457 zircoSword.SetMenuIcon(&swordIcon);
459 firestorm.SetName("Firestorm");
460 firestorm.SetCost(224);
461 firestorm.GetTargetingMode().TargetAllEnemies();
462 firestorm.SetPhysical();
463 zircoSword.SetIkari(&firestorm);
464 // maxim.SetWeapon(&zircoSword);
466 zirconArmor.SetName("Zircon armor");
467 zirconArmor.SetMenuIcon(&armorIcon);
469 magicCure.SetName("Magic cure");
470 magicCure.SetCost(128);
471 magicCure.GetTargetingMode().TargetSingleAlly();
472 magicCure.SetMagical();
473 zirconArmor.SetIkari(&magicCure);
474 maxim.SetArmor(&zirconArmor);
476 holyShield.SetName("Holy shield");
477 holyShield.SetMenuIcon(&shieldIcon);
479 lightGuard.SetName("Light guard");
480 lightGuard.SetCost(128);
481 lightGuard.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
482 lightGuard.SetMagical();
483 holyShield.SetIkari(&lightGuard);
484 maxim.SetShield(&holyShield);
486 legendHelm.SetName("Legend helm");
487 legendHelm.SetMenuIcon(&helmetIcon);
489 boomerang.SetName("Boomerang");
490 boomerang.SetCost(164);
491 boomerang.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
492 boomerang.SetMagical();
493 legendHelm.SetIkari(&boomerang);
494 maxim.SetHelmet(&legendHelm);
496 sProRing.SetName("S-pro ring");
497 sProRing.SetMenuIcon(&ringIcon);
499 courage.SetName("Courage");
501 courage.GetTargetingMode().TargetMultipleAllies();
502 courage.SetMagical();
503 sProRing.SetIkari(&courage);
504 maxim.SetRing(&sProRing);
506 evilJewel.SetName("Evil jewel");
507 evilJewel.SetMenuIcon(&jewelIcon);
509 gloomy.SetName("Gloomy");
511 gloomy.GetTargetingMode().TargetAllEnemies();
513 evilJewel.SetIkari(&gloomy);
514 maxim.SetJewel(&evilJewel);
517 zircoWhip.SetName("Zirco whip");
518 zircoWhip.SetMenuIcon(&rodIcon);
520 thundershriek.SetName("Thundershriek");
521 thundershriek.SetCost(224);
522 thundershriek.GetTargetingMode().TargetAllEnemies();
523 thundershriek.SetPhysical();
524 zircoWhip.SetIkari(&thundershriek);
525 selan.SetWeapon(&zircoWhip);
527 zirconPlate.SetName("Zircon plate");
528 zirconPlate.SetMenuIcon(&armorIcon);
530 suddenCure.SetName("Sudden cure");
531 suddenCure.SetCost(96);
532 suddenCure.GetTargetingMode().TargetAllAllies();
533 suddenCure.SetMagical();
534 zirconPlate.SetIkari(&suddenCure);
535 selan.SetArmor(&zirconPlate);
537 zircoGloves.SetName("Zirco gloves");
538 zircoGloves.SetMenuIcon(&shieldIcon);
540 forcefield.SetName("Forcefield");
541 forcefield.SetCost(64);
542 forcefield.GetTargetingMode().TargetAllAllies();
543 forcefield.SetMagical();
544 zircoGloves.SetIkari(&forcefield);
545 selan.SetShield(&zircoGloves);
547 holyCap.SetName("Holy cap");
548 holyCap.SetMenuIcon(&helmetIcon);
550 vulnerable.SetName("Vulnerable");
551 vulnerable.SetCost(196);
552 vulnerable.GetTargetingMode().TargetAllEnemies();
553 vulnerable.SetPhysical();
554 holyCap.SetIkari(&vulnerable);
555 selan.SetHelmet(&holyCap);
557 ghostRing.SetName("Ghost ring");
558 ghostRing.SetMenuIcon(&ringIcon);
560 destroy.SetName("Destroy");
561 destroy.SetCost(128);
562 destroy.GetTargetingMode().TargetMultipleEnemies();
563 destroy.SetMagical();
564 ghostRing.SetIkari(&destroy);
565 selan.SetRing(&ghostRing);
567 eagleRock.SetName("Eagle rock");
568 eagleRock.SetMenuIcon(&jewelIcon);
570 dive.SetName("Dive");
572 dive.GetTargetingMode().TargetSingleEnemy();
574 eagleRock.SetIkari(&dive);
575 selan.SetJewel(&eagleRock);
578 zircoAx.SetName("Zirco ax");
579 zircoAx.SetMenuIcon(&axIcon);
581 torrent.SetName("Torrent");
582 torrent.SetCost(224);
583 torrent.GetTargetingMode().TargetAllEnemies();
584 torrent.SetPhysical();
585 zircoAx.SetIkari(&torrent);
586 guy.SetWeapon(&zircoAx);
587 guy.SetArmor(&zirconArmor);
589 megaShield.SetName("Mega shield");
590 megaShield.SetMenuIcon(&shieldIcon);
592 ironBarrier.SetName("Iron barrier");
593 ironBarrier.SetCost(255);
594 ironBarrier.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
595 ironBarrier.SetMagical();
596 megaShield.SetIkari(&ironBarrier);
597 guy.SetShield(&megaShield);
599 zircoHelmet.SetName("Zirco helmet");
600 zircoHelmet.SetMenuIcon(&helmetIcon);
602 slow.SetName("Slow");
604 slow.GetTargetingMode().TargetAllEnemies();
606 zircoHelmet.SetIkari(&slow);
607 guy.SetHelmet(&zircoHelmet);
609 powerRing.SetName("Power ring");
610 powerRing.SetMenuIcon(&ringIcon);
612 trick.SetName("Trick");
614 trick.GetTargetingMode().TargetAllEnemies();
616 zircoHelmet.SetIkari(&trick);
617 guy.SetRing(&powerRing);
618 guy.SetJewel(&evilJewel);
620 // NOTE: this is actually Artea equipment
622 lizardBlow.SetName("Lizard blow");
623 lizardBlow.SetMenuIcon(&swordIcon);
625 dragonRush.SetName("Dragon rush");
626 dragonRush.SetCost(164);
627 dragonRush.GetTargetingMode().TargetSingleEnemy();
628 dragonRush.SetPhysical();
629 lizardBlow.SetIkari(&dragonRush);
630 dekar.SetWeapon(&lizardBlow);
632 holyRobe.SetName("Holy robe");
633 holyRobe.SetMenuIcon(&armorIcon);
635 crisisCure.SetName("Crisis cure");
636 crisisCure.SetCost(164);
637 crisisCure.GetTargetingMode().TargetAllAllies();
638 crisisCure.SetMagical();
639 holyRobe.SetIkari(&crisisCure);
640 dekar.SetArmor(&holyRobe);
641 dekar.SetShield(&zircoGloves);
642 dekar.SetHelmet(&holyCap);
644 rocketRing.SetName("Rocket ring");
645 rocketRing.SetMenuIcon(&ringIcon);
647 fake.SetName("Fake");
649 fake.GetTargetingMode().TargetSingleAlly();
651 rocketRing.SetIkari(&fake);
652 dekar.SetRing(&rocketRing);
654 krakenRock.SetName("Kraken rock");
655 krakenRock.SetMenuIcon(&jewelIcon);
657 tenLegger.SetName("Ten-legger");
658 tenLegger.SetCost(164);
659 tenLegger.GetTargetingMode().TargetAllEnemies();
660 tenLegger.SetPhysical();
661 rocketRing.SetIkari(&tenLegger);
662 dekar.SetJewel(&krakenRock);
664 battleRes.ikariMenuHeadline = "Please choose equipment.";
665 battleRes.noEquipmentText = "No equip";
666 battleRes.ikariMenuPrototype = Menu<const Item *>(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth());
668 battleRes.escapeText = "Escapes.";
670 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));
671 battleState->AddMonster(monster);
672 battleState->AddMonster(monster);
673 battleState->AddMonster(monster);
674 battleState->AddMonster(monster);
675 battleState->AddHero(maxim);
676 battleState->AddHero(selan);
677 battleState->AddHero(guy);
678 battleState->AddHero(dekar);
679 Application app(&screen, battleState);
680 app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
681 app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
682 app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
683 app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
684 app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
685 app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
686 app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
687 app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
688 app.Buttons().MapKey(SDLK_RETURN, Input::START);
689 app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
690 app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
691 app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
695 } catch (exception &e) {
696 cerr << "exception in main(): " << e.what() << endl;