Prev: C6AD Up: Map Next: C700
C6BD: 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 02 until it is 1F 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 C6BD CALL SetPixelAdjustments_Legs Set the pixel adjustments of the bottom half of a guard.
C6C0 SET 7,(IX+$0D) Make the portcullis deadly.
C6C4 LD A,($5C14) Fetch the counter and flags of the player.
C6C7 AND %11110000 Keep the counter that runs when the player enters the room.
C6C9 RET NZ Return if the player has only just entered the room.
C6CA LD A,(IX+$0B) Fetch the speed in Z.
C6CD AND A Test it.
C6CE JP P,HandleMovingPortcullis_Rise Jump to HandleMovingPortcullis_Rise if the portcullis is going up.
C6D1 DEC (IX+$0B) Increase the speed of the fall.
C6D4 CALL ApplyGravityAndMove Apply gravity to the portcullis and move it.
C6D7 BIT 2,(IX+$0C) Jump to SetWipeAndDrawFlags if the portcullis has not hit the floor.
C6DB JR Z,SetWipeAndDrawFlags
C6DD CALL PlayRandomNoise Play the sound of a portcullis.
Stop the portcullis and free the next one to start.
HandleMovingPortcullis_Stop C6E0 XOR A Clear A.
C6E1 LD ($5BAF),A Flag that no portcullis is moving at PortcullisMovingFlag.
C6E4 RES 0,(IX+$00) Change the graphic of the portcullis to the stationary one.
C6E8 JR SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags.
Rise until the portcullis is 1F above the floor.
HandleMovingPortcullis_Rise C6EA LD (IX+$0B),$02 Set the speed in Z to 02.
C6EE CALL PlaySoundFromPosition Play the sound of a moving object.
C6F1 CALL ApplyGravityAndMove Apply gravity to the portcullis and move it.
C6F4 LD A,($5BAE) Fetch the Z coordinate of the floor of the room from FloorHeight.
C6F7 ADD A,$1F Add 1F to it.
C6F9 CP (IX+$03) Compare it with the Z coordinate of the portcullis.
C6FC JR NC,SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags if the portcullis has not yet reached the top.
C6FE JR HandleMovingPortcullis_Stop Jump to HandleMovingPortcullis_Stop to stop it.
Prev: C6AD Up: Map Next: C700