![]() |
Routines |
| Prev: 926C | Up: Map | Next: 9286 |
|
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 02 and 03 of each slot.
|
||||||||||||||
| FindInventoryItem | 9273 | LD B,$03 | B=03 (the number of slots in the inventory). | |||||||||||
| 9275 | LD HL,$5E32 | Point HL at the sprite ID of the first slot at Inventory_Slot1_Sprite_Id. | ||||||||||||
| FindInventoryItem_Loop | 9278 | LD A,(HL) | Fetch the sprite ID of the slot. | |||||||||||
| 9279 | CP E | Is it the sprite ID of the item? | ||||||||||||
| 927A | INC HL | Move HL on to the attribute of the slot. | ||||||||||||
| 927B | JR NZ,FindInventoryItem_Next | Jump to FindInventoryItem_Next if they are different. | ||||||||||||
| 927D | LD A,(HL) | Fetch the attribute of the slot. | ||||||||||||
| 927E | CP D | Return if the attribute matches too, as the player has the item. | ||||||||||||
| 927F | RET Z | |||||||||||||
| FindInventoryItem_Next | 9280 | INC HL | Move HL on to the next slot. | |||||||||||
| 9281 | INC HL | |||||||||||||
| 9282 | INC HL | |||||||||||||
| 9283 | DJNZ FindInventoryItem_Loop | Decrease the slot counter by one and loop back to FindInventoryItem_Loop until all three slots have been checked. | ||||||||||||
| 9285 | RET | Return. | ||||||||||||
| Prev: 926C | Up: Map | Next: 9286 |