the-infocom-files / enchanter

Enchanter
8 stars 3 forks source link

The game claims the room goes dark if you turn off a FROTZed object #46

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

At the beginning of the game:

>FROTZ SPELL BOOK
There is an almost blinding flash of light as the spell book begins to glow! It
slowly fades to a less painful level, but the spell book is now quite usable as
a light source.

>TURN OFF SPELL BOOK
The spell book is now off.
It is now pitch black.

This is what V-LAMP-OFF looks like:

<ROUTINE V-LAMP-OFF ()
     <COND (<FSET? ,PRSO ,LIGHTBIT>
        <COND (<NOT <FSET? ,PRSO ,ONBIT>>
               <TELL "It is already off." CR>)
              (ELSE
               <FCLEAR ,PRSO ,ONBIT>
               <COND (<NOT <EQUAL? ,ETERNAL-FLAME ,LANTERN>>
                  <FCLEAR ,PRSO ,LIGHTBIT>)>
               <COND (,LIT
                  <SETG LIT <LIT? ,HERE>>)>
               <TELL "The " D ,PRSO " is now off." CR>
               <SETG LIT <LIT? ,HERE>>
               <COND (<NOT <LIT? ,HERE <>>>
                  <COND (<OR <NOT <EQUAL? ,HERE ,GALLERY>>
                     <NOT <DESCRIBE-PORTRAIT-GALLERY>>>
                     <TELL "It is now pitch black." CR>)>)>)>)
           (<FSET? ,PRSO ,ONBIT>
        <TELL "It's not easy to see how. It's glowing by magic." CR>)
           (ELSE <TELL "You can't turn that off." CR>)>
     <RTRUE>>

I'm not quite sure what happens there, but I can see that it calls <LIT? ,HERE <>> instead of <LIT? ,HERE> to see if the room goes dark. The only other place it does that is GALLERY-F, where light is handled a bit different from elsewhere.

The bug does not happen in r16 of the game, but it does happen in r24. The source code for r16 is preserved, and this is what it looks like there:

<ROUTINE V-LAMP-OFF ()
         <COND (<FSET? ,PRSO ,LIGHTBIT>
                <COND (<NOT <FSET? ,PRSO ,ONBIT>>
                       <TELL "It is already off." CR>)
                      (ELSE
                       <FCLEAR ,PRSO ,ONBIT>
                       <COND (,LIT
                              <SETG LIT <LIT? ,HERE>>)>
                       <TELL "The " D ,PRSO " is now off." CR>
                       <COND (<NOT <SETG LIT <LIT? ,HERE>>>
                              <TELL "It is now pitch black." CR>)>)>)
               (<FSET? ,PRSO ,ONBIT>
                <TELL "It's not easy to see how. It's glowing by magic." CR>)
               (ELSE <TELL "You can't turn that off." CR>)>
         <RTRUE>>

So I guess there was some bug fix when turning off your light source in the gallery, but it didn't work quite right?

eriktorbjorn commented 5 years ago

Perhaps this bug would go away if we don't allow the player to "un-FROTZ" objects? See https://github.com/the-infocom-files/enchanter/issues/45