New item capsule respawn functionality

This commit is contained in:
lachablock 2021-06-21 13:11:21 +10:00
parent 27489edd3d
commit 90269c1a91
3 changed files with 23 additions and 1 deletions

View file

@ -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

View file

@ -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++)
{

View file

@ -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: