![]() |
Routines |
| Prev: 34431 | Up: Map | Next: 34561 |
|
Convert the actor's world position into a screen column relative to Jetman_Position, then fetch its sprite.
|
||||||||
|
Convert the actor world X into a screen column.
|
||||||||
| PositionSprite | 34465 | LD L,(IX+2) | Fetch the actor's world X position. | |||||
| 34468 | LD H,(IX+3) | |||||||
| 34471 | LD BC,120 | Add the 0120 draw offset. | ||||||
| 34474 | ADD HL,BC | |||||||
| 34475 | LD BC,(24698) | Fetch the scroll position from Jetman_Position. | ||||||
| 34479 | AND A | Subtract the scroll position. | ||||||
| 34480 | SBC HL,BC | |||||||
| 34482 | LD A,H | Fetch the high byte of the screen column. | ||||||
| 34483 | AND %00011111 | Keep only bits 0-4. | ||||||
| 34485 | JR NZ,ResetSpriteFields | Jump to ResetSpriteFields if the actor is off-screen. | ||||||
| 34487 | LD A,L | Jump to ResetSpriteFields if the column is at least 240. | ||||||
| 34488 | CP 240 | |||||||
| 34490 | JR NC,ResetSpriteFields | |||||||
|
Store the column and look up the actor sprite.
|
||||||||
| 34492 | LD (IX+1),L | Store the screen column in *IX+1. | ||||||
| 34495 | CALL FetchActorSprite | Call FetchActorSprite. | ||||||
|
Build the pixel-shift index from the column.
|
||||||||
| PositionSprite_Apply | 34498 | LD L,(IX+1) | Fetch the screen column and actor Y. | |||||
| 34501 | LD H,(IX+4) | |||||||
| 34504 | LD A,L | Build a pixel-shift index from the column. | ||||||
| 34505 | DEC A | |||||||
| 34506 | RLCA | |||||||
| 34507 | AND %00001110 | Keep only bits 1-3. | ||||||
| 34509 | CP 14 | Jump to PositionSprite_StoreShift if the shift is not 14. | ||||||
| 34511 | JR NZ,PositionSprite_StoreShift | |||||||
| 34513 | LD A,232 | Set the shift operand to 232. | ||||||
|
Store the pixel shift for the sprite drawing code.
|
||||||||
| PositionSprite_StoreShift | 34515 | LD (34333),A | Write the shift to 34333 and *IX+9. | |||||
| 34518 | LD (IX+9),A | |||||||
|
Choose the scratch width from the shift.
|
||||||||
| 34521 | LD A,2 | Set the scratch width to 2. | ||||||
| 34523 | JR Z,PositionSprite_StoreWidth | Jump to PositionSprite_StoreWidth if the shift was 14. | ||||||
| 34525 | INC A | Widen the scratch width to 3. | ||||||
| PositionSprite_StoreWidth | 34526 | LD (24151),A | Write the scratch width and cache the actor Y. | |||||
| 34529 | LD (IX+11),H | |||||||
|
Work out the screen address, then cache the sprite details on the actor.
|
||||||||
| 34532 | CALL ScreenAddress | Call ScreenAddress. | ||||||
| 34535 | LD A,(DE) | Copy the sprite height into SpriteRowsLeft, SpriteHeight and *IX+10. | ||||||
| 34536 | INC DE | |||||||
| 34537 | LD (24153),A | |||||||
| 34540 | LD (24152),A | |||||||
| 34543 | LD (IX+10),A | |||||||
| 34546 | LD (IX+12),E | Cache the graphic pointer and screen address on the actor. | ||||||
| 34549 | LD (IX+13),D | |||||||
| 34552 | LD (IX+14),L | |||||||
| 34555 | LD (IX+15),H | |||||||
| 34558 | LD C,0 | Clear the row counter. | ||||||
| 34560 | RET | Return. | ||||||
| Prev: 34431 | Up: Map | Next: 34561 |