shithub: choc

Download patch

ref: 6a2255c70b882391931a7ef7ad9ada47a88b7c77
parent: 1011b3bd314e515e6357df8b5b77d33a2528ae34
author: James Haley <haleyjd@hotmail.com>
date: Sun Feb 24 20:38:41 EST 2013

Portability tweak when adding quest flags from collected items, due to
the Broken Power Coupling's anomalous speed value of 512*FRACUNIT
(verified against binary). Added note about this in the quest flags
enumeration as well; bit 31 (quest #32) is accidentally set by this
item, but is never checked for anywhere.

Subversion-branch: /branches/v2-branch
Subversion-revision: 2560

--- a/src/strife/doomdef.h
+++ b/src/strife/doomdef.h
@@ -253,7 +253,7 @@
     QF_QUEST5  = (1 << tk_quest5),  // Accepted Gov. Mourel's "bloody" chore
     QF_QUEST6  = (1 << tk_quest6),  // Destroyed the Power Coupling
     QF_QUEST7  = (1 << tk_quest7),  // Killed Blue Acolytes ("Scanning Team")
-    QF_QUEST8  = (1 << tk_quest8),
+    QF_QUEST8  = (1 << tk_quest8),  // Unused; formerly, picked up Broken Coupling
     QF_QUEST9  = (1 << tk_quest9),  // Obtained Derwin's ear
     QF_QUEST10 = (1 << tk_quest10), // Obtained Prison Pass
     QF_QUEST11 = (1 << tk_quest11), // Obtained Prison Key
@@ -277,7 +277,7 @@
     QF_QUEST29 = (1 << tk_quest29), // Destroyed the Mines Transmitter
     QF_QUEST30 = (1 << tk_quest30),
     QF_QUEST31 = (1 << tk_quest31),
-    QF_QUEST32 = (1 << tk_quest32), // Note: seems to be unused
+    QF_QUEST32 = (1 << tk_quest32), // Unused; BUG: Broken Coupling accidentally sets it.
     
     QF_ALLQUESTS  = (QF_QUEST31 + (QF_QUEST31 - 1)) // does not include bit 32!
 };
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -726,11 +726,14 @@
 
     if(special->flags & MF_GIVEQUEST)
     {
-        // [STRIFE] TODO - verify this. Seems that questflag isn't
-        // applied if the special's speed is equal to 8 or if
-        // the player has received a specific quest token
+        // [STRIFE]: Award quest flag based on the thing's speed. Quest 8 was
+        // apparently at some point given by the Broken Power Coupling, which is
+        // why they don't want to award it if you have Quest 6 (which is 
+        // acquired by destroying the Front's working power coupling). BUT, the 
+        // broken coupling object's speed is NOT 8... it is 512*FRACUNIT. For
+        // strict portability beyond the x86, we need to AND the operand by 31.
         if(special->info->speed != 8 || !(player->questflags & QF_QUEST6))
-            player->questflags |= 1 << (special->info->speed - 1);
+            player->questflags |= 1 << ((special->info->speed - 1) & 31);
     }