From 90269c1a91c6eee83883c4b82356c6b2be5ea146 Mon Sep 17 00:00:00 2001 From: lachablock Date: Mon, 21 Jun 2021 13:11:21 +1000 Subject: [PATCH] New item capsule respawn functionality --- src/info.c | 2 +- src/p_inter.c | 8 ++++++++ src/p_mobj.c | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index ef941c34b..7f2e06f56 100644 --- a/src/info.c +++ b/src/info.c @@ -23078,7 +23078,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_NULL, // deathstate + S_INVISIBLE, // deathstate S_NULL, // xdeathstate sfx_itcaps, // deathsound 0, // speed diff --git a/src/p_inter.c b/src/p_inter.c index e0d6d3a5c..01c4b82de 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1303,6 +1303,14 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget angle_t angle = FixedAngle(360*P_RandomFixed()); INT16 spacing = (target->radius >> 1) / target->scale; + // set respawn fuse + if (modeattacking) // no respawns + ; + else if (target->threshold == KITEM_SUPERRING) + target->fuse = 20*TICRATE; + else + target->fuse = 40*TICRATE; + // burst effects for (i = 0; i < 2; i++) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 5e3bac915..007d15f12 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8476,6 +8476,17 @@ static boolean P_FuseThink(mobj_t *mobj) P_RemoveMobj(mobj); // make sure they disappear return false; + case MT_ITEMCAPSULE: + if (mobj->spawnpoint) + P_SpawnMapThing(mobj->spawnpoint); + else + { + mobj_t *newMobj = P_SpawnMobj(mobj->x, mobj->y, mobj->z, mobj->type); + newMobj->threshold = mobj->threshold; + newMobj->movecount = mobj->movecount; + } + P_RemoveMobj(mobj); + return false; case MT_SMK_ICEBLOCK: { mobj_t *cur = mobj->hnext, *next; @@ -11706,7 +11717,10 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean // Ambush = double size (grounded) / half size (aerial) if (!(mthing->options & MTF_AMBUSH) == !P_IsObjectOnGround(mobj)) + { mobj->destscale = min(mobj->destscale << 1, FixedDiv(64*FRACUNIT, mobj->info->radius)); // don't make them larger than the blockmap can handle + mobj->scalespeed <<= 1; + } break; } case MT_AAZTREE_HELPER: