Prev: 50861 Up: Map Next: 50944
50877: Handle Moving Portcullis
Handles a portcullis that is moving. A portcullis that is coming down is deadly. It speeds up as it falls until it hits the floor, and the sound of a portcullis is played. One that is going up moves at a speed of 2 until it is 31 above the floor of the room. When it is done the portcullis stops, and the next one is free to start.
Input
IX Address of the portcullis object
Fall and speed up, or rise, until the portcullis is done.
HandleMovingPortcullis 50877 CALL SetPixelAdjustments_Legs Set the pixel adjustments of the bottom half of a guard.
50880 SET 7,(IX+13) Make the portcullis deadly.
50884 LD A,(23572) Fetch the counter and flags of the player.
50887 AND %11110000 Keep the counter that runs when the player enters the room.
50889 RET NZ Return if the player has only just entered the room.
50890 LD A,(IX+11) Fetch the speed in Z.
50893 AND A Test it.
50894 JP P,HandleMovingPortcullis_Rise Jump to HandleMovingPortcullis_Rise if the portcullis is going up.
50897 DEC (IX+11) Increase the speed of the fall.
50900 CALL ApplyGravityAndMove Apply gravity to the portcullis and move it.
50903 BIT 2,(IX+12) Jump to SetWipeAndDrawFlags if the portcullis has not hit the floor.
50907 JR Z,SetWipeAndDrawFlags
50909 CALL PlayRandomNoise Play the sound of a portcullis.
Stop the portcullis and free the next one to start.
HandleMovingPortcullis_Stop 50912 XOR A Clear A.
50913 LD (23471),A Flag that no portcullis is moving at PortcullisMovingFlag.
50916 RES 0,(IX+0) Change the graphic of the portcullis to the stationary one.
50920 JR SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags.
Rise until the portcullis is 31 above the floor.
HandleMovingPortcullis_Rise 50922 LD (IX+11),2 Set the speed in Z to 2.
50926 CALL PlaySoundFromPosition Play the sound of a moving object.
50929 CALL ApplyGravityAndMove Apply gravity to the portcullis and move it.
50932 LD A,(23470) Fetch the Z coordinate of the floor of the room from FloorHeight.
50935 ADD A,31 Add 31 to it.
50937 CP (IX+3) Compare it with the Z coordinate of the portcullis.
50940 JR NC,SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags if the portcullis has not yet reached the top.
50942 JR HandleMovingPortcullis_Stop Jump to HandleMovingPortcullis_Stop to stop it.
Prev: 50861 Up: Map Next: 50944