Prev: 70AD Up: Map Next: 70CE
70B2: 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 00
PrepareOldSprite 70B2 CALL FetchSprite Call FetchSprite to fetch the sprite.
70B5 LD HL,($5E20) Fetch the old position of the sprite (Actor_Position_X).
70B8 LD A,L A=L.
70B9 NEG Make A negative.
70BB AND %00000111 Keep only bits 0-2.
70BD LD ($5E40),A Write the pixel shift to OldSpriteShift.
70C0 CALL GetVisibleHeight Work out how many lines can be drawn using GetVisibleHeight.
70C3 CALL ScreenAddress Convert the position into a screen address using ScreenAddress.
70C6 LD A,(DE) Fetch the height of the sprite.
70C7 CP C Jump to PrepareOldSprite_Rows if the height is no more than the number of lines that can be drawn.
70C8 JR C,PrepareOldSprite_Rows
70CA LD A,C Use the number of lines that can be drawn, as the sprite is too tall.
PrepareOldSprite_Rows 70CB LD ($5E25),A Write the number of lines to CurrentSpriteHeight.
View the equivalent code in;
Continue on to NextSprite.
Prev: 70AD Up: Map Next: 70CE