From c3129a682e9a94aabe7ed406524d979bd8ecbe5a Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 6 Oct 2005 01:22:18 +0000 Subject: [PATCH] Remove GhostArrow, and do them with XML. This is simpler and reduces bloat in note skins. - skins with only one ghost flash can simply override "Common Tap Explosion Bright" and "Dim" - don't need to have tons of files to redirect each type of ghost flash - still supports overriding ghost commands in NoteSkin metrics.ini - fixes obscure bug: the first bright ghost flash wouldn't hide the last dim ghost flash --- stepmania/src/GhostArrowRow.cpp | 48 +++++++++++++++------------------ stepmania/src/GhostArrowRow.h | 4 +-- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/stepmania/src/GhostArrowRow.cpp b/stepmania/src/GhostArrowRow.cpp index db72ae741d..f1a93cf48b 100644 --- a/stepmania/src/GhostArrowRow.cpp +++ b/stepmania/src/GhostArrowRow.cpp @@ -9,6 +9,7 @@ #include "Game.h" #include "PlayerState.h" #include "Style.h" +#include "ActorUtil.h" GhostArrowRow::GhostArrowRow() @@ -30,17 +31,12 @@ void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset { const CString &sButton = GAMESTATE->GetCurrentGame()->ColToButtonName( c ); - m_GhostDim.push_back( new GhostArrow ); - m_GhostBright.push_back( new GhostArrow ); m_HoldGhost.push_back( new HoldGhostArrow ); - - m_GhostDim[c]->SetName( "GhostArrowDim" ); - m_GhostBright[c]->SetName( "GhostArrowBright" ); m_HoldGhost[c]->SetName( "HoldGhostArrow" ); - - m_GhostDim[c]->Load( sButton, "tap explosion dim" ); - m_GhostBright[c]->Load( sButton, "tap explosion bright" ); m_HoldGhost[c]->Load( sButton, "hold explosion" ); + + m_Ghost.push_back( ActorUtil::MakeActor( NOTESKIN->GetPath(sButton, "tap explosion") ) ); + m_Ghost[c]->SetName( "GhostArrow" ); } } @@ -48,8 +44,7 @@ GhostArrowRow::~GhostArrowRow() { for( int i = 0; i < m_iNumCols; ++i ) { - delete m_GhostDim[i]; - delete m_GhostBright[i]; + delete m_Ghost[i]; delete m_HoldGhost[i]; } } @@ -59,29 +54,24 @@ void GhostArrowRow::Update( float fDeltaTime ) { for( int c=0; cUpdate( fDeltaTime ); - m_GhostBright[c]->Update( fDeltaTime ); + m_Ghost[c]->Update( fDeltaTime ); m_HoldGhost[c]->Update( fDeltaTime ); const float fX = ArrowEffects::GetXPos( m_pPlayerState, c, 0 ); const float fY = ArrowEffects::GetYPos( m_pPlayerState, c, 0, m_fYReverseOffsetPixels ); const float fZ = ArrowEffects::GetZPos( m_pPlayerState, c, 0 ); - m_GhostDim[c]->SetX( fX ); - m_GhostBright[c]->SetX( fX ); + m_Ghost[c]->SetX( fX ); m_HoldGhost[c]->SetX( fX ); - m_GhostDim[c]->SetY( fY ); - m_GhostBright[c]->SetY( fY ); + m_Ghost[c]->SetY( fY ); m_HoldGhost[c]->SetY( fY ); - m_GhostDim[c]->SetZ( fZ ); - m_GhostBright[c]->SetZ( fZ ); + m_Ghost[c]->SetZ( fZ ); m_HoldGhost[c]->SetZ( fZ ); const float fZoom = ArrowEffects::GetZoom( m_pPlayerState ); - m_GhostDim[c]->SetZoom( fZoom ); - m_GhostBright[c]->SetZoom( fZoom ); + m_Ghost[c]->SetZoom( fZoom ); m_HoldGhost[c]->SetZoom( fZoom ); } } @@ -95,8 +85,7 @@ void GhostArrowRow::DrawPrimitives() NoteFieldMode::BeginDrawTrack( pn, c ); - m_GhostDim[c]->Draw(); - m_GhostBright[c]->Draw(); + m_Ghost[c]->Draw(); m_HoldGhost[c]->Draw(); NoteFieldMode::EndDrawTrack( c ); @@ -107,19 +96,26 @@ void GhostArrowRow::DrawPrimitives() void GhostArrowRow::DidTapNote( int iCol, TapNoteScore tns, bool bBright ) { ASSERT( iCol >= 0 && iCol < m_iNumCols ); + + m_Ghost[iCol]->PlayCommand( "Judgment" ); if( bBright ) - m_GhostBright[iCol]->StepTap( tns ); + m_Ghost[iCol]->PlayCommand( "Bright" ); else - m_GhostDim[iCol]->StepTap( tns ); + m_Ghost[iCol]->PlayCommand( "Dim" ); + CString sJudge = TapNoteScoreToString( tns ); + m_Ghost[iCol]->PlayCommand( Capitalize(sJudge) ); } void GhostArrowRow::DidHoldNote( int iCol, HoldNoteScore hns, bool bBright ) { ASSERT( iCol >= 0 && iCol < m_iNumCols ); + m_Ghost[iCol]->PlayCommand( "Judgment" ); if( bBright ) - m_GhostBright[iCol]->StepHold( hns ); + m_Ghost[iCol]->PlayCommand( "Bright" ); else - m_GhostDim[iCol]->StepHold( hns ); + m_Ghost[iCol]->PlayCommand( "Dim" ); + CString sJudge = HoldNoteScoreToString( hns ); + m_Ghost[iCol]->PlayCommand( Capitalize(sJudge) ); } void GhostArrowRow::SetHoldIsActive( int iCol ) diff --git a/stepmania/src/GhostArrowRow.h b/stepmania/src/GhostArrowRow.h index 23f30b712d..d451677db5 100644 --- a/stepmania/src/GhostArrowRow.h +++ b/stepmania/src/GhostArrowRow.h @@ -4,7 +4,6 @@ #define GHOSTARROWROW_H #include "ActorFrame.h" -#include "GhostArrow.h" #include "HoldGhostArrow.h" #include "GameConstantsAndTypes.h" @@ -29,8 +28,7 @@ protected: float m_fYReverseOffsetPixels; const PlayerState* m_pPlayerState; - vector m_GhostDim; - vector m_GhostBright; + vector m_Ghost; vector m_HoldGhost; };