mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-09 21:31:22 +00:00
Speed up inventory display
This commit is contained in:
parent
9f3e880c37
commit
1f328ce1d8
@ -39,8 +39,8 @@ word global
|
|||||||
// in the same order as the constants are defined in the the header.
|
// in the same order as the constants are defined in the the header.
|
||||||
predef _party_doPlayerSheet
|
predef _party_doPlayerSheet
|
||||||
word[] funcTbl = @_party_doPlayerSheet
|
word[] funcTbl = @_party_doPlayerSheet
|
||||||
byte[] strWhichItem = "\n^YWhich item?^Y"
|
byte[] strWhichItem = "\n^T032Which item?"
|
||||||
byte[] strYouSure = "\n^YAre you sure (Y/N)?^Y"
|
byte[] strYouSure = "\n^T008Are you sure (Y/N)?"
|
||||||
|
|
||||||
// Other global variables here
|
// Other global variables here
|
||||||
|
|
||||||
@ -67,10 +67,14 @@ def itemMatch(item, group)
|
|||||||
wend
|
wend
|
||||||
end
|
end
|
||||||
// Search item num
|
// Search item num
|
||||||
def itemNum(player, num, select)
|
def itemNum(player, skip, num, select)
|
||||||
word item
|
word item
|
||||||
|
|
||||||
item = player=>p_items
|
item = player=>p_items
|
||||||
|
while item and skip
|
||||||
|
item = item=>p_nextObj
|
||||||
|
skip--
|
||||||
|
loop
|
||||||
while item
|
while item
|
||||||
if itemMatch(item, select)
|
if itemMatch(item, select)
|
||||||
if not num; return item; fin
|
if not num; return item; fin
|
||||||
@ -105,8 +109,7 @@ def showInventory(player, page, height, select)
|
|||||||
|
|
||||||
setMapWindow()
|
setMapWindow()
|
||||||
clearWindow()
|
clearWindow()
|
||||||
rawDisplayStr("^Y^LInventory^L^Y")
|
rawDisplayStr("^T040^LInventory^L\n^T018")
|
||||||
rawDisplayStr("\n^T018")
|
|
||||||
displayf1("Group Gold: %d", countGold())
|
displayf1("Group Gold: %d", countGold())
|
||||||
item = player=>p_items
|
item = player=>p_items
|
||||||
s_item = 0
|
s_item = 0
|
||||||
@ -179,7 +182,7 @@ def showPlayerSheet(num, mapHeight)
|
|||||||
// Show stats in the right panel
|
// Show stats in the right panel
|
||||||
setWindow2()
|
setWindow2()
|
||||||
clearWindow()
|
clearWindow()
|
||||||
rawDisplayStr("^Y^LStats^L^N\n")
|
rawDisplayStr("^T040^LStats^L\n")
|
||||||
rightJustifyNum(player=>w_health, CHAR_WND_STAT_X); rawDisplayStr("^T024Health\n")
|
rightJustifyNum(player=>w_health, CHAR_WND_STAT_X); rawDisplayStr("^T024Health\n")
|
||||||
rightJustifyNum(player->b_intelligence, CHAR_WND_STAT_X); rawDisplayStr("^T024Intelligence\n")
|
rightJustifyNum(player->b_intelligence, CHAR_WND_STAT_X); rawDisplayStr("^T024Intelligence\n")
|
||||||
rightJustifyNum(player->b_strength, CHAR_WND_STAT_X); rawDisplayStr("^T024Strength\n")
|
rightJustifyNum(player->b_strength, CHAR_WND_STAT_X); rawDisplayStr("^T024Strength\n")
|
||||||
@ -193,7 +196,7 @@ def showPlayerSheet(num, mapHeight)
|
|||||||
// Show aquired skills in lower right panel
|
// Show aquired skills in lower right panel
|
||||||
setWindow3()
|
setWindow3()
|
||||||
clearWindow()
|
clearWindow()
|
||||||
rawDisplayStr("^Y^LSkills^L^N")
|
rawDisplayStr("^T040^LSkills^L")
|
||||||
displaySkill("Aim", player->b_aiming, 0)
|
displaySkill("Aim", player->b_aiming, 0)
|
||||||
displaySkill("Fists", player->b_handToHand, 1)
|
displaySkill("Fists", player->b_handToHand, 1)
|
||||||
displaySkill("Dodge", player->b_dodging, 0)
|
displaySkill("Dodge", player->b_dodging, 0)
|
||||||
@ -206,7 +209,7 @@ def showPlayerSheet(num, mapHeight)
|
|||||||
loop
|
loop
|
||||||
// Next, show inventory in the main panel
|
// Next, show inventory in the main panel
|
||||||
showInventory(player, 0, mapHeight, 0)
|
showInventory(player, 0, mapHeight, 0)
|
||||||
rawDisplayStr("\n^YE)quip, U)se, D)rop^Y")
|
rawDisplayStr("\n^T012E)quip, U)se, D)rop")
|
||||||
return player
|
return player
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -234,7 +237,7 @@ def _party_doPlayerSheet(num)
|
|||||||
is 'E'
|
is 'E'
|
||||||
if showInventory(player, n_page, vInv, TYPE_EQUIP)
|
if showInventory(player, n_page, vInv, TYPE_EQUIP)
|
||||||
rawDisplayStr(@strWhichItem)
|
rawDisplayStr(@strWhichItem)
|
||||||
item = itemNum(player, getUpperKey() - 'A', TYPE_EQUIP)
|
item = itemNum(player, vInv * n_page, getUpperKey() - 'A', TYPE_EQUIP)
|
||||||
if item
|
if item
|
||||||
if unequip(player, item->t_type, item=>s_itemKind) <> item
|
if unequip(player, item->t_type, item=>s_itemKind) <> item
|
||||||
item->b_flags = item->b_flags | ITEM_FLAG_EQUIP
|
item->b_flags = item->b_flags | ITEM_FLAG_EQUIP
|
||||||
@ -249,7 +252,7 @@ def _party_doPlayerSheet(num)
|
|||||||
is 'U'
|
is 'U'
|
||||||
if showInventory(player, n_page, vInv, TYPE_USE)
|
if showInventory(player, n_page, vInv, TYPE_USE)
|
||||||
rawDisplayStr(@strWhichItem)
|
rawDisplayStr(@strWhichItem)
|
||||||
item = itemNum(player, getUpperKey() - 'A', TYPE_USE)
|
item = itemNum(player, vInv * n_page, getUpperKey() - 'A', TYPE_USE)
|
||||||
if item
|
if item
|
||||||
if streqi(item=>p_modifiers=>s_name, "health")
|
if streqi(item=>p_modifiers=>s_name, "health")
|
||||||
if player=>w_health < player=>w_maxHealth
|
if player=>w_health < player=>w_maxHealth
|
||||||
@ -270,16 +273,16 @@ def _party_doPlayerSheet(num)
|
|||||||
if showInventory(player, n_page, vInv, TYPE_DROP)
|
if showInventory(player, n_page, vInv, TYPE_DROP)
|
||||||
rawDisplayStr(@strWhichItem)
|
rawDisplayStr(@strWhichItem)
|
||||||
n_item = getUpperKey() - 'A'
|
n_item = getUpperKey() - 'A'
|
||||||
item = itemNum(player, n_item, TYPE_DROP)
|
item = itemNum(player, vInv * n_page, n_item, TYPE_DROP)
|
||||||
if item
|
if item
|
||||||
clearWindow()
|
clearWindow()
|
||||||
rawDisplayStr("^Y^LDrop^L^Y")
|
rawDisplayStr("^T050^LDrop^L\n")
|
||||||
for i = 0 to n_item
|
for i = 0 to n_item
|
||||||
displayChar('\n')
|
displayChar('\n')
|
||||||
next
|
next
|
||||||
rawDisplayStr("\n^T018")
|
rawDisplayStr("\n^T018")
|
||||||
displayStr(item=>s_name)
|
displayStr(item=>s_name)
|
||||||
for i = n_item + 2 to vInv
|
for i = n_item + 3 to vInv
|
||||||
displayChar('\n')
|
displayChar('\n')
|
||||||
next
|
next
|
||||||
rawDisplayStr(@strYouSure)
|
rawDisplayStr(@strYouSure)
|
||||||
@ -294,7 +297,7 @@ def _party_doPlayerSheet(num)
|
|||||||
break
|
break
|
||||||
// Next inventory page
|
// Next inventory page
|
||||||
is '>'
|
is '>'
|
||||||
if itemNum(player, n_page * vInv + vInv, TYPE_ALL)
|
if itemNum(player, vInv * n_page, vInv * n_page + vInv, TYPE_ALL)
|
||||||
n_page++
|
n_page++
|
||||||
fin
|
fin
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user