Prev: C64E Up: Map Next: C692
C65E: Handle Portcullis
Handles a portcullis that is not moving. Nothing happens while another portcullis in the room is moving. A portcullis that is on the floor of the room, or no more than 1F above it, starts to rise on one frame in thirty-two. One that is higher than that starts to come down: at once for the first four times that a portcullis comes down, and after that on one frame in thirty-two.
Input
IX Address of the portcullis object
Start the portcullis rising or lowering when it is time.
HandlePortcullis C65E CALL SetPixelAdjustments_Legs Set the pixel adjustments of the bottom half of a guard.
C661 LD HL,$5BAF Point HL at PortcullisMovingFlag.
C664 LD A,(HL) Fetch it.
C665 AND A Test it.
C666 RET NZ Return if a portcullis is moving.
C667 LD A,($5BAE) Fetch the Z coordinate of the floor of the room from FloorHeight.
C66A CP (IX+$03) Compare it with the Z coordinate of the portcullis.
C66D JR Z,StartPortcullisRising Jump to StartPortcullisRising if the portcullis is on the floor.
C66F ADD A,$1F Add 1F to the height.
C671 CP (IX+$03) Compare it with the Z coordinate of the portcullis.
C674 JR NC,StartPortcullisRising Jump to StartPortcullisRising if the portcullis is no more than 1F above the floor of the room.
C676 LD A,($5BB0) Fetch the number of times that a portcullis has come down from PortcullisLowerCount.
C679 CP $04 Jump to HandlePortcullis_Lower if it is fewer, to set off at once.
C67B JR C,HandlePortcullis_Lower
C67D LD A,($5BA5) Fetch the second random seed from RandomSeed2.
C680 AND %00011111 Keep the lowest five bits.
C682 RET NZ Return unless it is the time to set off.
C683 OR %10000000 Set A to a large number, so that it stays above four.
HandlePortcullis_Lower C685 INC A Add one to the number of times that a portcullis has come down.
C686 LD ($5BB0),A Store it at PortcullisLowerCount.
C689 SET 0,(IX+$00) Change the graphic of the portcullis to the moving one.
C68D LD (IX+$0B),$FF Set the speed in Z to move it down.
This entry point is used by the routine at StartPortcullisRising.
HandlePortcullis_Flag C691 INC (HL) Flag that a portcullis is moving.
Prev: C64E Up: Map Next: C692