Prev: 56819 Up: Map Next: 56951
56869: Reset Entities
Used by the routine at RunGame.
Clears the entities other than the player, and marks every extra record free. The player is copied from the template at PlayerTemplate and the jump counter is cleared. If BottleFlag is set, the player's animation low nibble and the control byte are set to 5. SetEntitySize then measures the sprite.
ResetEntities 56869 LD IX,46438 Start at the first entity after the player.
56873 LD B,11 There are 11 entities besides the player.
56875 LD DE,38 Each entity is 38 bytes.
ResetEntities_Pool 56878 LD (IX+0),0 Free the entity.
56882 SET 7,(IX+1) Hide the entity.
56886 ADD IX,DE Move on to the next entity.
56888 DJNZ ResetEntities_Pool Repeat for the remaining entities.
56890 LD IX,46856 Start at the first extra record.
56894 LD B,12 There are 12 extra records.
56896 LD DE,13 Each record is 13 bytes.
ResetEntities_Records 56899 LD (IX+9),0 Mark the extra record as free.
56903 ADD IX,DE Move on to the next record.
56905 DJNZ ResetEntities_Records Repeat for the remaining records.
56907 LD DE,46400 The player is the destination.
56910 LD BC,38 The template is 38 bytes.
56913 LD HL,56951 The template is the source.
56916 LDIR Copy the template over the player.
56918 XOR A Clear the jump counter.
56919 LD (23808),A
ResetEntities_Player 56922 LD IX,46400 Use the player.
56926 LD A,(57084) Read the bottle flag.
56929 AND A Measure the sprite when the flag is clear.
56930 JP Z,SetEntitySize
56933 LD A,(46428) Read the player's animation counter.
56936 AND %11110000 Use the high nibble of the animation.
56938 OR %00000101 Set the low nibble to 5.
56940 LD (46428),A Keep that animation.
56943 LD A,5 Set the control byte to 5.
56945 LD (43901),A
56948 JP SetEntitySize Measure the sprite.
Prev: 56819 Up: Map Next: 56951