Skip to content

Commit 951b6c5

Browse files
committed
[GEN] Backport all Audio changes, incl. localization lookup changes in AudioEventRTS from Zero Hour (#1330)
1 parent 10c1285 commit 951b6c5

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

Generals/Code/GameEngine/Include/Common/GameAudio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ class AudioManager : public SubsystemInterface
316316

317317
// For tracking purposes
318318
virtual AudioHandle allocateNewHandle( void );
319+
319320
// Remove all AudioEventInfo's with the m_isLevelSpecific flag
320321
virtual void removeLevelSpecificAudioEventInfos( void );
321322

Generals/Code/GameEngine/Include/Common/MiscAudio.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ struct MiscAudio
6969
AudioEventRTS m_crateMoney; ///< When money crate is picked up.
7070
AudioEventRTS m_unitPromoted; ///< Unit is promoted.
7171
AudioEventRTS m_repairSparks; ///< Battle drone repairs unit.
72+
AudioEventRTS m_sabotageShutDownBuilding; ///< When Saboteur hits a building
73+
AudioEventRTS m_sabotageResetTimerBuilding; ///< When Saboteur hits a building
7274
AudioEventRTS m_aircraftWheelScreech; ///< When a jet lands on a runway.
7375
};
7476

7577

76-
#endif /* _MISCAUDIO_H_ */
78+
#endif /* _MISCAUDIO_H_ */
79+

Generals/Code/GameEngine/Source/Common/Audio/AudioEventRTS.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,20 +800,23 @@ AsciiString AudioEventRTS::generateFilenameExtension( AudioType audioTypeToPlay
800800
//-------------------------------------------------------------------------------------------------
801801
void AudioEventRTS::adjustForLocalization(AsciiString &strToAdjust)
802802
{
803-
if (TheFileSystem->doesFileExist(strToAdjust.str()))
804-
{
805-
return;
806-
}
807-
808803
const char *str = strToAdjust.reverseFind('\\');
809804
if (!str) {
810805
return;
811806
}
812807

808+
// try the localized version first so that we're guarenteed to get it
809+
// even if the generic data directory holds a version of the file
810+
AsciiString localizedFilePath = generateFilenamePrefix(m_eventInfo->m_soundType, TRUE);
813811
AsciiString filename = str;
812+
localizedFilePath.concat(filename);
813+
814+
if (TheFileSystem->doesFileExist(localizedFilePath.str())) {
815+
strToAdjust = localizedFilePath;
816+
}
817+
// else there was no localized version, so leave the path we received unchanged
814818

815-
strToAdjust = generateFilenamePrefix(m_eventInfo->m_soundType, TRUE);
816-
strToAdjust.concat(filename);
819+
return;
817820
}
818821

819822
//-------------------------------------------------------------------------------------------------

Generals/Code/GameEngine/Source/Common/INI/INIMiscAudio.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ const FieldParse MiscAudio::m_fieldParseTable[] =
6363
{ "CrateMoney", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateMoney ) },
6464
{ "UnitPromoted", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_unitPromoted ) },
6565
{ "RepairSparks", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_repairSparks ) },
66-
{ "AircraftWheelScreech", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_aircraftWheelScreech ) },
66+
{ "SabotageShutDownBuilding", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_sabotageShutDownBuilding ) },
67+
{ "SabotageResetTimeBuilding", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_sabotageResetTimerBuilding ) },
68+
{ "AircraftWheelScreech", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_aircraftWheelScreech ) },
6769

6870
{ 0, 0, 0, 0 }
6971
};

0 commit comments

Comments
 (0)