2001-12-19 05:04:20 +00:00
|
|
|
#include "stdafx.h"
|
2002-07-28 20:28:37 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: HoldGhostArrow
|
|
|
|
|
|
|
|
|
|
Desc: A graphic displayed in the HoldJudgement during Dancing.
|
|
|
|
|
|
|
|
|
|
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"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include <math.h>
|
2001-12-19 05:04:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
const float HOLD_GHOST_ARROW_TWEEN_TIME = 0.5f;
|
|
|
|
|
|
|
|
|
|
HoldGhostArrow::HoldGhostArrow()
|
|
|
|
|
{
|
|
|
|
|
m_bWasSteppedOnLastFrame = false;
|
|
|
|
|
m_fHeatLevel = 0;
|
|
|
|
|
|
2002-04-01 02:04:43 +00:00
|
|
|
// LoadFromSpriteFile( THEME->GetPathTo(GRAPHIC_HOLD_GHOST_ARROW) );
|
2002-10-28 05:30:45 +00:00
|
|
|
SetDiffuse( RageColor(1,1,1,1) );
|
2002-07-28 20:28:37 +00:00
|
|
|
// SetZoom( 1.1f );
|
2001-12-19 05:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void HoldGhostArrow::Update( float fDeltaTime )
|
|
|
|
|
{
|
|
|
|
|
Sprite::Update( fDeltaTime );
|
|
|
|
|
|
|
|
|
|
if( m_bWasSteppedOnLastFrame )
|
|
|
|
|
m_fHeatLevel += fDeltaTime * 4;
|
|
|
|
|
else
|
|
|
|
|
m_fHeatLevel -= fDeltaTime * 4;
|
2002-07-28 20:28:37 +00:00
|
|
|
|
|
|
|
|
CLAMP( m_fHeatLevel, 0, 1 );
|
|
|
|
|
// if( m_fHeatLevel > 0 )
|
2003-02-12 19:39:58 +00:00
|
|
|
// LOG->Trace( "m_fHeatLevel = %f\n", m_fHeatLevel );
|
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 );
|
2002-02-03 20:45:08 +00:00
|
|
|
|
|
|
|
|
if( m_fHeatLevel == 1 )
|
|
|
|
|
{
|
2002-12-19 23:07:20 +00:00
|
|
|
bool bZooomALittle = fmodf( RageTimer::GetTimeSinceStart(), 1/20.0f ) > 1/40.0f;
|
2002-02-03 20:45:08 +00:00
|
|
|
SetZoom( bZooomALittle ? 1.04f : 1.0f );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
SetZoom( 1 );
|
2001-12-19 05:04:20 +00:00
|
|
|
|
2002-10-28 05:30:45 +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;
|
|
|
|
|
}
|