mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Don't do scale-to-scale collision checks vs static hazards
This commit is contained in:
parent
a578f9b37c
commit
5575a049b1
1 changed files with 26 additions and 1 deletions
27
src/k_kart.c
27
src/k_kart.c
|
|
@ -3914,9 +3914,22 @@ void K_RemoveGrowShrink(player_t *player)
|
|||
player->roundconditions.consecutive_grow_lasers = 0;
|
||||
}
|
||||
|
||||
// Should this object actually scale check?
|
||||
// Scale-to-scale comparisons only make sense for objects that expect to have dynamic scale.
|
||||
static boolean K_IsScaledItem(mobj_t *mobj)
|
||||
{
|
||||
return mobj && !P_MobjWasRemoved(mobj) &&
|
||||
(mobj->type == MT_ORBINAUT || mobj->type == MT_JAWZ || mobj->type == MT_GACHABOM
|
||||
|| mobj->type == MT_BANANA || mobj->type == MT_EGGMANITEM || mobj->type == MT_BALLHOG
|
||||
|| mobj->type == MT_SSMINE || mobj->type == MT_LANDMINE || mobj->type == MT_SINK
|
||||
|| mobj->type == MT_GARDENTOP || mobj->type == MT_DROPTARGET || mobj->type == MT_PLAYER);
|
||||
}
|
||||
|
||||
|
||||
boolean K_IsBigger(mobj_t *compare, mobj_t *other)
|
||||
{
|
||||
fixed_t compareScale, otherScale;
|
||||
const fixed_t requiredDifference = (mapobjectscale/4);
|
||||
|
||||
if ((compare == NULL || P_MobjWasRemoved(compare) == true)
|
||||
|| (other == NULL || P_MobjWasRemoved(other) == true))
|
||||
|
|
@ -3924,6 +3937,18 @@ boolean K_IsBigger(mobj_t *compare, mobj_t *other)
|
|||
return false;
|
||||
}
|
||||
|
||||
// If a player is colliding with a non-kartitem object, we don't care about what scale that object is:
|
||||
// mappers are liable to fuck with the scale for their own reasons, and we need to compare against the
|
||||
// player's base scale instead to match expectations.
|
||||
if (K_IsScaledItem(compare) != K_IsScaledItem(other))
|
||||
{
|
||||
if (compare->type == MT_PLAYER)
|
||||
return (compare->scale > requiredDifference + FixedMul(mapobjectscale, P_GetMobjDefaultScale(compare)));
|
||||
else if (other->type == MT_PLAYER)
|
||||
return false; // Haha what the fuck are you doing
|
||||
// fallthrough
|
||||
}
|
||||
|
||||
if ((compareScale = P_GetMobjDefaultScale(compare)) != FRACUNIT)
|
||||
{
|
||||
compareScale = FixedDiv(compare->scale, compareScale);
|
||||
|
|
@ -3942,7 +3967,7 @@ boolean K_IsBigger(mobj_t *compare, mobj_t *other)
|
|||
otherScale = other->scale;
|
||||
}
|
||||
|
||||
return (compareScale > otherScale + (mapobjectscale / 4));
|
||||
return (compareScale > otherScale + requiredDifference);
|
||||
}
|
||||
|
||||
static fixed_t K_TumbleZ(mobj_t *mo, fixed_t input)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue