![]() |
Routines |
| Prev: 8807 | Up: Map | Next: 8891 |
|
Look up the actor sprite, clip it against the left and right screen edges, and cache its graphic pointer and screen address on the actor.
|
||||||||
|
Look up the actor sprite and test whether it is on-screen.
|
||||||||
| FetchAndDraw | 8826 | CALL FetchActorSprite | Call FetchActorSprite. | |||||
| 8829 | LD L,(IX+$02) | Fetch the actor's world X position. | ||||||
| 882C | LD H,(IX+$03) | |||||||
| 882F | LD BC,($607A) | Subtract the scroll position at Jetman_Position. | ||||||
| 8833 | AND A | |||||||
| 8834 | SBC HL,BC | |||||||
| 8836 | LD BC,$0068 | Add the 0068 draw offset. | ||||||
| 8839 | ADD HL,BC | |||||||
| 883A | LD A,H | Fetch the high byte of the screen column. | ||||||
| 883B | AND %00011111 | Keep only bits 0-4. | ||||||
| 883D | JR Z,ReadSpriteHeader | Jump to ReadSpriteHeader if the actor is on-screen. | ||||||
| 883F | ADD A,$E1 | Jump to ClearSpriteCache if the column is not 1F. | ||||||
| 8841 | JR NZ,ClearSpriteCache | |||||||
|
Clip a sprite that straddles the left edge.
|
||||||||
| 8843 | LD A,L | Arithmetic-shift the column down by three. | ||||||
| 8844 | SRA A | |||||||
| 8846 | SRA A | |||||||
| 8848 | SRA A | |||||||
| 884A | JP P,ClearSpriteCache | Jump to ClearSpriteCache if the result is positive. | ||||||
| 884D | LD B,A | Store the shifted column. | ||||||
| 884E | AND %00001111 | Keep only bits 0-3. | ||||||
| 8850 | LD ($87EE),A | Write the skip to 87EE and *IX+09. | ||||||
| 8853 | LD (IX+$09),A | |||||||
|
Work out how much of the sprite width is visible and cache the visible width and height.
|
||||||||
| 8856 | LD A,(DE) | Fetch the sprite width and add the shifted column. | ||||||
| 8857 | INC DE | |||||||
| 8858 | LD C,A | |||||||
| 8859 | ADD A,B | |||||||
| 885A | JP M,ClearSpriteCache | Jump to ClearSpriteCache if that sum is zero or negative. | ||||||
| 885D | JR Z,ClearSpriteCache | |||||||
| 885F | LD B,A | Copy the visible width into B. | ||||||
| 8860 | LD ($5E57),A | Write the visible width to SpriteWidth and *IX+0B. | ||||||
| 8863 | LD (IX+$0B),A | |||||||
| 8866 | LD A,(DE) | Copy the next header byte into SpriteRowsLeft, SpriteHeight and *IX+0A. | ||||||
| 8867 | INC DE | |||||||
| 8868 | LD ($5E59),A | |||||||
| 886B | LD ($5E58),A | |||||||
| 886E | LD (IX+$0A),A | |||||||
|
Skip the graphic bytes hidden off the left edge.
|
||||||||
| 8871 | LD A,C | A=width-visible width (the bytes hidden on the left). | ||||||
| 8872 | SUB B | |||||||
| FetchAndDraw_Loop | 8873 | INC DE | Skip graphic bytes until the visible strip starts. | |||||
| 8874 | DEC A | |||||||
| 8875 | JR NZ,FetchAndDraw_Loop | |||||||
| 8877 | LD L,$00 | Set the screen column to 00. | ||||||
|
Cache the visible strip and draw it.
|
||||||||
| FetchAndDraw_StoreColumn | 8879 | LD (IX+$01),L | Store the screen column. | |||||
| 887C | LD H,(IX+$04) | Fetch the actor Y. | ||||||
| 887F | CALL ScreenAddress | Call ScreenAddress. | ||||||
| 8882 | LD (IX+$0C),E | Cache the graphic pointer and screen address on the actor. | ||||||
| 8885 | LD (IX+$0D),D | |||||||
| 8888 | LD (IX+$0E),L | |||||||
| 888B | LD (IX+$0F),H | |||||||
| 888E | LD C,$00 | Clear the row counter. | ||||||
| 8890 | RET | Return. | ||||||
| Prev: 8807 | Up: Map | Next: 8891 |