There goes the macro file.

This is one of my bigger commits in this branch.

Still, shouldn't cause a problem.
This commit is contained in:
Jason Felds
2013-05-01 23:54:39 -04:00
parent b1ed735622
commit c67419ecc8
121 changed files with 3793 additions and 3844 deletions
@@ -670,7 +670,6 @@
AA40D2F509A08D650068C0D5 /* RageSurface_Load_XPM.h in Headers */ = {isa = PBXBuildFile; fileRef = AABBF6730659E78D00738526 /* RageSurface_Load_XPM.h */; };
AA40D2F609A08D650068C0D5 /* RageSurface_Load.h in Headers */ = {isa = PBXBuildFile; fileRef = AABBF6750659E78D00738526 /* RageSurface_Load.h */; };
AA40D2F809A08D650068C0D5 /* Difficulty.h in Headers */ = {isa = PBXBuildFile; fileRef = AAD6A713065E0FDF0042165A /* Difficulty.h */; };
AA40D2F909A08D650068C0D5 /* Foreach.h in Headers */ = {isa = PBXBuildFile; fileRef = AA70E3640663112800DAE1FD /* Foreach.h */; };
AA40D2FA09A08D650068C0D5 /* Trail.h in Headers */ = {isa = PBXBuildFile; fileRef = AA70E3660663112800DAE1FD /* Trail.h */; };
AA40D2FB09A08D650068C0D5 /* TrailUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = AA70E3680663112800DAE1FD /* TrailUtil.h */; };
AA40D2FC09A08D650068C0D5 /* ScreenNetworkOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = AA42F5E7067068D30013509E /* ScreenNetworkOptions.h */; };
@@ -2499,7 +2498,6 @@
AA6EFFC104770FFD005F316C /* Quad.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; name = Quad.h; path = ../src/Quad.h; sourceTree = "<group>"; };
AA6EFFC204770FFD005F316C /* Sprite.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = Sprite.cpp; path = ../src/Sprite.cpp; sourceTree = "<group>"; };
AA6EFFC304770FFD005F316C /* Sprite.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; name = Sprite.h; path = ../src/Sprite.h; sourceTree = "<group>"; };
AA70E3640663112800DAE1FD /* Foreach.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = Foreach.h; sourceTree = "<group>"; };
AA70E3650663112800DAE1FD /* Trail.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = Trail.cpp; path = ../src/Trail.cpp; sourceTree = "<group>"; };
AA70E3660663112800DAE1FD /* Trail.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; name = Trail.h; path = ../src/Trail.h; sourceTree = "<group>"; };
AA70E3670663112800DAE1FD /* TrailUtil.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; name = TrailUtil.cpp; path = ../src/TrailUtil.cpp; sourceTree = "<group>"; };
@@ -3471,7 +3469,6 @@
29B97315FDCFA39411CA2CEA /* Other Source */ = {
isa = PBXGroup;
children = (
AA70E3640663112800DAE1FD /* Foreach.h */,
3659B56D0F902143002B6B68 /* CommandLineActions.cpp */,
3659B56E0F902143002B6B68 /* CommandLineActions.h */,
);
@@ -5682,7 +5679,6 @@
AA40D2F509A08D650068C0D5 /* RageSurface_Load_XPM.h in Headers */,
AA40D2F609A08D650068C0D5 /* RageSurface_Load.h in Headers */,
AA40D2F809A08D650068C0D5 /* Difficulty.h in Headers */,
AA40D2F909A08D650068C0D5 /* Foreach.h in Headers */,
AA40D2FA09A08D650068C0D5 /* Trail.h in Headers */,
AA40D2FB09A08D650068C0D5 /* TrailUtil.h in Headers */,
AA40D2FC09A08D650068C0D5 /* ScreenNetworkOptions.h in Headers */,
+1745 -1745
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -9,7 +9,7 @@
#include "ActorUtil.h"
#include "RageDisplay.h"
#include "ScreenDimensions.h"
#include "Foreach.h"
/* Tricky: We need ActorFrames created in Lua to auto delete their children.
* We don't want classes that derive from ActorFrame to auto delete their
+1 -1
View File
@@ -9,7 +9,7 @@
#include "RageTexture.h"
#include "RageUtil.h"
#include "ActorUtil.h"
#include "Foreach.h"
#include "LuaBinding.h"
#include "LuaManager.h"
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
#include "ActorScroller.h"
#include "Foreach.h"
#include "RageUtil.h"
#include "XmlFile.h"
#include "arch/Dialog/Dialog.h"
+1 -1
View File
@@ -8,7 +8,7 @@
#include "XmlFile.h"
#include "XmlFileUtil.h"
#include "LuaManager.h"
#include "Foreach.h"
#include "arch/Dialog/Dialog.h"
+1 -1
View File
@@ -41,7 +41,7 @@
#include "LocalizedString.h"
#include "PrefsManager.h"
#include "ScreenManager.h"
#include "Foreach.h"
vector<TimingData> AdjustSync::s_vpTimingDataOriginal;
float AdjustSync::s_fGlobalOffsetSecondsOriginal = 0.0f;
+1 -1
View File
@@ -3,7 +3,7 @@
#include "GameState.h"
#include "RageUtil.h"
#include "Song.h"
#include "Foreach.h"
#include "PlayerOptions.h"
#include "PlayerState.h"
+1 -1
View File
@@ -30,7 +30,7 @@
#include "RageSoundManager.h"
#include "RageLog.h"
#include "RageSoundReader_FileReader.h"
#include "Foreach.h"
void AutoKeysounds::Load( PlayerNumber pn, const NoteData& ndAutoKeysoundsOnly )
{
+1 -1
View File
@@ -4,7 +4,7 @@
#include "BGAnimationLayer.h"
#include "RageUtil.h"
#include "ActorUtil.h"
#include "Foreach.h"
#include "LuaManager.h"
#include "PrefsManager.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "BackgroundUtil.h"
#include "RageUtil.h"
#include "Song.h"
#include "Foreach.h"
#include "IniFile.h"
#include "RageLog.h"
#include <set>
+1 -1
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "BannerCache.h"
#include "Foreach.h"
#include "RageDisplay.h"
#include "RageUtil.h"
#include "RageLog.h"
+1 -1
View File
@@ -9,7 +9,7 @@
#include "Font.h"
#include "ActorUtil.h"
#include "LuaBinding.h"
#include "Foreach.h"
REGISTER_ACTOR_CLASS( BitmapText );
+1 -1
View File
@@ -2,7 +2,7 @@
#include "CharacterManager.h"
#include "Character.h"
#include "GameState.h"
#include "Foreach.h"
#include "LuaManager.h"
#define CHARACTERS_DIR "/Characters/"
+1 -1
View File
@@ -3,7 +3,7 @@
#include "RageUtil.h"
#include "RageLog.h"
#include "arch/Dialog/Dialog.h"
#include "Foreach.h"
#include <numeric>
RString Command::GetName() const
+1 -1
View File
@@ -8,7 +8,7 @@
#include "LuaManager.h"
#include "ProductInfo.h"
#include "DateTime.h"
#include "Foreach.h"
#include "arch/Dialog/Dialog.h"
#include "RageFileManager.h"
#include "SpecialFiles.h"
+1 -1
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "CommonMetrics.h"
#include "RageUtil.h"
#include "Foreach.h"
#include "GameManager.h"
#include "RageLog.h"
#include "GameState.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "global.h"
#include "Course.h"
#include "CourseLoaderCRS.h"
#include "Foreach.h"
#include "GameManager.h"
#include "GameState.h"
#include "LocalizedString.h"
+1 -1
View File
@@ -8,7 +8,7 @@
#include "XmlFile.h"
#include "GameState.h"
#include "Style.h"
#include "Foreach.h"
#include "GameState.h"
#include "LocalizedString.h"
#include "RageLog.h"
-1
View File
@@ -3,7 +3,6 @@
#include "RageUtil.h"
#include "RageFile.h"
#include "RageLog.h"
#include "Foreach.h"
CsvFile::CsvFile()
{
+1 -1
View File
@@ -7,7 +7,7 @@
#include "StepsDisplay.h"
#include "StepsUtil.h"
#include "CommonMetrics.h"
#include "Foreach.h"
#include "SongUtil.h"
#include "XmlFile.h"
+1 -1
View File
@@ -8,7 +8,7 @@
#include "Steps.h"
#include "Song.h"
#include "StepsUtil.h"
#include "Foreach.h"
#include "CommonMetrics.h"
#include "BannerCache.h"
#include "UnlockManager.h"
+1 -1
View File
@@ -7,7 +7,7 @@
#include "SpecialFiles.h"
#include "RageLog.h"
#include "Preference.h"
#include "Foreach.h"
FileTransfer::FileTransfer()
{
-35
View File
@@ -1,35 +0,0 @@
#ifndef Foreach_H
#define Foreach_H
/** @brief General foreach loop iterating over a vector. */
#define FOREACH( elemType, vect, var ) \
for( vector<elemType>::iterator var = (vect).begin(); var != (vect).end(); ++var )
#endif
/**
* @file
* @author Chris Danford (c) 2004-2005
* @section LICENSE
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+1 -1
View File
@@ -6,7 +6,7 @@
#include "ActorUtil.h"
#include "Song.h"
#include "BackgroundUtil.h"
#include "Foreach.h"
Foreground::~Foreground()
{
+1 -1
View File
@@ -13,7 +13,7 @@
#include "PrefsManager.h"
#include "Game.h"
#include "Style.h"
#include "Foreach.h"
#include "arch/Dialog/Dialog.h"
#include "GameSoundManager.h"
#include "PlayerState.h"
+1 -1
View File
@@ -4,7 +4,7 @@
#include "RageUtil.h"
#include "ThemeMetric.h"
#include "EnumHelper.h"
#include "Foreach.h"
#include "LuaManager.h"
#include "GameManager.h"
#include "LocalizedString.h"
+1 -1
View File
@@ -10,7 +10,7 @@
#include "LightsManager.h" // for NUM_CabinetLight
#include "Game.h"
#include "Style.h"
#include "Foreach.h"
GameManager* GAMEMAN = NULL; // global and accessable from anywhere in our program
+1 -1
View File
@@ -8,7 +8,7 @@
#include "CommonMetrics.h"
#include "Course.h"
#include "CryptManager.h"
#include "Foreach.h"
#include "Game.h"
#include "GameCommand.h"
#include "GameConstantsAndTypes.h"
+1 -1
View File
@@ -8,7 +8,7 @@
#include "RageLog.h"
#include "RageMath.h"
#include "StageStats.h"
#include "Foreach.h"
#include "Song.h"
#include "XmlFile.h"
+1 -1
View File
@@ -5,7 +5,7 @@
#include "PlayerNumber.h"
#include "ThemeManager.h"
#include "XmlFile.h"
#include "Foreach.h"
#include "RadarValues.h"
ThemeMetric<RString> EMPTY_NAME("HighScore","EmptyName");
+1 -1
View File
@@ -9,7 +9,7 @@ http://en.wikipedia.org/wiki/INI_file
#include "RageUtil.h"
#include "RageLog.h"
#include "RageFile.h"
#include "Foreach.h"
IniFile::IniFile(): XNode("IniFile")
{
+1 -1
View File
@@ -5,7 +5,7 @@
#include "RageUtil.h"
#include "RageThreads.h"
#include "Preference.h"
#include "Foreach.h"
// for mouse stuff: -aj
#include "PrefsManager.h"
#include "ScreenDimensions.h"
+1 -1
View File
@@ -9,7 +9,7 @@
#include "RageInput.h"
#include "SpecialFiles.h"
#include "LocalizedString.h"
#include "Foreach.h"
#include "arch/Dialog/Dialog.h"
#define AUTOMAPPINGS_DIR "/Data/AutoMappings/"
+1 -1
View File
@@ -3,7 +3,7 @@
#include "RageTimer.h"
#include "RageLog.h"
#include "InputEventPlus.h"
#include "Foreach.h"
#include "InputMapper.h"
InputQueue* INPUTQUEUE = NULL; // global and accessable from anywhere in our program
+1 -1
View File
@@ -10,7 +10,7 @@
#include "PrefsManager.h"
#include "Actor.h"
#include "Preference.h"
#include "Foreach.h"
#include "GameManager.h"
#include "CommonMetrics.h"
#include "Style.h"
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
#include "LocalizedString.h"
#include "Foreach.h"
#include "RageUtil.h"
#include "SubscriptionManager.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "LuaBinding.h"
#include "LuaReference.h"
#include "RageUtil.h"
#include "Foreach.h"
#include "SubscriptionManager.h"
static SubscriptionManager<LuaBinding> m_Subscribers;
+1 -1
View File
@@ -5,7 +5,7 @@
#include "RageLog.h"
#include "RageFile.h"
#include "RageThreads.h"
#include "Foreach.h"
#include "arch/Dialog/Dialog.h"
#include "XmlFile.h"
#include "Command.h"
+1 -1
View File
@@ -198,7 +198,7 @@ XmlFile.cpp XmlFile.h \
XmlFileUtil.cpp XmlFileUtil.h
StepMania = CommandLineActions.h CommandLineActions.cpp \
StdString.h Foreach.h \
StdString.h \
StepMania.cpp StepMania.h \
GameLoop.cpp GameLoop.h \
global.cpp global.h \
+1 -1
View File
@@ -8,7 +8,7 @@
#include "RageFileDriver.h"
#include "RageFileDriverTimeout.h"
#include "MessageManager.h"
#include "Foreach.h"
#include "RageUtil_WorkerThread.h"
#include "arch/MemoryCard/MemoryCardDriver_Null.h"
#include "LuaManager.h"
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
#include "MessageManager.h"
#include "Foreach.h"
#include "RageUtil.h"
#include "RageThreads.h"
#include "EnumHelper.h"
+1 -1
View File
@@ -8,7 +8,7 @@
#include "ActorUtil.h"
#include "XmlFile.h"
#include "LuaManager.h"
#include "Foreach.h"
int OptionToPreferredColumn( RString sOptionText );
+1 -1
View File
@@ -10,7 +10,7 @@
#include "RageLog.h"
#include "ActorUtil.h"
#include "ModelManager.h"
#include "Foreach.h"
#include "LuaBinding.h"
#include "PrefsManager.h"
+1 -1
View File
@@ -8,7 +8,7 @@
#include "RageTextureManager.h"
#include "RageLog.h"
#include "RageDisplay.h"
#include "Foreach.h"
#include <numeric>
#define MS_MAX_NAME 32
+1 -1
View File
@@ -16,7 +16,7 @@
#include "ActorUtil.h"
#include "SongUtil.h"
#include "CourseUtil.h"
#include "Foreach.h"
#include "Style.h"
#include "PlayerState.h"
#include "CommonMetrics.h"
+1 -1
View File
@@ -10,7 +10,7 @@
#include "RageLog.h"
#include "XmlFile.h"
#include "GameState.h" // blame radar calculations.
#include "Foreach.h"
#include "RageUtil_AutoPtr.h"
REGISTER_CLASS_TRAITS( NoteData, new NoteData(*pCopy) )
+1 -1
View File
@@ -8,7 +8,7 @@
#include "Style.h"
#include "GameState.h"
#include "RadarValues.h"
#include "Foreach.h"
#include <utility>
// TODO: Remove these constants that aren't time signature-aware
+1 -1
View File
@@ -11,7 +11,7 @@
#include "Sprite.h"
#include "NoteTypes.h"
#include "LuaBinding.h"
#include "Foreach.h"
#include "RageMath.h"
const RString& NoteNotePartToString( NotePart i );
+1 -1
View File
@@ -10,7 +10,7 @@
#include "RageDisplay.h"
#include "arch/Dialog/Dialog.h"
#include "PrefsManager.h"
#include "Foreach.h"
#include "ActorUtil.h"
#include "XmlFileUtil.h"
#include "Sprite.h"
+1 -1
View File
@@ -3,7 +3,7 @@
#include <cstring>
#include "NotesWriterSM.h"
#include "BackgroundUtil.h"
#include "Foreach.h"
#include "GameManager.h"
#include "LocalizedString.h"
#include "NoteTypes.h"
+1 -1
View File
@@ -3,7 +3,7 @@
#include <cstring>
#include "NotesWriterSSC.h"
#include "BackgroundUtil.h"
#include "Foreach.h"
#include "GameManager.h"
#include "LocalizedString.h"
#include "NoteTypes.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "OptionRow.h"
#include "RageUtil.h"
#include "RageLog.h"
#include "Foreach.h"
#include "OptionRowHandler.h"
#include "CommonMetrics.h"
#include "GameState.h"
+1 -1
View File
@@ -16,7 +16,7 @@
#include "SongUtil.h"
#include "StepsUtil.h"
#include "GameManager.h"
#include "Foreach.h"
#include "GameSoundManager.h"
#include "CommonMetrics.h"
#include "CharacterManager.h"
+331 -331
View File
@@ -1,331 +1,331 @@
#include "global.h"
#include "PaneDisplay.h"
#include "ThemeManager.h"
#include "GameState.h"
#include "Song.h"
#include "Steps.h"
#include "RageLog.h"
#include "ProfileManager.h"
#include "Profile.h"
#include "Course.h"
#include "Style.h"
#include "ActorUtil.h"
#include "Foreach.h"
#include "LuaManager.h"
#include "XmlFile.h"
#include "PlayerStageStats.h"
#define SHIFT_X(pc) THEME->GetMetricF(sMetricsGroup, ssprintf("ShiftP%iX", pc+1))
#define SHIFT_Y(pc) THEME->GetMetricF(sMetricsGroup, ssprintf("ShiftP%iY", pc+1))
static const char *PaneCategoryNames[] = {
"NumSteps",
"Jumps",
"Holds",
"Rolls",
"Mines",
"Hands",
"Lifts",
"Fakes",
"MachineHighScore",
"MachineHighName",
"ProfileHighScore",
};
XToString( PaneCategory );
LuaXType( PaneCategory );
enum { NEED_NOTES=1, NEED_PROFILE=2 };
struct Content_t
{
int req;
RString sFontType;
};
static const Content_t g_Contents[NUM_PaneCategory] =
{
{ NEED_NOTES, "count" }, // NumSteps
{ NEED_NOTES, "count" }, // Jumps
{ NEED_NOTES, "count" }, // Holds
{ NEED_NOTES, "count" }, // Rolls
{ NEED_NOTES, "count" }, // Mines
{ NEED_NOTES, "count" }, // Hands
{ NEED_NOTES, "count" }, // Lifts
{ NEED_NOTES, "count" }, // Fakes
{ NEED_NOTES, "score" }, // MachineHighScore
{ NEED_NOTES, "name" }, // MachineHighName
{ NEED_NOTES|NEED_PROFILE, "score" }, // ProfileHighScore
};
REGISTER_ACTOR_CLASS( PaneDisplay );
void PaneDisplay::Load( const RString &sMetricsGroup, PlayerNumber pn )
{
m_PlayerNumber = pn;
EMPTY_MACHINE_HIGH_SCORE_NAME.Load( sMetricsGroup, "EmptyMachineHighScoreName" );
NOT_AVAILABLE.Load( sMetricsGroup, "NotAvailable" );
COUNT_FORMAT.Load( sMetricsGroup, "CountFormat" );
NULL_COUNT_STRING.Load( sMetricsGroup, "NullCountString" );
FOREACH_ENUM( PaneCategory, pc )
{
LuaThreadVariable var( "PaneCategory", LuaReference::Create(pc) );
RString sFontType = g_Contents[pc].sFontType;
m_textContents[pc].LoadFromFont( THEME->GetPathF(sMetricsGroup,sFontType) );
m_textContents[pc].SetName( PaneCategoryToString(pc) + "Text" );
ActorUtil::LoadAllCommands( m_textContents[pc], sMetricsGroup );
ActorUtil::SetXY( m_textContents[pc], sMetricsGroup );
m_ContentsFrame.AddChild( &m_textContents[pc] );
m_Labels[pc].Load( THEME->GetPathG(sMetricsGroup,"label " + PaneCategoryToString(pc)) );
m_Labels[pc]->SetName( PaneCategoryToString(pc) + "Label" );
ActorUtil::LoadAllCommands( *m_Labels[pc], sMetricsGroup );
ActorUtil::SetXY( m_Labels[pc], sMetricsGroup );
m_ContentsFrame.AddChild( m_Labels[pc] );
ActorUtil::LoadAllCommandsFromName( m_textContents[pc], sMetricsGroup, PaneCategoryToString(pc) );
}
m_ContentsFrame.SetXY( SHIFT_X(m_PlayerNumber), SHIFT_Y(m_PlayerNumber) );
this->AddChild( &m_ContentsFrame );
}
void PaneDisplay::LoadFromNode( const XNode *pNode )
{
bool b;
RString sMetricsGroup;
b = pNode->GetAttrValue( "MetricsGroup", sMetricsGroup );
ASSERT( b );
Lua *L = LUA->Get();
b = pNode->PushAttrValue( L, "PlayerNumber" );
ASSERT( b );
PlayerNumber pn;
LuaHelpers::Pop( L, pn );
LUA->Release( L );
Load( sMetricsGroup, pn );
ActorFrame::LoadFromNode( pNode );
}
void PaneDisplay::GetPaneTextAndLevel( PaneCategory c, RString & sTextOut, float & fLevelOut )
{
const Song *pSong = GAMESTATE->m_pCurSong;
const Steps *pSteps = GAMESTATE->m_pCurSteps[m_PlayerNumber];
const Course *pCourse = GAMESTATE->m_pCurCourse;
const Trail *pTrail = GAMESTATE->m_pCurTrail[m_PlayerNumber];
const Profile *pProfile = PROFILEMAN->IsPersistentProfile(m_PlayerNumber) ? PROFILEMAN->GetProfile(m_PlayerNumber) : NULL;
bool bIsPlayerEdit = pSteps && pSteps->IsAPlayerEdit();
// Defaults, will be filled in later
sTextOut = NULL_COUNT_STRING;
fLevelOut = 0;
if(GAMESTATE->IsCourseMode() && !pTrail)
{
if( (g_Contents[c].req&NEED_PROFILE) )
sTextOut = NOT_AVAILABLE;
{
switch( c )
{
case PaneCategory_MachineHighName:
sTextOut = EMPTY_MACHINE_HIGH_SCORE_NAME;
break;
case PaneCategory_MachineHighScore:
case PaneCategory_ProfileHighScore:
sTextOut = NOT_AVAILABLE;
break;
default: break;
}
}
return;
}
else if(!GAMESTATE->IsCourseMode() && !pSong)
{
if( (g_Contents[c].req&NEED_PROFILE) )
sTextOut = NOT_AVAILABLE;
{
switch( c )
{
case PaneCategory_MachineHighName:
sTextOut = EMPTY_MACHINE_HIGH_SCORE_NAME;
break;
case PaneCategory_MachineHighScore:
case PaneCategory_ProfileHighScore:
sTextOut = NOT_AVAILABLE;
break;
default: break;
}
}
return;
}
if( (g_Contents[c].req&NEED_NOTES) && !pSteps && !pTrail )
return;
if( (g_Contents[c].req&NEED_PROFILE) && !pProfile )
{
sTextOut = NOT_AVAILABLE;
return;
}
{
RadarValues rv;
HighScoreList *pHSL = NULL;
ProfileSlot slot = ProfileSlot_Machine;
switch( c )
{
case PaneCategory_ProfileHighScore:
slot = (ProfileSlot) m_PlayerNumber;
default: break;
}
if( pSteps )
{
rv = pSteps->GetRadarValues( m_PlayerNumber );
pHSL = &PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSong, pSteps);
}
else if( pTrail )
{
rv = pTrail->GetRadarValues();
pHSL = &PROFILEMAN->GetProfile(slot)->GetCourseHighScoreList(pCourse, pTrail);
}
switch( c )
{
case PaneCategory_NumSteps: fLevelOut = rv[RadarCategory_TapsAndHolds]; break;
case PaneCategory_Jumps: fLevelOut = rv[RadarCategory_Jumps]; break;
case PaneCategory_Holds: fLevelOut = rv[RadarCategory_Holds]; break;
case PaneCategory_Rolls: fLevelOut = rv[RadarCategory_Rolls]; break;
case PaneCategory_Mines: fLevelOut = rv[RadarCategory_Mines]; break;
case PaneCategory_Hands: fLevelOut = rv[RadarCategory_Hands]; break;
case PaneCategory_Lifts: fLevelOut = rv[RadarCategory_Lifts]; break;
case PaneCategory_Fakes: fLevelOut = rv[RadarCategory_Fakes]; break;
case PaneCategory_ProfileHighScore:
case PaneCategory_MachineHighName: // set fLevelOut for color
case PaneCategory_MachineHighScore:
CHECKPOINT;
fLevelOut = pHSL->GetTopScore().GetPercentDP();
break;
default: break;
};
if( fLevelOut != RADAR_VAL_UNKNOWN )
{
switch( c )
{
case PaneCategory_MachineHighName:
if( pHSL->vHighScores.empty() )
{
sTextOut = EMPTY_MACHINE_HIGH_SCORE_NAME;
}
else
{
sTextOut = pHSL->GetTopScore().GetName();
if( sTextOut.empty() )
sTextOut = "????";
}
break;
case PaneCategory_MachineHighScore:
case PaneCategory_ProfileHighScore:
// Don't show or save machine high scores for edits loaded from a player profile.
if( bIsPlayerEdit )
sTextOut = NOT_AVAILABLE;
else
sTextOut = PlayerStageStats::FormatPercentScore( fLevelOut );
break;
case PaneCategory_NumSteps:
case PaneCategory_Jumps:
case PaneCategory_Holds:
case PaneCategory_Rolls:
case PaneCategory_Mines:
case PaneCategory_Hands:
case PaneCategory_Lifts:
case PaneCategory_Fakes:
sTextOut = ssprintf( COUNT_FORMAT.GetValue(), fLevelOut );
break;
default: break;
}
}
}
}
void PaneDisplay::SetContent( PaneCategory c )
{
// these get filled in later:
RString str;
float val;
GetPaneTextAndLevel( c, str, val );
m_textContents[c].SetText( str );
Lua *L = LUA->Get();
m_textContents[c].PushSelf( L );
lua_pushstring( L, "PaneLevel" );
lua_pushnumber( L, val );
lua_settable( L, -3 );
lua_pop( L, 1 );
m_textContents[c].PlayCommand( "Level" );
LUA->Release(L);
}
void PaneDisplay::SetFromGameState()
{
// Don't update text that doesn't apply to the current mode. It's still tweening off.
FOREACH_ENUM( PaneCategory, i )
SetContent( i );
}
// lua start
#include "LuaBinding.h"
/** @brief Allow Lua to have access to the PaneDisplay. */
class LunaPaneDisplay: public Luna<PaneDisplay>
{
public:
static int SetFromGameState( T* pc, lua_State *L ) { pc->SetFromGameState(); return 0; }
LunaPaneDisplay()
{
ADD_METHOD( SetFromGameState );
}
};
LUA_REGISTER_DERIVED_CLASS( PaneDisplay, ActorFrame )
// lua end
/*
* (c) 2003 Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "global.h"
#include "PaneDisplay.h"
#include "ThemeManager.h"
#include "GameState.h"
#include "Song.h"
#include "Steps.h"
#include "RageLog.h"
#include "ProfileManager.h"
#include "Profile.h"
#include "Course.h"
#include "Style.h"
#include "ActorUtil.h"
#include "LuaManager.h"
#include "XmlFile.h"
#include "PlayerStageStats.h"
#define SHIFT_X(pc) THEME->GetMetricF(sMetricsGroup, ssprintf("ShiftP%iX", pc+1))
#define SHIFT_Y(pc) THEME->GetMetricF(sMetricsGroup, ssprintf("ShiftP%iY", pc+1))
static const char *PaneCategoryNames[] = {
"NumSteps",
"Jumps",
"Holds",
"Rolls",
"Mines",
"Hands",
"Lifts",
"Fakes",
"MachineHighScore",
"MachineHighName",
"ProfileHighScore",
};
XToString( PaneCategory );
LuaXType( PaneCategory );
enum { NEED_NOTES=1, NEED_PROFILE=2 };
struct Content_t
{
int req;
RString sFontType;
};
static const Content_t g_Contents[NUM_PaneCategory] =
{
{ NEED_NOTES, "count" }, // NumSteps
{ NEED_NOTES, "count" }, // Jumps
{ NEED_NOTES, "count" }, // Holds
{ NEED_NOTES, "count" }, // Rolls
{ NEED_NOTES, "count" }, // Mines
{ NEED_NOTES, "count" }, // Hands
{ NEED_NOTES, "count" }, // Lifts
{ NEED_NOTES, "count" }, // Fakes
{ NEED_NOTES, "score" }, // MachineHighScore
{ NEED_NOTES, "name" }, // MachineHighName
{ NEED_NOTES|NEED_PROFILE, "score" }, // ProfileHighScore
};
REGISTER_ACTOR_CLASS( PaneDisplay );
void PaneDisplay::Load( const RString &sMetricsGroup, PlayerNumber pn )
{
m_PlayerNumber = pn;
EMPTY_MACHINE_HIGH_SCORE_NAME.Load( sMetricsGroup, "EmptyMachineHighScoreName" );
NOT_AVAILABLE.Load( sMetricsGroup, "NotAvailable" );
COUNT_FORMAT.Load( sMetricsGroup, "CountFormat" );
NULL_COUNT_STRING.Load( sMetricsGroup, "NullCountString" );
FOREACH_ENUM( PaneCategory, pc )
{
LuaThreadVariable var( "PaneCategory", LuaReference::Create(pc) );
RString sFontType = g_Contents[pc].sFontType;
m_textContents[pc].LoadFromFont( THEME->GetPathF(sMetricsGroup,sFontType) );
m_textContents[pc].SetName( PaneCategoryToString(pc) + "Text" );
ActorUtil::LoadAllCommands( m_textContents[pc], sMetricsGroup );
ActorUtil::SetXY( m_textContents[pc], sMetricsGroup );
m_ContentsFrame.AddChild( &m_textContents[pc] );
m_Labels[pc].Load( THEME->GetPathG(sMetricsGroup,"label " + PaneCategoryToString(pc)) );
m_Labels[pc]->SetName( PaneCategoryToString(pc) + "Label" );
ActorUtil::LoadAllCommands( *m_Labels[pc], sMetricsGroup );
ActorUtil::SetXY( m_Labels[pc], sMetricsGroup );
m_ContentsFrame.AddChild( m_Labels[pc] );
ActorUtil::LoadAllCommandsFromName( m_textContents[pc], sMetricsGroup, PaneCategoryToString(pc) );
}
m_ContentsFrame.SetXY( SHIFT_X(m_PlayerNumber), SHIFT_Y(m_PlayerNumber) );
this->AddChild( &m_ContentsFrame );
}
void PaneDisplay::LoadFromNode( const XNode *pNode )
{
bool b;
RString sMetricsGroup;
b = pNode->GetAttrValue( "MetricsGroup", sMetricsGroup );
ASSERT( b );
Lua *L = LUA->Get();
b = pNode->PushAttrValue( L, "PlayerNumber" );
ASSERT( b );
PlayerNumber pn;
LuaHelpers::Pop( L, pn );
LUA->Release( L );
Load( sMetricsGroup, pn );
ActorFrame::LoadFromNode( pNode );
}
void PaneDisplay::GetPaneTextAndLevel( PaneCategory c, RString & sTextOut, float & fLevelOut )
{
const Song *pSong = GAMESTATE->m_pCurSong;
const Steps *pSteps = GAMESTATE->m_pCurSteps[m_PlayerNumber];
const Course *pCourse = GAMESTATE->m_pCurCourse;
const Trail *pTrail = GAMESTATE->m_pCurTrail[m_PlayerNumber];
const Profile *pProfile = PROFILEMAN->IsPersistentProfile(m_PlayerNumber) ? PROFILEMAN->GetProfile(m_PlayerNumber) : NULL;
bool bIsPlayerEdit = pSteps && pSteps->IsAPlayerEdit();
// Defaults, will be filled in later
sTextOut = NULL_COUNT_STRING;
fLevelOut = 0;
if(GAMESTATE->IsCourseMode() && !pTrail)
{
if( (g_Contents[c].req&NEED_PROFILE) )
sTextOut = NOT_AVAILABLE;
{
switch( c )
{
case PaneCategory_MachineHighName:
sTextOut = EMPTY_MACHINE_HIGH_SCORE_NAME;
break;
case PaneCategory_MachineHighScore:
case PaneCategory_ProfileHighScore:
sTextOut = NOT_AVAILABLE;
break;
default: break;
}
}
return;
}
else if(!GAMESTATE->IsCourseMode() && !pSong)
{
if( (g_Contents[c].req&NEED_PROFILE) )
sTextOut = NOT_AVAILABLE;
{
switch( c )
{
case PaneCategory_MachineHighName:
sTextOut = EMPTY_MACHINE_HIGH_SCORE_NAME;
break;
case PaneCategory_MachineHighScore:
case PaneCategory_ProfileHighScore:
sTextOut = NOT_AVAILABLE;
break;
default: break;
}
}
return;
}
if( (g_Contents[c].req&NEED_NOTES) && !pSteps && !pTrail )
return;
if( (g_Contents[c].req&NEED_PROFILE) && !pProfile )
{
sTextOut = NOT_AVAILABLE;
return;
}
{
RadarValues rv;
HighScoreList *pHSL = NULL;
ProfileSlot slot = ProfileSlot_Machine;
switch( c )
{
case PaneCategory_ProfileHighScore:
slot = (ProfileSlot) m_PlayerNumber;
default: break;
}
if( pSteps )
{
rv = pSteps->GetRadarValues( m_PlayerNumber );
pHSL = &PROFILEMAN->GetProfile(slot)->GetStepsHighScoreList(pSong, pSteps);
}
else if( pTrail )
{
rv = pTrail->GetRadarValues();
pHSL = &PROFILEMAN->GetProfile(slot)->GetCourseHighScoreList(pCourse, pTrail);
}
switch( c )
{
case PaneCategory_NumSteps: fLevelOut = rv[RadarCategory_TapsAndHolds]; break;
case PaneCategory_Jumps: fLevelOut = rv[RadarCategory_Jumps]; break;
case PaneCategory_Holds: fLevelOut = rv[RadarCategory_Holds]; break;
case PaneCategory_Rolls: fLevelOut = rv[RadarCategory_Rolls]; break;
case PaneCategory_Mines: fLevelOut = rv[RadarCategory_Mines]; break;
case PaneCategory_Hands: fLevelOut = rv[RadarCategory_Hands]; break;
case PaneCategory_Lifts: fLevelOut = rv[RadarCategory_Lifts]; break;
case PaneCategory_Fakes: fLevelOut = rv[RadarCategory_Fakes]; break;
case PaneCategory_ProfileHighScore:
case PaneCategory_MachineHighName: // set fLevelOut for color
case PaneCategory_MachineHighScore:
CHECKPOINT;
fLevelOut = pHSL->GetTopScore().GetPercentDP();
break;
default: break;
};
if( fLevelOut != RADAR_VAL_UNKNOWN )
{
switch( c )
{
case PaneCategory_MachineHighName:
if( pHSL->vHighScores.empty() )
{
sTextOut = EMPTY_MACHINE_HIGH_SCORE_NAME;
}
else
{
sTextOut = pHSL->GetTopScore().GetName();
if( sTextOut.empty() )
sTextOut = "????";
}
break;
case PaneCategory_MachineHighScore:
case PaneCategory_ProfileHighScore:
// Don't show or save machine high scores for edits loaded from a player profile.
if( bIsPlayerEdit )
sTextOut = NOT_AVAILABLE;
else
sTextOut = PlayerStageStats::FormatPercentScore( fLevelOut );
break;
case PaneCategory_NumSteps:
case PaneCategory_Jumps:
case PaneCategory_Holds:
case PaneCategory_Rolls:
case PaneCategory_Mines:
case PaneCategory_Hands:
case PaneCategory_Lifts:
case PaneCategory_Fakes:
sTextOut = ssprintf( COUNT_FORMAT.GetValue(), fLevelOut );
break;
default: break;
}
}
}
}
void PaneDisplay::SetContent( PaneCategory c )
{
// these get filled in later:
RString str;
float val;
GetPaneTextAndLevel( c, str, val );
m_textContents[c].SetText( str );
Lua *L = LUA->Get();
m_textContents[c].PushSelf( L );
lua_pushstring( L, "PaneLevel" );
lua_pushnumber( L, val );
lua_settable( L, -3 );
lua_pop( L, 1 );
m_textContents[c].PlayCommand( "Level" );
LUA->Release(L);
}
void PaneDisplay::SetFromGameState()
{
// Don't update text that doesn't apply to the current mode. It's still tweening off.
FOREACH_ENUM( PaneCategory, i )
SetContent( i );
}
// lua start
#include "LuaBinding.h"
/** @brief Allow Lua to have access to the PaneDisplay. */
class LunaPaneDisplay: public Luna<PaneDisplay>
{
public:
static int SetFromGameState( T* pc, lua_State *L ) { pc->SetFromGameState(); return 0; }
LunaPaneDisplay()
{
ADD_METHOD( SetFromGameState );
}
};
LUA_REGISTER_DERIVED_CLASS( PaneDisplay, ActorFrame )
// lua end
/*
* (c) 2003 Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+1 -1
View File
@@ -7,7 +7,7 @@
#include "Course.h"
#include "Steps.h"
#include "ThemeManager.h"
#include "Foreach.h"
#include "Style.h"
#include "CommonMetrics.h"
#include <float.h>
+1 -1
View File
@@ -2,7 +2,7 @@
#include "PlayerStageStats.h"
#include "RageLog.h"
#include "ThemeManager.h"
#include "Foreach.h"
#include "LuaManager.h"
#include <float.h>
#include <numeric>
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
#include "PlayerState.h"
#include "Foreach.h"
#include "GameState.h"
#include "RageLog.h"
#include "RadarValues.h"
+1 -1
View File
@@ -5,7 +5,7 @@
#include "LuaManager.h"
#include "MessageManager.h"
#include "SubscriptionManager.h"
#include "Foreach.h"
static SubscriptionManager<IPreference> m_Subscribers;
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
#include "PrefsManager.h"
#include "Foreach.h"
#include "IniFile.h"
#include "LuaManager.h"
#include "Preference.h"
+1 -1
View File
@@ -20,7 +20,7 @@
#include "UnlockManager.h"
#include "XmlFile.h"
#include "XmlFileUtil.h"
#include "Foreach.h"
#include "Game.h"
#include "CharacterManager.h"
#include "Character.h"
+1 -1
View File
@@ -14,7 +14,7 @@ using namespace RageDisplay_Legacy_Helpers;
#include "RageTypes.h"
#include "RageUtil.h"
#include "EnumHelper.h"
#include "Foreach.h"
#include "DisplayResolutions.h"
#include "LocalizedString.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "RageFileDriverDirectHelpers.h"
#include "RageUtil.h"
#include "RageLog.h"
#include "Foreach.h"
#include <cerrno>
#include <sys/types.h>
+1 -1
View File
@@ -6,7 +6,7 @@
#include "RageUtil_FileDB.h"
#include "RageLog.h"
#include "RageThreads.h"
#include "Foreach.h"
#include "arch/ArchHooks/ArchHooks.h"
#include "LuaManager.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "RageInput.h"
#include "RageLog.h"
#include "arch/InputHandler/InputHandler.h"
#include "Foreach.h"
#include "Preference.h"
#include "LuaManager.h"
#include "LocalizedString.h"
+1 -1
View File
@@ -4,7 +4,7 @@
#include "global.h"
#include "RageInputDevice.h"
#include "RageUtil.h"
#include "Foreach.h"
#include "LocalizedString.h"
static const char *InputDeviceStateNames[] = {
+1 -1
View File
@@ -4,7 +4,7 @@
#include "RageTimer.h"
#include "RageFile.h"
#include "RageThreads.h"
#include "Foreach.h"
#include <ctime>
#if defined(_WINDOWS)
+1 -1
View File
@@ -15,7 +15,7 @@
#include "RageLog.h"
#include "RageTimer.h"
#include "RageSoundReader_Preload.h"
#include "Foreach.h"
#include "LocalizedString.h"
#include "Preference.h"
+1 -1
View File
@@ -3,7 +3,7 @@
#include "RageLog.h"
#include "RageUtil.h"
#include "RageTimer.h"
#include "Foreach.h"
#include <list>
+1 -1
View File
@@ -8,7 +8,7 @@
#include "RageUtil.h"
#include "RageSoundMixBuffer.h"
#include "RageSoundUtil.h"
#include "Foreach.h"
/*
* Keyed sounds should pass this object to SoundReader_Preload, to preprocess it.
+1 -1
View File
@@ -38,7 +38,7 @@
#include "RageUtil.h"
#include "RageSoundMixBuffer.h"
#include "RageSoundUtil.h"
#include "Foreach.h"
#include <set>
class RageSoundReader_Split;
+1 -1
View File
@@ -6,7 +6,7 @@
#include "RageUtil.h"
#include "RageSoundMixBuffer.h"
#include "RageSoundUtil.h"
#include "Foreach.h"
RageSoundReader_Merge::RageSoundReader_Merge()
{
+377 -377
View File
@@ -1,377 +1,377 @@
#include "global.h"
#include "RageSoundReader_ThreadedBuffer.h"
#include "RageUtil.h"
#include "RageTimer.h"
#include "Foreach.h"
#include "RageLog.h"
#if !defined(_WINDOWS)
#include <unistd.h>
#endif
/* Implement threaded read-ahead buffering.
*
* If a buffer is low on data, keep filling until it has a g_iMinFillFrames.
* Once beyond that, fill at a rate relative to realtime.
*
* This allows a stream to have a large buffer, for higher reliability, without
* causing major CPU bursts when the stream starts or underruns. Filling 32k
* takes more CPU than filling 4k frames, and may cause a skip. */
// The amount of data to read at once:
static const unsigned g_iReadBlockSizeFrames = 1024;
// The maximum number of frames to buffer:
static const int g_iStreamingBufferFrames = 1024*32;
/* When a sound has fewer than g_iMinFillFrames buffered, buffer at maximum speed.
* Once beyond that, fill at a limited rate. */
static const int g_iMinFillFrames = 1024*4;
RageSoundReader_ThreadedBuffer::RageSoundReader_ThreadedBuffer( RageSoundReader *pSource ):
RageSoundReader_Filter( pSource ),
m_Event( "ThreadedBuffer" )
{
m_iSampleRate = pSource->GetSampleRate();
m_iChannels = pSource->GetNumChannels();
int iFrameSize = sizeof(float) * this->GetNumChannels();
m_DataBuffer.reserve( g_iStreamingBufferFrames * iFrameSize, iFrameSize );
m_bEOF = false;
m_bShutdownThread = false;
m_bEnabled = false;
m_bFilling = false;
m_StreamPosition.push_back( Mapping() );
m_StreamPosition.back().iPositionOfFirstFrame = pSource->GetNextSourceFrame();
m_StreamPosition.back().fRate = pSource->GetStreamToSourceRatio();
m_Thread.SetName( "Streaming sound buffering" );
m_Thread.Create( StartBufferingThread, this );
}
RageSoundReader_ThreadedBuffer::RageSoundReader_ThreadedBuffer( const RageSoundReader_ThreadedBuffer &cpy ):
RageSoundReader_Filter( NULL ), // don't touch m_pSource before DisableBuffering
m_Event( "ThreadedBuffer" )
{
bool bWasEnabled = cpy.DisableBuffering();
m_pSource = cpy.m_pSource->Copy();
m_iSampleRate = cpy.m_iSampleRate;
m_iChannels = cpy.m_iChannels;
m_DataBuffer = cpy.m_DataBuffer;
m_bEOF = cpy.m_bEOF;
m_bShutdownThread = cpy.m_bShutdownThread;
m_bEnabled = cpy.m_bEnabled;
m_bFilling = cpy.m_bFilling;
m_StreamPosition = cpy.m_StreamPosition;
m_Thread.Create( StartBufferingThread, this );
if( bWasEnabled )
{
cpy.EnableBuffering();
EnableBuffering();
}
}
RageSoundReader_ThreadedBuffer::~RageSoundReader_ThreadedBuffer()
{
DisableBuffering();
m_Event.Lock();
m_bShutdownThread = true;
m_Event.Broadcast();
m_Event.Unlock();
m_Thread.Wait();
}
void RageSoundReader_ThreadedBuffer::EnableBuffering()
{
m_Event.Lock();
m_bEnabled = true;
m_Event.Broadcast();
m_Event.Unlock();
}
bool RageSoundReader_ThreadedBuffer::DisableBuffering()
{
m_Event.Lock();
bool bRet = m_bEnabled;
m_bEnabled = false;
m_Event.Broadcast();
while( m_bFilling )
m_Event.Wait();
m_Event.Unlock();
return bRet;
}
void RageSoundReader_ThreadedBuffer::WaitUntilFrames( int iWaitUntilFrames )
{
m_Event.Lock();
ASSERT( m_bEnabled );
while( GetFilledFrames() < iWaitUntilFrames )
m_Event.Wait();
m_Event.Unlock();
}
int RageSoundReader_ThreadedBuffer::SetPosition( int iFrame )
{
bool bWasEnabled = DisableBuffering();
m_DataBuffer.clear();
int iRet = RageSoundReader_Filter::SetPosition( iFrame );
m_StreamPosition.clear();
m_StreamPosition.push_back( Mapping() );
m_StreamPosition.back().iPositionOfFirstFrame = iFrame;
m_bEOF = iRet == 0;
if( bWasEnabled )
EnableBuffering();
return iRet;
}
int RageSoundReader_ThreadedBuffer::GetEmptyFrames() const
{
int iSamplesPerFrame = this->GetNumChannels();
if( g_iReadBlockSizeFrames * iSamplesPerFrame > m_DataBuffer.num_writable() )
return 0;
return m_DataBuffer.num_writable() / iSamplesPerFrame;
}
int RageSoundReader_ThreadedBuffer::GetFilledFrames() const
{
int iSamplesPerFrame = this->GetNumChannels();
return m_DataBuffer.num_readable() / iSamplesPerFrame;
}
int RageSoundReader_ThreadedBuffer::GetNextSourceFrame() const
{
m_Event.Lock();
int iRet = m_StreamPosition.front().iPositionOfFirstFrame;
m_Event.Unlock();
return iRet;
}
float RageSoundReader_ThreadedBuffer::GetStreamToSourceRatio() const
{
m_Event.Lock();
float fRet = m_StreamPosition.front().fRate;
m_Event.Unlock();
return fRet;
}
int RageSoundReader_ThreadedBuffer::GetLength() const
{
bool bWasEnabled = DisableBuffering();
int iRet = m_pSource->GetLength();
if( bWasEnabled )
EnableBuffering();
return iRet;
}
int RageSoundReader_ThreadedBuffer::GetLength_Fast() const
{
bool bWasEnabled = DisableBuffering();
int iRet = m_pSource->GetLength_Fast();
if( bWasEnabled )
EnableBuffering();
return iRet;
}
bool RageSoundReader_ThreadedBuffer::SetProperty( const RString &sProperty, float fValue )
{
return m_pSource->SetProperty( sProperty, fValue );
}
void RageSoundReader_ThreadedBuffer::BufferingThread()
{
m_Event.Lock();
while( !m_bShutdownThread )
{
if( !m_bEnabled )
{
m_Event.Wait();
continue;
}
// Fill some data.
m_bFilling = true;
int iFramesToFill = g_iReadBlockSizeFrames;
if( GetFilledFrames() < g_iMinFillFrames )
iFramesToFill = max( iFramesToFill, g_iMinFillFrames - GetFilledFrames() );
int iRet = FillFrames( iFramesToFill );
// Release m_bFilling, and signal the event to wake anyone waiting for it.
m_bFilling = false;
m_Event.Broadcast();
// On error or end of file, stop buffering the sound.
if( iRet < 0 )
{
m_bEnabled = false;
continue;
}
/* Sleep proportionately to the amount of data we buffered, so we
* fill at a reasonable pace. */
float fTimeFilled = float(g_iReadBlockSizeFrames) / m_iSampleRate;
float fTimeToSleep = fTimeFilled / 2;
if( fTimeToSleep == 0 )
fTimeToSleep = float(g_iReadBlockSizeFrames) / m_iSampleRate;
if( m_Event.WaitTimeoutSupported() )
{
RageTimer time;
time.Touch();
time += fTimeToSleep;
m_Event.Wait( &time );
}
else
{
m_Event.Unlock();
usleep( lrintf(fTimeToSleep * 1000000) );
m_Event.Lock();
}
}
m_Event.Unlock();
}
int RageSoundReader_ThreadedBuffer::FillFrames( int iFrames )
{
int iFramesFilled = 0;
while( iFramesFilled < iFrames )
{
int iRet = FillBlock();
if( iRet == 0 )
break;
// On error or end of file, stop buffering the sound.
if( iRet < 0 )
return iRet;
iFramesFilled += iRet;
}
return iFramesFilled;
}
int RageSoundReader_ThreadedBuffer::FillBlock()
{
if( GetEmptyFrames() == 0 )
return 0;
int iSamplesPerFrame = this->GetNumChannels();
ASSERT( g_iReadBlockSizeFrames * iSamplesPerFrame <= m_DataBuffer.num_writable() );
int iGotFrames;
int iNextSourceFrame = 0;
float fRate = 0;
m_Event.Unlock();
{
// We own m_pSource, even after unlocking, because m_bFilling is true.
unsigned iBufSize;
float *pBuf = m_DataBuffer.get_write_pointer( &iBufSize );
ASSERT( (iBufSize % iSamplesPerFrame) == 0 );
iGotFrames = m_pSource->RetriedRead( pBuf, min(g_iReadBlockSizeFrames, iBufSize / iSamplesPerFrame), &iNextSourceFrame, &fRate );
}
m_Event.Lock();
if( iGotFrames > 0 )
{
// Add the data to the buffer.
m_DataBuffer.advance_write_pointer( iGotFrames * iSamplesPerFrame );
if( iNextSourceFrame != m_StreamPosition.back().iPositionOfFirstFrame + m_StreamPosition.back().iFramesBuffered ||
fRate != m_StreamPosition.back().fRate )
{
m_StreamPosition.push_back( Mapping() );
m_StreamPosition.back().iPositionOfFirstFrame = iNextSourceFrame;
m_StreamPosition.back().fRate = fRate;
}
m_StreamPosition.back().iFramesBuffered += iGotFrames;
}
m_bEOF = (iGotFrames == END_OF_FILE);
return iGotFrames;
}
int RageSoundReader_ThreadedBuffer::Read( float *pBuffer, int iFrames )
{
if( !m_bEOF )
EnableBuffering();
m_Event.Lock();
{
/* Delete any empty mappings from the beginning, but don't empty the list,
* so we always have the current position and rate. If we delete an item,
* the rate or position has probably changed, so return. */
list<Mapping>::iterator it = m_StreamPosition.begin();
++it;
if( it != m_StreamPosition.end() && !m_StreamPosition.front().iFramesBuffered )
{
++it;
m_StreamPosition.pop_front();
m_Event.Unlock();
return 0;
}
}
int iRet;
if( m_StreamPosition.front().iFramesBuffered )
{
Mapping &pos = m_StreamPosition.front();
int iFramesToRead = min( iFrames, pos.iFramesBuffered );
int iSamplesPerFrame = this->GetNumChannels();
m_DataBuffer.read( pBuffer, iFramesToRead * iSamplesPerFrame );
pos.iPositionOfFirstFrame += iFramesToRead;
pos.iFramesBuffered -= iFramesToRead;
iRet = iFramesToRead;
}
else if( m_bEOF )
iRet = END_OF_FILE;
else
iRet = WOULD_BLOCK;
m_Event.Unlock();
return iRet;
}
/*
* Copyright (c) 2006 Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "global.h"
#include "RageSoundReader_ThreadedBuffer.h"
#include "RageUtil.h"
#include "RageTimer.h"
#include "RageLog.h"
#if !defined(_WINDOWS)
#include <unistd.h>
#endif
/* Implement threaded read-ahead buffering.
*
* If a buffer is low on data, keep filling until it has a g_iMinFillFrames.
* Once beyond that, fill at a rate relative to realtime.
*
* This allows a stream to have a large buffer, for higher reliability, without
* causing major CPU bursts when the stream starts or underruns. Filling 32k
* takes more CPU than filling 4k frames, and may cause a skip. */
// The amount of data to read at once:
static const unsigned g_iReadBlockSizeFrames = 1024;
// The maximum number of frames to buffer:
static const int g_iStreamingBufferFrames = 1024*32;
/* When a sound has fewer than g_iMinFillFrames buffered, buffer at maximum speed.
* Once beyond that, fill at a limited rate. */
static const int g_iMinFillFrames = 1024*4;
RageSoundReader_ThreadedBuffer::RageSoundReader_ThreadedBuffer( RageSoundReader *pSource ):
RageSoundReader_Filter( pSource ),
m_Event( "ThreadedBuffer" )
{
m_iSampleRate = pSource->GetSampleRate();
m_iChannels = pSource->GetNumChannels();
int iFrameSize = sizeof(float) * this->GetNumChannels();
m_DataBuffer.reserve( g_iStreamingBufferFrames * iFrameSize, iFrameSize );
m_bEOF = false;
m_bShutdownThread = false;
m_bEnabled = false;
m_bFilling = false;
m_StreamPosition.push_back( Mapping() );
m_StreamPosition.back().iPositionOfFirstFrame = pSource->GetNextSourceFrame();
m_StreamPosition.back().fRate = pSource->GetStreamToSourceRatio();
m_Thread.SetName( "Streaming sound buffering" );
m_Thread.Create( StartBufferingThread, this );
}
RageSoundReader_ThreadedBuffer::RageSoundReader_ThreadedBuffer( const RageSoundReader_ThreadedBuffer &cpy ):
RageSoundReader_Filter( NULL ), // don't touch m_pSource before DisableBuffering
m_Event( "ThreadedBuffer" )
{
bool bWasEnabled = cpy.DisableBuffering();
m_pSource = cpy.m_pSource->Copy();
m_iSampleRate = cpy.m_iSampleRate;
m_iChannels = cpy.m_iChannels;
m_DataBuffer = cpy.m_DataBuffer;
m_bEOF = cpy.m_bEOF;
m_bShutdownThread = cpy.m_bShutdownThread;
m_bEnabled = cpy.m_bEnabled;
m_bFilling = cpy.m_bFilling;
m_StreamPosition = cpy.m_StreamPosition;
m_Thread.Create( StartBufferingThread, this );
if( bWasEnabled )
{
cpy.EnableBuffering();
EnableBuffering();
}
}
RageSoundReader_ThreadedBuffer::~RageSoundReader_ThreadedBuffer()
{
DisableBuffering();
m_Event.Lock();
m_bShutdownThread = true;
m_Event.Broadcast();
m_Event.Unlock();
m_Thread.Wait();
}
void RageSoundReader_ThreadedBuffer::EnableBuffering()
{
m_Event.Lock();
m_bEnabled = true;
m_Event.Broadcast();
m_Event.Unlock();
}
bool RageSoundReader_ThreadedBuffer::DisableBuffering()
{
m_Event.Lock();
bool bRet = m_bEnabled;
m_bEnabled = false;
m_Event.Broadcast();
while( m_bFilling )
m_Event.Wait();
m_Event.Unlock();
return bRet;
}
void RageSoundReader_ThreadedBuffer::WaitUntilFrames( int iWaitUntilFrames )
{
m_Event.Lock();
ASSERT( m_bEnabled );
while( GetFilledFrames() < iWaitUntilFrames )
m_Event.Wait();
m_Event.Unlock();
}
int RageSoundReader_ThreadedBuffer::SetPosition( int iFrame )
{
bool bWasEnabled = DisableBuffering();
m_DataBuffer.clear();
int iRet = RageSoundReader_Filter::SetPosition( iFrame );
m_StreamPosition.clear();
m_StreamPosition.push_back( Mapping() );
m_StreamPosition.back().iPositionOfFirstFrame = iFrame;
m_bEOF = iRet == 0;
if( bWasEnabled )
EnableBuffering();
return iRet;
}
int RageSoundReader_ThreadedBuffer::GetEmptyFrames() const
{
int iSamplesPerFrame = this->GetNumChannels();
if( g_iReadBlockSizeFrames * iSamplesPerFrame > m_DataBuffer.num_writable() )
return 0;
return m_DataBuffer.num_writable() / iSamplesPerFrame;
}
int RageSoundReader_ThreadedBuffer::GetFilledFrames() const
{
int iSamplesPerFrame = this->GetNumChannels();
return m_DataBuffer.num_readable() / iSamplesPerFrame;
}
int RageSoundReader_ThreadedBuffer::GetNextSourceFrame() const
{
m_Event.Lock();
int iRet = m_StreamPosition.front().iPositionOfFirstFrame;
m_Event.Unlock();
return iRet;
}
float RageSoundReader_ThreadedBuffer::GetStreamToSourceRatio() const
{
m_Event.Lock();
float fRet = m_StreamPosition.front().fRate;
m_Event.Unlock();
return fRet;
}
int RageSoundReader_ThreadedBuffer::GetLength() const
{
bool bWasEnabled = DisableBuffering();
int iRet = m_pSource->GetLength();
if( bWasEnabled )
EnableBuffering();
return iRet;
}
int RageSoundReader_ThreadedBuffer::GetLength_Fast() const
{
bool bWasEnabled = DisableBuffering();
int iRet = m_pSource->GetLength_Fast();
if( bWasEnabled )
EnableBuffering();
return iRet;
}
bool RageSoundReader_ThreadedBuffer::SetProperty( const RString &sProperty, float fValue )
{
return m_pSource->SetProperty( sProperty, fValue );
}
void RageSoundReader_ThreadedBuffer::BufferingThread()
{
m_Event.Lock();
while( !m_bShutdownThread )
{
if( !m_bEnabled )
{
m_Event.Wait();
continue;
}
// Fill some data.
m_bFilling = true;
int iFramesToFill = g_iReadBlockSizeFrames;
if( GetFilledFrames() < g_iMinFillFrames )
iFramesToFill = max( iFramesToFill, g_iMinFillFrames - GetFilledFrames() );
int iRet = FillFrames( iFramesToFill );
// Release m_bFilling, and signal the event to wake anyone waiting for it.
m_bFilling = false;
m_Event.Broadcast();
// On error or end of file, stop buffering the sound.
if( iRet < 0 )
{
m_bEnabled = false;
continue;
}
/* Sleep proportionately to the amount of data we buffered, so we
* fill at a reasonable pace. */
float fTimeFilled = float(g_iReadBlockSizeFrames) / m_iSampleRate;
float fTimeToSleep = fTimeFilled / 2;
if( fTimeToSleep == 0 )
fTimeToSleep = float(g_iReadBlockSizeFrames) / m_iSampleRate;
if( m_Event.WaitTimeoutSupported() )
{
RageTimer time;
time.Touch();
time += fTimeToSleep;
m_Event.Wait( &time );
}
else
{
m_Event.Unlock();
usleep( lrintf(fTimeToSleep * 1000000) );
m_Event.Lock();
}
}
m_Event.Unlock();
}
int RageSoundReader_ThreadedBuffer::FillFrames( int iFrames )
{
int iFramesFilled = 0;
while( iFramesFilled < iFrames )
{
int iRet = FillBlock();
if( iRet == 0 )
break;
// On error or end of file, stop buffering the sound.
if( iRet < 0 )
return iRet;
iFramesFilled += iRet;
}
return iFramesFilled;
}
int RageSoundReader_ThreadedBuffer::FillBlock()
{
if( GetEmptyFrames() == 0 )
return 0;
int iSamplesPerFrame = this->GetNumChannels();
ASSERT( g_iReadBlockSizeFrames * iSamplesPerFrame <= m_DataBuffer.num_writable() );
int iGotFrames;
int iNextSourceFrame = 0;
float fRate = 0;
m_Event.Unlock();
{
// We own m_pSource, even after unlocking, because m_bFilling is true.
unsigned iBufSize;
float *pBuf = m_DataBuffer.get_write_pointer( &iBufSize );
ASSERT( (iBufSize % iSamplesPerFrame) == 0 );
iGotFrames = m_pSource->RetriedRead( pBuf, min(g_iReadBlockSizeFrames, iBufSize / iSamplesPerFrame), &iNextSourceFrame, &fRate );
}
m_Event.Lock();
if( iGotFrames > 0 )
{
// Add the data to the buffer.
m_DataBuffer.advance_write_pointer( iGotFrames * iSamplesPerFrame );
if( iNextSourceFrame != m_StreamPosition.back().iPositionOfFirstFrame + m_StreamPosition.back().iFramesBuffered ||
fRate != m_StreamPosition.back().fRate )
{
m_StreamPosition.push_back( Mapping() );
m_StreamPosition.back().iPositionOfFirstFrame = iNextSourceFrame;
m_StreamPosition.back().fRate = fRate;
}
m_StreamPosition.back().iFramesBuffered += iGotFrames;
}
m_bEOF = (iGotFrames == END_OF_FILE);
return iGotFrames;
}
int RageSoundReader_ThreadedBuffer::Read( float *pBuffer, int iFrames )
{
if( !m_bEOF )
EnableBuffering();
m_Event.Lock();
{
/* Delete any empty mappings from the beginning, but don't empty the list,
* so we always have the current position and rate. If we delete an item,
* the rate or position has probably changed, so return. */
list<Mapping>::iterator it = m_StreamPosition.begin();
++it;
if( it != m_StreamPosition.end() && !m_StreamPosition.front().iFramesBuffered )
{
++it;
m_StreamPosition.pop_front();
m_Event.Unlock();
return 0;
}
}
int iRet;
if( m_StreamPosition.front().iFramesBuffered )
{
Mapping &pos = m_StreamPosition.front();
int iFramesToRead = min( iFrames, pos.iFramesBuffered );
int iSamplesPerFrame = this->GetNumChannels();
m_DataBuffer.read( pBuffer, iFramesToRead * iSamplesPerFrame );
pos.iPositionOfFirstFrame += iFramesToRead;
pos.iFramesBuffered -= iFramesToRead;
iRet = iFramesToRead;
}
else if( m_bEOF )
iRet = END_OF_FILE;
else
iRet = WOULD_BLOCK;
m_Event.Unlock();
return iRet;
}
/*
* Copyright (c) 2006 Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+1 -1
View File
@@ -25,7 +25,7 @@
#include "RageUtil.h"
#include "RageLog.h"
#include "RageDisplay.h"
#include "Foreach.h"
#include <map>
+1 -1
View File
@@ -3,7 +3,7 @@
#include "RageMath.h"
#include "RageLog.h"
#include "RageFile.h"
#include "Foreach.h"
#include "LocalizedString.h"
#include "LuaBinding.h"
#include "LuaManager.h"
+223 -223
View File
@@ -1,223 +1,223 @@
#include "global.h"
#if !defined(WITHOUT_NETWORKING)
#include "RoomInfoDisplay.h"
#include "ActorUtil.h"
#include "NetworkSyncManager.h"
#include "LocalizedString.h"
AutoScreenMessage( SM_RoomInfoRetract );
AutoScreenMessage( SM_RoomInfoDeploy );
static LocalizedString LAST_ROUND_INFO ( "RoomInfoDisplay", "Last Round Info:" );
static LocalizedString ROOM_NAME ( "RoomInfoDisplay", "Room Name:" );
static LocalizedString ROOM_DESC ( "RoomInfoDisplay", "Room Description:" );
static LocalizedString SONG_TITLE( "RoomInfoDisplay", "Song Title:" );
static LocalizedString SONG_SUB_TITLE( "RoomInfoDisplay", "Song Subtitle:" );
static LocalizedString SONG_ARTIST( "RoomInfoDisplay", "Song Artist:" );
static LocalizedString PLAYERS( "RoomInfoDisplay", "Players" );
RoomInfoDisplay::RoomInfoDisplay() :
m_state( OPEN )
{
//No code
}
RoomInfoDisplay::~RoomInfoDisplay()
{
for (size_t i = 0; i < m_playerList.size(); i++)
{
this->RemoveChild(m_playerList[i]);
SAFE_DELETE(m_playerList[i]);
}
}
void RoomInfoDisplay::DeployInfoBox()
{
if (m_state == CLOSED)
{
ON_COMMAND( this );
m_state = OPEN;
}
}
void RoomInfoDisplay::RetractInfoBox()
{
if (m_state == OPEN)
OFF_COMMAND( this );
m_state = LOCKED;
}
void RoomInfoDisplay::Load( RString sType )
{
DEPLOY_DELAY.Load( sType, "DeployDelay" );
RETRACT_DELAY.Load( sType, "RetractDelay" );
PLAYERLISTX.Load( sType, "PlayerListElementX" );
PLAYERLISTY.Load( sType, "PlayerListElementY" );
PLAYERLISTOFFSETX.Load( sType, "PlayerListElementOffsetX" );
PLAYERLISTOFFSETY.Load( sType, "PlayerListElementOffsetY" );
m_bg.Load( THEME->GetPathG(m_sName,"Background") );
m_bg->SetName( "Background" );
this->AddChild( m_bg );
m_Title.LoadFromFont( THEME->GetPathF(sType,"text") );
m_Title.SetName( "RoomTitle" );
m_Title.SetShadowLength( 0 );
m_Title.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_Title );
ON_COMMAND( m_Title );
this->AddChild( &m_Title );
m_Desc.LoadFromFont( THEME->GetPathF(sType,"text") );
m_Desc.SetName( "RoomDesc" );
m_Desc.SetShadowLength( 0 );
m_Desc.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_Desc );
ON_COMMAND( m_Desc );
this->AddChild( &m_Desc );
m_lastRound.LoadFromFont( THEME->GetPathF(sType,"text") );
m_lastRound.SetName( "LastRound" );
m_lastRound.SetText( LAST_ROUND_INFO.GetValue() );
m_lastRound.SetShadowLength( 0 );
m_lastRound.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_lastRound );
ON_COMMAND( m_lastRound );
this->AddChild( &m_lastRound );
m_songTitle.LoadFromFont( THEME->GetPathF(sType,"text") );
m_songTitle.SetName( "SongTitle" );
m_songTitle.SetShadowLength( 0 );
m_songTitle.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_songTitle );
ON_COMMAND( m_songTitle );
this->AddChild( &m_songTitle );
m_songSub.LoadFromFont( THEME->GetPathF(sType,"text") );
m_songSub.SetName( "SongSubTitle" );
m_songSub.SetShadowLength( 0 );
m_songSub.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_songSub );
ON_COMMAND( m_songSub );
this->AddChild( &m_songSub );
m_songArtist.LoadFromFont( THEME->GetPathF(sType,"text") );
m_songArtist.SetName( "SongArtist" );
m_songArtist.SetShadowLength( 0 );
m_songArtist.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_songArtist );
ON_COMMAND( m_songArtist );
this->AddChild( &m_songArtist );
m_players.LoadFromFont( THEME->GetPathF(sType,"text") );
m_players.SetName( "Players" );
m_players.SetShadowLength( 0 );
m_players.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_players );
ON_COMMAND( m_players );
this->AddChild( &m_players );
LOAD_ALL_COMMANDS( this );
this->PlayCommand("Off");
FinishTweening();
m_state = LOCKED;
}
void RoomInfoDisplay::SetRoom( const RoomWheelItemData* roomData )
{
RequestRoomInfo(roomData->m_sText);
m_Title.SetText( ROOM_NAME.GetValue() + roomData->m_sText );
m_Desc.SetText( ROOM_DESC.GetValue() + roomData->m_sDesc );
}
void RoomInfoDisplay::Update( float fDeltaTime )
{
if ((m_deployDelay.PeekDeltaTime() >= DEPLOY_DELAY) && (m_deployDelay.PeekDeltaTime() < (DEPLOY_DELAY + RETRACT_DELAY)))
DeployInfoBox();
else if (m_deployDelay.PeekDeltaTime() >= DEPLOY_DELAY + RETRACT_DELAY)
RetractInfoBox();
ActorFrame::Update(fDeltaTime);
}
void RoomInfoDisplay::RequestRoomInfo(const RString& name)
{
NSMAN->m_SMOnlinePacket.ClearPacket();
NSMAN->m_SMOnlinePacket.Write1((uint8_t)3); //Request Room Info
NSMAN->m_SMOnlinePacket.WriteNT(name);
NSMAN->SendSMOnline( );
}
void RoomInfoDisplay::SetRoomInfo( const RoomInfo& info)
{
m_songTitle.SetText( SONG_TITLE.GetValue() + info.songTitle );
m_songSub.SetText( SONG_SUB_TITLE.GetValue() + info.songSubTitle );
m_songArtist.SetText( SONG_ARTIST.GetValue() + info.songArtist );
m_players.SetText(ssprintf("%s (%d/%d):", PLAYERS.GetValue().c_str(), info.numPlayers, info.maxPlayers));
if (m_playerList.size() > info.players.size())
{
for (size_t i = info.players.size(); i < m_playerList.size(); i++)
{
//if our old list is larger remove some elements
this->RemoveChild(m_playerList[i]);
SAFE_DELETE(m_playerList[i]);
}
m_playerList.resize(info.players.size());
}
else if (m_playerList.size() < info.players.size())
{
//add elements if our old list is smaller
int oldsize = m_playerList.size();
m_playerList.resize(info.players.size());
for (size_t i = oldsize; i < m_playerList.size(); i++)
{
m_playerList[i] = new BitmapText;
m_playerList[i]->LoadFromFont( THEME->GetPathF(GetName(),"text") );
m_playerList[i]->SetName("PlayerListElement");
m_playerList[i]->SetHorizAlign( align_left );
m_playerList[i]->SetX(PLAYERLISTX + (i * PLAYERLISTOFFSETX));
m_playerList[i]->SetY(PLAYERLISTY + (i * PLAYERLISTOFFSETY));
LOAD_ALL_COMMANDS(m_playerList[i]);
ON_COMMAND(m_playerList[i]);
this->AddChild(m_playerList[i]);
}
}
for (size_t i = 0; i < m_playerList.size(); i++)
m_playerList[i]->SetText(info.players[i]);
m_state = CLOSED;
m_deployDelay.Touch();
}
#endif
/*
* (c) 2006 Josh Allen
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "global.h"
#if !defined(WITHOUT_NETWORKING)
#include "RoomInfoDisplay.h"
#include "ActorUtil.h"
#include "NetworkSyncManager.h"
#include "LocalizedString.h"
AutoScreenMessage( SM_RoomInfoRetract );
AutoScreenMessage( SM_RoomInfoDeploy );
static LocalizedString LAST_ROUND_INFO ( "RoomInfoDisplay", "Last Round Info:" );
static LocalizedString ROOM_NAME ( "RoomInfoDisplay", "Room Name:" );
static LocalizedString ROOM_DESC ( "RoomInfoDisplay", "Room Description:" );
static LocalizedString SONG_TITLE( "RoomInfoDisplay", "Song Title:" );
static LocalizedString SONG_SUB_TITLE( "RoomInfoDisplay", "Song Subtitle:" );
static LocalizedString SONG_ARTIST( "RoomInfoDisplay", "Song Artist:" );
static LocalizedString PLAYERS( "RoomInfoDisplay", "Players" );
RoomInfoDisplay::RoomInfoDisplay() :
m_state( OPEN )
{
//No code
}
RoomInfoDisplay::~RoomInfoDisplay()
{
for (size_t i = 0; i < m_playerList.size(); i++)
{
this->RemoveChild(m_playerList[i]);
SAFE_DELETE(m_playerList[i]);
}
}
void RoomInfoDisplay::DeployInfoBox()
{
if (m_state == CLOSED)
{
ON_COMMAND( this );
m_state = OPEN;
}
}
void RoomInfoDisplay::RetractInfoBox()
{
if (m_state == OPEN)
OFF_COMMAND( this );
m_state = LOCKED;
}
void RoomInfoDisplay::Load( RString sType )
{
DEPLOY_DELAY.Load( sType, "DeployDelay" );
RETRACT_DELAY.Load( sType, "RetractDelay" );
PLAYERLISTX.Load( sType, "PlayerListElementX" );
PLAYERLISTY.Load( sType, "PlayerListElementY" );
PLAYERLISTOFFSETX.Load( sType, "PlayerListElementOffsetX" );
PLAYERLISTOFFSETY.Load( sType, "PlayerListElementOffsetY" );
m_bg.Load( THEME->GetPathG(m_sName,"Background") );
m_bg->SetName( "Background" );
this->AddChild( m_bg );
m_Title.LoadFromFont( THEME->GetPathF(sType,"text") );
m_Title.SetName( "RoomTitle" );
m_Title.SetShadowLength( 0 );
m_Title.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_Title );
ON_COMMAND( m_Title );
this->AddChild( &m_Title );
m_Desc.LoadFromFont( THEME->GetPathF(sType,"text") );
m_Desc.SetName( "RoomDesc" );
m_Desc.SetShadowLength( 0 );
m_Desc.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_Desc );
ON_COMMAND( m_Desc );
this->AddChild( &m_Desc );
m_lastRound.LoadFromFont( THEME->GetPathF(sType,"text") );
m_lastRound.SetName( "LastRound" );
m_lastRound.SetText( LAST_ROUND_INFO.GetValue() );
m_lastRound.SetShadowLength( 0 );
m_lastRound.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_lastRound );
ON_COMMAND( m_lastRound );
this->AddChild( &m_lastRound );
m_songTitle.LoadFromFont( THEME->GetPathF(sType,"text") );
m_songTitle.SetName( "SongTitle" );
m_songTitle.SetShadowLength( 0 );
m_songTitle.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_songTitle );
ON_COMMAND( m_songTitle );
this->AddChild( &m_songTitle );
m_songSub.LoadFromFont( THEME->GetPathF(sType,"text") );
m_songSub.SetName( "SongSubTitle" );
m_songSub.SetShadowLength( 0 );
m_songSub.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_songSub );
ON_COMMAND( m_songSub );
this->AddChild( &m_songSub );
m_songArtist.LoadFromFont( THEME->GetPathF(sType,"text") );
m_songArtist.SetName( "SongArtist" );
m_songArtist.SetShadowLength( 0 );
m_songArtist.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_songArtist );
ON_COMMAND( m_songArtist );
this->AddChild( &m_songArtist );
m_players.LoadFromFont( THEME->GetPathF(sType,"text") );
m_players.SetName( "Players" );
m_players.SetShadowLength( 0 );
m_players.SetHorizAlign( align_left );
LOAD_ALL_COMMANDS( m_players );
ON_COMMAND( m_players );
this->AddChild( &m_players );
LOAD_ALL_COMMANDS( this );
this->PlayCommand("Off");
FinishTweening();
m_state = LOCKED;
}
void RoomInfoDisplay::SetRoom( const RoomWheelItemData* roomData )
{
RequestRoomInfo(roomData->m_sText);
m_Title.SetText( ROOM_NAME.GetValue() + roomData->m_sText );
m_Desc.SetText( ROOM_DESC.GetValue() + roomData->m_sDesc );
}
void RoomInfoDisplay::Update( float fDeltaTime )
{
if ((m_deployDelay.PeekDeltaTime() >= DEPLOY_DELAY) && (m_deployDelay.PeekDeltaTime() < (DEPLOY_DELAY + RETRACT_DELAY)))
DeployInfoBox();
else if (m_deployDelay.PeekDeltaTime() >= DEPLOY_DELAY + RETRACT_DELAY)
RetractInfoBox();
ActorFrame::Update(fDeltaTime);
}
void RoomInfoDisplay::RequestRoomInfo(const RString& name)
{
NSMAN->m_SMOnlinePacket.ClearPacket();
NSMAN->m_SMOnlinePacket.Write1((uint8_t)3); //Request Room Info
NSMAN->m_SMOnlinePacket.WriteNT(name);
NSMAN->SendSMOnline( );
}
void RoomInfoDisplay::SetRoomInfo( const RoomInfo& info)
{
m_songTitle.SetText( SONG_TITLE.GetValue() + info.songTitle );
m_songSub.SetText( SONG_SUB_TITLE.GetValue() + info.songSubTitle );
m_songArtist.SetText( SONG_ARTIST.GetValue() + info.songArtist );
m_players.SetText(ssprintf("%s (%d/%d):", PLAYERS.GetValue().c_str(), info.numPlayers, info.maxPlayers));
if (m_playerList.size() > info.players.size())
{
for (size_t i = info.players.size(); i < m_playerList.size(); i++)
{
//if our old list is larger remove some elements
this->RemoveChild(m_playerList[i]);
SAFE_DELETE(m_playerList[i]);
}
m_playerList.resize(info.players.size());
}
else if (m_playerList.size() < info.players.size())
{
//add elements if our old list is smaller
int oldsize = m_playerList.size();
m_playerList.resize(info.players.size());
for (size_t i = oldsize; i < m_playerList.size(); i++)
{
m_playerList[i] = new BitmapText;
m_playerList[i]->LoadFromFont( THEME->GetPathF(GetName(),"text") );
m_playerList[i]->SetName("PlayerListElement");
m_playerList[i]->SetHorizAlign( align_left );
m_playerList[i]->SetX(PLAYERLISTX + (i * PLAYERLISTOFFSETX));
m_playerList[i]->SetY(PLAYERLISTY + (i * PLAYERLISTOFFSETY));
LOAD_ALL_COMMANDS(m_playerList[i]);
ON_COMMAND(m_playerList[i]);
this->AddChild(m_playerList[i]);
}
}
for (size_t i = 0; i < m_playerList.size(); i++)
m_playerList[i]->SetText(info.players[i]);
m_state = CLOSED;
m_deployDelay.Touch();
}
#endif
/*
* (c) 2006 Josh Allen
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+1 -1
View File
@@ -2,7 +2,7 @@
#include "SampleHistory.h"
#include "RageLog.h"
#include "RageUtil.h"
#include "Foreach.h"
SampleHistory::SampleHistory()
{
+1 -1
View File
@@ -6,7 +6,7 @@
#include "AdjustSync.h"
#include "BackgroundUtil.h"
#include "CommonMetrics.h"
#include "Foreach.h"
#include "GameManager.h"
#include "GamePreferences.h"
#include "GameSoundManager.h"
+1 -1
View File
@@ -37,7 +37,7 @@
#include "StatsManager.h"
#include "PlayerAI.h" // for NUM_SKILL_LEVELS
#include "NetworkSyncManager.h"
#include "Foreach.h"
#include "DancingCharacters.h"
#include "ScreenDimensions.h"
#include "ThemeMetric.h"
+1 -1
View File
@@ -70,7 +70,7 @@
#include "FontManager.h"
#include "Screen.h"
#include "ScreenDimensions.h"
#include "Foreach.h"
#include "ActorUtil.h"
ScreenManager* SCREENMAN = NULL; // global and accessable from anywhere in our program
-1
View File
@@ -9,7 +9,6 @@
#include "ScreenDimensions.h"
#include "InputEventPlus.h"
#include "LocalizedString.h"
#include "Foreach.h"
#include "LuaBinding.h"
static const float g_fSecondsToWaitForInput = 0.05f;
+1 -1
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "ScreenMessage.h"
#include "RageLog.h"
#include "Foreach.h"
#include <map>
const ScreenMessage SM_Invalid = "";
+1 -1
View File
@@ -3,7 +3,7 @@
#include "ScreenManager.h"
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#include "Foreach.h"
#include "ScreenDimensions.h"
#include "GameState.h"
#include "FontCharAliases.h"
+1 -1
View File
@@ -10,7 +10,7 @@
#include "PrefsManager.h"
#include "StepMania.h"
#include "RageSoundManager.h"
#include "Foreach.h"
#include "OptionRowHandler.h"
#include "ScreenOptionsMasterPrefs.h"
#include "CommonMetrics.h"
+1 -1
View File
@@ -12,7 +12,7 @@
#include "GameState.h"
#include "StepMania.h"
#include "Game.h"
#include "Foreach.h"
#include "GameConstantsAndTypes.h"
#include "DisplayResolutions.h"
#include "LocalizedString.h"
+1 -1
View File
@@ -11,7 +11,7 @@
#include "CodeDetector.h"
#include "ScreenDimensions.h"
#include "PlayerState.h"
#include "Foreach.h"
#include "InputEventPlus.h"
REGISTER_SCREEN_CLASS( ScreenPlayerOptions );
+1 -1
View File
@@ -10,7 +10,7 @@
#include "ActorUtil.h"
#include "RageLog.h"
#include <set>
#include "Foreach.h"
#include "InputEventPlus.h"
static const char *MenuDirNames[] = {
+1 -1
View File
@@ -20,7 +20,7 @@
#include "MenuTimer.h"
#include "StatsManager.h"
#include "StepsUtil.h"
#include "Foreach.h"
#include "Style.h"
#include "PlayerState.h"
#include "CommonMetrics.h"
+1 -1
View File
@@ -20,7 +20,7 @@
#include "NoteDataUtil.h"
#include "SongUtil.h"
#include "StepsUtil.h"
#include "Foreach.h"
#include "BackgroundUtil.h"
#include "SpecialFiles.h"
#include "NotesLoader.h"
+1 -1
View File
@@ -8,7 +8,7 @@
#include "Course.h"
#include "CourseLoaderCRS.h"
#include "CourseUtil.h"
#include "Foreach.h"
#include "GameManager.h"
#include "GameState.h"
#include "LocalizedString.h"
+1 -1
View File
@@ -9,7 +9,7 @@
#include "PrefsManager.h"
#include "SongManager.h"
#include "XmlFile.h"
#include "Foreach.h"
#include "UnlockManager.h"
#include "ThemeMetric.h"
#include "LocalizedString.h"
+1 -1
View File
@@ -10,7 +10,7 @@
#include "RageUtil.h"
#include "ActorUtil.h"
#include "arch/Dialog/Dialog.h"
#include "Foreach.h"
#include "LuaBinding.h"
#include "LuaManager.h"
#include <numeric>
+1 -1
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "StageStats.h"
#include "GameState.h"
#include "Foreach.h"
#include "Steps.h"
#include "Song.h"
#include "RageLog.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#include "StatsManager.h"
#include "RageFileManager.h"
#include "GameState.h"
#include "Foreach.h"
#include "ProfileManager.h"
#include "Profile.h"
#include "PrefsManager.h"
-1
View File
@@ -1783,7 +1783,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"</Command>
<ClInclude Include="Difficulty.h" />
<ClInclude Include="EnumHelper.h" />
<ClInclude Include="FileDownload.h" />
<ClInclude Include="Foreach.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="GameCommand.h" />
<ClInclude Include="GameConstantsAndTypes.h" />
-3
View File
@@ -1883,9 +1883,6 @@
<ClInclude Include="FileDownload.h">
<Filter>Data Structures</Filter>
</ClInclude>
<ClInclude Include="Foreach.h">
<Filter>Data Structures</Filter>
</ClInclude>
<ClInclude Include="Game.h">
<Filter>Data Structures</Filter>
</ClInclude>
+1 -1
View File
@@ -14,7 +14,7 @@
#include "ScreenManager.h"
#include "ActorUtil.h"
#endif
#include "Foreach.h"
#include "ThemeMetric.h"
#include "SubscriptionManager.h"
#include "LuaManager.h"
+1 -1
View File
@@ -5,7 +5,7 @@
#include "ThemeManager.h"
#include <map>
#include "Foreach.h"
#include "LuaManager.h"
#include "RageUtil.h"
+1 -1
View File
@@ -4,7 +4,7 @@
#include "RageUtil.h"
#include "RageLog.h"
#include "NoteTypes.h"
#include "Foreach.h"
#include <float.h>
TimingSegment* GetSegmentAtRow( int iNoteRow, TimingSegmentType tst );
+1 -1
View File
@@ -5,7 +5,7 @@
#include "RageLog.h"
#include "FontCharAliases.h"
#include "RageFile.h"
#include "Foreach.h"
#include "XmlFile.h"
#include "XmlFileUtil.h"

Some files were not shown because too many files have changed in this diff Show More