foxygit / doom Log in
commit 533755e5298ecd39bd682dfd1e33c98d80445369
Author:     Samuel Villareal <svkaiser@gmail.com>
AuthorDate: Sat Sep 18 02:32:24 2010 +0000
Commit:     Samuel Villareal <svkaiser@gmail.com>
CommitDate: Sat Sep 18 02:32:24 2010 +0000

    + A_Tracer, A_BurnSpread and A_AcolyteSpecial done
    + Macro added for giving objective logs

    Subversion-branch: /branches/strife-branch
    Subversion-revision: 2100
---
 src/strife/p_dialog.h |  21 +++---
 src/strife/p_enemy.c  | 176 ++++++++++++++++++++++++++++++++++++--------------
 src/strife/p_inter.c  |   7 +-
 3 files changed, 141 insertions(+), 63 deletions(-)

diff --git a/src/strife/p_dialog.h b/src/strife/p_dialog.h
index 91cc99a8..95adea13 100644
--- a/src/strife/p_dialog.h
+++ b/src/strife/p_dialog.h
@@ -45,6 +45,11 @@

 extern char mission_objective[OBJECTIVE_LEN];

+// villsa - convenient macro for giving objective logs to player
+#define GiveObjective(x) \
+    if(W_CheckNumForName(DEH_String(x)) != -1)\
+{ strncpy(mission_objective, W_CacheLumpName(DEH_String(x), PU_CACHE), OBJECTIVE_LEN); }
+
 typedef struct mapdlgchoice_s
 {
     int  giveitem;                      // item given when successful
@@ -59,14 +64,14 @@ typedef struct mapdlgchoice_s

 typedef struct mapdialog_s
 {
-    int speakerid;                  // script ID# for mobjtype that will use this dialog
-    int dropitem;                   // item to drop if that thingtype is killed
-    int checkitem[MDLG_MAXITEMS];   // item(s) needed to see this dialog
-    int jumptoconv;                 // conversation to jump to when... ?
-    char name[MDLG_NAMELEN];        // name of speaker
-    char voice[MDLG_LUMPLEN];       // voice file to play
-    char backpic[MDLG_LUMPLEN];     // backdrop pic for character, if any
-    char text[MDLG_TEXTLEN];        // main message text
+    int speakerid;                      // script ID# for mobjtype that will use this dialog
+    int dropitem;                       // item to drop if that thingtype is killed
+    int checkitem[MDLG_MAXITEMS];       // item(s) needed to see this dialog
+    int jumptoconv;                     // conversation to jump to when... ?
+    char name[MDLG_NAMELEN];            // name of speaker
+    char voice[MDLG_LUMPLEN];           // voice file to play
+    char backpic[MDLG_LUMPLEN];         // backdrop pic for character, if any
+    char text[MDLG_TEXTLEN];            // main message text

     // options that this dialog gives the player
     mapdlgchoice_t choices[MDLG_MAXCHOICES];
diff --git a/src/strife/p_enemy.c b/src/strife/p_enemy.c
index d0c235c0..fed64e85 100644
--- a/src/strife/p_enemy.c
+++ b/src/strife/p_enemy.c
@@ -31,13 +31,11 @@

 #include "m_random.h"
 #include "i_system.h"
-
 #include "doomdef.h"
 #include "p_local.h"
-
 #include "s_sound.h"
-
 #include "g_game.h"
+#include "z_zone.h"     // villsa [STRIFE]

 // State.
 #include "doomstat.h"
@@ -2116,78 +2114,80 @@ void A_SpawnSparkPuff(mobj_t* actor)
 // A_BspiAttack, A_TroopAttack, A_SargAttack, A_HeadAttack, A_CyberAttack,
 // A_BruisAttack, A_SkelMissile

-int	TRACEANGLE = 0xc000000;

+int TRACEANGLE = 0xE000000; // villsa [STRIFE] changed from 0xC000000 to 0xE000000
+
+//
+// A_Tracer
+//
 void A_Tracer (mobj_t* actor)
 {
-    // villsa [STRIFE] TODO - update with strife version
-/*    angle_t	exact;
-    fixed_t	dist;
-    fixed_t	slope;
-    mobj_t*	dest;
-    mobj_t*	th;
-
-    if (gametic & 3)
-	return;
-
+    angle_t exact;
+    fixed_t dist;
+    fixed_t slope;
+    mobj_t* dest;
+    //mobj_t* th;
+
+    // villsa [STRIFE] not used
+    /*if(gametic & 3)
+        return;*/
+
     // spawn a puff of smoke behind the rocket
-    P_SpawnPuff (actor->x, actor->y, actor->z);
-
+    /*P_SpawnPuff(actor->x, actor->y, actor->z);
+
     th = P_SpawnMobj (actor->x-actor->momx,
-		      actor->y-actor->momy,
-		      actor->z, MT_SMOKE);
-
+        actor->y-actor->momy,
+        actor->z, MT_SMOKE);
+
     th->momz = FRACUNIT;
     th->tics -= P_Random()&3;
     if (th->tics < 1)
-	th->tics = 1;
-
+        th->tics = 1;*/
+
     // adjust direction
     dest = actor->tracer;
-
-    if (!dest || dest->health <= 0)
-	return;
-
+
+    if(!dest || dest->health <= 0)
+        return;
+
     // change angle
-    exact = R_PointToAngle2 (actor->x,
-			     actor->y,
-			     dest->x,
-			     dest->y);
+    exact = R_PointToAngle2(actor->x, actor->y, dest->x, dest->y);

-    if (exact != actor->angle)
+    if(exact != actor->angle)
     {
-	if (exact - actor->angle > 0x80000000)
-	{
-	    actor->angle -= TRACEANGLE;
-	    if (exact - actor->angle < 0x80000000)
-		actor->angle = exact;
-	}
-	else
-	{
-	    actor->angle += TRACEANGLE;
-	    if (exact - actor->angle > 0x80000000)
-		actor->angle = exact;
-	}
+        // villsa [STRIFE] slightly different algorithm
+        if(exact - actor->angle <= 0x80000000)
+        {
+            actor->angle += TRACEANGLE;
+            if(exact - actor->angle > 0x80000000)
+                actor->angle = exact;
+        }
+        else
+        {
+            actor->angle -= TRACEANGLE;
+            if (exact - actor->angle < 0x80000000)
+                actor->angle = exact;
+        }
     }
-
+
     exact = actor->angle>>ANGLETOFINESHIFT;
     actor->momx = FixedMul (actor->info->speed, finecosine[exact]);
     actor->momy = FixedMul (actor->info->speed, finesine[exact]);
-
+
     // change slope
     dist = P_AproxDistance (dest->x - actor->x,
-			    dest->y - actor->y);
-
+        dest->y - actor->y);
+
     dist = dist / actor->info->speed;

     if (dist < 1)
-	dist = 1;
+        dist = 1;
     slope = (dest->z+40*FRACUNIT - actor->z) / dist;

     if (slope < actor->momz)
-	actor->momz -= FRACUNIT/8;
+        actor->momz -= FRACUNIT/8;
     else
-	actor->momz += FRACUNIT/8;*/
+        actor->momz += FRACUNIT/8;
 }

 //
@@ -2820,9 +2820,42 @@ void A_HeadChunk(mobj_t* actor)
     mo->momz = (P_Random() & 7) << FRACBITS;
 }

+//
+// A_BurnSpread
+// villsa [STRIFE] - new codepointer
+//
 void A_BurnSpread(mobj_t* actor)
 {
+    int t;
+    mobj_t* mo;
+    fixed_t x;
+    fixed_t y;
+
+    actor->momz -= (8*FRACUNIT);
+
+    t = P_Random();
+    actor->momx += ((t & 3) - (P_Random() & 3)) << FRACBITS;
+    t = P_Random();
+    actor->momy += ((t & 3) - (P_Random() & 3)) << FRACBITS;

+    S_StartSound(actor, sfx_lgfire);
+
+    if(actor->flags & MF_DROPPED)
+        return; // not the parent
+
+    x = actor->x + (((P_Random() + 12) & 31) << FRACBITS);
+    y = actor->y + (((P_Random() + 12) & 31) << FRACBITS);
+
+    // spawn child
+    mo = P_SpawnMobj(x, y, actor->z + (4*FRACUNIT), MT_PFLAME);
+
+    t = P_Random();
+    mo->momx += ((t & 7) - (P_Random() & 7)) << FRACBITS;
+    t = P_Random();
+    mo->momy += ((t & 7) - (P_Random() & 7)) << FRACBITS;
+    mo->momz -= FRACUNIT;
+    mo->flags |= MF_DROPPED;
+    mo->reactiontime = (P_Random() & 3) + 2;
 }

 //
@@ -2835,9 +2868,52 @@ void A_BossDeath (mobj_t* mo)
     // villsa [STRIFE] TODO - update to strife version
 }

+//
+// A_AcolyteSpecial
+// villsa [STRIFE] - new codepointer
+//
 void A_AcolyteSpecial(mobj_t* actor)
 {
-   // STRIFE-TODO
+    int p;
+    int i;
+    thinker_t* th;
+
+    if(actor->type != MT_GUARD8)
+        return; // must be MT_GUARD8
+
+    for(i = 0; i < MAXPLAYERS; i++)
+    {
+        if(playeringame[i])
+            p++;
+    }
+
+    // [STRIFE] TODO - whats the point of this?
+    if(p == 8)
+        return;
+
+    for(th = thinkercap.next; th != &thinkercap; th = th->next)
+    {
+        if(th->function.acp1 == P_MobjThinker)
+        {
+            mobj_t *mo = (mobj_t *)th;
+
+            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
+            I_StartVoice(DEH_String("VOC14"));
+
+            // give objective
+            GiveObjective("LOG14");
+        }
+    }
 }

 //
diff --git a/src/strife/p_inter.c b/src/strife/p_inter.c
index c31b4333..a41bdcec 100644
--- a/src/strife/p_inter.c
+++ b/src/strife/p_inter.c
@@ -832,11 +832,8 @@ void P_KillMobj(mobj_t* source, mobj_t* target)
             EV_DoFloor(&junk, lowerFloor);

             I_StartVoice(DEH_String("VOC13"));
-            if(W_CheckNumForName(DEH_String("LOG13")) != -1)
-            {
-                strncpy(mission_objective,
-                    W_CacheLumpName(DEH_String("LOG13"), PU_CACHE), OBJECTIVE_LEN);
-            }
+            GiveObjective("LOG13");
+
             item = MT_COUPLING_BROKEN;
             players[0].questflags |= (1 << (mobjinfo[MT_COUPLING].speed - 1));
             break;