foxygit / doom Log in
commit ab144aa9d30a97f0c3a2d049d624c868aaba3af7
Author:     James Haley <haleyjd@hotmail.com>
AuthorDate: Sat Feb 5 05:57:12 2011 +0000
Commit:     James Haley <haleyjd@hotmail.com>
CommitDate: Sat Feb 5 05:57:12 2011 +0000

    Documented most of the questflags. Misc fixes: Removed "is turbo!"
    message, PST_REBORN set in G_DoLoadLevel if players.health <= 0,
    M_ClearRandom doesn't seed rndindex with time(), A_Chase doesn't check
    for target->health <= 0 when decrementing actor->threshold, and
    A_AcolyteSpecial fixed - ALL blue acolytes must be dead, not just one.

    Subversion-branch: /branches/strife-branch
    Subversion-revision: 2248
---
 src/strife/doomdef.h  | 26 ++++++++++++------------
 src/strife/f_finale.c |  2 +-
 src/strife/g_game.c   | 30 +++++++++++++++++----------
 src/strife/m_random.c | 10 +++++----
 src/strife/p_enemy.c  | 56 +++++++++++++++++++++++++--------------------------
 src/strife/p_inter.c  |  2 +-
 src/strife/p_switch.c |  2 +-
 7 files changed, 69 insertions(+), 59 deletions(-)

diff --git a/src/strife/doomdef.h b/src/strife/doomdef.h
index 18ce62be..52cfc587 100644
--- a/src/strife/doomdef.h
+++ b/src/strife/doomdef.h
@@ -243,34 +243,34 @@ typedef enum
 // flag values for each quest.
 enum
 { //  Name       Flag from bitnum      Purpose, if known
-    QF_QUEST1  = (1 << tk_quest1),
-    QF_QUEST2  = (1 << tk_quest2),
-    QF_QUEST3  = (1 << tk_quest3),  // Permission to visit Irale
+    QF_QUEST1  = (1 << tk_quest1),  // Obtained Beldin's ring
+    QF_QUEST2  = (1 << tk_quest2),  // Stole the Chalice
+    QF_QUEST3  = (1 << tk_quest3),  // Permission to visit Irale (visited Macil)
     QF_QUEST4  = (1 << tk_quest4),
     QF_QUEST5  = (1 << tk_quest5),
     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_QUEST9  = (1 << tk_quest9),
-    QF_QUEST10 = (1 << tk_quest10),
-    QF_QUEST11 = (1 << tk_quest11),
-    QF_QUEST12 = (1 << tk_quest12),
+    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
+    QF_QUEST12 = (1 << tk_quest12), // Obtained Judge Wolenick's hand
     QF_QUEST13 = (1 << tk_quest13), // Freed the Prisoners
-    QF_QUEST14 = (1 << tk_quest14),
-    QF_QUEST15 = (1 << tk_quest15),
+    QF_QUEST14 = (1 << tk_quest14), // Destroyed the Power Crystal
+    QF_QUEST15 = (1 << tk_quest15), // Obtained Guard Uniform
     QF_QUEST16 = (1 << tk_quest16), // Destroyed the Gate Mechanism
-    QF_QUEST17 = (1 << tk_quest17),
+    QF_QUEST17 = (1 << tk_quest17), // Heard Macil's story about the Sigil (MAP10)
     QF_QUEST18 = (1 << tk_quest18), // Obtained Oracle Pass
     QF_QUEST19 = (1 << tk_quest19),
     QF_QUEST20 = (1 << tk_quest20),
-    QF_QUEST21 = (1 << tk_quest21), // Killed Bishop - TODO: verify!
+    QF_QUEST21 = (1 << tk_quest21), // Killed Bishop
     QF_QUEST22 = (1 << tk_quest22), // Killed Oracle with QUEST21 set
     QF_QUEST23 = (1 << tk_quest23), // Killed Oracle (always given)
     QF_QUEST24 = (1 << tk_quest24), // Killed Macil
     QF_QUEST25 = (1 << tk_quest25), // Destroyed the Converter
     QF_QUEST26 = (1 << tk_quest26), // Killed Loremaster
-    QF_QUEST27 = (1 << tk_quest27),
-    QF_QUEST28 = (1 << tk_quest28), // ???? - checked by line type 228 STRIFE-TODO
+    QF_QUEST27 = (1 << tk_quest27), // Destroyed the Computer (checked for good ending)
+    QF_QUEST28 = (1 << tk_quest28), // Obtained Catacomb Key (checked by line type 228)
     QF_QUEST29 = (1 << tk_quest29), // Destroyed the Mines Transmitter
     QF_QUEST30 = (1 << tk_quest30),
     QF_QUEST31 = (1 << tk_quest31),
diff --git a/src/strife/f_finale.c b/src/strife/f_finale.c
index b93d1106..1761ad44 100644
--- a/src/strife/f_finale.c
+++ b/src/strife/f_finale.c
@@ -206,7 +206,7 @@ void F_StartFinale (void)
             else
             {
                 if((players[0].questflags & QF_QUEST25) && // Converter destroyed
-                   (players[0].questflags & QF_QUEST27))   // ????
+                   (players[0].questflags & QF_QUEST27))   // Computer destroyed (wtf?!)
                 {
                     // Good ending - You get the hot babe.
                     slideshow_state = SLIDE_GOODEND1;
diff --git a/src/strife/g_game.c b/src/strife/g_game.c
index 65c2e5bb..4acebc53 100644
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -103,7 +103,7 @@ gamestate_t     oldgamestate;
 gameaction_t    gameaction;
 gamestate_t     gamestate;
 skill_t         gameskill = 2; // [STRIFE] Default value set to 2.
-boolean		respawnmonsters;
+boolean         respawnmonsters;
 //int             gameepisode;
 int             gamemap;

@@ -132,7 +132,8 @@ boolean         netgame;                // only true if packets are broadcast
 boolean         playeringame[MAXPLAYERS];
 player_t        players[MAXPLAYERS];

-boolean         turbodetected[MAXPLAYERS];
+// [STRIFE] unused
+//boolean         turbodetected[MAXPLAYERS];

 int             consoleplayer;          // player taking events and displaying
 int             displayplayer;          // view being displayed
@@ -766,25 +767,28 @@ void G_DoLoadLevel (void)
     //skyflatnum = R_FlatNumForName(DEH_String(SKYFLATNAME));

     levelstarttic = gametic;        // for time calculation
-
+
     if (wipegamestate == GS_LEVEL)
-	wipegamestate = -1;             // force a wipe
+        wipegamestate = -1;             // force a wipe

     gamestate = GS_LEVEL;

     for (i=0 ; i<MAXPLAYERS ; i++)
     {
-	turbodetected[i] = false;
-	if (playeringame[i] && players[i].playerstate == PST_DEAD)
-	    players[i].playerstate = PST_REBORN;
-	memset (players[i].frags,0,sizeof(players[i].frags));
+        //turbodetected[i] = false; [STRIFE] unused
+
+        // haleyjd 20110204 [STRIFE]: PST_REBORN if players[i].health <= 0
+        if (playeringame[i] && (players[i].playerstate == PST_DEAD || players[i].health <= 0))
+            players[i].playerstate = PST_REBORN;
+        memset (players[i].frags,0,sizeof(players[i].frags));
     }
-
+
     P_SetupLevel (gamemap, 0, gameskill);
-    displayplayer = consoleplayer;		// view the guy you are playing
+    displayplayer = consoleplayer;      // view the guy you are playing
+    starttime = I_GetTime(); // haleyjd 20110204 [STRIFE]
     gameaction = ga_nothing;
     Z_CheckHeap ();
-
+
     // clear cmd building stuff

     memset (gamekeydown, 0, sizeof(gamekeydown));
@@ -1058,7 +1062,10 @@ void G_Ticker (void)
             // over the past 4 seconds.  offset the checking period
             // for each player so messages are not displayed at the
             // same time.
+            //
+            // haleyjd 20110204 [STRIFE] unused

+            /*
             if (cmd->forwardmove > TURBOTHRESHOLD)
             {
                 turbodetected[i] = true;
@@ -1074,6 +1081,7 @@ void G_Ticker (void)
                 players[consoleplayer].message = turbomessage;
                 turbodetected[i] = false;
             }
+            */

             if (netgame && !netdemo && !(gametic%ticdup) )
             {
diff --git a/src/strife/m_random.c b/src/strife/m_random.c
index 31cdf1b2..b7e6aa05 100644
--- a/src/strife/m_random.c
+++ b/src/strife/m_random.c
@@ -72,13 +72,15 @@ int M_Random (void)
     return rndtable[rndindex];
 }

+//
+// M_ClearRandom
+//
+// haleyjd 20110204 [STRIFE]: No "seeding" of M_Random index
+//
 void M_ClearRandom (void)
 {
     prndindex = 0;
-
-    // Seed the M_Random counter from the system time
-
-    rndindex = time(NULL) & 0xff;
+    rndindex = 0;
 }


diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index c3b41b7c..4bfceefe 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -980,7 +980,10 @@ void A_FriendLook(mobj_t* actor)

     // do some idle animation
     if(P_Random() < 30)
-        P_SetMobjState(actor, actor->info->spawnstate + 1 + (P_Random() & 1));
+    {
+        int t = P_Random();
+        P_SetMobjState(actor, (t & 1) + actor->info->spawnstate + 1);
+    }

     // wander around a bit
     if(!(actor->flags & MF_STAND) && P_Random() < 40)
@@ -1038,13 +1041,11 @@ void A_Chase (mobj_t*	actor)
     // modify target threshold
     if  (actor->threshold)
     {
-        if (!actor->target
-            || actor->target->health <= 0)
-        {
-            actor->threshold = 0;
-        }
-        else
+        // haleyjd 20110204 [STRIFE]: No health <= 0 check here!
+        if (actor->target)
             actor->threshold--;
+        else
+            actor->threshold = 0;
     }

     // turn towards movement direction if not there yet
@@ -1063,7 +1064,7 @@ void A_Chase (mobj_t*	actor)
         || !(actor->target->flags&MF_SHOOTABLE))
     {
         // look for a new target
-        if (P_LookForPlayers(actor,true))
+        if (P_LookForPlayers(actor, true))
             return; 	// got a new target

         P_SetMobjState (actor, actor->info->spawnstate);
@@ -1105,7 +1106,7 @@ void A_Chase (mobj_t*	actor)

         P_SetMobjState (actor, actor->info->missilestate);

-        // [STRIFE] Add INCOMBAT flag to disable dialog
+        // [STRIFE] Add NODIALOG flag to disable dialog
         actor->flags |= (MF_NODIALOG|MF_JUSTATTACKED);
         return;
     }
@@ -1117,8 +1118,8 @@ nomissile:
         && !actor->threshold
         && !P_CheckSight (actor, actor->target) )
     {
-        if (P_LookForPlayers(actor,true))
-            return;	// got a new target
+        if (P_LookForPlayers(actor, true))
+            return; // got a new target
     }

     // chase towards player
@@ -1153,7 +1154,7 @@ nomissile:
 // haleyjd 09/05/10: Handling for visibility-modifying flags.
 //
 void A_FaceTarget (mobj_t* actor)
-{
+{
     if (!actor->target)
         return;

@@ -1995,7 +1996,6 @@ void A_SetTLOptions(mobj_t* actor)
         actor->flags |= MF_SHADOW;
     if(actor->spawnpoint.options & MTF_MVIS)
         actor->flags |= MF_MVIS;
-
 }

 //
@@ -2307,11 +2307,11 @@ void A_PeasantCrash(mobj_t* actor)
 // A_Fall
 //
 // [STRIFE]
-// * Set INCOMBAT, and clear NOGRAVITY and SHADOW
+// * Set NODIALOG, and clear NOGRAVITY and SHADOW
 //
 void A_Fall (mobj_t *actor)
 {
-    // villsa [STRIFE] set incombat flag to stop dialog
+    // villsa [STRIFE] set NODIALOG flag to stop dialog
     actor->flags |= MF_NODIALOG;

     // actor is on ground, it can be walked over
@@ -2697,7 +2697,7 @@ void A_QuestMsg(mobj_t* actor)
     // give quest and display message to players
     for(i = 0; i < MAXPLAYERS; i++)
     {
-        quest = 1 << ((actor->info->speed) - 1);
+        quest = 1 << (actor->info->speed - 1);
         players[i].message = pmsgbuffer;
         players[i].questflags |= quest;
     }
@@ -3002,7 +3002,7 @@ void A_BossDeath (mobj_t* actor)
         }
         else
         {
-            // So much for prognostication.
+            // So much for prognostication!
             GiveVoiceObjective("VOC87", "LOG87", 0);
         }
         junk.tag = 222;         // Open the exit door again;
@@ -3051,7 +3051,9 @@ void A_BossDeath (mobj_t* actor)

 //
 // A_AcolyteSpecial
+//
 // villsa [STRIFE] - new codepointer
+// Awards quest #7 when all the Blue Acolytes are killed in Tarnhill
 //
 void A_AcolyteSpecial(mobj_t* actor)
 {
@@ -3063,7 +3065,7 @@ void A_AcolyteSpecial(mobj_t* actor)

     for(i = 0; i < MAXPLAYERS; i++)
     {
-        if(playeringame[i] && &players[i].health > 0)
+        if(playeringame[i] && players[i].health > 0)
             break;
     }

@@ -3076,20 +3078,18 @@ void A_AcolyteSpecial(mobj_t* actor)
         {
             mobj_t *mo = (mobj_t *)th;

+            // Found a living MT_GUARD8?
             if(mo != actor && mo->type == actor->type && mo->health > 0)
                 return;
-
-            if(mo->type != MT_GUARD8)
-                continue;   // not MT_GUARD8
-
-            // give quest token #7 to all players
-            for(i = 0; i < MAXPLAYERS; i++)
-                P_GiveItemToPlayer(&players[i], SPR_TOKN, MT_TOKEN_QUEST7);
-
-            // play voice, give objective
-            GiveVoiceObjective("VOC14", "LOG14", 0);
         }
     }
+
+    // All MT_GUARD8 are dead, give quest token #7 to all players
+    for(i = 0; i < MAXPLAYERS; i++)
+        P_GiveItemToPlayer(&players[i], SPR_TOKN, MT_TOKEN_QUEST7);
+
+    // play voice, give objective
+    GiveVoiceObjective("VOC14", "LOG14", 0);
 }

 //
diff --git a/src/strife/p_inter.c b/src/strife/p_inter.c
index d75970c6..a2d1dcc2 100644
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -723,7 +723,7 @@ void P_TouchSpecialThing(mobj_t* special, mobj_t* toucher)
     {
         // [STRIFE] TODO - verify this. Seems that questflag isn't
         // applied if the special's speed is equal to 8 or if
-        // the player has recieved a specific quest token
+        // the player has received a specific quest token
         if(special->info->speed != 8 || !(player->questflags & QF_QUEST6))
             player->questflags |= 1 << (special->info->speed - 1);
     }
diff --git a/src/strife/p_switch.c b/src/strife/p_switch.c
index 99bc9f09..9234c00d 100644
--- a/src/strife/p_switch.c
+++ b/src/strife/p_switch.c
@@ -324,7 +324,7 @@ void P_ChangeSwitchTexture(line_t* line, int useAgain)
                 if(useAgain)
                     P_StartButton(line, middle,switchlist[i],BUTTONTIME);

-                // villsa [STRIFE]: Mines Converter hack
+                // villsa [STRIFE]: Mines Transmitter hack
                 if(sound == sfx_firxpl)
                 {
                     breakglass = true;