added flexable NoteType coloring to NoteDisplay, optimized note texture usage

This commit is contained in:
Chris Danford
2003-02-06 07:32:57 +00:00
parent c57f5e27a4
commit 4ff98e0442
25 changed files with 525 additions and 315 deletions
@@ -0,0 +1,2 @@
[NoteDisplay]
TapNoteAnimationIsVivid=0
+10 -7
View File
@@ -24,6 +24,8 @@ Actor::Actor()
m_iNumTweenStates = 0;
m_baseRotation = RageVector3( 0, 0, 0 );
m_baseScale = RageVector3( 1, 1, 1 );
m_size = RageVector2( 1, 1 );
m_start.Init();
@@ -124,16 +126,17 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
}
m_temp.scale.x *= m_baseScale.x;
m_temp.scale.y *= m_baseScale.y;
m_temp.scale.z *= m_baseScale.z;
m_temp.rotation.x += m_baseRotation.x;
m_temp.rotation.y += m_baseRotation.y;
m_temp.rotation.z += m_baseRotation.z;
DISPLAY->Translate( m_temp.pos.x, m_temp.pos.y, m_temp.pos.z );
DISPLAY->Scale( m_temp.scale.x, m_temp.scale.y, 1 );
DISPLAY->Scale( m_temp.scale.x, m_temp.scale.y, m_temp.scale.z );
// super slow, and most Actors don't have any rotation
// RageMatrixRotationYawPitchRoll( &matTemp, rotation.y, rotation.x, rotation.z ); // add in the rotation
// matNewWorld = matTemp * matNewWorld;
// replace with...
if( m_temp.rotation.x != 0 ) DISPLAY->RotateX( m_temp.rotation.x );
if( m_temp.rotation.y != 0 ) DISPLAY->RotateY( m_temp.rotation.y );
if( m_temp.rotation.z != 0 ) DISPLAY->RotateZ( m_temp.rotation.z );
+17 -9
View File
@@ -198,7 +198,7 @@ public:
// start and end position for tweening
RageVector3 pos;
RageVector3 rotation;
RageVector2 scale;
RageVector3 scale;
RageColor diffuse[4];
RageColor glow;
@@ -206,7 +206,7 @@ public:
{
pos = RageVector3( 0, 0, 0 );
rotation = RageVector3( 0, 0, 0 );
scale = RageVector2( 1, 1 );
scale = RageVector3( 1, 1, 1 );
for(int i=0; i<4; i++)
diffuse[i] = RageColor( 1, 1, 1, 1 );
glow = RageColor( 1, 1, 1, 0 );
@@ -230,6 +230,19 @@ protected:
float m_fTweenTime; // seconds between Start and End positions/zooms
};
// 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;
RageVector2 m_size;
TweenState m_current;
TweenState m_start;
@@ -242,13 +255,8 @@ protected:
// Temporary variables that are filled just before drawing
//
TweenState m_temp;
/* RageVector2 m_temp_size;
RageVector3 m_temp_pos;
RageVector3 m_temp_rotation;
RageVector2 m_temp_scale;
RageColor m_temp_colorDiffuse[4];
RageColor m_temp_colorGlow;
*/
bool m_bFirstUpdate;
+1
View File
@@ -17,6 +17,7 @@
#include "RageLog.h"
#include "GameDef.h"
#include "StyleDef.h"
#include "RageUtil.h"
enum Code {
CODE_EASIER1,
+2 -123
View File
@@ -18,6 +18,7 @@
#include "IniFile.h"
#include "RageLog.h"
#include "RageUtil.h"
#include "NoteSkinManager.h"
#include "SDL_keysym.h" // for SDLKeys
@@ -1492,12 +1493,10 @@ const int NUM_MODE_CHOICES = sizeof(g_ModeChoices) / sizeof(g_ModeChoices[0]);
GameManager::GameManager()
{
m_pIniFile = new IniFile;
}
GameManager::~GameManager()
{
delete m_pIniFile;
}
GameDef* GameManager::GetGameDefForGame( Game g )
@@ -1565,138 +1564,18 @@ void GameManager::GetNotesTypesForGame( Game game, vector<NotesType>& aNotesType
}
}
bool GameManager::DoesNoteSkinExist( CString sSkinName ) const
{
CStringArray asSkinNames;
GetNoteSkinNames( asSkinNames );
for( unsigned i=0; i<asSkinNames.size(); i++ )
if( 0==stricmp(sSkinName, asSkinNames[i]) )
return true;
return false;
}
void GameManager::SwitchNoteSkin( CString sNewNoteSkin )
{
if( sNewNoteSkin == "" || !DoesNoteSkinExist(sNewNoteSkin) )
{
CStringArray as;
GetNoteSkinNames( as );
ASSERT( !as.empty() );
SwitchNoteSkin( as[0] );
}
else
{
m_sCurNoteSkin = sNewNoteSkin;
m_pIniFile->Reset();
CString sPath = GetCurNoteSkinDir() + "metrics.ini";
m_pIniFile->SetPath(sPath);
if( !m_pIniFile->ReadFile() )
RageException::Throw( "Could not read NoteSkin metrics file '%s'", sPath.GetString() );
}
}
CString GameManager::GetCurNoteSkinDir()
{
const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
return NOTESKIN_DIR + ssprintf("%s\\%s\\", pGameDef->m_szName, m_sCurNoteSkin.GetString());
}
CString GameManager::GetMetric( CString sClassName, CString sValue ) // looks in GAMESTATE for the current Style
{
CString sReturn;
if( !m_pIniFile->GetValue( sClassName, sValue, sReturn ) )
RageException::Throw( "Could not read metric '%s - %s' from '%smetrics.ini'", sClassName.GetString(), sValue.GetString(), GetCurNoteSkinDir().GetString() );
return sReturn;
}
int GameManager::GetMetricI( CString sClassName, CString sValueName )
{
return atoi( GetMetric(sClassName,sValueName) );
}
float GameManager::GetMetricF( CString sClassName, CString sValueName )
{
return (float)atof( GetMetric(sClassName,sValueName) );
}
bool GameManager::GetMetricB( CString sClassName, CString sValueName )
{
return atoi( GetMetric(sClassName,sValueName) ) != 0;
}
RageColor GameManager::GetMetricC( CString sClassName, CString sValueName )
{
float r=1,b=1,g=1,a=1; // initialize in case sscanf fails
CString sValue = GetMetric(sClassName,sValueName);
char szValue[40];
strncpy( szValue, sValue, 39 );
int result = sscanf( szValue, "%f,%f,%f,%f", &r, &g, &b, &a );
if( result != 4 )
{
LOG->Warn( "The color value '%s' for theme metric '%s : %s' is invalid.", szValue, sClassName.GetString(), sValueName.GetString() );
ASSERT(0);
}
return RageColor(r,g,b,a);
}
CString GameManager::GetPathTo( const int col, CString sElementName ) // looks in GAMESTATE for the current Style
{
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
StyleInput SI( PLAYER_1, col );
GameInput GI = pStyleDef->StyleInputToGameInput( SI );
CString sButtonName = pGameDef->m_szButtonNames[GI.button];
const CString sDir = GetCurNoteSkinDir();
CStringArray arrayPossibleFileNames; // fill this with the possible files
GetDirListing( ssprintf("%s%s %s*.sprite", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.png", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.jpg", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.bmp", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.gif", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
if( arrayPossibleFileNames.empty() )
RageException::Throw( "The NoteSkin element '%s %s' is missing from '%s'.", sButtonName.GetString(), sElementName.GetString(), sDir.GetString() );
return DerefRedir(arrayPossibleFileNames[0]);
}
void GameManager::GetEnabledGames( vector<Game>& aGamesOut )
{
for( int g=0; g<NUM_GAMES; g++ )
{
Game game = (Game)g;
CStringArray asNoteSkins;
GetNoteSkinNames( game, asNoteSkins );
NOTESKIN->GetNoteSkinNames( game, asNoteSkins );
if( !asNoteSkins.empty() )
aGamesOut.push_back( game );
}
}
void GameManager::GetNoteSkinNames( Game game, CStringArray &AddTo ) const
{
GameDef* pGameDef = GAMEMAN->GetGameDefForGame( game );
CString sBaseSkinFolder = NOTESKIN_DIR + pGameDef->m_szName + "\\";
GetDirListing( sBaseSkinFolder + "*", AddTo, true );
// strip out "CVS"
for( int i=AddTo.size()-1; i>=0; i-- )
if( 0 == stricmp("cvs", AddTo[i]) )
AddTo.erase( AddTo.begin()+i, AddTo.begin()+i+1 );
}
void GameManager::GetNoteSkinNames( CStringArray &AddTo ) const
{
GetNoteSkinNames( GAMESTATE->m_CurGame, AddTo );
}
int GameManager::NotesTypeToNumTracks( NotesType nt )
{
if(nt >= NUM_NOTES_TYPES)
-23
View File
@@ -33,26 +33,6 @@ public:
void GetNotesTypesForGame( Game game, vector<NotesType>& aNotesTypeAddTo );
Style GetEditorStyleForNotesType( NotesType nt );
// void GetGameNames( CStringArray &AddTo );
// bool DoesGameExist( CString sGameName );
CString GetCurNoteSkinDir();
void GetNoteSkinNames( Game game, CStringArray &AddTo ) const;
void GetNoteSkinNames( CStringArray &AddTo ) const; // looks up current Game in GAMESTATE
bool DoesNoteSkinExist( CString sSkinName ) const; // looks up current Game in GAMESTATE
void SwitchNoteSkin( CString sNewNoteSkin ); // looks up current Game in GAMESTATE
CString GetCurNoteSkin() const { return m_sCurNoteSkin; };
CString GetPathTo( const int col, CString sElementName );
CString GetMetric( CString sClassName, CString sValueName );
int GetMetricI( CString sClassName, CString sValueName );
float GetMetricF( CString sClassName, CString sValueName );
bool GetMetricB( CString sClassName, CString sValueName );
RageColor GetMetricC( CString sClassName, CString sValueName );
void GetEnabledGames( vector<Game>& aGamesOut );
static int NotesTypeToNumTracks( NotesType nt );
@@ -61,9 +41,6 @@ public:
static Game StringToGameType( CString sGameType );
protected:
CString m_sCurNoteSkin;
IniFile* m_pIniFile;
};
extern GameManager* GAMEMAN; // global and accessable from anywhere in our program
+1
View File
@@ -19,6 +19,7 @@
#include "Song.h"
#include "RageLog.h"
#include "ThemeManager.h"
#include "RageUtil.h"
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
+4 -4
View File
@@ -15,7 +15,7 @@
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ArrowEffects.h"
#include "GameManager.h"
#include "NoteSkinManager.h"
#include "GameState.h"
#include "PrefsManager.h"
@@ -36,9 +36,9 @@ void GhostArrowRow::Load( PlayerNumber pn )
// init arrows
for( int c=0; c<m_iNumCols; c++ )
{
m_GhostArrowRow[c].Load( GAMEMAN->GetPathTo(c, "tap explosion dim") );
m_GhostArrowRowBright[c].Load( GAMEMAN->GetPathTo(c, "tap explosion bright") );
m_HoldGhostArrowRow[c].Load( GAMEMAN->GetPathTo(c, "hold explosion") );
m_GhostArrowRow[c].Load( NOTESKIN->GetPathTo(c, "tap explosion dim") );
m_GhostArrowRowBright[c].Load( NOTESKIN->GetPathTo(c, "tap explosion bright") );
m_HoldGhostArrowRow[c].Load( NOTESKIN->GetPathTo(c, "hold explosion") );
m_GhostArrowRow[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset );
m_GhostArrowRowBright[c].SetX( pStyleDef->m_ColumnInfo[pn][c].fXOffset );
+2 -2
View File
@@ -15,7 +15,7 @@
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
#include "ArrowEffects.h"
#include "GameManager.h"
#include "NoteSkinManager.h"
#include "GameState.h"
#include "PrefsManager.h"
@@ -35,7 +35,7 @@ void GrayArrowRow::Load( PlayerNumber pn )
for( int c=0; c<m_iNumCols; c++ )
{
CString sPath = GAMEMAN->GetPathTo(c, "receptor");
CString sPath = NOTESKIN->GetPathTo(c, "receptor");
m_GrayArrow[c].Load( sPath );
// XXX
if( m_GrayArrow[c].GetNumStates() != 2 &&
+169 -89
View File
@@ -17,7 +17,7 @@
#include "Notes.h"
#include "PrefsManager.h"
#include "GameState.h"
#include "GameManager.h"
#include "NoteSkinManager.h"
#include "RageException.h"
#include "ArrowEffects.h"
#include "RageLog.h"
@@ -26,24 +26,24 @@
#include "NoteTypes.h"
#define DRAW_HOLD_HEAD_FOR_TAPS_ON_SAME_ROW GAMEMAN->GetMetricB("NoteDisplay","DrawHoldHeadForTapsOnSameRow")
#define TAP_NOTE_ANIMATION_LENGTH_IN_BEATS GAMEMAN->GetMetricF("NoteDisplay","TapNoteAnimationLengthInBeats")
#define HOLD_HEAD_ANIMATION_LENGTH_IN_BEATS GAMEMAN->GetMetricF("NoteDisplay","HoldHeadAnimationLengthInBeats")
#define HOLD_BODY_ANIMATION_LENGTH_IN_BEATS GAMEMAN->GetMetricF("NoteDisplay","HoldBodyAnimationLengthInBeats")
#define HOLD_TAIL_ANIMATION_LENGTH_IN_BEATS GAMEMAN->GetMetricF("NoteDisplay","HoldTailAnimationLengthInBeats")
#define TAP_NOTE_ANIMATION_IS_VIVID GAMEMAN->GetMetricB("NoteDisplay","TapNoteAnimationIsVivid")
#define HOLD_HEAD_ANIMATION_IS_VIVID GAMEMAN->GetMetricB("NoteDisplay","HoldHeadAnimationIsVivid")
#define HOLD_BODY_ANIMATION_IS_VIVID GAMEMAN->GetMetricB("NoteDisplay","HoldBodyAnimationIsVivid")
#define HOLD_TAIL_ANIMATION_IS_VIVID GAMEMAN->GetMetricB("NoteDisplay","HoldTailAnimationIsVivid")
#define TAP_NOTE_ANIMATION_IS_NOTE_COLOR GAMEMAN->GetMetricB("NoteDisplay","TapNoteAnimationIsNoteColor")
#define HOLD_HEAD_ANIMATION_IS_NOTE_COLOR GAMEMAN->GetMetricB("NoteDisplay","HoldHeadAnimationIsNoteColor")
#define HOLD_BODY_ANIMATION_IS_NOTE_COLOR GAMEMAN->GetMetricB("NoteDisplay","HoldBodyAnimationIsNoteColor")
#define HOLD_TAIL_ANIMATION_IS_NOTE_COLOR GAMEMAN->GetMetricB("NoteDisplay","HoldTailAnimationIsNoteColor")
#define START_DRAWING_HOLD_BODY_OFFSET_FROM_HEAD GAMEMAN->GetMetricI("NoteDisplay","StartDrawingHoldBodyOffsetFromHead")
#define STOP_DRAWING_HOLD_BODY_OFFSET_FROM_TAIL GAMEMAN->GetMetricI("NoteDisplay","StopDrawingHoldBodyOffsetFromTail")
#define HOLD_HEAD_IS_WAVY GAMEMAN->GetMetricB("NoteDisplay","HoldHeadIsWavy")
#define HOLD_TAIL_IS_WAVY GAMEMAN->GetMetricB("NoteDisplay","HoldTailIsWavy")
#define HOLD_NG_GRAY_PERCENT GAMEMAN->GetMetricF("NoteDisplay","HoldNGGrayPercent")
#define DRAW_HOLD_HEAD_FOR_TAPS_ON_SAME_ROW NOTESKIN->GetMetricB("NoteDisplay","DrawHoldHeadForTapsOnSameRow")
#define TAP_NOTE_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF("NoteDisplay","TapNoteAnimationLengthInBeats")
#define HOLD_HEAD_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF("NoteDisplay","HoldHeadAnimationLengthInBeats")
#define HOLD_BODY_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF("NoteDisplay","HoldBodyAnimationLengthInBeats")
#define HOLD_TAIL_ANIMATION_LENGTH_IN_BEATS NOTESKIN->GetMetricF("NoteDisplay","HoldTailAnimationLengthInBeats")
#define TAP_NOTE_ANIMATION_IS_VIVID NOTESKIN->GetMetricB("NoteDisplay","TapNoteAnimationIsVivid")
#define HOLD_HEAD_ANIMATION_IS_VIVID NOTESKIN->GetMetricB("NoteDisplay","HoldHeadAnimationIsVivid")
#define HOLD_BODY_ANIMATION_IS_VIVID NOTESKIN->GetMetricB("NoteDisplay","HoldBodyAnimationIsVivid")
#define HOLD_TAIL_ANIMATION_IS_VIVID NOTESKIN->GetMetricB("NoteDisplay","HoldTailAnimationIsVivid")
#define TAP_NOTE_ANIMATION_IS_NOTE_COLOR NOTESKIN->GetMetricB("NoteDisplay","TapNoteAnimationIsNoteColor")
#define HOLD_HEAD_ANIMATION_IS_NOTE_COLOR NOTESKIN->GetMetricB("NoteDisplay","HoldHeadAnimationIsNoteColor")
#define HOLD_BODY_ANIMATION_IS_NOTE_COLOR NOTESKIN->GetMetricB("NoteDisplay","HoldBodyAnimationIsNoteColor")
#define HOLD_TAIL_ANIMATION_IS_NOTE_COLOR NOTESKIN->GetMetricB("NoteDisplay","HoldTailAnimationIsNoteColor")
#define START_DRAWING_HOLD_BODY_OFFSET_FROM_HEAD NOTESKIN->GetMetricI("NoteDisplay","StartDrawingHoldBodyOffsetFromHead")
#define STOP_DRAWING_HOLD_BODY_OFFSET_FROM_TAIL NOTESKIN->GetMetricI("NoteDisplay","StopDrawingHoldBodyOffsetFromTail")
#define HOLD_HEAD_IS_WAVY NOTESKIN->GetMetricB("NoteDisplay","HoldHeadIsWavy")
#define HOLD_TAIL_IS_WAVY NOTESKIN->GetMetricB("NoteDisplay","HoldTailIsWavy")
#define HOLD_NG_GRAY_PERCENT NOTESKIN->GetMetricF("NoteDisplay","HoldNGGrayPercent")
// cache
bool g_bDrawHoldHeadForTapsOnSameRow;
@@ -92,93 +92,161 @@ void NoteDisplay::Load( int iColNum, PlayerNumber pn )
{
m_PlayerNumber = pn;
m_sprTapNote.Load( GAMEMAN->GetPathTo(iColNum, "tap note") );
m_sprHoldHeadActive.Load( GAMEMAN->GetPathTo(iColNum, "hold head active") );
m_sprHoldHeadInactive.Load( GAMEMAN->GetPathTo(iColNum, "hold head inactive") );
m_sprHoldBodyActive.Load( GAMEMAN->GetPathTo(iColNum, "hold body active") );
m_sprHoldBodyInactive.Load( GAMEMAN->GetPathTo(iColNum, "hold body inactive") );
m_sprHoldTailActive.Load( GAMEMAN->GetPathTo(iColNum, "hold tail active") );
m_sprHoldTailInactive.Load( GAMEMAN->GetPathTo(iColNum, "hold tail inactive") );
// Look up note names once and store them here.
CString sNoteType[ NOTE_COLOR_IMAGES ];
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
sNoteType[i] = NoteTypeToString( (NoteType)i );
if( g_bTapNoteAnimationIsNoteColor )
{
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
m_sprTapNote[i].Load( NOTESKIN->GetPathTo(iColNum, "tap note "+sNoteType[i]) );
}
else
{
m_sprTapNote[0].Load( NOTESKIN->GetPathTo(iColNum, "tap note") );
}
if( g_bHoldHeadAnimationIsNoteColor )
{
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
{
m_sprHoldHeadActive[i].Load( NOTESKIN->GetPathTo(iColNum, "hold head active "+sNoteType[i]) );
m_sprHoldHeadInactive[i].Load( NOTESKIN->GetPathTo(iColNum, "hold head inactive "+sNoteType[i]) );
}
}
else
{
m_sprHoldHeadActive[0].Load( NOTESKIN->GetPathTo(iColNum, "hold head active") );
m_sprHoldHeadInactive[0].Load( NOTESKIN->GetPathTo(iColNum, "hold head inactive") );
}
if( g_bHoldBodyAnimationIsNoteColor )
{
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
{
m_sprHoldBodyActive[i].Load( NOTESKIN->GetPathTo(iColNum, "hold body active "+sNoteType[i]) );
m_sprHoldBodyInactive[i].Load( NOTESKIN->GetPathTo(iColNum, "hold body inactive "+sNoteType[i]) );
}
}
else
{
m_sprHoldBodyActive[0].Load( NOTESKIN->GetPathTo(iColNum, "hold body active") );
m_sprHoldBodyInactive[0].Load( NOTESKIN->GetPathTo(iColNum, "hold body inactive") );
}
if( g_bHoldTailAnimationIsNoteColor )
{
for( int i=0; i<NOTE_COLOR_IMAGES; i++ )
{
m_sprHoldTailActive[i].Load( NOTESKIN->GetPathTo(iColNum, "hold tail active "+sNoteType[i]) );
m_sprHoldTailInactive[i].Load( NOTESKIN->GetPathTo(iColNum, "hold tail inactive "+sNoteType[i]) );
}
}
else
{
m_sprHoldTailActive[0].Load( NOTESKIN->GetPathTo(iColNum, "hold tail active") );
m_sprHoldTailInactive[0].Load( NOTESKIN->GetPathTo(iColNum, "hold tail inactive") );
}
}
int NoteDisplay::GetFrameNo( float fNoteBeat, int iNumFrames, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor )
{
float fSongBeat = GAMESTATE->m_fSongBeat;
float fPercentIntoMeasure = fmodfp( fSongBeat, fAnimationLengthInBeats ) / fAnimationLengthInBeats;
float fBeatFraction = fmodf( fNoteBeat, 1.0f );
fBeatFraction = froundf( fBeatFraction, 0.25f ); // round to nearest 1/4th
int iBeatFractionContrib = (int)roundf( fBeatFraction * iNumFrames );
int iSongBeatFrameContrib = (int)roundf( fPercentIntoMeasure * iNumFrames );
float fPrecentIntoAnimation = fmodf(fSongBeat,fAnimationLengthInBeats) / fAnimationLengthInBeats;
float fNoteBeatFraction = fmodf( fNoteBeat, 1.0f );
int iFrameNo;
if( bVivid )
{
iFrameNo = (iSongBeatFrameContrib + iBeatFractionContrib) % iNumFrames;
}
else if( bNoteColor )
{
NoteType type = BeatToNoteType( fNoteBeat );
int iBaseFrameNo;
switch( type )
{
case NOTE_TYPE_4TH: iBaseFrameNo = iNumFrames*0/6; break;
case NOTE_TYPE_8TH: iBaseFrameNo = iNumFrames*1/6; break;
case NOTE_TYPE_12TH: iBaseFrameNo = iNumFrames*2/6; break;
case NOTE_TYPE_16TH: iBaseFrameNo = iNumFrames*3/6; break;
case NOTE_TYPE_24TH: iBaseFrameNo = iNumFrames*4/6; break;
case NOTE_TYPE_32ND: iBaseFrameNo = iNumFrames*5/6; break;
default: ASSERT(0); iBaseFrameNo=0; // get rid of warning
}
iFrameNo = (int)(fPrecentIntoAnimation*iNumFrames + fNoteBeatFraction*iNumFrames);
else
iFrameNo = (int)(fPrecentIntoAnimation*iNumFrames);
iFrameNo = iBaseFrameNo + iBeatFractionContrib;
}
else // flat
{
iFrameNo = (iSongBeatFrameContrib) % iNumFrames;
}
iFrameNo += iNumFrames;
iFrameNo %= iNumFrames;
ASSERT( iFrameNo>=0 && iFrameNo<iNumFrames );
return iFrameNo;
}
int NoteDisplay::GetTapNoteFrameNo( float fNoteBeat )
void NoteDisplay::GetTapNoteSpriteAndFrameNo( float fNoteBeat, Sprite*& pSpriteOut, int& iFrameNoOut )
{
return GetFrameNo(
if( g_bTapNoteAnimationIsNoteColor )
{
NoteType nt = BeatToNoteType( fNoteBeat );
if( nt == NOTE_TYPE_INVALID )
nt = NOTE_TYPE_32ND;
pSpriteOut = &m_sprTapNote[nt];
}
else
pSpriteOut = &m_sprTapNote[0];
iFrameNoOut = GetFrameNo(
fNoteBeat,
m_sprTapNote.GetNumStates(),
pSpriteOut->GetNumStates(),
g_fTapNoteAnimationLengthInBeats,
g_bTapNoteAnimationIsVivid,
g_bTapNoteAnimationIsNoteColor );
}
int NoteDisplay::GetHoldHeadFrameNo( float fNoteBeat, bool bActive )
void NoteDisplay::GetHoldHeadSpriteAndFrameNo( float fNoteBeat, bool bActive, Sprite*& pSpriteOut, int& iFrameNoOut )
{
return GetFrameNo(
if( g_bHoldHeadAnimationIsNoteColor )
{
NoteType nt = BeatToNoteType( fNoteBeat );
if( nt == NOTE_TYPE_INVALID )
nt = NOTE_TYPE_32ND;
pSpriteOut = bActive ? &m_sprHoldHeadActive[nt] : &m_sprHoldHeadInactive[nt];
}
else
pSpriteOut = bActive ? &m_sprHoldHeadActive[0] : &m_sprHoldHeadInactive[0];
iFrameNoOut = GetFrameNo(
fNoteBeat,
(bActive?m_sprHoldHeadActive:m_sprHoldHeadInactive).GetNumStates(),
pSpriteOut->GetNumStates(),
g_fHoldHeadAnimationLengthInBeats,
g_bHoldHeadAnimationIsVivid,
g_bHoldHeadAnimationIsNoteColor );
}
int NoteDisplay::GetHoldBodyFrameNo( float fNoteBeat, bool bActive )
void NoteDisplay::GetHoldBodySpriteAndFrameNo( float fNoteBeat, bool bActive, Sprite*& pSpriteOut, int& iFrameNoOut )
{
return GetFrameNo(
if( g_bHoldBodyAnimationIsNoteColor )
{
NoteType nt = BeatToNoteType( fNoteBeat );
if( nt == NOTE_TYPE_INVALID )
nt = NOTE_TYPE_32ND;
pSpriteOut = bActive ? &m_sprHoldBodyActive[nt] : &m_sprHoldBodyInactive[nt];
}
else
pSpriteOut = bActive ? &m_sprHoldBodyActive[0] : &m_sprHoldBodyInactive[0];
iFrameNoOut = GetFrameNo(
fNoteBeat,
(bActive?m_sprHoldBodyActive:m_sprHoldBodyInactive).GetNumStates(),
pSpriteOut->GetNumStates(),
g_fHoldBodyAnimationLengthInBeats,
g_bHoldBodyAnimationIsVivid,
g_bHoldBodyAnimationIsNoteColor );
}
int NoteDisplay::GetHoldTailFrameNo( float fNoteBeat, bool bActive )
void NoteDisplay::GetHoldTailSpriteAndFrameNo( float fNoteBeat, bool bActive, Sprite*& pSpriteOut, int& iFrameNoOut )
{
return GetFrameNo(
if( g_bHoldTailAnimationIsNoteColor )
{
NoteType nt = BeatToNoteType( fNoteBeat );
if( nt == NOTE_TYPE_INVALID )
nt = NOTE_TYPE_32ND;
pSpriteOut = bActive ? &m_sprHoldTailActive[nt] : &m_sprHoldTailInactive[nt];
}
else
pSpriteOut = bActive ? &m_sprHoldTailActive[0] : &m_sprHoldTailInactive[0];
iFrameNoOut = GetFrameNo(
fNoteBeat,
(bActive?m_sprHoldTailActive:m_sprHoldTailInactive).GetNumStates(),
pSpriteOut->GetNumStates(),
g_fHoldTailAnimationLengthInBeats,
g_bHoldTailAnimationIsVivid,
g_bHoldTailAnimationIsNoteColor );
@@ -215,8 +283,9 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
// Draw the tail
//
{
Sprite* pSprTail = bActive ? &m_sprHoldTailActive : &m_sprHoldTailInactive;
int iFrameNo = GetHoldTailFrameNo( hn.m_fStartBeat, bActive );
Sprite* pSprTail;
int iFrameNo;
GetHoldTailSpriteAndFrameNo( hn.m_fStartBeat, bActive, pSprTail, iFrameNo );
if( g_bHoldTailIsWavy )
{
@@ -307,9 +376,10 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
// Draw the body (always wavy)
//
{
Sprite* pSprBody = bActive ? &m_sprHoldBodyActive : &m_sprHoldBodyInactive;
int iFrameNo = GetHoldBodyFrameNo( hn.m_fStartBeat, bActive );
Sprite* pSprBody;
int iFrameNo;
GetHoldBodySpriteAndFrameNo( hn.m_fStartBeat, bActive, pSprBody, iFrameNo );
// draw manually in small segments
RageVertex *v = &queue[0];
RageTexture* pTexture = pSprBody->GetTexture();
@@ -387,8 +457,9 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
// Draw the head
//
{
Sprite* pSprHead = bActive ? &m_sprHoldHeadActive : &m_sprHoldHeadInactive;
int iFrameNo = GetHoldHeadFrameNo( hn.m_fStartBeat, bActive );
Sprite* pSprHead;
int iFrameNo;
GetHoldHeadSpriteAndFrameNo( hn.m_fStartBeat, bActive, pSprHead, iFrameNo );
if( g_bHoldHeadIsWavy )
{
@@ -492,6 +563,7 @@ void NoteDisplay::DrawTap( const int iCol, const float fBeat, const bool bOnSame
RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
RageColor glow = RageColor(1,1,1,fGlow);
/*
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_ColorType == PlayerOptions::COLOR_NOTE )
{
RageColor noteColor = GetNoteColorFromBeat(fBeat);
@@ -501,27 +573,35 @@ void NoteDisplay::DrawTap( const int iCol, const float fBeat, const bool bOnSame
glow = RageColor(1,1,1,1)*fGlow + noteColor*(1-fGlow)*0.7f*fAlpha;
}
*/
if( bOnSameRowAsHoldStart && g_bDrawHoldHeadForTapsOnSameRow )
{
// draw hold head
const int iHoldHeadFrameNo = GetHoldHeadFrameNo( fBeat, false );
m_sprHoldHeadInactive.SetXY( fXPos, fYPos );
m_sprHoldHeadInactive.SetDiffuse( diffuse );
m_sprHoldHeadInactive.SetGlow( glow );
m_sprHoldHeadInactive.StopUsingCustomCoords();
m_sprHoldHeadInactive.SetState( iHoldHeadFrameNo );
m_sprHoldHeadInactive.Draw();
Sprite* pSprHead;
int iFrameNo;
GetHoldHeadSpriteAndFrameNo( fBeat, false, pSprHead, iFrameNo );
pSprHead->SetXY( fXPos, fYPos );
pSprHead->SetDiffuse( diffuse );
pSprHead->SetGlow( glow );
pSprHead->StopUsingCustomCoords();
pSprHead->SetState( iFrameNo );
pSprHead->Draw();
}
else
{
const int iTapFrameNo = GetTapNoteFrameNo( fBeat );
m_sprTapNote.SetXY( fXPos, fYPos );
m_sprTapNote.SetRotation( fRotation );
m_sprTapNote.SetGlow( glow );
m_sprTapNote.SetDiffuse( diffuse );
m_sprTapNote.SetState( iTapFrameNo );
m_sprTapNote.Draw();
// draw tap
Sprite* pSprTap;
int iFrameNo;
GetTapNoteSpriteAndFrameNo( fBeat, pSprTap, iFrameNo );
pSprTap->SetXY( fXPos, fYPos );
pSprTap->SetRotation( fRotation );
pSprTap->SetGlow( glow );
pSprTap->SetDiffuse( diffuse );
pSprTap->SetState( iFrameNo );
pSprTap->Draw();
}
}
+13 -11
View File
@@ -29,20 +29,22 @@ public:
protected:
int GetFrameNo( float fNoteBeat, int iNumFrames, float fAnimationLengthInBeats, bool bVivid, bool bNoteColor );
int GetTapNoteFrameNo( float fNoteBeat );
int GetHoldHeadFrameNo( float fNoteBeat, bool bActive );
int GetHoldBodyFrameNo( float fNoteBeat, bool bActive );
int GetHoldTailFrameNo( float fNoteBeat, bool bActive );
void GetTapNoteSpriteAndFrameNo( float fNoteBeat, Sprite*& pSpriteOut, int& iFrameNoOut );
void GetHoldHeadSpriteAndFrameNo( float fNoteBeat, bool bActive, Sprite*& pSpriteOut, int& iFrameNoOut );
void GetHoldBodySpriteAndFrameNo( float fNoteBeat, bool bActive, Sprite*& pSpriteOut, int& iFrameNoOut );
void GetHoldTailSpriteAndFrameNo( float fNoteBeat, bool bActive, Sprite*& pSpriteOut, int& iFrameNoOut );
PlayerNumber m_PlayerNumber; // to look up PlayerOptions
Sprite m_sprTapNote;
Sprite m_sprHoldHeadActive;
Sprite m_sprHoldHeadInactive;
Sprite m_sprHoldBodyActive;
Sprite m_sprHoldBodyInactive;
Sprite m_sprHoldTailActive;
Sprite m_sprHoldTailInactive;
#define NOTE_COLOR_IMAGES 6
Sprite m_sprTapNote[NOTE_COLOR_IMAGES];
Sprite m_sprHoldHeadActive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldHeadInactive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldBodyActive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldBodyInactive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldTailActive[NOTE_COLOR_IMAGES];
Sprite m_sprHoldTailInactive[NOTE_COLOR_IMAGES];
};
#endif
+181
View File
@@ -0,0 +1,181 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: NoteSkinManager
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "NoteSkinManager.h"
#include "RageLog.h"
#include "RageException.h"
#include "GameState.h"
#include "GameDef.h"
#include "IniFile.h"
#include "StyleInput.h"
#include "StyleDef.h"
#include "RageUtil.h"
#include "GameManager.h"
NoteSkinManager* NOTESKIN = NULL; // global object accessable from anywhere in the program
const CString BASE_NOTESKIN_NAME = "default";
const CString NOTESKINS_DIR = "NoteSkins/";
NoteSkinManager::NoteSkinManager()
{
m_pIniMetrics = new IniFile;
m_sCurNoteSkinName = BASE_NOTESKIN_NAME; // Use the base theme for now. It's up to PrefsManager to change this.
}
NoteSkinManager::~NoteSkinManager()
{
delete m_pIniMetrics;
}
void NoteSkinManager::GetNoteSkinNames( Game game, CStringArray &AddTo ) const
{
GameDef* pGameDef = GAMEMAN->GetGameDefForGame( game );
CString sBaseSkinFolder = NOTESKINS_DIR + pGameDef->m_szName + "\\";
GetDirListing( sBaseSkinFolder + "*", AddTo, true );
// strip out "CVS"
for( int i=AddTo.size()-1; i>=0; i-- )
if( 0 == stricmp("cvs", AddTo[i]) )
AddTo.erase( AddTo.begin()+i, AddTo.begin()+i+1 );
}
void NoteSkinManager::GetNoteSkinNames( CStringArray &AddTo ) const
{
GetNoteSkinNames( GAMESTATE->m_CurGame, AddTo );
}
bool NoteSkinManager::DoesNoteSkinExist( CString sSkinName ) const
{
CStringArray asSkinNames;
GetNoteSkinNames( asSkinNames );
for( unsigned i=0; i<asSkinNames.size(); i++ )
if( 0==stricmp(sSkinName, asSkinNames[i]) )
return true;
return false;
}
void NoteSkinManager::SwitchNoteSkin( CString sNewNoteSkin )
{
if( sNewNoteSkin == "" || !DoesNoteSkinExist(sNewNoteSkin) )
{
CStringArray as;
GetNoteSkinNames( as );
ASSERT( !as.empty() );
sNewNoteSkin = as[0];
}
m_sCurNoteSkinName = sNewNoteSkin;
m_pIniMetrics->Reset();
m_pIniMetrics->SetPath( GetNoteSkinDir(BASE_NOTESKIN_NAME)+"metrics.ini" );
m_pIniMetrics->ReadFile();
m_pIniMetrics->SetPath( GetNoteSkinDir(m_sCurNoteSkinName)+"metrics.ini" );
m_pIniMetrics->ReadFile();
}
CString NoteSkinManager::GetNoteSkinDir( CString sSkinName )
{
const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
return NOTESKINS_DIR + ssprintf("%s/%s/", pGameDef->m_szName, sSkinName.GetString());
}
CString NoteSkinManager::GetMetric( CString sClassName, CString sValue ) // looks in GAMESTATE for the current Style
{
CString sReturn;
if( !m_pIniMetrics->GetValue( sClassName, sValue, sReturn ) )
RageException::Throw( "Could not read metric '%s - %s'", sClassName.GetString(), sValue.GetString() );
return sReturn;
}
int NoteSkinManager::GetMetricI( CString sClassName, CString sValueName )
{
return atoi( GetMetric(sClassName,sValueName) );
}
float NoteSkinManager::GetMetricF( CString sClassName, CString sValueName )
{
return (float)atof( GetMetric(sClassName,sValueName) );
}
bool NoteSkinManager::GetMetricB( CString sClassName, CString sValueName )
{
return atoi( GetMetric(sClassName,sValueName) ) != 0;
}
RageColor NoteSkinManager::GetMetricC( CString sClassName, CString sValueName )
{
float r=1,b=1,g=1,a=1; // initialize in case sscanf fails
CString sValue = GetMetric(sClassName,sValueName);
char szValue[40];
strncpy( szValue, sValue, 39 );
int result = sscanf( szValue, "%f,%f,%f,%f", &r, &g, &b, &a );
if( result != 4 )
{
LOG->Warn( "The color value '%s' for theme metric '%s : %s' is invalid.", szValue, sClassName.GetString(), sValueName.GetString() );
ASSERT(0);
}
return RageColor(r,g,b,a);
}
CString NoteSkinManager::GetPathTo( int col, CString sFileName ) // looks in GAMESTATE for the current Style
{
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
const GameDef* pGameDef = GAMESTATE->GetCurrentGameDef();
StyleInput SI( PLAYER_1, col );
GameInput GI = pStyleDef->StyleInputToGameInput( SI );
CString sButtonName = pGameDef->m_szButtonNames[GI.button];
CString sCurNoteSkinName = m_sCurNoteSkinName;
if( GAMESTATE->m_bEditing )
sCurNoteSkinName = "note";
CString ret = GetPathTo( m_sCurNoteSkinName, sButtonName, sFileName );
if( !ret.empty() ) // we found something
return ret;
ret = GetPathTo( BASE_NOTESKIN_NAME, sButtonName, sFileName);
if( ret.empty() )
RageException::Throw( "The NoteSkin element '%s %s' could not be found in '%s' or '%s'.",
sButtonName.GetString(), sFileName.GetString(),
GetNoteSkinDir(m_sCurNoteSkinName).GetString(),
GetNoteSkinDir(BASE_NOTESKIN_NAME).GetString() );
return ret;
}
CString NoteSkinManager::GetPathTo( CString sSkinName, CString sButtonName, CString sElementName ) // looks in GAMESTATE for the current Style
{
const CString sDir = GetNoteSkinDir( sSkinName );
CStringArray arrayPossibleFileNames; // fill this with the possible files
GetDirListing( ssprintf("%s%s %s*.sprite", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.png", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.jpg", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.bmp", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*.gif", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
GetDirListing( ssprintf("%s%s %s*", sDir.GetString(), sButtonName.GetString(), sElementName.GetString()), arrayPossibleFileNames, false, true );
if( arrayPossibleFileNames.empty() )
return "";
else
return DerefRedir(arrayPossibleFileNames[0]);
}
+54
View File
@@ -0,0 +1,54 @@
#ifndef NoteSkinMANAGER_H
#define NoteSkinMANAGER_H
/*
-----------------------------------------------------------------------------
Class: NoteSkinManager
Desc: Manages which graphics and sounds are chosed to load. Every time
a sound or graphic is loaded, it gets the path from the NoteSkinManager.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "RageTypes.h"
#include "Game.h"
class IniFile;
class NoteSkinManager
{
public:
NoteSkinManager();
~NoteSkinManager();
void GetNoteSkinNames( Game game, CStringArray &AddTo ) const;
void GetNoteSkinNames( CStringArray &AddTo ) const; // looks up current Game in GAMESTATE
bool DoesNoteSkinExist( CString sSkinName ) const; // looks up current Game in GAMESTATE
void SwitchNoteSkin( CString sNewNoteSkin ); // looks up current Game in GAMESTATE
CString GetCurNoteSkinName() const { return m_sCurNoteSkinName; };
CString GetPathTo( int col, CString sFileName );
CString GetMetric( CString sClassName, CString sValueName );
int GetMetricI( CString sClassName, CString sValueName );
float GetMetricF( CString sClassName, CString sValueName );
bool GetMetricB( CString sClassName, CString sValueName );
RageColor GetMetricC( CString sClassName, CString sValueName );
protected:
CString GetPathTo( CString sSkinName, CString sButtonName, CString sFileName );
CString GetNoteSkinDir( CString sSkinName );
CString m_sCurNoteSkinName;
IniFile* m_pIniMetrics;
unsigned m_uHashForCurThemeMetrics;
unsigned m_uHashForBaseThemeMetrics;
};
extern NoteSkinManager* NOTESKIN; // global and accessable from anywhere in our program
#endif
+15 -1
View File
@@ -53,10 +53,24 @@ NoteType GetNoteType( int iNoteIndex )
else return NOTE_TYPE_INVALID;
};
CString NoteTypeToString( NoteType nt )
{
switch( nt )
{
case NOTE_TYPE_4TH: return "4th";
case NOTE_TYPE_8TH: return "8th";
case NOTE_TYPE_12TH: return "12th";
case NOTE_TYPE_16TH: return "16th";
case NOTE_TYPE_24TH: return "24th";
case NOTE_TYPE_32ND: return "32nd";
default: ASSERT(0); return "";
}
}
NoteType BeatToNoteType( float fBeat )
{
return GetNoteType( BeatToNoteRow(fBeat) );
};
}
bool IsNoteOfType( int iNoteIndex, NoteType t )
{
+1
View File
@@ -77,6 +77,7 @@ NoteType BeatToNoteType( float fBeat );
bool IsNoteOfType( int iNoteIndex, NoteType t );
RageColor GetNoteColorFromIndex( int iNoteIndex );
RageColor GetNoteColorFromBeat( float fBeat );
CString NoteTypeToString( NoteType nt );
+4 -3
View File
@@ -13,11 +13,12 @@
#include "PrefsManager.h"
#include "IniFile.h"
#include "GameManager.h"
#include "NoteSkinManager.h"
#include "GameState.h"
#include "RageException.h"
#include "RageDisplay.h"
#include "RageUtil.h"
#include "GameDef.h"
#include "AnnouncerManager.h"
#include "ThemeManager.h"
#include "arch/arch.h" /* for default driver specs */
@@ -260,7 +261,7 @@ void PrefsManager::ReadGamePrefsFromDisk()
// it's OK to call these functions with names that don't exist.
ANNOUNCER->SwitchAnnouncer( sAnnouncer );
THEME->SwitchTheme( sTheme );
GAMEMAN->SwitchNoteSkin( sNoteSkin );
NOTESKIN->SwitchNoteSkin( sNoteSkin );
}
void PrefsManager::SaveGamePrefsToDisk()
@@ -275,7 +276,7 @@ void PrefsManager::SaveGamePrefsToDisk()
ini.SetValue( sGameName, "Announcer", ANNOUNCER->GetCurAnnouncerName() );
ini.SetValue( sGameName, "Theme", THEME->GetCurThemeName() );
ini.SetValue( sGameName, "NoteSkin", GAMEMAN->GetCurNoteSkin() );
ini.SetValue( sGameName, "NoteSkin", NOTESKIN->GetCurNoteSkinName() );
ini.WriteFile();
}
+4 -4
View File
@@ -21,7 +21,7 @@
#include "PrefsManager.h"
#include "RageLog.h"
#include "AnnouncerManager.h"
#include "GameManager.h"
#include "NoteSkinManager.h"
#include "GameState.h"
#include "ThemeManager.h"
@@ -134,7 +134,7 @@ void ScreenAppearanceOptions::ImportOptions()
// fill in skin names
//
CStringArray arraySkinNames;
GAMEMAN->GetNoteSkinNames( arraySkinNames );
NOTESKIN->GetNoteSkinNames( arraySkinNames );
m_OptionRowData[AO_SKIN].iNumOptions = arraySkinNames.size();
@@ -145,7 +145,7 @@ void ScreenAppearanceOptions::ImportOptions()
m_iSelectedOption[0][AO_SKIN] = -1;
for( i=0; i<m_OptionRowData[AO_SKIN].iNumOptions; i++ )
{
if( 0==stricmp(m_OptionRowData[AO_SKIN].szOptionsText[i], GAMEMAN->GetCurNoteSkin()) )
if( 0==stricmp(m_OptionRowData[AO_SKIN].szOptionsText[i], NOTESKIN->GetCurNoteSkinName()) )
{
m_iSelectedOption[0][AO_SKIN] = i;
break;
@@ -177,7 +177,7 @@ void ScreenAppearanceOptions::ExportOptions()
int iSelectedSkin = m_iSelectedOption[0][AO_SKIN];
CString sNewSkin = m_OptionRowData[AO_SKIN].szOptionsText[iSelectedSkin];
GAMEMAN->SwitchNoteSkin( sNewSkin );
NOTESKIN->SwitchNoteSkin( sNewSkin );
PREFSMAN->m_bInstructions = !!m_iSelectedOption[0][AO_INSTRUCTIONS];
PREFSMAN->m_bShowDontDie = !!m_iSelectedOption[0][AO_CAUTION];
+1
View File
@@ -855,6 +855,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
OnSnapModeChange();
break;
case SDLK_RETURN:
case SDLK_KP_ENTER:
if( m_NoteFieldEdit.m_fEndMarker != -1 && GAMESTATE->m_fSongBeat > m_NoteFieldEdit.m_fEndMarker )
{
// invalid! The begin maker must be placed before the end marker
+5 -3
View File
@@ -145,6 +145,9 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
if( !MenuI.IsValid() )
return;
if( PREFSMAN->m_CoinMode==PrefsManager::COIN_HOME && m_Fade.IsClosing() )
return;
switch( MenuI.button )
{
case MENU_BUTTON_UP:
@@ -162,6 +165,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
case PrefsManager::COIN_PAY:
case PrefsManager::COIN_FREE:
return; // ignore
default:
ASSERT(0);
}
break;
case MENU_BUTTON_DOWN:
@@ -199,9 +204,6 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
// fall through
case PrefsManager::COIN_HOME:
case PrefsManager::COIN_FREE:
if( m_Fade.IsClosing() )
break;
GAMESTATE->m_bSideIsJoined[MenuI.player] = true;
GAMESTATE->m_MasterPlayerNumber = MenuI.player;
GAMESTATE->m_bPlayersCanJoin = false;
+14 -3
View File
@@ -51,6 +51,12 @@ Sprite::~Sprite()
// Delay0000=1.0
// Frame0001=3
// Delay0000=2.0
// BaseRotationXDegrees=0
// BaseRotationYDegrees=0
// BaseRotationZDegrees=0
// BaseZoomX=1
// BaseZoomY=1
// BaseZoomZ=1
bool Sprite::LoadFromSpriteFile( RageTextureID ID )
{
LOG->Trace( ssprintf("Sprite::LoadFromSpriteFile(%s)", ID.filename.GetString()) );
@@ -65,9 +71,6 @@ bool Sprite::LoadFromSpriteFile( RageTextureID ID )
splitrelpath( m_sSpritePath, sFontDir, sFontFileName, sFontExtension );
// read sprite file
IniFile ini;
ini.SetPath( m_sSpritePath );
@@ -117,6 +120,14 @@ bool Sprite::LoadFromSpriteFile( RageTextureID ID )
m_fDelay[0] = 10;
}
float f;
if( ini.GetValueF( "Sprite", "BaseRotationXDegrees", f ) ) Actor::SetBaseRotationX( f*PI/180.f );
if( ini.GetValueF( "Sprite", "BaseRotationYDegrees", f ) ) Actor::SetBaseRotationY( f*PI/180.f );
if( ini.GetValueF( "Sprite", "BaseRotationZDegrees", f ) ) Actor::SetBaseRotationZ( f*PI/180.f );
if( ini.GetValueF( "Sprite", "BaseZoomX", f ) ) Actor::SetBaseZoomX( f );
if( ini.GetValueF( "Sprite", "BaseZoomY", f ) ) Actor::SetBaseZoomY( f );
if( ini.GetValueF( "Sprite", "BaseZoomZ", f ) ) Actor::SetBaseZoomZ( f );
return true;
}
+7 -26
View File
@@ -36,6 +36,7 @@
// StepMania global classes
//
#include "ThemeManager.h"
#include "NoteSkinManager.h"
#include "PrefsManager.h"
#include "SongManager.h"
#include "PrefsManager.h"
@@ -121,11 +122,11 @@ void ResetGame()
INPUTMAPPER->ReadMappingsFromDisk();
GAMESTATE->m_bPlayersCanJoin = true;
if( !GAMEMAN->DoesNoteSkinExist( GAMEMAN->GetCurNoteSkin() ) )
if( !NOTESKIN->DoesNoteSkinExist( NOTESKIN->GetCurNoteSkinName() ) )
{
CStringArray asNoteSkinNames;
GAMEMAN->GetNoteSkinNames( asNoteSkinNames );
GAMEMAN->SwitchNoteSkin( asNoteSkinNames[0] );
NOTESKIN->GetNoteSkinNames( asNoteSkinNames );
NOTESKIN->SwitchNoteSkin( asNoteSkinNames[0] );
}
if( !THEME->DoesThemeExist( THEME->GetCurThemeName() ) )
{
@@ -272,6 +273,7 @@ int main(int argc, char* argv[])
PREFSMAN = new PrefsManager;
GAMEMAN = new GameManager;
THEME = new ThemeManager;
NOTESKIN = new NoteSkinManager;
SOUNDMAN = new RageSoundManager(PREFSMAN->m_sSoundDrivers);
SOUNDMAN->SetPrefs(PREFSMAN->m_fSoundVolume);
ANNOUNCER = new AnnouncerManager;
@@ -364,6 +366,7 @@ int main(int argc, char* argv[])
SAFE_DELETE( PREFSMAN );
SAFE_DELETE( GAMESTATE );
SAFE_DELETE( GAMEMAN );
SAFE_DELETE( NOTESKIN );
SAFE_DELETE( THEME );
SAFE_DELETE( ANNOUNCER );
SAFE_DELETE( INPUTMAN );
@@ -422,29 +425,7 @@ static void HandleInputEvents(float fDeltaTime)
continue;
}
}
/* Hitting F5, then waiting 5 seconds while my monitor is black
* is really making me angry.
* Do any users even know about this hotkey or think it's useful?
* Probably not... -Chris
/* else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5))
{
if(type != IET_FIRST_PRESS) continue;
// pressed F5. Toggle detail.
if(PREFSMAN->m_iDisplayWidth != 640)
{
PREFSMAN->m_iDisplayWidth = 640;
PREFSMAN->m_iDisplayHeight = 480;
}
else
{
PREFSMAN->m_iDisplayWidth = 320;
PREFSMAN->m_iDisplayHeight = 240;
}
ApplyGraphicOptions();
}
*/
else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5)) // F6 conflicts with editor and AutoSync
else if(DeviceI == DeviceInput(DEVICE_KEYBOARD, SDLK_F5)) // F5 conflicts with editor and AutoSync
{
if(type != IET_FIRST_PRESS) continue;
+6
View File
@@ -1451,6 +1451,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
<File
RelativePath="InputQueue.h">
</File>
<File
RelativePath="NoteSkinManager.cpp">
</File>
<File
RelativePath="NoteSkinManager.h">
</File>
<File
RelativePath=".\PrefsManager.cpp">
</File>
+1 -1
View File
@@ -55,7 +55,7 @@ void ThemeManager::GetAllThemeNames( CStringArray& AddTo )
// strip out the folder called "CVS"
for( CStringArray::iterator i=AddTo.begin(); i != AddTo.end(); ++i )
{
if( !i->CompareNoCase("cvs") ) {
if( *i == "CVS" ) {
AddTo.erase(i, i+1);
break;
}
-1
View File
@@ -12,7 +12,6 @@
-----------------------------------------------------------------------------
*/
#include "RageUtil.h"
#include "RageTypes.h"
class IniFile;
+11 -5
View File
@@ -19,7 +19,7 @@
!define PRODUCT_NAME_VER "${PRODUCT_NAME} ${VERSION}"
Name "${PRODUCT_NAME}"
OutFile "stepmania-CVS-20030202.exe"
OutFile "stepmania-CVS-20030205.exe"
;OutFile "stepmania301.exe"
; Some default compiler settings (uncomment and change at will):
@@ -130,12 +130,16 @@ SetOutPath "$INSTDIR\Music"
File "Music\instructions.txt"
RMDir /r "$INSTDIR\NoteSkins\dance\MAX"
CreateDirectory "$INSTDIR\NoteSkins\dance\MAX"
RMDir /r "$INSTDIR\NoteSkins\dance\default"
RMDir /r "$INSTDIR\NoteSkins\dance\flat"
RMDir /r "$INSTDIR\NoteSkins\dance\note"
SetOutPath "$INSTDIR\NoteSkins"
File "NoteSkins\instructions.txt"
CreateDirectory "$INSTDIR\NoteSkins\dance\default"
CreateDirectory "$INSTDIR\NoteSkins\dance\note"
SetOutPath "$INSTDIR\NoteSkins\dance"
File /r "NoteSkins\dance\MAX"
File /r "NoteSkins\dance\default"
File /r "NoteSkins\dance\note"
SetOutPath "$INSTDIR\NoteSkins\pump"
File /r "NoteSkins\pump\classic" ; what the heck, they're tiny
@@ -254,7 +258,9 @@ Delete "$INSTDIR\Music\instructions.txt"
RMDir "$INSTDIR\Music"
Delete "$INSTDIR\NoteSkins\instructions.txt"
RMDir /r "$INSTDIR\NoteSkins\dance\MAX"
RMDir /r "$INSTDIR\NoteSkins\dance\default"
RMDir /r "$INSTDIR\NoteSkins\dance\flat"
RMDir /r "$INSTDIR\NoteSkins\dance\note"
RMDir "$INSTDIR\NoteSkins\dance"
RMDir /r "$INSTDIR\NoteSkins\pump\classic"
RMDir /r "$INSTDIR\NoteSkins\pump\shiny"