| Routines

63152: Check whether a character is standing next to a light switch or window blind

Used by the routines at 30092 and 63209. Returns with the zero flag reset if the character is standing next to a light switch or a window that has a blind, and with the bit set in A identifying the fixture that was found.
Input
H | Character number (215-230)
63152 | LD L,4 | Point HL at byte 4 of the character's buffer
63154 | BIT 0,(HL) | Is the character indoors?
63156 | RET Z | Return if not
63157 | CALL 63138 | Collect in C the x-coordinate of the front column of the character's sprite
63160 | LD B,128 | Bit 7 set: check for a light switch at the left side of the room
63162 | JR Z,63184 | Jump if C=0 mod 8
63164 | LD B,16 | Bit 4 set: check for a blind on the left-hand window
63166 | SUB 3 | Does C=1 or 2 mod 8?
63168 | JR C,63184 | Jump if so
63170 | LD B,4 | Bit 2 set: check for a blind on a large central window
63172 | SUB 2 | Does C=3 or 4 mod 8?
63174 | JR C,63184 | Jump if so
63176 | LD B,8 | Bit 3 set: check for a blind on the right-hand window
63178 | SUB 2 | Does C=5 or 6 mod 8?
63180 | JR C,63184 | Jump if so
63182 | LD B,64 | Bit 6 set: check for a light switch at the right side of the room (when C=7 mod 8)
63184 | PUSH BC | Save the fixture identifier bit (in B)
63185 | CALL 62548 | Is the character standing next to a light switch or a window that has a blind?
63188 | JR NZ,63193 | Jump if so
63190 | POP AF | Restore the fixture identifier bit to A (though we don't need it now)
63191 | XOR A | Set the zero flag
63192 | RET |
63193 | POP AF | Restore the fixture identifier bit to A
63194 | AND A | Reset the zero flag
63195 | RET |