Prev: DDF3 Up: Map Next: DE77
DE25: 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 05. SetEntitySize then measures the sprite.
ResetEntities DE25 LD IX,$B566 Start at the first entity after the player.
DE29 LD B,$0B There are 0B entities besides the player.
DE2B LD DE,$0026 Each entity is 26 bytes.
ResetEntities_Pool DE2E LD (IX+$00),$00 Free the entity.
DE32 SET 7,(IX+$01) Hide the entity.
DE36 ADD IX,DE Move on to the next entity.
DE38 DJNZ ResetEntities_Pool Repeat for the remaining entities.
DE3A LD IX,$B708 Start at the first extra record.
DE3E LD B,$0C There are 0C extra records.
DE40 LD DE,$000D Each record is 0D bytes.
ResetEntities_Records DE43 LD (IX+$09),$00 Mark the extra record as free.
DE47 ADD IX,DE Move on to the next record.
DE49 DJNZ ResetEntities_Records Repeat for the remaining records.
DE4B LD DE,$B540 The player is the destination.
DE4E LD BC,$0026 The template is 26 bytes.
DE51 LD HL,$DE77 The template is the source.
DE54 LDIR Copy the template over the player.
DE56 XOR A Clear the jump counter.
DE57 LD ($5D00),A
ResetEntities_Player DE5A LD IX,$B540 Use the player.
DE5E LD A,($DEFC) Read the bottle flag.
DE61 AND A Measure the sprite when the flag is clear.
DE62 JP Z,SetEntitySize
DE65 LD A,($B55C) Read the player's animation counter.
DE68 AND %11110000 Use the high nibble of the animation.
DE6A OR %00000101 Set the low nibble to 05.
DE6C LD ($B55C),A Keep that animation.
DE6F LD A,$05 Set the control byte to 05.
DE71 LD ($AB7D),A
DE74 JP SetEntitySize Measure the sprite.
Prev: DDF3 Up: Map Next: DE77