![]() |
Routines |
| Prev: C3C1 | Up: Map | Next: C5BE |
|
Used by the routine at C2E7.
Handle movement to the right for CATERPILLAR and FOOT MAN
|
||||
| C433 | LD HL,($A1B4) | Set HL to the tile address under entity | ||
| C436 | LD DE,$0040 | Set HL point to tile in front-upper of entity | ||
| C439 | AND A | |||
| C43A | SBC HL,DE | |||
| C43C | INC HL | |||
| C43D | INC HL | |||
| C43E | CALL $CDF5 | Check if tile is wall | ||
| C441 | JP Z,$C4C6 | Jump if tile is wall and change direction | ||
| C444 | LD DE,$0020 | Set HL point to tile in front-lower of entity | ||
| C447 | ADD HL,DE | |||
| C448 | CALL $CDF5 | Check if tile is wall | ||
| C44B | JP Z,$C4C6 | Jump if tile is wall and change direction | ||
| C44E | LD A,(IX+$09) | Jump forward if enemy is FOOT MAN | ||
| C451 | OR A | |||
| C452 | JP Z,$C463 | |||
| C455 | LD A,(IX+$00) | Computes new x-position based on speed | ||
| C458 | ADD A,(IX+$10) | |||
| C45B | CP $E8 | Jump to handle collision with right border if x-position greater than 232 | ||
| C45D | JP NC,$C4F9 | |||
| C460 | JP $C46E | Jump to continue the movement | ||
|
check collision with border for FOOT MAN
|
||||
| C463 | LD A,(IX+$00) | Computes new x-position based on speed | ||
| C466 | ADD A,(IX+$10) | |||
| C469 | CP $F8 | Jump to handle collision with right border if x-position greater than 248 | ||
| C46B | JP NC,$C4F9 | |||
|
no collision, continue movement
|
||||
| C46E | LD (IX+$00),A | Set the new x-position | ||
| C471 | LD (IX+$02),$00 | Set direction to right | ||
| C475 | LD A,(IX+$03) | Return if FOOT MAN jumping | ||
| C478 | OR A | |||
| C479 | RET NZ | |||
| C47A | LD A,(IX+$06) | Return if FOOT MAN falling | ||
| C47D | OR A | |||
| C47E | RET NZ | |||
| C47F | LD A,(IX+$09) | Jump forward if enemy is not FOOT MAN | ||
| C482 | OR A | |||
| C483 | JP NZ,$C4AE | |||
| C486 | LD HL,($A1B4) | Set HL to the address of the tile buffer in front of FOOT MAN | ||
| C489 | LD DE,$001E | |||
| C48C | AND A | |||
| C48D | SBC HL,DE | |||
| C48F | LD A,(HL) | if tile type is $0F then jump to handle jump of FOOT MAN | ||
| C490 | CP $0F | |||
| C492 | JP Z,$C673 | |||
| C495 | CP $0E | if tile type is $0E then jump to handle force crouch of FOOT MAN - Not used in Rex (Side B) | ||
| C497 | JP Z,$C5BF | |||
| C49A | CP $10 | if tile type is $10 then jump to handle random crouch of FOOT MAN | ||
| C49C | CALL Z,$C598 | |||
| C49F | CP $11 | if tile type is $10 then jump to handle random jump of FOOT MAN | ||
| C4A1 | CALL Z,$C5A7 | |||
| C4A4 | CP $15 | if tile type is $10 then jump to handle random telporting of FOOT MAN | ||
| C4A6 | CALL Z,$C5B4 | |||
| C4A9 | CP $16 | if tile type is $10 then jump to handle forced telporting of FOOT MAN | ||
| C4AB | CALL Z,$C5BA | |||
|
check the next tile under the foots of enemy
|
||||
| C4AE | LD HL,($A1B4) | Set HL to the next tile under foots | ||
| C4B1 | INC HL | |||
| C4B2 | INC HL | |||
| C4B3 | LD A,(HL) | Return if tile is not background | ||
| C4B4 | OR A | |||
| C4B5 | RET NZ | |||
| C4B6 | LD A,(IX+$09) | Return if enemy is FOOT MAN | ||
| C4B9 | AND $7F | |||
| C4BB | OR A | |||
| C4BC | RET Z | |||
| C4BD | CP $08 | Remnant code. No enemies with this type | ||
| C4BF | RET Z | |||
| C4C0 | CP $0C | |||
| C4C2 | RET Z | |||
| C4C3 | CP $0D | |||
| C4C5 | RET Z | |||
| C4C6 | LD A,(IX+$09) | Return if FOOT MAN dying | ||
| C4C9 | CP $07 | |||
| C4CB | RET Z | |||
| C4CC | CP $06 | |||
| C4CE | RET Z | |||
|
change direction of enemy
|
||||
| C4CF | LD A,(IX+$02) | change enemy direction | ||
| C4D2 | XOR $01 | |||
| C4D4 | LD (IX+$02),A | |||
|
special case for FOOT MAN dying
|
||||
| C4D7 | LD A,(IX+$09) | if FOOT MAN dying then generate explosion | ||
| C4DA | CP $07 | |||
| C4DC | JP Z,$9807 | |||
| C4DF | CP $06 | |||
| C4E1 | JP Z,$9807 | |||
| C4E4 | CP $03 | Remnant code for train of Rex (Side A). Nou used in game | ||
| C4E6 | JP Z,$C4F4 | |||
| C4E9 | CP $04 | |||
| C4EB | JP Z,$C4F4 | |||
| C4EE | CP $05 | |||
| C4F0 | JP Z,$C4F4 | |||
| C4F3 | RET | |||
|
Set enemy to not visible
|
||||
| C4F4 | LD (IX+$0C),$00 | Enemy not visible | ||
| C4F8 | RET | |||
|
Handle collision with room border
|
||||
| C4F9 | LD A,(IX+$09) | if enemy type is FOOT MAN then jump to make FOOT MAN invisible | ||
| C4FC | OR A | |||
| C4FD | JP Z,$C4F4 | |||
| C500 | JP $C4CF | if not change enemy direction | ||
|
Handle movement to the left for CATERPILLAR and FOOT MAN
|
||||
| C503 | LD HL,($A1B4) | Set HL to the tile address under entity | ||
| C506 | LD DE,$0040 | Set HL to the tile address in front-upper of enemy | ||
| C509 | AND A | |||
| C50A | SBC HL,DE | |||
| C50C | DEC HL | |||
| C50D | CALL $CDF5 | Check if tile type is wall | ||
| C510 | JP Z,$C588 | Jump if it's a wall | ||
| C513 | LD DE,$0020 | Increment address to tile in front-lower of enemy | ||
| C516 | ADD HL,DE | |||
| C517 | CALL $CDF5 | Check if tile type is wall | ||
| C51A | JP Z,$C588 | Jump if it's a wall and change direction | ||
| C51D | LD A,(IX+$00) | Computes new x-position based on speed | ||
| C520 | SUB (IX+$10) | |||
| C523 | CP $E8 | if x-position is less than 24 then jump and handle left collision with room border | ||
| C525 | JP NC,$C4F9 | |||
|
no collision, continue moving
|
||||
| C528 | LD (IX+$00),A | Set the new x-position | ||
| C52B | LD (IX+$02),$01 | Continue in the same direction | ||
| C52F | LD A,(IX+$03) | Return if jumping | ||
| C532 | OR A | |||
| C533 | RET NZ | |||
| C534 | LD A,(IX+$06) | Return if falling | ||
| C537 | OR A | |||
| C538 | RET NZ | |||
| C539 | LD A,(IX+$09) | Check enemy type | ||
| C53C | OR A | Jump forward if enemy type is not FOOT MAN | ||
| C53D | JP NZ,$C568 | |||
|
handle special behavior of FOOT MAN
|
||||
| C540 | LD HL,($A1B4) | Set HL to the tile address under FOOT MAN | ||
| C543 | LD DE,$0021 | Check tile type where is FOOT MAN | ||
| C546 | AND A | |||
| C547 | SBC HL,DE | |||
| C549 | LD A,(HL) | if tile type is $0F then jump to handle jump of FOOT MAN | ||
| C54A | CP $0F | |||
| C54C | JP Z,$C66E | |||
| C54F | CP $0E | if tile type is $0E then jump to handle force crouch of FOOT MAN - Not used in Rex (Side B) | ||
| C551 | JP Z,$C5BF | |||
| C554 | CP $10 | if tile type is $10 then jump to handle random crouch of FOOT MAN | ||
| C556 | CALL Z,$C598 | |||
| C559 | CP $11 | if tile type is $10 then jump to handle random jump of FOOT MAN | ||
| C55B | CALL Z,$C5A7 | |||
| C55E | CP $15 | if tile type is $10 then jump to handle random telporting of FOOT MAN | ||
| C560 | CALL Z,$C5B4 | |||
| C563 | CP $16 | if tile type is $10 then jump to handle forced telporting of FOOT MAN | ||
| C565 | CALL Z,$C5BA | |||
|
check for space under the feet in next tile
|
||||
| C568 | LD HL,($A1B4) | Return if next tile under a feet is not space | ||
| C56B | DEC HL | |||
| C56C | LD A,(HL) | |||
| C56D | OR A | |||
| C56E | RET NZ | |||
| C56F | LD A,(IX+$09) | Check enemy type | ||
| C572 | AND $7F | Return if FOOT MAN | ||
| C574 | OR A | |||
| C575 | RET Z | |||
| C576 | CP $03 | Remant code for train of Rex (Side A) | ||
| C578 | RET Z | |||
| C579 | CP $04 | |||
| C57B | RET Z | |||
| C57C | CP $05 | |||
| C57E | RET Z | |||
| C57F | CP $08 | Remnant code. No enemies with this type | ||
| C581 | RET Z | |||
| C582 | CP $0C | |||
| C584 | RET Z | |||
| C585 | CP $0D | |||
| C587 | RET Z | |||
|
change direction
|
||||
| C588 | LD A,(IX+$09) | Return if FOOT MAN dying | ||
| C58B | CP $06 | |||
| C58D | RET Z | |||
| C58E | CP $07 | |||
| C590 | RET Z | |||
| C591 | LD (IX+$02),$00 | Change enemy direction | ||
| C595 | JP $C4D7 | Jump to handle special case for FOOT MAN dying | ||
|
Handle random crouch for FOOT MAN
|
||||
| C598 | PUSH AF | Save AF | ||
| C599 | CALL $A51D | Set A a pseudo random nummber | ||
| C59C | CP $80 | is less than 128? | ||
| C59E | JP C,$C5BE | Jump to crouch FOOT MAN if so | ||
| C5A1 | LD (IX+$11),$04 | Reset state change counter | ||
| C5A5 | POP AF | Restore AF | ||
| C5A6 | RET | |||
|
Handle random jump for FOOT MAN
|
||||
| C5A7 | CALL $A51D | Set A a pseudo random nummber | ||
| C5AA | CP $80 | is less than 128? | ||
| C5AC | JP C,$C66E | Jump to make FOOT MAN jump | ||
| C5AF | LD (IX+$11),$04 | Reset state change counter | ||
| C5B3 | RET | |||
|
Handle random teleporting out of the room for FOOT MAN
|
||||
| C5B4 | CALL $A51D | Set A a pseudo random nummber | ||
| C5B7 | CP $80 | is less than 128? | ||
| C5B9 | RET C | Return if so | ||
|
Handle forced teleporting out of the room for FOOT MAN
|
||||
| C5BA | CALL $9EF1 | Configure teleporting out of the room | ||
| C5BD | RET | |||
| Prev: C3C1 | Up: Map | Next: C5BE |