From 4cf6e96f6b6b010a4ee493ffbe806eff96186344 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 31 Dec 2003 21:40:38 +0000 Subject: [PATCH] support different explosion graphics per TapNoteScore --- stepmania/src/GhostArrow.cpp | 35 +++++++++++++++++++--- stepmania/src/GhostArrow.h | 7 +++-- stepmania/src/GhostArrowRow.cpp | 8 ++--- stepmania/src/NoteDisplay.cpp | 50 +++++++++++++++---------------- stepmania/src/NoteSkinManager.cpp | 37 ++++++++++++----------- stepmania/src/NoteSkinManager.h | 8 ++--- stepmania/src/ReceptorArrow.cpp | 6 ++-- 7 files changed, 92 insertions(+), 59 deletions(-) diff --git a/stepmania/src/GhostArrow.cpp b/stepmania/src/GhostArrow.cpp index 0c699d37b7..a8cb303131 100644 --- a/stepmania/src/GhostArrow.cpp +++ b/stepmania/src/GhostArrow.cpp @@ -14,11 +14,32 @@ #include "GhostArrow.h" #include "NoteSkinManager.h" #include "GameState.h" +#include "NoteSkinManager.h" GhostArrow::GhostArrow() { - SetDiffuse( RageColor(1,1,1,0) ); + for( int i=0; iAddChild( &m_spr[i] ); + } +} + +void GhostArrow::Load( CString sNoteSkin, CString sButton, CString sFile, bool bLoadJustOne ) +{ + for( int i=0; iGetPathToFromNoteSkinAndButton(sNoteSkin, sButton, sFullFile, true); // optional + if( sPath.empty() ) + sPath = NOTESKIN->GetPathToFromNoteSkinAndButton(sNoteSkin, sButton, sFile); // not optional + m_spr[i].Load( sPath ); + } } void GhostArrow::Init( PlayerNumber pn ) @@ -35,11 +56,17 @@ void GhostArrow::Init( PlayerNumber pn ) void GhostArrow::Update( float fDeltaTime ) { - Sprite::Update( fDeltaTime ); + ActorFrame::Update( fDeltaTime ); } void GhostArrow::Step( TapNoteScore score ) { - this->StopTweening(); - this->Command( m_sScoreCommand[score] ); + for( int i=0; iGetPathTo(NoteSkin, Button, "tap explosion dim") ); - m_GhostBright[c].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "tap explosion bright") ); - m_GhostMine[c].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "tap explosion mine") ); - m_HoldGhost[c].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold explosion") ); + m_GhostDim[c].Load( NoteSkin, Button, "tap explosion dim", false); + m_GhostBright[c].Load( NoteSkin, Button, "tap explosion bright", false ); + m_GhostMine[c].Load( NoteSkin, Button, "tap explosion mine", true ); + m_HoldGhost[c].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold explosion") ); } } diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 26c5d3ff15..a4903f60c1 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -198,93 +198,93 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn, CString NoteSkin, float fY if( cache->m_bTapNoteAnimationIsNoteColor ) { for( int i=0; iGetPathTo(NoteSkin, Button, "tap note "+sNoteType[i]) ); + m_pTapNote[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap note "+sNoteType[i]) ); } else { - m_pTapNote[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "tap note") ); + m_pTapNote[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap note") ); } if( cache->m_bTapAdditionAnimationIsNoteColor ) { for( int i=0; iGetPathTo(NoteSkin, Button, "tap addition "+sNoteType[i]) ); + m_pTapAddition[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap addition "+sNoteType[i]) ); } else { - m_pTapAddition[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "tap addition") ); + m_pTapAddition[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap addition") ); } - m_pTapMine = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "tap mine") ); + m_pTapMine = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "tap mine") ); if( cache->m_bHoldHeadAnimationIsNoteColor ) { for( int i=0; iGetPathTo(NoteSkin, Button, "hold head active "+sNoteType[i]) ); - m_pHoldHeadInactive[i] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head inactive "+sNoteType[i]) ); + m_pHoldHeadActive[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold head active "+sNoteType[i]) ); + m_pHoldHeadInactive[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold head inactive "+sNoteType[i]) ); } } else { - m_pHoldHeadActive[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head active") ); - m_pHoldHeadInactive[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head inactive") ); + m_pHoldHeadActive[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold head active") ); + m_pHoldHeadInactive[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold head inactive") ); } if( cache->m_bHoldTopCapAnimationIsNoteColor ) { for( int i=0; iGetPathTo(NoteSkin, Button, "hold topcap active "+sNoteType[i]) ); - m_sprHoldTopCapInactive[i].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold topcap inactive "+sNoteType[i]) ); + m_sprHoldTopCapActive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold topcap active "+sNoteType[i]) ); + m_sprHoldTopCapInactive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold topcap inactive "+sNoteType[i]) ); } } else { - m_sprHoldTopCapActive[0].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold topcap active") ); - m_sprHoldTopCapInactive[0].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold topcap inactive") ); + m_sprHoldTopCapActive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold topcap active") ); + m_sprHoldTopCapInactive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold topcap inactive") ); } if( cache->m_bHoldBodyAnimationIsNoteColor ) { for( int i=0; iGetPathTo(NoteSkin, Button, "hold body active "+sNoteType[i]) ); - m_sprHoldBodyInactive[i].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold body inactive "+sNoteType[i]) ); + m_sprHoldBodyActive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold body active "+sNoteType[i]) ); + m_sprHoldBodyInactive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold body inactive "+sNoteType[i]) ); } } else { - m_sprHoldBodyActive[0].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold body active") ); - m_sprHoldBodyInactive[0].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold body inactive") ); + m_sprHoldBodyActive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold body active") ); + m_sprHoldBodyInactive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold body inactive") ); } if( cache->m_bHoldBottomCapAnimationIsNoteColor ) { for( int i=0; iGetPathTo(NoteSkin, Button, "hold bottomcap active "+sNoteType[i]) ); - m_sprHoldBottomCapInactive[i].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold bottomcap inactive "+sNoteType[i]) ); + m_sprHoldBottomCapActive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold bottomcap active "+sNoteType[i]) ); + m_sprHoldBottomCapInactive[i].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold bottomcap inactive "+sNoteType[i]) ); } } else { - m_sprHoldBottomCapActive[0].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold bottomcap active") ); - m_sprHoldBottomCapInactive[0].Load( NOTESKIN->GetPathTo(NoteSkin, Button, "hold bottomcap inactive") ); + m_sprHoldBottomCapActive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold bottomcap active") ); + m_sprHoldBottomCapInactive[0].Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold bottomcap inactive") ); } if( cache->m_bHoldTailAnimationIsNoteColor ) { for( int i=0; iGetPathTo(NoteSkin, Button, "hold tail active "+sNoteType[i]) ); - m_pHoldTailInactive[i] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail inactive "+sNoteType[i]) ); + m_pHoldTailActive[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold tail active "+sNoteType[i]) ); + m_pHoldTailInactive[i] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold tail inactive "+sNoteType[i]) ); } } else { - m_pHoldTailActive[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail active") ); - m_pHoldTailInactive[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail inactive") ); + m_pHoldTailActive[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold tail active") ); + m_pHoldTailInactive[0] = MakeActor( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin, Button, "hold tail inactive") ); } } diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index 2a470414be..bedccb61ff 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -215,54 +215,57 @@ CString NoteSkinManager::ColToButtonName(int col) return pGameDef->m_szButtonNames[GI.button]; } -CString NoteSkinManager::GetPathTo( PlayerNumber pn, int col, CString sFileName ) +CString NoteSkinManager::GetPathToFromPlayerAndCol( PlayerNumber pn, int col, CString sFileName, bool bOptional ) { CString sButtonName = ColToButtonName(col); - return GetPathTo( pn, sButtonName, sFileName ); + return GetPathToFromPlayerAndButton( pn, sButtonName, sFileName, bOptional ); } -CString NoteSkinManager::GetPathTo( PlayerNumber pn, CString sButtonName, CString sFileName ) // looks in GAMESTATE for the current Style +CString NoteSkinManager::GetPathToFromPlayerAndButton( PlayerNumber pn, CString sButtonName, CString sElement, bool bOptional ) // looks in GAMESTATE for the current Style { // search active NoteSkin CString sNoteSkinName = GAMESTATE->m_PlayerOptions[pn].m_sNoteSkin; sNoteSkinName.MakeLower(); - return GetPathTo( sNoteSkinName, sButtonName, sFileName ); + return GetPathToFromNoteSkinAndButton( sNoteSkinName, sButtonName, sElement, bOptional ); } -CString NoteSkinManager::GetPathTo( CString NoteSkin, CString sButtonName, CString sFileName ) +CString NoteSkinManager::GetPathToFromNoteSkinAndButton( CString NoteSkin, CString sButtonName, CString sElement, bool bOptional ) { - CString ret = GetPathTo( GetNoteSkinDir(NoteSkin), sButtonName+" "+sFileName ); + CString ret = GetPathToFromDir( GetNoteSkinDir(NoteSkin), sButtonName+" "+sElement, bOptional ); if( !ret.empty() ) // we found something return ret; - ret = GetPathTo( GetNoteSkinDir(NoteSkin), "Fallback "+sFileName); + ret = GetPathToFromDir( GetNoteSkinDir(NoteSkin), "Fallback "+sElement, bOptional ); if( !ret.empty() ) // we found something return ret; // Search game default NoteSkin - ret = GetPathTo( GetNoteSkinDir(GAME_BASE_NOTESKIN_NAME), sButtonName+" "+sFileName); + ret = GetPathToFromDir( GetNoteSkinDir(GAME_BASE_NOTESKIN_NAME), sButtonName+" "+sElement, bOptional ); if( !ret.empty() ) // we found something return ret; - ret = GetPathTo( GetNoteSkinDir(GAME_BASE_NOTESKIN_NAME), "Fallback "+sFileName); + ret = GetPathToFromDir( GetNoteSkinDir(GAME_BASE_NOTESKIN_NAME), "Fallback "+sElement, bOptional ); if( !ret.empty() ) // we found something return ret; // Search global default NoteSkin - ret = GetPathTo( GLOBAL_BASE_NOTESKIN_DIR, "Fallback "+sFileName ); + ret = GetPathToFromDir( GLOBAL_BASE_NOTESKIN_DIR, "Fallback "+sElement, bOptional ); if( !ret.empty() ) // we found something return ret; - RageException::Throw( "The NoteSkin element '%s %s' could not be found in '%s', '%s', or '%s'.", - sButtonName.c_str(), sFileName.c_str(), - GetNoteSkinDir(NoteSkin).c_str(), - GetNoteSkinDir(GAME_BASE_NOTESKIN_NAME).c_str(), - GLOBAL_BASE_NOTESKIN_DIR.c_str() ); + if( bOptional ) + return ""; + else + RageException::Throw( "The NoteSkin element '%s %s' could not be found in '%s', '%s', or '%s'.", + sButtonName.c_str(), sElement.c_str(), + GetNoteSkinDir(NoteSkin).c_str(), + GetNoteSkinDir(GAME_BASE_NOTESKIN_NAME).c_str(), + GLOBAL_BASE_NOTESKIN_DIR.c_str() ); } -CString NoteSkinManager::GetPathTo( CString sDir, CString sFileName ) +CString NoteSkinManager::GetPathToFromDir( CString sDir, CString sFileName, bool bOptional ) { CStringArray matches; // fill this with the possible files @@ -295,7 +298,7 @@ CString NoteSkinManager::GetPathTo( CString sDir, CString sFileName ) { CString sNewFileName = GetRedirContents(sPath); - CString sNewPath = GetPathTo(sDir, sNewFileName); + CString sNewPath = GetPathToFromDir(sDir, sNewFileName, bOptional); if( !sNewPath.empty() ) return sNewPath; diff --git a/stepmania/src/NoteSkinManager.h b/stepmania/src/NoteSkinManager.h index be9ca75a90..8851d13c33 100644 --- a/stepmania/src/NoteSkinManager.h +++ b/stepmania/src/NoteSkinManager.h @@ -30,10 +30,10 @@ public: void GetNoteSkinNames( CStringArray &AddTo ); // looks up current Game in GAMESTATE bool DoesNoteSkinExist( CString sSkinName ); // looks up current Game in GAMESTATE - CString GetPathTo( PlayerNumber pn, int col, CString sElement ); - CString GetPathTo( CString NoteSkin, CString sButtonName, CString sFileName ); - CString GetPathTo( PlayerNumber pn, CString sButtonName, CString sElement ); - CString GetPathTo( CString sDir, CString sFileName ); + CString GetPathToFromPlayerAndCol( PlayerNumber pn, int col, CString sElement, bool bOptional=false ); + CString GetPathToFromNoteSkinAndButton( CString NoteSkin, CString sButtonName, CString sElement, bool bOptional=false ); + CString GetPathToFromPlayerAndButton( PlayerNumber pn, CString sButtonName, CString sElement, bool bOptional=false ); + CString GetPathToFromDir( CString sDir, CString sFileName, bool bOptional=false ); CString GetMetric( CString sNoteSkinName, CString sButtonName, CString sValue ); int GetMetricI( CString sNoteSkinName, CString sButtonName, CString sValueName ); diff --git a/stepmania/src/ReceptorArrow.cpp b/stepmania/src/ReceptorArrow.cpp index cc7ce8a1b9..91f51cb9df 100644 --- a/stepmania/src/ReceptorArrow.cpp +++ b/stepmania/src/ReceptorArrow.cpp @@ -38,11 +38,11 @@ bool ReceptorArrow::Load( CString NoteSkin, PlayerNumber pn, int iColNo ) sButton = NoteSkinManager::ColToButtonName( iColNo ); CString sPath; - m_pReceptorWaiting.Load( NOTESKIN->GetPathTo(NoteSkin,sButton,"receptor waiting") ); - m_pReceptorGo.Load( NOTESKIN->GetPathTo(NoteSkin,sButton,"receptor go") ); + m_pReceptorWaiting.Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin,sButton,"receptor waiting") ); + m_pReceptorGo.Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin,sButton,"receptor go") ); m_sStepCommand = NOTESKIN->GetMetric(GAMESTATE->m_PlayerOptions[pn].m_sNoteSkin,"ReceptorArrow","StepCommand"); - m_pPressBlock.Load( NOTESKIN->GetPathTo(NoteSkin,sButton,"KeypressBlock") ); + m_pPressBlock.Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin,sButton,"KeypressBlock") ); // draw pressblock before receptors this->AddChild( m_pPressBlock );