Prev: 30144 Up: Map Next: 30205
30156: Display Entity
Erases the sprite from the position recorded by StoreEntity and draws it at the new position held by the actor. The old and the new sprite are processed together so that the screen lines which they share are updated in step.
Input
IX Actor
sprite-move-before sprite-move-after
DisplayEntity 30156 CALL PrepareActorSprite Prepare the actor sprite using PrepareActorSprite.
30159 EXX Switch to the shadow registers.
30160 CALL PrepareOldSprite Prepare the old sprite using PrepareOldSprite.
Compare the vertical position of the old sprite with the new one.
DisplayEntity_Compare 30163 LD A,(24341) Fetch the vertical co-ordinate of the old sprite (OldSprite_Y).
30166 SUB (IX+2) Subtract the new vertical co-ordinate.
30169 JP Z,XORSpriteLoop_Remaining Jump to XORSpriteLoop_Remaining if they are the same.
30172 JP M,DisplayEntity_NewLower Jump to DisplayEntity_NewLower if the new sprite is lower down the screen.
The old sprite is lower down. Draw the rows of it which the new sprite does not cover first.
30175 LD C,A Keep the number of rows in C.
30176 LD A,(24345) Fetch the sprite rows remaining.
30179 CP C Compare with the number of rows.
30180 JP C,XORSpriteLoop_Remaining Jump to XORSpriteLoop_Remaining if the sprites do not overlap.
30183 SUB C Subtract the rows which are about to be drawn.
30184 LD (24345),A Update the number of rows remaining for the old sprite (OldSprite_RowsRemaining).
30187 JP XORSpriteLoop Jump to XORSpriteLoop.
The new sprite is lower down. Draw the rows of it which the old sprite does not cover first.
DisplayEntity_NewLower 30190 EXX Switch to the shadow registers.
30191 NEG Make the number of rows positive.
30193 LD C,A Keep the number of rows in C.
30194 LD A,(24346) Fetch the number of rows remaining for the actor sprite (ActorSprite_RowsRemaining).
30197 CP C Compare with the number of rows.
30198 JP C,XORSpriteLoop_Restore Jump to XORSpriteLoop_Restore if the sprites do not overlap.
30201 SUB C Subtract the rows which are about to be drawn.
30202 JP XORSpriteLoop_Continue Jump to XORSpriteLoop_Continue.
Prev: 30144 Up: Map Next: 30205