fix uninitialized variable (causing stuck life meter?)
This commit is contained in:
@@ -1,7 +1,20 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "StreamDisplay.h"
|
#include "StreamDisplay.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
|
StreamDisplay::StreamDisplay()
|
||||||
|
{
|
||||||
|
m_fMeterHeight = 1;
|
||||||
|
m_fMeterWidth = 1;
|
||||||
|
m_iNumStrips = 1;
|
||||||
|
m_iNumChambers = 1;
|
||||||
|
m_fPercent = 0;
|
||||||
|
m_fTrailingPercent = 0;
|
||||||
|
m_fVelocity = 0;
|
||||||
|
m_fPassingAlpha = 0;
|
||||||
|
m_fHotAlpha = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void StreamDisplay::Load(
|
void StreamDisplay::Load(
|
||||||
float fMeterWidth,
|
float fMeterWidth,
|
||||||
@@ -111,7 +124,18 @@ void StreamDisplay::DrawPrimitives()
|
|||||||
|
|
||||||
void StreamDisplay::SetPercent( float fPercent )
|
void StreamDisplay::SetPercent( float fPercent )
|
||||||
{
|
{
|
||||||
ASSERT( fPercent >= 0.0f && fPercent <= 1.0f );
|
DEBUG_ASSERT( fPercent >= 0.0f && fPercent <= 1.0f );
|
||||||
|
if( _isnan(fPercent) )
|
||||||
|
{
|
||||||
|
DEBUG_ASSERT_M( 0, "fPercent is NaN" );
|
||||||
|
fPercent = 1;
|
||||||
|
}
|
||||||
|
if( !_finite(fPercent) )
|
||||||
|
{
|
||||||
|
DEBUG_ASSERT_M( 0, "fPercent is infinite" );
|
||||||
|
fPercent = 1;
|
||||||
|
}
|
||||||
|
|
||||||
float fDeltaPercent = fPercent - m_fPercent;
|
float fDeltaPercent = fPercent - m_fPercent;
|
||||||
m_fVelocity += fDeltaPercent;
|
m_fVelocity += fDeltaPercent;
|
||||||
m_fPercent = fPercent;
|
m_fPercent = fPercent;
|
||||||
|
|||||||
@@ -7,16 +7,7 @@
|
|||||||
class StreamDisplay : public Actor
|
class StreamDisplay : public Actor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StreamDisplay()
|
StreamDisplay();
|
||||||
{
|
|
||||||
m_fMeterWidth = 0;
|
|
||||||
m_fMeterHeight = 0;
|
|
||||||
m_iNumStrips = 1;
|
|
||||||
m_iNumChambers = 1;
|
|
||||||
m_fPercent = 0;
|
|
||||||
m_fPassingAlpha = 0;
|
|
||||||
m_fHotAlpha = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Update( float fDeltaSecs );
|
virtual void Update( float fDeltaSecs );
|
||||||
|
|
||||||
|
|||||||
@@ -111,8 +111,10 @@ void ShowWarning( const char *file, int line, const char *message ); // don't pu
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define DEBUG_ASSERT(x) ASSERT(x)
|
#define DEBUG_ASSERT(x) ASSERT(x)
|
||||||
|
#define DEBUG_ASSERT_M(x,y) ASSERT_M(x,y)
|
||||||
#else
|
#else
|
||||||
#define DEBUG_ASSERT(x)
|
#define DEBUG_ASSERT(x)
|
||||||
|
#define DEBUG_ASSERT_M(x,y)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define a macro to tell the compiler that a function has printf() semantics, to
|
/* Define a macro to tell the compiler that a function has printf() semantics, to
|
||||||
|
|||||||
Reference in New Issue
Block a user