Prev: 52667 Up: Map Next: 52890
52785: Run Bobbing Block
Used by the routine at RunHarmfulBobbingBlock.
The handler of the object type 85, which no room uses. The block falls until it lands, and then it rises until it is at a height of 176, and falls again. It rises faster while something is standing on it. Flag bit 2 of the hit flags is used for the state: it is set while the block is rising.
Input
IX Object record
RunBobbingBlock 52785 CALL SetSpriteOffset_Minus16_Minus8 Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite.
52788 XOR A Set the speeds along x and y to zero.
52789 LD (IX+9),A
52792 LD (IX+10),A
Fall until the block lands, then start rising.
52795 BIT 2,(IX+13) Jump to RunBobbingBlock_Rising if the block is rising.
52799 JR NZ,RunBobbingBlock_Rising
52801 LD (IX+11),A Set the speed along z to zero.
52804 CALL ApplyGravityAndMove Call ApplyGravityAndMove to apply gravity to the block and move it.
52807 BIT 2,(IX+12) Jump to RunBobbingBlock_Finish if the block has not landed.
52811 JR Z,RunBobbingBlock_Finish
52813 SET 2,(IX+13) Flag the block as rising.
52817 LD (IX+11),2 Set the speed along z to 2.
RunBobbingBlock_Finish 52821 XOR A Set the speeds along x and y to zero.
52822 LD (IX+9),A
52825 LD (IX+10),A
52828 JP SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags to flag the block as moved.
Rise towards 176, faster if something is standing on the block.
RunBobbingBlock_Rising 52831 LD A,(42875) Fetch the collision flags of the player.
52834 AND %00001000 Keep the flag for the player jumping.
52836 JR Z,RunBobbingBlock_Speed Jump to RunBobbingBlock_Speed if the player is not jumping.
52838 RES 7,(IX+23) Clear the flag for something having landed on the block.
RunBobbingBlock_Speed 52842 LD A,(IX+11) Fetch the speed along z.
52845 AND A Test it.
52846 BIT 7,(IX+23) Jump to RunBobbingBlock_Rise if something has landed on the block.
52850 JR NZ,RunBobbingBlock_Rise
52852 AND A Jump to RunBobbingBlock_Fall if the block has no speed along z.
52853 JR Z,RunBobbingBlock_Fall
RunBobbingBlock_Rise 52855 LD A,1 Set the speed along z to one.
52857 JP P,RunBobbingBlock_Move Keep it at one if the block is rising and nothing has landed on it.
52860 ADD A,2 Otherwise make it three.
RunBobbingBlock_Move 52862 LD (IX+11),A Set the speed along z of the block.
52865 CALL ApplyGravityAndMove_Move Call ApplyGravityAndMove_Move to move the block, without gravity.
52868 LD A,(IX+3) Jump to RunBobbingBlock_Finish if the block is lower than 176.
52871 CP 176
52873 JR C,RunBobbingBlock_Finish
52875 RES 2,(IX+13) Flag the block as not rising.
52879 JR RunBobbingBlock_Finish Jump to RunBobbingBlock_Finish to finish.
RunBobbingBlock_Fall 52881 CALL ApplyGravityAndMove Call ApplyGravityAndMove to apply gravity to the block and move it.
52884 RES 2,(IX+13) Flag the block as not rising.
52888 JR RunBobbingBlock_Finish Jump to RunBobbingBlock_Finish to finish.
Prev: 52667 Up: Map Next: 52890