Prev: DB3F Up: Map Next: DC26
DBC9: Handler: Inventory Items
Used by the routine at Dispatch_Handlers.
Picks up the first matching 2-wide key and redraws Print_KeyBar.
Point at the inventory list.
Handler_InventoryItems DBC9 LD HL,$7C70 Write Buffer_ActiveFont to *CHARS.
DBCC LD ($5C36),HL
DBCF LD IX,($6426) Point IX at *ReferenceInventoryItems.
DBD3 LD A,($64A4) Copy the player column into C.
DBD6 LD C,A
Walk each key record.
Handler_InventoryItems_Loop DBD7 LD A,(IX+$00) Return if the terminator FF is reached.
DBDA CP $FF
DBDC RET Z
DBDD BIT 7,A Jump to Handler_InventoryItems_Next if this item is already taken.
DBDF JR NZ,Handler_InventoryItems_Next
Accept this column or the next.
DBE1 CP C Jump to Handler_InventoryItems_Row if the column matches.
DBE2 JR Z,Handler_InventoryItems_Row
DBE4 INC A Jump to Handler_InventoryItems_Next unless the next column matches.
DBE5 CP C
DBE6 JR NZ,Handler_InventoryItems_Next
Require the same row.
Handler_InventoryItems_Row DBE8 LD A,($64A5) Jump to Handler_InventoryItems_Next unless the player row matches.
DBEB CP (IX+$01)
DBEE JR NZ,Handler_InventoryItems_Next
Punch a hole in the room tiles.
DBF0 LD C,(IX+$00) Convert the item cell into a Buffer_RoomTiles offset.
DBF3 LD B,(IX+$01)
DBF6 CALL JumpTable_ConvertCoordinate
DBF9 LD DE,$5DCE Fill a 02 by 02 hole with C8.
DBFC ADD HL,DE
DBFD LD BC,$0202
DC00 LD A,$C8
DC02 CALL JumpTable_FillAttributes
Hide the record.
DC05 LD A,(IX+$00) Reload the item column.
DC08 OR %10000000 Set bit 7.
DC0A LD (IX+$00),A Write the hidden record.
Count the key.
DC0D LD A,($64A1) Increase *CollectedKeys by one.
DC10 INC A
DC11 LD ($64A1),A
Play the pickup sound and redraw the key bar.
DC14 LD BC,$0032 Call Sound_Pickup with delay 32 and 19 iterations.
DC17 LD DE,$0019
DC1A CALL Sound_Pickup
DC1D JP Print_KeyBar Jump to Print_KeyBar.
Step to the next record.
Handler_InventoryItems_Next DC20 INC IX Increase IX by two.
DC22 INC IX
DC24 JR Handler_InventoryItems_Loop Jump to Handler_InventoryItems_Loop.
Prev: DB3F Up: Map Next: DC26