diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 802b1fcbfd..be9bc28959 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -101,6 +101,13 @@ public: virtual void SetWidth( float width ) { m_size.x = width; } virtual void SetHeight( float height ) { m_size.y = height; } + void SetBaseZoomX( float zoom ) { m_baseScale.x = zoom; } + void SetBaseZoomY( float zoom ) { m_baseScale.y = zoom; } + void SetBaseZoomZ( float zoom ) { m_baseScale.z = zoom; } + virtual void SetBaseRotationX( float rot ) { m_baseRotation.x = rot; } + virtual void SetBaseRotationY( float rot ) { m_baseRotation.y = rot; } + virtual void SetBaseRotationZ( float rot ) { m_baseRotation.z = rot; } + virtual float GetZoom() { return DestTweenState().scale.x; } // not accurate in some cases virtual float GetZoomX() { return DestTweenState().scale.x; } virtual float GetZoomY() { return DestTweenState().scale.y; } @@ -276,14 +283,6 @@ protected: }; - // only called by Sprite - void SetBaseZoomX( float zoom ) { m_baseScale.x = zoom; } - void SetBaseZoomY( float zoom ) { m_baseScale.y = zoom; } - void SetBaseZoomZ( float zoom ) { m_baseScale.z = zoom; } - virtual void SetBaseRotationX( float rot ) { m_baseRotation.x = rot; } - virtual void SetBaseRotationY( float rot ) { m_baseRotation.y = rot; } - virtual void SetBaseRotationZ( float rot ) { m_baseRotation.z = rot; } - RageVector3 m_baseRotation; RageVector3 m_baseScale; diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index e2a310116b..55c9484dd5 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -15,6 +15,7 @@ #include "Sprite.h" #include "BitmapText.h" #include "Model.h" +#include "IniFile.h" Actor* MakeActor( CString sPath ) @@ -24,7 +25,35 @@ Actor* MakeActor( CString sPath ) sExt.MakeLower(); - if( sExt=="png" || + if( sExt=="actor" ) + { + // TODO: Check for recursive loading + CString sDir, sThrowAway; + splitrelpath( sPath, sDir, sThrowAway, sThrowAway ); + + IniFile ini; + ini.SetPath( sPath ); + ini.ReadFile(); + + if( !ini.GetKey("Actor") ) + RageException::Throw( "The actor file '%s' is invalid.", sPath.c_str() ); + + CString sFileName; + ini.GetValue( "Actor", "File", sFileName ); + + Actor* pActor = MakeActor( sDir+sFileName ); + + float f; + if( ini.GetValueF( "Actor", "BaseRotationXDegrees", f ) ) pActor->SetBaseRotationX( f ); + if( ini.GetValueF( "Actor", "BaseRotationYDegrees", f ) ) pActor->SetBaseRotationY( f ); + if( ini.GetValueF( "Actor", "BaseRotationZDegrees", f ) ) pActor->SetBaseRotationZ( f ); + if( ini.GetValueF( "Actor", "BaseZoomX", f ) ) pActor->SetBaseZoomX( f ); + if( ini.GetValueF( "Actor", "BaseZoomY", f ) ) pActor->SetBaseZoomY( f ); + if( ini.GetValueF( "Actor", "BaseZoomZ", f ) ) pActor->SetBaseZoomZ( f ); + + return pActor; + } + else if( sExt=="png" || sExt=="jpg" || sExt=="gif" || sExt=="bmp" || @@ -49,12 +78,6 @@ Actor* MakeActor( CString sPath ) pModel->LoadMilkshapeAscii( sPath ); return pModel; } - else if( sExt=="model" ) - { - Model* pModel = new Model; - pModel->LoadFromModelFile( sPath ); - return pModel; - } ASSERT(0); return NULL; diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index aca1efb26b..431e455626 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -49,33 +49,6 @@ void Model::Clear () m_pCurAnimation = NULL; } -bool Model::LoadFromModelFile( CString sPath ) -{ - CString sDir, sThrowAway; - splitrelpath( sPath, sDir, sThrowAway, sThrowAway ); - - IniFile ini; - ini.SetPath( sPath ); - ini.ReadFile(); - - if( !ini.GetKey("Model") ) - RageException::Throw( "The model file '%s' is invalid.", sPath.c_str() ); - - CString sFileName; - ini.GetValue( "Model", "File", sFileName ); - LoadMilkshapeAscii( sDir+sFileName ); - - float f; - if( ini.GetValueF( "Model", "BaseRotationXDegrees", f ) ) Actor::SetBaseRotationX( f ); - if( ini.GetValueF( "Model", "BaseRotationYDegrees", f ) ) Actor::SetBaseRotationY( f ); - if( ini.GetValueF( "Model", "BaseRotationZDegrees", f ) ) Actor::SetBaseRotationZ( f ); - if( ini.GetValueF( "Model", "BaseZoomX", f ) ) Actor::SetBaseZoomX( f ); - if( ini.GetValueF( "Model", "BaseZoomY", f ) ) Actor::SetBaseZoomY( f ); - if( ini.GetValueF( "Model", "BaseZoomZ", f ) ) Actor::SetBaseZoomZ( f ); - - return true; -} - bool Model::LoadMilkshapeAscii( CString sPath ) { CString sDir, sThrowAway; diff --git a/stepmania/src/Model.h b/stepmania/src/Model.h index 8a74143fed..583857e66d 100644 --- a/stepmania/src/Model.h +++ b/stepmania/src/Model.h @@ -40,13 +40,9 @@ public: void Load( CString sFile ) { if( sFile == "" ) return; - if( sFile.Right(6) == ".model" ) - LoadFromModelFile( sFile ); - else - LoadMilkshapeAscii( sFile ); + LoadMilkshapeAscii( sFile ); }; - bool LoadFromModelFile( CString sFile ); bool LoadMilkshapeAscii( CString sFile ); bool LoadMilkshapeAsciiBones( CString sAniName, CString sFile ); void PlayAnimation( CString sAniName, float fPlayRate = 1 ); diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 5d14c00240..326e0aef13 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -25,23 +25,9 @@ #include "RageDisplay.h" #include "NoteTypes.h" #include "NoteFieldPositioning.h" +#include "ActorUtil.h" -Actor* MakeModelOrSprite( CString sFile ) -{ - if( sFile.Right(3)=="txt"||sFile.Right(5)=="model" ) - { - Model* pModel = new Model; - pModel->Load( sFile ); - return pModel; - } - else - { - Sprite* pSprite = new Sprite; - pSprite->Load( sFile ); - return pSprite; - } -} #define DRAW_HOLD_HEAD_FOR_TAPS_ON_SAME_ROW NOTESKIN->GetMetricB(skin,name,"DrawHoldHeadForTapsOnSameRow") #define TAP_NOTE_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF(skin,name,"TapNoteAnimationLengthInBeats") @@ -190,29 +176,29 @@ 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->GetPathTo(NoteSkin, Button, "tap note "+sNoteType[i]) ); } else { - m_pTapNote[0] = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "tap note") ); + m_pTapNote[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "tap note") ); } - m_pTapAddition = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "tap addition") ); + m_pTapAddition = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "tap addition") ); - m_pTapMine = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "tap mine") ); + m_pTapMine = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "tap mine") ); if( cache->m_bHoldHeadAnimationIsNoteColor ) { for( int i=0; iGetPathTo(NoteSkin, Button, "hold head active "+sNoteType[i]) ); - m_pHoldHeadInactive[i] = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head inactive "+sNoteType[i]) ); + m_pHoldHeadActive[i] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head active "+sNoteType[i]) ); + m_pHoldHeadInactive[i] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head inactive "+sNoteType[i]) ); } } else { - m_pHoldHeadActive[0] = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head active") ); - m_pHoldHeadInactive[0] = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head inactive") ); + m_pHoldHeadActive[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head active") ); + m_pHoldHeadInactive[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold head inactive") ); } if( cache->m_bHoldTopCapAnimationIsNoteColor ) @@ -261,14 +247,14 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn, CString NoteSkin, float fY { for( int i=0; iGetPathTo(NoteSkin, Button, "hold tail active "+sNoteType[i]) ); - m_pHoldTailInactive[i] = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail inactive "+sNoteType[i]) ); + m_pHoldTailActive[i] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail active "+sNoteType[i]) ); + m_pHoldTailInactive[i] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail inactive "+sNoteType[i]) ); } } else { - m_pHoldTailActive[0] = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail active") ); - m_pHoldTailInactive[0] = MakeModelOrSprite( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail inactive") ); + m_pHoldTailActive[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail active") ); + m_pHoldTailInactive[0] = MakeActor( NOTESKIN->GetPathTo(NoteSkin, Button, "hold tail inactive") ); } } diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index 6cec3fa75f..de1bc622db 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -246,7 +246,7 @@ CString NoteSkinManager::GetPathTo( CString sDir, CString sFileName ) CStringArray matches; // fill this with the possible files GetDirListing( sDir+sFileName+"*.redir", matches, false, true ); - GetDirListing( sDir+sFileName+"*.model", matches, false, true ); + GetDirListing( sDir+sFileName+"*.actor", matches, false, true ); GetDirListing( sDir+sFileName+"*.txt", matches, false, true ); GetDirListing( sDir+sFileName+"*.sprite", matches, false, true ); GetDirListing( sDir+sFileName+"*.png", matches, false, true ); diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 8b90267104..9eb9128f63 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -191,7 +191,7 @@ try_element_again: static const char *masks[NUM_ELEMENT_CATEGORIES][12] = { { "", NULL }, { "*.ini", NULL }, - { "*.model", "*.sprite", "*.png", "*.jpg", "*.bmp", "*.gif","*.avi", "*.mpg", "*.mpeg", NULL}, + { "*.actor", "*.sprite", "*.png", "*.jpg", "*.bmp", "*.gif","*.avi", "*.mpg", "*.mpeg", "*.txt", NULL}, { "*.png", NULL }, { ".set", "*.mp3", "*.ogg", "*.wav", NULL }, { "*.sm", NULL },