![]() |
Routines |
| Prev: 95DF | Up: Map | Next: 962B |
|
Characters are never in the dark: anyone but the player gets "no" at once. A player shut inside something that cannot be seen into (SHUT_IN) skips the room's light altogether, so a closed barrel is dark inside even in a lit room; otherwise the player can see if the room is lit -- bit 7 of the first byte of its record. Failing that only the short strong sword helps: it has to be within the player's reach (lying in the same room will do), and its flag byte at SHORT_STRONG_SWORD_FLAGS must have bit 2 set, bit 3 clear and bit 4 set, which is what XOR $F7 then AND $1C tests for in one go. It starts as $94, so it glows from the beginning, and having it at hand lights every dark place. The torch has the same flags, but only the sword is tested. Tried in the simulator: with the sword lying in the trolls' cave the cave could be seen, and with it moved out it could not; and a player who climbed into the barrel in Bag End and closed it was in the dark, and could not then OPEN it, since OPEN needs light and the barrel is not carried.
Twenty-six of the seventy-nine rooms are dark, and they are the ones the story says are: the trolls' cave, the goblins' dungeon, the large dry cave, the big goblins' cavern, the dark winding passage, inside the goblins' gate, fifteen identical dark stuffy passages, Gollum's lake, the Elvenking's halls, cellar and dungeon, and the passage into the mountain.
What depends on it: MOVE, which in the dark throws the direction away and picks one from 1 to 10 at random; and CLEAR_CANVAS, which blacks the picture out instead of drawing it.
|
||||||||
| TOO_DARK | 95ED | LD A,(ACTING) | Characters can always see: only the player is ever in the dark | |||||
| 95F0 | AND A | |||||||
| 95F1 | RET NZ | |||||||
| 95F2 | PUSH IX | |||||||
| 95F4 | PUSH BC | |||||||
| 95F5 | LD IX,PLAYER | Shut inside something closed? Then the room's light does not count: only the sword | ||||||
| 95F9 | CALL SHUT_IN | |||||||
| 95FC | INC A | |||||||
| 95FD | JR NZ,TOO_DARK_0 | |||||||
| 95FF | CALL ACTOR_ROOM | So can a player in a lit room (bit 7 of its first byte) | ||||||
| 9602 | BIT 7,(IX+$00) | |||||||
| 9606 | JR NZ,TOO_DARK_2 | |||||||
| TOO_DARK_0 | 9608 | PUSH IY | Otherwise only by the sword, object $0E, if it is within reach... | |||||
| 960A | LD A,$0E | |||||||
| 960C | LD IY,SHORT_STRONG_SWORD | |||||||
| 9610 | CALL IN_REACH | |||||||
| 9613 | POP IY | |||||||
| 9615 | JR Z,TOO_DARK_1 | |||||||
| 9617 | LD A,(SHORT_STRONG_SWORD_FLAGS) | ...and glowing: flags bit 2 set, bit 3 clear, bit 4 set, all in one test | ||||||
| 961A | XOR $F7 | |||||||
| 961C | AND $1C | |||||||
| 961E | JR Z,TOO_DARK_3 | |||||||
| TOO_DARK_1 | 9620 | LD HL,MSG_IT_IS_DARK | Too dark: carry set, and HL = "it is dark." | |||||
| 9623 | SCF | |||||||
| TOO_DARK_2 | 9624 | POP BC | ||||||
| 9625 | POP IX | |||||||
| 9627 | RET | |||||||
| TOO_DARK_3 | 9628 | AND A | Can see: carry clear | |||||
| 9629 | JR TOO_DARK_2 | |||||||
| Prev: 95DF | Up: Map | Next: 962B |