Files
itgmania212121/stepmania/src/HoldJudgement.cpp
T

85 lines
2.0 KiB
C++
Raw Normal View History

2002-02-24 01:43:11 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: HoldJudgement
2002-02-24 01:43:11 +00:00
Desc: A graphic displayed in the HoldJudgement during Dancing.
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
2002-02-24 01:43:11 +00:00
-----------------------------------------------------------------------------
*/
#include "HoldJudgement.h"
#include "RageUtil.h"
2002-05-01 19:14:55 +00:00
#include "GameConstantsAndTypes.h"
2002-07-23 01:41:40 +00:00
#include "PrefsManager.h"
#include "ThemeManager.h"
2002-02-24 01:43:11 +00:00
2002-08-19 20:02:30 +00:00
//
// Important!!!! Do not use these macros during gameplay. They return very slowly. Cache them in a member.
//
#define JUDGEMENT_DISPLAY_TIME THEME->GetMetricF("HoldJudgement","DisplayTime")
2002-02-24 01:43:11 +00:00
HoldJudgement::HoldJudgement()
{
2002-08-19 20:02:30 +00:00
m_fDisplayTime = JUDGEMENT_DISPLAY_TIME;
2002-02-24 01:43:11 +00:00
m_fDisplayCountdown = 0;
m_sprJudgement.Load( THEME->GetPathTo("Graphics","gameplay hold judgement") );
2002-02-24 01:43:11 +00:00
m_sprJudgement.StopAnimating();
2002-05-29 09:47:24 +00:00
m_sprJudgement.TurnShadowOn();
this->AddChild( &m_sprJudgement );
2002-02-24 01:43:11 +00:00
}
void HoldJudgement::Update( float fDeltaTime )
{
ActorFrame::Update( fDeltaTime );
m_fDisplayCountdown -= fDeltaTime;
if( m_fDisplayCountdown < 0 )
m_fDisplayCountdown = 0;
}
2002-05-19 01:59:48 +00:00
void HoldJudgement::DrawPrimitives()
2002-02-24 01:43:11 +00:00
{
if( m_fDisplayCountdown > 0 )
{
2002-05-19 01:59:48 +00:00
ActorFrame::DrawPrimitives();
2002-02-24 01:43:11 +00:00
}
}
2002-06-14 22:25:22 +00:00
void HoldJudgement::SetHoldJudgement( HoldNoteScore hns )
2002-02-24 01:43:11 +00:00
{
//LOG->Trace( "Judgement::SetJudgement()" );
2002-02-24 01:43:11 +00:00
2002-06-14 22:25:22 +00:00
switch( hns )
2002-02-24 01:43:11 +00:00
{
2002-06-14 22:25:22 +00:00
case HNS_NONE: m_sprJudgement.SetState( 0 ); break;
case HNS_OK: m_sprJudgement.SetState( 0 ); break;
case HNS_NG: m_sprJudgement.SetState( 1 ); break;
2002-02-24 01:43:11 +00:00
default: ASSERT( false );
}
2002-08-19 20:02:30 +00:00
m_fDisplayCountdown = m_fDisplayTime;
2002-02-24 01:43:11 +00:00
2002-06-14 22:25:22 +00:00
if( hns == HNS_NG )
2002-02-24 01:43:11 +00:00
{
// falling down
2002-10-09 17:44:32 +00:00
m_sprJudgement.StopTweening();
2002-02-24 01:43:11 +00:00
m_sprJudgement.SetY( -10 );
m_sprJudgement.SetZoom( 1.0f );
2002-08-19 20:02:30 +00:00
m_sprJudgement.BeginTweening( m_fDisplayTime );
2002-02-24 01:43:11 +00:00
m_sprJudgement.SetTweenY( 10 );
}
2002-06-14 22:25:22 +00:00
else // hns == HNS_OK
2002-02-24 01:43:11 +00:00
{
// zooming out
2002-10-09 17:44:32 +00:00
m_sprJudgement.StopTweening();
2002-02-24 01:43:11 +00:00
m_sprJudgement.SetZoom( 1.5f );
2002-08-19 20:02:30 +00:00
m_sprJudgement.BeginTweening( m_fDisplayTime/3.0f );
2002-02-24 01:43:11 +00:00
m_sprJudgement.SetTweenZoom( 1.0f );
}
2002-11-16 08:55:46 +00:00
}