vector<> for members

This commit is contained in:
Glenn Maynard
2004-07-27 04:31:01 +00:00
parent 0944da00ab
commit f1254b50de
2 changed files with 63 additions and 38 deletions
+57 -34
View File
@@ -14,9 +14,11 @@ GhostArrowRow::GhostArrowRow()
{ {
m_iNumCols = 0; m_iNumCols = 0;
} }
#include "RageLog.h"
void GhostArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset ) void GhostArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset )
{ {
Unload();
m_PlayerNumber = pn; m_PlayerNumber = pn;
m_fYReverseOffsetPixels = fYReverseOffset; m_fYReverseOffsetPixels = fYReverseOffset;
@@ -24,6 +26,7 @@ void GhostArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffs
m_iNumCols = pStyle->m_iColsPerPlayer; m_iNumCols = pStyle->m_iColsPerPlayer;
LOG->Trace("xxxsz: %i, %i", sizeof(GhostArrow), sizeof(HoldGhostArrow));
// init arrows // init arrows
for( int c=0; c<m_iNumCols; c++ ) for( int c=0; c<m_iNumCols; c++ )
{ {
@@ -32,49 +35,69 @@ void GhostArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffs
if(Button == "") if(Button == "")
Button = NoteSkinManager::ColToButtonName(c); Button = NoteSkinManager::ColToButtonName(c);
m_GhostDim[c].SetName( "GhostArrowDim" ); m_GhostDim.push_back( new GhostArrow );
m_GhostBright[c].SetName( "GhostArrowBright" ); m_GhostBright.push_back( new GhostArrow );
m_HoldGhost[c].SetName( "HoldGhostArrow" ); m_HoldGhost.push_back( new HoldGhostArrow );
m_GhostDim[c].Init( pn ); m_GhostDim[c]->SetName( "GhostArrowDim" );
m_GhostBright[c].Init( pn ); m_GhostBright[c]->SetName( "GhostArrowBright" );
//m_HoldGhost[c].Init( pn ); m_HoldGhost[c]->SetName( "HoldGhostArrow" );
m_GhostDim[c].Load( NoteSkin, Button, "tap explosion dim" ); m_GhostDim[c]->Init( pn );
m_GhostBright[c].Load( NoteSkin, Button, "tap explosion bright" ); m_GhostBright[c]->Init( pn );
m_HoldGhost[c].Load( NoteSkin, Button, "hold explosion" ); //m_HoldGhost[c]->Init( pn );
m_GhostDim[c]->Load( NoteSkin, Button, "tap explosion dim" );
m_GhostBright[c]->Load( NoteSkin, Button, "tap explosion bright" );
m_HoldGhost[c]->Load( NoteSkin, Button, "hold explosion" );
} }
} }
void GhostArrowRow::Unload()
{
for( int i = 0; i < m_iNumCols; ++i )
{
delete m_GhostDim[i];
delete m_GhostBright[i];
delete m_HoldGhost[i];
}
m_GhostDim.clear();
m_GhostBright.clear();
m_HoldGhost.clear();
m_iNumCols = 0;
}
void GhostArrowRow::Update( float fDeltaTime ) void GhostArrowRow::Update( float fDeltaTime )
{ {
for( int c=0; c<m_iNumCols; c++ ) for( int c=0; c<m_iNumCols; c++ )
{ {
m_GhostDim[c].Update( fDeltaTime ); m_GhostDim[c]->Update( fDeltaTime );
m_GhostBright[c].Update( fDeltaTime ); m_GhostBright[c]->Update( fDeltaTime );
m_HoldGhost[c].Update( fDeltaTime ); m_HoldGhost[c]->Update( fDeltaTime );
const float fX = ArrowGetXPos( m_PlayerNumber, c, 0 ); const float fX = ArrowGetXPos( m_PlayerNumber, c, 0 );
const float fY = ArrowGetYPos( m_PlayerNumber, c, 0, m_fYReverseOffsetPixels ); const float fY = ArrowGetYPos( m_PlayerNumber, c, 0, m_fYReverseOffsetPixels );
const float fZ = ArrowGetZPos( m_PlayerNumber, c, 0 ); const float fZ = ArrowGetZPos( m_PlayerNumber, c, 0 );
m_GhostDim[c].SetX( fX ); m_GhostDim[c]->SetX( fX );
m_GhostBright[c].SetX( fX ); m_GhostBright[c]->SetX( fX );
m_HoldGhost[c].SetX( fX ); m_HoldGhost[c]->SetX( fX );
m_GhostDim[c].SetY( fY ); m_GhostDim[c]->SetY( fY );
m_GhostBright[c].SetY( fY ); m_GhostBright[c]->SetY( fY );
m_HoldGhost[c].SetY( fY ); m_HoldGhost[c]->SetY( fY );
m_GhostDim[c].SetZ( fZ ); m_GhostDim[c]->SetZ( fZ );
m_GhostBright[c].SetZ( fZ ); m_GhostBright[c]->SetZ( fZ );
m_HoldGhost[c].SetZ( fZ ); m_HoldGhost[c]->SetZ( fZ );
const float fZoom = ArrowGetZoom( m_PlayerNumber ); const float fZoom = ArrowGetZoom( m_PlayerNumber );
m_GhostDim[c].SetZoom( fZoom ); m_GhostDim[c]->SetZoom( fZoom );
m_GhostBright[c].SetZoom( fZoom ); m_GhostBright[c]->SetZoom( fZoom );
m_HoldGhost[c].SetZoom( fZoom ); m_HoldGhost[c]->SetZoom( fZoom );
} }
} }
@@ -84,9 +107,9 @@ void GhostArrowRow::DrawPrimitives()
{ {
g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c); g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c);
m_GhostDim[c].Draw(); m_GhostDim[c]->Draw();
m_GhostBright[c].Draw(); m_GhostBright[c]->Draw();
m_HoldGhost[c].Draw(); m_HoldGhost[c]->Draw();
g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c); g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c);
} }
@@ -97,24 +120,24 @@ void GhostArrowRow::DidTapNote( int iCol, TapNoteScore score, bool bBright )
{ {
ASSERT( iCol >= 0 && iCol < m_iNumCols ); ASSERT( iCol >= 0 && iCol < m_iNumCols );
if( bBright ) if( bBright )
m_GhostBright[iCol].Step( score ); m_GhostBright[iCol]->Step( score );
else else
m_GhostDim[iCol].Step( score ); m_GhostDim[iCol]->Step( score );
} }
void GhostArrowRow::SetHoldIsActive( int iCol ) void GhostArrowRow::SetHoldIsActive( int iCol )
{ {
ASSERT( iCol >= 0 && iCol < m_iNumCols ); ASSERT( iCol >= 0 && iCol < m_iNumCols );
m_HoldGhost[iCol].SetHoldIsActive( true ); m_HoldGhost[iCol]->SetHoldIsActive( true );
} }
void GhostArrowRow::CopyTweening( const GhostArrowRow &from ) void GhostArrowRow::CopyTweening( const GhostArrowRow &from )
{ {
for( int c=0; c<m_iNumCols; c++ ) for( int c=0; c<m_iNumCols; c++ )
{ {
m_GhostDim[c].CopyTweening( from.m_GhostDim[c] ); m_GhostDim[c]->CopyTweening( *from.m_GhostDim[c] );
m_GhostBright[c].CopyTweening( from.m_GhostBright[c] ); m_GhostBright[c]->CopyTweening( *from.m_GhostBright[c] );
m_HoldGhost[c].CopyTweening( from.m_HoldGhost[c] ); m_HoldGhost[c]->CopyTweening( *from.m_HoldGhost[c] );
} }
ActorFrame::CopyTweening( from ); ActorFrame::CopyTweening( from );
} }
+5 -3
View File
@@ -15,11 +15,13 @@ class GhostArrowRow : public ActorFrame
{ {
public: public:
GhostArrowRow(); GhostArrowRow();
virtual ~GhostArrowRow() { Unload(); }
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void DrawPrimitives(); virtual void DrawPrimitives();
virtual void CopyTweening( const GhostArrowRow &from ); virtual void CopyTweening( const GhostArrowRow &from );
void Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset ); void Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset );
void Unload();
void DidTapNote( int iCol, TapNoteScore score, bool bBright ); void DidTapNote( int iCol, TapNoteScore score, bool bBright );
void SetHoldIsActive( int iCol ); void SetHoldIsActive( int iCol );
@@ -29,9 +31,9 @@ protected:
float m_fYReverseOffsetPixels; float m_fYReverseOffsetPixels;
PlayerNumber m_PlayerNumber; PlayerNumber m_PlayerNumber;
GhostArrow m_GhostDim[MAX_NOTE_TRACKS]; vector<GhostArrow *> m_GhostDim;
GhostArrow m_GhostBright[MAX_NOTE_TRACKS]; vector<GhostArrow *> m_GhostBright;
HoldGhostArrow m_HoldGhost[MAX_NOTE_TRACKS]; vector<HoldGhostArrow *> m_HoldGhost;
}; };