the-infocom-files / witness

The Witness
3 stars 4 forks source link

BACK-FOOTPRINTS and SIDE-FOOTPRINTS are only shown in brief mode #19

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago
>EAST
(office porch)
You notice some fresh foot prints heading east.

>LOOK
(office porch)
You are standing on a small concrete slab outside Linder's office. A sign
between the door and the window reads "PACIFIC TRADE ASSOCIATES". To the north
is a tidy lawn, extending east to the edge of the woods. A path of stepping
stones leads south to the back gate.

>SOUTH
(office path)
There's a muddy handgun here

>WEST
(side yard)
You notice a fresh row of foot prints going from the back yard to the driveway.

>LOOK
(side yard)
This is a little-used side yard, hidden from the street by the fence. The back
yard lies to the east and the driveway to the west.

This works in the released version of the game, but not in this version.

Both BACK-FOOTPRINTS and SIDE-FOOTPRINTS are local global objects. OFFICE-PORCH-F and SIDE-YARD-F have special cases for when RARG is M-FLASH (i.e. when printing the brief room description). Maybe they're local global so that brief mode only shows them once, the first time you see them? But how are they then supposed to be shown in verbose mode? The Witness has some debugging code left, and here's what the released version prints:

>EAST
[Perform: 125]
[detective=][Actor: Not handled]
[Room (M-BEG): Not handled]
[Action:]
(office porch)
You are standing on a small concrete slab outside Linder's office. A sign
between the door and the window reads "PACIFIC TRADE ASSOCIATES". To the north
is a tidy lawn, extending east to the edge of the woods. A path of stepping
stones leads south to the back gate.
You notice some fresh foot prints heading east.
[Room (M-END): Not handled]
[Mr. Stiles just went into the driveway.]

If I understand that correctly, it's the standard look action that's supposed to print the description of the footprints.

eriktorbjorn commented 5 years ago

Not even the preserved Release 23 (which I thought would be the closest match to this source code) doesn't have this bug.

One interesting thing is that in that version, every time I look in the office porch, it sets attribute 4 (TOUCHBIT) on the set of footprints. That does not happen in the version I compiled with ZILF. That led me to look at the .zap files, and I saw that there is only one place where it explicitly sets the TOUCHBIT on BACK-FOOTPRINTS. (Though of course there may be places where it sets it on an object that just happens to be the footprints.) And that's in OFFICE-PORCH-F:

    .FUNCT  OFFICE-PORCH-F,RARG=0
    EQUAL?  RARG,M-LOOK \FALSE
    PRINTI  "You are standing on a small concrete slab outside Linder's office. A sign between the door and the window reads ""PACIFIC TRADE ASSOCIATES"". To the north is a tidy lawn, extending east to the edge of the woods. A path of stepping stones leads south to the back gate."
    CRLF    
    FSET?   BACK-FOOTPRINTS,INVISIBLE /FALSE
    CALL    DESCRIBE-OBJECT,BACK-FOOTPRINTS,TRUE-VALUE,0
    FSET    BACK-FOOTPRINTS,TOUCHBIT
    RTRUE   

Now, that doesn't seem to correspond with OFFICE-PORCH-F:

<ROUTINE OFFICE-PORCH-F ("OPTIONAL" (RARG <>))
     <COND (<==? .RARG ,M-LOOK>
        <TELL
"You are standing on a small concrete slab outside Linder's office. A sign
between the door and the window reads \"PACIFIC TRADE ASSOCIATES\". To the
north is a tidy lawn, extending east to the edge of the woods. A path of
stepping stones leads south to the back gate." CR>)
           (<==? .RARG ,M-FLASH>
        <COND (<AND <NOT <FSET? ,BACK-FOOTPRINTS ,INVISIBLE>>
                <NOT <FSET? ,BACK-FOOTPRINTS ,TOUCHBIT>>>
               <DESCRIBE-OBJECT ,BACK-FOOTPRINTS T 0>
               <FSET ,BACK-FOOTPRINTS ,TOUCHBIT>)>)>>

Similarly the ZAP code for SIDE-YARD-F:

    .FUNCT  SIDE-YARD-F,RARG=0
    EQUAL?  RARG,M-LOOK \?ELS5
    PRINTI  "This is a little-used side yard, hidden from the street by the fence. The back yard lies to the east and the driveway to the west."
    CRLF    
    FSET?   SIDE-FOOTPRINTS,INVISIBLE /FALSE
    CALL    DESCRIBE-OBJECT,SIDE-FOOTPRINTS,TRUE-VALUE,0
    FSET    SIDE-FOOTPRINTS,TOUCHBIT
    RTRUE   
?ELS5:  EQUAL?  RARG,M-BEG \FALSE
    EQUAL?  HERE,SIDE-YARD \FALSE
    ZERO?   GROUND-MUDDY /FALSE
    EQUAL?  PRSA,V?FOLLOW,V?WALK \FALSE
    SET 'SIDE-FOOTPRINTS-CONFUSED,TRUE-VALUE
    RFALSE

doesn't quite match the ZIL code for it:

<ROUTINE SIDE-YARD-F ("OPTIONAL" (RARG <>))
     <COND (<==? .RARG ,M-LOOK>
        <TELL 
"This is a little-used side yard, hidden from the street by the fence.
The back yard lies to the east and the driveway to the west." CR>)
           (<==? .RARG ,M-FLASH>
        <COND (<AND <NOT <FSET? ,SIDE-FOOTPRINTS ,INVISIBLE>>
                <NOT <FSET? ,SIDE-FOOTPRINTS ,TOUCHBIT>>>
               <DESCRIBE-OBJECT ,SIDE-FOOTPRINTS T 0>
               <FSET ,SIDE-FOOTPRINTS ,TOUCHBIT>)>)
           (<AND <==? .RARG ,M-BEG>
             <==? ,HERE ,SIDE-YARD>
             ,GROUND-MUDDY
             <VERB? WALK FOLLOW>>
        <SETG SIDE-FOOTPRINTS-CONFUSED T>
        <RFALSE>)>>

I think what must have happened is that after the unreleased version 23 was compiled, someone changed the code further to make the footprints visible in brief mode, without realizing (or maybe not realizing until after the backup was made) that this broke verbose mode.

eriktorbjorn commented 5 years ago

I think the most sensible thing would be to preserve the "brief" behavior (since it represents the last known development of the game), while restoring the "verbose" behavior. I.e. something like this:

<ROUTINE OFFICE-PORCH-F ("OPTIONAL" (RARG <>))
     <COND (<==? .RARG ,M-LOOK>
        <TELL
"You are standing on a small concrete slab outside Linder's office. A sign
between the door and the window reads \"PACIFIC TRADE ASSOCIATES\". To the
north is a tidy lawn, extending east to the edge of the woods. A path of
stepping stones leads south to the back gate." CR>
        <COND (<NOT <FSET? ,BACK-FOOTPRINTS ,INVISIBLE>>
               <DESCRIBE-OBJECT ,BACK-FOOTPRINTS T 0>
               <FSET ,BACK-FOOTPRINTS ,TOUCHBIT>)>)
           (<==? .RARG ,M-FLASH>
        <COND (<AND <NOT <FSET? ,BACK-FOOTPRINTS ,INVISIBLE>>
                <NOT <FSET? ,BACK-FOOTPRINTS ,TOUCHBIT>>>
               <DESCRIBE-OBJECT ,BACK-FOOTPRINTS T 0>
               <FSET ,BACK-FOOTPRINTS ,TOUCHBIT>)>)>>

<ROUTINE SIDE-YARD-F ("OPTIONAL" (RARG <>))
     <COND (<==? .RARG ,M-LOOK>
        <TELL 
"This is a little-used side yard, hidden from the street by the fence.
The back yard lies to the east and the driveway to the west." CR>
        <COND (<NOT <FSET? ,SIDE-FOOTPRINTS ,INVISIBLE>>
               <DESCRIBE-OBJECT ,SIDE-FOOTPRINTS T 0>
               <FSET ,SIDE-FOOTPRINTS ,TOUCHBIT>)>)
           (<==? .RARG ,M-FLASH>
        <COND (<AND <NOT <FSET? ,SIDE-FOOTPRINTS ,INVISIBLE>>
                <NOT <FSET? ,SIDE-FOOTPRINTS ,TOUCHBIT>>>
               <DESCRIBE-OBJECT ,SIDE-FOOTPRINTS T 0>
               <FSET ,SIDE-FOOTPRINTS ,TOUCHBIT>)>)
           (<AND <==? .RARG ,M-BEG>
             <==? ,HERE ,SIDE-YARD>
             ,GROUND-MUDDY
             <VERB? WALK FOLLOW>>
        <SETG SIDE-FOOTPRINTS-CONFUSED T>
        <RFALSE>)>>

(Yes, I know it duplicates some code. But we're not that pressed for space with this game.)