4 * Created on: Aug 1, 2012
8 #include "app/Application.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 "geometry/Vector.h"
21 #include "graphics/ComplexAnimation.h"
22 #include "graphics/Font.h"
23 #include "graphics/Frame.h"
24 #include "graphics/Gauge.h"
25 #include "graphics/Menu.h"
26 #include "graphics/SimpleAnimation.h"
27 #include "graphics/Sprite.h"
28 #include "sdl/InitImage.h"
29 #include "sdl/InitScreen.h"
30 #include "sdl/InitSDL.h"
35 #include <SDL_image.h>
37 using app::Application;
39 using battle::BattleState;
41 using battle::Monster;
42 using battle::PartyLayout;
44 using common::Inventory;
47 using geometry::Point;
48 using geometry::Vector;
49 using graphics::ComplexAnimation;
51 using graphics::Frame;
52 using graphics::Gauge;
54 using graphics::SimpleAnimation;
55 using graphics::Sprite;
57 using sdl::InitScreen;
65 int main(int argc, char **argv) {
66 const int width = 800;
67 const int height = 480;
71 InitImage image(IMG_INIT_PNG);
72 InitScreen screen(width, height);
74 // temporary test data
75 SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
76 PartyLayout monstersLayout;
77 monstersLayout.AddPosition(Point<Uint8>(88, 104));
78 monstersLayout.AddPosition(Point<Uint8>(128, 104));
79 monstersLayout.AddPosition(Point<Uint8>(168, 104));
80 monstersLayout.AddPosition(Point<Uint8>(208, 104));
81 PartyLayout heroesLayout;
82 heroesLayout.AddPosition(Point<Uint8>(48, 152));
83 heroesLayout.AddPosition(Point<Uint8>(128, 152));
84 heroesLayout.AddPosition(Point<Uint8>(80, 168));
85 heroesLayout.AddPosition(Point<Uint8>(160, 168));
87 SDL_Surface *monsterImg(IMG_Load("test-data/monster.png"));
88 Sprite dummySprite(monsterImg, 64, 64);
90 monster.SetName("Monster");
91 monster.SetSprite(&dummySprite);
92 monster.SetMaxHealth(10);
93 monster.SetHealth(10);
95 SDL_Surface *maximImg(IMG_Load("test-data/maxim.png"));
96 Sprite maximSprite(maximImg, 64, 64);
98 maxim.SetName("Maxim");
100 maxim.SetSprite(&maximSprite);
101 maxim.SetMaxHealth(33);
103 maxim.SetMaxMana(20);
106 ComplexAnimation maximAttackAnimation(&maximSprite, 30);
107 maximAttackAnimation.AddFrame(1, 0, Vector<int>(2, 0));
108 maximAttackAnimation.AddFrame(1, 0, Vector<int>(2, -1));
109 maximAttackAnimation.AddFrames(2, 0, Vector<int>(2, -2), 2);
110 maximAttackAnimation.AddFrame(2, 0, Vector<int>(4, -2));
111 maximAttackAnimation.AddFrame(2, 0, Vector<int>(3, -1));
112 maximAttackAnimation.AddFrames(2, 1, Vector<int>(3, -1), 2);
113 maximAttackAnimation.AddFrame(2, 1);
114 maximAttackAnimation.AddFrames(2, 2, Vector<int>(), 2);
115 maxim.SetAttackAnimation(&maximAttackAnimation);
116 ComplexAnimation maximSpellAnimation(&maximSprite, 150);
117 maximSpellAnimation.AddFrames(3, 0, Vector<int>(), 2);
118 maximSpellAnimation.AddFrame(3, 1);
119 maxim.SetSpellAnimation(&maximSpellAnimation);
120 SDL_Surface *maximMeleeImg(IMG_Load("test-data/melee-maxim.png"));
121 Sprite maximMeleeSprite(maximMeleeImg, 96, 96);
122 SimpleAnimation maximMeleeAnimation(&maximMeleeSprite, 30, 4);
123 maxim.SetMeleeAnimation(&maximMeleeAnimation);
125 SDL_Surface *selanImg(IMG_Load("test-data/selan.png"));
126 Sprite selanSprite(selanImg, 64, 64);
128 selan.SetName("Selan");
130 selan.SetSprite(&selanSprite);
131 selan.SetMaxHealth(28);
133 selan.SetMaxMana(23);
136 ComplexAnimation selanAttackAnimation(&selanSprite, 30);
137 selanAttackAnimation.AddFrames(1, 0, Vector<int>(4, 0), 2);
138 selanAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
139 selanAttackAnimation.AddFrame(2, 0, Vector<int>(10, 4));
140 selanAttackAnimation.AddFrame(2, 0, Vector<int>(14, 4));
141 selanAttackAnimation.AddFrames(2, 0, Vector<int>(12, 2), 3);
142 selanAttackAnimation.AddFrames(2, 1, Vector<int>(14, 2), 2);
143 selanAttackAnimation.AddFrame(2, 1, Vector<int>(2, 0));
144 selanAttackAnimation.AddFrame(2, 2, Vector<int>(-2, -4));
145 selanAttackAnimation.AddFrame(2, 2, Vector<int>(-8, -8));
146 selanAttackAnimation.AddFrame(2, 2);
147 selan.SetAttackAnimation(&selanAttackAnimation);
148 ComplexAnimation selanSpellAnimation(&selanSprite, 30);
149 selanSpellAnimation.AddFrames(2, 0, Vector<int>(), 3);
150 selanSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
151 selanSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
152 selanSpellAnimation.AddFrames(2, 3, Vector<int>(), 2);
153 selan.SetSpellAnimation(&selanSpellAnimation);
155 SDL_Surface *guyImg(IMG_Load("test-data/guy.png"));
156 Sprite guySprite(guyImg, 64, 64);
160 guy.SetSprite(&guySprite);
161 guy.SetMaxHealth(38);
166 ComplexAnimation guyAttackAnimation(&guySprite, 30);
167 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-4, 0), 2);
168 guyAttackAnimation.AddFrames(1, 0, Vector<int>(-8, 0), 2);
169 guyAttackAnimation.AddFrames(2, 0, Vector<int>(-8, 0), 2);
170 guyAttackAnimation.AddFrame(2, 0, Vector<int>(-4, 0));
171 guyAttackAnimation.AddFrames(2, 0, Vector<int>(), 2);
172 guyAttackAnimation.AddFrame(2, 1);
173 guyAttackAnimation.AddFrame(2, 1, Vector<int>(4, 0));
174 guyAttackAnimation.AddFrame(2, 1, Vector<int>(10, 0));
175 guyAttackAnimation.AddFrame(2, 2, Vector<int>(10, 0));
176 guyAttackAnimation.AddFrame(2, 2);
177 guy.SetAttackAnimation(&guyAttackAnimation);
179 SDL_Surface *dekarImg(IMG_Load("test-data/dekar.png"));
180 Sprite dekarSprite(dekarImg, 64, 64);
182 dekar.SetName("Dekar");
184 dekar.SetSprite(&dekarSprite);
185 dekar.SetMaxHealth(38);
190 ComplexAnimation dekarAttackAnimation(&dekarSprite, 30);
191 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(4, 0));
192 dekarAttackAnimation.AddFrame(1, 0, Vector<int>(8, 2));
193 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(12, 4));
194 dekarAttackAnimation.AddFrame(2, 0, Vector<int>(16, 4));
195 dekarAttackAnimation.AddFrames(2, 0, Vector<int>(10, 2), 4);
196 dekarAttackAnimation.AddFrame(2, 1, Vector<int>(6, 2));
197 dekarAttackAnimation.AddFrame(2, 1, Vector<int>());
198 dekarAttackAnimation.AddFrame(2, 2, Vector<int>(-2, 0));
199 dekarAttackAnimation.AddFrames(2, 2, Vector<int>(0, 0), 3);
200 dekar.SetAttackAnimation(&dekarAttackAnimation);
201 ComplexAnimation dekarSpellAnimation(&dekarSprite, 30);
202 dekarSpellAnimation.AddFrames(2, 0, Vector<int>(), 6);
203 dekarSpellAnimation.AddFrames(2, 1, Vector<int>(), 2);
204 dekarSpellAnimation.AddFrames(2, 2, Vector<int>(), 3);
205 dekar.SetSpellAnimation(&dekarSpellAnimation);
207 battle::Resources battleRes;
209 SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png"));
210 Sprite swapCursorSprite(swapCursorImg, 32, 32);
211 battleRes.swapCursor = &swapCursorSprite;
212 SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
213 Sprite attackIconsSprite(attackIconsImg, 32, 32);
214 battleRes.attackIcons = &attackIconsSprite;
215 SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
216 Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
217 battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
218 SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
219 Sprite moveIconsSprite(moveIconsImg, 32, 32);
220 battleRes.moveIcons = &moveIconsSprite;
222 SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png"));
223 Frame titleFrame(titleFrameImg, 16, 16);
224 battleRes.titleFrame = &titleFrame;
226 SDL_Surface *largeFontImg(IMG_Load("test-data/large-font.png"));
227 Sprite largeFontSprite(largeFontImg, 16, 32);
228 Font largeFont(&largeFontSprite, 0, -2);
229 battleRes.titleFont = &largeFont;
231 battleRes.numberAnimationPrototype = ComplexAnimation(0, 30);
232 battleRes.numberAnimationPrototype.AddFrame(0, 0);
233 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
234 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
235 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -48));
236 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
237 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
238 battleRes.numberAnimationPrototype.AddFrame(0, 0);
239 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
240 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
241 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -24));
242 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
243 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
244 battleRes.numberAnimationPrototype.AddFrame(0, 0);
245 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
246 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
247 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
248 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
249 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
250 battleRes.numberAnimationPrototype.AddFrames(0, 0, Vector<int>(), 14);
251 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -36));
252 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -32));
253 battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -18));
255 SDL_Surface *bigNumbersImg(IMG_Load("test-data/big-numbers.png"));
256 Sprite bigNumbersSprite(bigNumbersImg, 16, 32);
257 battleRes.bigNumberSprite = &bigNumbersSprite;
258 SDL_Surface *bigGreenNumbersImg(IMG_Load("test-data/big-green-numbers.png"));
259 Sprite bigGreenNumbersSprite(bigGreenNumbersImg, 16, 32);
260 battleRes.greenNumberSprite = &bigGreenNumbersSprite;
262 SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png"));
263 Sprite heroTagSprite(heroTagImg, 32, 16);
264 battleRes.heroTagLabels = &heroTagSprite;
265 battleRes.levelLabelCol = 0;
266 battleRes.levelLabelRow = 0;
267 battleRes.healthLabelCol = 0;
268 battleRes.healthLabelRow = 1;
269 battleRes.manaLabelCol = 0;
270 battleRes.manaLabelRow = 2;
271 battleRes.moveLabelCol = 0;
272 battleRes.moveLabelRow = 3;
273 battleRes.ikariLabelCol = 0;
274 battleRes.ikariLabelRow = 4;
276 SDL_Surface *numbersImg(IMG_Load("test-data/numbers.png"));
277 Sprite numbersSprite(numbersImg, 16, 16);
278 Font heroTagFont(&numbersSprite, 0, -3);
279 battleRes.heroTagFont = &heroTagFont;
280 SDL_Surface *tagFramesImg(IMG_Load("test-data/tag-frames.png"));
281 Frame heroTagFrame(tagFramesImg, 16, 16, 1, 1, 0, 33);
282 battleRes.heroTagFrame = &heroTagFrame;
283 Frame activeHeroTagFrame(tagFramesImg, 16, 16);
284 battleRes.activeHeroTagFrame = &activeHeroTagFrame;
285 SDL_Surface *smallTagFrameImg(IMG_Load("test-data/small-tag-frame.png"));
286 Frame smallTagFrame(smallTagFrameImg, 8, 16);
287 battleRes.smallHeroTagFrame = &smallTagFrame;
288 Frame lastSmallTagFrame(smallTagFrameImg, 8, 16, 1, 1, 0, 33);
289 battleRes.lastSmallHeroTagFrame = &lastSmallTagFrame;
290 battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31);
292 SDL_Surface *gauges(IMG_Load("test-data/gauges.png"));
293 Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6);
294 battleRes.healthGauge = &healthGauge;
295 Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
296 battleRes.manaGauge = &manaGauge;
297 Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
298 battleRes.ikariGauge = &ikariGauge;
300 SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png"));
301 Frame selectFrame(selectFrameImg, 16, 16);
302 battleRes.selectFrame = &selectFrame;
304 SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png"));
305 Sprite normalFontSprite(normalFontImg, 16, 16);
306 Font normalFont(&normalFontSprite, 0, -2);
307 battleRes.normalFont = &normalFont;
309 SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png"));
310 Sprite disabledFontSprite(disabledFontImg, 16, 16);
311 Font disabledFont(&disabledFontSprite, 0, -2);
312 battleRes.disabledFont = &disabledFont;
314 SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png"));
315 Sprite handCursorSprite(handCursorImg, 32, 32);
316 battleRes.menuCursor = &handCursorSprite;
318 SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png"));
319 Sprite weaponTargetCursor(targetingIconsImg, 32, 32);
320 Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
321 Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
322 battleRes.weaponTargetCursor = &weaponTargetCursor;
323 // TODO: add image for magic targeting cursor
324 battleRes.magicTargetCursor = &magicTargetCursor;
325 // TODO: add image for item targeting cursor
326 battleRes.itemTargetCursor = &itemTargetCursor;
329 resetSpell.SetName("Reset");
330 maxim.AddSpell(&resetSpell);
332 strongSpell.SetName("Strong");
333 strongSpell.SetCost(3);
334 strongSpell.SetUsableInBattle();
335 strongSpell.GetTargetingMode().TargetMultipleAllies();
336 maxim.AddSpell(&strongSpell);
337 selan.AddSpell(&strongSpell);
339 strongerSpell.SetName("Stronger");
340 strongerSpell.SetCost(8);
341 strongerSpell.SetUsableInBattle();
342 strongerSpell.GetTargetingMode().TargetMultipleAllies();
343 maxim.AddSpell(&strongerSpell);
344 selan.AddSpell(&strongerSpell);
346 championSpell.SetName("Champion");
347 championSpell.SetCost(16);
348 championSpell.SetUsableInBattle();
349 championSpell.GetTargetingMode().TargetMultipleAllies();
350 maxim.AddSpell(&championSpell);
351 selan.AddSpell(&championSpell);
353 rallySpell.SetName("Rally");
354 rallySpell.SetCost(10);
355 rallySpell.SetUsableInBattle();
356 rallySpell.GetTargetingMode().TargetMultipleAllies();
357 maxim.AddSpell(&rallySpell);
358 selan.AddSpell(&rallySpell);
360 escapeSpell.SetName("Escape");
361 escapeSpell.SetCost(8);
362 selan.AddSpell(&escapeSpell);
364 valorSpell.SetName("Valor");
365 valorSpell.SetCost(30);
366 valorSpell.SetUsableInBattle();
367 valorSpell.GetTargetingMode().TargetMultipleAllies();
368 maxim.AddSpell(&valorSpell);
369 selan.AddSpell(&valorSpell);
371 battleRes.spellMenuHeadline = "Please choose a spell.";
372 battleRes.spellMenuPrototype = Menu<const Spell *>(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':');
374 SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png"));
375 Sprite potionIcon(itemIcons, 16, 16);
376 Sprite ballIcon(itemIcons, 16, 16, 0, 16);
377 Sprite crankIcon(itemIcons, 16, 16, 0, 32);
378 Sprite spearIcon(itemIcons, 16, 16, 0, 48);
379 Sprite swordIcon(itemIcons, 16, 16, 0, 64);
380 Sprite axIcon(itemIcons, 16, 16, 0, 80);
381 Sprite rodIcon(itemIcons, 16, 16, 0, 96);
382 Sprite armorIcon(itemIcons, 16, 16, 0, 112);
383 Sprite shieldIcon(itemIcons, 16, 16, 0, 128);
384 Sprite helmetIcon(itemIcons, 16, 16, 0, 144);
385 Sprite ringIcon(itemIcons, 16, 16, 0, 160);
386 Sprite jewelIcon(itemIcons, 16, 16, 0, 176);
388 battleRes.weaponMenuIcon = &swordIcon;
389 battleRes.armorMenuIcon = &armorIcon;
390 battleRes.shieldMenuIcon = &shieldIcon;
391 battleRes.helmetMenuIcon = &helmetIcon;
392 battleRes.ringMenuIcon = &ringIcon;
393 battleRes.jewelMenuIcon = &jewelIcon;
397 antidote.SetName("Antidote");
398 antidote.SetMenuIcon(&potionIcon);
399 antidote.SetUsableInBattle();
400 antidote.GetTargetingMode().TargetSingleAlly();
401 inventory.Add(&antidote, 9);
403 magicJar.SetName("Magic jar");
404 magicJar.SetMenuIcon(&potionIcon);
405 magicJar.SetUsableInBattle();
406 magicJar.GetTargetingMode().TargetSingleAlly();
407 inventory.Add(&magicJar, 4);
409 hiPotion.SetName("Hi-Potion");
410 hiPotion.SetMenuIcon(&potionIcon);
411 hiPotion.SetUsableInBattle();
412 hiPotion.GetTargetingMode().TargetSingleAlly();
413 inventory.Add(&hiPotion, 4);
415 powerPotion.SetName("Power potion");
416 powerPotion.SetMenuIcon(&potionIcon);
417 inventory.Add(&powerPotion, 4);
419 escape.SetName("Escape");
420 inventory.Add(&escape, 2);
422 sleepBall.SetName("Sleep ball");
423 sleepBall.SetMenuIcon(&ballIcon);
424 sleepBall.SetUsableInBattle();
425 sleepBall.GetTargetingMode().TargetSingleEnemy();
426 inventory.Add(&sleepBall, 1);
428 multiBall.SetName("Multi-ball!");
429 multiBall.SetMenuIcon(&ballIcon);
430 multiBall.SetUsableInBattle();
431 multiBall.GetTargetingMode().TargetMultipleEnemies();
432 inventory.Add(&multiBall, 1);
434 figgoru.SetName("Figgoru");
435 figgoru.SetMenuIcon(&crankIcon);
436 figgoru.GetTargetingMode().TargetAllEnemies();
437 inventory.Add(&figgoru, 1);
438 battleRes.inventory = &inventory;
440 battleRes.itemMenuHeadline = "Please choose an item.";
441 battleRes.itemMenuPrototype = Menu<const common::Item *>(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':');
444 zircoSword.SetName("Zirco sword");
445 zircoSword.SetMenuIcon(&swordIcon);
447 firestorm.SetName("Firestorm");
448 firestorm.SetCost(224);
449 firestorm.GetTargetingMode().TargetAllEnemies();
450 firestorm.SetPhysical();
451 zircoSword.SetIkari(&firestorm);
452 // maxim.SetWeapon(&zircoSword);
454 zirconArmor.SetName("Zircon armor");
455 zirconArmor.SetMenuIcon(&armorIcon);
457 magicCure.SetName("Magic cure");
458 magicCure.SetCost(128);
459 magicCure.GetTargetingMode().TargetSingleAlly();
460 magicCure.SetMagical();
461 zirconArmor.SetIkari(&magicCure);
462 maxim.SetArmor(&zirconArmor);
464 holyShield.SetName("Holy shield");
465 holyShield.SetMenuIcon(&shieldIcon);
467 lightGuard.SetName("Light guard");
468 lightGuard.SetCost(128);
469 lightGuard.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
470 lightGuard.SetMagical();
471 holyShield.SetIkari(&lightGuard);
472 maxim.SetShield(&holyShield);
474 legendHelm.SetName("Legend helm");
475 legendHelm.SetMenuIcon(&helmetIcon);
477 boomerang.SetName("Boomerang");
478 boomerang.SetCost(164);
479 boomerang.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
480 boomerang.SetMagical();
481 legendHelm.SetIkari(&boomerang);
482 maxim.SetHelmet(&legendHelm);
484 sProRing.SetName("S-pro ring");
485 sProRing.SetMenuIcon(&ringIcon);
487 courage.SetName("Courage");
489 courage.GetTargetingMode().TargetMultipleAllies();
490 courage.SetMagical();
491 sProRing.SetIkari(&courage);
492 maxim.SetRing(&sProRing);
494 evilJewel.SetName("Evil jewel");
495 evilJewel.SetMenuIcon(&jewelIcon);
497 gloomy.SetName("Gloomy");
499 gloomy.GetTargetingMode().TargetAllEnemies();
501 evilJewel.SetIkari(&gloomy);
502 maxim.SetJewel(&evilJewel);
505 zircoWhip.SetName("Zirco whip");
506 zircoWhip.SetMenuIcon(&rodIcon);
508 thundershriek.SetName("Thundershriek");
509 thundershriek.SetCost(224);
510 thundershriek.GetTargetingMode().TargetAllEnemies();
511 thundershriek.SetPhysical();
512 zircoWhip.SetIkari(&thundershriek);
513 selan.SetWeapon(&zircoWhip);
515 zirconPlate.SetName("Zircon plate");
516 zirconPlate.SetMenuIcon(&armorIcon);
518 suddenCure.SetName("Sudden cure");
519 suddenCure.SetCost(96);
520 suddenCure.GetTargetingMode().TargetAllAllies();
521 suddenCure.SetMagical();
522 zirconPlate.SetIkari(&suddenCure);
523 selan.SetArmor(&zirconPlate);
525 zircoGloves.SetName("Zirco gloves");
526 zircoGloves.SetMenuIcon(&shieldIcon);
528 forcefield.SetName("Forcefield");
529 forcefield.SetCost(64);
530 forcefield.GetTargetingMode().TargetAllAllies();
531 forcefield.SetMagical();
532 zircoGloves.SetIkari(&forcefield);
533 selan.SetShield(&zircoGloves);
535 holyCap.SetName("Holy cap");
536 holyCap.SetMenuIcon(&helmetIcon);
538 vulnerable.SetName("Vulnerable");
539 vulnerable.SetCost(196);
540 vulnerable.GetTargetingMode().TargetAllEnemies();
541 vulnerable.SetPhysical();
542 holyCap.SetIkari(&vulnerable);
543 selan.SetHelmet(&holyCap);
545 ghostRing.SetName("Ghost ring");
546 ghostRing.SetMenuIcon(&ringIcon);
548 destroy.SetName("Destroy");
549 destroy.SetCost(128);
550 destroy.GetTargetingMode().TargetMultipleEnemies();
551 destroy.SetMagical();
552 ghostRing.SetIkari(&destroy);
553 selan.SetRing(&ghostRing);
555 eagleRock.SetName("Eagle rock");
556 eagleRock.SetMenuIcon(&jewelIcon);
558 dive.SetName("Dive");
560 dive.GetTargetingMode().TargetSingleEnemy();
562 eagleRock.SetIkari(&dive);
563 selan.SetJewel(&eagleRock);
566 zircoAx.SetName("Zirco ax");
567 zircoAx.SetMenuIcon(&axIcon);
569 torrent.SetName("Torrent");
570 torrent.SetCost(224);
571 torrent.GetTargetingMode().TargetAllEnemies();
572 torrent.SetPhysical();
573 zircoAx.SetIkari(&torrent);
574 guy.SetWeapon(&zircoAx);
575 guy.SetArmor(&zirconArmor);
577 megaShield.SetName("Mega shield");
578 megaShield.SetMenuIcon(&shieldIcon);
580 ironBarrier.SetName("Iron barrier");
581 ironBarrier.SetCost(255);
582 ironBarrier.GetTargetingMode().TargetAllAllies(); // FIXME: actually only targets self
583 ironBarrier.SetMagical();
584 megaShield.SetIkari(&ironBarrier);
585 guy.SetShield(&megaShield);
587 zircoHelmet.SetName("Zirco helmet");
588 zircoHelmet.SetMenuIcon(&helmetIcon);
590 slow.SetName("Slow");
592 slow.GetTargetingMode().TargetAllEnemies();
594 zircoHelmet.SetIkari(&slow);
595 guy.SetHelmet(&zircoHelmet);
597 powerRing.SetName("Power ring");
598 powerRing.SetMenuIcon(&ringIcon);
600 trick.SetName("Trick");
602 trick.GetTargetingMode().TargetAllEnemies();
604 zircoHelmet.SetIkari(&trick);
605 guy.SetRing(&powerRing);
606 guy.SetJewel(&evilJewel);
608 // NOTE: this is actually Artea equipment
610 lizardBlow.SetName("Lizard blow");
611 lizardBlow.SetMenuIcon(&swordIcon);
613 dragonRush.SetName("Dragon rush");
614 dragonRush.SetCost(164);
615 dragonRush.GetTargetingMode().TargetSingleEnemy();
616 dragonRush.SetPhysical();
617 lizardBlow.SetIkari(&dragonRush);
618 dekar.SetWeapon(&lizardBlow);
620 holyRobe.SetName("Holy robe");
621 holyRobe.SetMenuIcon(&armorIcon);
623 crisisCure.SetName("Crisis cure");
624 crisisCure.SetCost(164);
625 crisisCure.GetTargetingMode().TargetAllAllies();
626 crisisCure.SetMagical();
627 holyRobe.SetIkari(&crisisCure);
628 dekar.SetArmor(&holyRobe);
629 dekar.SetShield(&zircoGloves);
630 dekar.SetHelmet(&holyCap);
632 rocketRing.SetName("Rocket ring");
633 rocketRing.SetMenuIcon(&ringIcon);
635 fake.SetName("Fake");
637 fake.GetTargetingMode().TargetSingleAlly();
639 rocketRing.SetIkari(&fake);
640 dekar.SetRing(&rocketRing);
642 krakenRock.SetName("Kraken rock");
643 krakenRock.SetMenuIcon(&jewelIcon);
645 tenLegger.SetName("Ten-legger");
646 tenLegger.SetCost(164);
647 tenLegger.GetTargetingMode().TargetAllEnemies();
648 tenLegger.SetPhysical();
649 rocketRing.SetIkari(&tenLegger);
650 dekar.SetJewel(&krakenRock);
652 battleRes.ikariMenuHeadline = "Please choose equipment.";
653 battleRes.noEquipmentText = "No equip";
654 battleRes.ikariMenuPrototype = Menu<const Item *>(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth());
656 battleRes.escapeText = "Escapes.";
658 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));
659 battleState->AddMonster(monster);
660 battleState->AddMonster(monster);
661 battleState->AddMonster(monster);
662 battleState->AddMonster(monster);
663 battleState->AddHero(maxim);
664 battleState->AddHero(selan);
665 battleState->AddHero(guy);
666 battleState->AddHero(dekar);
667 Application app(&screen, battleState);
668 app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
669 app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
670 app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
671 app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
672 app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
673 app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
674 app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
675 app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
676 app.Buttons().MapKey(SDLK_RETURN, Input::START);
677 app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
678 app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
679 app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
683 } catch (exception &e) {
684 cerr << "exception in main(): " << e.what() << endl;