Prev: CE73 Up: Map Next: CEE5
CE74: Handle Rex jumping
Used by the routine at 9470.
CE74 LD A,($A256) Return if Rex not jumping
CE77 OR A
CE78 RET Z
CE79 LD HL,($A1B2) Set HL the address into tile type buffer pointing over Rex
CE7C LD DE,$0021
CE7F ADD HL,DE
CE80 CALL $CDF5 Check if tile type is wall
CE83 JP Z,$CEAA Jump to start falling if tile is wall
CE86 INC HL Increment address
CE87 CALL $CDF5 Check if tile type is wall
CE8A JP Z,$CEAA Jump to start falling if tile is wall
CE8D LD A,($A250) Substract to y-position of Rex the corresponding y-offset pointed by A259
CE90 LD HL,($A259)
CE93 LD E,(HL)
CE94 SUB E
CE95 CP $08 If y-position of Rex is less than 8 then jump forward to stop jumping
CE97 JP C,$CEC7
CE9A LD ($A250),A Set the new y-position of Rex
CE9D INC HL Increment address pointer into the y-offset table for jumping
CE9E LD ($A259),HL
CEA1 LD A,(HL) Return if not arrived to the end of the y-offset table
CEA2 CP $FF
CEA4 RET NZ
CEA5 XOR A Set Rex not jumping
CEA6 LD ($A256),A
CEA9 RET
Rex start falling after wall collision
CEAA LD A,($A25D) If Rex collides with tile type $03 (tile of death) then jump to kill Rex
CEAD CP $03
CEAF CALL Z,$9CC5
This entry point is used by the routine at A0F8.
CEB2 LD A,$02 Set falling speed
CEB4 LD ($A255),A
CEB7 XOR A Set not jumping
CEB8 LD ($A256),A
CEBB LD A,($A250) Return if Rex y-position is not grid fixed
CEBE AND $07
CEC0 OR A
CEC1 RET NZ
CEC2 XOR A Set Rex not falling
CEC3 LD ($A255),A
CEC6 RET
Rex start falling after collision with top border room
CEC7 XOR A Set not jumping
CEC8 LD ($A256),A
CECB LD A,$02 Set falling speed
CECD LD ($A255),A
CED0 LD A,($A227) Return if no top room connection
CED3 OR A
CED4 RET Z
CED5 LD ($A251),A Set the top room to be the current room
CED8 LD A,$A0 Set y-position of Rex to be 160
CEDA LD ($A250),A
CEDD XOR A Set Rex to not falling
CEDE LD ($A255),A
CEE1 POP BC Restore BC
CEE2 JP $C9CD Check for end game room
Prev: CE73 Up: Map Next: CEE5