mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-02-02 19:31:23 +00:00
cf2ee1eb3f
They were immediately deleted when the associated thinker was destroyed. But this was too early because it missed the final tic of movement, resulting in a visible jump when a moving platform with a player on it came to a halt. Changed it so that DelRef no longer destroys the interpolation itself. Instead the ::Interpolate method will check if the reference count is 0, and if so and there was no more movement, will then destroy the interpolation. This ensures that it keeps running until it has interpolated all remaining bits of movement induced by the thinker. Now moving up a lift is 100% smooth, even with movement interpolation on.
71 lines
1.4 KiB
C++
71 lines
1.4 KiB
C++
#ifndef R_INTERPOLATE_H
|
|
#define R_INTERPOLATE_H
|
|
|
|
#include "dobject.h"
|
|
//==========================================================================
|
|
//
|
|
//
|
|
//
|
|
//==========================================================================
|
|
|
|
class DInterpolation : public DObject
|
|
{
|
|
friend struct FInterpolator;
|
|
|
|
DECLARE_ABSTRACT_CLASS(DInterpolation, DObject)
|
|
HAS_OBJECT_POINTERS
|
|
|
|
TObjPtr<DInterpolation> Next;
|
|
TObjPtr<DInterpolation> Prev;
|
|
|
|
protected:
|
|
int refcount;
|
|
|
|
DInterpolation();
|
|
|
|
public:
|
|
int AddRef();
|
|
int DelRef();
|
|
|
|
virtual void Destroy();
|
|
virtual void UpdateInterpolation() = 0;
|
|
virtual void Restore() = 0;
|
|
virtual void Interpolate(fixed_t smoothratio) = 0;
|
|
virtual void Serialize(FArchive &arc);
|
|
};
|
|
|
|
//==========================================================================
|
|
//
|
|
//
|
|
//
|
|
//==========================================================================
|
|
|
|
struct FInterpolator
|
|
{
|
|
TObjPtr<DInterpolation> Head;
|
|
bool didInterp;
|
|
int count;
|
|
|
|
int CountInterpolations ();
|
|
|
|
public:
|
|
FInterpolator()
|
|
{
|
|
Head = NULL;
|
|
didInterp = false;
|
|
count = 0;
|
|
}
|
|
void UpdateInterpolations();
|
|
void AddInterpolation(DInterpolation *);
|
|
void RemoveInterpolation(DInterpolation *);
|
|
void DoInterpolations(fixed_t smoothratio);
|
|
void RestoreInterpolations();
|
|
void ClearInterpolations();
|
|
};
|
|
|
|
extern FInterpolator interpolator;
|
|
|
|
|
|
|
|
#endif
|
|
|