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/Sprite.h"
27 #include "sdl/InitImage.h"
28 #include "sdl/InitScreen.h"
29 #include "sdl/InitSDL.h"
34 #include <SDL_image.h>
36 using app::Application;
38 using battle::BattleState;
40 using battle::Monster;
41 using battle::PartyLayout;
43 using common::Inventory;
46 using geometry::Point;
47 using geometry::Vector;
48 using graphics::ComplexAnimation;
50 using graphics::Frame;
51 using graphics::Gauge;
53 using graphics::Sprite;
55 using sdl::InitScreen;
63 int main(int argc, char **argv) {
64 const int width = 800;
65 const int height = 480;
69 InitImage image(IMG_INIT_PNG);
70 InitScreen screen(width, height);
72 // temporary test data
73 SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
74 PartyLayout monstersLayout;
75 monstersLayout.AddPosition(Point<Uint8>(88, 104));
76 monstersLayout.AddPosition(Point<Uint8>(128, 104));
77 monstersLayout.AddPosition(Point<Uint8>(168, 104));
78 monstersLayout.AddPosition(Point<Uint8>(208, 104));
79 PartyLayout heroesLayout;
80 heroesLayout.AddPosition(Point<Uint8>(48, 152));
81 heroesLayout.AddPosition(Point<Uint8>(128, 152));
82 heroesLayout.AddPosition(Point<Uint8>(80, 168));
83 heroesLayout.AddPosition(Point<Uint8>(160, 168));
85 SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
86 Sprite dummySprite(monsterImg, 64, 64);
88 monster.SetName("Monster");
89 monster.SetSprite(&dummySprite);
90 monster.SetMaxHealth(10);
91 monster.SetHealth(10);
93 SDL_Surface *maximImg(IMG_Load("test-data/maxim.png"));
94 Sprite maximSprite(maximImg, 64, 64);
96 maxim.SetName("Maxim");
98 maxim.SetSprite(&maximSprite);
99 maxim.SetMaxHealth(33);
101 maxim.SetMaxMana(20);
104 ComplexAnimation maximAttackAnimation(&maximSprite, 30);
105 maximAttackAnimation.AddFrames(2, 0, Vector<int>(), 2);
106 maximAttackAnimation.AddFrames(2, 0, Vector<int>(4, 0), 2);
107 maximAttackAnimation.AddFrame(2, 1, Vector<int>(4, 0));
108 maximAttackAnimation.AddFrames(2, 1, Vector<int>(-2, 0), 2);
109 maximAttackAnimation.AddFrame(2, 1, Vector<int>(-8, 0));
110 maximAttackAnimation.AddFrames(2, 2, Vector<int>(-8, 0), 2);
111 maximAttackAnimation.AddFrame(2, 2, Vector<int>(-4, 0));
112 maxim.SetAttackAnimation(&maximAttackAnimation);
113 ComplexAnimation maximSpellAnimation(&maximSprite, 150);
114 maximSpellAnimation.AddFrames(3, 0, Vector<int>(), 2);
115 maximSpellAnimation.AddFrame(3, 1);
116 maxim.SetSpellAnimation(&maximSpellAnimation);
118 SDL_Surface *selanImg(IMG_Load("test-data/selan.png"));
119 Sprite selanSprite(selanImg, 64, 64);
121 selan.SetName("Selan");
123 selan.SetSprite(&selanSprite);
124 selan.SetMaxHealth(28);
126 selan.SetMaxMana(23);
129 ComplexAnimation selanAttackAnimation(&selanSprite, 30);
130 selanAttackAnimation.AddFrames(1, 0, Vector<int>(4, 0), 2);
131 selanAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
132 selanAttackAnimation.AddFrame(2, 0, Vector<int>(10, 4));
133 selanAttackAnimation.AddFrame(2, 0, Vector<int>(14, 4));
134 selanAttackAnimation.AddFrames(2, 0, Vector<int>(12, 2), 3);
135 selanAttackAnimation.AddFrames(2, 1, Vector<int>(14, 2), 2);
136 selanAttackAnimation.AddFrame(2, 1, Vector<int>(2, 0));
137 selanAttackAnimation.AddFrame(2, 2, Vector<int>(-2, -4));
138 selanAttackAnimation.AddFrame(2, 2, Vector<int>(-8, -8));
139 selanAttackAnimation.AddFrame(2, 2);
140 selan.SetAttackAnimation(&selanAttackAnimation);
141 ComplexAnimation selanSpellAnimation(&selanSprite, 30);
142 selanAttackAnimation.AddFrames(2, 0, Vector<int>(), 3);
143 selanAttackAnimation.AddFrames(2, 1, Vector<int>(), 2);
144 selanAttackAnimation.AddFrames(2, 2, Vector<int>(), 3);
145 selanAttackAnimation.AddFrames(2, 3, Vector<int>(), 2);
146 selan.SetSpellAnimation(&selanSpellAnimation);
148 SDL_Surface *guyImg(IMG_Load("test-data/guy.png"));
149 Sprite guySprite(guyImg, 64, 64);
153 guy.SetSprite(&guySprite);
154 guy.SetMaxHealth(38);
159 ComplexAnimation guyAttackAnimation(&guySprite, 30);
160 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-4, 0), 2);
161 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-8, 0), 2);
162 guyAttackAnimation.AddFrames(2, 0, Vector<int>(-8, 0), 2);
163 guyAttackAnimation.AddFrame(2, 0, Vector<int>(-4, 0));
164 guyAttackAnimation.AddFrames(2, 0, Vector<int>(), 2);
165 guyAttackAnimation.AddFrame(2, 1);
166 guyAttackAnimation.AddFrame(2, 1, Vector<int>(4, 0));
167 guyAttackAnimation.AddFrame(2, 1, Vector<int>(10, 0));
168 guyAttackAnimation.AddFrame(2, 2, Vector<int>(10, 0));
169 guyAttackAnimation.AddFrame(2, 2);
170 guy.SetAttackAnimation(&guyAttackAnimation);
172 SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png"));
173 Sprite dekarSprite(dekarImg, 64, 64);
175 dekar.SetName("Dekar");
177 dekar.SetSprite(&dekarSprite);
178 dekar.SetMaxHealth(38);
183 ComplexAnimation dekarAttackAnimation(&dekarSprite, 30);
184 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(4, 0));
185 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
186 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(12, 4));
187 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(16, 4));
188 dekarAttackAnimation.AddFrames(2, 0, Vector<int>(10, 2), 4);
189 dekarAttackAnimation.AddFrame(2, 1, Vector<int>(6, 2));
190 dekarAttackAnimation.AddFrame(2, 1, Vector<int>());
191 dekarAttackAnimation.AddFrame(2, 2, Vector<int>(-2, 0));
192 dekarAttackAnimation.AddFrames(2, 2, Vector<int>(0, 0), 3);
193 dekar.SetAttackAnimation(&dekarAttackAnimation);
194 ComplexAnimation dekarSpellAnimation(&dekarSprite, 30);
195 dekarSpellAnimation.AddFrames(2, 0, Vector<int>(), 6);
196 dekarSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
197 dekarSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
198 dekar.SetSpellAnimation(&dekarSpellAnimation);
200 battle::Resources battleRes;
202 SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png"));
203 Sprite swapCursorSprite(swapCursorImg, 32, 32);
204 battleRes.swapCursor = &swapCursorSprite;
205 SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
206 Sprite attackIconsSprite(attackIconsImg, 32, 32);
207 battleRes.attackIcons = &attackIconsSprite;
208 SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
209 Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
210 battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
211 SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
212 Sprite moveIconsSprite(moveIconsImg, 32, 32);
213 battleRes.moveIcons = &moveIconsSprite;
215 SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png"));
216 Frame titleFrame(titleFrameImg, 16, 16);
217 battleRes.titleFrame = &titleFrame;
219 SDL_Surface *largeFontImg(IMG_Load("test-data/large-font.png"));
220 Sprite largeFontSprite(largeFontImg, 16, 32);
221 Font largeFont(&largeFontSprite, 0, -2);
222 battleRes.titleFont = &largeFont;
224 SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png"));
225 Sprite heroTagSprite(heroTagImg, 32, 16);
226 battleRes.heroTagLabels = &heroTagSprite;
227 battleRes.levelLabelCol = 0;
228 battleRes.levelLabelRow = 0;
229 battleRes.healthLabelCol = 0;
230 battleRes.healthLabelRow = 1;
231 battleRes.manaLabelCol = 0;
232 battleRes.manaLabelRow = 2;
233 battleRes.moveLabelCol = 0;
234 battleRes.moveLabelRow = 3;
235 battleRes.ikariLabelCol = 0;
236 battleRes.ikariLabelRow = 4;
238 SDL_Surface *numbersImg(IMG_Load("test-data/numbers.png"));
239 Sprite numbersSprite(numbersImg, 16, 16);
240 Font heroTagFont(&numbersSprite, 0, -3);
241 battleRes.heroTagFont = &heroTagFont;
242 SDL_Surface *tagFramesImg(IMG_Load("test-data/tag-frames.png"));
243 Frame heroTagFrame(tagFramesImg, 16, 16, 1, 1, 0, 33);
244 battleRes.heroTagFrame = &heroTagFrame;
245 Frame activeHeroTagFrame(tagFramesImg, 16, 16);
246 battleRes.activeHeroTagFrame = &activeHeroTagFrame;
247 SDL_Surface *smallTagFrameImg(IMG_Load("test-data/small-tag-frame.png"));
248 Frame smallTagFrame(smallTagFrameImg, 8, 16);
249 battleRes.smallHeroTagFrame = &smallTagFrame;
250 Frame lastSmallTagFrame(smallTagFrameImg, 8, 16, 1, 1, 0, 33);
251 battleRes.lastSmallHeroTagFrame = &lastSmallTagFrame;
252 battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31);
254 SDL_Surface *gauges(IMG_Load("test-data/gauges.png"));
255 Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6);
256 battleRes.healthGauge = &healthGauge;
257 Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
258 battleRes.manaGauge = &manaGauge;
259 Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
260 battleRes.ikariGauge = &ikariGauge;
262 SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png"));
263 Frame selectFrame(selectFrameImg, 16, 16);
264 battleRes.selectFrame = &selectFrame;
266 SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png"));
267 Sprite normalFontSprite(normalFontImg, 16, 16);
268 Font normalFont(&normalFontSprite, 0, -2);
269 battleRes.normalFont = &normalFont;
271 SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png"));
272 Sprite disabledFontSprite(disabledFontImg, 16, 16);
273 Font disabledFont(&disabledFontSprite, 0, -2);
274 battleRes.disabledFont = &disabledFont;
276 SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png"));
277 Sprite handCursorSprite(handCursorImg, 32, 32);
278 battleRes.menuCursor = &handCursorSprite;
280 SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png"));
281 Sprite weaponTargetCursor(targetingIconsImg, 32, 32);
282 Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
283 Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
284 battleRes.weaponTargetCursor = &weaponTargetCursor;
285 // TODO: add image for magic targeting cursor
286 battleRes.magicTargetCursor = &magicTargetCursor;
287 // TODO: add image for item targeting cursor
288 battleRes.itemTargetCursor = &itemTargetCursor;
291 resetSpell.SetName("Reset");
292 maxim.AddSpell(&resetSpell);
294 strongSpell.SetName("Strong");
295 strongSpell.SetCost(3);
296 strongSpell.SetUsableInBattle();
297 strongSpell.GetTargetingMode().TargetMultipleAllies();
298 maxim.AddSpell(&strongSpell);
299 selan.AddSpell(&strongSpell);
301 strongerSpell.SetName("Stronger");
302 strongerSpell.SetCost(8);
303 strongerSpell.SetUsableInBattle();
304 strongerSpell.GetTargetingMode().TargetMultipleAllies();
305 maxim.AddSpell(&strongerSpell);
306 selan.AddSpell(&strongerSpell);
308 championSpell.SetName("Champion");
309 championSpell.SetCost(16);
310 championSpell.SetUsableInBattle();
311 championSpell.GetTargetingMode().TargetMultipleAllies();
312 maxim.AddSpell(&championSpell);
313 selan.AddSpell(&championSpell);
315 rallySpell.SetName("Rally");
316 rallySpell.SetCost(10);
317 rallySpell.SetUsableInBattle();
318 rallySpell.GetTargetingMode().TargetMultipleAllies();
319 maxim.AddSpell(&rallySpell);
320 selan.AddSpell(&rallySpell);
322 escapeSpell.SetName("Escape");
323 escapeSpell.SetCost(8);
324 selan.AddSpell(&escapeSpell);
326 valorSpell.SetName("Valor");
327 valorSpell.SetCost(30);
328 valorSpell.SetUsableInBattle();
329 valorSpell.GetTargetingMode().TargetMultipleAllies();
330 maxim.AddSpell(&valorSpell);
331 selan.AddSpell(&valorSpell);
333 battleRes.spellMenuHeadline = "Please choose a spell.";
334 battleRes.spellMenuPrototype = Menu<const Spell *>(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':');
336 SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png"));
337 Sprite potionIcon(itemIcons, 16, 16);
338 Sprite ballIcon(itemIcons, 16, 16, 0, 16);
339 Sprite crankIcon(itemIcons, 16, 16, 0, 32);
340 Sprite spearIcon(itemIcons, 16, 16, 0, 48);
341 Sprite swordIcon(itemIcons, 16, 16, 0, 64);
342 Sprite axIcon(itemIcons, 16, 16, 0, 80);
343 Sprite rodIcon(itemIcons, 16, 16, 0, 96);
344 Sprite armorIcon(itemIcons, 16, 16, 0, 112);
345 Sprite shieldIcon(itemIcons, 16, 16, 0, 128);
346 Sprite helmetIcon(itemIcons, 16, 16, 0, 144);
347 Sprite ringIcon(itemIcons, 16, 16, 0, 160);
348 Sprite jewelIcon(itemIcons, 16, 16, 0, 176);
350 battleRes.weaponMenuIcon = &swordIcon;
351 battleRes.armorMenuIcon = &armorIcon;
352 battleRes.shieldMenuIcon = &shieldIcon;
353 battleRes.helmetMenuIcon = &helmetIcon;
354 battleRes.ringMenuIcon = &ringIcon;
355 battleRes.jewelMenuIcon = &jewelIcon;
359 antidote.SetName("Antidote");
360 antidote.SetMenuIcon(&potionIcon);
361 antidote.SetUsableInBattle();
362 antidote.GetTargetingMode().TargetSingleAlly();
363 inventory.Add(&antidote, 9);
365 magicJar.SetName("Magic jar");
366 magicJar.SetMenuIcon(&potionIcon);
367 magicJar.SetUsableInBattle();
368 magicJar.GetTargetingMode().TargetSingleAlly();
369 inventory.Add(&magicJar, 4);
371 hiPotion.SetName("Hi-Potion");
372 hiPotion.SetMenuIcon(&potionIcon);
373 hiPotion.SetUsableInBattle();
374 hiPotion.GetTargetingMode().TargetSingleAlly();
375 inventory.Add(&hiPotion, 4);
377 powerPotion.SetName("Power potion");
378 powerPotion.SetMenuIcon(&potionIcon);
379 inventory.Add(&powerPotion, 4);
381 escape.SetName("Escape");
382 inventory.Add(&escape, 2);
384 sleepBall.SetName("Sleep ball");
385 sleepBall.SetMenuIcon(&ballIcon);
386 sleepBall.SetUsableInBattle();
387 sleepBall.GetTargetingMode().TargetSingleEnemy();
388 inventory.Add(&sleepBall, 1);
390 multiBall.SetName("Multi-ball!");
391 multiBall.SetMenuIcon(&ballIcon);
392 multiBall.SetUsableInBattle();
393 multiBall.GetTargetingMode().TargetMultipleEnemies();
394 inventory.Add(&multiBall, 1);
396 figgoru.SetName("Figgoru");
397 figgoru.SetMenuIcon(&crankIcon);
398 figgoru.GetTargetingMode().TargetAllEnemies();
399 inventory.Add(&figgoru, 1);
400 battleRes.inventory = &inventory;
402 battleRes.itemMenuHeadline = "Please choose an item.";
403 battleRes.itemMenuPrototype = Menu<const common::Item *>(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':');
406 zircoSword.SetName("Zirco sword");
407 zircoSword.SetMenuIcon(&swordIcon);
409 firestorm.SetName("Firestorm");
410 firestorm.SetCost(224);
411 firestorm.GetTargetingMode().TargetAllEnemies();
412 firestorm.SetPhysical();
413 zircoSword.SetIkari(&firestorm);
414 maxim.SetWeapon(&zircoSword);
416 zirconArmor.SetName("Zircon armor");
417 zirconArmor.SetMenuIcon(&armorIcon);
419 magicCure.SetName("Magic cure");
420 magicCure.SetCost(128);
421 magicCure.GetTargetingMode().TargetSingleAlly();
422 magicCure.SetMagical();
423 zirconArmor.SetIkari(&magicCure);
424 maxim.SetArmor(&zirconArmor);
426 holyShield.SetName("Holy shield");
427 holyShield.SetMenuIcon(&shieldIcon);
429 lightGuard.SetName("Light guard");
430 lightGuard.SetCost(128);
431 lightGuard.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
432 lightGuard.SetMagical();
433 holyShield.SetIkari(&lightGuard);
434 maxim.SetShield(&holyShield);
436 legendHelm.SetName("Legend helm");
437 legendHelm.SetMenuIcon(&helmetIcon);
439 boomerang.SetName("Boomerang");
440 boomerang.SetCost(164);
441 boomerang.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
442 boomerang.SetMagical();
443 legendHelm.SetIkari(&boomerang);
444 maxim.SetHelmet(&legendHelm);
446 sProRing.SetName("S-pro ring");
447 sProRing.SetMenuIcon(&ringIcon);
449 courage.SetName("Courage");
451 courage.GetTargetingMode().TargetMultipleAllies();
452 courage.SetMagical();
453 sProRing.SetIkari(&courage);
454 maxim.SetRing(&sProRing);
456 evilJewel.SetName("Evil jewel");
457 evilJewel.SetMenuIcon(&jewelIcon);
459 gloomy.SetName("Gloomy");
461 gloomy.GetTargetingMode().TargetAllEnemies();
463 evilJewel.SetIkari(&gloomy);
464 maxim.SetJewel(&evilJewel);
467 zircoWhip.SetName("Zirco whip");
468 zircoWhip.SetMenuIcon(&rodIcon);
470 thundershriek.SetName("Thundershriek");
471 thundershriek.SetCost(224);
472 thundershriek.GetTargetingMode().TargetAllEnemies();
473 thundershriek.SetPhysical();
474 zircoWhip.SetIkari(&thundershriek);
475 selan.SetWeapon(&zircoWhip);
477 zirconPlate.SetName("Zircon plate");
478 zirconPlate.SetMenuIcon(&armorIcon);
480 suddenCure.SetName("Sudden cure");
481 suddenCure.SetCost(96);
482 suddenCure.GetTargetingMode().TargetAllAllies();
483 suddenCure.SetMagical();
484 zirconPlate.SetIkari(&suddenCure);
485 selan.SetArmor(&zirconPlate);
487 zircoGloves.SetName("Zirco gloves");
488 zircoGloves.SetMenuIcon(&shieldIcon);
490 forcefield.SetName("Forcefield");
491 forcefield.SetCost(64);
492 forcefield.GetTargetingMode().TargetAllAllies();
493 forcefield.SetMagical();
494 zircoGloves.SetIkari(&forcefield);
495 selan.SetShield(&zircoGloves);
497 holyCap.SetName("Holy cap");
498 holyCap.SetMenuIcon(&helmetIcon);
500 vulnerable.SetName("Vulnerable");
501 vulnerable.SetCost(196);
502 vulnerable.GetTargetingMode().TargetAllEnemies();
503 vulnerable.SetPhysical();
504 holyCap.SetIkari(&vulnerable);
505 selan.SetHelmet(&holyCap);
507 ghostRing.SetName("Ghost ring");
508 ghostRing.SetMenuIcon(&ringIcon);
510 destroy.SetName("Destroy");
511 destroy.SetCost(128);
512 destroy.GetTargetingMode().TargetMultipleEnemies();
513 destroy.SetMagical();
514 ghostRing.SetIkari(&destroy);
515 selan.SetRing(&ghostRing);
517 eagleRock.SetName("Eagle rock");
518 eagleRock.SetMenuIcon(&jewelIcon);
520 dive.SetName("Dive");
522 dive.GetTargetingMode().TargetSingleEnemy();
524 eagleRock.SetIkari(&dive);
525 selan.SetJewel(&eagleRock);
528 zircoAx.SetName("Zirco ax");
529 zircoAx.SetMenuIcon(&axIcon);
531 torrent.SetName("Torrent");
532 torrent.SetCost(224);
533 torrent.GetTargetingMode().TargetAllEnemies();
534 torrent.SetPhysical();
535 zircoAx.SetIkari(&torrent);
536 guy.SetWeapon(&zircoAx);
537 guy.SetArmor(&zirconArmor);
539 megaShield.SetName("Mega shield");
540 megaShield.SetMenuIcon(&shieldIcon);
542 ironBarrier.SetName("Iron barrier");
543 ironBarrier.SetCost(255);
544 ironBarrier.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
545 ironBarrier.SetMagical();
546 megaShield.SetIkari(&ironBarrier);
547 guy.SetShield(&megaShield);
549 zircoHelmet.SetName("Zirco helmet");
550 zircoHelmet.SetMenuIcon(&helmetIcon);
552 slow.SetName("Slow");
554 slow.GetTargetingMode().TargetAllEnemies();
556 zircoHelmet.SetIkari(&slow);
557 guy.SetHelmet(&zircoHelmet);
559 powerRing.SetName("Power ring");
560 powerRing.SetMenuIcon(&ringIcon);
562 trick.SetName("Trick");
564 trick.GetTargetingMode().TargetAllEnemies();
566 zircoHelmet.SetIkari(&trick);
567 guy.SetRing(&powerRing);
568 guy.SetJewel(&evilJewel);
570 // NOTE: this is actually Artea equipment
572 lizardBlow.SetName("Lizard blow");
573 lizardBlow.SetMenuIcon(&swordIcon);
575 dragonRush.SetName("Dragon rush");
576 dragonRush.SetCost(164);
577 dragonRush.GetTargetingMode().TargetSingleEnemy();
578 dragonRush.SetPhysical();
579 lizardBlow.SetIkari(&dragonRush);
580 dekar.SetWeapon(&lizardBlow);
582 holyRobe.SetName("Holy robe");
583 holyRobe.SetMenuIcon(&armorIcon);
585 crisisCure.SetName("Crisis cure");
586 crisisCure.SetCost(164);
587 crisisCure.GetTargetingMode().TargetAllAllies();
588 crisisCure.SetMagical();
589 holyRobe.SetIkari(&crisisCure);
590 dekar.SetArmor(&holyRobe);
591 dekar.SetShield(&zircoGloves);
592 dekar.SetHelmet(&holyCap);
594 rocketRing.SetName("Rocket ring");
595 rocketRing.SetMenuIcon(&ringIcon);
597 fake.SetName("Fake");
599 fake.GetTargetingMode().TargetSingleAlly();
601 rocketRing.SetIkari(&fake);
602 dekar.SetRing(&rocketRing);
604 krakenRock.SetName("Kraken rock");
605 krakenRock.SetMenuIcon(&jewelIcon);
607 tenLegger.SetName("Ten-legger");
608 tenLegger.SetCost(164);
609 tenLegger.GetTargetingMode().TargetAllEnemies();
610 tenLegger.SetPhysical();
611 rocketRing.SetIkari(&tenLegger);
612 dekar.SetJewel(&krakenRock);
614 battleRes.ikariMenuHeadline = "Please choose equipment.";
615 battleRes.noEquipmentText = "No equip";
616 battleRes.ikariMenuPrototype = Menu<const Item *>(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth());
618 battleRes.escapeText = "Escapes.";
620 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));
621 battleState->AddMonster(monster);
622 battleState->AddMonster(monster);
623 battleState->AddMonster(monster);
624 battleState->AddMonster(monster);
625 battleState->AddHero(maxim);
626 battleState->AddHero(selan);
627 battleState->AddHero(guy);
628 battleState->AddHero(dekar);
629 Application app(&screen, battleState);
630 app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
631 app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
632 app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
633 app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
634 app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
635 app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
636 app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
637 app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
638 app.Buttons().MapKey(SDLK_RETURN, Input::START);
639 app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
640 app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
641 app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
645 } catch (exception &e) {
646 cerr << "exception in main(): " << e.what() << endl;