the-infocom-files / zork2

Zork II: The Wizard of Frobozz
8 stars 4 forks source link

Multiple issues with the menhir #6

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

There are multiple, related issues with the menhir. To understand them, we first need to know what can happen to the menhir:

Here's some useful debug code for testing these states:

<SYNTAX DEBUG = V-DEBUG>
<ROUTINE V-DEBUG ()
     <SETG CAROUSEL-FLIP-FLAG T>    ; "Stop the spinning"
     <SETG GUARDIAN-FED T>      ; "Open the door"
     <SETG WIZ-DOOR-FLAG T>
     <FSET ,WIZ-DOOR ,OPENBIT>
     <MOVE ,GENIE ,PENTAGRAM-ROOM>  ; "Summon and satisfy the demon"
     <FCLEAR ,GENIE ,INVISIBLE>
     <SETG GENIE-READY? T>
     <DISABLE <INT I-WIZARD>>   ; "Summon the Wizard"
     <MOVE ,WIZARD ,PENTAGRAM-ROOM>
     <SETG ALWAYS-LIT T>        ; "Let there be light"
     <SETG LIT T>
     <MOVE ,BRICK ,ADVENTURER>  ; "It's the bomb!"
     <MOVE ,FUSE ,ADVENTURER>
     <MOVE ,MATCH ,ADVENTURER>
     <GOTO ,PENTAGRAM-ROOM>>

There are a couple of problems:

You can examine the menhir from the Menhir Room and the Kennel, even if the menhir has been moved from the room. The problem here is that the menhir is a "local-global" object. At the start of the game, it's sitting in LOCAL-GLOBALS and both KENNEL and MENHIR-ROOM have it in their GLOBAL properties.

According to the ZIL manual, the object has to be in LOCAL-GLOBALS to be a local-global object, but apparently this isn't the case. Here's what the relevant part of GLOBAL-CHECK looks like:

        <COND (<SET RMG <GETPT ,HERE ,P?GLOBAL>>
               <SET RMGL <- <PTSIZE .RMG> 1>>
               <REPEAT ()
                       <COND (<THIS-IT? <SET OBJ <GETB .RMG .CNT>> .TBL>
                              <OBJ-FOUND .OBJ .TBL>)>
                       <COND (<IGRTR? CNT .RMGL> <RETURN>)>>)>

I think that means that it simply loops through the GLOBAL property and check if what you typed matches any of them. If so, it's added to the list of found objects by calling OBJ-FOUND. There's nothing about it having to be in LOCAL-GLOBALS.

In Mini-Zork II, I changed it to this instead, which seems to work:

        <COND (<SET RMG <GETPT ,HERE ,P?GLOBAL>>
               <SET RMGL <- <PTSIZE .RMG> 1>>
               <REPEAT ()
                       <COND (<AND <EQUAL? <LOC <SET OBJ <GETB .RMG .CNT>>>
                                           ,LOCAL-GLOBALS>
                                   <THIS-IT? .OBJ .TBL>>
                              <OBJ-FOUND .OBJ .TBL>)>
                       <COND (<IGRTR? CNT .RMGL> <RETURN>)>>)>

I don't know if any other game than Zork II plays this sort of trick with local-global objects.

Another problem is that DESCRIBE-MENHIR never prints the description of the menhir floating in the air. That's because the game uses MENHIR-POSITION 2 to indicate that the demon has removed the menhir from the game, and 3 both to indicate that the menhir has been moved to the Pentagram Room and to indicate that it's being levitated.

Since both the case where the menhir is removed and the case where it's been moved to the Pentagram Room should be described the same way in DESCRIBE-MENHIR, I think the proper fix is to use MENHIR-POSITION 2 for both these cases, and remove the case for MENHIR-POSITION 3 from DESCRIBE-MENHIR. That case seems intended for describing the menhir when it's in the Pentagram Room, but the routine is never called from there.

The description of the passage leading southwest is only printed in brief mode when the menhir is gone. That's because DESCRIBE-MENHIR is always called when RARG is M-FLASH (brief description). When it's M-LOOK (full description), it's only called if the menhir is in LOCAL-GLOBALS.

I think the solution here is to always call DESCRIBE-MENHIR in both these cases.

Finally, if you ask the demon to give you the menhir, it's described in the Pentagram Room as "There is a enormous menhir here.".

Zork II doesn't have any VOWELBIT. Since DESCRIBE-MENHIR wanted to describe it as "There is a huge menhir here.", I guess we could either change its DESC to "huge menhir", or give it an LDESC.

If all this was too confusing to follow, there is a pull request for The ZIL Files at https://github.com/AlexProudfoot/The-ZIL-Files/pull/84