![]() |
Routines |
| Prev: 70CE | Up: Map | Next: 7101 |
|
Used by the routines at DisplayEntity and DrawEntity.
Prepares to draw the sprite of an actor at its new position. Points DE to the sprite data and HL to the screen address, stores the pixel shift in NewSpriteShift, the width in bytes in WidthBytes and the number of lines to draw in HeightLines and HeightPixels.
|
||||||||||||||||
| PrepareActorSprite | 70D2 | CALL FetchActorSprite | Call FetchActorSprite to fetch the sprite. | |||||||||||||
| PrepareActorSprite_Position | 70D5 | LD L,(IX+$01) | L=X position of the actor. | |||||||||||||
| 70D8 | LD H,(IX+$02) | H=Y position of the actor. | ||||||||||||||
|
This entry point is used by the routines at DisplayCupsCollected and DisplayPlayerLives.
|
||||||||||||||||
| PrepareActorSprite_Shift | 70DB | LD A,L | A=L. | |||||||||||||
| 70DC | NEG | Make A negative. | ||||||||||||||
| 70DE | AND %00000111 | Keep only bits 0-2. | ||||||||||||||
| 70E0 | LD ($5E41),A | Write the pixel shift to NewSpriteShift. | ||||||||||||||
| 70E3 | LD A,$02 | Set the width of the sprite in bytes, 02. | ||||||||||||||
| 70E5 | JR Z,PrepareActorSprite_Width | Jump to PrepareActorSprite_Width if the sprite is not shifted. | ||||||||||||||
| 70E7 | INC A | Increment A by one (a shifted sprite is one byte wider). | ||||||||||||||
| PrepareActorSprite_Width | 70E8 | LD ($5E24),A | Write the width to WidthBytes. | |||||||||||||
| 70EB | LD ($5E27),HL | Write the position to ActorScreenPosition. | ||||||||||||||
| 70EE | CALL GetVisibleHeight | Work out how many lines can be drawn using GetVisibleHeight. | ||||||||||||||
| 70F1 | CALL ScreenAddress | Convert the position into a screen address using ScreenAddress. | ||||||||||||||
| 70F4 | LD A,(DE) | Fetch the height of the sprite. | ||||||||||||||
| 70F5 | CP C | Jump to PrepareActorSprite_Rows if the height is no more than the number of lines that can be drawn. | ||||||||||||||
| 70F6 | JR C,PrepareActorSprite_Rows | |||||||||||||||
| 70F8 | LD A,C | Use the number of lines that can be drawn, as the sprite is too tall. | ||||||||||||||
| PrepareActorSprite_Rows | 70F9 | LD ($5E26),A | Write the number of lines to HeightLines. | |||||||||||||
| 70FC | LD ($5E23),A | Write the number of lines to HeightPixels. | ||||||||||||||
| 70FF | JR NextSprite | Jump to NextSprite. | ||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||
| Prev: 70CE | Up: Map | Next: 7101 |