MT_WALLSPIKE bumps are now literally reusing wallspring code

The code clearly *wanted* them to behave like wallsprings, but it was a mess so they were instead nuclear railguns. Now they're grey springs with damage but without tiregrease!

Also:
- Fixes pop-out wallspike interactions
- If a custom MF_SPRING has a "starcolor" (tiregrease stars) of SKINCOLOR_NONE, instead don't apply any tiregrease
This commit is contained in:
toaster 2025-08-01 14:34:22 +01:00
parent 763b9e970a
commit 2726da8e86
3 changed files with 27 additions and 12 deletions

View file

@ -5016,7 +5016,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
14*FRACUNIT, // height
0, // display offset
4, // mass
0, // damage
45*FRACUNIT, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_NOCLIPHEIGHT|MF_PAPERCOLLISION|MF_NOHITLAGFORME|MF_DONTENCOREMAP, // flags
S_NULL // raisestate

View file

@ -1225,6 +1225,20 @@ boolean K_KartSolidBounce(mobj_t *bounceMobj, mobj_t *solidMobj)
return false;
}
if (solidMobj->type == MT_WALLSPIKE)
{
// Always thrust out towards the tip
// (...don't try to roll our own bad calculations,
// just make this behave like a wallspring...)
P_DoSpringEx(bounceMobj, mapobjectscale, 0, solidMobj->info->damage,
solidMobj->angle, SKINCOLOR_NONE);
K_PlayerJustBumped(bounceMobj->player);
return true;
}
// Adds the OTHER object's momentum times a bunch, for the best chance of getting the correct direction
{
distx = (bounceMobj->x + solidMobj->momx) - (solidMobj->x + bounceMobj->momx);
@ -1252,16 +1266,6 @@ boolean K_KartSolidBounce(mobj_t *bounceMobj, mobj_t *solidMobj)
normalisedx = FixedDiv(distx, dist);
normalisedy = FixedDiv(disty, dist);
if (solidMobj->type == MT_WALLSPIKE)
{
fixed_t co = FCOS(solidMobj->angle);
fixed_t si = FSIN(solidMobj->angle);
// Always thrust out toward the tip
normalisedx = FixedMul(normalisedx, abs(si)) - co;
normalisedy = FixedMul(normalisedy, abs(co)) - si;
}
bounceSpeed = FixedHypot(bounceMobj->momx, bounceMobj->momy);
bounceSpeed = FixedMul(bounceSpeed, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3)));
bounceSpeed += minBump;

View file

@ -323,7 +323,7 @@ P_DoSpringEx
P_InstaThrust(object, finalAngle, finalSpeed);
}
if (object->player)
if (object->player && starcolor != SKINCOLOR_NONE)
{
K_TumbleInterrupt(object->player);
P_ResetPlayer(object->player);
@ -1341,6 +1341,11 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
thing->y,
g_tm.thing->z + (P_MobjFlip(thing) > 0 ? g_tm.thing->height : -thing->height)
);
if (g_tm.thing->type == MT_WALLSPIKE)
{
K_KartSolidBounce(thing, g_tm.thing);
}
}
}
else
@ -1367,6 +1372,12 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
if (!P_IsObjectOnGround(g_tm.thing) && g_tm.thing->momz * P_MobjFlip(g_tm.thing) < 0) // fell into it
{
P_DamageMobj(g_tm.thing, thing, thing, 1, DMG_TUMBLE);
if (thing->type == MT_WALLSPIKE)
{
K_KartSolidBounce(g_tm.thing, thing);
}
return BMIT_CONTINUE;
}
else