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