Prev: 637E Up: Map Next: 63E1
63AA: Leaf Collision
Used by the routine at 64ED.
LeafCollision 63AA LD HL,$5E94 HL=Leaf_1_State.
63AD LD B,$04 B=04 (leaf counter).
63AF LD DE,$0008 BC=08 (data offset).
LeafCollision_Loop 63B2 PUSH HL Stash HL on the stack.
63B3 LD A,(HL) If the current leaf is not active, jump to LeafCollision_Next.
63B4 AND A
63B5 JR Z,LeafCollision_Next
63B7 INC HL A=current leaf X position.
63B8 LD A,(HL)
63B9 SUB (IX+$01) Leaf X position - bug X Position.
63BC JP P,LeafCollision_Test_X Make sure we have a positive byte.
63BF NEG
LeafCollision_Test_X 63C1 CP $0A Jump to LeafCollision_Next if A >= 0A.
63C3 JR NC,LeafCollision_Next
63C5 INC HL A=current leaf Y position.
63C6 LD A,(HL)
63C7 SUB (IX+$02) Leaf Y position - bug Y Position.
63CA JP P,LeafCollision_Test_Y Make sure we have a positive byte.
63CD NEG
LeafCollision_Test_Y 63CF CP $0A Jump to LeafCollision_Next if A >= 0A.
63D1 JR NC,LeafCollision_Next
63D3 INC HL Increment HL by two (skip colour attribute).
63D4 INC HL
63D5 LD A,$01 Write 01 to todo and todo (being eaten?)
63D7 LD (HL),A
63D8 INC HL
63D9 LD (HL),A
63DA POP HL Restore HL from the stack.
63DB RET Return.
Handles moving onto the next leaf object.
LeafCollision_Next 63DC POP HL Restore HL from the stack.
63DD ADD HL,DE Add the data offset/ move onto the next leaf.
63DE DJNZ LeafCollision_Loop Decrease counter by one and loop back to LeafCollision_Loop until counter is zero.
63E0 RET Return.
Prev: 637E Up: Map Next: 63E1