Integrate C++11 branch into 5_1-new

This commit is contained in:
teejusb
2019-06-22 12:35:38 -07:00
444 changed files with 19503 additions and 21007 deletions
+79 -80
View File
@@ -38,7 +38,6 @@
#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"
@@ -102,13 +101,13 @@ PlayerInfo::PlayerInfo(): m_pn(PLAYER_INVALID), m_mp(MultiPlayer_Invalid),
m_bIsDummy(false), m_iDummyIndex(0), m_iAddToDifficulty(0),
m_bPlayerEnabled(false), m_PlayerStateDummy(),
m_PlayerStageStatsDummy(), m_SoundEffectControl(),
m_vpStepsQueue(), m_asModifiersQueue(), m_pLifeMeter(NULL),
m_ptextCourseSongNumber(NULL), m_ptextStepsDescription(NULL),
m_pPrimaryScoreDisplay(NULL), m_pSecondaryScoreDisplay(NULL),
m_pPrimaryScoreKeeper(NULL), m_pSecondaryScoreKeeper(NULL),
m_ptextPlayerOptions(NULL), m_pActiveAttackList(NULL),
m_NoteData(), m_pPlayer(NULL), m_pInventory(NULL),
m_pStepsDisplay(NULL), m_sprOniGameOver() {}
m_vpStepsQueue(), m_asModifiersQueue(), m_pLifeMeter(nullptr),
m_ptextCourseSongNumber(nullptr), m_ptextStepsDescription(nullptr),
m_pPrimaryScoreDisplay(nullptr), m_pSecondaryScoreDisplay(nullptr),
m_pPrimaryScoreKeeper(nullptr), m_pSecondaryScoreKeeper(nullptr),
m_ptextPlayerOptions(nullptr), m_pActiveAttackList(nullptr),
m_NoteData(), m_pPlayer(nullptr), m_pInventory(nullptr),
m_pStepsDisplay(nullptr), m_sprOniGameOver() {}
void PlayerInfo::Load( PlayerNumber pn, MultiPlayer mp, bool bShowNoteField, int iAddToDifficulty )
{
@@ -117,9 +116,9 @@ void PlayerInfo::Load( PlayerNumber pn, MultiPlayer mp, bool bShowNoteField, int
m_bPlayerEnabled = IsEnabled();
m_bIsDummy = false;
m_iAddToDifficulty = iAddToDifficulty;
m_pLifeMeter = NULL;
m_ptextCourseSongNumber = NULL;
m_ptextStepsDescription = NULL;
m_pLifeMeter = nullptr;
m_ptextCourseSongNumber = nullptr;
m_ptextStepsDescription = nullptr;
if( !IsMultiPlayer() )
{
@@ -175,11 +174,11 @@ void PlayerInfo::Load( PlayerNumber pn, MultiPlayer mp, bool bShowNoteField, int
break;
}
m_ptextPlayerOptions = NULL;
m_pActiveAttackList = NULL;
m_ptextPlayerOptions = nullptr;
m_pActiveAttackList = nullptr;
m_pPlayer = new Player( m_NoteData, bShowNoteField );
m_pInventory = NULL;
m_pStepsDisplay = NULL;
m_pInventory = nullptr;
m_pStepsDisplay = nullptr;
if( IsMultiPlayer() )
{
@@ -323,8 +322,8 @@ GetNextVisiblePlayerInfo( vector<PlayerInfo>::iterator iter, vector<PlayerInfo>
ScreenGameplay::ScreenGameplay()
{
m_pSongBackground = NULL;
m_pSongForeground = NULL;
m_pSongBackground = nullptr;
m_pSongForeground = nullptr;
m_bForceNoNetwork = false;
m_delaying_ready_announce= false;
GAMESTATE->m_AdjustTokensBySongCostForFinalStageCheck= false;
@@ -399,12 +398,12 @@ void ScreenGameplay::Init()
if( !GAMESTATE->m_bDemonstrationOrJukebox )
MEMCARDMAN->PauseMountingThread();
m_pSoundMusic = NULL;
m_pSoundMusic = nullptr;
set_paused_internal(false);
m_pCombinedLifeMeter = NULL;
m_pCombinedLifeMeter = nullptr;
if( GAMESTATE->m_pCurSong == NULL && GAMESTATE->m_pCurCourse == NULL )
if( GAMESTATE->m_pCurSong == nullptr && GAMESTATE->m_pCurCourse == nullptr )
return; // ScreenDemonstration will move us to the next screen. We just need to survive for one update without crashing.
/* Save settings to the profile now. Don't do this on extra stages, since the
@@ -458,7 +457,7 @@ void ScreenGameplay::Init()
}
FOREACH_EnabledPlayer(p)
ASSERT( GAMESTATE->m_pCurSteps[p].Get() != NULL );
ASSERT( GAMESTATE->m_pCurSteps[p].Get() != nullptr );
}
/* Increment the course play count. */
@@ -738,7 +737,7 @@ void ScreenGameplay::Init()
{
if( GAMESTATE->IsCourseMode() )
{
ASSERT( pi->m_ptextCourseSongNumber == NULL );
ASSERT( pi->m_ptextCourseSongNumber == nullptr );
SONG_NUMBER_FORMAT.Load( m_sName, "SongNumberFormat" );
pi->m_ptextCourseSongNumber = new BitmapText;
pi->m_ptextCourseSongNumber->LoadFromFont( THEME->GetPathF(m_sName,"SongNum") );
@@ -749,7 +748,7 @@ void ScreenGameplay::Init()
this->AddChild( pi->m_ptextCourseSongNumber );
}
ASSERT( pi->m_ptextStepsDescription == NULL );
ASSERT( pi->m_ptextStepsDescription == nullptr );
pi->m_ptextStepsDescription = new BitmapText;
pi->m_ptextStepsDescription->LoadFromFont( THEME->GetPathF(m_sName,"StepsDescription") );
pi->m_ptextStepsDescription->SetName( ssprintf("StepsDescription%s",pi->GetName().c_str()) );
@@ -757,7 +756,7 @@ void ScreenGameplay::Init()
this->AddChild( pi->m_ptextStepsDescription );
// Player/Song options
ASSERT( pi->m_ptextPlayerOptions == NULL );
ASSERT( pi->m_ptextPlayerOptions == nullptr );
pi->m_ptextPlayerOptions = new BitmapText;
pi->m_ptextPlayerOptions->LoadFromFont( THEME->GetPathF(m_sName,"player options") );
pi->m_ptextPlayerOptions->SetName( ssprintf("PlayerOptions%s",pi->GetName().c_str()) );
@@ -765,7 +764,7 @@ void ScreenGameplay::Init()
this->AddChild( pi->m_ptextPlayerOptions );
// Difficulty icon and meter
ASSERT( pi->m_pStepsDisplay == NULL );
ASSERT( pi->m_pStepsDisplay == nullptr );
pi->m_pStepsDisplay = new StepsDisplay;
pi->m_pStepsDisplay->Load("StepsDisplayGameplay", pi->GetPlayerState() );
pi->m_pStepsDisplay->SetName( ssprintf("StepsDisplay%s",pi->GetName().c_str()) );
@@ -796,7 +795,7 @@ void ScreenGameplay::Init()
FOREACH_VisiblePlayerInfo( m_vPlayerInfo, pi )
{
ASSERT( pi->m_pActiveAttackList == NULL );
ASSERT( pi->m_pActiveAttackList == nullptr );
pi->m_pActiveAttackList = new ActiveAttackList;
pi->m_pActiveAttackList->LoadFromFont( THEME->GetPathF(m_sName,"ActiveAttackList") );
pi->m_pActiveAttackList->Init( pi->GetPlayerState() );
@@ -880,10 +879,10 @@ void ScreenGameplay::Init()
// Fill StageStats
STATSMAN->m_CurStageStats.m_vpPossibleSongs = m_apSongsQueue;
FOREACH( PlayerInfo, m_vPlayerInfo, pi )
for (PlayerInfo &pi : m_vPlayerInfo)
{
if( pi->GetPlayerStageStats() )
pi->GetPlayerStageStats()->m_vpPossibleSteps = pi->m_vpStepsQueue;
if( pi.GetPlayerStageStats() )
pi.GetPlayerStageStats()->m_vpPossibleSteps = pi.m_vpStepsQueue;
}
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
@@ -928,31 +927,31 @@ void ScreenGameplay::InitSongQueues()
if( GAMESTATE->IsCourseMode() )
{
Course* pCourse = GAMESTATE->m_pCurCourse;
ASSERT( pCourse != NULL );
ASSERT( pCourse != nullptr );
m_apSongsQueue.clear();
PlayerNumber pnMaster = GAMESTATE->GetMasterPlayerNumber();
Trail *pTrail = GAMESTATE->m_pCurTrail[pnMaster];
ASSERT( pTrail != NULL );
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
ASSERT( pTrail != nullptr );
for (TrailEntry const &e : pTrail->m_vEntries)
{
ASSERT( e->pSong != NULL );
m_apSongsQueue.push_back( e->pSong );
ASSERT( e.pSong != nullptr );
m_apSongsQueue.push_back( e.pSong );
}
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
Trail *lTrail = GAMESTATE->m_pCurTrail[ pi->GetStepsAndTrailIndex() ];
ASSERT( lTrail != NULL );
ASSERT( lTrail != nullptr );
pi->m_vpStepsQueue.clear();
pi->m_asModifiersQueue.clear();
FOREACH_CONST( TrailEntry, lTrail->m_vEntries, e )
for (TrailEntry const &e : lTrail->m_vEntries)
{
ASSERT( e->pSteps != NULL );
pi->m_vpStepsQueue.push_back( e->pSteps );
ASSERT( e.pSteps != nullptr );
pi->m_vpStepsQueue.push_back( e.pSteps );
AttackArray a;
e->GetAttackArray( a );
e.GetAttackArray( a );
pi->m_asModifiersQueue.push_back( a );
}
@@ -1214,7 +1213,7 @@ void ScreenGameplay::LoadNextSong()
Steps* pSteps = GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ];
++pi->GetPlayerStageStats()->m_iStepsPlayed;
ASSERT( GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ] != NULL );
ASSERT( GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ] != nullptr );
if( pi->m_ptextStepsDescription )
pi->m_ptextStepsDescription->SetText( pSteps->GetDescription() );
@@ -1390,7 +1389,7 @@ void ScreenGameplay::LoadNextSong()
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
RageSoundReader *pPlayerSound = m_AutoKeysounds.GetPlayerSound(pi->m_pn);
if( pPlayerSound == NULL && pi->m_pn == GAMESTATE->GetMasterPlayerNumber() )
if( pPlayerSound == nullptr && pi->m_pn == GAMESTATE->GetMasterPlayerNumber() )
pPlayerSound = m_AutoKeysounds.GetSharedSound();
pi->m_SoundEffectControl.SetSoundReader( pPlayerSound );
}
@@ -1405,10 +1404,10 @@ void ScreenGameplay::LoadLights()
// First, check if the song has explicit lights
m_CabinetLightsNoteData.Init();
ASSERT( GAMESTATE->m_pCurSong != NULL );
ASSERT( GAMESTATE->m_pCurSong != nullptr );
const Steps *pSteps = SongUtil::GetClosestNotes( GAMESTATE->m_pCurSong, StepsType_lights_cabinet, Difficulty_Medium );
if( pSteps != NULL )
if( pSteps != nullptr )
{
pSteps->GetNoteData( m_CabinetLightsNoteData );
return;
@@ -1447,7 +1446,7 @@ void ScreenGameplay::LoadLights()
pSteps = SongUtil::GetClosestNotes( GAMESTATE->m_pCurSong, st, d1 );
// If we can't find anything at all, stop.
if( pSteps == NULL )
if( pSteps == nullptr )
return;
NoteData TapNoteData1;
@@ -1562,7 +1561,7 @@ void ScreenGameplay::PlayAnnouncer( const RString &type, float fSeconds, float *
/* Don't play before the first beat, or after we're finished. */
if( m_DancingState != STATE_DANCING )
return;
if(GAMESTATE->m_pCurSong == NULL || // this will be true on ScreenDemonstration sometimes
if(GAMESTATE->m_pCurSong == nullptr || // this will be true on ScreenDemonstration sometimes
GAMESTATE->m_Position.m_fSongBeat < GAMESTATE->m_pCurSong->GetFirstBeat())
return;
@@ -1579,14 +1578,14 @@ void ScreenGameplay::UpdateSongPosition( float fDeltaTime )
return;
RageTimer tm;
const float fSeconds = m_pSoundMusic->GetPositionSeconds( NULL, &tm );
const float fSeconds = m_pSoundMusic->GetPositionSeconds( nullptr, &tm );
const float fAdjust = SOUND->GetFrameTimingAdjustment( fDeltaTime );
GAMESTATE->UpdateSongPosition( fSeconds+fAdjust, GAMESTATE->m_pCurSong->m_SongTiming, tm+fAdjust );
}
void ScreenGameplay::BeginScreen()
{
if( GAMESTATE->m_pCurSong == NULL )
if( GAMESTATE->m_pCurSong == nullptr )
return;
ScreenWithMenuElements::BeginScreen();
@@ -1663,7 +1662,7 @@ void ScreenGameplay::GetMusicEndTiming( float &fSecondsToStartFadingOutMusic, fl
void ScreenGameplay::Update( float fDeltaTime )
{
if( GAMESTATE->m_pCurSong == NULL )
if( GAMESTATE->m_pCurSong == nullptr )
{
/* ScreenDemonstration will move us to the next screen. We just need to
* survive for one update without crashing. We need to call Screen::Update
@@ -1686,7 +1685,7 @@ void ScreenGameplay::Update( float fDeltaTime )
/* This happens if ScreenDemonstration::HandleScreenMessage sets a new screen when
* PREFSMAN->m_bDelayedScreenLoad. */
if( GAMESTATE->m_pCurSong == NULL )
if( GAMESTATE->m_pCurSong == nullptr )
return;
/* This can happen if ScreenDemonstration::HandleScreenMessage sets a new screen when
* !PREFSMAN->m_bDelayedScreenLoad. (The new screen was loaded when we called Screen::Update,
@@ -1767,7 +1766,7 @@ void ScreenGameplay::Update( float fDeltaTime )
continue;
// check for individual fail
if( pi->m_pLifeMeter == NULL || !pi->m_pLifeMeter->IsFailing() )
if( pi->m_pLifeMeter == nullptr || !pi->m_pLifeMeter->IsFailing() )
continue; /* isn't failing */
if( pi->GetPlayerStageStats()->m_bFailed )
continue; /* failed and is already dead */
@@ -1807,7 +1806,7 @@ void ScreenGameplay::Update( float fDeltaTime )
switch( ft )
{
case FailType_Immediate:
if( pi->m_pLifeMeter == NULL || (pi->m_pLifeMeter && !pi->m_pLifeMeter->IsFailing()) )
if( pi->m_pLifeMeter == nullptr || (pi->m_pLifeMeter && !pi->m_pLifeMeter->IsFailing()) )
bAllFailed = false;
break;
case FailType_ImmediateContinue:
@@ -1881,10 +1880,10 @@ void ScreenGameplay::Update( float fDeltaTime )
// update 2d dancing characters
FOREACH_EnabledPlayerNumberInfo( m_vPlayerInfo, pi )
{
DancingCharacters *pCharacter = NULL;
DancingCharacters *pCharacter = nullptr;
if( m_pSongBackground )
pCharacter = m_pSongBackground->GetDancingCharacters();
if( pCharacter != NULL )
if( pCharacter != nullptr )
{
TapNoteScore tns = pi->m_pPlayer->GetLastTapNoteScore();
@@ -2549,10 +2548,10 @@ bool ScreenGameplay::Input( const InputEventPlus &input )
{
if( input.mp != MultiPlayer_Invalid && GAMESTATE->IsMultiPlayerEnabled(input.mp) && iCol != -1 )
{
FOREACH( PlayerInfo, m_vPlayerInfo, pi )
for (PlayerInfo const &pi : m_vPlayerInfo)
{
if( input.mp == pi->m_mp )
pi->m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease );
if( input.mp == pi.m_mp )
pi.m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease );
}
return true;
}
@@ -2623,7 +2622,7 @@ void ScreenGameplay::SaveStats()
pss.m_radarPossible += rv;
NoteDataWithScoring::GetActualRadarValues( nd, pss, fMusicLen, rv );
pss.m_radarActual += rv;
GAMESTATE->SetProcessedTimingData(NULL);
GAMESTATE->SetProcessedTimingData(nullptr);
}
}
@@ -2810,7 +2809,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
{
GAMESTATE->m_DanceDuration= GAMESTATE->m_DanceStartTime.Ago();
// update dancing characters for win / lose
DancingCharacters *pDancers = NULL;
DancingCharacters *pDancers = nullptr;
if( m_pSongBackground )
pDancers = m_pSongBackground->GetDancingCharacters();
if( pDancers )
@@ -2878,7 +2877,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
GAMESTATE->GetCourseSongIndex() >= (int)m_apSongsQueue.size()-1)
{
Course* course= GAMESTATE->m_pCurCourse;
ASSERT(course != NULL);
ASSERT(course != nullptr);
// Need to store these so they can be used to refetch the players'
// trails after they're invalidated.
vector<StepsType> trail_sts;
@@ -2886,7 +2885,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
FOREACH_EnabledPlayerInfo(m_vPlayerInfo, pi)
{
Trail* trail= GAMESTATE->m_pCurTrail[pi->GetStepsAndTrailIndex()];
ASSERT(trail != NULL);
ASSERT(trail != nullptr);
trail_sts.push_back(trail->m_StepsType);
trail_cds.push_back(trail->m_CourseDifficulty);
}
@@ -2899,31 +2898,31 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
FOREACH_EnabledPlayerInfo(m_vPlayerInfo, pi)
{
Trail* trail= course->GetTrail(trail_sts[info_id], trail_cds[info_id]);
ASSERT(trail != NULL);
ASSERT(trail != nullptr);
GAMESTATE->m_pCurTrail[pi->m_pn].Set(trail);
++info_id;
}
PlayerNumber master_pn = GAMESTATE->GetMasterPlayerNumber();
Trail *master_trail= GAMESTATE->m_pCurTrail[master_pn];
ASSERT(master_trail != NULL);
FOREACH_CONST(TrailEntry, master_trail->m_vEntries, entry)
ASSERT(master_trail != nullptr);
for (TrailEntry const &entry : master_trail->m_vEntries)
{
ASSERT(entry->pSong != NULL);
m_apSongsQueue.push_back(entry->pSong);
STATSMAN->m_CurStageStats.m_vpPossibleSongs.push_back(entry->pSong);
ASSERT(entry.pSong != nullptr);
m_apSongsQueue.push_back(entry.pSong);
STATSMAN->m_CurStageStats.m_vpPossibleSongs.push_back(entry.pSong);
}
FOREACH_EnabledPlayerInfo(m_vPlayerInfo, pi)
{
Trail* trail= GAMESTATE->m_pCurTrail[pi->GetStepsAndTrailIndex()];
ASSERT(trail != NULL);
FOREACH_CONST(TrailEntry, trail->m_vEntries, entry)
ASSERT(trail != nullptr);
for (TrailEntry const &entry : master_trail->m_vEntries)
{
ASSERT(entry->pSteps != NULL);
pi->m_vpStepsQueue.push_back(entry->pSteps);
ASSERT(entry.pSteps != nullptr);
pi->m_vpStepsQueue.push_back(entry.pSteps);
AttackArray a;
entry->GetAttackArray(a);
entry.GetAttackArray(a);
pi->m_asModifiersQueue.push_back(a);
pi->GetPlayerStageStats()->m_vpPossibleSteps.push_back(entry->pSteps);
pi->GetPlayerStageStats()->m_vpPossibleSteps.push_back(entry.pSteps);
}
// In a survival course, override stored mods
if(course->GetCourseType() == COURSE_TYPE_SURVIVAL &&
@@ -3093,7 +3092,7 @@ void ScreenGameplay::HandleMessage( const Message &msg )
continue;
RageSoundReader *pSoundReader = m_AutoKeysounds.GetPlayerSound( pn );
if( pSoundReader == NULL )
if( pSoundReader == nullptr )
pSoundReader = m_AutoKeysounds.GetSharedSound();
HoldNoteScore hns;
@@ -3139,7 +3138,7 @@ PlayerInfo *ScreenGameplay::GetPlayerInfo( PlayerNumber pn )
if( pi->m_pn == pn )
return &*pi;
}
return NULL;
return nullptr;
}
PlayerInfo *ScreenGameplay::GetDummyPlayerInfo( int iDummyIndex )
@@ -3149,7 +3148,7 @@ PlayerInfo *ScreenGameplay::GetDummyPlayerInfo( int iDummyIndex )
if( pi->m_bIsDummy && pi->m_iDummyIndex == iDummyIndex )
return &*pi;
}
return NULL;
return nullptr;
}
void ScreenGameplay::SaveReplay()
@@ -3213,7 +3212,7 @@ void ScreenGameplay::SaveReplay()
continue;
ASSERT( matches.size() == 1 );
iIndex = StringToInt( matches[0] )+1;
iIndex = std::stoi( matches[0] )+1;
break;
}
@@ -3248,10 +3247,10 @@ public:
PlayerNumber pn = Enum::Check<PlayerNumber>( L, 1 );
PlayerInfo *pi = p->GetPlayerInfo(pn);
if( pi == NULL )
if( pi == nullptr )
return 0;
LifeMeter *pLM = pi->m_pLifeMeter;
if( pLM == NULL )
if( pLM == nullptr )
return 0;
pLM->PushSelf( L );
@@ -3262,7 +3261,7 @@ public:
PlayerNumber pn = Enum::Check<PlayerNumber>( L, 1 );
PlayerInfo *pi = p->GetPlayerInfo(pn);
if( pi == NULL )
if( pi == nullptr )
return 0;
pi->PushSelf( L );
@@ -3272,7 +3271,7 @@ public:
{
int iDummyIndex = IArg(1);
PlayerInfo *pi = p->GetDummyPlayerInfo(iDummyIndex);
if( pi == NULL )
if( pi == nullptr )
return 0;
pi->PushSelf( L );
return 1;