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