Files
itgmania212121/stepmania/src/HoldGhostArrow.cpp
T

72 lines
1.6 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-07-28 20:28:37 +00:00
/*
-----------------------------------------------------------------------------
Class: HoldGhostArrow
2003-02-17 12:19:42 +00:00
Desc: A graphic displayed in the HoldJudgment during Dancing.
2002-07-28 20:28:37 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom
Chris Danford
-----------------------------------------------------------------------------
*/
2001-12-19 05:04:20 +00:00
#include "HoldGhostArrow.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
2002-07-27 19:29:51 +00:00
#include "RageException.h"
#include "RageTimer.h"
#include <math.h>
2003-02-17 12:19:42 +00:00
#include "ThemeManager.h"
2001-12-19 05:04:20 +00:00
CachedThemeMetricF WARM_UP_SECONDS ("HoldGhostArrow","WarmUpSeconds");
2003-02-17 12:19:42 +00:00
2001-12-19 05:04:20 +00:00
HoldGhostArrow::HoldGhostArrow()
{
2003-02-17 12:19:42 +00:00
WARM_UP_SECONDS.Refresh();
2001-12-19 05:04:20 +00:00
m_bWasSteppedOnLastFrame = false;
m_fHeatLevel = 0;
2002-04-01 02:04:43 +00:00
// LoadFromSpriteFile( THEME->GetPathTo(GRAPHIC_HOLD_GHOST_ARROW) );
SetDiffuse( RageColor(1,1,1,1) );
2001-12-19 05:04:20 +00:00
}
void HoldGhostArrow::Update( float fDeltaTime )
{
Sprite::Update( fDeltaTime );
if( m_bWasSteppedOnLastFrame )
2003-02-17 12:19:42 +00:00
m_fHeatLevel += fDeltaTime/(float)WARM_UP_SECONDS;
2001-12-19 05:04:20 +00:00
else
2003-02-17 12:19:42 +00:00
m_fHeatLevel -= fDeltaTime/(float)WARM_UP_SECONDS;
2002-07-28 20:28:37 +00:00
CLAMP( m_fHeatLevel, 0, 1 );
2001-12-19 05:04:20 +00:00
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-12-19 23:07:20 +00:00
bool bZooomALittle = fmodf( RageTimer::GetTimeSinceStart(), 1/20.0f ) > 1/40.0f;
SetZoom( bZooomALittle ? 1.04f : 1.0f );
}
else
SetZoom( 1 );
2001-12-19 05:04:20 +00:00
SetDiffuse( RageColor(1,1,1,m_fHeatLevel*3) );
2001-12-19 05:04:20 +00:00
m_bWasSteppedOnLastFrame = false; // reset for next frame
}
2002-07-28 20:28:37 +00:00
void HoldGhostArrow::DrawPrimitives()
2001-12-19 05:04:20 +00:00
{
2002-07-28 20:28:37 +00:00
Sprite::DrawPrimitives();
2001-12-19 05:04:20 +00:00
}
void HoldGhostArrow::Step()
{
m_bWasSteppedOnLastFrame = true;
}