Prev: 28845 Up: Map Next: 28878
28850: Prepare Old Sprite
Used by the routines at DisplayEntity and RemoveEntity.
Prepares to erase the sprite of an actor from where it was last drawn, using the old state held in the actor buffer at Actor_Position_X. Points DE to the sprite data, HL to the screen address, stores the pixel shift in OldSpriteShift and the number of lines to erase in CurrentSpriteHeight.
Output
DE Sprite data (after the height)
HL Screen address of the bottom left of the sprite
C 0
PrepareOldSprite 28850 CALL FetchSprite Call FetchSprite to fetch the sprite.
28853 LD HL,(24096) Fetch the old position of the sprite (Actor_Position_X).
28856 LD A,L A=L.
28857 NEG Make A negative.
28859 AND %00000111 Keep only bits 0-2.
28861 LD (24128),A Write the pixel shift to OldSpriteShift.
28864 CALL GetVisibleHeight Work out how many lines can be drawn using GetVisibleHeight.
28867 CALL ScreenAddress Convert the position into a screen address using ScreenAddress.
28870 LD A,(DE) Fetch the height of the sprite.
28871 CP C Jump to PrepareOldSprite_Rows if the height is no more than the number of lines that can be drawn.
28872 JR C,PrepareOldSprite_Rows
28874 LD A,C Use the number of lines that can be drawn, as the sprite is too tall.
PrepareOldSprite_Rows 28875 LD (24101),A Write the number of lines to CurrentSpriteHeight.
View the equivalent code in;
Continue on to NextSprite.
Prev: 28845 Up: Map Next: 28878