Scale Chaos Chute objects

This commit is contained in:
Lach 2023-09-29 20:27:13 +10:00
parent abf784cc79
commit 2bdc055139
3 changed files with 41 additions and 6 deletions

View file

@ -3802,13 +3802,33 @@ void K_RemoveGrowShrink(player_t *player)
boolean K_IsBigger(mobj_t *compare, mobj_t *other)
{
fixed_t compareScale, otherScale;
if ((compare == NULL || P_MobjWasRemoved(compare) == true)
|| (other == NULL || P_MobjWasRemoved(other) == true))
{
return false;
}
return (compare->scale > other->scale + (mapobjectscale / 4));
if ((compareScale = P_GetMobjDefaultScale(compare)) != FRACUNIT)
{
compareScale = FixedDiv(compare->scale, compareScale);
}
else
{
compareScale = compare->scale;
}
if ((otherScale = P_GetMobjDefaultScale(other)) != FRACUNIT)
{
otherScale = FixedDiv(other->scale, otherScale);
}
else
{
otherScale = other->scale;
}
return (compareScale > otherScale + (mapobjectscale / 4));
}
static fixed_t K_TumbleZ(mobj_t *mo, fixed_t input)

View file

@ -256,6 +256,7 @@ mobjtype_t P_GetMobjtype(UINT16 mthingtype);
void P_RespawnSpecials(void);
fixed_t P_GetMobjDefaultScale(mobj_t *mobj);
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
void P_CalculatePrecipFloor(precipmobj_t *mobj);

View file

@ -10496,6 +10496,20 @@ void P_SceneryThinker(mobj_t *mobj)
// GAME SPAWN FUNCTIONS
//
fixed_t P_GetMobjDefaultScale(mobj_t *mobj)
{
switch(mobj->type)
{
case MT_SPECIALSTAGEARCH:
return 5*FRACUNIT;
case MT_SPECIALSTAGEBOMB:
return 3*FRACUNIT/4;
default:
break;
}
return FRACUNIT;
}
static void P_DefaultMobjShadowScale(mobj_t *thing)
{
thing->shadowscale = 0;
@ -10596,6 +10610,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
SINT8 sc = -1;
state_t *st;
mobj_t *mobj;
fixed_t scale;
if (type == MT_NULL)
{
@ -10648,13 +10663,12 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
// All mobjs are created at 100% scale.
mobj->scale = FRACUNIT;
mobj->destscale = mobj->scale;
mobj->scalespeed = FRACUNIT/12;
mobj->destscale = mapobjectscale;
mobj->scalespeed = mapobjectscale/12;
if (mapobjectscale != FRACUNIT) //&& !(mobj->type == MT_BLACKEGGMAN)
if ((scale = P_GetMobjDefaultScale(mobj)) != FRACUNIT)
{
mobj->destscale = mapobjectscale;
mobj->scalespeed = mapobjectscale/12;
mobj->destscale = FixedMul(mobj->destscale, scale);
}
// Sprite rendering