![]() |
Routines |
| Prev: D904 | Up: Map | Next: DA15 |
|
Used by the routine at Dispatch_Handlers.
Two balls in room 07 stored at SpecialActor.
|
|||||
|
Return unless this is room 07.
|
|||||
| Handler_RoomSeven | D9B6 | LD IX,$644D | Point IX at SpecialActor. | ||
| D9BA | LD A,($64A2) | Return if *CurrentRoom is not 07. | |||
| D9BD | CP $07 | ||||
| D9BF | RET NZ | ||||
|
Clip drawing to a maximum row of 0E.
|
|||||
| D9C0 | LD A,$0E | Write 0E to *ClipWindow_MaximumRow. | |||
| D9C2 | LD ($641A),A | ||||
| D9C5 | LD B,$02 | Set the ball count to 02. | |||
|
Process each ball.
|
|||||
| Handler_RoomSeven_Loop | D9C7 | PUSH BC | Stash the ball count on the stack. | ||
|
Draw the ball if it is already active.
|
|||||
| D9C8 | LD A,(IX+$00) | Jump to Handler_RoomSeven_Move if this ball is already active. | |||
| D9CB | BIT 7,A | ||||
| D9CD | JR Z,Handler_RoomSeven_Move | ||||
|
Spawn on a random roll.
|
|||||
| D9CF | CALL JumpTable_GetRandomNumber | Jump to Handler_RoomSeven_Next if the random number is BE or higher. | |||
| D9D2 | CP $BE | ||||
| D9D4 | JR NC,Handler_RoomSeven_Next | ||||
|
|
|||||
| D9D6 | AND %00001111 | Keep only bits 0-3. | |||
| D9D8 | ADD A,$09 | Spawn the ball at row 19 column 09-18 sprite E7, colour YELLOW (BRIGHT) and size 01 by 01. | |||
| D9DA | LD C,A | ||||
| D9DB | LD B,$19 | ||||
| D9DD | LD DE,$0101 | ||||
| D9E0 | LD L,$46 | ||||
| D9E2 | LD A,$E7 | ||||
| D9E4 | CALL JumpTable_SpawnEntity | ||||
| D9E7 | LD (IX+$09),$FA | Write FA as the vertical delta. | |||
|
Hide the ball once it has reached row 0C.
|
|||||
| Handler_RoomSeven_Move | D9EB | LD A,(IX+$01) | Deactivate the ball if it has reached row 0C. | ||
| D9EE | CP $0C | ||||
| D9F0 | JR NZ,Handler_RoomSeven_Draw | ||||
| D9F2 | SET 7,(IX+$00) | ||||
| D9F6 | JR Handler_RoomSeven_Next | Jump to Handler_RoomSeven_Next. | |||
|
Store, move, draw and erase the ball.
|
|||||
| Handler_RoomSeven_Draw | D9F8 | CALL JumpTable_AdvanceEntity | Call JumpTable_AdvanceEntity. | ||
| D9FB | CALL JumpTable_StorePosition | Call JumpTable_StorePosition. | |||
| D9FE | CALL JumpTable_MoveEntity | Call JumpTable_MoveEntity. | |||
| DA01 | CALL JumpTable_DrawEntity | Call JumpTable_DrawEntity. | |||
| DA04 | CALL JumpTable_EraseEntity | Call JumpTable_EraseEntity. | |||
|
Step to the next ball.
|
|||||
| Handler_RoomSeven_Next | DA07 | POP BC | Restore the ball count from the stack. | ||
| DA08 | LD DE,$000E | IX+=000E. | |||
| DA0B | ADD IX,DE | ||||
| DA0D | DJNZ Handler_RoomSeven_Loop | Decrease the ball count and loop back to Handler_RoomSeven_Loop. | |||
|
Reset the clip maximum row.
|
|||||
| DA0F | LD A,$02 | Write 02 to *ClipWindow_MaximumRow. | |||
| DA11 | LD ($641A),A | ||||
| DA14 | RET | Return. | |||
| Prev: D904 | Up: Map | Next: DA15 |