Prev: C3BE Up: Map Next: C4A6
C3E0: Handle collision detection for entity moving right
Used by the routines at BFEF, C1CA and C27E.
C3E0 LD HL,($A01B) Set HL to the tile address under entity
C3E3 LD DE,$0040 Set HL point to tile in front-upper of entity
C3E6 AND A
C3E7 SBC HL,DE
C3E9 INC HL
C3EA INC HL
C3EB CALL $D06C Check if tile is wall
C3EE JP Z,$C469 Jump if tile is wall and change direction
C3F1 LD DE,$0020 Set #rEGhl point to tile in front-lower of entity
C3F4 ADD HL,DE
C3F5 CALL $D06C Check if tile is wall
C3F8 JP Z,$C469 Jump if tile is wall and change direction
C3FB LD A,(IX+$09) Jump forward if enemy is FOOT MAN
C3FE OR A
C3FF JP Z,$C410
C402 LD A,(IX+$00) Computes new x-position based on speed
C405 ADD A,(IX+$10)
C408 CP $E8 Jump to handle collision with right border if x-position greater than $E8
C40A JP NC,$C49C
C40D JP $C41B Jump to continue the movement
check collision with border for FOOT MAN
C410 LD A,(IX+$00) Computes new x-position based on speed
C413 ADD A,(IX+$10)
C416 CP $F8 Jump to handle collision with right border if x-position greater than $F8
C418 JP NC,$C49C
continue movement
C41B LD (IX+$00),A Set the new x-position
C41E LD (IX+$02),$00 Set direction to right
C422 LD A,(IX+$03) Return if FOOT MAN jumping
C425 OR A
C426 RET NZ
C427 LD A,(IX+$06) Return if FOOT MAN falling
C42A OR A
C42B RET NZ
C42C LD A,(IX+$09) Jump forward if enemy is not FOOT MAN
C42F OR A
C430 JP NZ,$C451
C433 LD HL,($A01B) Set HL to the address of the tile buffer in front of FOOT MAN
C436 LD DE,$001F
C439 AND A
C43A SBC HL,DE
C43C LD A,(HL) if tile type is $0F then jump to handle force jump of FOOT MAN
C43D CP $0F
C43F JP Z,$C602
C442 CP $0E if tile type is $0E then jump to handle force crouch of FOOT MAN
C444 JP Z,$C54E
C447 CP $10 if tile type is $10 then jump to handle possible crouch of FOOT MAN
C449 CALL Z,$C531
C44C CP $11 if tile type is $10 then jump to handle possible jump of FOOT MAN
C44E CALL Z,$C540
check the next tile under the foots of enemy
C451 LD HL,($A01B) Set HL to the next tile under foots
C454 INC HL
C455 INC HL
C456 LD A,(HL) Return if tile is not background
C457 OR A
C458 RET NZ
C459 LD A,(IX+$09) Return if enemy is FOOT MAN
C45C AND $7F
C45E OR A
C45F RET Z
C460 CP $08 Return is enemy is SCANNER
C462 RET Z
C463 CP $0C Return is enemy is POD
C465 RET Z
C466 CP $0D Return is enemy is MINE LAYER
C468 RET Z
Special case for FOOT MAN dying
C469 LD A,(IX+$09) Return if FOOT MAN dying
C46C CP $07
C46E RET Z
C46F CP $06
C471 RET Z
change direction of enemy
C472 LD A,(IX+$02) change enemy direction
C475 XOR $01
C477 LD (IX+$02),A
Special case for FOOT MAN dying and train wagons. This entry point is used by the routine at C4A6.
C47A LD A,(IX+$09) if FOOT MAN dying then explode it
C47D CP $07
C47F JP Z,$981F
C482 CP $06
C484 JP Z,$981F
C487 CP $03 if train wagon then set wagon invisible
C489 JP Z,$C497
C48C CP $04
C48E JP Z,$C497
C491 CP $05
C493 JP Z,$C497
C496 RET
Set enemy to not visible
C497 LD (IX+$0C),$00 Enemy not visible
C49B RET
Handle collision with room border
C49C LD A,(IX+$09) if enemy type is FOOT MAN then jump to make FOOT MAN invisible
C49F OR A
C4A0 JP Z,$C497
C4A3 JP $C472 if not change enemy direction
Prev: C3BE Up: Map Next: C4A6