Prev: 40778 Up: Map Next: 40820
40790: Remove Entity
Removes the image of an entity that was saved by StoreEntity, by drawing it again (sprites are XORed onto the screen).
Input
IX The entity
Before After
remove-entity-before remove-entity-after
RemoveEntity 40790 CALL PrepDraw23 Prepare the old sprite with PrepDraw23.
RemoveEntity_Prepared 40793 EXX Switch to the shadow registers.
40794 XOR A A=0.
40795 LD C,A Keep zero as the number of rows of the new sprite in C.
40796 LD (24089),A Update the number of new sprite rows in New_Sprite_Row_Count.
40799 LD A,(24088) Fetch the number of old sprite rows from Old_Sprite_Row_Count.
40802 LD (24081),A Update the sprite height in SpriteHeight.
Work out the width of the sprite in bytes. The code uses L from the shadow registers, which holds whatever an earlier routine left there.
40805 LD A,L A=L.
40806 AND %00000111 Keep only bits 0-2.
40808 LD A,2 A=2.
40810 JR Z,RemoveEntity_Width Jump to RemoveEntity_Width if bits 0-2 were zero.
40812 INC A A=3.
RemoveEntity_Width 40813 LD (24080),A Write the width to SpriteWidth.
40816 EXX Switch to the normal registers.
40817 JP XORSpriteLoop Jump to XORSpriteLoop to draw the sprites onto the screen.
View the equivalent code in;
Prev: 40778 Up: Map Next: 40820