Prev: 50766 Up: Map Next: 50834
50782: 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 31 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 50782 CALL SetPixelAdjustments_Legs Set the pixel adjustments of the bottom half of a guard.
50785 LD HL,23471 Point HL at PortcullisMovingFlag.
50788 LD A,(HL) Fetch it.
50789 AND A Test it.
50790 RET NZ Return if a portcullis is moving.
50791 LD A,(23470) Fetch the Z coordinate of the floor of the room from FloorHeight.
50794 CP (IX+3) Compare it with the Z coordinate of the portcullis.
50797 JR Z,StartPortcullisRising Jump to StartPortcullisRising if the portcullis is on the floor.
50799 ADD A,31 Add 31 to the height.
50801 CP (IX+3) Compare it with the Z coordinate of the portcullis.
50804 JR NC,StartPortcullisRising Jump to StartPortcullisRising if the portcullis is no more than 31 above the floor of the room.
50806 LD A,(23472) Fetch the number of times that a portcullis has come down from PortcullisLowerCount.
50809 CP 4 Jump to HandlePortcullis_Lower if it is fewer, to set off at once.
50811 JR C,HandlePortcullis_Lower
50813 LD A,(23461) Fetch the second random seed from RandomSeed2.
50816 AND %00011111 Keep the lowest five bits.
50818 RET NZ Return unless it is the time to set off.
50819 OR %10000000 Set A to a large number, so that it stays above four.
HandlePortcullis_Lower 50821 INC A Add one to the number of times that a portcullis has come down.
50822 LD (23472),A Store it at PortcullisLowerCount.
50825 SET 0,(IX+0) Change the graphic of the portcullis to the moving one.
50829 LD (IX+11),255 Set the speed in Z to move it down.
This entry point is used by the routine at StartPortcullisRising.
HandlePortcullis_Flag 50833 INC (HL) Flag that a portcullis is moving.
Prev: 50766 Up: Map Next: 50834