![]() |
Routines |
| Prev: 47465 | Up: Map | Next: 47563 |
|
Moves an entity on the screen, by erasing the sprite at its old position (saved by StoreEntity) and drawing it at its new one.
Both sprites are drawn with XOR, a row at a time, so that the rows are alternated between the two sprites and the screen is never without the sprite for long. If the sprites are offset vertically, the rows of the sprite that has no matching row in the other one are drawn first.
|
||||||||||||
| DisplayEntity | 47529 | CALL PrepDraw2 | Prepare the registers for the sprite at its new position. | |||||||||
| 47532 | EXX | Switch to the registers of the old sprite. | ||||||||||
| 47533 | CALL PrepDraw23 | Prepare the registers for the sprite at its old position. | ||||||||||
| 47536 | LD A,(38561) | Fetch the old Y position from Previous_Y_Position. | ||||||||||
| 47539 | SUB (IX+4) | Subtract the new Y position of the entity. | ||||||||||
| 47542 | JP Z,XORSpriteLoop_Reload | Jump to XORSpriteLoop_Reload if the Y position has not changed. | ||||||||||
| 47545 | JP M,DisplayEntity_NewLower | Jump to DisplayEntity_NewLower if the sprite has moved down the screen. | ||||||||||
|
The old sprite is lower than the new one, so draw the bottom rows of the old sprite on their own first.
|
||||||||||||
| 47548 | LD C,A | Copy the number of rows that stand alone to C. | ||||||||||
| 47549 | LD A,(38563) | Fetch the number of rows of the old sprite from Old_Sprite_Row_Count. | ||||||||||
| 47552 | CP C | Compare it with the number of rows that stand alone. | ||||||||||
| 47553 | JP C,XORSpriteLoop_Reload | Jump to XORSpriteLoop_Reload if the old sprite has no more rows than that, so that the sprites do not overlap and are each drawn in full. | ||||||||||
| 47556 | SUB C | Subtract the number of rows that stand alone. | ||||||||||
| 47557 | LD (38563),A | Write the number of rows that remain to Old_Sprite_Row_Count. | ||||||||||
| 47560 | JP XORSpriteLoop | Jump to XORSpriteLoop to draw those rows of the old sprite on their own. | ||||||||||
| Prev: 47465 | Up: Map | Next: 47563 |