Prev: 62812 Up: Map Next: 62853
62827: Update character's x-coordinate if new value is allowed, otherwise return
Used by the routine at 62622.
Input
A Updated x-coordinate for character
HL Pointer to x-coordinate data in a character's current position data
Output
A Updated x-coordinate for character (same as input)
62827 PUSH HL Store HL (pointer to x-coordinate in a character's current position data)
62828 PUSH AF Store AF (A = updated x-coordinate)
62829 DEC HL Move HL back to room index
62830 LD A,(HL) Load BC with double character's room index...
62831 ADD A,A ...
62832 LD C,A ...
62833 LD B,0 ...
62835 LD HL,48915 Load HL with start address of character movement restriction data
62838 ADD HL,BC ...and add BC as offset
62839 POP AF Restore AF (A = updated x-coordinate)
62840 CP (HL) If new x-coordinate is same as first disallowed x-coordinate...
62841 JR Z,62850 ...then skip ahead to 62850
62843 INC HL If new x-coordinate is same as second disallowed x-coordinate...
62844 CP (HL) ...
62845 JR Z,62850 ...then skip ahead to 62850
62847 POP HL Store HL (pointer to x-coordinate in a character's current position data)
62848 LD (HL),A Store updated x-coordinate
62849 RET Return
62850 POP HL Store HL (pointer to x-coordinate in a character's current position data)
62851 POP AF Remove return address from top of stack...
62852 RET ...and return to routine that called the routine that called this one
Prev: 62812 Up: Map Next: 62853