mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 10:50:29 -05:00
Extra modes tweaks (#2985)
* Tweaks to extra modes menu * Update soh/soh/config/ConfigUpdaters.cpp Co-authored-by: Christopher Leggett <chris@leggett.dev> --------- Co-authored-by: Christopher Leggett <chris@leggett.dev>
This commit is contained in:
parent
6dc227b5ed
commit
170c8ce16e
@ -2,6 +2,7 @@
|
|||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "soh/Enhancements/randomizer/3drando/random.hpp"
|
#include "soh/Enhancements/randomizer/3drando/random.hpp"
|
||||||
|
#include "soh/Enhancements/enhancementTypes.h"
|
||||||
#include "variables.h"
|
#include "variables.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -232,16 +233,13 @@ extern "C" uint8_t GetRandomizedEnemy(PlayState* play, int16_t *actorId, f32 *po
|
|||||||
}
|
}
|
||||||
|
|
||||||
EnemyEntry GetRandomizedEnemyEntry(uint32_t seed) {
|
EnemyEntry GetRandomizedEnemyEntry(uint32_t seed) {
|
||||||
if (CVarGetInteger("gSeededRandomizedEnemies", 0) && gSaveContext.n64ddFlag) {
|
if (CVarGetInteger("gRandomizedEnemies", ENEMY_RANDOMIZER_OFF) == ENEMY_RANDOMIZER_RANDOM_SEEDED) {
|
||||||
uint32_t finalSeed = seed + gSaveContext.seedIcons[0] + gSaveContext.seedIcons[1] + gSaveContext.seedIcons[2] +
|
uint32_t finalSeed = seed + (gSaveContext.n64ddFlag ? (gSaveContext.seedIcons[0] + gSaveContext.seedIcons[1] + gSaveContext.seedIcons[2] + gSaveContext.seedIcons[3] + gSaveContext.seedIcons[4]) : gSaveContext.sohStats.fileCreatedAt);
|
||||||
gSaveContext.seedIcons[3] + gSaveContext.seedIcons[4];
|
|
||||||
Random_Init(finalSeed);
|
Random_Init(finalSeed);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t randomNumber = Random(0, RANDOMIZED_ENEMY_SPAWN_TABLE_SIZE);
|
uint32_t randomNumber = Random(0, RANDOMIZED_ENEMY_SPAWN_TABLE_SIZE);
|
||||||
return randomizedEnemySpawnTable[randomNumber];
|
return randomizedEnemySpawnTable[randomNumber];
|
||||||
} else {
|
|
||||||
uint32_t randomNumber = rand() + seed;
|
|
||||||
return randomizedEnemySpawnTable[randomNumber % RANDOMIZED_ENEMY_SPAWN_TABLE_SIZE];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsEnemyFoundToRandomize(int16_t sceneNum, int8_t roomNum, int16_t actorId, int16_t params, float posX) {
|
bool IsEnemyFoundToRandomize(int16_t sceneNum, int8_t roomNum, int16_t actorId, int16_t params, float posX) {
|
||||||
|
@ -18,6 +18,12 @@ typedef enum {
|
|||||||
MIRRORED_WORLD_RANDOM_SEEDED,
|
MIRRORED_WORLD_RANDOM_SEEDED,
|
||||||
} MirroredWorldMode;
|
} MirroredWorldMode;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ENEMY_RANDOMIZER_OFF,
|
||||||
|
ENEMY_RANDOMIZER_RANDOM,
|
||||||
|
ENEMY_RANDOMIZER_RANDOM_SEEDED,
|
||||||
|
} EnemyRandomizerMode;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FASTFILE_1,
|
FASTFILE_1,
|
||||||
FASTFILE_2,
|
FASTFILE_2,
|
||||||
|
@ -63,6 +63,7 @@ std::string GetWindowButtonText(const char* text, bool menuOpen) {
|
|||||||
static const char* chestStyleMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" };
|
static const char* chestStyleMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" };
|
||||||
static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" };
|
static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" };
|
||||||
static const char* mirroredWorldModes[4] = { "Disabled", "Always", "Random", "Random (Seeded)" };
|
static const char* mirroredWorldModes[4] = { "Disabled", "Always", "Random", "Random (Seeded)" };
|
||||||
|
static const char* enemyRandomizerModes[3] = { "Disabled", "Random", "Random (Seeded)" };
|
||||||
static const char* allPowers[9] = {
|
static const char* allPowers[9] = {
|
||||||
"Vanilla (1x)",
|
"Vanilla (1x)",
|
||||||
"Double (2x)",
|
"Double (2x)",
|
||||||
@ -1031,7 +1032,18 @@ void DrawEnhancementsMenu() {
|
|||||||
UIWidgets::Spacer(0);
|
UIWidgets::Spacer(0);
|
||||||
|
|
||||||
if (ImGui::BeginMenu("Extra Modes")) {
|
if (ImGui::BeginMenu("Extra Modes")) {
|
||||||
UIWidgets::PaddedText("Mirrored World Mode", true, false);
|
#ifdef ENABLE_CROWD_CONTROL
|
||||||
|
if (UIWidgets::PaddedEnhancementCheckbox("Crowd Control", "gCrowdControl", false, false)) {
|
||||||
|
if (CVarGetInteger("gCrowdControl", 0)) {
|
||||||
|
CrowdControl::Instance->Enable();
|
||||||
|
} else {
|
||||||
|
CrowdControl::Instance->Disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UIWidgets::Tooltip("Will attempt to connect to the Crowd Control server. Check out crowdcontrol.live for more information.");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
UIWidgets::PaddedText("Mirrored World", true, false);
|
||||||
if (UIWidgets::EnhancementCombobox("gMirroredWorldMode", mirroredWorldModes, MIRRORED_WORLD_OFF) && gPlayState != NULL) {
|
if (UIWidgets::EnhancementCombobox("gMirroredWorldMode", mirroredWorldModes, MIRRORED_WORLD_OFF) && gPlayState != NULL) {
|
||||||
UpdateMirrorModeState(gPlayState->sceneNum);
|
UpdateMirrorModeState(gPlayState->sceneNum);
|
||||||
}
|
}
|
||||||
@ -1042,18 +1054,23 @@ void DrawEnhancementsMenu() {
|
|||||||
"- Random (Seeded): Scenes are mirrored based on the current randomizer seed/file\n"
|
"- Random (Seeded): Scenes are mirrored based on the current randomizer seed/file\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
UIWidgets::Spacer(0);
|
UIWidgets::PaddedText("Enemy Randomizer", true, false);
|
||||||
|
UIWidgets::EnhancementCombobox("gRandomizedEnemies", enemyRandomizerModes, ENEMY_RANDOMIZER_OFF);
|
||||||
|
UIWidgets::Tooltip(
|
||||||
|
"Replaces fixed enemies throughout the game with a random enemy. Bosses, mini-bosses and a few specific regular enemies are excluded.\n"
|
||||||
|
"Enemies that need more than Deku Nuts + either Deku Sticks or a sword to kill are excluded from spawning in \"clear enemy\" rooms.\n\n"
|
||||||
|
"- Random: Enemies are randomized every time you load a room\n"
|
||||||
|
"- Random (Seeded): Enemies are randomized based on the current randomizer seed/file\n"
|
||||||
|
);
|
||||||
|
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false);
|
||||||
UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and "
|
UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and "
|
||||||
"press the C-Buttons to use items and mess with Player 1!");
|
"press the C-Buttons to use items and mess with Player 1!");
|
||||||
|
|
||||||
UIWidgets::Spacer(0);
|
|
||||||
|
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Rupee Dash Mode", "gRupeeDash", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Rupee Dash Mode", "gRupeeDash", true, false);
|
||||||
|
UIWidgets::Tooltip("Rupees reduced over time, Link suffers damage when the count hits 0.");
|
||||||
|
|
||||||
if (CVarGetInteger("gRupeeDash", 0)) {
|
if (CVarGetInteger("gRupeeDash", 0)) {
|
||||||
UIWidgets::Tooltip("Rupees reduced over time, Link suffers damage when the count hits 0.");
|
|
||||||
UIWidgets::PaddedEnhancementSliderInt(
|
UIWidgets::PaddedEnhancementSliderInt(
|
||||||
"Rupee Dash Interval: %d", "##DashInterval", "gDashInterval", 3, 5, "", 5, true, true, false,
|
"Rupee Dash Interval: %d", "##DashInterval", "gDashInterval", 3, 5, "", 5, true, true, false,
|
||||||
!CVarGetInteger("gRupeeDash", 0),
|
!CVarGetInteger("gRupeeDash", 0),
|
||||||
@ -1061,13 +1078,8 @@ void DrawEnhancementsMenu() {
|
|||||||
UIWidgets::Tooltip("Interval between Rupee reduction in Rupee Dash Mode");
|
UIWidgets::Tooltip("Interval between Rupee reduction in Rupee Dash Mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
UIWidgets::Spacer(0);
|
|
||||||
|
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Shadow Tag Mode", "gShadowTag", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Shadow Tag Mode", "gShadowTag", true, false);
|
||||||
|
|
||||||
if (CVarGetInteger("gShadowTag", 0)) {
|
|
||||||
UIWidgets::Tooltip("A wallmaster follows Link everywhere, don't get caught!");
|
UIWidgets::Tooltip("A wallmaster follows Link everywhere, don't get caught!");
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
@ -1421,38 +1433,6 @@ void DrawRandomizerMenu() {
|
|||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
UIWidgets::PaddedSeparator();
|
|
||||||
|
|
||||||
#ifdef ENABLE_CROWD_CONTROL
|
|
||||||
UIWidgets::EnhancementCheckbox("Crowd Control", "gCrowdControl");
|
|
||||||
UIWidgets::Tooltip("Will attempt to connect to the Crowd Control server. Check out crowdcontrol.live for more information.");
|
|
||||||
|
|
||||||
if (CVarGetInteger("gCrowdControl", 0)) {
|
|
||||||
CrowdControl::Instance->Enable();
|
|
||||||
} else {
|
|
||||||
CrowdControl::Instance->Disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
UIWidgets::Spacer(0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UIWidgets::EnhancementCheckbox("Enemy Randomizer", "gRandomizedEnemies");
|
|
||||||
UIWidgets::Tooltip(
|
|
||||||
"Randomizes regular enemies every time you load a room. Bosses, mini-bosses and a few specific regular enemies are excluded.\n\n"
|
|
||||||
"Enemies that need more than Deku Nuts + either Deku Sticks or a sword to kill are excluded from spawning in \"clear enemy\" rooms."
|
|
||||||
);
|
|
||||||
|
|
||||||
if (CVarGetInteger("gRandomizedEnemies", 0)) {
|
|
||||||
|
|
||||||
bool disableSeededEnemies = !gSaveContext.n64ddFlag && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2;
|
|
||||||
static const char* disableSeededEnemiesText = "This setting is disabled because it relies on a randomizer savefile.";
|
|
||||||
|
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Seeded Enemy Spawns", "gSeededRandomizedEnemies", true, false, disableSeededEnemies, disableSeededEnemiesText);
|
|
||||||
UIWidgets::Tooltip(
|
|
||||||
"Enemy spawns will stay consistent throughout room reloads. Enemy spawns are based on randomizer seeds, so this only works with randomizer savefiles."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,5 +53,11 @@ namespace LUS {
|
|||||||
CVarSetInteger("gZFightingMode", CVarGetInteger("gDirtPathFix", 0));
|
CVarSetInteger("gZFightingMode", CVarGetInteger("gDirtPathFix", 0));
|
||||||
CVarClear("gDirtPathFix");
|
CVarClear("gDirtPathFix");
|
||||||
}
|
}
|
||||||
|
if (CVarGetInteger("gRandomizedEnemies", 0) != 0) {
|
||||||
|
if (CVarGetInteger("gSeededRandomizedEnemies", 0)) {
|
||||||
|
CVarSetInteger("gRandomizedEnemies", 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CVarClear("gSeededRandomizedEnemies");
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user