Files
itgmania212121/stepmania/src/HoldGhostArrow.cpp
T

70 lines
1.5 KiB
C++
Raw Normal View History

2001-12-19 05:04:20 +00:00
#include "stdafx.h"
//
// HoldGhostArrow.cpp: implementation of the GhostArrow class.
//
//////////////////////////////////////////////////////////////////////
#include "HoldGhostArrow.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2001-12-19 05:04:20 +00:00
const float HOLD_GHOST_ARROW_TWEEN_TIME = 0.5f;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
HoldGhostArrow::HoldGhostArrow()
{
m_bWasSteppedOnLastFrame = false;
m_fHeatLevel = 0;
2002-04-01 02:04:43 +00:00
// LoadFromSpriteFile( THEME->GetPathTo(GRAPHIC_HOLD_GHOST_ARROW) );
2001-12-19 05:04:20 +00:00
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
SetZoom( 1.1f );
}
void HoldGhostArrow::Update( float fDeltaTime )
{
Sprite::Update( fDeltaTime );
if( m_bWasSteppedOnLastFrame )
{
m_fHeatLevel += fDeltaTime * 4;
if( m_fHeatLevel >= 1 )
m_fHeatLevel = 1;
}
else
{
m_fHeatLevel -= fDeltaTime * 4;
if( m_fHeatLevel < 0 )
m_fHeatLevel = 0;
}
2002-02-24 01:43:11 +00:00
int iStateNum = (int)min( m_fHeatLevel * GetNumStates(), GetNumStates()-1 );
2001-12-19 05:04:20 +00:00
SetState( iStateNum );
if( m_fHeatLevel == 1 )
{
2002-06-14 22:25:22 +00:00
bool bZooomALittle = fmodf( TIMER->GetTimeSinceStart(), 1/20.0f ) > 1/40.0f;
SetZoom( bZooomALittle ? 1.04f : 1.0f );
}
else
SetZoom( 1 );
2001-12-19 05:04:20 +00:00
SetDiffuseColor( D3DXCOLOR(1,1,1,m_fHeatLevel*3) );
m_bWasSteppedOnLastFrame = false; // reset for next frame
}
void HoldGhostArrow::SetBeat( const float fSongBeat )
{
//SetState( fmod(fSongBeat,1)<0.25 ? 1 : 0 );
}
void HoldGhostArrow::Step()
{
m_bWasSteppedOnLastFrame = true;
}