Added generation for generic items like amulets.

This commit is contained in:
Martin Haye 2016-07-01 16:57:24 -07:00
parent d89d9dfbad
commit 30a9f15ae2
2 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -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