Prev: 8E2D Up: Map Next: 8F1E
8ECA: Apply Player Collision
Used by the routine at ApplyCollisionEffects.
Part of ApplyCollisionEffects, used when the value in ScratchValue is zero. Only objects of type 13 are dealt with here. Purpose not yet known.
Input
IX Address of the object
IY Address of the player's object
ApplyPlayerCollision 8ECA LD A,(IX+$00) Fetch the type of the object.
8ECD CP $13 Is it 13?
8ECF RET NZ Return if not.
8ED0 LD A,($F5F7) Fetch the value from F5F7.
8ED3 AND A Test it.
8ED4 RET Z Return if it is zero.
8ED5 LD A,($C8FD) Fetch the value from C8FD.
8ED8 XOR (IX+$07) Combine the sign with the horizontal speed of the object.
8EDB BIT 7,A Test bit 7.
8EDD RET NZ Return if it is set.
8EDE LD A,($C27C) Fetch the value from C27C.
8EE1 LD H,A Use it as the horizontal position.
8EE2 LD A,($C27D) Fetch the value from PieceVariables_SecondSprite.
8EE5 ADD A,$08 Add eight.
8EE7 LD L,A Use it as the vertical position.
8EE8 LD A,$50 A=50.
8EEA CALL LimitHeight Work out the position.
8EED LD E,B Use the result as the height.
8EEE LD D,$0C Set the width to 0C.
8EF0 LD IX,$ABA4 Use the hit data at CollisionBox.
8EF4 CALL TestBoxesOverlap Check for a hit.
8EF7 LD A,($5C1C) Fetch the value from ScratchValue.
8EFA AND A Test it.
8EFB RET Z Return if it is zero.
8EFC LD A,$80 Set CollisionKind to 80.
8EFE LD ($D0BC),A
8F01 LD IX,($AD46) Fetch the address of the object that was hit from CurrentObject.
8F05 LD H,(IX+$07) Fetch its horizontal speed into HL.
8F08 LD L,(IX+$08)
8F0B CALL NegateNumber Negate it.
8F0E SRA H Halve it.
8F10 RR L
8F12 LD (IY+$19),H Give the result to the player as horizontal speed.
8F15 LD (IY+$1A),L
8F18 LD A,$FF Set Variables to FF.
8F1A LD ($5C40),A
8F1D RET Return.
Prev: 8E2D Up: Map Next: 8F1E