summaryrefslogtreecommitdiff
path: root/src/strife/p_enemy.c
diff options
context:
space:
mode:
authorSamuel Villareal2010-09-18 02:32:24 +0000
committerSamuel Villareal2010-09-18 02:32:24 +0000
commit533755e5298ecd39bd682dfd1e33c98d80445369 (patch)
tree8f86d3966304e76dd03e3dbee79ac38aebb63aaf /src/strife/p_enemy.c
parent69c0d2e83b1eeaf71a2badf3d3f0cda3491312a7 (diff)
downloadchocolate-doom-533755e5298ecd39bd682dfd1e33c98d80445369.tar.gz
chocolate-doom-533755e5298ecd39bd682dfd1e33c98d80445369.tar.bz2
chocolate-doom-533755e5298ecd39bd682dfd1e33c98d80445369.zip
+ A_Tracer, A_BurnSpread and A_AcolyteSpecial done
+ Macro added for giving objective logs Subversion-branch: /branches/strife-branch Subversion-revision: 2100
Diffstat (limited to 'src/strife/p_enemy.c')
-rw-r--r--src/strife/p_enemy.c176
1 files changed, 126 insertions, 50 deletions
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");
+ }
+ }
}
//