Prev: 55672 Up: Map Next: 55787
55715: Update Village Item
The routine for objects of type 48 to 63, the items that appear in the village (see SpawnItem). An item wanders about at random while the player stays in the cell that it appeared in, and is picked up when the player touches it. It turns into a burst, and goes back to the items that are available, when the player has gone from the cell or is dead.
UpdateVillageItem 55715 LD A,(48270) Jump to UpdateVillageItem_Dead if the player is not there (the type of the player is not 16 to 47).
55718 SUB 16
55720 CP 32
55722 JR NC,UpdateVillageItem_Dead
55724 LD A,(48272) Jump to UpdateVillageItem_Left if the player is not in the column of the item.
55727 CP (IX+2)
55730 JR NZ,UpdateVillageItem_Left
55732 LD A,(48274) Jump to UpdateVillageItem_Left if the player is not in the row of the item.
55735 CP (IX+4)
55738 JR NZ,UpdateVillageItem_Left
55740 LD B,4 Use 4 bits for the velocity.
55742 CALL ChooseRandomVelocity Choose a random velocity.
55745 CALL SetDirectionFromVelocity Set the direction that the item is facing from its velocity.
55748 CALL MoveObject Move the item.
55751 CALL NextSpriteNumber Change the sprite of the item.
55754 CALL CheckPlayerCollision Return if the item is not touching the player.
55757 RET NC
55758 CALL PickUpItem Pick up the item.
55761 LD (IX+0),12 Turn the item into a burst and return.
55765 RET
The player is dead.
UpdateVillageItem_Dead 55766 LD (IX+0),13 Turn the item into a burst, with a different sprite, and jump to UpdateVillageItem_Return.
55770 JR UpdateVillageItem_Return
The player has left the cell.
UpdateVillageItem_Left 55772 LD (IX+0),12 Turn the item into a burst.
Add the item to the items that are available for the kind of tile.
UpdateVillageItem_Return 55776 LD C,(IX+5) Fetch the kind of tile that the item was found on.
55779 LD B,0
55781 LD HL,48078 Point at the number of items for the kind of tile.
55784 ADD HL,BC
55785 INC (HL) Add one to the number of items that are available.
55786 RET Return.
Prev: 55672 Up: Map Next: 55787