Prev: B103 Up: Map Next: B16A
B12F: Enter Room Below
Used by the routine at MoveActor.
Used by MoveActor when an actor has gone off the bottom of the screen. The actor is put at the top of the room below (the room number increases by 10) and its X position is changed to the entry point of the room, which is held in RoomEntryXPositions for the layout of the room (see Layout).
If the actor is not the player (the sprite ID is not 10 to 2F) then that is all. If it is the player then the new room is drawn and the delay before the flames appear is started.
Input
IX Actor record
Output
D New Y position
E New X position
EnterRoomBelow B12F LD D,$27 Set the Y position to the top of the play area (27).
B131 LD A,(IX+$01) Fetch the room of the actor.
B134 ADD A,$10 Move to the room below.
B136 LD (IX+$01),A Set the new room of the actor.
B139 LD L,A Use the room as the offset into the layout table.
B13A LD H,$00
B13C LD BC,$6066 Add the layout table at Layout to get the address of the layout number.
B13F ADD HL,BC
B140 LD L,(HL) Fetch the layout number of the room.
B141 LD H,$00 Clear H.
B143 LD BC,$6036 Add the table of entry X positions at RoomEntryXPositions to get the address of the X position.
B146 ADD HL,BC
B147 LD E,(HL) Fetch the X position at which the actor enters the room.
This entry point is used by the routines at EnterRoomLeft and EnterRoomAbove.
This is where the other routines to enter a room join in.
EnterRoom B148 LD A,(IX+$00) Fetch the sprite ID of the actor.
B14B SUB $10 Subtract 10 (the first Sabreman sprite ID).
B14D CP $20 Return if the actor is not the player.
B14F RET NC
B150 PUSH DE Stash the new position on the stack.
B151 CALL ClearPlayArea_Attributes Clear the attribute buffer of the play area.
B154 CALL ClearPlayArea Clear the play area.
B157 CALL DrawCurrentRoom Draw the new room.
B15A CALL StoreEntity Remember the previous position of the player.
B15D CALL DrawEntity Draw the player.
B160 CALL VisitRoom Mark the new room as visited.
B163 POP DE Restore the new position from the stack.
B164 LD A,$80 Set the flame spawn delay in FlameSpawnDelay to 80.
B166 LD ($96B4),A
B169 RET Return.
Prev: B103 Up: Map Next: B16A