From aa54e2032b14cc6674a0710be809f168122c71b0 Mon Sep 17 00:00:00 2001 From: andy5995 Date: Tue, 11 Sep 2018 21:24:37 -0500 Subject: [PATCH] put filenames back into source code This closes #113 and will help with #110 --- mk/linux/glest.ini | 17 ----------------- mk/macos/glest.ini | 19 ------------------- mk/windows/glest.ini | 17 ----------------- mk/windows/glest_release.ini | 17 ----------------- source/glest_game/global/core_data.cpp | 24 +++++++++++------------- source/glest_game/global/core_data.h | 4 ++-- 6 files changed, 13 insertions(+), 85 deletions(-) diff --git a/mk/linux/glest.ini b/mk/linux/glest.ini index 3a70457c9..da8e06bda 100644 --- a/mk/linux/glest.ini +++ b/mk/linux/glest.ini @@ -94,20 +94,3 @@ UnitParticles=true UserData_Root=$HOME/.zetaglest/ VersionURL=http://zetaglest.dreamhosters.com/files/versions/ Windowed=false - -; sfx -; These can be over-ridden by adding the variables to your glestuser.ini -; file. -; -; FIXME: There should be a way to use the "DataPath" variable -; here (defined above) -PlaySoundAttention=../../../zetaglest-data/data/core/menu/sound/attention.wav -PlaySoundHighlight=../../../zetaglest-data/data/core/menu/sound/highlight.wav -PlaySoundNewServer=../../../zetaglest-data/data/core/menu/sound/attention.wav -PlaySoundMarker=../../../zetaglest-data/data/core/menu/sound/sonar.wav - -; it's recommended that users not over-ride these. The sounds are just for -; menu clicks and should remain very short in duration. -PlaySoundMenuClickA=../../../zetaglest-data/data/core/menu/sound/click_a.wav -PlaySoundMenuClickB=../../../zetaglest-data/data/core/menu/sound/click_b.wav -PlaySoundMenuClickC=../../../zetaglest-data/data/core/menu/sound/click_c.wav diff --git a/mk/macos/glest.ini b/mk/macos/glest.ini index 885028d5c..e7a23b3aa 100644 --- a/mk/macos/glest.ini +++ b/mk/macos/glest.ini @@ -92,22 +92,3 @@ UnitParticles=true UserData_Root=$HOME/.zetaglest/ VersionURL=http://zetaglest.dreamhosters.com/files/versions/ Windowed=true - -; sfx -; These can be over-ridden by adding the variables to your glestuser.ini -; file. -; -; FIXME: There should be a way to use the "DataPath" variable -; here (defined above) -PlaySoundAttention=../../../zetaglest-data/data/core/menu/sound/attention.wav -PlaySoundHighlight=../../../zetaglest-data/data/core/menu/sound/highlight.wav -PlaySoundNewServer=../../../zetaglest-data/data/core/menu/sound/attention.wav -PlaySoundMarker=../../../zetaglest-data/data/core/menu/sound/sonar.wav - -; it's recommended that users not over-ride these. The sounds are just for -; menu clicks and should remain very short in duration. -; it's recommended that users not over-ride these. The sounds are just for -; menu clicks and should remain very short in duration. -PlaySoundMenuClickA=../../../zetaglest-data/data/core/menu/sound/click_a.wav -PlaySoundMenuClickB=../../../zetaglest-data/data/core/menu/sound/click_b.wav -PlaySoundMenuClickC=../../../zetaglest-data/data/core/menu/sound/click_c.wav diff --git a/mk/windows/glest.ini b/mk/windows/glest.ini index 1ad881021..722ab60e1 100644 --- a/mk/windows/glest.ini +++ b/mk/windows/glest.ini @@ -94,20 +94,3 @@ UnitParticles=true UserData_Root=$APPDATA\zetaglest\ VersionURL=http://zetaglest.dreamhosters.com/files/versions/ Windowed=false - -; sfx -; These can be over-ridden by adding the variables to your glestuser.ini -; file. -; -; FIXME: There should be a way to use the "DataPath" variable -; here (defined above) -PlaySoundAttention=..\..\..\..\data\data\core\menu\sound\attention.wav -PlaySoundHighlight=..\..\..\..\data\data\core\menu\sound\highlight.wav -PlaySoundNewServer=..\..\..\..\data\data\core\menu\sound\attention.wav -PlaySoundMarker=..\..\..\..\data\data\core\menu\sound\sonar.wav - -; it's recommended that users not over-ride these. The sounds are just for -; menu clicks and should remain very short in duration. -PlaySoundMenuClickA=..\..\..\..\data\data\core\menu\sound\click_a.wav -PlaySoundMenuClickB=..\..\..\..\data\data\core\menu\sound\click_b.wav -PlaySoundMenuClickC=..\..\..\..\data\data\core\menu\sound\click_c.wav \ No newline at end of file diff --git a/mk/windows/glest_release.ini b/mk/windows/glest_release.ini index 882b91182..7efdfd747 100644 --- a/mk/windows/glest_release.ini +++ b/mk/windows/glest_release.ini @@ -94,20 +94,3 @@ UnitParticles=true UserData_Root=$APPDATA\zetaglest\ VersionURL=http://zetaglest.dreamhosters.com/files/versions/ Windowed=false - -; sfx -; These can be over-ridden by adding the variables to your glestuser.ini -; file. -; -; FIXME: There should be a way to use the "DataPath" variable -; here (defined above) -PlaySoundAttention=data\data\core\menu\sound\attention.wav -PlaySoundHighlight=data\data\core\menu\sound\highlight.wav -PlaySoundNewServer=data\data\core\menu\sound\attention.wav -PlaySoundMarker=data\data\core\menu\sound\sonar.wav - -; it's recommended that users not over-ride these. The sounds are just for -; menu clicks and should remain very short in duration. -PlaySoundMenuClickA=data\data\core\menu\sound\click_a.wav -PlaySoundMenuClickB=data\data\core\menu\sound\click_b.wav -PlaySoundMenuClickC=data\data\core\menu\sound\click_c.wav \ No newline at end of file diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp index aa66c612b..d25e891f5 100644 --- a/source/glest_game/global/core_data.cpp +++ b/source/glest_game/global/core_data.cpp @@ -61,15 +61,13 @@ namespace Glest { static const string CORE_WATER_SOUNDS_PATH = CORE_PATH + "/water_sounds/"; - // Sound effects - // These variables are specified in the ini file - const string PlaySoundClip::sfxAttention = "PlaySoundAttention"; - const string PlaySoundClip::sfxHighlight = "PlaySoundHighlight"; - const string PlaySoundClip::sfxNewServer = "PlaySoundNewServer"; - const string PlaySoundClip::sfxMarker = "PlaySoundMarker"; - const string PlaySoundClip::sfxMenuClickA = "PlaySoundMenuClickA"; - const string PlaySoundClip::sfxMenuClickB = "PlaySoundMenuClickB"; - const string PlaySoundClip::sfxMenuClickC = "PlaySoundMenuClickC"; + const string PlaySoundClip::sfxAttention = CORE_MENU_SOUND_PATH + "attention.wav"; + const string PlaySoundClip::sfxHighlight = CORE_MENU_SOUND_PATH + "highlight.wav"; + const string PlaySoundClip::sfxNewServer = CORE_MENU_SOUND_PATH + "attention.wav"; + const string PlaySoundClip::sfxMarker = CORE_MENU_SOUND_PATH + "sonar.wav"; + const string PlaySoundClip::sfxMenuClickA = CORE_MENU_SOUND_PATH + "click_a.wav"; + const string PlaySoundClip::sfxMenuClickB = CORE_MENU_SOUND_PATH + "click_b.wav"; + const string PlaySoundClip::sfxMenuClickC = CORE_MENU_SOUND_PATH + "click_c.wav"; CoreData & CoreData::getInstance() { static CoreData coreData; @@ -1784,7 +1782,7 @@ namespace Glest { PlaySoundClip::~PlaySoundClip(void) { }; - StaticSound *PlaySoundClip::getSound(const std::string& iniPlaySoundVal) { + StaticSound *PlaySoundClip::getSound(const std::string& PlaySoundVal) { CoreData coreData; int loadAttemptLookupKey = coreData.tsyst_COUNT + 6; if (coreData.itemLoadAttempted.find(loadAttemptLookupKey) == @@ -1793,8 +1791,8 @@ namespace Glest { coreData.itemLoadAttempted[loadAttemptLookupKey] = true; try { - static Config & config = Config::getInstance(); - iniPlaySound.load(config.getString(iniPlaySoundVal, "")); + string data_path = coreData.getDataPath(); + PlaySound.load(getGameCustomCoreDataPath(data_path, PlaySoundVal)); } catch (const megaglest_runtime_error & ex) { message(ex.what(), GlobalStaticFlags::getIsNonGraphicalModeEnabled(), @@ -1802,7 +1800,7 @@ namespace Glest { } } - return &iniPlaySound; + return &PlaySound; } // ================== PRIVATE ======================== diff --git a/source/glest_game/global/core_data.h b/source/glest_game/global/core_data.h index 57fea5d8b..dced3026d 100644 --- a/source/glest_game/global/core_data.h +++ b/source/glest_game/global/core_data.h @@ -336,9 +336,9 @@ namespace Glest { class PlaySoundClip { private: - StaticSound iniPlaySound; + StaticSound PlaySound; public: - StaticSound * getSound(const std::string& iniPlaySoundVal); + StaticSound * getSound(const std::string& PlaySoundVal); static const string sfxAttention; static const string sfxHighlight; static const string sfxNewServer;