- Move the float bob offset calculation into a separate function.

SVN r3789 (trunk)
This commit is contained in:
Randy Heit 2012-07-27 01:53:21 +00:00
parent 6bd8fafbad
commit eea532ce48
2 changed files with 13 additions and 11 deletions

View file

@ -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();

View file

@ -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;