various cleanup and commenting

This commit is contained in:
AJ Kelly
2010-03-14 19:46:05 -05:00
parent cb52191666
commit dca9182138
17 changed files with 101 additions and 138 deletions
+5 -6
View File
@@ -358,17 +358,16 @@ public:
void StartAnimating() { this->EnableAnimation(true); }
void StopAnimating() { this->EnableAnimation(false); }
// render states
void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; }
void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; }
void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; }
void SetTextureFiltering( bool b ) { m_bTextureFiltering = b; }
void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; }
void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); }
void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); }
virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; }
virtual void SetZWrite( bool b ) { m_bZWrite = b; }
void SetZBias( float f ) { m_fZBias = f; }
virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; }
virtual void SetZWrite( bool b ) { m_bZWrite = b; }
void SetZBias( float f ) { m_fZBias = f; }
virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; }
// Lua
virtual void PushSelf( lua_State *L );
+1 -1
View File
@@ -554,7 +554,7 @@ public:
// this one is tricky, we need to get an Actor from Lua.
return 0;
}
static int RemoveChild( T* p, lua_State *L )
{
Actor *pChild = p->GetChild( SArg(1) );
+2 -2
View File
@@ -106,7 +106,7 @@ void BGAnimation::LoadFromAniDir( const RString &_sAniDir )
IniFile ini;
ini.ReadFile( sPathToIni );
AddLayersFromAniDir( sAniDir, &ini ); // TODO: Check for circular load
AddLayersFromAniDir( sAniDir, &ini ); // TODO: Check for circular load
XNode* pBGAnimation = ini.GetChild( "BGAnimation" );
XNode dummy( "BGAnimation" );
@@ -137,7 +137,7 @@ void BGAnimation::LoadFromAniDir( const RString &_sAniDir )
{
const RString sPath = asImagePaths[i];
if( Basename(sPath).Left(1) == "_" )
continue; // don't directly load files starting with an underscore
continue; // don't directly load files starting with an underscore
BGAnimationLayer* pLayer = new BGAnimationLayer;
pLayer->LoadFromAniLayerFile( asImagePaths[i] );
AddChild( pLayer );
-32
View File
@@ -1,7 +1,6 @@
#include "global.h"
#include "Banner.h"
#include "BannerCache.h"
//#include "BackgroundCache.h" // XXX: this is probably a bad idea -aj
#include "SongManager.h"
#include "RageUtil.h"
#include "Song.h"
@@ -74,37 +73,6 @@ void Banner::LoadFromCachedBanner( const RString &sPath )
LoadFallback();
}
// xxx: move this shit elsewhere yo -aj
/*
void Banner::LoadFromCachedBackground( const RString &sPath )
{
if( sPath.empty() )
{
LoadFallbackBG();
return;
}
RageTextureID ID;
bool bLowRes = (PREFSMAN->m_BackgroundCache != BGCACHE_FULL);
if( !bLowRes )
{
ID = Sprite::SongBGTexture( sPath );
}
else
{
// Try to load the low quality version.
ID = BACKGROUNDCACHE->LoadCachedBackground( sPath );
}
if( TEXTUREMAN->IsTextureRegistered(ID) )
Load( ID );
else if( IsAFile(sPath) )
Load( sPath );
else
LoadFallbackBG();
}
*/
void Banner::Update( float fDeltaTime )
{
Sprite::Update( fDeltaTime );
-1
View File
@@ -20,7 +20,6 @@ public:
void Load( RageTextureID ID, bool bIsBanner );
virtual void Load( RageTextureID ID ) { Load( ID, true ); }
void LoadFromCachedBanner( const RString &sPath );
//void LoadFromCachedBackground( const RString &sPath );
virtual void Update( float fDeltaTime );
+8 -10
View File
@@ -14,7 +14,7 @@ const int MAX_METER = 20;
const int MAX_NUM_CREDITS = 20;
/* This is just cached song data. Not all of it may actually be displayed
/* This is just cached song data. Not all of it may actually be displayed
* in the radar. */
enum RadarCategory
{
@@ -108,6 +108,7 @@ LuaDeclareType( PlayMode );
enum SortOrder
{
// song sorts
SORT_PREFERRED,
SORT_GROUP,
SORT_TITLE,
@@ -125,7 +126,9 @@ enum SortOrder
SORT_DOUBLE_MEDIUM_METER,
SORT_DOUBLE_HARD_METER,
SORT_DOUBLE_CHALLENGE_METER,
//
SORT_MODE_MENU,
// course sorts
SORT_ALL_COURSES,
SORT_NONSTOP_COURSES,
SORT_ONI_COURSES,
@@ -141,11 +144,10 @@ const RString& SortOrderToString( SortOrder so );
const RString& SortOrderToLocalizedString( SortOrder so );
SortOrder StringToSortOrder( const RString& str );
LuaDeclareType( SortOrder );
// IsSongSort is only used for saving sort order to the profile. -aj
inline bool IsSongSort( SortOrder so ) { return so >= SORT_PREFERRED && so <= SORT_DOUBLE_CHALLENGE_METER; }
// Scoring stuff
enum TapNoteScore {
TNS_None,
TNS_HitMine,
@@ -168,9 +170,9 @@ LuaDeclareType( TapNoteScore );
enum HoldNoteScore
{
HNS_None, // this HoldNote has not been scored yet
HNS_LetGo, // the HoldNote has passed and they missed it
HNS_Held, // the HoldNote has passed and was successfully held all the way through
HNS_None, // HoldNote not scored yet
HNS_LetGo, // HoldNote has passed, missed it
HNS_Held, // HoldNote has passed, successfully held all the way
NUM_HoldNoteScore,
HoldNoteScore_Invalid,
};
@@ -258,9 +260,7 @@ enum MemoryCardState
const RString& MemoryCardStateToString( MemoryCardState mcs );
LuaDeclareType( MemoryCardState );
//
// Ranking stuff
//
enum RankingCategory
{
RANKING_A, // 1-3 meter per song avg.
@@ -278,9 +278,7 @@ inline bool IsRankingToFillIn( const RString& sName ) { return !sName.empty() &&
RankingCategory AverageMeterToRankingCategory( int iAverageMeter );
//
// Group stuff
//
extern const RString GROUP_ALL;
+32 -32
View File
@@ -118,7 +118,7 @@ void LuaHelpers::ReadArrayFromTableB( Lua *L, vector<bool> &aOut )
namespace
{
/* Creates a table from an XNode and leaves it on the stack. */
// Creates a table from an XNode and leaves it on the stack.
void CreateTableFromXNodeRecursive( Lua *L, const XNode *pNode )
{
// create our base table
@@ -137,9 +137,9 @@ namespace
FOREACH_CONST_Child( pNode, c )
{
const XNode *pChild = c;
lua_pushstring( L, pChild->m_sName ); // push key
lua_pushstring( L, pChild->m_sName ); // push key
// push value (more correctly, build this child's table and leave it there
// push value (more correctly, build this child's table and leave it there)
CreateTableFromXNodeRecursive( L, pChild );
// add key-value pair to the table
@@ -187,14 +187,14 @@ static int GetLuaStack( lua_State *L )
}
}
/* If the first call is this function, omit it from the trace. */
// If the first call is this function, omit it from the trace.
if( iLevel == 0 && lua_iscfunction(L, -1) && lua_tocfunction(L, 1) == GetLuaStack )
{
lua_pop( L, 1 ); // pop function
continue;
}
lua_pop( L, 1 ); // pop function
sErr += ssprintf( "\n%s:", file );
if( ar.currentline != -1 )
sErr += ssprintf( "%i:", ar.currentline );
@@ -206,7 +206,7 @@ static int GetLuaStack( lua_State *L )
else
sErr += ssprintf( " unknown" );
sErr += ssprintf( "(%s)", join(",", vArgs).c_str() );
}
}
LuaHelpers::Push( L, sErr );
return 1;
@@ -238,7 +238,7 @@ void LuaManager::Register( RegisterWithLuaFn pfn )
LuaManager::LuaManager()
{
pImpl = new Impl;
LUA = this; // so that LUA is available when we call the Register functions
LUA = this; // so that LUA is available when we call the Register functions
lua_State *L = lua_open();
ASSERT( L );
@@ -251,14 +251,15 @@ LuaManager::LuaManager()
lua_pushcfunction( L, luaopen_string ); lua_call( L, 0, 0 );
lua_pushcfunction( L, luaopen_table ); lua_call( L, 0, 0 );
lua_pushcfunction( L, luaopen_debug ); lua_call( L, 0, 0 );
// these three can be dangerous. don't use them.
// these three can be dangerous. don't use them
// (unless you know what you are doing). -aj
#if 0
lua_pushcfunction( L, luaopen_io ); lua_call( L, 0, 0 );
lua_pushcfunction( L, luaopen_os ); lua_call( L, 0, 0 );
lua_pushcfunction( L, luaopen_package ); lua_call( L, 0, 0 );
#endif
/* Store the thread pool in a table on the stack, in the main thread. */
// Store the thread pool in a table on the stack, in the main thread.
#define THREAD_POOL 1
lua_newtable( L );
@@ -287,7 +288,7 @@ Lua *LuaManager::Get()
{
pRet = lua_newthread( m_pLuaMain );
/* Store the new thread in THREAD_POOL, so it isn't collected. */
// Store the new thread in THREAD_POOL, so it isn't collected.
int iLast = lua_objlen( m_pLuaMain, THREAD_POOL );
lua_rawseti( m_pLuaMain, THREAD_POOL, iLast+1 );
}
@@ -322,13 +323,13 @@ void LuaManager::Release( Lua *&p )
* to process long-running actions, without blocking all other threads from using Lua
* until it finishes.
*
* Lua *L = LUA->Get(); // acquires L and locks Lua
* Lua *L = LUA->Get(); // acquires L and locks Lua
* lua_newtable(L); // does something with Lua
* LUA->YieldLua(); // unlocks Lua for lengthy operation; L is still owned, but can't be used
* RString s = ReadFile("/filename.txt"); // time-consuming operation; other threads may use Lua in the meantime
* LUA->UnyieldLua(); // relock Lua
* lua_pushstring( L, s ); // finish working with it
* LUA->Release( L ); // release L and unlock Lua
* LUA->UnyieldLua(); // relock Lua
* lua_pushstring( L, s ); // finish working with it
* LUA->Release( L ); // release L and unlock Lua
*
* YieldLua() must not be called when already yielded, or when a lua_State has not been
* acquired (you have nothing to yield), and always unyield before releasing the
@@ -336,8 +337,8 @@ void LuaManager::Release( Lua *&p )
*
* L1 = LUA->Get();
* LUA->YieldLua(); // yields
* L2 = LUA->Get(); // unyields
* LUA->Release(L2); // re-yields
* L2 = LUA->Get(); // unyields
* LUA->Release(L2); // re-yields
* LUA->UnyieldLua();
* LUA->Release(L1);
*/
@@ -401,7 +402,7 @@ LuaThreadVariable::LuaThreadVariable( lua_State *L )
{
m_Name = new LuaReference;
m_pOldValue = new LuaReference;
lua_pushvalue( L, -2 );
m_Name->SetFromStack( L );
@@ -602,7 +603,7 @@ XNode *LuaHelpers::GetLuaInformation()
break;
}
}
// fall through
// fall through
case LUA_TUSERDATA: // table or userdata: class instance
{
if( !luaL_callmeta(L, -1, "__type") )
@@ -631,7 +632,7 @@ XNode *LuaHelpers::GetLuaInformation()
lua_getinfo( L, ">S", &ar ); // Pops the function
printf( "%s: %s\n", sKey.c_str(), ar.short_src );
}
*/
*/
break;
}
}
@@ -719,7 +720,7 @@ XNode *LuaHelpers::GetLuaInformation()
const vector<RString> &vEnum = iter->second;
pEnumNode->AppendAttr( "name", iter->first );
for( unsigned i = 0; i < vEnum.size(); ++i )
{
XNode *pEnumValueNode = pEnumNode->AppendChild( "EnumValue" );
@@ -732,7 +733,7 @@ XNode *LuaHelpers::GetLuaInformation()
FOREACHM_CONST( RString, float, mConstants, c )
{
XNode *pConstantNode = pConstantsNode->AppendChild( "Constant" );
pConstantNode->AppendAttr( "name", c->first );
if( c->second == truncf(c->second) )
pConstantNode->AppendAttr( "value", int(c->second) );
@@ -840,7 +841,7 @@ void LuaHelpers::ParseCommandList( Lua *L, const RString &sCommands, const RStri
RString sLuaFunction;
if( sCommands.size() > 0 && sCommands[0] == '\033' )
{
/* This is a compiled Lua chunk. Just pass it on directly. */
// This is a compiled Lua chunk. Just pass it on directly.
sLuaFunction = sCommands;
}
else if( sCommands.size() > 0 && sCommands[0] == '%' )
@@ -899,7 +900,7 @@ void LuaHelpers::ParseCommandList( Lua *L, const RString &sCommands, const RStri
if( !LuaHelpers::RunScript(L, sLuaFunction, sName, sError, 0, 1) )
LOG->Warn( "Compiling \"%s\": %s", sLuaFunction.c_str(), sError.c_str() );
/* The function is now on the stack. */
// The function is now on the stack.
}
/* Like luaL_typerror, but without the special case for argument 1 being "self"
@@ -929,7 +930,7 @@ void LuaHelpers::DeepCopy( lua_State *L )
luaL_checktype( L, -2, LUA_TTABLE );
luaL_checktype( L, -1, LUA_TTABLE );
/* Call DeepCopy(t, u), where t is our referenced object and u is the new table. */
// Call DeepCopy(t, u), where t is our referenced object and u is the new table.
lua_getglobal( L, "DeepCopy" );
ASSERT_M( !lua_isnil(L, -1), "DeepCopy() missing" );
@@ -1006,7 +1007,8 @@ namespace
{
RString sPath = SArg(1);
/* Release Lua while we call GetFileContents, so we don't it while we read from he disk. */
/* Release Lua while we call GetFileContents, so we don't access
* it while we read from the disk. */
LUA->YieldLua();
RString sFileContents;
@@ -1026,11 +1028,9 @@ namespace
}
}
/*
* RunWithThreadVariables(func, { a = "x", b = "y" }, arg1, arg2, arg3 ... }
/* RunWithThreadVariables(func, { a = "x", b = "y" }, arg1, arg2, arg3 ... }
* calls func(arg1, arg2, arg3) with two LuaThreadVariable set, and returns
* the return values of func().
*/
* the return values of func(). */
static int RunWithThreadVariables( lua_State *L )
{
luaL_checktype( L, 1, LUA_TFUNCTION );
@@ -1046,8 +1046,8 @@ namespace
lua_remove( L, 2 );
/* XXX: We want to clean up apVars on errors, but if we lua_pcall, we won't
* propagate the error upwards. */
/* XXX: We want to clean up apVars on errors, but if we lua_pcall,
* we won't propagate the error upwards. */
int iArgs = lua_gettop(L) - 1;
lua_call( L, iArgs, LUA_MULTRET );
int iVals = lua_gettop(L);
@@ -1064,7 +1064,7 @@ namespace
LuaThreadVariable::GetThreadVariable( L );
return 1;
}
const luaL_Reg luaTable[] =
{
LIST_METHOD( Trace ),
+12 -11
View File
@@ -35,7 +35,8 @@ public:
void YieldLua();
void UnyieldLua();
// Register all subscribing types. There's no harm in registering when already registered.
// Register all subscribing types.
// There's no harm in registering when already registered.
void RegisterTypes();
void SetGlobal( const RString &sName, int val );
@@ -49,19 +50,19 @@ private:
namespace LuaHelpers
{
/* Load the given script with the given name. On success, the resulting
* chunk will be on the stack. On error, the error is stored in sError
/* Load the given script with the given name. On success, the resulting
* chunk will be on the stack. On error, the error is stored in sError
* and the stack is unchanged. */
bool LoadScript( Lua *L, const RString &sScript, const RString &sName, RString &sError );
/* Run the function with arguments at the top of the stack, with the given
* number of arguments. The specified number of return values are left on
* the Lua stack. On error, nils are left on the stack, sError is set and
* number of arguments. The specified number of return values are left on
* the Lua stack. On error, nils are left on the stack, sError is set and
* false is returned. */
bool RunScriptOnStack( Lua *L, RString &sError, int iArgs = 0, int iReturnValues = 0 );
/* LoadScript the given script, and RunScriptOnStack it. iArgs arguments are
* at the top of the stack. */
/* LoadScript the given script, and RunScriptOnStack it.
* iArgs arguments are at the top of the stack. */
bool RunScript( Lua *L, const RString &sScript, const RString &sName, RString &sError, int iArgs = 0, int iReturnValues = 0 );
/* Run the given expression, returning a single value, and leave the return
@@ -77,8 +78,8 @@ namespace LuaHelpers
// Create a Lua table with contents set from this XNode, then push it on the stack.
void CreateTableFromXNode( Lua *L, const XNode *pNode );
/* Recursively copy elements from the table at stack element -2 into the table
* at stack -1. Pop both elements from the stack. */
/* Recursively copy elements from the table at stack element -2 into the
* table at stack -1. Pop both elements from the stack. */
void DeepCopy( lua_State *L );
// Read the table at the top of the stack back into a vector.
@@ -88,8 +89,8 @@ namespace LuaHelpers
XNode *GetLuaInformation();
/* Pops the last iArgs arguments from the stack, and return a function that returns
* those values. */
/* Pops the last iArgs arguments from the stack, and return a function that
* returns those values. */
void PushValueFunc( lua_State *L, int iArgs );
template<class T>
+4 -1
View File
@@ -48,7 +48,8 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
if(!line.compare(0, 2, "//"))
continue;
/* "[data1] data2". Ignore whitespace at the beginning of the line. */
// (most tags are in the format of...)
// "[data1] data2". Ignore whitespace at the beginning of the line.
static Regex x("^ *\\[([^]]+)\\] *(.*)$");
vector<RString> matches;
@@ -77,6 +78,8 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
continue;
}
// todo: handle [offset:xxxx] (where xxxx is in milliseconds) tag? -aj
{
/* If we've gotten this far, and no other statement caught
* this value before this does, assume it's a time value. */
+2 -2
View File
@@ -576,7 +576,7 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
{
if( SHOW_ROULETTE )
arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_ROULETTE, NULL, "", NULL, RageColor(1,0,0,1), 0) );
/* Only add TYPE_PORTAL if there's at least one song on the list. */
// Only add TYPE_PORTAL if there's at least one song on the list.
bool bFoundAnySong = false;
for( unsigned i=0; !bFoundAnySong && i < arrayWheelItemDatas.size(); i++ )
if( arrayWheelItemDatas[i]->m_Type == TYPE_SONG )
@@ -599,7 +599,7 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
{
if( arrayWheelItemDatas[i]->m_pSong == pSong )
{
/* Change the song color. */
// Change the song color.
arrayWheelItemDatas[i]->m_color = SONG_REAL_EXTRA_COLOR;
break;
}
+1 -1
View File
@@ -1009,7 +1009,7 @@ public:
lua_pop( L, 1 ); // pop option table
LuaHelpers::ReadArrayFromTableB( L, vbSelOut );
lua_pop( L, 1 ); // pop vbSelectedOut table
ASSERT( lua_gettop(L) == 0 );
+1 -1
View File
@@ -54,7 +54,7 @@ public:
int m_iMaxScore;
RadarValues m_radarPossible; // filled in by ScreenGameplay on start of notes
RadarValues m_radarActual;
/* The number of songs played and passed, respectively. */
// The number of songs played and passed, respectively.
int m_iSongsPassed;
int m_iSongsPlayed;
float m_fLifeRemainingSeconds; // used in survival
+7 -11
View File
@@ -128,9 +128,7 @@ void ScreenEdit::InitEditMappings()
{
m_EditMappingsDeviceInput.Clear();
//
// Common mappings:
//
switch( EDIT_MODE.GetValue() )
{
case EditMode_Practice:
@@ -167,9 +165,7 @@ void ScreenEdit::InitEditMappings()
m_EditMappingsDeviceInput.hold[EDIT_BUTTON_PLAY_FROM_CURSOR][1] = DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT);
m_EditMappingsDeviceInput.button[EDIT_BUTTON_PLAY_SELECTION][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cp);
//
// EditMode-specific mappings
//
switch( EDIT_MODE.GetValue() )
{
case EditMode_Practice:
@@ -195,27 +191,27 @@ void ScreenEdit::InitEditMappings()
// Left/Right = Snap to Next/Prev
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SNAP_NEXT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_LEFT);
m_EditMappingsDeviceInput.button[EDIT_BUTTON_SNAP_PREV][0] = DeviceInput(DEVICE_KEYBOARD, KEY_RIGHT);
// v = course attack menu
m_EditMappingsDeviceInput.button[EDIT_BUTTON_OPEN_COURSE_ATTACK_MENU][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cv);
m_EditMappingsDeviceInput.button[EDIT_BUTTON_ADD_COURSE_MODS][0] = DeviceInput(DEVICE_KEYBOARD, KEY_Cm);
// F1 = Show help popup
m_EditMappingsDeviceInput.button [EDIT_BUTTON_OPEN_INPUT_HELP][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F1);
// Esc = Show Edit Menu
m_EditMappingsDeviceInput.button [EDIT_BUTTON_OPEN_EDIT_MENU][0] = DeviceInput(DEVICE_KEYBOARD, KEY_ESC);
m_EditMappingsMenuButton.button [EDIT_BUTTON_OPEN_EDIT_MENU][0] = GAME_BUTTON_START;
m_EditMappingsMenuButton.button [EDIT_BUTTON_OPEN_EDIT_MENU][1] = GAME_BUTTON_BACK;
// Escape, Enter = exit play/record
m_PlayMappingsDeviceInput.button [EDIT_BUTTON_RETURN_TO_EDIT][0] = DeviceInput(DEVICE_KEYBOARD, KEY_ENTER);
m_PlayMappingsDeviceInput.button [EDIT_BUTTON_RETURN_TO_EDIT][1] = DeviceInput(DEVICE_KEYBOARD, KEY_ESC);
m_PlayMappingsMenuButton.button [EDIT_BUTTON_RETURN_TO_EDIT][0] = GAME_BUTTON_START;
return;
case EditMode_Full:
/* Don't allow F5/F6 in home mode. It breaks the "delay creation until first save" logic. */
/* Don't allow F5/F6 in home mode. It breaks the "delay creation until first save" logic. */
m_EditMappingsDeviceInput.button[EDIT_BUTTON_OPEN_PREV_STEPS][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F5);
m_EditMappingsDeviceInput.button[EDIT_BUTTON_OPEN_NEXT_STEPS][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F6);
m_EditMappingsDeviceInput.button[EDIT_BUTTON_BPM_DOWN][0] = DeviceInput(DEVICE_KEYBOARD, KEY_F7);
@@ -3855,7 +3851,7 @@ static const EditHelpLine g_EditHelpLines[] =
EditHelpLine( "Next/prev steps of same StepsType", EDIT_BUTTON_OPEN_NEXT_STEPS, EDIT_BUTTON_OPEN_PREV_STEPS ),
EditHelpLine( "Decrease/increase BPM at cur beat", EDIT_BUTTON_BPM_DOWN, EDIT_BUTTON_BPM_UP ),
EditHelpLine( "Decrease/increase stop at cur beat", EDIT_BUTTON_STOP_DOWN, EDIT_BUTTON_STOP_UP ),
// EditHelpLine( "Decrease/increase delay at cur beat", EDIT_BUTTON_DELAY_DOWN, EDIT_BUTTON_DELAY_UP ),
//EditHelpLine( "Decrease/increase delay at cur beat", EDIT_BUTTON_DELAY_DOWN, EDIT_BUTTON_DELAY_UP ),
EditHelpLine( "Decrease/increase music offset", EDIT_BUTTON_OFFSET_DOWN, EDIT_BUTTON_OFFSET_UP ),
EditHelpLine( "Decrease/increase sample music start", EDIT_BUTTON_SAMPLE_START_DOWN, EDIT_BUTTON_SAMPLE_START_UP ),
EditHelpLine( "Decrease/increase sample music length", EDIT_BUTTON_SAMPLE_LENGTH_DOWN, EDIT_BUTTON_SAMPLE_LENGTH_UP ),
+5 -7
View File
@@ -96,17 +96,15 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_ExportOptions )
{
//
// Override ScreenOptions's calling of ExportOptions
//
m_iChangeMask = 0;
CHECKPOINT;
vector<PlayerNumber> vpns;
FOREACH_OptionsPlayer( p )
vpns.push_back( p );
for( unsigned r=0; r<m_pRows.size(); r++ ) // foreach row
for( unsigned r=0; r<m_pRows.size(); r++ ) // foreach row
ExportOptions( r, vpns );
if( m_iChangeMask & OPT_APPLY_ASPECT_RATIO )
@@ -117,14 +115,14 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
}
/* If the theme changes, we need to reset RageDisplay to apply the new window
* title and icon. If the aspect ratio changes, we need to reset RageDisplay
* title and icon. If the aspect ratio changes, we need to reset RageDisplay
* so that the projection matrix is re-created using the new screen dimensions. */
if( (m_iChangeMask & OPT_APPLY_THEME) ||
(m_iChangeMask & OPT_APPLY_GRAPHICS) ||
(m_iChangeMask & OPT_APPLY_ASPECT_RATIO) )
{
/* If the resolution or aspect ratio changes, always reload the theme. Otherwise,
* only reload it if it changed. */
/* If the resolution or aspect ratio changes, always reload the theme.
* Otherwise, only reload it if it changed. */
RString sNewTheme = PREFSMAN->m_sTheme.Get();
bool bForceThemeReload = !!(m_iChangeMask & OPT_APPLY_ASPECT_RATIO) || !!(m_iChangeMask & OPT_APPLY_GRAPHICS);
GameLoop::ChangeTheme( sNewTheme, this->GetNextScreenName(), bForceThemeReload );
+7 -5
View File
@@ -62,19 +62,20 @@ public:
void PreloadSongImages();
RString GetSongGroupBannerPath( RString sSongGroup ) const;
//RString GetSongGroupBackgroundPath( RString sSongGroup ) const;
void GetSongGroupNames( vector<RString> &AddTo ) const;
bool DoesSongGroupExist( RString sSongGroup ) const;
RageColor GetSongGroupColor( const RString &sSongGroupName ) const;
RageColor GetSongColor( const Song* pSong ) const;
RString GetCourseGroupBannerPath( const RString &sCourseGroup ) const;
//RString GetCourseGroupBackgroundPath( const RString &sCourseGroup ) const;
void GetCourseGroupNames( vector<RString> &AddTo ) const;
bool DoesCourseGroupExist( const RString &sCourseGroup ) const;
RageColor GetCourseGroupColor( const RString &sCourseGroupName ) const;
RageColor GetCourseColor( const Course* pCourse ) const;
static RString ShortenGroupName( RString sLongGroupName );
static RString ShortenGroupName( RString sLongGroupName );
// Lookup
const vector<Song*> &GetSongs( const RString &sGroupName ) const;
@@ -114,9 +115,8 @@ public:
Course* GetCourseFromPath( RString sPath ) const; // path to .crs file, or path to song group dir
Course* GetCourseFromName( RString sName ) const;
void UpdatePopular();
void UpdateShuffled(); // re-shuffle songs and courses
void UpdateShuffled(); // re-shuffle songs and courses
void UpdatePreferredSort();
void SortSongs(); // sort m_pSongs by CompareSongPointersByTitle
@@ -146,7 +146,8 @@ protected:
vector<PreferredSortSection> m_vPreferredSongSort;
vector<RString> m_sSongGroupNames;
vector<RString> m_sSongGroupBannerPaths; // each song group may have a banner associated with it
//vector<RString> m_sSongGroupBackgroundPaths; // each song group may have a background associated with it (very rarely)
struct Comp { bool operator()(const RString& s, const RString &t) const { return CompareRStringsAsc(s,t); } };
typedef vector<Song*> SongPointerVector;
map<RString,SongPointerVector,Comp> m_mapSongGroupIndex;
@@ -157,6 +158,7 @@ protected:
struct CourseGroupInfo
{
RString m_sBannerPath;
//RString m_sBackgroundPath;
};
map<RString,CourseGroupInfo> m_mapCourseGroupToInfo;
typedef vector<Course*> CoursePointerVector;
+13 -14
View File
@@ -61,9 +61,7 @@ public:
LoadedThemeData *g_pLoadedThemeData = NULL;
//
// For self-registering metrics
//
#include "SubscriptionManager.h"
static SubscriptionManager<IThemeMetric> g_Subscribers;
@@ -113,7 +111,7 @@ void ThemeManager::Unsubscribe( IThemeMetric *p )
}
/* We spend a lot of time doing redundant theme path lookups. Cache results. */
// We spend a lot of time doing redundant theme path lookups. Cache results.
static map<RString, ThemeManager::PathInfo> g_ThemePathCache[NUM_ElementCategory];
void ThemeManager::ClearThemePathCache()
{
@@ -125,7 +123,7 @@ static void FileNameToMetricsGroupAndElement( const RString &sFileName, RString
{
// split into class name and file name
RString::size_type iIndexOfFirstSpace = sFileName.find(" ");
if( iIndexOfFirstSpace == string::npos ) // no space
if( iIndexOfFirstSpace == string::npos ) // no space
{
sMetricsGroupOut = "";
sElementOut = sFileName;
@@ -159,7 +157,7 @@ ThemeManager::ThemeManager()
LUA->Release( L );
}
/* We don't have any theme loaded until SwitchThemeAndLanguage is called. */
// We don't have any theme loaded until SwitchThemeAndLanguage is called.
m_sCurThemeName = "";
m_bPseudoLocalize = false;
@@ -201,7 +199,7 @@ int ThemeManager::GetNumSelectableThemes()
bool ThemeManager::DoesThemeExist( const RString &sThemeName )
{
vector<RString> asThemeNames;
vector<RString> asThemeNames;
GetThemeNames( asThemeNames );
for( unsigned i=0; i<asThemeNames.size(); i++ )
{
@@ -247,7 +245,7 @@ RString ThemeManager::GetThemeAuthor( const RString &sThemeName )
static bool EqualsNoCase( const RString &s1, const RString &s2 )
{
return s1.EqualsNoCase(s2);
return s1.EqualsNoCase(s2);
}
void ThemeManager::GetLanguages( vector<RString>& AddTo )
{
@@ -317,9 +315,10 @@ void ThemeManager::LoadThemeMetrics( const RString &sThemeName_, const RString &
if( bIsBaseTheme )
bLoadedBase = true;
/* Read the fallback theme. If no fallback theme is specified, and we haven't
* already loaded it, fall back on SpecialFiles::BASE_THEME_NAME. That way, default theme
* fallbacks can be disabled with "FallbackTheme=". */
/* Read the fallback theme. If no fallback theme is specified, and we haven't
* already loaded it, fall back on SpecialFiles::BASE_THEME_NAME.
* That way, default theme fallbacks can be disabled with
* "FallbackTheme=". */
RString sFallback;
if( !iniMetrics.GetValue("Global","FallbackTheme",sFallback) )
{
@@ -340,13 +339,13 @@ void ThemeManager::LoadThemeMetrics( const RString &sThemeName_, const RString &
sThemeName = sFallback;
}
/* Overlay metrics from the command line. */
// Overlay metrics from the command line.
RString sMetric;
for( int i = 0; GetCommandlineArgument( "metric", &sMetric, i ); ++i )
{
/* sMetric must be "foo::bar=baz". "foo" and "bar" never contain "=", so in
* "foo::bar=1+1=2", "baz" is always "1+1=2". Neither foo nor bar may be
* empty, but baz may be. */
/* sMetric must be "foo::bar=baz". "foo" and "bar" never contain "=", so
* in "foo::bar=1+1=2", "baz" is always "1+1=2". Neither foo nor bar may
* be empty, but baz may be. */
Regex re( "^([^=]+)::([^=]+)=(.*)$" );
vector<RString> sBits;
if( !re.Compare( sMetric, sBits ) )
+1 -1
View File
@@ -28,7 +28,7 @@ public:
protected:
enum State {
waiting,
waiting,
transitioning,
finished
} m_State;