Prev: D894 Up: Map Next: D9B6
D904: Handler: Room Sixteen
Used by the routine at Dispatch_Handlers.
Special actor for room 16.
Return unless this is room 16.
Handler_RoomSixteen D904 LD A,($64A2) Return if *CurrentRoom is not 16.
D907 CP $16
D909 RET NZ
Point at the special actor and set the clip window.
D90A LD IX,$644D Point IX at SpecialActor.
D90E LD BC,$051D Write 051D to *ClipWindow_MinimumColumn.
D911 LD ($641B),BC
Draw the actor if it is already active.
D915 BIT 7,(IX+$00) Jump to Handler_RoomSixteen_Draw if the actor is already active.
D919 JR Z,Handler_RoomSixteen_Draw
Only spawn when the player is on a trigger row.
D91B LD A,($64A5) Jump to Handler_RoomSixteen_Column if the player row is 07, 14 or 11, otherwise jump to Handler_RoomSixteen_Done.
D91E CP $07
D920 JR Z,Handler_RoomSixteen_Column
D922 CP $14
D924 JR Z,Handler_RoomSixteen_Column
D926 CP $11
D928 JP NZ,Handler_RoomSixteen_Done
Only spawn when the player is in the trigger columns.
Handler_RoomSixteen_Column D92B LD A,($64A4) Jump to Handler_RoomSixteen_Done unless the player column is 0F-16.
D92E CP $17
D930 JP NC,Handler_RoomSixteen_Done
D933 CP $0F
D935 JR C,Handler_RoomSixteen_Done
Spawn on a random roll.
D937 CALL JumpTable_GetRandomNumber Jump to Handler_RoomSixteen_Done if the random number is DC or higher.
D93A CP $DC
D93C JR NC,Handler_RoomSixteen_Done
sprite-e6
D93E LD A,$E6 Spawn the actor with sprite E6, colour WHITE (BRIGHT) and size 01 by 01.
D940 LD L,$47
D942 LD DE,$0101
D945 CALL JumpTable_SpawnEntity
Choose left or right movement.
D948 CALL JumpTable_GetRandomNumber Jump to Handler_RoomSixteen_Right if the random number is 80 or higher.
D94B CP $80
D94D JR NC,Handler_RoomSixteen_Right
D94F LD (IX+$00),$1E Start at column 1E and write FB as the horizontal delta.
D953 LD (IX+$0A),$1E
D957 LD (IX+$08),$FB
D95B JR Handler_RoomSixteen_Sound Jump to Handler_RoomSixteen_Sound.
Start on the left and move right.
Handler_RoomSixteen_Right D95D LD (IX+$00),$05 Start at column 05 and write 05 as the horizontal delta.
D961 LD (IX+$0A),$05
D965 LD (IX+$08),$05
Sound the actor appearing.
Handler_RoomSixteen_Sound D969 LD B,$FF Call Play_Noise with mask FF and 32 iterations.
D96B LD D,$32
D96D CALL Play_Noise
Choose the actor row.
D970 LD A,($64A5) Jump to Handler_RoomSixteen_RowLow if the player row is 14.
D973 CP $14
D975 JR Z,Handler_RoomSixteen_RowLow
D977 CP $11 Jump to Handler_RoomSixteen_RowHigh if the player row is 11.
D979 JR Z,Handler_RoomSixteen_RowHigh
D97B CALL JumpTable_GetRandomNumber Jump to Handler_RoomSixteen_RowHigh if the random number is 80 or higher.
D97E CP $80
D980 JR NC,Handler_RoomSixteen_RowHigh
Handler_RoomSixteen_RowLow D982 LD (IX+$01),$13 Write row 13 into the actor.
D986 LD (IX+$0B),$13
D98A JR Handler_RoomSixteen_Draw Jump to Handler_RoomSixteen_Draw.
Handler_RoomSixteen_RowHigh D98C LD (IX+$01),$10 Write row 10 into the actor.
D990 LD (IX+$0B),$10
Store, move, draw and erase the actor.
Handler_RoomSixteen_Draw D994 CALL JumpTable_AdvanceEntity Call JumpTable_AdvanceEntity.
D997 CALL JumpTable_StorePosition Call JumpTable_StorePosition.
D99A CALL JumpTable_MoveEntity Call JumpTable_MoveEntity.
D99D CALL JumpTable_DrawEntity Call JumpTable_DrawEntity.
D9A0 CALL JumpTable_EraseEntity Call JumpTable_EraseEntity.
Hide the actor once it has left the room.
D9A3 LD A,(IX+$00) Deactivate the actor once column 23 is passed.
D9A6 CP $23
D9A8 JR C,Handler_RoomSixteen_Done
D9AA LD (IX+$00),$80
Restore the clip window.
Handler_RoomSixteen_Done D9AE LD BC,$0121 Write 0121 to *ClipWindow_MinimumColumn.
D9B1 LD ($641B),BC
D9B5 RET Return.
Prev: D894 Up: Map Next: D9B6