merge dupe code into GrayArrow::Load

This commit is contained in:
Glenn Maynard
2003-09-12 06:37:10 +00:00
parent b0adf33f18
commit f79f9ad322
6 changed files with 27 additions and 29 deletions
+19
View File
@@ -16,6 +16,8 @@
#include "GameState.h" #include "GameState.h"
#include <math.h> #include <math.h>
#include "ThemeManager.h" #include "ThemeManager.h"
#include "NoteFieldPositioning.h"
#include "NoteSkinManager.h"
#include "RageLog.h" #include "RageLog.h"
@@ -31,6 +33,23 @@ GrayArrow::GrayArrow()
StopAnimating(); StopAnimating();
} }
bool GrayArrow::Load( PlayerNumber pn, int iColNo )
{
CString Button = g_NoteFieldMode[pn].GrayButtonNames[iColNo];
if( Button == "" )
Button = NoteSkinManager::ColToButtonName( iColNo );
CString sPath = NOTESKIN->GetPathTo( pn, Button, "receptor" );
bool ret = Sprite::Load( sPath );
// XXX
if( GetNumStates() != 2 &&
GetNumStates() != 3 )
RageException::Throw( "'%s' must have 2 or 3 frames", sPath.c_str() );
return ret;
}
void GrayArrow::Update( float fDeltaTime ) void GrayArrow::Update( float fDeltaTime )
{ {
ASSERT( Sprite::GetNumStates() > 0 ); // you forgot to call Load() ASSERT( Sprite::GetNumStates() > 0 ); // you forgot to call Load()
+4 -2
View File
@@ -1,5 +1,5 @@
#ifndef _GrayArrow_H_ #ifndef GRAY_ARROW_H
#define _GrayArrow_H_ #define GRAY_ARROW_H
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: GrayArrow Class: GrayArrow
@@ -14,11 +14,13 @@
#include "Sprite.h" #include "Sprite.h"
#include "PlayerNumber.h"
class GrayArrow : public Sprite class GrayArrow : public Sprite
{ {
public: public:
GrayArrow(); GrayArrow();
bool Load( PlayerNumber pn, int iColNo );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
void Step(); void Step();
+1 -14
View File
@@ -15,7 +15,6 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "ArrowEffects.h" #include "ArrowEffects.h"
#include "NoteSkinManager.h"
#include "GameState.h" #include "GameState.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "NoteFieldPositioning.h" #include "NoteFieldPositioning.h"
@@ -35,19 +34,7 @@ void GrayArrowRow::Load( PlayerNumber pn )
m_iNumCols = pStyleDef->m_iColsPerPlayer; m_iNumCols = pStyleDef->m_iColsPerPlayer;
for( int c=0; c<m_iNumCols; c++ ) for( int c=0; c<m_iNumCols; c++ )
{ m_GrayArrow[c].Load( m_PlayerNumber, c );
CString Button = g_NoteFieldMode[m_PlayerNumber].GrayButtonNames[c];
if(Button == "")
Button = NoteSkinManager::ColToButtonName(c);
CString sPath = NOTESKIN->GetPathTo(pn, Button, "receptor");
m_GrayArrow[c].Load( sPath );
// XXX
if( m_GrayArrow[c].GetNumStates() != 2 &&
m_GrayArrow[c].GetNumStates() != 3 )
RageException::Throw( "'%s' must have 2 or 3 frames", sPath.c_str() );
m_GrayArrow[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset );
}
} }
void GrayArrowRow::Update( float fDeltaTime ) void GrayArrowRow::Update( float fDeltaTime )
+1 -12
View File
@@ -36,18 +36,7 @@ void NoteFieldPlus::Load( NoteData* pNoteData, PlayerNumber pn, int iFirstPixelT
// GrayArrowRow // GrayArrowRow
// //
for( c=0; c<m_iNumCols; c++ ) for( c=0; c<m_iNumCols; c++ )
{ m_GrayArrow[c].Load( pn, c );
CString Button = g_NoteFieldMode[m_PlayerNumber].GrayButtonNames[c];
if(Button == "")
Button = NoteSkinManager::ColToButtonName(c);
CString sPath = NOTESKIN->GetPathTo(pn, Button, "receptor");
m_GrayArrow[c].Load( sPath );
// XXX
if( m_GrayArrow[c].GetNumStates() != 2 &&
m_GrayArrow[c].GetNumStates() != 3 )
RageException::Throw( "'%s' must have 2 or 3 frames", sPath.c_str() );
}
// //
+1 -1
View File
@@ -13,7 +13,7 @@
#include "NoteField.h" #include "NoteField.h"
#include "GrayArrowRow.h" #include "GrayArrow.h"
#include "GhostArrowRow.h" #include "GhostArrowRow.h"
+1
View File
@@ -17,6 +17,7 @@
#include "RageSound.h" #include "RageSound.h"
#include "BGAnimation.h" #include "BGAnimation.h"
#include "SnapDisplay.h" #include "SnapDisplay.h"
#include "GrayArrowRow.h"
const int NUM_ACTION_MENU_ITEMS = 23; const int NUM_ACTION_MENU_ITEMS = 23;