the-infocom-files / starcross

Starcross
5 stars 3 forks source link

Trying to take a pseudo object triggers a Frotz warning #56

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

The quickest way to reproduce this bug is to go to the spaceship bridge and:

>GET OBJECT
Warning: @test_attr called with object 0 (PC = 6910) (will ignore further
occurrences)
You can't be serious.

The error happens in PRE-TAKE, when it checks if PRSO is in a closed (presumably transparent) container.

This does not happen in zork-substrate, probably because there PSEUDO-OBJECT resides in LOCAL-GLOBALS. In Starcross, it has no parent. So that seems like it could be a sensible fix here, too.

eriktorbjorn commented 5 years ago

This looks like it could be affecting several other games as well. I'll see if I can make a list later.

eriktorbjorn commented 5 years ago

Not every game has PSEUDO-OBJECT.

Games where PSEUDO-OBJECT has no parents:

I can reproduce the bug in Cutthroats, Hitchhiker's Guide, Planetfall, Seastalker, Starcross, Suspect, and The Witness.

The Solid Gold versions don't build yet.

Infidel and Suspended don't seem to use pseudo objects.

I haven't checked what the others do differently so that I couldn't trigger the bug there.

Games where PSEUDO-OBJECT is in GLOBAL-OBJECTS:

Games where PSEUDO-OBJECT is in LOCAL-GLOBALS:

eriktorbjorn commented 4 years ago

Changing the parent of the pseudo object can have unexpected (though possibly beneficial) consequences, though. Consider this case in Wishbringer's HERE-F:

           (<AND <VERB? PUT PUT-ON THROW>
             <EQUAL? ,PRSI ,PSEUDO-OBJECT>>
        <PERFORM ,V?DROP ,PRSO>)

HERE-F is used for various pseudo objects, e.g. the planks at Wharf's End. In theory, "PUT NOTE ON PLANKS" should drop the note. Instead it replies with "You can't see any planks here!"

That's because of the PRE-PUT pre-action (which is also called for a couple of other actions), which contains this check:

           (<NOT <ACCESSIBLE? ,PRSI>>
        <CANT-SEE-ANY ,PRSI>
        <RTRUE>)

An object without a parent can't ever be accessible, so PSEUDO-OBJECT doesn't stand a chance. Putting it in GLOBAL-OBJECTS makes the PUT action work as expected.