![]() |
Routines |
| Prev: 29839 | Up: Map | Next: 29980 |
|
Used by the routine at DrawSprite.
Sprites are drawn by erasing the previous image and drawing the new one at the same time, a row at a time. The routines from here to DisplayEntity_Compare prepare the two images: the main registers hold one sprite and the shadow registers hold the other. Each is set up with the screen address in HL, the sprite width in B, a row count of zero in C and the sprite data pointer in DE.
This entry point finds the previous sprite from the temporary actor state at Actor, using PrepareOldSprite to get its graphic.
|
||||||||||
| SetUpPreviousSprite | 29861 | CALL PrepareOldSprite | Call PrepareOldSprite. | |||||||
|
This entry point is used by the routines at UpdateBloomingFlower, UpdateStreamer, UpdateLeaf and DrawSprite.
Sets up the previous sprite using the sprite data address in DE, rather than looking it up.
|
||||||||||
| SetUpPreviousSprite_Address | 29864 | LD HL,(24075) | Fetch the previous X and Y position from Actor. | |||||||
|
This entry point is used by the routine at AnimateExplosion.
The first byte of the sprite is a horizontal offset in pixels.
|
||||||||||
| SetUpPreviousSprite_Offset | 29867 | LD A,(DE) | Fetch the horizontal offset. | |||||||
| 29868 | INC DE | Move onto the sprite width. | ||||||||
| 29869 | ADD A,L | Add the horizontal offset to the X position. | ||||||||
| 29870 | LD L,A | Store the result back in L. | ||||||||
| 29871 | CALL ScreenAddress | Convert the position into a screen address using ScreenAddress. | ||||||||
| 29874 | LD A,(DE) | Fetch the sprite width. | ||||||||
| 29875 | LD B,A | Set the width counter in B to the sprite width. | ||||||||
| 29876 | INC DE | Move onto the sprite height. | ||||||||
| 29877 | LD A,(DE) | Fetch the sprite height. | ||||||||
| 29878 | LD (24080),A | Store it in 24080 as the height of the previous sprite. | ||||||||
| SetUpSprite_Finish | 29881 | LD C,0 | Set the row count in C to 0 (no rows have been drawn yet). | |||||||
| 29883 | INC DE | Move onto the first byte of the sprite graphic data. | ||||||||
| 29884 | RET | Return. | ||||||||
|
This entry point is used by the routine at DrawSprite.
Sets up the sprite of the actor in IX, using ActorMoveSprite to get its graphic.
|
||||||||||
| SetUpSprite | 29885 | CALL ActorMoveSprite | Call ActorMoveSprite. | |||||||
|
This entry point is used by the routines at UpdateBloomingFlower, UpdateStreamer, UpdateLeaf and DrawSprite.
Sets up the sprite using the sprite data address in DE, at the position held in the actor object.
|
||||||||||
| SetUpSprite_Address | 29888 | LD L,(IX+1) | Fetch the X and Y position from *IX+1 and *IX+2. | |||||||
| 29891 | LD H,(IX+2) | |||||||||
|
This entry point is used by the routine at DrawCubbyHoleItem.
|
||||||||||
| SetUpSprite_Offset | 29894 | LD A,(DE) | Fetch the horizontal offset. | |||||||
| 29895 | INC DE | Move onto the sprite width. | ||||||||
| 29896 | ADD A,L | Add the horizontal offset to the X position. | ||||||||
| 29897 | LD L,A | Store the result back in L. | ||||||||
| 29898 | LD (24090),HL | Store the screen position in SpritePosition. | ||||||||
| 29901 | CALL ScreenAddress | Convert the position into a screen address using ScreenAddress. | ||||||||
| 29904 | LD A,(DE) | Fetch the sprite width. | ||||||||
| 29905 | LD B,A | Set the width counter in B to the sprite width. | ||||||||
| 29906 | LD (24079),A | Store it in NewSprite_Width. | ||||||||
| 29909 | INC DE | Move onto the sprite height. | ||||||||
| 29910 | LD A,(DE) | Fetch the sprite height. | ||||||||
| 29911 | LD (24081),A | Store it in 24081 as the height of the new sprite. | ||||||||
| 29914 | LD (24078),A | Store it in 24078. | ||||||||
| 29917 | JR SetUpSprite_Finish | Jump to SetUpSprite_Finish. | ||||||||
|
This entry point is used by the routine at UpdateFlower.
Moves a sprite using the same sprite data in DE for both the previous image (erased) and the new image (drawn).
|
||||||||||
| ReplaceSprite | 29919 | PUSH DE | Stash the sprite data pointer on the stack. | |||||||
| 29920 | CALL SetUpPreviousSprite_Address | Set up the previous sprite using SetUpPreviousSprite_Address. | ||||||||
| 29923 | EXX | Switch to the shadow registers. | ||||||||
| 29924 | POP DE | Restore the sprite data pointer from the stack. | ||||||||
| 29925 | CALL SetUpSprite_Address | Set up the new sprite using SetUpSprite_Address. | ||||||||
| 29928 | EXX | Switch to the shadow registers. | ||||||||
| 29929 | JR DisplayEntity_Compare | Jump to DisplayEntity_Compare. | ||||||||
|
Display Entity. Erases the previous sprite of the actor in IX and draws the new one.
|
||||||||||
| DisplayEntity | 29931 | CALL SetUpSprite | Set up the new sprite using SetUpSprite. | |||||||
| 29934 | EXX | Switch to the shadow registers. | ||||||||
| 29935 | CALL SetUpPreviousSprite | Set up the previous sprite using SetUpPreviousSprite. | ||||||||
|
Work out how many rows of one sprite lie beyond the other.
|
||||||||||
| DisplayEntity_Compare | 29938 | LD A,(24076) | Fetch the previous Y position from 24076. | |||||||
| 29941 | SUB (IX+2) | Subtract the new Y position. | ||||||||
| 29944 | JP Z,MaskSprite_Finish_Previous | Jump to MaskSprite_Finish_Previous if the two sprites start on the same row. | ||||||||
| 29947 | JP M,DisplayEntity_NewLower | Jump to DisplayEntity_NewLower if the new sprite starts lower down the screen. | ||||||||
| 29950 | LD C,A | Store the number of extra rows in C. | ||||||||
| 29951 | LD A,(24080) | Fetch the height of the previous sprite from 24080. | ||||||||
| 29954 | CP C | Compare it with the number of extra rows. | ||||||||
| 29955 | JP C,MaskSprite_Finish_Previous | Jump to MaskSprite_Finish_Previous if the sprites do not overlap. | ||||||||
| 29958 | SUB C | Subtract the extra rows from the height of the previous sprite. | ||||||||
| 29959 | LD (24080),A | Write it back to 24080. | ||||||||
| 29962 | JP MaskSprite | Jump to MaskSprite to erase the extra rows of the previous sprite first. | ||||||||
|
The new sprite starts lower down the screen, so its extra rows are drawn first.
|
||||||||||
| DisplayEntity_NewLower | 29965 | EXX | Switch to the shadow registers. | |||||||
| 29966 | NEG | Make the number of extra rows positive. | ||||||||
| 29968 | LD C,A | Store the number of extra rows in C. | ||||||||
| 29969 | LD A,(24081) | Fetch the height of the new sprite from 24081. | ||||||||
| 29972 | CP C | Compare it with the number of extra rows. | ||||||||
| 29973 | JP C,MaskSprite_Finish | Jump to MaskSprite_Finish if the sprites do not overlap. | ||||||||
| 29976 | SUB C | Subtract the extra rows from the height of the new sprite. | ||||||||
| 29977 | JP MaskSprite_Finish_ClearNew | Jump to MaskSprite_Finish_ClearNew. | ||||||||
| Prev: 29839 | Up: Map | Next: 29980 |