Prev: 25470 Up: Map Next: 25569
25514: Leaf Collision
Used by the routine at 25837.
LeafCollision 25514 LD HL,24212 HL=Leaf_1_State.
25517 LD B,4 B=4 (leaf counter).
25519 LD DE,8 BC=8 (data offset).
LeafCollision_Loop 25522 PUSH HL Stash HL on the stack.
25523 LD A,(HL) If the current leaf is not active, jump to LeafCollision_Next.
25524 AND A
25525 JR Z,LeafCollision_Next
25527 INC HL A=current leaf X position.
25528 LD A,(HL)
25529 SUB (IX+1) Leaf X position - bug X Position.
25532 JP P,LeafCollision_Test_X Make sure we have a positive byte.
25535 NEG
LeafCollision_Test_X 25537 CP 10 Jump to LeafCollision_Next if A >= 10.
25539 JR NC,LeafCollision_Next
25541 INC HL A=current leaf Y position.
25542 LD A,(HL)
25543 SUB (IX+2) Leaf Y position - bug Y Position.
25546 JP P,LeafCollision_Test_Y Make sure we have a positive byte.
25549 NEG
LeafCollision_Test_Y 25551 CP 10 Jump to LeafCollision_Next if A >= 10.
25553 JR NC,LeafCollision_Next
25555 INC HL Increment HL by two (skip colour attribute).
25556 INC HL
25557 LD A,1 Write 1 to todo and todo (being eaten?)
25559 LD (HL),A
25560 INC HL
25561 LD (HL),A
25562 POP HL Restore HL from the stack.
25563 RET Return.
Handles moving onto the next leaf object.
LeafCollision_Next 25564 POP HL Restore HL from the stack.
25565 ADD HL,DE Add the data offset/ move onto the next leaf.
25566 DJNZ LeafCollision_Loop Decrease counter by one and loop back to LeafCollision_Loop until counter is zero.
25568 RET Return.
Prev: 25470 Up: Map Next: 25569