Prev: D0E4 Up: Map Next: D1B9
D14D: Handle Rex falling
Used by the routine at 947A.
D14D LD A,($A0BD) Return if Rex is jumping
D150 OR A
D151 RET NZ
D152 LD A,($A0B7) Add falling speed to y-position of Rex
D155 LD HL,$A0BC
D158 ADD A,(HL)
D159 CP $BA if y-position is greater then 186 jump to check bottom room
D15B JP NC,$D19B
D15E LD ($A0B7),A Set the new y-position
D161 AND $07 Return if y-position is not grid fixed
D163 OR A
D164 RET NZ
D165 LD A,($A0B6) Set A0AF the x-position of Rex
D168 LD ($A0AF),A
D16B LD A,($A0B7) Set A0B7 the y-position of Rex
D16E LD ($A0B0),A
D171 LD A,($A0BB) Set A the face direction
D174 CALL $A503 Computes address position in tile type buffer based on (x,y) position on screen
D177 LD DE,$0061 Set HL to point into tile type buffer under Rex feet
D17A ADD HL,DE
D17B LD A,(HL) Set A the tile type
D17C CALL $D08B Check if tile type is 'background'
D17F JP NZ,$D196 Jump to stop falling if not background
D182 INC HL Increment address
D183 LD A,(HL) Set A the tile type
D184 CALL $D08B Check if tile type is 'background'
D187 JP NZ,$D196 Jump to stop falling if not background
D18A LD A,($A0BC) Increase falling speed by 2
D18D ADD A,$02
D18F CP $06 Return if falling speed greater than 4
D191 RET Z
D192 LD ($A0BC),A Set the new falling speed
D195 RET
Rex has finished falling
D196 XOR A Set falling speed to 0
D197 LD ($A0BC),A
D19A RET
Rex has fallen through bottom room
D19B LD A,($A08F) If no bottom room connection then jump to kill Rex
D19E OR A
D19F JP Z,$D1AE
D1A2 LD ($A0B8),A Set the new room
D1A5 LD A,$08 Set the new y-position of Rex as 8
D1A7 LD ($A0B7),A
D1AA POP BC Restore BC
D1AB JP $C95A Check for end game room
No room connection, kill Rex
D1AE XOR A Set Rex to not jumping nor falling
D1AF LD ($A0BC),A
D1B2 LD ($A0BD),A
D1B5 CALL $9BDA Handle Rex dead
D1B8 RET
Prev: D0E4 Up: Map Next: D1B9