the-infocom-files / zork1

Zork I: The Great Underground Empire
11 stars 3 forks source link

Enable fighting with the cyclops? (Probably not on any main branch) #19

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

This isn't a bug, but...

The game still contains all the messages for fighting with the cyclops, even though you can't fight him. (I believe you could in the MDL version). Should this be re-enabled?

One reason why you can't fight him is because of how it iterates through the VILLAIN table, i.e. this one:

"each table entry is:"

<CONSTANT V-VILLAIN 0>  ;"villain"
<CONSTANT V-BEST 1> ;"best weapon"
<CONSTANT V-BEST-ADV 2> ;"advantage it confers"
<CONSTANT V-PROB 3> ;"prob of waking if unconscious"
<CONSTANT V-MSGS 4> ;"messages for that villain"

"This table must be after TROLL-MELEE, THIEF-MELEE, CYCLOPS-MELEE defined!"

<GLOBAL VILLAINS
    <LTABLE <TABLE TROLL SWORD 1 0 TROLL-MELEE>
        <TABLE THIEF KNIFE 1 0 THIEF-MELEE>
        <TABLE CYCLOPS <> 0 0 CYCLOPS-MELEE>>>

It's an LTABLE so element 0 contains the number of elements (3), and elements 1-3 contain the data for the troll, thief and cyclops respectively.

It iterates through the table in DO-FIGHT, HERO-BLOW and I-FIGHT, and they all use the same general pattern:

         <REPEAT ()
                 <SET CNT <+ .CNT 1>>
                 <COND (<EQUAL? .CNT .LEN> <RETURN>)>
                 "Do all the interesting stuff here">

Where LEN has previously been set to <GET ,VILLAINS 0> and CNT to 0.

That means it will look at element 1 (the troll) and 2 (the thief), but when it gets to 3 (the cyclops) it will terminate without doing anything with it. (This actually caused a bug in the older version of Mini-Zork I. The entry for the cyclops had been removed, so you couldn't attack the thief.)

So at the very least, to enable cyclops fighting you'd have to go through the routines mentioned above and change <EQUAL? .CNT .LEN> to <G? .CNT .LEN>.

That's not enough, though. The cyclops is unarmed, so attacking him kills him instantly. So you'd have to change the <OR <NOT .DWEAPON> <L? .DEF 0>> check in HERO-BLOW, I guess.

And you'd have to remove the ATTACK case from CYCLOPS-FCN, of course.

I don't know if that's enough, but it wasn't obviously broken at a quick test... Except for some reason, I got "The cyclops doesn't take kindly to being grabbed." whenever I picked up my sword again after he disarmed me. Weird.

eriktorbjorn commented 5 years ago

On second thought, this may be the kind of change that should either just be documented, or in a separate branch, since it changes the behavior of the original game. (Even if it is to restore a feature from the original original game.)