the-infocom-files / zork1

Zork I: The Great Underground Empire
10 stars 3 forks source link

Throwing objects defaults to throwing them at yourself #14

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

This is what Release 88 of the game says:

>THROW BOTTLE
What do you want to throw the bottle at?

This is what this version of the game says:

>THROW BOTTLE
(at the you)
The bottle hits the far wall and shatters.
The water spills to the floor and evaporates.

I don't know why it defaults to "at the you". The rest of the messages are arguably correct, though usually throwing things at yourself kills you.

eriktorbjorn commented 5 years ago

I thought perhaps the reason for the implicit "at the you" was because of the syntax of the "THROW AT " action, but in both the latest version and in the Release 88 source it's the same:

<SYNTAX THROW OBJECT (HELD CARRIED HAVE)
    AT OBJECT (FIND ACTORBIT) (ON-GROUND IN-ROOM) = V-THROW>

But if I compile Release 88, it still behaves as the released version so there must be some difference in the parser.

Here's one difference that looks interesting. From what I understand, the routine mostly responsible for printing implicit objects is called GWIM (as in Get What I Mean). In Release 88 part of it looks like this:

    <COND (<GET-OBJECT ,P-MERGE <>>
           <SETG P-GWIMBIT 0>
           <COND (<==? <GET ,P-MERGE ,P-MATCHLEN> 1>
              <COND (<EQUAL? <SET OBJ <GET ,P-MERGE 1>> ,ME>
                 <RFALSE>)>
              <TELL "(">

Which I take to mean "Get a matching object. If you find only one, use that. Unless it's the ME object, in which case the function fails and presumably leads to the game asking you to clarify.

But in the current version, it looks like this:

    <COND (<GET-OBJECT ,P-MERGE <>>
           <SETG P-GWIMBIT 0>
           <COND (<EQUAL? <GET ,P-MERGE ,P-MATCHLEN> 1>
              <SET OBJ <GET ,P-MERGE 1>>
              <TELL "(">

I.e. the test for the ME object is gone. Reinstating it seems to restore the old behavior.

Looking at some of the later games, they also seem to have dropped the ME check, so it's probably deliberate. On the other hand, Zork I, II and III seem to be the only ones with FIND ACTORBIT in the THROW syntax, so maybe it's still undesirable for those particular games?