From d5f1663267b962dfaf912b63ba7d14ef1213295f Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Fri, 17 Jun 2016 07:26:53 -0700 Subject: [PATCH] Added ammo generation. --- .../src/org/demo/PackPartitions.groovy | 7 ++++++- Platform/Apple/virtual/src/plasma/gamelib.plh | 2 +- Platform/Apple/virtual/src/plasma/gameloop.pla | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Platform/Apple/tools/PackPartitions/src/org/demo/PackPartitions.groovy b/Platform/Apple/tools/PackPartitions/src/org/demo/PackPartitions.groovy index 2f9442b8..1dc9a092 100644 --- a/Platform/Apple/tools/PackPartitions/src/org/demo/PackPartitions.groovy +++ b/Platform/Apple/tools/PackPartitions/src/org/demo/PackPartitions.groovy @@ -1896,7 +1896,12 @@ class PackPartitions def genAmmo(func, row, out) { - out.println " //ammo name=${row.@name}" + out.println( + " return makeStuff(" + + "${escapeString(parseStringAttr(row, "name"))}, " + + "${escapeString(parseStringAttr(row, "type"))}, " + + "${parseWordAttr(row, "price")}, " + + "${parseWordAttr(row, "max")})") } def genItem(func, row, out) diff --git a/Platform/Apple/virtual/src/plasma/gamelib.plh b/Platform/Apple/virtual/src/plasma/gamelib.plh index caf87a6b..537de10f 100644 --- a/Platform/Apple/virtual/src/plasma/gamelib.plh +++ b/Platform/Apple/virtual/src/plasma/gamelib.plh @@ -118,7 +118,7 @@ const randomFromArray = gameLibVecs + 3*57 const makePlayer_pt1 = gameLibVecs + 3*58 const makePlayer_pt2 = gameLibVecs + 3*59 const calcPlayerArmor = gameLibVecs + 3*60 -const UNUSED_FN_61 = gameLibVecs + 3*61 +const makeAmmo = gameLibVecs + 3*61 const UNUSED_FN_62 = gameLibVecs + 3*62 const UNUSED_FN_63 = gameLibVecs + 3*63 const UNUSED_FN_64 = gameLibVecs + 3*64 diff --git a/Platform/Apple/virtual/src/plasma/gameloop.pla b/Platform/Apple/virtual/src/plasma/gameloop.pla index 8ab0cbd6..db500474 100644 --- a/Platform/Apple/virtual/src/plasma/gameloop.pla +++ b/Platform/Apple/virtual/src/plasma/gameloop.pla @@ -111,7 +111,7 @@ predef _reboot, _brk, _encodeDice, _rollDice predef _setPlural, _makeEnemy, _getStringResponse, _strcmpi, _addEncounterZone, _fatal predef _pause, _tossStrings, _showMapName, _setMapWindow predef _makeModifier, _makeArmor, _makeWeapon_pt1, _makeWeapon_pt2, _randomFromArray -predef _makePlayer_pt1, _makePlayer_pt2, _calcPlayerArmor +predef _makePlayer_pt1, _makePlayer_pt2, _calcPlayerArmor, _makeAmmo word gameLib_addrs = @_setScriptInfo, @_scriptDisplayStr, @_scriptDisplayStrNL, @_getYN word = @_queue_setMap, @_setSky, @_setGround, @_queue_teleport, @_setPortrait, @_clearPortrait @@ -127,7 +127,7 @@ word = @_reboot, @_brk, @_encodeDice, @_rollDice word = @_setPlural, @_makeEnemy, @_getStringResponse, @_strcmpi, @_addEncounterZone, @_fatal word = @_pause, @_tossStrings, @_showMapName, @_setMapWindow word = @_makeModifier, @_makeArmor, @_makeWeapon_pt1, @_makeWeapon_pt2, @_randomFromArray -word = @_makePlayer_pt1, @_makePlayer_pt2, @_calcPlayerArmor +word = @_makePlayer_pt1, @_makePlayer_pt2, @_calcPlayerArmor, @_makeAmmo word = 0 // end of library functions @@ -2230,6 +2230,17 @@ def _calcPlayerArmor(player) loop end +/////////////////////////////////////////////////////////////////////////////////////////////////// +def _makeAmmo(name, kind, price, count) + word p; p = mmgr(HEAP_ALLOC, TYPE_ARMOR) + p=>s_name = mmgr(HEAP_INTERN, name) + p=>s_itemKind = mmgr(HEAP_INTERN, kind) + p=>w_price = price + p=>w_count = count + p=>w_maxCount = count + return p +end + /////////////////////////////////////////////////////////////////////////////////////////////////// // Create the party def initParty()