![]()  | 
Routines | 
| Prev: 37850 | Up: Map | Next: 38443 | 
| 
 | 
||||
| 
 
We're only interested if the currently processed character is the player. Return if not.
 
 | 
||||
| LocationLit | 38381 | LD A,(46826) | Return if CurrentCharacter is not zero. | |
| 38384 | AND A | |||
| 38385 | RET NZ | |||
| 
 
Begin...
 
 | 
||||
| 38386 | PUSH IX | Store IX and BC on the stack. | ||
| 38388 | PUSH BC | |||
| 
 
Check if the player object is inside "something".
 
 | 
||||
| 38389 | LD IX,49435 | IX="You". | ||
| 38393 | CALL ContainerLit | Call ContainerLit. | ||
| 38396 | INC A | If the player is inside of another object then jump to LocationLit_Sword. | ||
| 38397 | JR NZ,LocationLit_Sword | |||
| 
 
Check the location data to see if this location is light or dark.
 
 | 
||||
| 38399 | CALL GetObjectLocationInIX | Call GetObjectLocationInIX. | ||
| 38402 | BIT 7,(IX+0) | If the location is marked as being "LIGHT" then jump to LocationLit_Return to return. | ||
| 38406 | JR NZ,LocationLit_Return | |||
| 
 
The "Short Strong Sword" is a light source, can it be used?
 
 | 
||||
| LocationLit_Sword | 38408 | PUSH IY | Stash IY on the stack briefly. | |
| 38410 | LD A,14 | Using A=$0E and HL=49925 which are the object ID and object location for "Short Strong Sword", call 40500. | ||
| 38412 | LD IY,49925 | |||
| 38416 | CALL 40500 | |||
| 38419 | POP IY | Restore IY from the stack. | ||
| 38421 | JR Z,LocationLit_IsDark | Jump to LocationLit_IsDark if it is dark. | ||
| 38423 | LD A,(49932) | A=the attributes for "Short Strong Sword". | ||
| 38426 | XOR 247 | XOR 11110111. | ||
| 38428 | AND 28 | If the "Short Strong Sword" is not "Broken", "Gives Light" and is not "Full" (?) then jump to LocationLit_IsLight. | ||
| 38430 | 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 | 38432 | LD HL,44575 | HL="it is dark". | |
| 38435 | SCF | Set the carry flag. | ||
| LocationLit_Return | 38436 | POP BC | Restore BC and IX from the stack. | |
| 38437 | POP IX | |||
| 38439 | RET | Return. | ||
| LocationLit_IsLight | 38440 | AND A | Reset the carry flag. | |
| 38441 | JR LocationLit_Return | Jump to LocationLit_Return. | ||
| Prev: 37850 | Up: Map | Next: 38443 |