Skip to content
  •  
  •  
  •  
20 changes: 10 additions & 10 deletions Core/GameEngine/Source/Common/Audio/AudioEventRTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ AudioEventRTS::AudioEventRTS()
m_shouldFade(false),
m_isLogicalAudio(false),
m_filenameToLoad(AsciiString::TheEmptyString),
m_eventInfo(NULL),
m_eventInfo(nullptr),
m_playingHandle(0),
m_killThisHandle(0),
m_pitchShift(1.0),
Expand All @@ -95,7 +95,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName )
m_shouldFade(false),
m_isLogicalAudio(false),
m_filenameToLoad(AsciiString::TheEmptyString),
m_eventInfo(NULL),
m_eventInfo(nullptr),
m_playingHandle(0),
m_killThisHandle(0),
m_pitchShift(1.0),
Expand Down Expand Up @@ -123,7 +123,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, ObjectID ownerID )
m_shouldFade(false),
m_isLogicalAudio(false),
m_filenameToLoad(AsciiString::TheEmptyString),
m_eventInfo(NULL),
m_eventInfo(nullptr),
m_playingHandle(0),
m_killThisHandle(0),
m_pitchShift(1.0),
Expand Down Expand Up @@ -159,7 +159,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, DrawableID drawableI
m_shouldFade(false),
m_isLogicalAudio(false),
m_filenameToLoad(AsciiString::TheEmptyString),
m_eventInfo(NULL),
m_eventInfo(nullptr),
m_playingHandle(0),
m_killThisHandle(0),
m_pitchShift(1.0),
Expand Down Expand Up @@ -194,7 +194,7 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, const Coord3D *posit
m_shouldFade(false),
m_isLogicalAudio(false),
m_filenameToLoad(AsciiString::TheEmptyString),
m_eventInfo(NULL),
m_eventInfo(nullptr),
m_playingHandle(0),
m_killThisHandle(0),
m_pitchShift(1.0),
Expand Down Expand Up @@ -302,9 +302,9 @@ AudioEventRTS::~AudioEventRTS()
//-------------------------------------------------------------------------------------------------
void AudioEventRTS::setEventName( AsciiString name )
{
if ((name != m_eventName) && m_eventInfo != NULL) {
if ((name != m_eventName) && m_eventInfo != nullptr) {
// Clear out the audio event info, cause its not valid for the new event.
m_eventInfo = NULL;
m_eventInfo = nullptr;
}

m_eventName = name;
Expand Down Expand Up @@ -526,7 +526,7 @@ const AudioEventInfo *AudioEventRTS::getAudioEventInfo( void ) const
if (m_eventInfo->m_audioName == m_eventName) {
return m_eventInfo;
} else {
m_eventInfo = NULL;
m_eventInfo = nullptr;
}
}

Expand Down Expand Up @@ -568,7 +568,7 @@ const Coord3D* AudioEventRTS::getPosition( void )
return &m_positionOfAudio;
}

return NULL;
return nullptr;
}

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -759,7 +759,7 @@ const Coord3D *AudioEventRTS::getCurrentPosition( void )
return &m_positionOfAudio;
}

return NULL;
return nullptr;
}

//-------------------------------------------------------------------------------------------------
Expand Down
144 changes: 72 additions & 72 deletions Core/GameEngine/Source/Common/Audio/GameAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static const char* TheSpeakerTypes[] =
"4 Speaker",
"5.1 Surround",
"7.1 Surround",
NULL
nullptr
};

static const Int TheSpeakerTypesCount = sizeof(TheSpeakerTypes) / sizeof(TheSpeakerTypes[0]);
Expand All @@ -90,54 +90,54 @@ static void parseSpeakerType( INI *ini, void *instance, void *store, const void
// Field Parse table for Audio Settings ///////////////////////////////////////////////////////////
static const FieldParse audioSettingsFieldParseTable[] =
{
{ "AudioRoot", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_audioRoot) },
{ "SoundsFolder", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_soundsFolder) },
{ "MusicFolder", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_musicFolder) },
{ "StreamingFolder", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_streamingFolder) },
{ "SoundsExtension", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_soundsExtension) },

{ "UseDigital", INI::parseBool, NULL, offsetof( AudioSettings, m_useDigital) },
{ "UseMidi", INI::parseBool, NULL, offsetof( AudioSettings, m_useMidi) },
{ "OutputRate", INI::parseInt, NULL, offsetof( AudioSettings, m_outputRate) },
{ "OutputBits", INI::parseInt, NULL, offsetof( AudioSettings, m_outputBits) },
{ "OutputChannels", INI::parseInt, NULL, offsetof( AudioSettings, m_outputChannels) },
{ "SampleCount2D", INI::parseInt, NULL, offsetof( AudioSettings, m_sampleCount2D) },
{ "SampleCount3D", INI::parseInt, NULL, offsetof( AudioSettings, m_sampleCount3D) },
{ "StreamCount", INI::parseInt, NULL, offsetof( AudioSettings, m_streamCount) },

{ "Preferred3DHW1", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[0]) },
{ "Preferred3DHW2", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[1]) },
{ "Preferred3DHW3", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[2]) },
{ "Preferred3DHW4", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[3]) },

{ "Preferred3DSW", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_preferred3DProvider[4]) },

{ "Default2DSpeakerType", parseSpeakerType, NULL, offsetof( AudioSettings, m_defaultSpeakerType2D) },
{ "Default3DSpeakerType", parseSpeakerType, NULL, offsetof( AudioSettings, m_defaultSpeakerType3D) },

{ "MinSampleVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_minVolume) },
{ "GlobalMinRange", INI::parseInt, NULL, offsetof( AudioSettings, m_globalMinRange) },
{ "GlobalMaxRange", INI::parseInt, NULL, offsetof( AudioSettings, m_globalMaxRange) },
{ "TimeBetweenDrawableSounds", INI::parseDurationUnsignedInt, NULL, offsetof( AudioSettings, m_drawableAmbientFrames) },
{ "TimeToFadeAudio", INI::parseDurationUnsignedInt, NULL, offsetof( AudioSettings, m_fadeAudioFrames) },
{ "AudioFootprintInBytes",INI::parseUnsignedInt, NULL, offsetof( AudioSettings, m_maxCacheSize) },
{ "Relative2DVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_relative2DVolume ) },
{ "DefaultSoundVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_defaultSoundVolume) },
{ "Default3DSoundVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_default3DSoundVolume) },
{ "DefaultSpeechVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_defaultSpeechVolume) },
{ "DefaultMusicVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_defaultMusicVolume) },
{ "DefaultMoneyTransactionVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_defaultMoneyTransactionVolume) },
{ "MicrophoneDesiredHeightAboveTerrain", INI::parseReal, NULL, offsetof( AudioSettings, m_microphoneDesiredHeightAboveTerrain ) },
{ "MicrophoneMaxPercentageBetweenGroundAndCamera", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_microphoneMaxPercentageBetweenGroundAndCamera ) },
{ "ZoomMinDistance", INI::parseReal, NULL, offsetof( AudioSettings, m_zoomMinDistance ) },
{ "ZoomMaxDistance", INI::parseReal, NULL, offsetof( AudioSettings, m_zoomMaxDistance ) },
{ "ZoomSoundVolumePercentageAmount", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_zoomSoundVolumePercentageAmount ) },

{ NULL, NULL, NULL, NULL }
{ "AudioRoot", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_audioRoot) },
{ "SoundsFolder", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_soundsFolder) },
{ "MusicFolder", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_musicFolder) },
{ "StreamingFolder", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_streamingFolder) },
{ "SoundsExtension", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_soundsExtension) },

{ "UseDigital", INI::parseBool, nullptr, offsetof( AudioSettings, m_useDigital) },
{ "UseMidi", INI::parseBool, nullptr, offsetof( AudioSettings, m_useMidi) },
{ "OutputRate", INI::parseInt, nullptr, offsetof( AudioSettings, m_outputRate) },
{ "OutputBits", INI::parseInt, nullptr, offsetof( AudioSettings, m_outputBits) },
{ "OutputChannels", INI::parseInt, nullptr, offsetof( AudioSettings, m_outputChannels) },
{ "SampleCount2D", INI::parseInt, nullptr, offsetof( AudioSettings, m_sampleCount2D) },
{ "SampleCount3D", INI::parseInt, nullptr, offsetof( AudioSettings, m_sampleCount3D) },
{ "StreamCount", INI::parseInt, nullptr, offsetof( AudioSettings, m_streamCount) },

{ "Preferred3DHW1", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[0]) },
{ "Preferred3DHW2", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[1]) },
{ "Preferred3DHW3", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[2]) },
{ "Preferred3DHW4", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[3]) },

{ "Preferred3DSW", INI::parseAsciiString, nullptr, offsetof( AudioSettings, m_preferred3DProvider[4]) },

{ "Default2DSpeakerType", parseSpeakerType, nullptr, offsetof( AudioSettings, m_defaultSpeakerType2D) },
{ "Default3DSpeakerType", parseSpeakerType, nullptr, offsetof( AudioSettings, m_defaultSpeakerType3D) },

{ "MinSampleVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_minVolume) },
{ "GlobalMinRange", INI::parseInt, nullptr, offsetof( AudioSettings, m_globalMinRange) },
{ "GlobalMaxRange", INI::parseInt, nullptr, offsetof( AudioSettings, m_globalMaxRange) },
{ "TimeBetweenDrawableSounds", INI::parseDurationUnsignedInt, nullptr, offsetof( AudioSettings, m_drawableAmbientFrames) },
{ "TimeToFadeAudio", INI::parseDurationUnsignedInt, nullptr, offsetof( AudioSettings, m_fadeAudioFrames) },
{ "AudioFootprintInBytes",INI::parseUnsignedInt, nullptr, offsetof( AudioSettings, m_maxCacheSize) },
{ "Relative2DVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_relative2DVolume ) },
{ "DefaultSoundVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_defaultSoundVolume) },
{ "Default3DSoundVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_default3DSoundVolume) },
{ "DefaultSpeechVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_defaultSpeechVolume) },
{ "DefaultMusicVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_defaultMusicVolume) },
{ "DefaultMoneyTransactionVolume", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_defaultMoneyTransactionVolume) },
{ "MicrophoneDesiredHeightAboveTerrain", INI::parseReal, nullptr, offsetof( AudioSettings, m_microphoneDesiredHeightAboveTerrain ) },
{ "MicrophoneMaxPercentageBetweenGroundAndCamera", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_microphoneMaxPercentageBetweenGroundAndCamera ) },
{ "ZoomMinDistance", INI::parseReal, nullptr, offsetof( AudioSettings, m_zoomMinDistance ) },
{ "ZoomMaxDistance", INI::parseReal, nullptr, offsetof( AudioSettings, m_zoomMaxDistance ) },
{ "ZoomSoundVolumePercentageAmount", INI::parsePercentToReal, nullptr, offsetof( AudioSettings, m_zoomSoundVolumePercentageAmount ) },

{ nullptr, nullptr, nullptr, NULL }
Copy link

@localspook localspook Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only 3 of the 4 NULLs got converted? 🤔

Copy link

@localspook localspook Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, because the last field is an integer. (so the last NULL should ideally be 0)

};

// Singleton TheAudio /////////////////////////////////////////////////////////////////////////////
AudioManager *TheAudio = NULL;
AudioManager *TheAudio = nullptr;


// AudioManager Device Independent functions //////////////////////////////////////////////////////
Expand All @@ -146,8 +146,8 @@ AudioManager::AudioManager() :
m_sound3DOn(TRUE),
m_musicOn(TRUE),
m_speechOn(TRUE),
m_music(NULL),
m_sound(NULL),
m_music(nullptr),
m_sound(nullptr),
m_surroundSpeakers(FALSE),
m_hardwareAccel(FALSE),
m_musicPlayingFromCD(FALSE)
Expand All @@ -170,7 +170,7 @@ AudioManager::AudioManager() :
m_audioSettings = NEW AudioSettings;
m_miscAudio = NEW MiscAudio;
m_silentAudioEvent = NEW AudioEventRTS;
m_savedValues = NULL;
m_savedValues = nullptr;
m_disallowSpeech = FALSE;
}

Expand All @@ -186,19 +186,19 @@ AudioManager::~AudioManager()
m_allAudioEventInfo.clear();

delete m_silentAudioEvent;
m_silentAudioEvent = NULL;
m_silentAudioEvent = nullptr;

delete m_music;
m_music = NULL;
m_music = nullptr;

delete m_sound;
m_sound = NULL;
m_sound = nullptr;

delete m_miscAudio;
m_miscAudio = NULL;
m_miscAudio = nullptr;

delete m_audioSettings;
m_audioSettings = NULL;
m_audioSettings = nullptr;

delete [] m_savedValues;
}
Expand All @@ -207,22 +207,22 @@ AudioManager::~AudioManager()
void AudioManager::init()
{
INI ini;
ini.loadFileDirectory( "Data\\INI\\AudioSettings", INI_LOAD_OVERWRITE, NULL);
ini.loadFileDirectory( "Data\\INI\\AudioSettings", INI_LOAD_OVERWRITE, nullptr);

ini.loadFileDirectory( "Data\\INI\\Default\\Music", INI_LOAD_OVERWRITE, NULL );
ini.loadFileDirectory( "Data\\INI\\Music", INI_LOAD_OVERWRITE, NULL );
ini.loadFileDirectory( "Data\\INI\\Default\\Music", INI_LOAD_OVERWRITE, nullptr );
ini.loadFileDirectory( "Data\\INI\\Music", INI_LOAD_OVERWRITE, nullptr );

ini.loadFileDirectory( "Data\\INI\\Default\\SoundEffects", INI_LOAD_OVERWRITE, NULL );
ini.loadFileDirectory( "Data\\INI\\SoundEffects", INI_LOAD_OVERWRITE, NULL );
ini.loadFileDirectory( "Data\\INI\\Default\\SoundEffects", INI_LOAD_OVERWRITE, nullptr );
ini.loadFileDirectory( "Data\\INI\\SoundEffects", INI_LOAD_OVERWRITE, nullptr );

ini.loadFileDirectory( "Data\\INI\\Default\\Speech", INI_LOAD_OVERWRITE, NULL );
ini.loadFileDirectory( "Data\\INI\\Speech", INI_LOAD_OVERWRITE, NULL );
ini.loadFileDirectory( "Data\\INI\\Default\\Speech", INI_LOAD_OVERWRITE, nullptr );
ini.loadFileDirectory( "Data\\INI\\Speech", INI_LOAD_OVERWRITE, nullptr );

ini.loadFileDirectory( "Data\\INI\\Default\\Voice", INI_LOAD_OVERWRITE, NULL );
ini.loadFileDirectory( "Data\\INI\\Voice", INI_LOAD_OVERWRITE, NULL );
ini.loadFileDirectory( "Data\\INI\\Default\\Voice", INI_LOAD_OVERWRITE, nullptr );
ini.loadFileDirectory( "Data\\INI\\Voice", INI_LOAD_OVERWRITE, nullptr );

// do the miscellaneous sound files last so that we find the AudioEventRTS associated with the events.
ini.loadFileDirectory( "Data\\INI\\MiscAudio", INI_LOAD_OVERWRITE, NULL);
ini.loadFileDirectory( "Data\\INI\\MiscAudio", INI_LOAD_OVERWRITE, nullptr);

// determine if one of the music tracks exists. Since their now BIGd, one implies all.
// If they don't exist, then attempt to load them from the CD.
Expand Down Expand Up @@ -498,7 +498,7 @@ Bool AudioManager::isValidAudioEvent(const AudioEventRTS *eventToCheck) const

getInfoForAudioEvent(eventToCheck);

return (eventToCheck->getAudioEventInfo() != NULL);
return (eventToCheck->getAudioEventInfo() != nullptr);
}

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -864,7 +864,7 @@ AudioEventInfo *AudioManager::findAudioEventInfo( AsciiString eventName ) const
AudioEventInfoHash::const_iterator it;
it = m_allAudioEventInfo.find(eventName);
if (it == m_allAudioEventInfo.end()) {
return NULL;
return nullptr;
}

return (*it).second;
Expand Down Expand Up @@ -951,7 +951,7 @@ Real AudioManager::getAudioLengthMS( const AudioEventRTS *event )
//-------------------------------------------------------------------------------------------------
Bool AudioManager::isMusicAlreadyLoaded(void) const
{
const AudioEventInfo *musicToLoad = NULL;
const AudioEventInfo *musicToLoad = nullptr;
AudioEventInfoHash::const_iterator it;
for (it = m_allAudioEventInfo.begin(); it != m_allAudioEventInfo.end(); ++it) {
if (it->second) {
Expand Down Expand Up @@ -1034,12 +1034,12 @@ Bool AudioManager::shouldPlayLocally(const AudioEventRTS *audioEvent)

Player *owningPlayer = ThePlayerList->getNthPlayer(audioEvent->getPlayerIndex());

if (BitIsSet(ei->m_type, ST_PLAYER) && BitIsSet(ei->m_type, ST_UI) && owningPlayer == NULL) {
if (BitIsSet(ei->m_type, ST_PLAYER) && BitIsSet(ei->m_type, ST_UI) && owningPlayer == nullptr) {
DEBUG_ASSERTCRASH(!TheGameLogic->isInGameLogicUpdate(), ("Playing %s sound -- player-based UI sound without specifying a player.", ei->m_audioName.str()));
return TRUE;
}

if (owningPlayer == NULL) {
if (owningPlayer == nullptr) {
DEBUG_CRASH(("Sound '%s' expects an owning player, but the audio event that created it didn't specify one.", ei->m_audioName.str()));
return FALSE;
}
Expand All @@ -1050,7 +1050,7 @@ Bool AudioManager::shouldPlayLocally(const AudioEventRTS *audioEvent)
}

const Team *localTeam = localPlayer->getDefaultTeam();
if (localTeam == NULL) {
if (localTeam == nullptr) {
return FALSE;
}

Expand Down Expand Up @@ -1082,7 +1082,7 @@ AudioHandle AudioManager::allocateNewHandle( void )
void AudioManager::releaseAudioEventRTS( AudioEventRTS *&eventToRelease )
{
delete eventToRelease;
eventToRelease = NULL;
eventToRelease = nullptr;
}

//-------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1116,7 +1116,7 @@ void AudioManager::regainFocus( void )

// Now, blow away the old volumes.
delete [] m_savedValues;
m_savedValues = NULL;
m_savedValues = nullptr;
}

//-------------------------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions Core/GameEngine/Source/Common/Audio/GameMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
const FieldParse MusicTrack::m_musicTrackFieldParseTable[] =
{

{ "Filename", INI::parseAsciiString, NULL, offsetof( MusicTrack, filename ) },
{ "Volume", INI::parsePercentToReal, NULL, offsetof( MusicTrack, volume ) },
{ "Ambient", INI::parseBool, NULL, offsetof( MusicTrack, ambient ) },
{ NULL, NULL, NULL, 0 },
{ "Filename", INI::parseAsciiString, nullptr, offsetof( MusicTrack, filename ) },
{ "Volume", INI::parsePercentToReal, nullptr, offsetof( MusicTrack, volume ) },
{ "Ambient", INI::parseBool, nullptr, offsetof( MusicTrack, ambient ) },
{ nullptr, nullptr, nullptr, 0 },
};


Expand Down
8 changes: 4 additions & 4 deletions Core/GameEngine/Source/Common/FramePacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "GameNetwork/NetworkInterface.h"


FramePacer* TheFramePacer = NULL;
FramePacer* TheFramePacer = nullptr;

FramePacer::FramePacer()
{
Expand Down Expand Up @@ -83,12 +83,12 @@ Bool FramePacer::isActualFramesPerSecondLimitEnabled() const
{
Bool allowFpsLimit = true;

if (TheTacticalView != NULL)
if (TheTacticalView != nullptr)
{
allowFpsLimit &= TheTacticalView->getTimeMultiplier()<=1 && !TheScriptEngine->isTimeFast();
}

if (TheGameLogic != NULL)
if (TheGameLogic != nullptr)
{
#if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
allowFpsLimit &= !(!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode);
Expand Down Expand Up @@ -177,7 +177,7 @@ Int FramePacer::getActualLogicTimeScaleFps(LogicTimeQueryFlags flags) const
return 0;
}

if (TheNetwork != NULL)
if (TheNetwork != nullptr)
{
return TheNetwork->getFrameRate();
}
Expand Down
Loading
Loading