![]() |
Routines |
| Prev: 70D2 | Up: Map | Next: 7139 |
|
Erases the sprite of an actor from where it was last drawn (the old state held in the actor buffer at Actor_Position_X) and draws it at its new position. Both sprites are handled a line at a time by MaskSprite, but if the old and the new Y positions are different then the lines of one sprite that stick out below the other are handled first.
|
||||||||||||
| DisplayEntity | 7101 | LD A,($5E22) | Fetch the sprite ID of the old sprite (Actor_SpriteID). | |||||||||
| 7104 | AND A | Jump to DrawEntity if there is no old sprite, as there is nothing to erase. | ||||||||||
| 7105 | JP Z,DrawEntity | |||||||||||
| 7108 | CALL PrepareActorSprite | Call PrepareActorSprite to prepare the new sprite. | ||||||||||
| 710B | EXX | Switch to the shadow registers (to keep the new sprite). | ||||||||||
| 710C | CALL PrepareOldSprite | Call PrepareOldSprite to prepare the old sprite. | ||||||||||
| 710F | LD A,($5E21) | A=Actor_Position_Y (the old Y position). | ||||||||||
| 7112 | SUB (IX+$02) | Subtract the new Y position. | ||||||||||
| 7115 | JP Z,ActorUpdateSize | Jump to ActorUpdateSize if the old and new Y positions are the same. | ||||||||||
| 7118 | JP M,DisplayEntity_NewLower | Jump to DisplayEntity_NewLower if the new sprite is lower down than the old sprite. | ||||||||||
| 711B | LD C,A | C=the number of lines that the old sprite sticks out below the new sprite. | ||||||||||
| 711C | LD A,($5E25) | A=CurrentSpriteHeight (the number of lines in the old sprite). | ||||||||||
| 711F | CP C | Jump to ActorUpdateSize if the old sprite has fewer lines than this. | ||||||||||
| 7120 | JP C,ActorUpdateSize | |||||||||||
| 7123 | SUB C | Subtract the lines that stick out. | ||||||||||
| 7124 | LD ($5E25),A | Write the number of lines left to CurrentSpriteHeight. | ||||||||||
| 7127 | JP MaskSprite | Jump to MaskSprite to erase the lines that stick out. | ||||||||||
|
The new sprite is lower down, so it has some lines to draw before any lines are erased.
|
||||||||||||
| DisplayEntity_NewLower | 712A | EXX | Switch to the shadow registers (the new sprite). | |||||||||
| 712B | NEG | Make the result positive. | ||||||||||
| 712D | LD C,A | C=the number of lines that the new sprite sticks out below the old sprite. | ||||||||||
| 712E | LD A,($5E26) | A=HeightLines (the number of lines in the new sprite). | ||||||||||
| 7131 | CP C | Jump to ActorUpdateSizeFlipReg if the new sprite has fewer lines than this. | ||||||||||
| 7132 | JP C,ActorUpdateSizeFlipReg | |||||||||||
| 7135 | SUB C | Subtract the lines that stick out. | ||||||||||
| 7136 | JP ActorUpdateHeightAndMask | Jump to ActorUpdateHeightAndMask to store the number of lines left and to draw the lines that stick out. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 70D2 | Up: Map | Next: 7139 |