]> git.localhorst.tv Git - l2e.git/blob - src/main.cpp
730c5aa01cee254d90a08f7a7ca46df43dc34bd9
[l2e.git] / src / main.cpp
1 /*
2  * main.cpp
3  *
4  *  Created on: Aug 1, 2012
5  *      Author: holy
6  */
7
8 #include "app/Application.h"
9 #include "app/Input.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 "graphics/Font.h"
21 #include "graphics/Frame.h"
22 #include "graphics/Gauge.h"
23 #include "graphics/Menu.h"
24 #include "graphics/Sprite.h"
25 #include "sdl/InitImage.h"
26 #include "sdl/InitScreen.h"
27 #include "sdl/InitSDL.h"
28
29 #include <exception>
30 #include <iostream>
31 #include <SDL.h>
32 #include <SDL_image.h>
33
34 using app::Application;
35 using app::Input;
36 using battle::BattleState;
37 using battle::Hero;
38 using battle::Monster;
39 using battle::PartyLayout;
40 using common::Ikari;
41 using common::Inventory;
42 using common::Item;
43 using common::Spell;
44 using geometry::Point;
45 using graphics::Font;
46 using graphics::Frame;
47 using graphics::Gauge;
48 using graphics::Menu;
49 using graphics::Sprite;
50 using sdl::InitImage;
51 using sdl::InitScreen;
52 using sdl::InitSDL;
53
54 using std::cerr;
55 using std::cout;
56 using std::endl;
57 using std::exception;
58
59 int main(int argc, char **argv) {
60         const int width = 800;
61         const int height = 480;
62
63         try {
64                 InitSDL sdl;
65                 InitImage image(IMG_INIT_PNG);
66                 InitScreen screen(width, height);
67
68                 // temporary test data
69                 SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
70                 PartyLayout monstersLayout;
71                 monstersLayout.AddPosition(Point<Uint8>(88, 104));
72                 monstersLayout.AddPosition(Point<Uint8>(128, 104));
73                 monstersLayout.AddPosition(Point<Uint8>(168, 104));
74                 monstersLayout.AddPosition(Point<Uint8>(208, 104));
75                 PartyLayout heroesLayout;
76                 heroesLayout.AddPosition(Point<Uint8>(48, 152));
77                 heroesLayout.AddPosition(Point<Uint8>(128, 152));
78                 heroesLayout.AddPosition(Point<Uint8>(80, 168));
79                 heroesLayout.AddPosition(Point<Uint8>(160, 168));
80
81                 SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
82                 Sprite dummySprite(monsterImg, 64, 64);
83                 Monster monster;
84                 monster.SetName("Monster");
85                 monster.SetSprite(&dummySprite);
86                 monster.SetMaxHealth(10);
87                 monster.SetHealth(10);
88
89                 SDL_Surface *maximImg(IMG_Load("test-data/maxim.png"));
90                 Sprite maximSprite(maximImg, 64, 64);
91                 Hero maxim;
92                 maxim.SetName("Maxim");
93                 maxim.SetLevel(1);
94                 maxim.SetSprite(&maximSprite);
95                 maxim.SetMaxHealth(33);
96                 maxim.SetHealth(33);
97                 maxim.SetMaxMana(20);
98                 maxim.SetMana(20);
99                 maxim.SetIP(0);
100                 maxim.SetAttackFrames(3, 125);
101                 maxim.SetSpellFrames(2, 125);
102
103                 SDL_Surface *selanImg(IMG_Load("test-data/selan.png"));
104                 Sprite selanSprite(selanImg, 64, 64);
105                 Hero selan;
106                 selan.SetName("Selan");
107                 selan.SetLevel(1);
108                 selan.SetSprite(&selanSprite);
109                 selan.SetMaxHealth(28);
110                 selan.SetHealth(28);
111                 selan.SetMaxMana(23);
112                 selan.SetMana(23);
113                 selan.SetIP(1);
114                 selan.SetAttackFrames(3, 125);
115                 selan.SetSpellFrames(4, 125);
116
117                 SDL_Surface *guyImg(IMG_Load("test-data/guy.png"));
118                 Sprite guySprite(guyImg, 64, 64);
119                 Hero guy;
120                 guy.SetName("Guy");
121                 guy.SetLevel(1);
122                 guy.SetSprite(&guySprite);
123                 guy.SetMaxHealth(38);
124                 guy.SetHealth(38);
125                 guy.SetMaxMana(0);
126                 guy.SetMana(0);
127                 guy.SetIP(254);
128                 guy.SetAttackFrames(3, 125);
129                 guy.SetSpellFrames(0, 125);
130
131                 SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png"));
132                 Sprite dekarSprite(dekarImg, 64, 64);
133                 Hero dekar;
134                 dekar.SetName("Dekar");
135                 dekar.SetLevel(1);
136                 dekar.SetSprite(&dekarSprite);
137                 dekar.SetMaxHealth(38);
138                 dekar.SetHealth(38);
139                 dekar.SetMaxMana(0);
140                 dekar.SetMana(0);
141                 dekar.SetIP(255);
142                 dekar.SetAttackFrames(3, 125);
143                 dekar.SetSpellFrames(3, 125);
144
145                 battle::Resources battleRes;
146
147                 SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png"));
148                 Sprite swapCursorSprite(swapCursorImg, 32, 32);
149                 battleRes.swapCursor = &swapCursorSprite;
150                 SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
151                 Sprite attackIconsSprite(attackIconsImg, 32, 32);
152                 battleRes.attackIcons = &attackIconsSprite;
153                 SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
154                 Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
155                 battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
156                 SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
157                 Sprite moveIconsSprite(moveIconsImg, 32, 32);
158                 battleRes.moveIcons = &moveIconsSprite;
159
160                 SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png"));
161                 Frame titleFrame(titleFrameImg, 16, 16);
162                 battleRes.titleFrame = &titleFrame;
163
164                 SDL_Surface *largeFontImg(IMG_Load("test-data/large-font.png"));
165                 Sprite largeFontSprite(largeFontImg, 16, 32);
166                 Font largeFont(&largeFontSprite, 0, -2);
167                 battleRes.titleFont = &largeFont;
168
169                 SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png"));
170                 Sprite heroTagSprite(heroTagImg, 32, 16);
171                 battleRes.heroTagLabels = &heroTagSprite;
172                 battleRes.levelLabelCol = 0;
173                 battleRes.levelLabelRow = 0;
174                 battleRes.healthLabelCol = 0;
175                 battleRes.healthLabelRow = 1;
176                 battleRes.manaLabelCol = 0;
177                 battleRes.manaLabelRow = 2;
178                 battleRes.moveLabelCol = 0;
179                 battleRes.moveLabelRow = 3;
180                 battleRes.ikariLabelCol = 0;
181                 battleRes.ikariLabelRow = 4;
182
183                 SDL_Surface *numbersImg(IMG_Load("test-data/numbers.png"));
184                 Sprite numbersSprite(numbersImg, 16, 16);
185                 Font heroTagFont(&numbersSprite, 0, -3);
186                 battleRes.heroTagFont = &heroTagFont;
187                 SDL_Surface *tagFramesImg(IMG_Load("test-data/tag-frames.png"));
188                 Frame heroTagFrame(tagFramesImg, 16, 16, 1, 1, 0, 33);
189                 battleRes.heroTagFrame = &heroTagFrame;
190                 Frame activeHeroTagFrame(tagFramesImg, 16, 16);
191                 battleRes.activeHeroTagFrame = &activeHeroTagFrame;
192                 SDL_Surface *smallTagFrameImg(IMG_Load("test-data/small-tag-frame.png"));
193                 Frame smallTagFrame(smallTagFrameImg, 8, 16);
194                 battleRes.smallHeroTagFrame = &smallTagFrame;
195                 Frame lastSmallTagFrame(smallTagFrameImg, 8, 16, 1, 1, 0, 33);
196                 battleRes.lastSmallHeroTagFrame = &lastSmallTagFrame;
197                 battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31);
198
199                 SDL_Surface *gauges(IMG_Load("test-data/gauges.png"));
200                 Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6);
201                 battleRes.healthGauge = &healthGauge;
202                 Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
203                 battleRes.manaGauge = &manaGauge;
204                 Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
205                 battleRes.ikariGauge = &ikariGauge;
206
207                 SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png"));
208                 Frame selectFrame(selectFrameImg, 16, 16);
209                 battleRes.selectFrame = &selectFrame;
210
211                 SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png"));
212                 Sprite normalFontSprite(normalFontImg, 16, 16);
213                 Font normalFont(&normalFontSprite, 0, -2);
214                 battleRes.normalFont = &normalFont;
215
216                 SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png"));
217                 Sprite disabledFontSprite(disabledFontImg, 16, 16);
218                 Font disabledFont(&disabledFontSprite, 0, -2);
219                 battleRes.disabledFont = &disabledFont;
220
221                 SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png"));
222                 Sprite handCursorSprite(handCursorImg, 32, 32);
223                 battleRes.menuCursor = &handCursorSprite;
224
225                 SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png"));
226                 Sprite weaponTargetCursor(targetingIconsImg, 32, 32);
227                 Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
228                 Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
229                 battleRes.weaponTargetCursor = &weaponTargetCursor;
230                 // TODO: add image for magic targeting cursor
231                 battleRes.magicTargetCursor = &magicTargetCursor;
232                 // TODO: add image for item targeting cursor
233                 battleRes.itemTargetCursor = &itemTargetCursor;
234
235                 Spell resetSpell;
236                 resetSpell.SetName("Reset");
237                 maxim.AddSpell(&resetSpell);
238                 Spell strongSpell;
239                 strongSpell.SetName("Strong");
240                 strongSpell.SetCost(3);
241                 strongSpell.SetUsableInBattle();
242                 strongSpell.GetTargetingMode().TargetMultipleAllies();
243                 maxim.AddSpell(&strongSpell);
244                 selan.AddSpell(&strongSpell);
245                 Spell strongerSpell;
246                 strongerSpell.SetName("Stronger");
247                 strongerSpell.SetCost(8);
248                 strongerSpell.SetUsableInBattle();
249                 strongerSpell.GetTargetingMode().TargetMultipleAllies();
250                 maxim.AddSpell(&strongerSpell);
251                 selan.AddSpell(&strongerSpell);
252                 Spell championSpell;
253                 championSpell.SetName("Champion");
254                 championSpell.SetCost(16);
255                 championSpell.SetUsableInBattle();
256                 championSpell.GetTargetingMode().TargetMultipleAllies();
257                 maxim.AddSpell(&championSpell);
258                 selan.AddSpell(&championSpell);
259                 Spell rallySpell;
260                 rallySpell.SetName("Rally");
261                 rallySpell.SetCost(10);
262                 rallySpell.SetUsableInBattle();
263                 rallySpell.GetTargetingMode().TargetMultipleAllies();
264                 maxim.AddSpell(&rallySpell);
265                 selan.AddSpell(&rallySpell);
266                 Spell escapeSpell;
267                 escapeSpell.SetName("Escape");
268                 escapeSpell.SetCost(8);
269                 selan.AddSpell(&escapeSpell);
270                 Spell valorSpell;
271                 valorSpell.SetName("Valor");
272                 valorSpell.SetCost(30);
273                 valorSpell.SetUsableInBattle();
274                 valorSpell.GetTargetingMode().TargetMultipleAllies();
275                 maxim.AddSpell(&valorSpell);
276                 selan.AddSpell(&valorSpell);
277
278                 battleRes.spellMenuHeadline = "Please choose a spell.";
279                 battleRes.spellMenuPrototype = Menu<const Spell *>(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':');
280
281                 SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png"));
282                 Sprite potionIcon(itemIcons, 16, 16);
283                 Sprite ballIcon(itemIcons, 16, 16, 0, 16);
284                 Sprite crankIcon(itemIcons, 16, 16, 0, 32);
285                 Sprite spearIcon(itemIcons, 16, 16, 0, 48);
286                 Sprite swordIcon(itemIcons, 16, 16, 0, 64);
287                 Sprite axIcon(itemIcons, 16, 16, 0, 80);
288                 Sprite rodIcon(itemIcons, 16, 16, 0, 96);
289                 Sprite armorIcon(itemIcons, 16, 16, 0, 112);
290                 Sprite shieldIcon(itemIcons, 16, 16, 0, 128);
291                 Sprite helmetIcon(itemIcons, 16, 16, 0, 144);
292                 Sprite ringIcon(itemIcons, 16, 16, 0, 160);
293                 Sprite jewelIcon(itemIcons, 16, 16, 0, 176);
294
295                 battleRes.weaponMenuIcon = &swordIcon;
296                 battleRes.armorMenuIcon = &armorIcon;
297                 battleRes.shieldMenuIcon = &shieldIcon;
298                 battleRes.helmetMenuIcon = &helmetIcon;
299                 battleRes.ringMenuIcon = &ringIcon;
300                 battleRes.jewelMenuIcon = &jewelIcon;
301
302                 Inventory inventory;
303                 Item antidote;
304                 antidote.SetName("Antidote");
305                 antidote.SetMenuIcon(&potionIcon);
306                 antidote.SetUsableInBattle();
307                 antidote.GetTargetingMode().TargetSingleAlly();
308                 inventory.Add(&antidote, 9);
309                 Item magicJar;
310                 magicJar.SetName("Magic jar");
311                 magicJar.SetMenuIcon(&potionIcon);
312                 magicJar.SetUsableInBattle();
313                 magicJar.GetTargetingMode().TargetSingleAlly();
314                 inventory.Add(&magicJar, 4);
315                 Item hiPotion;
316                 hiPotion.SetName("Hi-Potion");
317                 hiPotion.SetMenuIcon(&potionIcon);
318                 hiPotion.SetUsableInBattle();
319                 hiPotion.GetTargetingMode().TargetSingleAlly();
320                 inventory.Add(&hiPotion, 4);
321                 Item powerPotion;
322                 powerPotion.SetName("Power potion");
323                 powerPotion.SetMenuIcon(&potionIcon);
324                 inventory.Add(&powerPotion, 4);
325                 Item escape;
326                 escape.SetName("Escape");
327                 inventory.Add(&escape, 2);
328                 Item sleepBall;
329                 sleepBall.SetName("Sleep ball");
330                 sleepBall.SetMenuIcon(&ballIcon);
331                 sleepBall.SetUsableInBattle();
332                 sleepBall.GetTargetingMode().TargetSingleEnemy();
333                 inventory.Add(&sleepBall, 1);
334                 Item multiBall;
335                 multiBall.SetName("Multi-ball!");
336                 multiBall.SetMenuIcon(&ballIcon);
337                 multiBall.SetUsableInBattle();
338                 multiBall.GetTargetingMode().TargetMultipleEnemies();
339                 inventory.Add(&multiBall, 1);
340                 Item figgoru;
341                 figgoru.SetName("Figgoru");
342                 figgoru.SetMenuIcon(&crankIcon);
343                 figgoru.GetTargetingMode().TargetAllEnemies();
344                 inventory.Add(&figgoru, 1);
345                 battleRes.inventory = &inventory;
346
347                 battleRes.itemMenuHeadline = "Please choose an item.";
348                 battleRes.itemMenuPrototype = Menu<const common::Item *>(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':');
349
350                 Item zircoSword;
351                 zircoSword.SetName("Zirco sword");
352                 zircoSword.SetMenuIcon(&swordIcon);
353                 Ikari firestorm;
354                 firestorm.SetName("Firestorm");
355                 firestorm.SetCost(224);
356                 firestorm.GetTargetingMode().TargetAllEnemies();
357                 firestorm.SetPhysical();
358                 zircoSword.SetIkari(&firestorm);
359                 maxim.SetWeapon(&zircoSword);
360                 Item zirconArmor;
361                 zirconArmor.SetName("Zircon armor");
362                 zirconArmor.SetMenuIcon(&armorIcon);
363                 Ikari magicCure;
364                 magicCure.SetName("Magic cure");
365                 magicCure.SetCost(128);
366                 magicCure.GetTargetingMode().TargetSingleAlly();
367                 magicCure.SetMagical();
368                 zirconArmor.SetIkari(&magicCure);
369                 maxim.SetArmor(&zirconArmor);
370                 Item holyShield;
371                 holyShield.SetName("Holy shield");
372                 holyShield.SetMenuIcon(&shieldIcon);
373                 Ikari lightGuard;
374                 lightGuard.SetName("Light guard");
375                 lightGuard.SetCost(128);
376                 lightGuard.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
377                 lightGuard.SetMagical();
378                 holyShield.SetIkari(&lightGuard);
379                 maxim.SetShield(&holyShield);
380                 Item legendHelm;
381                 legendHelm.SetName("Legend helm");
382                 legendHelm.SetMenuIcon(&helmetIcon);
383                 Ikari boomerang;
384                 boomerang.SetName("Boomerang");
385                 boomerang.SetCost(164);
386                 boomerang.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
387                 boomerang.SetMagical();
388                 legendHelm.SetIkari(&boomerang);
389                 maxim.SetHelmet(&legendHelm);
390                 Item sProRing;
391                 sProRing.SetName("S-pro ring");
392                 sProRing.SetMenuIcon(&ringIcon);
393                 Ikari courage;
394                 courage.SetName("Courage");
395                 courage.SetCost(64);
396                 courage.GetTargetingMode().TargetMultipleAllies();
397                 courage.SetMagical();
398                 sProRing.SetIkari(&courage);
399                 maxim.SetRing(&sProRing);
400                 Item evilJewel;
401                 evilJewel.SetName("Evil jewel");
402                 evilJewel.SetMenuIcon(&jewelIcon);
403                 Ikari gloomy;
404                 gloomy.SetName("Gloomy");
405                 gloomy.SetCost(164);
406                 gloomy.GetTargetingMode().TargetAllEnemies();
407                 gloomy.SetMagical();
408                 evilJewel.SetIkari(&gloomy);
409                 maxim.SetJewel(&evilJewel);
410
411                 Item zircoWhip;
412                 zircoWhip.SetName("Zirco whip");
413                 zircoWhip.SetMenuIcon(&rodIcon);
414                 Ikari thundershriek;
415                 thundershriek.SetName("Thundershriek");
416                 thundershriek.SetCost(224);
417                 thundershriek.GetTargetingMode().TargetAllEnemies();
418                 thundershriek.SetPhysical();
419                 zircoWhip.SetIkari(&thundershriek);
420                 selan.SetWeapon(&zircoWhip);
421                 Item zirconPlate;
422                 zirconPlate.SetName("Zircon plate");
423                 zirconPlate.SetMenuIcon(&armorIcon);
424                 Ikari suddenCure;
425                 suddenCure.SetName("Sudden cure");
426                 suddenCure.SetCost(96);
427                 suddenCure.GetTargetingMode().TargetAllAllies();
428                 suddenCure.SetMagical();
429                 zirconPlate.SetIkari(&suddenCure);
430                 selan.SetArmor(&zirconPlate);
431                 Item zircoGloves;
432                 zircoGloves.SetName("Zirco gloves");
433                 zircoGloves.SetMenuIcon(&shieldIcon);
434                 Ikari forcefield;
435                 forcefield.SetName("Forcefield");
436                 forcefield.SetCost(64);
437                 forcefield.GetTargetingMode().TargetAllAllies();
438                 forcefield.SetMagical();
439                 zircoGloves.SetIkari(&forcefield);
440                 selan.SetShield(&zircoGloves);
441                 Item holyCap;
442                 holyCap.SetName("Holy cap");
443                 holyCap.SetMenuIcon(&helmetIcon);
444                 Ikari vulnerable;
445                 vulnerable.SetName("Vulnerable");
446                 vulnerable.SetCost(196);
447                 vulnerable.GetTargetingMode().TargetAllEnemies();
448                 vulnerable.SetPhysical();
449                 holyCap.SetIkari(&vulnerable);
450                 selan.SetHelmet(&holyCap);
451                 Item ghostRing;
452                 ghostRing.SetName("Ghost ring");
453                 ghostRing.SetMenuIcon(&ringIcon);
454                 Ikari destroy;
455                 destroy.SetName("Destroy");
456                 destroy.SetCost(128);
457                 destroy.GetTargetingMode().TargetMultipleEnemies();
458                 destroy.SetMagical();
459                 ghostRing.SetIkari(&destroy);
460                 selan.SetRing(&ghostRing);
461                 Item eagleRock;
462                 eagleRock.SetName("Eagle rock");
463                 eagleRock.SetMenuIcon(&jewelIcon);
464                 Ikari dive;
465                 dive.SetName("Dive");
466                 dive.SetCost(128);
467                 dive.GetTargetingMode().TargetSingleEnemy();
468                 dive.SetPhysical();
469                 eagleRock.SetIkari(&dive);
470                 selan.SetJewel(&eagleRock);
471
472                 Item zircoAx;
473                 zircoAx.SetName("Zirco ax");
474                 zircoAx.SetMenuIcon(&axIcon);
475                 Ikari torrent;
476                 torrent.SetName("Torrent");
477                 torrent.SetCost(224);
478                 torrent.GetTargetingMode().TargetAllEnemies();
479                 torrent.SetPhysical();
480                 zircoAx.SetIkari(&torrent);
481                 guy.SetWeapon(&zircoAx);
482                 guy.SetArmor(&zirconArmor);
483                 Item megaShield;
484                 megaShield.SetName("Mega shield");
485                 megaShield.SetMenuIcon(&shieldIcon);
486                 Ikari ironBarrier;
487                 ironBarrier.SetName("Iron barrier");
488                 ironBarrier.SetCost(255);
489                 ironBarrier.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
490                 ironBarrier.SetMagical();
491                 megaShield.SetIkari(&ironBarrier);
492                 guy.SetShield(&megaShield);
493                 Item zircoHelmet;
494                 zircoHelmet.SetName("Zirco helmet");
495                 zircoHelmet.SetMenuIcon(&helmetIcon);
496                 Ikari slow;
497                 slow.SetName("Slow");
498                 slow.SetCost(196);
499                 slow.GetTargetingMode().TargetAllEnemies();
500                 slow.SetPhysical();
501                 zircoHelmet.SetIkari(&slow);
502                 guy.SetHelmet(&zircoHelmet);
503                 Item powerRing;
504                 powerRing.SetName("Power ring");
505                 powerRing.SetMenuIcon(&ringIcon);
506                 Ikari trick;
507                 trick.SetName("Trick");
508                 trick.SetCost(32);
509                 trick.GetTargetingMode().TargetAllEnemies();
510                 trick.SetMagical();
511                 zircoHelmet.SetIkari(&trick);
512                 guy.SetRing(&powerRing);
513                 guy.SetJewel(&evilJewel);
514
515                 // NOTE: this is actually Artea equipment
516                 Item lizardBlow;
517                 lizardBlow.SetName("Lizard blow");
518                 lizardBlow.SetMenuIcon(&swordIcon);
519                 Ikari dragonRush;
520                 dragonRush.SetName("Dragon rush");
521                 dragonRush.SetCost(164);
522                 dragonRush.GetTargetingMode().TargetSingleEnemy();
523                 dragonRush.SetPhysical();
524                 lizardBlow.SetIkari(&dragonRush);
525                 dekar.SetWeapon(&lizardBlow);
526                 Item holyRobe;
527                 holyRobe.SetName("Holy robe");
528                 holyRobe.SetMenuIcon(&armorIcon);
529                 Ikari crisisCure;
530                 crisisCure.SetName("Crisis cure");
531                 crisisCure.SetCost(164);
532                 crisisCure.GetTargetingMode().TargetAllAllies();
533                 crisisCure.SetMagical();
534                 holyRobe.SetIkari(&crisisCure);
535                 dekar.SetArmor(&holyRobe);
536                 dekar.SetShield(&zircoGloves);
537                 dekar.SetHelmet(&holyCap);
538                 Item rocketRing;
539                 rocketRing.SetName("Rocket ring");
540                 rocketRing.SetMenuIcon(&ringIcon);
541                 Ikari fake;
542                 fake.SetName("Fake");
543                 fake.SetCost(32);
544                 fake.GetTargetingMode().TargetSingleAlly();
545                 fake.SetMagical();
546                 rocketRing.SetIkari(&fake);
547                 dekar.SetRing(&rocketRing);
548                 Item krakenRock;
549                 krakenRock.SetName("Kraken rock");
550                 krakenRock.SetMenuIcon(&jewelIcon);
551                 Ikari tenLegger;
552                 tenLegger.SetName("Ten-legger");
553                 tenLegger.SetCost(164);
554                 tenLegger.GetTargetingMode().TargetAllEnemies();
555                 tenLegger.SetPhysical();
556                 rocketRing.SetIkari(&tenLegger);
557                 dekar.SetJewel(&krakenRock);
558
559                 battleRes.ikariMenuHeadline = "Please choose equipment.";
560                 battleRes.noEquipmentText = "No equip";
561                 battleRes.ikariMenuPrototype = Menu<const Item *>(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth());
562
563                 battleRes.escapeText = "Escapes.";
564
565                 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));
566                 battleState->AddMonster(monster);
567                 battleState->AddMonster(monster);
568                 battleState->AddMonster(monster);
569                 battleState->AddMonster(monster);
570                 battleState->AddHero(maxim);
571                 battleState->AddHero(selan);
572                 battleState->AddHero(guy);
573                 battleState->AddHero(dekar);
574                 Application app(&screen, battleState);
575                 app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
576                 app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
577                 app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
578                 app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
579                 app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
580                 app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
581                 app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
582                 app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
583                 app.Buttons().MapKey(SDLK_RETURN, Input::START);
584                 app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
585                 app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
586                 app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
587                 app.Run();
588
589                 return 0;
590         } catch (exception &e) {
591                 cerr << "exception in main(): " << e.what() << endl;
592                 return 1;
593         }
594 }