Prepare for inventory command processing

This commit is contained in:
David Schmenk 2016-06-18 12:59:38 -07:00
parent e1c2c9c4d5
commit afd05c4bec

View File

@ -24,23 +24,21 @@ word global
// Exported functions go here. First a predef for each one, then a table with function pointers // Exported functions go here. First a predef for each one, then a table with function pointers
// 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_showPlayerSheet predef _party_doPlayerSheet
word[] funcTbl = @_party_showPlayerSheet word[] funcTbl = @_party_doPlayerSheet
// Other global variables here // Other global variables here
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Show player data // Show player data
def _party_showPlayerSheet(num) def showPlayerSheet(num)
word player, item word player, item
// Count the number of players // Count the number of players
player = global=>p_players player = global=>p_players
while num > 0 while num > 0
player = player=>p_nextObj player = player=>p_nextObj
if !player // Not that many players if !player; return; fin // Not that many players
return
fin
num-- num--
loop loop
@ -50,11 +48,11 @@ def _party_showPlayerSheet(num)
// Next, show inventory in the main panel // Next, show inventory in the main panel
setMapWindow() setMapWindow()
clearWindow() clearWindow()
rawDisplayStr("^Y^LInventory^L^N\n") rawDisplayStr("^Y^LInventory^L^N")
item = player=>p_items item = player=>p_items
while item while item
displayStr(item=>s_name)
displayStr("\n") displayStr("\n")
displayStr(item=>s_name)
item = item=>p_nextObj item = item=>p_nextObj
loop loop
@ -79,10 +77,27 @@ def _party_showPlayerSheet(num)
if player->b_aiming; displayStr("\nAiming"); fin if player->b_aiming; displayStr("\nAiming"); fin
if player->b_handToHand; displayStr("\nHand-to-Hand"); fin if player->b_handToHand; displayStr("\nHand-to-Hand"); fin
if player->b_dodging; displayStr("\nDodging"); fin if player->b_dodging; displayStr("\nDodging"); fin
return player
end
// Show player sheet and accept command
def _party_doPlayerSheet(num)
word player
repeat
player = showPlayerSheet(num)
if !player; return; fin // Invalid player
// Get a key, do something // Get a key, do something
getUpperKey() when getUpperKey()
// do something here // Select another player to show
is '1'; num = 0; break
is '2'; num = 1; break
is '3'; num = 2; break
// Other operations...
// All done
otherwise return
wend
until 0
end end
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////