the-infocom-files / starcross

Starcross
5 stars 3 forks source link

Looking through airlock doors doesn't work properly #34

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

The nice thing about testing games this way is that you find so many "hidden" features. Here's one:

>LOOK
Red Airlock
This is the main airlock of the red docking port. The inner door leading up to
the interior is open, and the outer door leading down to the surface is closed.

>LOOK THROUGH INNER DOOR
Red Hall
This is a wide room with corridors leading in four directions and a ladder down
to the airlock. The lighting is poor, as though the lights were worn out.
Halfway up the walls are planters full of wilted plants.
This is the main airlock of the red docking port. The inner door leading up to
the interior is open, and the outer door leading down to the surface is closed.

>CLOSE INNER DOOR
The red inner door closes.

>OPEN OUTER DOOR
The outer door opens and air rushes out of the airlock.

>LOOK THROUGH OUTER DOOR
Red Dock
(You are in the Red Airlock.)
This is a docking port color-coded in red. All around are strange protrusions,
one of which could be a hook for a safety line. The surface here is metallic,
but gets stony further from the dock. On one side ("Down") is your ship,
tethered to the surface of the artifact by thick silvery ropes. On the other
("Up") is a large dome with an airlock, which is open.
The door is covered by a smooth pattern of silver hexagons. (outside the Red
Airlock)

Something's off here. When I look through the inner door, it prints both the description for Red Hall and for Red Airlock, and when I look through the outer door it prints "(You are in the Red Airlock.)" and "(outside the Red Airlock)".

Actually, if I then look through the inner door again, I get "(You are in the Red Airlock.)" for that case too. And when I'm in the Red Airlock, it now tells me that "(You are in the Red Airlock.)" Hmm...

And it's also a bit inconsistent that:

>EXAMINE INNER DOOR
The red inner door is open, but I can't tell what's beyond it.

But also:

>UP
Red Hall
This is a wide room with corridors leading in four directions and a ladder down
to the airlock. The lighting is poor, as though the lights were worn out.
Halfway up the walls are planters full of wilted plants.

>LOOK THROUGH INNER DOOR
Red Hall
This is a wide room with corridors leading in four directions and a ladder down
to the airlock. The lighting is poor, as though the lights were worn out.
Halfway up the walls are planters full of wilted plants.

This is handled in RED-DOORS-FCN, which is the action routine for both RED-INNER and RED-OUTER. There's similar code in BLUE-DOORS-FCN and YELLOW-DOORS-FCN as well:

              (<VERB? LOOK-INSIDE>
               <AIRLOCK-LOOK ,RED-INNER ,RED-THREE ,RED-DOCK>)>)
eriktorbjorn commented 5 years ago

One thing that should probably be changed is to only call AIRLOCK-LOOK when you're inside the airlock.

I don't yet understand the other glitches.

eriktorbjorn commented 5 years ago

I just noticed that DESCRIBE-ROOM will give the player's location VEHBIT if the location isn't HERE. That explains the "(You are in the Red Airlock.)" messages, I guess.

eriktorbjorn commented 5 years ago

Printing the description of another room is handled by the GO&LOOK routine. I think the only other game that uses it is Zork II when looking through the window in the door with the key/mat puzzle. If we notice any further problems here, they may also exist there.

eriktorbjorn commented 5 years ago

I think I see what's causing the double room description, but I can't decide if it's a bug or not:

<ROUTINE DESCRIBE-ROOM ("OPTIONAL" (LOOK? <>) "AUX" V? STR AV)
     <SET V? <OR .LOOK? ,VERBOSE>>
     <COND (<NOT ,LIT>
        <TELL
"It is pitch black. You are likely to be eaten by a grue." CR>
        <RETURN <>>)>
     <COND (<NOT <FSET? ,HERE ,TOUCHBIT>>
        <FSET ,HERE ,TOUCHBIT>
        <SET V? T>)>
     <COND (<IN? ,HERE ,ROOMS> <TELL D ,HERE CR>)>
     <COND (<OR .LOOK? <NOT ,SUPER-BRIEF>>
        <SET AV <LOC ,WINNER>>
        <COND (<FSET? .AV ,VEHBIT>
               <TELL "(You are in the " D .AV ".)" CR>)>
        <COND (<AND .V? <APPLY <GETP ,HERE ,P?ACTION> ,M-LOOK>>
               <RTRUE>)
              (<AND .V? <SET STR <GETP ,HERE ,P?LDESC>>>
               <TELL .STR CR>)
              (T <APPLY <GETP ,HERE ,P?ACTION> ,M-FLASH>)>
        <COND (<AND <NOT <==? ,HERE .AV>> <FSET .AV ,VEHBIT>>
               <APPLY <GETP .AV ,P?ACTION> ,M-LOOK>)>)>
     <COND (<AND <NOT <FSET? ,HERE ,ONBIT>> ,ALWAYS-LIT>
        <TELL
"The room is lit by an emergency lighting system." CR>)>
     T>

So if the action routine for HERE returns true when called with the M-LOOK parameter, DESCRIBE-ROOM terminates. RED-DOCK does have an action routine, so that's what happens when looking through the outer door.

Otherwise, it prints the LDESC of HERE. In this case, it does not terminate. RED-THREE does not have an action routine, so that's what happens when looking through the inner door.

If it didn't terminate, it continues by checking if HERE and the player's location aren't the same. If so, it sets VEHBIT on the real location (in this case, RED-LOCK) and calls the action routine in the vehicle with the M-LOOK parameter. And since RED-LOCK does have an action routine, you get the description for the airlock.

eriktorbjorn commented 5 years ago

The more I look at it, the more convinced I am that

<COND (<AND <NOT <==? ,HERE .AV>> <FSET .AV ,VEHBIT>>
               <APPLY <GETP .AV ,P?ACTION> ,M-LOOK>)>)>

was really meant to be

<COND (<AND <NOT <==? ,HERE .AV>> <FSET? .AV ,VEHBIT>>
               <APPLY <GETP .AV ,P?ACTION> ,M-LOOK>)>)>

That is, it's supposed to test VEHBIT, not set it.

I tried to locate the equivalent code in as many games as I could:

Cutthroats, zork-substrate, Zork I (German) and Zork I (Solid Gold) use FSET?, which I think is correct. Enchanter, Infidel and Starcross use FSET, which I think is wrong.