add Model to NoteDisplay

This commit is contained in:
Chris Danford
2003-05-09 04:42:04 +00:00
parent 26fafd1c5f
commit c04b5b993b
9 changed files with 74 additions and 50 deletions
+2
View File
@@ -239,6 +239,8 @@ public:
void Command( CString sCommandString ); void Command( CString sCommandString );
static float GetCommandLength( CString command ); static float GetCommandLength( CString command );
virtual void SetState( int iNewState ) {};
virtual int GetNumStates() { return 1; };
protected: protected:
-2
View File
@@ -35,13 +35,11 @@ DancingCharacters::DancingCharacters()
m_Character[PLAYER_1].SetX( MODEL_X[PLAYER_1] ); m_Character[PLAYER_1].SetX( MODEL_X[PLAYER_1] );
m_Character[PLAYER_1].LoadMilkshapeAscii( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\char0000\\model.txt" ); m_Character[PLAYER_1].LoadMilkshapeAscii( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\char0000\\model.txt" );
m_Character[PLAYER_1].LoadMilkshapeAsciiBones( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\dance0001.bones.txt" ); m_Character[PLAYER_1].LoadMilkshapeAsciiBones( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\dance0001.bones.txt" );
m_Character[PLAYER_1].SetZoomY(-1);
this->AddChild( &m_Character[PLAYER_1] ); this->AddChild( &m_Character[PLAYER_1] );
m_Character[PLAYER_2].SetX( MODEL_X[PLAYER_2] ); m_Character[PLAYER_2].SetX( MODEL_X[PLAYER_2] );
m_Character[PLAYER_2].LoadMilkshapeAscii( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\char0011\\model.txt" ); m_Character[PLAYER_2].LoadMilkshapeAscii( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\char0011\\model.txt" );
m_Character[PLAYER_2].LoadMilkshapeAsciiBones( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\dance0002.bones.txt" ); m_Character[PLAYER_2].LoadMilkshapeAsciiBones( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\dance0002.bones.txt" );
m_Character[PLAYER_2].SetZoomY(-1);
this->AddChild( &m_Character[PLAYER_2] ); this->AddChild( &m_Character[PLAYER_2] );
StartCameraSweep(); StartCameraSweep();
+2
View File
@@ -702,6 +702,8 @@ void Model::DrawPrimitives()
if (!m_pModel) if (!m_pModel)
return; return;
DISPLAY->Scale( 0, -1, 0 ); // flip so positive Y is up
DISPLAY->SetBlendModeNormal(); DISPLAY->SetBlendModeNormal();
DISPLAY->EnableZBuffer(); DISPLAY->EnableZBuffer();
+55 -33
View File
@@ -27,6 +27,22 @@
#include "NoteFieldPositioning.h" #include "NoteFieldPositioning.h"
Actor* MakeModelOrSprite( CString sFile )
{
if( sFile.Right(3)=="txt" )
{
Model* pModel = new Model;
pModel->LoadMilkshapeAscii( sFile );
return pModel;
}
else
{
Sprite* pSprite = new Sprite;
pSprite->Load( sFile );
return pSprite;
}
}
#define DRAW_HOLD_HEAD_FOR_TAPS_ON_SAME_ROW NOTESKIN->GetMetricB(pn,name,"DrawHoldHeadForTapsOnSameRow") #define DRAW_HOLD_HEAD_FOR_TAPS_ON_SAME_ROW NOTESKIN->GetMetricB(pn,name,"DrawHoldHeadForTapsOnSameRow")
#define TAP_NOTE_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF(pn,name,"TapNoteAnimationLengthInBeats") #define TAP_NOTE_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF(pn,name,"TapNoteAnimationLengthInBeats")
#define HOLD_HEAD_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF(pn,name,"HoldHeadAnimationLengthInBeats") #define HOLD_HEAD_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF(pn,name,"HoldHeadAnimationLengthInBeats")
@@ -111,6 +127,13 @@ NoteDisplay::NoteDisplay()
NoteDisplay::~NoteDisplay() NoteDisplay::~NoteDisplay()
{ {
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
{
delete m_pTapNote[i];
delete m_pHoldHeadActive[i];
delete m_pHoldHeadInactive[i];
}
delete cache; delete cache;
} }
@@ -134,25 +157,25 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn )
if( cache->m_bTapNoteAnimationIsNoteColor ) if( cache->m_bTapNoteAnimationIsNoteColor )
{ {
for( int i=0; i<NOTE_COLOR_IMAGES; i++ ) for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
m_sprTapNote[i].Load( NOTESKIN->GetPathTo(pn, Button, "tap note "+sNoteType[i]) ); m_pTapNote[i] = MakeModelOrSprite( NOTESKIN->GetPathTo(pn, Button, "tap note "+sNoteType[i]) );
} }
else else
{ {
m_sprTapNote[0].Load( NOTESKIN->GetPathTo(pn, Button, "tap note") ); m_pTapNote[0] = MakeModelOrSprite( NOTESKIN->GetPathTo(pn, Button, "tap note") );
} }
if( cache->m_bHoldHeadAnimationIsNoteColor ) if( cache->m_bHoldHeadAnimationIsNoteColor )
{ {
for( int i=0; i<NOTE_COLOR_IMAGES; i++ ) for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
{ {
m_sprHoldHeadActive[i].Load( NOTESKIN->GetPathTo(pn, Button, "hold head active "+sNoteType[i]) ); m_pHoldHeadActive[i] = MakeModelOrSprite( NOTESKIN->GetPathTo(pn, Button, "hold head active "+sNoteType[i]) );
m_sprHoldHeadInactive[i].Load( NOTESKIN->GetPathTo(pn, Button, "hold head inactive "+sNoteType[i]) ); m_pHoldHeadInactive[i] = MakeModelOrSprite( NOTESKIN->GetPathTo(pn, Button, "hold head inactive "+sNoteType[i]) );
} }
} }
else else
{ {
m_sprHoldHeadActive[0].Load( NOTESKIN->GetPathTo(pn, Button, "hold head active") ); m_pHoldHeadActive[0] = MakeModelOrSprite( NOTESKIN->GetPathTo(pn, Button, "hold head active") );
m_sprHoldHeadInactive[0].Load( NOTESKIN->GetPathTo(pn, Button, "hold head inactive") ); m_pHoldHeadInactive[0] = MakeModelOrSprite( NOTESKIN->GetPathTo(pn, Button, "hold head inactive") );
} }
if( cache->m_bHoldTopCapAnimationIsNoteColor ) if( cache->m_bHoldTopCapAnimationIsNoteColor )
@@ -213,9 +236,9 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn )
} }
void NoteDisplay::SetActiveFrame( float fNoteBeat, Sprite &Spr, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor ) void NoteDisplay::SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor )
{ {
const int iNumFrames = Spr.GetNumStates(); const int iNumFrames = actorToSet.GetNumStates();
float fSongBeat = GAMESTATE->m_fSongBeat; float fSongBeat = GAMESTATE->m_fSongBeat;
float fPrecentIntoAnimation = fmodf(fSongBeat,fAnimationLengthInBeats) / fAnimationLengthInBeats; float fPrecentIntoAnimation = fmodf(fSongBeat,fAnimationLengthInBeats) / fAnimationLengthInBeats;
float fNoteBeatFraction = fmodf( fNoteBeat, 1.0f ); float fNoteBeatFraction = fmodf( fNoteBeat, 1.0f );
@@ -229,26 +252,26 @@ void NoteDisplay::SetActiveFrame( float fNoteBeat, Sprite &Spr, float fAnimation
ASSERT( iFrameNo>=0 && iFrameNo<iNumFrames ); ASSERT( iFrameNo>=0 && iFrameNo<iNumFrames );
Spr.SetState( iFrameNo ); actorToSet.SetState( iFrameNo );
} }
Sprite * NoteDisplay::GetTapNoteSprite( float fNoteBeat ) Actor * NoteDisplay::GetTapNoteActor( float fNoteBeat )
{ {
NoteType nt = NoteType(0); NoteType nt = NoteType(0);
if( cache->m_bTapNoteAnimationIsNoteColor ) if( cache->m_bTapNoteAnimationIsNoteColor )
nt = BeatToNoteType( fNoteBeat ); nt = BeatToNoteType( fNoteBeat );
if( nt == NOTE_TYPE_INVALID ) if( nt == NOTE_TYPE_INVALID )
nt = NOTE_TYPE_32ND; nt = NOTE_TYPE_32ND;
Sprite *pSpriteOut = &m_sprTapNote[nt]; Actor *pActorOut = m_pTapNote[nt];
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pSpriteOut, *pActorOut,
cache->m_fTapNoteAnimationLengthInBeats, cache->m_fTapNoteAnimationLengthInBeats,
cache->m_bTapNoteAnimationIsVivid, cache->m_bTapNoteAnimationIsVivid,
cache->m_bTapNoteAnimationIsNoteColor ); cache->m_bTapNoteAnimationIsNoteColor );
return pSpriteOut; return pActorOut;
} }
Sprite * NoteDisplay::GetHoldTopCapSprite( float fNoteBeat, bool bActive ) Sprite * NoteDisplay::GetHoldTopCapSprite( float fNoteBeat, bool bActive )
@@ -292,7 +315,7 @@ Sprite * NoteDisplay::GetHoldBottomCapSprite( float fNoteBeat, bool bActive )
} }
Sprite * NoteDisplay::GetHoldHeadSprite( float fNoteBeat, bool bActive ) Actor* NoteDisplay::GetHoldHeadActor( float fNoteBeat, bool bActive )
{ {
NoteType nt = NoteType(0); NoteType nt = NoteType(0);
if( cache->m_bHoldHeadAnimationIsNoteColor ) if( cache->m_bHoldHeadAnimationIsNoteColor )
@@ -300,16 +323,16 @@ Sprite * NoteDisplay::GetHoldHeadSprite( float fNoteBeat, bool bActive )
if( nt == NOTE_TYPE_INVALID ) if( nt == NOTE_TYPE_INVALID )
nt = NOTE_TYPE_32ND; nt = NOTE_TYPE_32ND;
Sprite *pSpriteOut = bActive ? &m_sprHoldHeadActive[nt] : &m_sprHoldHeadInactive[nt]; Actor *pActorOut = bActive ? m_pHoldHeadActive[nt] : m_pHoldHeadInactive[nt];
SetActiveFrame( SetActiveFrame(
fNoteBeat, fNoteBeat,
*pSpriteOut, *pActorOut,
cache->m_fHoldHeadAnimationLengthInBeats, cache->m_fHoldHeadAnimationLengthInBeats,
cache->m_bHoldHeadAnimationIsVivid, cache->m_bHoldHeadAnimationIsVivid,
cache->m_bHoldHeadAnimationIsNoteColor ); cache->m_bHoldHeadAnimationIsNoteColor );
return pSpriteOut; return pActorOut;
} }
Sprite *NoteDisplay::GetHoldBodySprite( float fNoteBeat, bool bActive ) Sprite *NoteDisplay::GetHoldBodySprite( float fNoteBeat, bool bActive )
@@ -619,7 +642,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
// Draw the head // Draw the head
// //
{ {
Sprite* pSprHead = GetHoldHeadSprite( hn.fStartBeat, bActive ); Actor* pActor = GetHoldHeadActor( hn.fStartBeat, bActive );
// draw with normal Sprite // draw with normal Sprite
const float fY = fYHead; const float fY = fYHead;
@@ -629,18 +652,18 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha); const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
const RageColor colorGlow = RageColor(1,1,1,fGlow); const RageColor colorGlow = RageColor(1,1,1,fGlow);
pSprHead->SetXY( fX, fY ); pActor->SetXY( fX, fY );
if( bDrawGlowOnly ) if( bDrawGlowOnly )
{ {
pSprHead->SetDiffuse( RageColor(1,1,1,0) ); pActor->SetDiffuse( RageColor(1,1,1,0) );
pSprHead->SetGlow( colorGlow ); pActor->SetGlow( colorGlow );
} }
else else
{ {
pSprHead->SetDiffuse( colorDiffuse ); pActor->SetDiffuse( colorDiffuse );
pSprHead->SetGlow( RageColor(0,0,0,0) ); pActor->SetGlow( RageColor(0,0,0,0) );
} }
pSprHead->Draw(); pActor->Draw();
} }
// now, draw the glow pass // now, draw the glow pass
@@ -660,24 +683,23 @@ void NoteDisplay::DrawTap( const int iCol, const float fBeat, const bool bOnSame
RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha); RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
RageColor glow = RageColor(1,1,1,fGlow); RageColor glow = RageColor(1,1,1,fGlow);
Sprite* pSprite; Actor* pActor;
if( bOnSameRowAsHoldStart && cache->m_bDrawHoldHeadForTapsOnSameRow ) if( bOnSameRowAsHoldStart && cache->m_bDrawHoldHeadForTapsOnSameRow )
{ {
// draw hold head // draw hold head
pSprite = GetHoldHeadSprite( fBeat, false ); pActor = GetHoldHeadActor( fBeat, false );
pSprite->StopUsingCustomCoords();
} }
else else
{ {
// draw tap // draw tap
pSprite = GetTapNoteSprite( fBeat ); pActor = GetTapNoteActor( fBeat );
pSprite->SetRotationZ( fRotation ); pActor->SetRotationZ( fRotation );
} }
pSprite->SetXY( fXPos, fYPos ); pActor->SetXY( fXPos, fYPos );
pSprite->SetDiffuse( diffuse ); pActor->SetDiffuse( diffuse );
pSprite->SetGlow( glow ); pActor->SetGlow( glow );
pSprite->Draw(); pActor->Draw();
} }
+7 -6
View File
@@ -14,6 +14,7 @@
*/ */
#include "Sprite.h" #include "Sprite.h"
#include "Model.h"
#include "NoteTypes.h" #include "NoteTypes.h"
#include "PlayerNumber.h" #include "PlayerNumber.h"
@@ -32,9 +33,9 @@ public:
void DrawHold( const HoldNote& hn, const bool bActive, const float fLife, const float fPercentFadeToFail, bool bDrawGlowOnly = false ); void DrawHold( const HoldNote& hn, const bool bActive, const float fLife, const float fPercentFadeToFail, bool bDrawGlowOnly = false );
protected: protected:
void SetActiveFrame( float fNoteBeat, Sprite &Spr, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor ); void SetActiveFrame( float fNoteBeat, Actor &actorToSet, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor );
Sprite *GetTapNoteSprite( float fNoteBeat ); Actor *GetTapNoteActor( float fNoteBeat );
Sprite *GetHoldHeadSprite( float fNoteBeat, bool bActive ); Actor *GetHoldHeadActor( float fNoteBeat, bool bActive );
Sprite *GetHoldTopCapSprite( float fNoteBeat, bool bActive ); Sprite *GetHoldTopCapSprite( float fNoteBeat, bool bActive );
Sprite *GetHoldBodySprite( float fNoteBeat, bool bActive ); Sprite *GetHoldBodySprite( float fNoteBeat, bool bActive );
Sprite *GetHoldBottomCapSprite( float fNoteBeat, bool bActive ); Sprite *GetHoldBottomCapSprite( float fNoteBeat, bool bActive );
@@ -46,9 +47,9 @@ protected:
#define NOTE_COLOR_IMAGES 6 #define NOTE_COLOR_IMAGES 6
Sprite m_sprTapNote[NOTE_COLOR_IMAGES]; Actor* m_pTapNote[NOTE_COLOR_IMAGES];
Sprite m_sprHoldHeadActive[NOTE_COLOR_IMAGES]; Actor* m_pHoldHeadActive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldHeadInactive[NOTE_COLOR_IMAGES]; Actor* m_pHoldHeadInactive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldTopCapActive[NOTE_COLOR_IMAGES]; Sprite m_sprHoldTopCapActive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldTopCapInactive[NOTE_COLOR_IMAGES]; Sprite m_sprHoldTopCapInactive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldBodyActive[NOTE_COLOR_IMAGES]; Sprite m_sprHoldBodyActive[NOTE_COLOR_IMAGES];
+1
View File
@@ -199,6 +199,7 @@ CString NoteSkinManager::GetPathTo( CString sSkinName, CString sButtonName, CStr
CStringArray arrayPossibleFileNames; // fill this with the possible files CStringArray arrayPossibleFileNames; // fill this with the possible files
GetDirListing( ssprintf("%s%s %s*.txt", sDir.c_str(), sButtonName.c_str(), sElementName.c_str()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.sprite", sDir.c_str(), sButtonName.c_str(), sElementName.c_str()), arrayPossibleFileNames, false, true ); GetDirListing( ssprintf("%s%s %s*.sprite", sDir.c_str(), sButtonName.c_str(), sElementName.c_str()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.png", sDir.c_str(), sButtonName.c_str(), sElementName.c_str()), arrayPossibleFileNames, false, true ); GetDirListing( ssprintf("%s%s %s*.png", sDir.c_str(), sButtonName.c_str(), sElementName.c_str()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.jpg", sDir.c_str(), sButtonName.c_str(), sElementName.c_str()), arrayPossibleFileNames, false, true ); GetDirListing( ssprintf("%s%s %s*.jpg", sDir.c_str(), sButtonName.c_str(), sElementName.c_str()), arrayPossibleFileNames, false, true );
+4 -6
View File
@@ -32,12 +32,10 @@ ScreenSandbox::ScreenSandbox() : Screen("ScreenSandbox")
// this->AddChild( &m_sprite ); // this->AddChild( &m_sprite );
m_model.SetXY(CENTER_X, CENTER_Y); m_model.SetXY(CENTER_X, CENTER_Y);
m_model.SetZoomX(12); m_model.SetZoomX(1);
m_model.SetZoomY(-12); m_model.SetZoomY(-1);
// m_model.SetY(0); m_model.LoadMilkshapeAscii( "arrow.txt" );
// m_model.LoadMilkshapeAscii( "bend.txt" ); // m_model.LoadMilkshapeAsciiBones( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\howtoplay.bones.txt" );
m_model.LoadMilkshapeAscii( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\char0000\\model.txt" );
m_model.LoadMilkshapeAsciiBones( "D:\\Dev\\ddrpc char hacking\\DDRPCRip\\models\\howtoplay.bones.txt" );
this->AddChild(&m_model); this->AddChild(&m_model);
m_model.SetEffectSpin( RageVector3(0,90,0) ); m_model.SetEffectSpin( RageVector3(0,90,0) );
+1 -1
View File
@@ -42,7 +42,7 @@ public:
virtual void EnableAnimation( bool bEnable ); virtual void EnableAnimation( bool bEnable );
virtual void SetState( int iNewState ); virtual void SetState( int iNewState );
int GetNumStates() { return m_iNumStates; }; virtual int GetNumStates() { return m_iNumStates; };
CString GetTexturePath() { return m_pTexture==NULL ? "" : m_pTexture->GetID().filename; }; CString GetTexturePath() { return m_pTexture==NULL ? "" : m_pTexture->GetID().filename; };
void SetCustomTextureRect( const RectF &new_texcoord_frect ); void SetCustomTextureRect( const RectF &new_texcoord_frect );
+2 -2
View File
@@ -60,7 +60,7 @@ IntDir=.\../Release6
TargetDir=\stepmania\stepmania TargetDir=\stepmania\stepmania
TargetName=StepMania TargetName=StepMania
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool # End Special Build Tool
@@ -95,7 +95,7 @@ IntDir=.\../Debug6
TargetDir=\stepmania\stepmania TargetDir=\stepmania\stepmania
TargetName=StepMania-debug TargetName=StepMania-debug
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool # End Special Build Tool