Prev: 95DF Up: Map Next: 962B
95ED: Condition: Is The Location Lit?
Reports whether the current location is lit.
We're only interested if the currently processed character is the player. Return if not.
LocationLit 95ED LD A,($B6EA) Return if CurrentCharacter is not zero.
95F0 AND A
95F1 RET NZ
Begin...
95F2 PUSH IX Save IX and BC, and point IX at the player.
95F4 PUSH BC
Check if the player object is inside "something".
95F5 LD IX,$C11B
95F9 CALL ContainerLit Call ContainerLit to test whether the container is lit.
95FC INC A If the player is inside of another object then jump to LocationLit_Sword.
95FD JR NZ,LocationLit_Sword
Check the location data to see if this location is light or dark.
95FF CALL GetObjectLocationInIX Call GetObjectLocationInIX to point IX at this location.
9602 BIT 7,(IX+$00) If the location is marked as being "LIGHT" then jump to LocationLit_Return to return.
9606 JR NZ,LocationLit_Return
The "Short Strong Sword" is a light source, can it be used?
LocationLit_Sword 9608 PUSH IY Save IY, point it at $0E - "Short Strong Sword", and call ConditionTheObjectIsHere.
960A LD A,$0E
960C LD IY,$C305
9610 CALL ConditionTheObjectIsHere
9613 POP IY Jump to LocationLit_IsDark if ConditionTheObjectIsHere did not find that object here.
9615 JR Z,LocationLit_IsDark
9617 LD A,($C30C) Read that object's attributes.
961A XOR $F7 XOR 11110111.
961C AND $1C Jump to LocationLit_IsLight if that object gives light, is not broken and is full.
961E JR Z,LocationLit_IsLight
The below handle the two responses for "light" and "dark" using the carry flag to signify darkness when set, and light unset.
LocationLit_IsDark 9620 LD HL,$AE1F Point at the message "it is dark" (AE1F).
9623 SCF Set carry: this location is dark.
LocationLit_Return 9624 POP BC Restore BC and IX from the stack.
9625 POP IX
9627 RET Return.
LocationLit_IsLight 9628 AND A Clear carry: this location is lit.
9629 JR LocationLit_Return Jump back to LocationLit_Return to return.
Prev: 95DF Up: Map Next: 962B