![]() |
Routines |
| Prev: 35560 | Up: Map | Next: 35666 |
|
Convert the actor's world position into a screen column. If it is on screen, work out the pixel shift, the screen address and the sprite size, and cache them on the actor.
|
||||||||
| PositionMaskSprite | 35575 | LD L,(IX+2) | Fetch the actor's world X position. | |||||
| 35578 | LD H,(IX+3) | |||||||
| 35581 | LD BC,(24698) | Subtract the scroll position at Jetman_Position. | ||||||
| 35585 | AND A | |||||||
| 35586 | SBC HL,BC | |||||||
| 35588 | LD BC,120 | Add the 0120 draw offset. | ||||||
| 35591 | ADD HL,BC | |||||||
| 35592 | LD A,H | Fetch the high byte of the screen column. | ||||||
| 35593 | AND %00011111 | Keep only bits 0-4. | ||||||
| 35595 | JP NZ,ResetSpriteFields | Jump to ResetSpriteFields if the actor is off-screen. | ||||||
| 35598 | LD (IX+1),L | Store the screen column in *IX+1. | ||||||
|
Look up the sprite graphic and work out the pixel shift from the screen column.
|
||||||||
| 35601 | CALL FetchActorSprite | Call FetchActorSprite. | ||||||
| 35604 | LD L,(IX+1) | Fetch the screen column and actor Y. | ||||||
| 35607 | LD H,(IX+4) | |||||||
| 35610 | LD A,L | Build a pixel-shift index from the column. | ||||||
| 35611 | DEC A | |||||||
| 35612 | AND %00000111 | Keep only bits 0-2. | ||||||
| 35614 | CP 7 | Jump to PositionMaskSprite_StoreShift if the shift is not 7. | ||||||
| 35616 | JR NZ,PositionMaskSprite_StoreShift | |||||||
| 35618 | LD A,242 | Set the shift operand to 242. | ||||||
| PositionMaskSprite_StoreShift | 35620 | LD (35537),A | Write the shift to 35537 and *IX+9. | |||||
| 35623 | LD (IX+9),A | |||||||
|
Choose the scratch width for the shift.
|
||||||||
| 35626 | LD A,1 | Set the scratch width to 1. | ||||||
| 35628 | JR Z,PositionMaskSprite_StoreWidth | Jump to PositionMaskSprite_StoreWidth if the shift was 7. | ||||||
| 35630 | INC A | Widen the scratch width to 2. | ||||||
| PositionMaskSprite_StoreWidth | 35631 | LD (24151),A | Write the scratch width and cache the actor Y. | |||||
| 35634 | LD (IX+11),H | |||||||
|
Work out the screen address, then cache the sprite size and pointers on the actor.
|
||||||||
| 35637 | CALL ScreenAddress | Call ScreenAddress. | ||||||
| 35640 | LD A,(DE) | Copy the sprite height into SpriteRowsLeft, SpriteHeight and *IX+10. | ||||||
| 35641 | INC DE | |||||||
| 35642 | LD (24153),A | |||||||
| 35645 | LD (24152),A | |||||||
| 35648 | LD (IX+10),A | |||||||
| 35651 | LD (IX+12),E | Cache the graphic pointer and screen address on the actor. | ||||||
| 35654 | LD (IX+13),D | |||||||
| 35657 | LD (IX+14),L | |||||||
| 35660 | LD (IX+15),H | |||||||
| 35663 | LD C,0 | Clear the row counter. | ||||||
| 35665 | RET | Return. | ||||||
| Prev: 35560 | Up: Map | Next: 35666 |