Merge branch 'broly-sigfpe' into 'master'

Fix Broly SIGFPE

See merge request KartKrew/Kart!841
This commit is contained in:
Oni 2023-01-03 02:49:58 +00:00
commit e400625da8
4 changed files with 25 additions and 7 deletions

View file

@ -324,6 +324,11 @@ tic_t K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin)
if (!spin)
{
if (minehitlag == 0)
{
minehitlag = actor->hitlag;
}
Obj_SpawnBrolyKi(actor, minehitlag);
return minehitlag;

View file

@ -60,7 +60,7 @@ void Obj_DuelBombInit(mobj_t *bomb);
/* Broly Ki */
mobj_t *Obj_SpawnBrolyKi(mobj_t *source, tic_t duration);
void Obj_BrolyKiThink(mobj_t *ki);
boolean Obj_BrolyKiThink(mobj_t *ki);
/* Special Stage UFO */
waypoint_t *K_GetSpecialUFOWaypoint(mobj_t *ufo);

View file

@ -34,14 +34,16 @@ Obj_SpawnBrolyKi
( mobj_t * source,
tic_t duration)
{
mobj_t *x = P_SpawnMobjFromMobj(
source, 0, 0, 0, MT_BROLY);
mobj_t *x;
if (duration == 0)
if (duration <= 0)
{
return x;
return NULL;
}
x = P_SpawnMobjFromMobj(
source, 0, 0, 0, MT_BROLY);
// Shrink into center of source object.
x->z = (source->z + source->height / 2);
@ -61,12 +63,20 @@ Obj_SpawnBrolyKi
return x;
}
void
boolean
Obj_BrolyKiThink (mobj_t *x)
{
if (broly_duration(x) <= 0)
{
P_RemoveMobj(x);
return false;
}
const fixed_t
t = get_unit_linear(x),
n = Easing_OutSine(t, 0, broly_maxscale(x));
P_InstaScale(x, n);
return true;
}

View file

@ -6515,7 +6515,10 @@ static void P_MobjSceneryThink(mobj_t *mobj)
mobj->renderflags ^= RF_DONTDRAW;
break;
case MT_BROLY:
Obj_BrolyKiThink(mobj);
if (Obj_BrolyKiThink(mobj) == false)
{
return;
}
break;
case MT_VWREF:
case MT_VWREB: