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