![]() |
Routines |
| Prev: 37484 | Up: Map | Next: 37510 |
|
Looks for an item in the three slots of the inventory (see Inventory_Slot1). The sprite ID and the attribute of the item are at offsets 2 and 3 of each slot.
|
||||||||||||||
| FindInventoryItem | 37491 | LD B,3 | B=3 (the number of slots in the inventory). | |||||||||||
| 37493 | LD HL,24114 | Point HL at the sprite ID of the first slot at Inventory_Slot1_Sprite_Id. | ||||||||||||
| FindInventoryItem_Loop | 37496 | LD A,(HL) | Fetch the sprite ID of the slot. | |||||||||||
| 37497 | CP E | Is it the sprite ID of the item? | ||||||||||||
| 37498 | INC HL | Move HL on to the attribute of the slot. | ||||||||||||
| 37499 | JR NZ,FindInventoryItem_Next | Jump to FindInventoryItem_Next if they are different. | ||||||||||||
| 37501 | LD A,(HL) | Fetch the attribute of the slot. | ||||||||||||
| 37502 | CP D | Return if the attribute matches too, as the player has the item. | ||||||||||||
| 37503 | RET Z | |||||||||||||
| FindInventoryItem_Next | 37504 | INC HL | Move HL on to the next slot. | |||||||||||
| 37505 | INC HL | |||||||||||||
| 37506 | INC HL | |||||||||||||
| 37507 | DJNZ FindInventoryItem_Loop | Decrease the slot counter by one and loop back to FindInventoryItem_Loop until all three slots have been checked. | ||||||||||||
| 37509 | RET | Return. | ||||||||||||
| Prev: 37484 | Up: Map | Next: 37510 |