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);
88 Interpreter intp(source);
91 InitScreen screen(width, height);
93 // temporary test data
94 SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
95 PartyLayout monstersLayout;
96 monstersLayout.AddPosition(Vector<Uint8>(88, 88));
97 monstersLayout.AddPosition(Vector<Uint8>(128, 88));
98 monstersLayout.AddPosition(Vector<Uint8>(168, 88));
99 monstersLayout.AddPosition(Vector<Uint8>(208, 88));
100 PartyLayout heroesLayout;
101 heroesLayout.AddPosition(Vector<Uint8>(48, 136));
102 heroesLayout.AddPosition(Vector<Uint8>(128, 136));
103 heroesLayout.AddPosition(Vector<Uint8>(80, 152));
104 heroesLayout.AddPosition(Vector<Uint8>(160, 152));
106 Monster monster(*intp.GetMonster("lizard"));
107 Hero maxim(*intp.GetHero("maxim"));
108 Hero selan(*intp.GetHero("selan"));
110 SDL_Surface *guyImg(IMG_Load("test-data/guy.png"));
111 Sprite guySprite(guyImg, 64, 64);
115 guy.SetSprite(&guySprite);
116 guy.SetMaxHealth(38);
121 guy.SetStats(Stats(38, 25, 38, 13, 8, 90, 8));
122 ComplexAnimation guyAttackAnimation(&guySprite, framerate);
123 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-4, 0), 2);
124 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-8, 0), 2);
125 guyAttackAnimation.AddFrames(2, 0, Vector<int>(-8, 0), 2);
126 guyAttackAnimation.AddFrame(2, 0, Vector<int>(-4, 0));
127 guyAttackAnimation.AddFrames(2, 0, Vector<int>(), 2);
128 guyAttackAnimation.AddFrame(2, 1);
129 guyAttackAnimation.AddFrame(2, 1, Vector<int>(4, 0));
130 guyAttackAnimation.AddFrame(2, 1, Vector<int>(10, 0));
131 guyAttackAnimation.AddFrame(2, 2, Vector<int>(10, 0));
132 guyAttackAnimation.AddFrame(2, 2);
133 guy.SetAttackAnimation(&guyAttackAnimation);
134 SDL_Surface *guyMeleeImg(IMG_Load("test-data/melee-guy.png"));
135 Sprite guyMeleeSprite(guyMeleeImg, 96, 96);
136 SimpleAnimation guyMeleeAnimation(&guyMeleeSprite, 2 * framerate, 4);
137 guy.SetMeleeAnimation(&guyMeleeAnimation);
139 SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png"));
140 Sprite dekarSprite(dekarImg, 64, 64);
142 dekar.SetName("Dekar");
144 dekar.SetSprite(&dekarSprite);
145 dekar.SetMaxHealth(38);
150 dekar.SetStats(Stats(46, 29, 46, 13, 7, 100, 5));
151 ComplexAnimation dekarAttackAnimation(&dekarSprite, framerate);
152 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(4, 0));
153 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
154 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(12, 4));
155 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(16, 4));
156 dekarAttackAnimation.AddFrames(2, 0, Vector<int>(10, 2), 4);
157 dekarAttackAnimation.AddFrame(2, 1, Vector<int>(6, 2));
158 dekarAttackAnimation.AddFrame(2, 1, Vector<int>());
159 dekarAttackAnimation.AddFrame(2, 2, Vector<int>(-2, 0));
160 dekarAttackAnimation.AddFrames(2, 2, Vector<int>(0, 0), 3);
161 dekar.SetAttackAnimation(&dekarAttackAnimation);
162 ComplexAnimation dekarSpellAnimation(&dekarSprite, framerate);
163 dekarSpellAnimation.AddFrames(2, 0, Vector<int>(), 6);
164 dekarSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
165 dekarSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
166 dekar.SetSpellAnimation(&dekarSpellAnimation);
167 SDL_Surface *dekarMeleeImg(IMG_Load("test-data/melee-dekar.png"));
168 Sprite dekarMeleeSprite(dekarMeleeImg, 96, 96);
169 SimpleAnimation dekarMeleeAnimation(&dekarMeleeSprite, 2 * framerate, 4);
170 dekar.SetMeleeAnimation(&dekarMeleeAnimation);
172 battle::Resources battleRes;
174 SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png"));
175 Sprite swapCursorSprite(swapCursorImg, 32, 32);
176 battleRes.swapCursor = &swapCursorSprite;
177 SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
178 Sprite attackIconsSprite(attackIconsImg, 32, 32);
179 battleRes.attackIcons = &attackIconsSprite;
180 SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
181 Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
182 battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
183 SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
184 Sprite moveIconsSprite(moveIconsImg, 32, 32);
185 battleRes.moveIcons = &moveIconsSprite;
187 SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png"));
188 Frame titleFrame(titleFrameImg, 16, 16);
189 battleRes.titleFrame = &titleFrame;
191 SDL_Surface *largeFontImg(IMG_Load("test-data/large-font.png"));
192 Sprite largeFontSprite(largeFontImg, 16, 32);
193 Font largeFont(&largeFontSprite, 0, -2);
194 battleRes.titleFont = &largeFont;
196 ComplexAnimation numberAnimationPrototype(0, framerate);
197 numberAnimationPrototype.AddFrame(0, 0);
198 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
199 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
200 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -48));
201 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
202 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
203 numberAnimationPrototype.AddFrame(0, 0);
204 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
205 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
206 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -24));
207 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
208 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
209 numberAnimationPrototype.AddFrame(0, 0);
210 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
211 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
212 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
213 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
214 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
215 numberAnimationPrototype.AddFrames(0, 0, Vector<int>(), 14);
216 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -36));
217 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -32));
218 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -18));
219 battleRes.numberAnimationPrototype = &numberAnimationPrototype;
221 SDL_Surface *bigNumbersImg(IMG_Load("test-data/big-numbers.png"));
222 Sprite bigNumbersSprite(bigNumbersImg, 16, 32);
223 battleRes.bigNumberSprite = &bigNumbersSprite;
224 SDL_Surface *bigGreenNumbersImg(IMG_Load("test-data/big-green-numbers.png"));
225 Sprite bigGreenNumbersSprite(bigGreenNumbersImg, 16, 32);
226 battleRes.greenNumberSprite = &bigGreenNumbersSprite;
228 SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png"));
229 Sprite heroTagSprite(heroTagImg, 32, 16);
230 battleRes.heroTagLabels = &heroTagSprite;
231 battleRes.levelLabelCol = 0;
232 battleRes.levelLabelRow = 0;
233 battleRes.healthLabelCol = 0;
234 battleRes.healthLabelRow = 1;
235 battleRes.manaLabelCol = 0;
236 battleRes.manaLabelRow = 2;
237 battleRes.moveLabelCol = 0;
238 battleRes.moveLabelRow = 3;
239 battleRes.ikariLabelCol = 0;
240 battleRes.ikariLabelRow = 4;
242 SDL_Surface *numbersImg(IMG_Load("test-data/numbers.png"));
243 Sprite numbersSprite(numbersImg, 16, 16);
244 Font heroTagFont(&numbersSprite, 0, -3);
245 battleRes.heroTagFont = &heroTagFont;
246 SDL_Surface *tagFramesImg(IMG_Load("test-data/tag-frames.png"));
247 Frame heroTagFrame(tagFramesImg, 16, 16, 1, 1, 0, 33);
248 battleRes.heroTagFrame = &heroTagFrame;
249 Frame activeHeroTagFrame(tagFramesImg, 16, 16);
250 battleRes.activeHeroTagFrame = &activeHeroTagFrame;
251 SDL_Surface *smallTagFrameImg(IMG_Load("test-data/small-tag-frame.png"));
252 Frame smallTagFrame(smallTagFrameImg, 8, 16);
253 battleRes.smallHeroTagFrame = &smallTagFrame;
254 Frame lastSmallTagFrame(smallTagFrameImg, 8, 16, 1, 1, 0, 33);
255 battleRes.lastSmallHeroTagFrame = &lastSmallTagFrame;
256 battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31);
258 SDL_Surface *gauges(IMG_Load("test-data/gauges.png"));
259 Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6);
260 battleRes.healthGauge = &healthGauge;
261 Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
262 battleRes.manaGauge = &manaGauge;
263 Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
264 battleRes.ikariGauge = &ikariGauge;
266 SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png"));
267 Frame selectFrame(selectFrameImg, 16, 16);
268 battleRes.selectFrame = &selectFrame;
270 SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png"));
271 Sprite normalFontSprite(normalFontImg, 16, 16);
272 Font normalFont(&normalFontSprite, 0, -2);
273 battleRes.normalFont = &normalFont;
275 SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png"));
276 Sprite disabledFontSprite(disabledFontImg, 16, 16);
277 Font disabledFont(&disabledFontSprite, 0, -2);
278 battleRes.disabledFont = &disabledFont;
280 SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png"));
281 Sprite handCursorSprite(handCursorImg, 32, 32);
282 battleRes.menuCursor = &handCursorSprite;
284 SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png"));
285 Sprite weaponTargetCursor(targetingIconsImg, 32, 32);
286 Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
287 Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
288 battleRes.weaponTargetCursor = &weaponTargetCursor;
289 battleRes.magicTargetCursor = &magicTargetCursor;
290 battleRes.itemTargetCursor = &itemTargetCursor;
293 resetSpell.SetName("Reset");
294 maxim.AddSpell(&resetSpell);
296 strongSpell.SetName("Strong");
297 strongSpell.SetCost(3);
298 strongSpell.SetUsableInBattle();
299 strongSpell.GetTargetingMode().TargetMultipleAllies();
300 maxim.AddSpell(&strongSpell);
301 selan.AddSpell(&strongSpell);
303 strongerSpell.SetName("Stronger");
304 strongerSpell.SetCost(8);
305 strongerSpell.SetUsableInBattle();
306 strongerSpell.GetTargetingMode().TargetMultipleAllies();
307 maxim.AddSpell(&strongerSpell);
308 selan.AddSpell(&strongerSpell);
310 championSpell.SetName("Champion");
311 championSpell.SetCost(16);
312 championSpell.SetUsableInBattle();
313 championSpell.GetTargetingMode().TargetMultipleAllies();
314 maxim.AddSpell(&championSpell);
315 selan.AddSpell(&championSpell);
317 rallySpell.SetName("Rally");
318 rallySpell.SetCost(10);
319 rallySpell.SetUsableInBattle();
320 rallySpell.GetTargetingMode().TargetMultipleAllies();
321 maxim.AddSpell(&rallySpell);
322 selan.AddSpell(&rallySpell);
324 escapeSpell.SetName("Escape");
325 escapeSpell.SetCost(8);
326 selan.AddSpell(&escapeSpell);
328 valorSpell.SetName("Valor");
329 valorSpell.SetCost(30);
330 valorSpell.SetUsableInBattle();
331 valorSpell.GetTargetingMode().TargetMultipleAllies();
332 maxim.AddSpell(&valorSpell);
333 selan.AddSpell(&valorSpell);
335 battleRes.spellMenuHeadline = "Please choose a spell.";
336 battleRes.spellMenuPrototype = Menu<const Spell *>(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':');
338 SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png"));
339 Sprite potionIcon(itemIcons, 16, 16);
340 Sprite ballIcon(itemIcons, 16, 16, 0, 16);
341 Sprite crankIcon(itemIcons, 16, 16, 0, 32);
342 Sprite spearIcon(itemIcons, 16, 16, 0, 48);
343 Sprite swordIcon(itemIcons, 16, 16, 0, 64);
344 Sprite axIcon(itemIcons, 16, 16, 0, 80);
345 Sprite rodIcon(itemIcons, 16, 16, 0, 96);
346 Sprite armorIcon(itemIcons, 16, 16, 0, 112);
347 Sprite shieldIcon(itemIcons, 16, 16, 0, 128);
348 Sprite helmetIcon(itemIcons, 16, 16, 0, 144);
349 Sprite ringIcon(itemIcons, 16, 16, 0, 160);
350 Sprite jewelIcon(itemIcons, 16, 16, 0, 176);
352 battleRes.weaponMenuIcon = &swordIcon;
353 battleRes.armorMenuIcon = &armorIcon;
354 battleRes.shieldMenuIcon = &shieldIcon;
355 battleRes.helmetMenuIcon = &helmetIcon;
356 battleRes.ringMenuIcon = &ringIcon;
357 battleRes.jewelMenuIcon = &jewelIcon;
361 antidote.SetName("Antidote");
362 antidote.SetMenuIcon(&potionIcon);
363 antidote.SetUsableInBattle();
364 antidote.GetTargetingMode().TargetSingleAlly();
365 inventory.Add(&antidote, 9);
367 magicJar.SetName("Magic jar");
368 magicJar.SetMenuIcon(&potionIcon);
369 magicJar.SetUsableInBattle();
370 magicJar.GetTargetingMode().TargetSingleAlly();
371 inventory.Add(&magicJar, 4);
373 hiPotion.SetName("Hi-Potion");
374 hiPotion.SetMenuIcon(&potionIcon);
375 hiPotion.SetUsableInBattle();
376 hiPotion.GetTargetingMode().TargetSingleAlly();
377 inventory.Add(&hiPotion, 4);
379 powerPotion.SetName("Power potion");
380 powerPotion.SetMenuIcon(&potionIcon);
381 inventory.Add(&powerPotion, 4);
383 escape.SetName("Escape");
384 inventory.Add(&escape, 2);
386 sleepBall.SetName("Sleep ball");
387 sleepBall.SetMenuIcon(&ballIcon);
388 sleepBall.SetUsableInBattle();
389 sleepBall.GetTargetingMode().TargetSingleEnemy();
390 inventory.Add(&sleepBall, 1);
392 multiBall.SetName("Multi-ball!");
393 multiBall.SetMenuIcon(&ballIcon);
394 multiBall.SetUsableInBattle();
395 multiBall.GetTargetingMode().TargetMultipleEnemies();
396 inventory.Add(&multiBall, 1);
398 figgoru.SetName("Figgoru");
399 figgoru.SetMenuIcon(&crankIcon);
400 figgoru.GetTargetingMode().TargetAllEnemies();
401 inventory.Add(&figgoru, 1);
402 battleRes.inventory = &inventory;
404 battleRes.itemMenuHeadline = "Please choose an item.";
405 battleRes.itemMenuPrototype = Menu<const common::Item *>(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':');
407 SDL_Surface *swordAttackImg(IMG_Load("test-data/attack-sword.png"));
408 Sprite swordAttackSprite(swordAttackImg, 96, 96);
409 SimpleAnimation swordAttackAnimation(&swordAttackSprite, 2 * framerate, 4);
412 zircoSword.SetName("Zirco sword");
413 zircoSword.SetMenuIcon(&swordIcon);
414 zircoSword.GetTargetingMode().TargetSingleEnemy();
416 firestorm.SetName("Firestorm");
417 firestorm.SetCost(224);
418 firestorm.GetTargetingMode().TargetAllEnemies();
419 firestorm.SetPhysical();
420 zircoSword.SetIkari(&firestorm);
421 zircoSword.SetAttackAnimation(&swordAttackAnimation);
422 maxim.SetWeapon(&zircoSword);
424 zirconArmor.SetName("Zircon armor");
425 zirconArmor.SetMenuIcon(&armorIcon);
427 magicCure.SetName("Magic cure");
428 magicCure.SetCost(128);
429 magicCure.GetTargetingMode().TargetSingleAlly();
430 magicCure.SetMagical();
431 zirconArmor.SetIkari(&magicCure);
432 maxim.SetArmor(&zirconArmor);
434 holyShield.SetName("Holy shield");
435 holyShield.SetMenuIcon(&shieldIcon);
437 lightGuard.SetName("Light guard");
438 lightGuard.SetCost(128);
439 lightGuard.GetTargetingMode().TargetAllAllies(); // actually only targets self
440 lightGuard.SetMagical();
441 holyShield.SetIkari(&lightGuard);
442 maxim.SetShield(&holyShield);
444 legendHelm.SetName("Legend helm");
445 legendHelm.SetMenuIcon(&helmetIcon);
447 boomerang.SetName("Boomerang");
448 boomerang.SetCost(164);
449 boomerang.GetTargetingMode().TargetAllAllies(); // actually only targets self
450 boomerang.SetMagical();
451 legendHelm.SetIkari(&boomerang);
452 maxim.SetHelmet(&legendHelm);
454 sProRing.SetName("S-pro ring");
455 sProRing.SetMenuIcon(&ringIcon);
457 courage.SetName("Courage");
459 courage.GetTargetingMode().TargetMultipleAllies();
460 courage.SetMagical();
461 sProRing.SetIkari(&courage);
462 maxim.SetRing(&sProRing);
464 evilJewel.SetName("Evil jewel");
465 evilJewel.SetMenuIcon(&jewelIcon);
467 gloomy.SetName("Gloomy");
469 gloomy.GetTargetingMode().TargetAllEnemies();
471 evilJewel.SetIkari(&gloomy);
472 maxim.SetJewel(&evilJewel);
475 zircoWhip.SetName("Zirco whip");
476 zircoWhip.SetMenuIcon(&rodIcon);
477 zircoWhip.GetTargetingMode().TargetSingleEnemy();
479 thundershriek.SetName("Thundershriek");
480 thundershriek.SetCost(224);
481 thundershriek.GetTargetingMode().TargetAllEnemies();
482 thundershriek.SetPhysical();
483 zircoWhip.SetIkari(&thundershriek);
484 // selan.SetWeapon(&zircoWhip);
486 zirconPlate.SetName("Zircon plate");
487 zirconPlate.SetMenuIcon(&armorIcon);
489 suddenCure.SetName("Sudden cure");
490 suddenCure.SetCost(96);
491 suddenCure.GetTargetingMode().TargetAllAllies();
492 suddenCure.SetMagical();
493 zirconPlate.SetIkari(&suddenCure);
494 selan.SetArmor(&zirconPlate);
496 zircoGloves.SetName("Zirco gloves");
497 zircoGloves.SetMenuIcon(&shieldIcon);
499 forcefield.SetName("Forcefield");
500 forcefield.SetCost(64);
501 forcefield.GetTargetingMode().TargetAllAllies();
502 forcefield.SetMagical();
503 zircoGloves.SetIkari(&forcefield);
504 selan.SetShield(&zircoGloves);
506 holyCap.SetName("Holy cap");
507 holyCap.SetMenuIcon(&helmetIcon);
509 vulnerable.SetName("Vulnerable");
510 vulnerable.SetCost(196);
511 vulnerable.GetTargetingMode().TargetAllEnemies();
512 vulnerable.SetPhysical();
513 holyCap.SetIkari(&vulnerable);
514 selan.SetHelmet(&holyCap);
516 ghostRing.SetName("Ghost ring");
517 ghostRing.SetMenuIcon(&ringIcon);
519 destroy.SetName("Destroy");
520 destroy.SetCost(128);
521 destroy.GetTargetingMode().TargetMultipleEnemies();
522 destroy.SetMagical();
523 ghostRing.SetIkari(&destroy);
524 selan.SetRing(&ghostRing);
526 eagleRock.SetName("Eagle rock");
527 eagleRock.SetMenuIcon(&jewelIcon);
529 dive.SetName("Dive");
531 dive.GetTargetingMode().TargetSingleEnemy();
533 eagleRock.SetIkari(&dive);
534 selan.SetJewel(&eagleRock);
537 zircoAx.SetName("Zirco ax");
538 zircoAx.SetMenuIcon(&axIcon);
539 zircoAx.GetTargetingMode().TargetSingleEnemy();
541 torrent.SetName("Torrent");
542 torrent.SetCost(224);
543 torrent.GetTargetingMode().TargetAllEnemies();
544 torrent.SetPhysical();
545 zircoAx.SetIkari(&torrent);
546 // guy.SetWeapon(&zircoAx);
547 guy.SetArmor(&zirconArmor);
549 megaShield.SetName("Mega shield");
550 megaShield.SetMenuIcon(&shieldIcon);
552 ironBarrier.SetName("Iron barrier");
553 ironBarrier.SetCost(255);
554 ironBarrier.GetTargetingMode().TargetAllAllies(); // actually only targets self
555 ironBarrier.SetMagical();
556 megaShield.SetIkari(&ironBarrier);
557 guy.SetShield(&megaShield);
559 zircoHelmet.SetName("Zirco helmet");
560 zircoHelmet.SetMenuIcon(&helmetIcon);
562 slow.SetName("Slow");
564 slow.GetTargetingMode().TargetAllEnemies();
566 zircoHelmet.SetIkari(&slow);
567 guy.SetHelmet(&zircoHelmet);
569 powerRing.SetName("Power ring");
570 powerRing.SetMenuIcon(&ringIcon);
572 trick.SetName("Trick");
574 trick.GetTargetingMode().TargetAllEnemies();
576 zircoHelmet.SetIkari(&trick);
577 guy.SetRing(&powerRing);
578 guy.SetJewel(&evilJewel);
580 // NOTE: this is actually Artea equipment
582 lizardBlow.SetName("Lizard blow");
583 lizardBlow.SetMenuIcon(&swordIcon);
584 lizardBlow.GetTargetingMode().TargetSingleEnemy();
586 dragonRush.SetName("Dragon rush");
587 dragonRush.SetCost(164);
588 dragonRush.GetTargetingMode().TargetSingleEnemy();
589 dragonRush.SetPhysical();
590 lizardBlow.SetIkari(&dragonRush);
591 // dekar.SetWeapon(&lizardBlow);
593 holyRobe.SetName("Holy robe");
594 holyRobe.SetMenuIcon(&armorIcon);
596 crisisCure.SetName("Crisis cure");
597 crisisCure.SetCost(164);
598 crisisCure.GetTargetingMode().TargetAllAllies();
599 crisisCure.SetMagical();
600 holyRobe.SetIkari(&crisisCure);
601 dekar.SetArmor(&holyRobe);
602 dekar.SetShield(&zircoGloves);
603 dekar.SetHelmet(&holyCap);
605 rocketRing.SetName("Rocket ring");
606 rocketRing.SetMenuIcon(&ringIcon);
608 fake.SetName("Fake");
610 fake.GetTargetingMode().TargetSingleAlly();
612 rocketRing.SetIkari(&fake);
613 dekar.SetRing(&rocketRing);
615 krakenRock.SetName("Kraken rock");
616 krakenRock.SetMenuIcon(&jewelIcon);
618 tenLegger.SetName("Ten-legger");
619 tenLegger.SetCost(164);
620 tenLegger.GetTargetingMode().TargetAllEnemies();
621 tenLegger.SetPhysical();
622 rocketRing.SetIkari(&tenLegger);
623 dekar.SetJewel(&krakenRock);
625 battleRes.ikariMenuHeadline = "Please choose equipment.";
626 battleRes.noEquipmentText = "No equip";
627 battleRes.ikariMenuPrototype = Menu<const Item *>(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth());
629 battleRes.escapeText = "Escapes.";
631 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));
632 battleState->AddMonster(monster);
633 battleState->AddMonster(monster);
634 battleState->AddMonster(monster);
635 battleState->AddMonster(monster);
636 battleState->AddHero(maxim);
637 battleState->AddHero(selan);
638 battleState->AddHero(guy);
639 battleState->AddHero(dekar);
640 Application app(&screen, battleState);
641 app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
642 app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
643 app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
644 app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
645 app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
646 app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
647 app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
648 app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
649 app.Buttons().MapKey(SDLK_RETURN, Input::START);
650 app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
651 app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
652 app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
656 } catch (Parser::Error &e) {
657 cerr << "parsing exception in file " << e.File() << " on line " << e.Line() << ": " << e.what() << endl;
659 } catch (exception &e) {
660 cerr << "exception in main(): " << e.what() << endl;