From: Daniel Karbach Date: Sat, 1 Sep 2012 13:55:48 +0000 (+0200) Subject: moved some items to l2 source files X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=771a3daeecf527a9b5873e412e263ad251c59ab5;p=l2e.git moved some items to l2 source files --- diff --git a/src/main.cpp b/src/main.cpp index ecd24a1..00c07c5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -174,79 +174,23 @@ int main(int argc, char **argv) { battleRes.jewelMenuIcon = intp.GetSprite("jewelIcon"); Inventory inventory; - Item antidote; - antidote.SetName("Antidote"); - antidote.SetMenuIcon(intp.GetSprite("potionIcon")); - antidote.SetUsableInBattle(); - antidote.GetTargetingMode().TargetSingleAlly(); - inventory.Add(&antidote, 9); - Item magicJar; - magicJar.SetName("Magic jar"); - magicJar.SetMenuIcon(intp.GetSprite("potionIcon")); - magicJar.SetUsableInBattle(); - magicJar.GetTargetingMode().TargetSingleAlly(); - inventory.Add(&magicJar, 4); - Item hiPotion; - hiPotion.SetName("Hi-Potion"); - hiPotion.SetMenuIcon(intp.GetSprite("potionIcon")); - hiPotion.SetUsableInBattle(); - hiPotion.GetTargetingMode().TargetSingleAlly(); - inventory.Add(&hiPotion, 4); - Item powerPotion; - powerPotion.SetName("Power potion"); - powerPotion.SetMenuIcon(intp.GetSprite("potionIcon")); - inventory.Add(&powerPotion, 4); - Item escape; - escape.SetName("Escape"); - inventory.Add(&escape, 2); - Item sleepBall; - sleepBall.SetName("Sleep ball"); - sleepBall.SetMenuIcon(intp.GetSprite("ballIcon")); - sleepBall.SetUsableInBattle(); - sleepBall.GetTargetingMode().TargetSingleEnemy(); - inventory.Add(&sleepBall, 1); - Item multiBall; - multiBall.SetName("Multi-ball!"); - multiBall.SetMenuIcon(intp.GetSprite("ballIcon")); - multiBall.SetUsableInBattle(); - multiBall.GetTargetingMode().TargetMultipleEnemies(); - inventory.Add(&multiBall, 1); - Item figgoru; - figgoru.SetName("Figgoru"); - figgoru.SetMenuIcon(intp.GetSprite("crankIcon")); - figgoru.GetTargetingMode().TargetAllEnemies(); - inventory.Add(&figgoru, 1); + inventory.Add(intp.GetItem("antidoteItem"), 9); + inventory.Add(intp.GetItem("magicJarItem"), 4); + inventory.Add(intp.GetItem("hiPotionItem"), 4); + inventory.Add(intp.GetItem("powerPotionItem"), 4); + inventory.Add(intp.GetItem("escapeItem"), 2); + inventory.Add(intp.GetItem("sleepBallItem"), 1); battleRes.inventory = &inventory; - battleRes.itemMenuHeadline = "Please choose an item."; + battleRes.itemMenuHeadline = intp.GetString("itemMenuHeadline"); 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); SimpleAnimation swordAttackAnimation(&swordAttackSprite, 2 * framerate, 4); - Item zircoSword; - zircoSword.SetName("Zirco sword"); - zircoSword.SetMenuIcon(intp.GetSprite("swordIcon")); - zircoSword.GetTargetingMode().TargetSingleEnemy(); - Ikari firestorm; - firestorm.SetName("Firestorm"); - firestorm.SetCost(224); - firestorm.GetTargetingMode().TargetAllEnemies(); - firestorm.SetPhysical(); - zircoSword.SetIkari(&firestorm); - zircoSword.SetAttackAnimation(&swordAttackAnimation); - maxim.SetWeapon(&zircoSword); - Item zirconArmor; - zirconArmor.SetName("Zircon armor"); - zirconArmor.SetMenuIcon(intp.GetSprite("armorIcon")); - Ikari magicCure; - magicCure.SetName("Magic cure"); - magicCure.SetCost(128); - magicCure.GetTargetingMode().TargetSingleAlly(); - magicCure.SetMagical(); - zirconArmor.SetIkari(&magicCure); - maxim.SetArmor(&zirconArmor); + maxim.SetWeapon(intp.GetItem("zircoSwordItem")); + maxim.SetArmor(intp.GetItem("zirconArmorItem")); Item holyShield; holyShield.SetName("Holy shield"); holyShield.SetMenuIcon(intp.GetSprite("shieldIcon")); @@ -361,7 +305,7 @@ int main(int argc, char **argv) { torrent.SetPhysical(); zircoAx.SetIkari(&torrent); // guy.SetWeapon(&zircoAx); - guy.SetArmor(&zirconArmor); + guy.SetArmor(intp.GetItem("zirconArmorItem")); Item megaShield; megaShield.SetName("Mega shield"); megaShield.SetMenuIcon(intp.GetSprite("shieldIcon")); diff --git a/test-data/ikaris.l2s b/test-data/ikaris.l2s new file mode 100644 index 0000000..99f343a --- /dev/null +++ b/test-data/ikaris.l2s @@ -0,0 +1,19 @@ +export Ikari firestormIkari { + name: "Firestorm", + cost: 224, + targets: TargetingMode { + enemy: true, + all: true + }, + physical: true +} + +export Ikari magicCureIkari { + name: "Magic cure", + cost: 128, + targets: TargetingMode { + ally: true, + single: true + }, + magical: true +} diff --git a/test-data/items.l2s b/test-data/items.l2s new file mode 100644 index 0000000..f1734a7 --- /dev/null +++ b/test-data/items.l2s @@ -0,0 +1,132 @@ +export Sprite potionIcon { + image: "test-data/item-icons.png", + size: <16,16> +} +export Sprite ballIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,16> +} +export Sprite crankIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,32> +} +export Sprite spearIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,48> +} +export Sprite swordIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,64> +} +export Sprite axIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,80> +} +export Sprite rodIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,96> +} +export Sprite armorIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,112> +} +export Sprite shieldIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,128> +} +export Sprite helmetIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,144> +} +export Sprite ringIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,160> +} +export Sprite jewelIcon { + image: "test-data/item-icons.png", + size: <16,16>, + offset: <0,176> +} + +export SimpleAnimation swordAttackAnimation { + sprite: Sprite { + image: "test-data/attack-sword.png", + size: <96,96> + }, + frametime: twoFramesTime, + repeat: false, + framecount: 4 +} + +export Item antidoteItem { + name: "Antidote", + menuicon: potionIcon, + battle: true, + targets: TargetingMode { + ally: true, + single: true + } +} +export Item escapeItem { + name: "Escape", + battle: false +} +export Item hiPotionItem { + name: "Hi-Potion", + menuicon: potionIcon, + battle: true, + targets: TargetingMode { + ally: true, + single: true + } +} +export Item magicJarItem { + name: "Magic jar", + menuicon: potionIcon, + battle: true, + targets: TargetingMode { + ally: true, + single: true + } +} +export Item powerPotionItem { + name: "Power potion", + menuicon: potionIcon, + battle: false +} +export Item sleepBallItem { + name: "Sleep ball", + menuicon: ballIcon, + battle: true, + targets: TargetingMode { + enemy: true, + single: true + } +} +export Item zirconArmorItem { + name: "Zircon armor", + menuicon: armorIcon, + battle: false, + ikari: magicCureIkari +} +export Item zircoSwordItem { + name: "Zirco sword", + menuicon: swordIcon, + battle: false, + targets: TargetingMode { + enemy: true, + single: true + }, + ikari: firestormIkari, + attackanimation: swordAttackAnimation +} diff --git a/test-data/test.l2s b/test-data/test.l2s index 28a08ee..5958c74 100644 --- a/test-data/test.l2s +++ b/test-data/test.l2s @@ -514,62 +514,7 @@ include "test-data/spells.l2s" export String spellMenuHeadline "Please choose a spell." -export Sprite potionIcon { - image: "test-data/item-icons.png", - size: <16,16> -} -export Sprite ballIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,16> -} -export Sprite crankIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,32> -} -export Sprite spearIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,48> -} -export Sprite swordIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,64> -} -export Sprite axIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,80> -} -export Sprite rodIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,96> -} -export Sprite armorIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,112> -} -export Sprite shieldIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,128> -} -export Sprite helmetIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,144> -} -export Sprite ringIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,160> -} -export Sprite jewelIcon { - image: "test-data/item-icons.png", - size: <16,16>, - offset: <0,176> -} +include "test-data/ikaris.l2s" +include "test-data/items.l2s" + +export String itemMenuHeadline "Please choose an item."