the-infocom-files/hitchhiker-invclues

The game sometimes crashes Frotz with an illegal object error

Opened this issue · 1 comments

This bug was reported by Esteban Díaz in the ZIL Facebook group. He didn't trigger it until very late in the game, when asking Marvin to open the hatch. I was able to trigger what I believe is the same bug in the second room of the game:

>SOUTH
You make your way down to the front porch.

Front Porch
This is the enclosed front porch of your home. Your front garden lies to the
south, and you can reenter your home to the north.
On the doormat is a pile of junk mail.

>FIND FORD PREFECT
@Attempt to address illegal object 27278.  This is normally fatal.
Fatal error: Illegal object

This seems to be caused by an off-by-one error in GLOBAL-CHECK:

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

In all other Solid Gold games, it subtracts one from RMGL. Here's the corresponding code from Leather Goddesses of Phobos:

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

Without that, it looks one element past the last object in the room's GLOBAL property. The effect of this is unpredictable since it depends on exactly what ZILF puts in the memory area right after the GLOBAL property. But other than crashes, I was able to pick up the number twelve asteroid paint chipper from the Vogon Hold, and you're not supposed to get that until after you solve the bugblatter beast puzzle.

The bug is present in the official Solid Gold release as well, though I wasn't able to find any dramatic cases when I looked. In fact, the only one I found (though I only played up to the Vogon Hold) was:

>SOUTH
You make your way down to the front porch.

Front Porch
This is the enclosed front porch of your home. Your front garden lies to the
south, and you can reenter your home to the north.
On the doormat is a pile of junk mail.

>EXAMINE RECEPTACLE
You see nothing special about the large receptacle.

That's the receptacle from the Heart of Gold's bridge, making an uncredited cameo back on earth.