Fix Bombs

Use reactiontime instead of health so chain reactions can occur when multiple bombs are layered.
Make the check for nearby players happen BEFORE the spawning of explosion objects.
Remove MF_NOCLIPTHING and MF_MISSILE from bombs so they don't try and die when they hit the floor sometimes.
This commit is contained in:
Sryder 2018-03-13 10:40:02 +00:00
parent 0483c882cd
commit 2a4a0f24d4
3 changed files with 26 additions and 18 deletions

View File

@ -14924,10 +14924,10 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_BOMBITEM { // MT_BOMBITEM
-1, // doomednum -1, // doomednum
S_BOMBAIR, // spawnstate S_BOMBAIR, // spawnstate
105, // spawnhealth 1, // spawnhealth
S_NULL, // seestate S_NULL, // seestate
sfx_tossed, // seesound sfx_tossed, // seesound
8, // reactiontime 105, // reactiontime
sfx_None, // attacksound sfx_None, // attacksound
S_NULL, // painstate S_NULL, // painstate
288*FRACUNIT, // painchance 288*FRACUNIT, // painchance
@ -14944,7 +14944,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
100, // mass 100, // mass
1, // damage 1, // damage
sfx_bomb, // activesound sfx_bomb, // activesound
MF_BOUNCE|MF_NOCLIPTHING|MF_MISSILE|MF_SHOOTABLE, // flags MF_BOUNCE|MF_SHOOTABLE, // flags
S_NULL // raisestate S_NULL // raisestate
}, },

View File

@ -8273,20 +8273,11 @@ void A_BobombExplode(mobj_t *actor)
type = (mobjtype_t)locvar1; type = (mobjtype_t)locvar1;
for (d = 0; d < 16; d++)
K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64
if (actor->target->player)
K_SpawnBobombExplosion(actor, actor->target->player->skincolor);
else
K_SpawnBobombExplosion(actor, SKINCOLOR_RED);
P_SpawnMobj(actor->x, actor->y, actor->z, MT_BOMBEXPLOSIONSOUND);
//S_StartSound(actor, sfx_prloop);
for (th = thinkercap.next; th != &thinkercap; th = th->next) for (th = thinkercap.next; th != &thinkercap; th = th->next)
{ {
if (P_MobjWasRemoved(actor))
return; // There's the possibility these can chain react onto themselves after they've already died if there are enough all in one spot
if (th->function.acp1 != (actionf_p1)P_MobjThinker) if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue; continue;
@ -8313,6 +8304,17 @@ void A_BobombExplode(mobj_t *actor)
continue; continue;
} }
} }
for (d = 0; d < 16; d++)
K_SpawnKartExplosion(actor->x, actor->y, actor->z, actor->info->painchance + 32*FRACUNIT, 32, type, d*(ANGLE_45/4), true, false, actor->target); // 32 <-> 64
if (actor->target && actor->target->player)
K_SpawnBobombExplosion(actor, actor->target->player->skincolor);
else
K_SpawnBobombExplosion(actor, SKINCOLOR_RED);
P_SpawnMobj(actor->x, actor->y, actor->z, MT_BOMBEXPLOSIONSOUND);
return; return;
} }
//} //}

View File

@ -7970,17 +7970,23 @@ void P_MobjThinker(mobj_t *mobj)
case MT_BOMBITEM: case MT_BOMBITEM:
if (mobj->momx || mobj->momy) if (mobj->momx || mobj->momy)
P_SpawnGhostMobj(mobj); P_SpawnGhostMobj(mobj);
if (mobj->z <= mobj->floorz) if (P_IsObjectOnGround(mobj))
{ {
if (mobj->health > mobj->info->spawnhealth-1) if (mobj->reactiontime >= mobj->info->reactiontime)
{ {
if (mobj->state == &states[S_BOMBAIR]) if (mobj->state == &states[S_BOMBAIR])
P_SetMobjState(mobj, S_BOMBITEM); P_SetMobjState(mobj, S_BOMBITEM);
mobj->momx = mobj->momy = 0; mobj->momx = mobj->momy = 0;
S_StartSound(mobj, mobj->info->activesound); S_StartSound(mobj, mobj->info->activesound);
mobj->reactiontime--;
} }
mobj->health--; }
if (mobj->reactiontime && mobj->reactiontime < mobj->info->reactiontime)
{
mobj->reactiontime--;
if (!mobj->reactiontime)
P_KillMobj(mobj, NULL, NULL);
} }
if (mobj->threshold > 0) if (mobj->threshold > 0)
mobj->threshold--; mobj->threshold--;