diff --git a/src/p_mobj.h b/src/p_mobj.h index 75a6bf3b8..8ba15af84 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -410,7 +410,7 @@ typedef struct mobj_s 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. } mobj_t; diff --git a/src/r_things.c b/src/r_things.c index fb12fcb4b..708e9e146 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1469,11 +1469,18 @@ static void R_ProjectSprite(mobj_t *thing) fixed_t this_scale = thing->scale; // hitlag vibrating - if (thing->hitlag > 0 && (leveltime & 1)) + if (thing->hitlag > 0) { - thingxpos += thing->momx; - thingypos += thing->momy; - thingzpos += thing->momz; + fixed_t mul = (thing->hitlag * FRACUNIT) / (TICRATE); + + if (leveltime & 1) + { + mul = -mul; + } + + thingxpos += FixedMul(thing->momx, mul); + thingypos += FixedMul(thing->momy, mul); + thingzpos += FixedMul(thing->momz, mul); } // transform the origin point