diff --git a/src/actor.h b/src/actor.h index 9c4fd9ff7..13ddf91fa 100644 --- a/src/actor.h +++ b/src/actor.h @@ -30,9 +30,7 @@ #include "dthinker.h" -// States are tied to finite states are -// tied to animation frames. -// Needs precompiled tables/data structures. +// States are tied to finite states are tied to animation frames. #include "info.h" #include "doomdef.h" @@ -40,6 +38,7 @@ #include "r_data/renderstyle.h" #include "s_sound.h" #include "memarena.h" +#include "g_level.h" struct subsector_t; // @@ -715,7 +714,16 @@ public: // What species am I? virtual FName GetSpecies(); - + + fixed_t GetBobOffset(fixed_t ticfrac=0) const + { + if (!(flags2 & MF2_FLOATBOB)) + { + return 0; + } + return finesine[MulScale22(((FloatBobPhase + level.maptime) << FRACBITS) + ticfrac, FINEANGLES) & FINEMASK] * 8; + } + // Enter the crash state void Crash(); diff --git a/src/r_things.cpp b/src/r_things.cpp index 80d0a75bc..459ebdbce 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -512,13 +512,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor // [RH] Interpolate the sprite's position to make it look smooth fx = thing->PrevX + FixedMul (r_TicFrac, thing->x - thing->PrevX); fy = thing->PrevY + FixedMul (r_TicFrac, thing->y - thing->PrevY); - fz = thing->PrevZ + FixedMul (r_TicFrac, thing->z - thing->PrevZ); - - // [RH] Make floatbobbing a renderer-only effect. - if (thing->flags2 & MF2_FLOATBOB) - { - fz += finesine[MulScale22(((thing->FloatBobPhase + level.maptime) << FRACBITS) + r_TicFrac, FINEANGLES) & FINEMASK] * 8; - } + fz = thing->PrevZ + FixedMul (r_TicFrac, thing->z - thing->PrevZ) + thing->GetBobOffset(r_TicFrac); // transform the origin point tr_x = fx - viewx;