Prev: 45315 Up: Map Next: 45418
45359: 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 16) 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 16 to 47) 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 45359 LD D,39 Set the Y position to the top of the play area (39).
45361 LD A,(IX+1) Fetch the room of the actor.
45364 ADD A,16 Move to the room below.
45366 LD (IX+1),A Set the new room of the actor.
45369 LD L,A Use the room as the offset into the layout table.
45370 LD H,0
45372 LD BC,24678 Add the layout table at Layout to get the address of the layout number.
45375 ADD HL,BC
45376 LD L,(HL) Fetch the layout number of the room.
45377 LD H,0 Clear H.
45379 LD BC,24630 Add the table of entry X positions at RoomEntryXPositions to get the address of the X position.
45382 ADD HL,BC
45383 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 45384 LD A,(IX+0) Fetch the sprite ID of the actor.
45387 SUB 16 Subtract 16 (the first Sabreman sprite ID).
45389 CP 32 Return if the actor is not the player.
45391 RET NC
45392 PUSH DE Stash the new position on the stack.
45393 CALL ClearPlayArea_Attributes Clear the attribute buffer of the play area.
45396 CALL ClearPlayArea Clear the play area.
45399 CALL DrawCurrentRoom Draw the new room.
45402 CALL StoreEntity Remember the previous position of the player.
45405 CALL DrawEntity Draw the player.
45408 CALL VisitRoom Mark the new room as visited.
45411 POP DE Restore the new position from the stack.
45412 LD A,128 Set the flame spawn delay in FlameSpawnDelay to 128.
45414 LD (38580),A
45417 RET Return.
Prev: 45315 Up: Map Next: 45418