From 898e17a4416e383f3aa373ca31474a469f9da4f6 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 16 Jul 2016 23:26:52 +0100 Subject: [PATCH] SF_MACHINE characters create boss explosions on death. Also, the gravity of drowning characters has been reduced to look more natural. --- src/p_inter.c | 1 + src/p_mobj.c | 17 ++++++++++++++++- src/p_user.c | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 26cae304e..e7d98dbe3 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2261,6 +2261,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget target->momx = target->momy = target->momz = 0; if (damagetype == DMG_DROWNED) // drowned { + target->movedir = damagetype; // we're MOVING the Damage Into anotheR function... Okay, this is a bit of a hack. if (target->player->charflags & SF_MACHINE) S_StartSound(target, sfx_fizzle); else diff --git a/src/p_mobj.c b/src/p_mobj.c index ad19d4423..90d21859b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6908,7 +6908,22 @@ void P_MobjThinker(mobj_t *mobj) } } else // Apply gravity to fall downwards. - P_SetObjectMomZ(mobj, -2*FRACUNIT/3, true); + { + if (mobj->player && !(mobj->fuse % 8) && (mobj->player->charflags & SF_MACHINE)) + { + fixed_t r = mobj->radius>>FRACBITS; + mobj_t *explosion = P_SpawnMobj( + mobj->x + (P_RandomRange(r, -r)<y + (P_RandomRange(r, -r)<z + (P_RandomKey(mobj->height>>FRACBITS)<movedir == DMG_DROWNED) + P_SetObjectMomZ(mobj, -FRACUNIT/2, true); // slower fall from drowning + else + P_SetObjectMomZ(mobj, -2*FRACUNIT/3, true); + } } break; default: diff --git a/src/p_user.c b/src/p_user.c index 4e761f3bc..a395aa7cd 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2157,9 +2157,9 @@ static void P_DoBubbleBreath(player_t *player) { if (P_RandomChance((128-(player->powers[pw_underwater]/4))*FRACUNIT/256)) { - fixed_t rad = player->mo->radius>>FRACBITS; - x += (P_RandomRange(rad, -rad)<mo->radius>>FRACBITS; + x += (P_RandomRange(r, -r)<mo->height>>FRACBITS)<