Prev: 9E3D Up: Map Next: 9EE4
9E67: Handle Rex visibility during teleporting
Used by the routine at 9470.
9E67 LD A,($A1F9) Return if Rex is not teleporting
9E6A OR A
9E6B RET Z
9E6C LD A,($A1F6) Return if Rex not visible
9E6F OR A
9E70 RET Z
9E71 LD A,($A250) Computes into HL the address pointer into room graphic data for Rex position
9E74 LD L,A
9E75 LD H,$00
9E77 ADD HL,HL
9E78 ADD HL,HL
9E79 ADD HL,HL
9E7A ADD HL,HL
9E7B ADD HL,HL
9E7C LD A,($A24F)
9E7F SRL A
9E81 SRL A
9E83 SRL A
9E85 LD E,A
9E86 LD D,$00
9E88 ADD HL,DE
9E89 LD DE,$E89F
9E8C ADD HL,DE
9E8D LD C,$00 Set C the graphic data to draw
9E8F LD A,($A1F7) Set B to the number of lines to hide from Rex sprite
9E92 LD B,A
9E93 CALL $9F8F Hide a portion of Rex to simulate teleporting
9E96 LD DE,$001D Garble randomly the last three lines of the Rex sprite not hidden
9E99 LD B,$03
9E9B PUSH BC
9E9C LD B,$03
9E9E PUSH BC
9E9F CALL $A51D
9EA2 AND (HL)
9EA3 LD (HL),A
9EA4 INC HL
9EA5 POP BC
9EA6 DJNZ $9E9E
9EA8 ADD HL,DE
9EA9 POP BC
9EAA DJNZ $9E9B
9EAC LD A,($A1FB) Jump forward if teleporting Rex dead
9EAF OR A
9EB0 JP NZ,$9EC4
9EB3 LD A,($A1F7) Decrement number of lines to hide
9EB6 DEC A
9EB7 LD ($A1F7),A
9EBA OR A Return if number of lines is not zero
9EBB RET NZ
9EBC JP $9ED5 Jump to finish teleporting
Code not reached
9EBF LD A,$64
9EC1 LD ($A1FA),A
Handle teleporting Rex after dead.
9EC4 LD A,($A1F7) Increment the number of lines to hide
9EC7 INC A
9EC8 LD ($A1F7),A
9ECB CP $12 Return if number of lines is not 18
9ECD RET NZ
9ECE XOR A Set Rex invisible
9ECF LD ($A1F6),A
9ED2 JP $9EDE Jump to reset teleporting counter
Rex has teleported completely
9ED5 XOR A Stop teleporting
9ED6 LD ($A1F9),A
9ED9 LD A,$01 Set Rex visible
9EDB LD ($A1F6),A
Reset teleporting loop counter
9EDE LD A,$1E Reset the teleporting loop counter
9EE0 LD ($A1FA),A
9EE3 RET
Prev: 9E3D Up: Map Next: 9EE4