-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom sounds now depend on Master * Effect volume
- Loading branch information
1 parent
2fe148e
commit 46e4d1c
Showing
13 changed files
with
145 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#pragma once | ||
|
||
#include "win_include.hpp" | ||
|
||
#include <unordered_map> | ||
#include <string> | ||
|
||
namespace SM | ||
{ | ||
struct GameSettings | ||
{ | ||
std::unordered_map<std::string, int> int_settings; | ||
std::unordered_map<std::string, float> float_settings; | ||
std::unordered_map<std::string, std::string> string_settings; | ||
|
||
inline static GameSettings* GetInstance() | ||
{ | ||
return *reinterpret_cast<GameSettings**>(std::uintptr_t(GetModuleHandle(NULL)) + 0x12A7840); | ||
} | ||
|
||
inline float get_effect_volume() | ||
{ | ||
auto v_iter = this->float_settings.find("EffectVolume"); | ||
if (v_iter != this->float_settings.end()) | ||
return v_iter->second; | ||
|
||
return 1.0f; | ||
} | ||
|
||
inline float get_master_volume() | ||
{ | ||
auto v_iter = this->float_settings.find("MasterVolume"); | ||
if (v_iter != this->float_settings.end()) | ||
return v_iter->second; | ||
|
||
return 1.0f; | ||
} | ||
|
||
inline static float GetEffectsVolume() | ||
{ | ||
SM::GameSettings* v_game_settings = SM::GameSettings::GetInstance(); | ||
if (v_game_settings) | ||
return v_game_settings->get_effect_volume() * v_game_settings->get_master_volume(); | ||
|
||
return 1.0f; //Default volume | ||
} | ||
|
||
private: | ||
GameSettings() = delete; | ||
GameSettings(const GameSettings&) = delete; | ||
GameSettings(GameSettings&&) = delete; | ||
~GameSettings() = delete; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,6 @@ | ||
#include "Console.hpp" | ||
|
||
#if 1 | ||
namespace Engine | ||
{ | ||
HANDLE Console::Handle = NULL; | ||
__ConsoleOutputHandler Console::Out = {}; | ||
|
||
bool Console::CreateEngineConsole(const wchar_t* title) | ||
{ | ||
if (Console::Handle == NULL) | ||
{ | ||
if (AllocConsole()) | ||
{ | ||
SetConsoleOutputCP(CP_UTF8); | ||
SetConsoleTitleW(title); | ||
|
||
Console::Handle = GetStdHandle(STD_OUTPUT_HANDLE); | ||
|
||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
bool Console::AttachToConsole() | ||
{ | ||
if (Console::Handle == NULL) | ||
{ | ||
Console::Handle = GetStdHandle(STD_OUTPUT_HANDLE); | ||
return (Console::Handle != NULL); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
void Console::DestroyConsole() | ||
{ | ||
if (Console::Handle == NULL) return; | ||
|
||
FreeConsole(); | ||
Console::Handle = NULL; | ||
} | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.