mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Ease hitlag vibration over time
This commit is contained in:
parent
c9b17c456d
commit
1bec6945ee
2 changed files with 12 additions and 5 deletions
|
|
@ -410,7 +410,7 @@ typedef struct mobj_s
|
||||||
|
|
||||||
fixed_t sprxoff, spryoff, sprzoff; // Sprite offsets in real space, does NOT affect position or collision
|
fixed_t sprxoff, spryoff, sprzoff; // Sprite offsets in real space, does NOT affect position or collision
|
||||||
|
|
||||||
INT32 hitlag;
|
INT32 hitlag; // Sal-style hit lag, straight from Captain Fetch's jowls
|
||||||
|
|
||||||
// WARNING: New fields must be added separately to savegame and Lua.
|
// WARNING: New fields must be added separately to savegame and Lua.
|
||||||
} mobj_t;
|
} mobj_t;
|
||||||
|
|
|
||||||
|
|
@ -1469,11 +1469,18 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||||
fixed_t this_scale = thing->scale;
|
fixed_t this_scale = thing->scale;
|
||||||
|
|
||||||
// hitlag vibrating
|
// hitlag vibrating
|
||||||
if (thing->hitlag > 0 && (leveltime & 1))
|
if (thing->hitlag > 0)
|
||||||
{
|
{
|
||||||
thingxpos += thing->momx;
|
fixed_t mul = (thing->hitlag * FRACUNIT) / (TICRATE);
|
||||||
thingypos += thing->momy;
|
|
||||||
thingzpos += thing->momz;
|
if (leveltime & 1)
|
||||||
|
{
|
||||||
|
mul = -mul;
|
||||||
|
}
|
||||||
|
|
||||||
|
thingxpos += FixedMul(thing->momx, mul);
|
||||||
|
thingypos += FixedMul(thing->momy, mul);
|
||||||
|
thingzpos += FixedMul(thing->momz, mul);
|
||||||
}
|
}
|
||||||
|
|
||||||
// transform the origin point
|
// transform the origin point
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue