From 30a9f15ae2bf31e6748bf4ac6dae106530594e35 Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Fri, 1 Jul 2016 16:57:24 -0700 Subject: [PATCH] Added generation for generic items like amulets. --- .../src/org/demo/PackPartitions.groovy | 17 ++++++++++++++++- Platform/Apple/virtual/src/plasma/playtype.plh | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Platform/Apple/tools/PackPartitions/src/org/demo/PackPartitions.groovy b/Platform/Apple/tools/PackPartitions/src/org/demo/PackPartitions.groovy index b8ae7c51..6493c2c2 100644 --- a/Platform/Apple/tools/PackPartitions/src/org/demo/PackPartitions.groovy +++ b/Platform/Apple/tools/PackPartitions/src/org/demo/PackPartitions.groovy @@ -1943,7 +1943,12 @@ end def genItem(func, row, out) { - out.println " //item name=${row.@name}" + out.println( + " return makeItem(" + + "${escapeString(parseStringAttr(row, "name"))}, " + + "${parseWordAttr(row, "price")}, " + + "${parseModifier(row, "bonus-value", "bonus-attribute")}, " + + "${parseByteAttr(row, "numofuses")})") } def genPlayer(func, row, out) @@ -2122,6 +2127,16 @@ def makeStuff(name, kind, price, count) p=>w_maxCount = count return p end + +def makeItem(name, price, modifier, maxUses) + word p; p = mmgr(HEAP_ALLOC, TYPE_ARMOR) + p=>s_name = mmgr(HEAP_INTERN, name) + p=>w_price = price + p=>p_modifiers = modifier + p->b_maxUses = maxUses + p->b_curUses = 0 + return p +end """) // Generate all the functions themselves diff --git a/Platform/Apple/virtual/src/plasma/playtype.plh b/Platform/Apple/virtual/src/plasma/playtype.plh index 6afbbb5d..2853320b 100644 --- a/Platform/Apple/virtual/src/plasma/playtype.plh +++ b/Platform/Apple/virtual/src/plasma/playtype.plh @@ -96,6 +96,9 @@ struc Item word s_itemKind word w_price word p_modifiers // list:modifier + // Usables properties + byte b_maxUses + byte b_curUses end const WEAPON_FLAG_SINGLE_USE = $01