remove .model file format, replace with more general .actor file format

This commit is contained in:
Chris Danford
2003-09-21 20:57:07 +00:00
parent 3f2d2c7f77
commit dba1188c97
7 changed files with 53 additions and 76 deletions
+7 -8
View File
@@ -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;
+30 -7
View File
@@ -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;
-27
View File
@@ -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;
+1 -5
View File
@@ -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 );
+13 -27
View File
@@ -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; i<NOTE_COLOR_IMAGES; i++ )
m_pTapNote[i] = MakeModelOrSprite( NOTESKIN->GetPathTo(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; i<NOTE_COLOR_IMAGES; i++ )
{
m_pHoldHeadActive[i] = MakeModelOrSprite( NOTESKIN->GetPathTo(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; i<NOTE_COLOR_IMAGES; i++ )
{
m_pHoldTailActive[i] = MakeModelOrSprite( NOTESKIN->GetPathTo(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") );
}
}
+1 -1
View File
@@ -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 );
+1 -1
View File
@@ -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 },