| Routines

64512: Deal with a character who is stepping onto or over the roof of no. 19

Used by the routine at 64338. If the character is about to step off the edge of the roof of no. 17 or the apartment building next to no. 19 towards no. 19, this routine checks whether there is a rope above the roof of no. 19 and moves the character accordingly. Otherwise, if the character is about to move left onto the roof of no. 17 (having just crossed the roof of no. 19 by means of the rope), this routine removes the rope.
Input
B | Location indicator (2-6; see 64338)
H | Character number (215-230)
64512 | LD A,B | A=location indicator
64513 | CP 2 | Is the character standing on the right edge of the roof of one of the apartment buildings (next to no. 74 and no. 19), or on the left edge of the roof of no. 17?
64515 | RET NZ | Return if not
64516 | LD L,1 | Point HL at byte 1 of the character's buffer
64518 | LD A,(HL) | A=character's x-coordinate
64519 | CP 206 | Is it less than 206 (meaning the character is standing on the right edge of the roof of the apartment building next to no. 74)?
64521 | RET C | Return if so
64522 | JR NZ,64534 | Jump unless the character's x-coordinate is 206
The character is standing on the right edge of the roof the apartment building next to no. 19, or the left edge of the roof of no. 17.
64524 | LD A,(47386) | Collect the Z value for 208<=x<=215, 6<=y<=11 from the block at 47360
64527 | CP 11 | Is there a rope connecting the roofs of no. 17 and the apartment building next to no. 19 (in which case A=9)?
64529 | RET Z | Return if not
64530 | POP BC | Drop the return address (64341) from the stack
64531 | JP 60423 | Move the character midstride
The character is standing on the left edge of the roof of no. 17.
64534 | DEC L | L=0
64535 | BIT 7,(HL) | Is the character facing left?
64537 | JR Z,64524 | Jump if so
The character is about to move right, away from the left edge of the roof of no. 17.
64539 | LD A,(47386) | Collect the Z value for 208<=x<=215, 6<=y<=11 from the block at 47360
64542 | CP 11 | Is there a rope connecting the roofs of no. 17 and the apartment building next to no. 19 (in which case A=9)?
64544 | CALL NZ,64549 | Remove it if so
64547 | JR 64530 | Move the character midstride