From 02a48737264eff8051025058d3955a9d38343b59 Mon Sep 17 00:00:00 2001 From: Kevin Slaughter Date: Tue, 18 Feb 2003 09:21:25 +0000 Subject: [PATCH] Re-added Judgement.* & HoldJudgement.* -- Without them, this current version will not compile. Why were they removed anyway? --- stepmania/src/HoldJudgement.cpp | 89 ++++++++++++++++++++++ stepmania/src/HoldJudgement.h | 34 +++++++++ stepmania/src/Judgement.cpp | 126 ++++++++++++++++++++++++++++++++ stepmania/src/Judgement.h | 36 +++++++++ 4 files changed, 285 insertions(+) create mode 100644 stepmania/src/HoldJudgement.cpp create mode 100644 stepmania/src/HoldJudgement.h create mode 100644 stepmania/src/Judgement.cpp create mode 100644 stepmania/src/Judgement.h diff --git a/stepmania/src/HoldJudgement.cpp b/stepmania/src/HoldJudgement.cpp new file mode 100644 index 0000000000..5889ad07d9 --- /dev/null +++ b/stepmania/src/HoldJudgement.cpp @@ -0,0 +1,89 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: HoldJudgment + + Desc: A graphic displayed in the HoldJudgment during Dancing. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "HoldJudgment.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" +#include "PrefsManager.h" +#include "ThemeManager.h" + + +CachedThemeMetric OK_ZOOM_X ("HoldJudgment","OKZoomX"); +CachedThemeMetric OK_ZOOM_Y ("HoldJudgment","OKZoomY"); +CachedThemeMetric TWEEN_SECONDS ("HoldJudgment","TweenSeconds"); +CachedThemeMetric SHOW_SECONDS ("HoldJudgment","ShowSeconds"); + + +HoldJudgment::HoldJudgment() +{ + OK_ZOOM_X.Refresh(); + OK_ZOOM_Y.Refresh(); + TWEEN_SECONDS.Refresh(); + SHOW_SECONDS.Refresh(); + + m_fShowCountdown = 0; + m_sprJudgment.Load( THEME->GetPathTo("Graphics","gameplay hold Judgment 1x2") ); + m_sprJudgment.StopAnimating(); + m_sprJudgment.TurnShadowOn(); + this->AddChild( &m_sprJudgment ); +} + +void HoldJudgment::Update( float fDeltaTime ) +{ + ActorFrame::Update( fDeltaTime ); + + m_fShowCountdown -= fDeltaTime; + if( m_fShowCountdown < 0 ) + m_fShowCountdown = 0; +} + +void HoldJudgment::DrawPrimitives() +{ + if( m_fShowCountdown > 0 ) + { + ActorFrame::DrawPrimitives(); + } +} + +void HoldJudgment::SetHoldJudgment( HoldNoteScore hns ) +{ + //LOG->Trace( "Judgment::SetJudgment()" ); + + switch( hns ) + { + case HNS_NONE: m_sprJudgment.SetState( 0 ); break; + case HNS_OK: m_sprJudgment.SetState( 0 ); break; + case HNS_NG: m_sprJudgment.SetState( 1 ); break; + default: ASSERT( false ); + } + + m_fShowCountdown = SHOW_SECONDS; + + if( hns == HNS_NG ) + { + // falling down + m_sprJudgment.StopTweening(); + m_sprJudgment.SetY( -10 ); + m_sprJudgment.SetZoom( 1.0f ); + m_sprJudgment.BeginTweening( SHOW_SECONDS ); + m_sprJudgment.SetTweenY( 10 ); + } + else // hns == HNS_OK + { + // zooming out + m_sprJudgment.StopTweening(); + m_sprJudgment.SetZoomX( OK_ZOOM_X ); + m_sprJudgment.SetZoomY( OK_ZOOM_Y ); + m_sprJudgment.BeginTweening( TWEEN_SECONDS ); + m_sprJudgment.SetTweenZoom( 1.0f ); + } +} \ No newline at end of file diff --git a/stepmania/src/HoldJudgement.h b/stepmania/src/HoldJudgement.h new file mode 100644 index 0000000000..b27893209a --- /dev/null +++ b/stepmania/src/HoldJudgement.h @@ -0,0 +1,34 @@ +#ifndef HOLDJudgment_H +#define HOLDJudgment_H +/* +----------------------------------------------------------------------------- + Class: HoldJudgment + + Desc: A graphic displayed in the HoldJudgment during Dancing. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Sprite.h" +#include "ActorFrame.h" +#include "song.h" +#include "BitmapText.h" +#include "PrefsManager.h" + + +class HoldJudgment : public ActorFrame +{ +public: + HoldJudgment(); + void SetHoldJudgment( HoldNoteScore hns ); + virtual void Update( float fDeltaTime ); + virtual void DrawPrimitives(); + +protected: + Sprite m_sprJudgment; + float m_fShowCountdown; +}; + +#endif \ No newline at end of file diff --git a/stepmania/src/Judgement.cpp b/stepmania/src/Judgement.cpp new file mode 100644 index 0000000000..db90b9d674 --- /dev/null +++ b/stepmania/src/Judgement.cpp @@ -0,0 +1,126 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: Judgment + + Desc: See header + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Judgment.h" +#include "RageUtil.h" +#include "GameConstantsAndTypes.h" +#include "PrefsManager.h" +#include "GameState.h" +#include "ThemeManager.h" + + +CachedThemeMetric WORD_X ("Judgment","WordX"); +CachedThemeMetric WORD_Y ("Judgment","WordY"); +CachedThemeMetric MARVELOUS_ZOOM ("Judgment","MarvelousZoom"); +CachedThemeMetric PERFECT_ZOOM ("Judgment","PerfectZoom"); +CachedThemeMetric GREAT_ZOOM ("Judgment","GreatZoom"); +CachedThemeMetric GOOD_ZOOM ("Judgment","GoodZoom"); +CachedThemeMetric BOO_ZOOM ("Judgment","BooZoom"); +CachedThemeMetric J_TWEEN_SECONDS ("Judgment","TweenSeconds"); +CachedThemeMetric J_SHOW_SECONDS ("Judgment","ShowSeconds"); + + +Judgment::Judgment() +{ + WORD_X.Refresh(); + WORD_Y.Refresh(); + MARVELOUS_ZOOM.Refresh(); + PERFECT_ZOOM.Refresh(); + GREAT_ZOOM.Refresh(); + GOOD_ZOOM.Refresh(); + BOO_ZOOM.Refresh(); + J_TWEEN_SECONDS.Refresh(); + J_SHOW_SECONDS.Refresh(); + + m_fShowCountdown = 0; + m_sprJudgment.Load( THEME->GetPathTo("Graphics","gameplay Judgment 1x6") ); + m_sprJudgment.SetXY( WORD_X, WORD_Y ); + m_sprJudgment.StopAnimating(); + m_sprJudgment.TurnShadowOn(); + this->AddChild( &m_sprJudgment ); +} + +void Judgment::Update( float fDeltaTime ) +{ + ActorFrame::Update( fDeltaTime ); + + m_fShowCountdown -= fDeltaTime; + if( m_fShowCountdown < 0 ) + m_fShowCountdown = 0; +} + +void Judgment::DrawPrimitives() +{ + if( m_fShowCountdown > 0 ) + { + ActorFrame::DrawPrimitives(); + } +} + + +void Judgment::SetJudgment( TapNoteScore score ) +{ + //LOG->Trace( "Judgment::SetJudgment()" ); + + switch( score ) + { + case TNS_MARVELOUS: m_sprJudgment.SetState( 0 ); break; + case TNS_PERFECT: m_sprJudgment.SetState( 1 ); break; + case TNS_GREAT: m_sprJudgment.SetState( 2 ); break; + case TNS_GOOD: m_sprJudgment.SetState( 3 ); break; + case TNS_BOO: m_sprJudgment.SetState( 4 ); break; + case TNS_MISS: m_sprJudgment.SetState( 5 ); break; + default: ASSERT(0); + } + + m_fShowCountdown = J_SHOW_SECONDS; + + m_sprJudgment.SetEffectNone(); + m_sprJudgment.StopTweening(); + + if( score == TNS_MISS ) + { + // falling down + m_sprJudgment.SetY( -20 ); + m_sprJudgment.BeginTweening( J_SHOW_SECONDS ); + m_sprJudgment.SetTweenY( 20 ); + } + else if( score == TNS_BOO ) + { + // vibrate + m_sprJudgment.SetY( 0 ); + m_sprJudgment.SetZoom( 1.0f ); + m_sprJudgment.SetEffectVibrating(); + } + else + { + // zooming out + float fZoom; + switch( score ) + { + case TNS_MARVELOUS: fZoom = MARVELOUS_ZOOM; break; + case TNS_PERFECT: fZoom = PERFECT_ZOOM; break; + case TNS_GREAT: fZoom = GREAT_ZOOM; break; + case TNS_GOOD: fZoom = GOOD_ZOOM; break; + default: ASSERT(0); fZoom = 1; break; + } + m_sprJudgment.SetY( 0 ); + m_sprJudgment.SetZoom( fZoom ); + m_sprJudgment.BeginTweening( J_TWEEN_SECONDS ); + m_sprJudgment.SetTweenZoom( 1 ); + } + + if( score == TNS_MARVELOUS ) + m_sprJudgment.SetEffectGlowBlinking(0.05f, RageColor(1,1,1,0), RageColor(1,1,1,0.5f)); + else + m_sprJudgment.SetEffectNone(); +} \ No newline at end of file diff --git a/stepmania/src/Judgement.h b/stepmania/src/Judgement.h new file mode 100644 index 0000000000..b1a91472fb --- /dev/null +++ b/stepmania/src/Judgement.h @@ -0,0 +1,36 @@ +#ifndef Judgment_H +#define Judgment_H +/* +----------------------------------------------------------------------------- + File: Judgment.h + + Desc: A graphic displayed in the Judgment during Dancing. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Sprite.h" +#include "ActorFrame.h" +#include "song.h" +#include "BitmapText.h" +#include "PrefsManager.h" + + +class Judgment : public ActorFrame +{ +public: + Judgment(); + virtual ~Judgment() { } + void SetJudgment( TapNoteScore score ); + virtual void Update( float fDeltaTime ); + virtual void DrawPrimitives(); + virtual void Reset() { m_fShowCountdown = .0f; } + +protected: + Sprite m_sprJudgment; + float m_fShowCountdown; +}; + +#endif \ No newline at end of file