heasm66 / mdlzork

Different versions of original mainframe Zork reconstructed and patched to run under Confusion.
15 stars 6 forks source link

Villains are not properly restored? #50

Open eriktorbjorn opened 1 year ago

eriktorbjorn commented 1 year ago

When I enter the troll room, the troll is described as being unconscious.

I assume that this happens outside of Confusion too. I seem to recall reading that the save/restore function was a source of some headaches. So it may not be worth fixing, but I figured it can't hurt to document these things.

heasm66 commented 1 year ago

I think you're right. I have a vague recollection that there was a problem if you saved and tried to restore during the fight with the thief also (the game crashed?).

eriktorbjorn commented 1 year ago

I also just had some issue where I restored after messing up the balloon/safe puzzle. The newspaper burned out, and I restored, but then I couldn't get the balloon off the ground until I restarted Confusion.

So I guess that whole thing is a bit brittle.

heasm66 commented 1 week ago

Unfortunately this is pretty hard to fix. During the fight the ODESC1 of the "TROLL" (dung.mud) gets changed in the function TROLL (act1.mud). SAVE/RESTORE don't save/restore what the description text is, it is what it is. You can see this the other way around too:

The general recommendation is to never save or restore during a fight. This problem can also pop up in other places when the description of an object changes over time.

heasm66 commented 1 week ago

On potential fix could be to change functions SAVE-GAME and DO-RESTORE (sr.mud) to, instead of saving/restoring variables, use the MDL SUBRs SAVE/RESTORE that saves/restores the whole working memory of the interpreter. This comes with a size penalty of about 30x (current save-file (50 kB) would grow to 1.45 MB).