From: Daniel Karbach Date: Fri, 31 Aug 2012 20:39:23 +0000 (+0200) Subject: moved more configuration to test.l2s X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=d53df1f79242df61b2305d148699d25a9c838eaa;p=l2e.git moved more configuration to test.l2s --- diff --git a/src/main.cpp b/src/main.cpp index e196930..e657f57 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -132,39 +132,18 @@ int main(int argc, char **argv) { battleRes.lastSmallHeroTagFrame = intp.GetFrame("lastSmallHeroTagFrame"); battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31); - SDL_Surface *gauges(IMG_Load("test-data/gauges.png")); - Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6); - battleRes.healthGauge = &healthGauge; - Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6); - battleRes.manaGauge = &manaGauge; - Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6); - battleRes.ikariGauge = &ikariGauge; - - SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png")); - Frame selectFrame(selectFrameImg, 16, 16); - battleRes.selectFrame = &selectFrame; - - SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png")); - Sprite normalFontSprite(normalFontImg, 16, 16); - Font normalFont(&normalFontSprite, 0, -2); - battleRes.normalFont = &normalFont; - - SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png")); - Sprite disabledFontSprite(disabledFontImg, 16, 16); - Font disabledFont(&disabledFontSprite, 0, -2); - battleRes.disabledFont = &disabledFont; - - SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png")); - Sprite handCursorSprite(handCursorImg, 32, 32); - battleRes.menuCursor = &handCursorSprite; - - SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png")); - Sprite weaponTargetCursor(targetingIconsImg, 32, 32); - Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32); - Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64); - battleRes.weaponTargetCursor = &weaponTargetCursor; - battleRes.magicTargetCursor = &magicTargetCursor; - battleRes.itemTargetCursor = &itemTargetCursor; + battleRes.healthGauge = intp.GetGauge("healthGauge"); + battleRes.manaGauge = intp.GetGauge("manaGauge"); + battleRes.ikariGauge = intp.GetGauge("ikariGauge"); + + battleRes.selectFrame = intp.GetFrame("selectFrame"); + battleRes.normalFont = intp.GetFont("normalFont"); + battleRes.disabledFont = intp.GetFont("disabledFont"); + battleRes.menuCursor = intp.GetSprite("handCursor"); + + battleRes.weaponTargetCursor = intp.GetSprite("weaponTargetCursor"); + battleRes.magicTargetCursor = intp.GetSprite("magicTargetCursor"); + battleRes.itemTargetCursor = intp.GetSprite("itemTargetCursor"); Spell resetSpell; resetSpell.SetName("Reset"); @@ -210,7 +189,7 @@ int main(int argc, char **argv) { selan.AddSpell(&valorSpell); battleRes.spellMenuHeadline = "Please choose a spell."; - battleRes.spellMenuPrototype = Menu(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':'); + battleRes.spellMenuPrototype = Menu(intp.GetFont("normalFont"), intp.GetFont("disabledFont"), intp.GetSprite("handCursor"), 9, 6, 8, 0, 2, 32, 2, ':'); SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png")); Sprite potionIcon(itemIcons, 16, 16); @@ -279,7 +258,7 @@ int main(int argc, char **argv) { battleRes.inventory = &inventory; battleRes.itemMenuHeadline = "Please choose an item."; - battleRes.itemMenuPrototype = Menu(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':'); + battleRes.itemMenuPrototype = Menu(intp.GetFont("normalFont"), intp.GetFont("disabledFont"), intp.GetSprite("handCursor"), 15, 6, 8, 16, 1, 32, 2, ':'); SDL_Surface *swordAttackImg(IMG_Load("test-data/attack-sword.png")); Sprite swordAttackSprite(swordAttackImg, 96, 96); @@ -501,7 +480,7 @@ int main(int argc, char **argv) { battleRes.ikariMenuHeadline = "Please choose equipment."; battleRes.noEquipmentText = "No equip"; - battleRes.ikariMenuPrototype = Menu(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth()); + battleRes.ikariMenuPrototype = Menu(intp.GetFont("normalFont"), intp.GetFont("disabledFont"), intp.GetSprite("handCursor"), 12, 6, intp.GetFont("normalFont")->CharHeight() / 2, intp.GetFont("normalFont")->CharWidth(), 1, intp.GetFont("normalFont")->CharWidth() * 2, 0, ':', 12, intp.GetFont("normalFont")->CharWidth()); battleRes.escapeText = "Escapes."; diff --git a/test-data/test.l2s b/test-data/test.l2s index b7e1acd..ad2b301 100644 --- a/test-data/test.l2s +++ b/test-data/test.l2s @@ -442,4 +442,70 @@ export Frame lastSmallHeroTagFrame { image: "test-data/small-tag-frame.png", border: <8,16>, offset: <0,33> -} \ No newline at end of file +} + +export Gauge healthGauge { + image: "test-data/gauges.png", + full: <0,16>, + empty: <0, 0>, + height: 16, + start: 6, + repeat: 1, + end: 6 +} +export Gauge manaGauge { + image: "test-data/gauges.png", + full: <0,32>, + empty: <0, 0>, + height: 16, + start: 6, + repeat: 1, + end: 6 +} +export Gauge ikariGauge { + image: "test-data/gauges.png", + full: <0,48>, + empty: <0, 0>, + height: 16, + start: 6, + repeat: 1, + end: 6 +} + +export Frame selectFrame { + image: "test-data/select-frame.png", + border: <16,16> +} +export Font normalFont { + sprite: Sprite { + image: "test-data/normal-font.png", + size: <16,16> + }, + rowoffset: -2 +} +export Font disabledFont { + sprite: Sprite { + image: "test-data/disabled-font.png", + size: <16,16> + }, + rowoffset: -2 +} +export Sprite handCursor { + image: "test-data/cursor-hand.png", + size: <32,32> +} + +export Sprite weaponTargetCursor { + image: "test-data/targeting-icons.png", + size: <32,32> +} +export Sprite magicTargetCursor { + image: "test-data/targeting-icons.png", + size: <32,32>, + offset: <0,32> +} +export Sprite itemTargetCursor { + image: "test-data/targeting-icons.png", + size: <32,32>, + offset: <0,64> +}