mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-14 02:27:21 -07:00
Merge a3e41841bf
into 237dcfec74
This commit is contained in:
commit
477efb9bb3
4 changed files with 33 additions and 0 deletions
|
@ -465,8 +465,17 @@ void AudioEditorRegisterOnSceneInitHook() {
|
|||
});
|
||||
}
|
||||
|
||||
void AudioEditorRegisterOnGenerationCompletionHook() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGenerationCompletion>([]() {
|
||||
if (CVarGetInteger(CVAR_AUDIO("RandomizeAllOnRandoGen"), 0)) {
|
||||
AudioEditor_RandomizeAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void AudioEditor::InitElement() {
|
||||
AudioEditorRegisterOnSceneInitHook();
|
||||
AudioEditorRegisterOnGenerationCompletionHook();
|
||||
}
|
||||
|
||||
void AudioEditor::DrawElement() {
|
||||
|
@ -570,6 +579,12 @@ void AudioEditor::DrawElement() {
|
|||
.Color(THEME_COLOR)
|
||||
.Tooltip(
|
||||
"Enables randomizing all unlocked music and sound effects when you enter a new scene."));
|
||||
UIWidgets::CVarCheckbox("Randomize All Music and Sound Effects on Randomizer Generation",
|
||||
CVAR_AUDIO("RandomizeAllOnRandoGen"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Enables randomizing all unlocked music and sound effects when "
|
||||
"you generate a new randomizer."));
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Lower Octaves of Unplayable High Notes", CVAR_AUDIO("ExperimentalOctaveDrop"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
|
|
|
@ -2382,6 +2382,11 @@ void CosmeticsEditorWindow::DrawElement() {
|
|||
.Color(THEME_COLOR)
|
||||
.Tooltip("Enables randomizing all unlocked cosmetics when you enter a new scene."));
|
||||
ImGui::EndDisabled();
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Randomize All on Randomizer Generation", CVAR_COSMETIC("RandomizeAllOnRandoGen"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.Tooltip("Enables randomizing all unlocked cosmetics when you generate a new randomizer."));
|
||||
UIWidgets::CVarCheckbox(
|
||||
"Advanced Mode", CVAR_COSMETIC("AdvancedMode"),
|
||||
UIWidgets::CheckboxOptions()
|
||||
|
@ -2589,6 +2594,14 @@ void Cosmetics_RegisterOnSceneInitHook() {
|
|||
});
|
||||
}
|
||||
|
||||
void CosmeticsEditorRegisterOnGenerationCompletionHook() {
|
||||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnGenerationCompletion>([]() {
|
||||
if (CVarGetInteger(CVAR_COSMETIC("RandomizeAllOnRandoGen"), 0)) {
|
||||
CosmeticsEditor_RandomizeAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void CosmeticsEditorWindow::InitElement() {
|
||||
// Convert the `current color` into the format that the ImGui color picker expects
|
||||
for (auto& [id, cosmeticOption] : cosmeticOptions) {
|
||||
|
@ -2608,6 +2621,7 @@ void CosmeticsEditorWindow::InitElement() {
|
|||
RegisterOnLoadGameHook();
|
||||
RegisterOnGameFrameUpdateHook();
|
||||
Cosmetics_RegisterOnSceneInitHook();
|
||||
CosmeticsEditorRegisterOnGenerationCompletionHook();
|
||||
}
|
||||
|
||||
void CosmeticsEditor_RandomizeAll() {
|
||||
|
|
|
@ -68,6 +68,7 @@ DEFINE_HOOK(OnUpdateFileBossRushOptionSelection, (uint8_t optionIndex, uint8_t o
|
|||
DEFINE_HOOK(OnUpdateFileRandomizerOptionSelection, (uint8_t optionIndex));
|
||||
DEFINE_HOOK(OnUpdateFileNameSelection, (int16_t charCode));
|
||||
DEFINE_HOOK(OnFileChooseMain, (void* gameState));
|
||||
DEFINE_HOOK(OnGenerationCompletion, ());
|
||||
|
||||
DEFINE_HOOK(OnSetGameLanguage, ());
|
||||
DEFINE_HOOK(OnFileDropped, (std::string filePath));
|
||||
|
|
|
@ -3798,6 +3798,8 @@ void GenerateRandomizerImgui(std::string seed = "") {
|
|||
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
|
||||
|
||||
generated = 1;
|
||||
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnGenerationCompletion>();
|
||||
}
|
||||
|
||||
bool GenerateRandomizer(std::string seed /*= ""*/) {
|
||||
|
@ -3807,6 +3809,7 @@ bool GenerateRandomizer(std::string seed /*= ""*/) {
|
|||
}
|
||||
if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) == 0) {
|
||||
randoThread = std::thread(&GenerateRandomizerImgui, seed);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue