Prev: 56127 Up: Map Next: 56358
56265: 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 56265 LD HL,31856 Write Buffer_ActiveFont to *CHARS.
56268 LD (23606),HL
56271 LD IX,(25638) Point IX at *ReferenceInventoryItems.
56275 LD A,(25764) Copy the player column into C.
56278 LD C,A
Walk each key record.
Handler_InventoryItems_Loop 56279 LD A,(IX+0) Return if the terminator 255 is reached.
56282 CP 255
56284 RET Z
56285 BIT 7,A Jump to Handler_InventoryItems_Next if this item is already taken.
56287 JR NZ,Handler_InventoryItems_Next
Accept this column or the next.
56289 CP C Jump to Handler_InventoryItems_Row if the column matches.
56290 JR Z,Handler_InventoryItems_Row
56292 INC A Jump to Handler_InventoryItems_Next unless the next column matches.
56293 CP C
56294 JR NZ,Handler_InventoryItems_Next
Require the same row.
Handler_InventoryItems_Row 56296 LD A,(25765) Jump to Handler_InventoryItems_Next unless the player row matches.
56299 CP (IX+1)
56302 JR NZ,Handler_InventoryItems_Next
Punch a hole in the room tiles.
56304 LD C,(IX+0) Convert the item cell into a Buffer_RoomTiles offset.
56307 LD B,(IX+1)
56310 CALL JumpTable_ConvertCoordinate
56313 LD DE,24014 Fill a 2 by 2 hole with 200.
56316 ADD HL,DE
56317 LD BC,514
56320 LD A,200
56322 CALL JumpTable_FillAttributes
Hide the record.
56325 LD A,(IX+0) Reload the item column.
56328 OR %10000000 Set bit 7.
56330 LD (IX+0),A Write the hidden record.
Count the key.
56333 LD A,(25761) Increase *CollectedKeys by one.
56336 INC A
56337 LD (25761),A
Play the pickup sound and redraw the key bar.
56340 LD BC,50 Call Sound_Pickup with delay 50 and 25 iterations.
56343 LD DE,25
56346 CALL Sound_Pickup
56349 JP Print_KeyBar Jump to Print_KeyBar.
Step to the next record.
Handler_InventoryItems_Next 56352 INC IX Increase IX by two.
56354 INC IX
56356 JR Handler_InventoryItems_Loop Jump to Handler_InventoryItems_Loop.
Prev: 56127 Up: Map Next: 56358