| The Hobbit (v1.0) | Routines |
| Prev: 8789 | Up: Map | Next: 883E |
|
Called when 8405 did not settle on exactly one workable target, to explain why - or to make the best of it. Inside a quotation (an order to a character) it says nothing at all and returns, so characters are not given the player's excuses.
If exactly one candidate target would work, the instrument is dealt with instead (8789). Otherwise the target's flags at 832E decide:
|
||||
| 87AD | LD A,($B60B) | Are we inside a quotation (an order to a character)? | ||
| 87B0 | DEC A | |||
| 87B1 | RET Z | Yes: say nothing - characters are not given the player's own excuses | ||
| 87B2 | LD A,($B60C) | Is an ALL command still working through a list of objects? | ||
| 87B5 | AND A | |||
| 87B6 | JR Z,$87BC | No: work out what really went wrong, below | ||
| 87B8 | POP HL | Yes: this particular object just did not work out, but others might - abandon it quietly... | ||
| 87B9 | JP $8385 | ...and go straight on to whatever ALL should try next | ||
| 87BC | LD A,($8331) | Did EXACTLY ONE target candidate work, with the problem lying only with the instrument? | ||
| 87BF | CP $01 | |||
| 87C1 | JR Z,$8789 | Yes: go and sort out the instrument specifically | ||
| 87C3 | LD HL,$832E | No: was any noun at all given for the target? | ||
| 87C6 | BIT 0,(HL) | |||
| 87C8 | JP Z,$8821 | No: go and ask "open what?" or say there was nothing to open | ||
| 87CB | BIT 1,(HL) | Are we still in the middle of searching? | ||
| 87CD | LD HL,$8333 | |||
| 87D0 | LD DE,$B5D9 | |||
| 87D3 | LD BC,$B5EF | |||
| 87D6 | JR Z,$87EF | Not searching yet: go and search properly, below | ||
| 87D8 | LD A,($8330) | Already searched: how many candidates fitted the words at all? | ||
| 87DB | AND A | |||
| 87DC | JR Z,$87E6 | None at all: let the action's own handler explain why | ||
| 87DE | DEC A | |||
| 87DF | JR NZ,$8774 | More than one: ask "which one?" | ||
| 87E1 | CALL $84C9 | Exactly one candidate, but the action still failed - does it even need an instrument? | ||
| 87E4 | JR NZ,$8789 | It does: go and sort that out instead | ||
|
This entry point is used by the routines at 8351 and 8789.
|
||||
| 87E6 | CALL $875C | It does not, or nothing else fits: carry the action out anyway... | ||
| 87E9 | CALL $946F | ...so its own handler can explain the real reason ("you cannot open the door") | ||
| 87EC | JP $837F | Then carry on with the rest of the turn as usual | ||
|
This entry point is used by the routine at 8789.
|
||||
| 87EF | PUSH HL | SEARCH PROPERLY: save the noun that was given | ||
| 87F0 | CALL $9DDE | IX = the actor's own room's exits | ||
| 87F3 | LD A,$01 | Assume, for now, that the noun names a nearby room | ||
| 87F5 | LD (BC),A | |||
| 87F6 | CALL $9DE9 | Does any exit lead to a room with that name? | ||
| 87F9 | CP $FF | |||
| 87FB | JR NZ,$8811 | Yes: that settles it - use that room | ||
| 87FD | POP HL | No: restore the noun | ||
| 87FE | LD A,$02 | Widen the search to EVERY object in the game, not just nearby ones... | ||
| 8800 | LD ($B600),A | |||
| 8803 | LD IX,$BF50 | |||
| 8807 | XOR A | ...and note that reach no longer matters | ||
| 8808 | LD (BC),A | |||
| 8809 | PUSH HL | Save the noun again | ||
| 880A | CALL $9D2E | Search absolutely everywhere for something matching it | ||
| 880D | CP $FF | |||
| 880F | JR Z,$8816 | Nothing anywhere fits those words | ||
| 8811 | POP HL | Something was found (a room, or a distant object): use it as the target/instrument... | ||
| 8812 | LD (DE),A | |||
| 8813 | JP $7111 | ...and report the action as a failure ("you cannot open the door"), since it is out of reach | ||
| 8816 | CALL $875C | Truly nothing fits those words anywhere | ||
| 8819 | LD HL,$ACC7 | "I do not see the X here." | ||
| 881C | CALL $72CA | |||
| 881F | XOR A | The command could not be completed | ||
| 8820 | RET | |||
| 8821 | CALL $8869 | NO NOUN GIVEN FOR THE TARGET: push the action's own words as message parameters | ||
| 8824 | LD HL,($8349) | |||
| 8827 | PUSH HL | |||
| 8828 | LD HL,$ACD5 | "I see nothing to <verb> <particle> <preposition>." | ||
| 882B | LD A,($8331) | Was there in fact exactly one possible object, even with no noun named? | ||
| 882E | AND A | |||
| 882F | JP Z,$8781 | No, none at all: print that message and give up | ||
| 8832 | LD A,($8345) | Yes, exactly one: use it anyway, and say which one was chosen | ||
| 8835 | CALL $8765 | |||
| 8838 | LD HL,$ACB8 | "<verb> <particle> <preposition> what?" (one more chance to name it precisely) | ||
| 883B | JP $8781 | |||
| Prev: 8789 | Up: Map | Next: 883E |