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