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 "battle/Stats.h"
16 #include "common/Ikari.h"
17 #include "common/Inventory.h"
18 #include "common/Item.h"
19 #include "common/Spell.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 "loader/Interpreter.h"
29 #include "loader/ParsedSource.h"
30 #include "loader/Parser.h"
31 #include "sdl/InitImage.h"
32 #include "sdl/InitScreen.h"
33 #include "sdl/InitSDL.h"
40 #include <SDL_image.h>
42 using app::Application;
44 using battle::BattleState;
46 using battle::Monster;
47 using battle::PartyLayout;
50 using common::Inventory;
53 using geometry::Vector;
54 using graphics::ComplexAnimation;
56 using graphics::Frame;
57 using graphics::Gauge;
59 using graphics::SimpleAnimation;
60 using graphics::Sprite;
61 using loader::Interpreter;
62 using loader::ParsedSource;
65 using sdl::InitScreen;
73 int main(int argc, char **argv) {
74 const int width = 800;
75 const int height = 480;
77 const int framerate = 33;
79 // std::srand(std::time(0));
83 InitImage image(IMG_INIT_PNG);
86 Parser parser("test-data/test.l2s", source);
89 Interpreter intp(source);
92 InitScreen screen(width, height);
94 // temporary test data
95 SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
96 PartyLayout monstersLayout;
97 monstersLayout.AddPosition(Vector<Uint8>(88, 88));
98 monstersLayout.AddPosition(Vector<Uint8>(128, 88));
99 monstersLayout.AddPosition(Vector<Uint8>(168, 88));
100 monstersLayout.AddPosition(Vector<Uint8>(208, 88));
101 PartyLayout heroesLayout;
102 heroesLayout.AddPosition(Vector<Uint8>(48, 136));
103 heroesLayout.AddPosition(Vector<Uint8>(128, 136));
104 heroesLayout.AddPosition(Vector<Uint8>(80, 152));
105 heroesLayout.AddPosition(Vector<Uint8>(160, 152));
107 Monster monster(*intp.GetMonster("lizard"));
108 Hero maxim(*intp.GetHero("maxim"));
109 Hero selan(*intp.GetHero("selan"));
111 SDL_Surface *guyImg(IMG_Load("test-data/guy.png"));
112 Sprite guySprite(guyImg, 64, 64);
116 guy.SetSprite(&guySprite);
117 guy.SetMaxHealth(38);
122 guy.SetStats(Stats(38, 25, 38, 13, 8, 90, 8));
123 ComplexAnimation guyAttackAnimation(&guySprite, framerate);
124 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-4, 0), 2);
125 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-8, 0), 2);
126 guyAttackAnimation.AddFrames(2, 0, Vector<int>(-8, 0), 2);
127 guyAttackAnimation.AddFrame(2, 0, Vector<int>(-4, 0));
128 guyAttackAnimation.AddFrames(2, 0, Vector<int>(), 2);
129 guyAttackAnimation.AddFrame(2, 1);
130 guyAttackAnimation.AddFrame(2, 1, Vector<int>(4, 0));
131 guyAttackAnimation.AddFrame(2, 1, Vector<int>(10, 0));
132 guyAttackAnimation.AddFrame(2, 2, Vector<int>(10, 0));
133 guyAttackAnimation.AddFrame(2, 2);
134 guy.SetAttackAnimation(&guyAttackAnimation);
135 SDL_Surface *guyMeleeImg(IMG_Load("test-data/melee-guy.png"));
136 Sprite guyMeleeSprite(guyMeleeImg, 96, 96);
137 SimpleAnimation guyMeleeAnimation(&guyMeleeSprite, 2 * framerate, 4);
138 guy.SetMeleeAnimation(&guyMeleeAnimation);
140 SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png"));
141 Sprite dekarSprite(dekarImg, 64, 64);
143 dekar.SetName("Dekar");
145 dekar.SetSprite(&dekarSprite);
146 dekar.SetMaxHealth(38);
151 dekar.SetStats(Stats(46, 29, 46, 13, 7, 100, 5));
152 ComplexAnimation dekarAttackAnimation(&dekarSprite, framerate);
153 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(4, 0));
154 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
155 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(12, 4));
156 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(16, 4));
157 dekarAttackAnimation.AddFrames(2, 0, Vector<int>(10, 2), 4);
158 dekarAttackAnimation.AddFrame(2, 1, Vector<int>(6, 2));
159 dekarAttackAnimation.AddFrame(2, 1, Vector<int>());
160 dekarAttackAnimation.AddFrame(2, 2, Vector<int>(-2, 0));
161 dekarAttackAnimation.AddFrames(2, 2, Vector<int>(0, 0), 3);
162 dekar.SetAttackAnimation(&dekarAttackAnimation);
163 ComplexAnimation dekarSpellAnimation(&dekarSprite, framerate);
164 dekarSpellAnimation.AddFrames(2, 0, Vector<int>(), 6);
165 dekarSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
166 dekarSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
167 dekar.SetSpellAnimation(&dekarSpellAnimation);
168 SDL_Surface *dekarMeleeImg(IMG_Load("test-data/melee-dekar.png"));
169 Sprite dekarMeleeSprite(dekarMeleeImg, 96, 96);
170 SimpleAnimation dekarMeleeAnimation(&dekarMeleeSprite, 2 * framerate, 4);
171 dekar.SetMeleeAnimation(&dekarMeleeAnimation);
173 battle::Resources battleRes;
175 SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png"));
176 Sprite swapCursorSprite(swapCursorImg, 32, 32);
177 battleRes.swapCursor = &swapCursorSprite;
178 SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
179 Sprite attackIconsSprite(attackIconsImg, 32, 32);
180 battleRes.attackIcons = &attackIconsSprite;
181 SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
182 Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
183 battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
184 SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
185 Sprite moveIconsSprite(moveIconsImg, 32, 32);
186 battleRes.moveIcons = &moveIconsSprite;
188 SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png"));
189 Frame titleFrame(titleFrameImg, 16, 16);
190 battleRes.titleFrame = &titleFrame;
192 SDL_Surface *largeFontImg(IMG_Load("test-data/large-font.png"));
193 Sprite largeFontSprite(largeFontImg, 16, 32);
194 Font largeFont(&largeFontSprite, 0, -2);
195 battleRes.titleFont = &largeFont;
197 ComplexAnimation numberAnimationPrototype(0, framerate);
198 numberAnimationPrototype.AddFrame(0, 0);
199 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
200 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
201 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -48));
202 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
203 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
204 numberAnimationPrototype.AddFrame(0, 0);
205 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
206 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
207 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -24));
208 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
209 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
210 numberAnimationPrototype.AddFrame(0, 0);
211 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
212 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
213 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
214 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
215 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
216 numberAnimationPrototype.AddFrames(0, 0, Vector<int>(), 14);
217 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -36));
218 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -32));
219 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -18));
220 battleRes.numberAnimationPrototype = &numberAnimationPrototype;
222 SDL_Surface *bigNumbersImg(IMG_Load("test-data/big-numbers.png"));
223 Sprite bigNumbersSprite(bigNumbersImg, 16, 32);
224 battleRes.bigNumberSprite = &bigNumbersSprite;
225 SDL_Surface *bigGreenNumbersImg(IMG_Load("test-data/big-green-numbers.png"));
226 Sprite bigGreenNumbersSprite(bigGreenNumbersImg, 16, 32);
227 battleRes.greenNumberSprite = &bigGreenNumbersSprite;
229 SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png"));
230 Sprite heroTagSprite(heroTagImg, 32, 16);
231 battleRes.heroTagLabels = &heroTagSprite;
232 battleRes.levelLabelCol = 0;
233 battleRes.levelLabelRow = 0;
234 battleRes.healthLabelCol = 0;
235 battleRes.healthLabelRow = 1;
236 battleRes.manaLabelCol = 0;
237 battleRes.manaLabelRow = 2;
238 battleRes.moveLabelCol = 0;
239 battleRes.moveLabelRow = 3;
240 battleRes.ikariLabelCol = 0;
241 battleRes.ikariLabelRow = 4;
243 SDL_Surface *numbersImg(IMG_Load("test-data/numbers.png"));
244 Sprite numbersSprite(numbersImg, 16, 16);
245 Font heroTagFont(&numbersSprite, 0, -3);
246 battleRes.heroTagFont = &heroTagFont;
247 SDL_Surface *tagFramesImg(IMG_Load("test-data/tag-frames.png"));
248 Frame heroTagFrame(tagFramesImg, 16, 16, 1, 1, 0, 33);
249 battleRes.heroTagFrame = &heroTagFrame;
250 Frame activeHeroTagFrame(tagFramesImg, 16, 16);
251 battleRes.activeHeroTagFrame = &activeHeroTagFrame;
252 SDL_Surface *smallTagFrameImg(IMG_Load("test-data/small-tag-frame.png"));
253 Frame smallTagFrame(smallTagFrameImg, 8, 16);
254 battleRes.smallHeroTagFrame = &smallTagFrame;
255 Frame lastSmallTagFrame(smallTagFrameImg, 8, 16, 1, 1, 0, 33);
256 battleRes.lastSmallHeroTagFrame = &lastSmallTagFrame;
257 battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31);
259 SDL_Surface *gauges(IMG_Load("test-data/gauges.png"));
260 Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6);
261 battleRes.healthGauge = &healthGauge;
262 Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
263 battleRes.manaGauge = &manaGauge;
264 Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
265 battleRes.ikariGauge = &ikariGauge;
267 SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png"));
268 Frame selectFrame(selectFrameImg, 16, 16);
269 battleRes.selectFrame = &selectFrame;
271 SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png"));
272 Sprite normalFontSprite(normalFontImg, 16, 16);
273 Font normalFont(&normalFontSprite, 0, -2);
274 battleRes.normalFont = &normalFont;
276 SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png"));
277 Sprite disabledFontSprite(disabledFontImg, 16, 16);
278 Font disabledFont(&disabledFontSprite, 0, -2);
279 battleRes.disabledFont = &disabledFont;
281 SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png"));
282 Sprite handCursorSprite(handCursorImg, 32, 32);
283 battleRes.menuCursor = &handCursorSprite;
285 SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png"));
286 Sprite weaponTargetCursor(targetingIconsImg, 32, 32);
287 Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
288 Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
289 battleRes.weaponTargetCursor = &weaponTargetCursor;
290 battleRes.magicTargetCursor = &magicTargetCursor;
291 battleRes.itemTargetCursor = &itemTargetCursor;
294 resetSpell.SetName("Reset");
295 maxim.AddSpell(&resetSpell);
297 strongSpell.SetName("Strong");
298 strongSpell.SetCost(3);
299 strongSpell.SetUsableInBattle();
300 strongSpell.GetTargetingMode().TargetMultipleAllies();
301 maxim.AddSpell(&strongSpell);
302 selan.AddSpell(&strongSpell);
304 strongerSpell.SetName("Stronger");
305 strongerSpell.SetCost(8);
306 strongerSpell.SetUsableInBattle();
307 strongerSpell.GetTargetingMode().TargetMultipleAllies();
308 maxim.AddSpell(&strongerSpell);
309 selan.AddSpell(&strongerSpell);
311 championSpell.SetName("Champion");
312 championSpell.SetCost(16);
313 championSpell.SetUsableInBattle();
314 championSpell.GetTargetingMode().TargetMultipleAllies();
315 maxim.AddSpell(&championSpell);
316 selan.AddSpell(&championSpell);
318 rallySpell.SetName("Rally");
319 rallySpell.SetCost(10);
320 rallySpell.SetUsableInBattle();
321 rallySpell.GetTargetingMode().TargetMultipleAllies();
322 maxim.AddSpell(&rallySpell);
323 selan.AddSpell(&rallySpell);
325 escapeSpell.SetName("Escape");
326 escapeSpell.SetCost(8);
327 selan.AddSpell(&escapeSpell);
329 valorSpell.SetName("Valor");
330 valorSpell.SetCost(30);
331 valorSpell.SetUsableInBattle();
332 valorSpell.GetTargetingMode().TargetMultipleAllies();
333 maxim.AddSpell(&valorSpell);
334 selan.AddSpell(&valorSpell);
336 battleRes.spellMenuHeadline = "Please choose a spell.";
337 battleRes.spellMenuPrototype = Menu<const Spell *>(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':');
339 SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png"));
340 Sprite potionIcon(itemIcons, 16, 16);
341 Sprite ballIcon(itemIcons, 16, 16, 0, 16);
342 Sprite crankIcon(itemIcons, 16, 16, 0, 32);
343 Sprite spearIcon(itemIcons, 16, 16, 0, 48);
344 Sprite swordIcon(itemIcons, 16, 16, 0, 64);
345 Sprite axIcon(itemIcons, 16, 16, 0, 80);
346 Sprite rodIcon(itemIcons, 16, 16, 0, 96);
347 Sprite armorIcon(itemIcons, 16, 16, 0, 112);
348 Sprite shieldIcon(itemIcons, 16, 16, 0, 128);
349 Sprite helmetIcon(itemIcons, 16, 16, 0, 144);
350 Sprite ringIcon(itemIcons, 16, 16, 0, 160);
351 Sprite jewelIcon(itemIcons, 16, 16, 0, 176);
353 battleRes.weaponMenuIcon = &swordIcon;
354 battleRes.armorMenuIcon = &armorIcon;
355 battleRes.shieldMenuIcon = &shieldIcon;
356 battleRes.helmetMenuIcon = &helmetIcon;
357 battleRes.ringMenuIcon = &ringIcon;
358 battleRes.jewelMenuIcon = &jewelIcon;
362 antidote.SetName("Antidote");
363 antidote.SetMenuIcon(&potionIcon);
364 antidote.SetUsableInBattle();
365 antidote.GetTargetingMode().TargetSingleAlly();
366 inventory.Add(&antidote, 9);
368 magicJar.SetName("Magic jar");
369 magicJar.SetMenuIcon(&potionIcon);
370 magicJar.SetUsableInBattle();
371 magicJar.GetTargetingMode().TargetSingleAlly();
372 inventory.Add(&magicJar, 4);
374 hiPotion.SetName("Hi-Potion");
375 hiPotion.SetMenuIcon(&potionIcon);
376 hiPotion.SetUsableInBattle();
377 hiPotion.GetTargetingMode().TargetSingleAlly();
378 inventory.Add(&hiPotion, 4);
380 powerPotion.SetName("Power potion");
381 powerPotion.SetMenuIcon(&potionIcon);
382 inventory.Add(&powerPotion, 4);
384 escape.SetName("Escape");
385 inventory.Add(&escape, 2);
387 sleepBall.SetName("Sleep ball");
388 sleepBall.SetMenuIcon(&ballIcon);
389 sleepBall.SetUsableInBattle();
390 sleepBall.GetTargetingMode().TargetSingleEnemy();
391 inventory.Add(&sleepBall, 1);
393 multiBall.SetName("Multi-ball!");
394 multiBall.SetMenuIcon(&ballIcon);
395 multiBall.SetUsableInBattle();
396 multiBall.GetTargetingMode().TargetMultipleEnemies();
397 inventory.Add(&multiBall, 1);
399 figgoru.SetName("Figgoru");
400 figgoru.SetMenuIcon(&crankIcon);
401 figgoru.GetTargetingMode().TargetAllEnemies();
402 inventory.Add(&figgoru, 1);
403 battleRes.inventory = &inventory;
405 battleRes.itemMenuHeadline = "Please choose an item.";
406 battleRes.itemMenuPrototype = Menu<const common::Item *>(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':');
408 SDL_Surface *swordAttackImg(IMG_Load("test-data/attack-sword.png"));
409 Sprite swordAttackSprite(swordAttackImg, 96, 96);
410 SimpleAnimation swordAttackAnimation(&swordAttackSprite, 2 * framerate, 4);
413 zircoSword.SetName("Zirco sword");
414 zircoSword.SetMenuIcon(&swordIcon);
415 zircoSword.GetTargetingMode().TargetSingleEnemy();
417 firestorm.SetName("Firestorm");
418 firestorm.SetCost(224);
419 firestorm.GetTargetingMode().TargetAllEnemies();
420 firestorm.SetPhysical();
421 zircoSword.SetIkari(&firestorm);
422 zircoSword.SetAttackAnimation(&swordAttackAnimation);
423 maxim.SetWeapon(&zircoSword);
425 zirconArmor.SetName("Zircon armor");
426 zirconArmor.SetMenuIcon(&armorIcon);
428 magicCure.SetName("Magic cure");
429 magicCure.SetCost(128);
430 magicCure.GetTargetingMode().TargetSingleAlly();
431 magicCure.SetMagical();
432 zirconArmor.SetIkari(&magicCure);
433 maxim.SetArmor(&zirconArmor);
435 holyShield.SetName("Holy shield");
436 holyShield.SetMenuIcon(&shieldIcon);
438 lightGuard.SetName("Light guard");
439 lightGuard.SetCost(128);
440 lightGuard.GetTargetingMode().TargetAllAllies(); // actually only targets self
441 lightGuard.SetMagical();
442 holyShield.SetIkari(&lightGuard);
443 maxim.SetShield(&holyShield);
445 legendHelm.SetName("Legend helm");
446 legendHelm.SetMenuIcon(&helmetIcon);
448 boomerang.SetName("Boomerang");
449 boomerang.SetCost(164);
450 boomerang.GetTargetingMode().TargetAllAllies(); // actually only targets self
451 boomerang.SetMagical();
452 legendHelm.SetIkari(&boomerang);
453 maxim.SetHelmet(&legendHelm);
455 sProRing.SetName("S-pro ring");
456 sProRing.SetMenuIcon(&ringIcon);
458 courage.SetName("Courage");
460 courage.GetTargetingMode().TargetMultipleAllies();
461 courage.SetMagical();
462 sProRing.SetIkari(&courage);
463 maxim.SetRing(&sProRing);
465 evilJewel.SetName("Evil jewel");
466 evilJewel.SetMenuIcon(&jewelIcon);
468 gloomy.SetName("Gloomy");
470 gloomy.GetTargetingMode().TargetAllEnemies();
472 evilJewel.SetIkari(&gloomy);
473 maxim.SetJewel(&evilJewel);
476 zircoWhip.SetName("Zirco whip");
477 zircoWhip.SetMenuIcon(&rodIcon);
478 zircoWhip.GetTargetingMode().TargetSingleEnemy();
480 thundershriek.SetName("Thundershriek");
481 thundershriek.SetCost(224);
482 thundershriek.GetTargetingMode().TargetAllEnemies();
483 thundershriek.SetPhysical();
484 zircoWhip.SetIkari(&thundershriek);
485 // selan.SetWeapon(&zircoWhip);
487 zirconPlate.SetName("Zircon plate");
488 zirconPlate.SetMenuIcon(&armorIcon);
490 suddenCure.SetName("Sudden cure");
491 suddenCure.SetCost(96);
492 suddenCure.GetTargetingMode().TargetAllAllies();
493 suddenCure.SetMagical();
494 zirconPlate.SetIkari(&suddenCure);
495 selan.SetArmor(&zirconPlate);
497 zircoGloves.SetName("Zirco gloves");
498 zircoGloves.SetMenuIcon(&shieldIcon);
500 forcefield.SetName("Forcefield");
501 forcefield.SetCost(64);
502 forcefield.GetTargetingMode().TargetAllAllies();
503 forcefield.SetMagical();
504 zircoGloves.SetIkari(&forcefield);
505 selan.SetShield(&zircoGloves);
507 holyCap.SetName("Holy cap");
508 holyCap.SetMenuIcon(&helmetIcon);
510 vulnerable.SetName("Vulnerable");
511 vulnerable.SetCost(196);
512 vulnerable.GetTargetingMode().TargetAllEnemies();
513 vulnerable.SetPhysical();
514 holyCap.SetIkari(&vulnerable);
515 selan.SetHelmet(&holyCap);
517 ghostRing.SetName("Ghost ring");
518 ghostRing.SetMenuIcon(&ringIcon);
520 destroy.SetName("Destroy");
521 destroy.SetCost(128);
522 destroy.GetTargetingMode().TargetMultipleEnemies();
523 destroy.SetMagical();
524 ghostRing.SetIkari(&destroy);
525 selan.SetRing(&ghostRing);
527 eagleRock.SetName("Eagle rock");
528 eagleRock.SetMenuIcon(&jewelIcon);
530 dive.SetName("Dive");
532 dive.GetTargetingMode().TargetSingleEnemy();
534 eagleRock.SetIkari(&dive);
535 selan.SetJewel(&eagleRock);
538 zircoAx.SetName("Zirco ax");
539 zircoAx.SetMenuIcon(&axIcon);
540 zircoAx.GetTargetingMode().TargetSingleEnemy();
542 torrent.SetName("Torrent");
543 torrent.SetCost(224);
544 torrent.GetTargetingMode().TargetAllEnemies();
545 torrent.SetPhysical();
546 zircoAx.SetIkari(&torrent);
547 // guy.SetWeapon(&zircoAx);
548 guy.SetArmor(&zirconArmor);
550 megaShield.SetName("Mega shield");
551 megaShield.SetMenuIcon(&shieldIcon);
553 ironBarrier.SetName("Iron barrier");
554 ironBarrier.SetCost(255);
555 ironBarrier.GetTargetingMode().TargetAllAllies(); // actually only targets self
556 ironBarrier.SetMagical();
557 megaShield.SetIkari(&ironBarrier);
558 guy.SetShield(&megaShield);
560 zircoHelmet.SetName("Zirco helmet");
561 zircoHelmet.SetMenuIcon(&helmetIcon);
563 slow.SetName("Slow");
565 slow.GetTargetingMode().TargetAllEnemies();
567 zircoHelmet.SetIkari(&slow);
568 guy.SetHelmet(&zircoHelmet);
570 powerRing.SetName("Power ring");
571 powerRing.SetMenuIcon(&ringIcon);
573 trick.SetName("Trick");
575 trick.GetTargetingMode().TargetAllEnemies();
577 zircoHelmet.SetIkari(&trick);
578 guy.SetRing(&powerRing);
579 guy.SetJewel(&evilJewel);
581 // NOTE: this is actually Artea equipment
583 lizardBlow.SetName("Lizard blow");
584 lizardBlow.SetMenuIcon(&swordIcon);
585 lizardBlow.GetTargetingMode().TargetSingleEnemy();
587 dragonRush.SetName("Dragon rush");
588 dragonRush.SetCost(164);
589 dragonRush.GetTargetingMode().TargetSingleEnemy();
590 dragonRush.SetPhysical();
591 lizardBlow.SetIkari(&dragonRush);
592 // dekar.SetWeapon(&lizardBlow);
594 holyRobe.SetName("Holy robe");
595 holyRobe.SetMenuIcon(&armorIcon);
597 crisisCure.SetName("Crisis cure");
598 crisisCure.SetCost(164);
599 crisisCure.GetTargetingMode().TargetAllAllies();
600 crisisCure.SetMagical();
601 holyRobe.SetIkari(&crisisCure);
602 dekar.SetArmor(&holyRobe);
603 dekar.SetShield(&zircoGloves);
604 dekar.SetHelmet(&holyCap);
606 rocketRing.SetName("Rocket ring");
607 rocketRing.SetMenuIcon(&ringIcon);
609 fake.SetName("Fake");
611 fake.GetTargetingMode().TargetSingleAlly();
613 rocketRing.SetIkari(&fake);
614 dekar.SetRing(&rocketRing);
616 krakenRock.SetName("Kraken rock");
617 krakenRock.SetMenuIcon(&jewelIcon);
619 tenLegger.SetName("Ten-legger");
620 tenLegger.SetCost(164);
621 tenLegger.GetTargetingMode().TargetAllEnemies();
622 tenLegger.SetPhysical();
623 rocketRing.SetIkari(&tenLegger);
624 dekar.SetJewel(&krakenRock);
626 battleRes.ikariMenuHeadline = "Please choose equipment.";
627 battleRes.noEquipmentText = "No equip";
628 battleRes.ikariMenuPrototype = Menu<const Item *>(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth());
630 battleRes.escapeText = "Escapes.";
632 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));
633 battleState->AddMonster(monster);
634 battleState->AddMonster(monster);
635 battleState->AddMonster(monster);
636 battleState->AddMonster(monster);
637 battleState->AddHero(maxim);
638 battleState->AddHero(selan);
639 battleState->AddHero(guy);
640 battleState->AddHero(dekar);
641 Application app(&screen, battleState);
642 app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
643 app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
644 app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
645 app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
646 app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
647 app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
648 app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
649 app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
650 app.Buttons().MapKey(SDLK_RETURN, Input::START);
651 app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
652 app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
653 app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
657 } catch (Parser::Error &e) {
658 cerr << "parsing exception in file " << e.File() << " on line " << e.Line() << ": " << e.what() << endl;
660 } catch (exception &e) {
661 cerr << "exception in main(): " << e.what() << endl;