Prev: C3E0 Up: Map Next: C531
C4A6: Handle collision detection for entity moving left
Used by the routines at BFEF, C1CA and C27E.
C4A6 LD HL,($A01B) Set HL to the tile address under entity
C4A9 LD DE,$0040 Set HL to the tile address in front-upper of enemy
C4AC AND A
C4AD SBC HL,DE
C4AF DEC HL
C4B0 CALL $D06C Check if tile type is wall
C4B3 JP Z,$C521 Jump if it's a wall
C4B6 LD DE,$0020 Increment address to tile in front-lower of enemy
C4B9 ADD HL,DE
C4BA CALL $D06C Check if tile type is wall
C4BD JP Z,$C521 Jump if it's a wall and change direction
C4C0 LD A,(IX+$00) Computes new x-position based on speed
C4C3 SUB (IX+$10)
C4C6 CP $E8 if x-position is less than $18 then jump and handle left collision with room border
C4C8 JP NC,$C49C
no collision, continue moving
C4CB LD (IX+$00),A Set the new x-position
C4CE LD (IX+$02),$01 Continue in the same direction
C4D2 LD A,(IX+$03) Return if jumping
C4D5 OR A
C4D6 RET NZ
C4D7 LD A,(IX+$06) Return if falling
C4DA OR A
C4DB RET NZ
C4DC LD A,(IX+$09) Check enemy type
C4DF OR A Jump if enemy type is not FOOT MAN
C4E0 JP NZ,$C501
handle special behavior of FOOT MAN
C4E3 LD HL,($A01B) Set HL to the tile address under FOOT MAN
C4E6 LD DE,$0020 Check tile type where is FOOT MAN
C4E9 AND A
C4EA SBC HL,DE
C4EC LD A,(HL)
C4ED CP $0F tile type is $0F?
C4EF JP Z,$C5FD Jump to handle a forced jump for FOOT MAN
C4F2 CP $0E tile type is $0E?
C4F4 JP Z,$C54E Jump to handle a forced crouch for FOOT MAN
C4F7 CP $10 tile type is $10?
C4F9 CALL Z,$C531 Jump to handle a possible crouch for FOOT MAN
C4FC CP $11 tile type is $11?
C4FE CALL Z,$C540 Jump to handle a possible jump for FOOT MAN
check for space under the feet in next tile
C501 LD HL,($A01B) Return if next tile under a feet is not space
C504 DEC HL
C505 LD A,(HL)
C506 OR A
C507 RET NZ
C508 LD A,(IX+$09) Check enemy type
C50B AND $7F Return if FOOT MAN
C50D OR A
C50E RET Z
C50F CP $03 Return if train wagon
C511 RET Z
C512 CP $04
C514 RET Z
C515 CP $05
C517 RET Z
C518 CP $08 Return if SCANNER
C51A RET Z
C51B CP $0C Return if POD
C51D RET Z
C51E CP $0D Return if MINE LAYER
C520 RET Z
change direction
C521 LD A,(IX+$09) Return if FOOT MAN dying
C524 CP $06
C526 RET Z
C527 CP $07
C529 RET Z
C52A LD (IX+$02),$00 Change enemy direction
C52E JP $C47A Special case for train wagons (no change direction, simple dissapear if wall hit)
Prev: C3E0 Up: Map Next: C531