Prev: D0E3 Up: Map Next: D14D
D0E4: Handle Rex jumping
Used by the routine at 947A.
D0E4 LD A,($A0BD) Return if Rex not jumping
D0E7 OR A
D0E8 RET Z
D0E9 LD HL,($A019) Set HL the address into tile type buffer pointing over Rex
D0EC LD DE,$0021
D0EF ADD HL,DE
D0F0 CALL $D06C Check if tile type is wall
D0F3 JP Z,$D11A Jump to start falling if tile is wall
D0F6 INC HL Increment address
D0F7 CALL $D06C Check if tile type is wall
D0FA JP Z,$D11A Jump to start falling if tile is wall
D0FD LD A,($A0B7) Substract to y-position of Rex the corresponding y-offset pointed by A0C0
D100 LD HL,($A0C0)
D103 LD E,(HL)
D104 SUB E
D105 CP $08 If y-position of Rex is less then jump forward to stop jumping
D107 JP C,$D12F
D10A LD ($A0B7),A Set the new y-position of Rex
D10D INC HL Increment address pointer into the y-offset table for jumping
D10E LD ($A0C0),HL
D111 LD A,(HL) Return if not arrived to the end of the y-offset table
D112 CP $FF
D114 RET NZ
D115 XOR A Set Rex not jumping
D116 LD ($A0BD),A
D119 RET
Rex start falling after wall collision
D11A LD A,$02 Set falling speed
D11C LD ($A0BC),A
D11F XOR A Set not jumping
D120 LD ($A0BD),A
D123 LD A,($A0B7) Return if Rex y-position is not grid fixed
D126 AND $07
D128 OR A
D129 RET NZ
D12A XOR A Set Rex not falling
D12B LD ($A0BC),A
D12E RET
Rex start falling after collision with top border room
D12F XOR A Set not jumping
D130 LD ($A0BD),A
D133 LD A,$02 Set falling speed
D135 LD ($A0BC),A
D138 LD A,($A08E) Return if no top room connection
D13B OR A
D13C RET Z
D13D LD ($A0B8),A Set the top room to be the current room
D140 LD A,$A0 Set y-position of Rex to be 160
D142 LD ($A0B7),A
D145 XOR A Set Rex to not falling
D146 LD ($A0BC),A
D149 POP BC Restore BC
D14A JP $C95A Check for end game room
Prev: D0E3 Up: Map Next: D14D