From 89bed5675b8dd5a5fa958c4c3f81e81a076ef550 Mon Sep 17 00:00:00 2001 From: Samuel Villareal Date: Fri, 3 Sep 2010 05:28:45 +0000 Subject: + P_SpawnSubMissile created/added + P_SpawnPuff updated + P_SpawnBlood updated Subversion-branch: /branches/strife-branch Subversion-revision: 2006 --- src/strife/p_local.h | 1 + src/strife/p_mobj.c | 89 ++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 77 insertions(+), 13 deletions(-) diff --git a/src/strife/p_local.h b/src/strife/p_local.h index 99cf755e..0c59ec0d 100644 --- a/src/strife/p_local.h +++ b/src/strife/p_local.h @@ -126,6 +126,7 @@ boolean P_SetMobjState (mobj_t* mobj, statenum_t state); void P_MobjThinker (mobj_t* mobj); void P_SpawnPuff (fixed_t x, fixed_t y, fixed_t z); +mobj_t* P_SpawnSparkPuff(fixed_t x, fixed_t y, fixed_t z); // villsa [STRIFE] void P_SpawnBlood (fixed_t x, fixed_t y, fixed_t z, int damage); mobj_t* P_SpawnMissile (mobj_t* source, mobj_t* dest, mobjtype_t type); void P_SpawnPlayerMissile (mobj_t* source, mobjtype_t type); diff --git a/src/strife/p_mobj.c b/src/strife/p_mobj.c index 8bb839c1..8a0f7225 100644 --- a/src/strife/p_mobj.c +++ b/src/strife/p_mobj.c @@ -941,13 +941,17 @@ P_SpawnPuff z += ((P_Random()-P_Random())<<10); - // villsa [STRIFE] TODO - update th = P_SpawnMobj (x,y,z, MT_STRIFEPUFF); th->momz = FRACUNIT; th->tics -= P_Random()&3; - if (th->tics < 1) - th->tics = 1; + // villsa [STRIFE] TODO - verify and update + /*if(shootdist == (80*FRACUNIT)) + P_SetMobjState(th, S_POW2_00);*/ + + // villsa [STRIFE] unused + /*if (th->tics < 1) + th->tics = 1;*/ // don't make punches spark on the wall // villsa [STRIFE] TODO - proper puff state @@ -955,6 +959,16 @@ P_SpawnPuff //P_SetMobjState (th, S_PUFF3); } +// +// P_SpawnSparkPuff +// villsa [STRIFE] new function +// + +mobj_t* P_SpawnSparkPuff(fixed_t x, fixed_t y, fixed_t z) +{ + return P_SpawnMobj(x, y, ((P_Random() - P_Random()) << 10) + z, MT_SPARKPUFF); +} + // @@ -967,22 +981,22 @@ P_SpawnBlood fixed_t z, int damage ) { - // villsa [STRIFE] TODO - update to strife version -/* mobj_t* th; + mobj_t* th; z += ((P_Random()-P_Random())<<10); - th = P_SpawnMobj (x,y,z, MT_BLOOD); + th = P_SpawnMobj (x,y,z, MT_BLOOD_DEATH); th->momz = FRACUNIT*2; th->tics -= P_Random()&3; - if (th->tics < 1) + // villsa [STRIFE] unused + /*if (th->tics < 1) th->tics = 1;*/ - // villsa [STRIFE] TODO - proper blood states - /*if (damage <= 12 && damage >= 9) - P_SetMobjState (th,S_BLOOD2); - else if (damage < 9) - P_SetMobjState (th,S_BLOOD3);*/ + // villsa [STRIFE] different checks for damage range + if (damage >= 10 && damage <= 13) + P_SetMobjState (th,S_BLOD_00); + else if (damage < 7) + P_SetMobjState (th,S_BLOD_02); } @@ -1056,7 +1070,10 @@ P_SpawnMissile // fuzzy player if (dest->flags & MF_SHADOW) - an += (P_Random()-P_Random())<<20; + an += (P_Random()-P_Random())<<21; + // villsa [STRIFE] check for heavily transparent things + else if(dest->flags & MF_MOREVISIBLE) + an += (P_Random()-P_Random())<<22; th->angle = an; an >>= ANGLETOFINESHIFT; @@ -1075,6 +1092,52 @@ P_SpawnMissile return th; } +// +// P_SpawnSubMissile +// villsa [STRIFE] new function (TODO - add description) +// + +mobj_t* P_SpawnSubMissile(mobj_t* source, mobj_t* target, mobjtype_t type, fixed_t radius) +{ + mobj_t* th; + angle_t an; + fixed_t dist; + + th = P_SpawnMobj(source->x, source->y, source->z + (32*FRACUNIT), type); + + if(th->info->seesound) + S_StartSound(th, th->info->seesound); + + th->target = source; // where it came from + an = th->angle; + + // fuzzy player + if (target->flags & MF_SHADOW) + an += (P_Random()-P_Random())<<21; + // villsa [STRIFE] check for heavily transparent things + else if(target->flags & MF_MOREVISIBLE) + an += (P_Random()-P_Random())<<22; + + th->angle = an; + an >>= ANGLETOFINESHIFT; + th->momx = FixedMul (th->info->speed, finecosine[an]); + th->momy = FixedMul (th->info->speed, finesine[an]); + + dist = P_AproxDistance (target->x - source->x, target->y - source->y); + dist = dist / th->info->speed; + + if(dist < 1) + dist = 1; + + th->momz = (target->z - source->z) / dist; + th->x += (th->momx >> 1); + th->y += (th->momy >> 1); + th->z += (th->momz >> 1); + + if(!P_TryMove (th, th->x, th->y)) + P_ExplodeMissile(th); +} + // // P_SpawnPlayerMissile -- cgit v1.2.3