mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-23 06:35:33 -07:00
re-added randomizer checkbox & fixed LH sun
This commit is contained in:
parent
df2b526975
commit
e344f6d0a1
5 changed files with 31 additions and 27 deletions
|
@ -50,6 +50,8 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPAR
|
||||||
using namespace Ship;
|
using namespace Ship;
|
||||||
bool oldCursorState = true;
|
bool oldCursorState = true;
|
||||||
|
|
||||||
|
u8 generated;
|
||||||
|
|
||||||
#define EXPERIMENTAL() \
|
#define EXPERIMENTAL() \
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 50, 50, 255)); \
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 50, 50, 255)); \
|
||||||
ImGui::Text("Experimental"); \
|
ImGui::Text("Experimental"); \
|
||||||
|
@ -423,7 +425,6 @@ namespace SohImGui {
|
||||||
});
|
});
|
||||||
Game::InitSettings();
|
Game::InitSettings();
|
||||||
|
|
||||||
CVar_SetS32("gRandomizer", 0);
|
|
||||||
CVar_SetS32("gRandoGenerating", 0);
|
CVar_SetS32("gRandoGenerating", 0);
|
||||||
CVar_SetS32("gDroppedNewSpoilerFile", 0);
|
CVar_SetS32("gDroppedNewSpoilerFile", 0);
|
||||||
Game::SaveSettings();
|
Game::SaveSettings();
|
||||||
|
@ -434,6 +435,12 @@ namespace SohImGui {
|
||||||
Game::SaveSettings();
|
Game::SaveSettings();
|
||||||
needs_save = false;
|
needs_save = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (generated) {
|
||||||
|
generated = 0;
|
||||||
|
randoThread.join();
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiProcessEvent(event);
|
ImGuiProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1041,6 +1048,8 @@ namespace SohImGui {
|
||||||
|
|
||||||
if (ImGui::BeginMenu("Randomizer"))
|
if (ImGui::BeginMenu("Randomizer"))
|
||||||
{
|
{
|
||||||
|
EnhancementCheckbox("Enable Randomizer", "gRandomizer");
|
||||||
|
|
||||||
if (ImGui::Button("Generate Seed")) {
|
if (ImGui::Button("Generate Seed")) {
|
||||||
if (CVar_GetS32("gRandoGenerating", 0) == 0) {
|
if (CVar_GetS32("gRandoGenerating", 0) == 0) {
|
||||||
randoThread = std::thread(&SohImGui::GenerateRandomizerImgui);
|
randoThread = std::thread(&SohImGui::GenerateRandomizerImgui);
|
||||||
|
@ -1278,6 +1287,8 @@ namespace SohImGui {
|
||||||
Game::SaveSettings();
|
Game::SaveSettings();
|
||||||
|
|
||||||
Game::LoadSettings();
|
Game::LoadSettings();
|
||||||
|
|
||||||
|
generated = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawFramebufferAndGameInput(void) {
|
void DrawFramebufferAndGameInput(void) {
|
||||||
|
|
|
@ -517,13 +517,8 @@ void PrintOptionDescription() {
|
||||||
|
|
||||||
std::string GenerateRandomizer() {
|
std::string GenerateRandomizer() {
|
||||||
// if a blank seed was entered, make a random one
|
// if a blank seed was entered, make a random one
|
||||||
if (Settings::seed.empty()) {
|
srand(time(NULL));
|
||||||
Settings::seed = std::to_string(rand());
|
Settings::seed = std::to_string(rand());
|
||||||
} else if (Settings::seed.rfind("seed_testing_count", 0) == 0) {
|
|
||||||
const int count = std::stoi(Settings::seed.substr(18), nullptr);
|
|
||||||
Playthrough::Playthrough_Repeat(count);
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
int ret = Playthrough::Playthrough_Init(std::hash<std::string>{}(Settings::seed));
|
int ret = Playthrough::Playthrough_Init(std::hash<std::string>{}(Settings::seed));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -1157,11 +1157,6 @@ void Randomizer::ParseItemLocationsFile(const char* spoilerFileName) {
|
||||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
|
||||||
CVar_SetS32("gRandomizer", 1);
|
|
||||||
Game::SaveSettings();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetItemID Randomizer::GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) {
|
GetItemID Randomizer::GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ void ItemEtcetera_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
Actor_SetScale(&this->actor, 0.5f);
|
Actor_SetScale(&this->actor, 0.5f);
|
||||||
this->futureActionFunc = func_80B858B4;
|
this->futureActionFunc = func_80B858B4;
|
||||||
if ((gSaveContext.eventChkInf[3] & 2 && !gSaveContext.n64ddFlag) ||
|
if ((gSaveContext.eventChkInf[3] & 2 && !gSaveContext.n64ddFlag) ||
|
||||||
(gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1F))) {
|
(gSaveContext.n64ddFlag && Flags_GetTreasure(globalCtx, 0x1E))) {
|
||||||
Actor_Kill(&this->actor);
|
Actor_Kill(&this->actor);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -120,18 +120,15 @@ void func_80B857D0(ItemEtcetera* this, GlobalContext* globalCtx) {
|
||||||
|
|
||||||
void func_80B85824(ItemEtcetera* this, GlobalContext* globalCtx) {
|
void func_80B85824(ItemEtcetera* this, GlobalContext* globalCtx) {
|
||||||
if (Actor_HasParent(&this->actor, globalCtx)) {
|
if (Actor_HasParent(&this->actor, globalCtx)) {
|
||||||
if ((this->actor.params & 0xFF) == 1) {
|
if ((this->actor.params & 0xFF) == 7) {
|
||||||
gSaveContext.eventChkInf[3] |= 2;
|
|
||||||
Flags_SetSwitch(globalCtx, 0xB);
|
|
||||||
|
|
||||||
if (gSaveContext.n64ddFlag) {
|
if (gSaveContext.n64ddFlag) {
|
||||||
Flags_SetTreasure(globalCtx, 0x1E);
|
Flags_SetTreasure(globalCtx, 0x1F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Actor_Kill(&this->actor);
|
Actor_Kill(&this->actor);
|
||||||
} else {
|
} else {
|
||||||
if (gSaveContext.n64ddFlag) {
|
if (gSaveContext.n64ddFlag) {
|
||||||
s32 getItemId = GetRandomizedItemId(GI_ARROW_FIRE, this->actor.id, this->actor.params, globalCtx->sceneNum);
|
s32 getItemId = GetRandomizedItemIdFromKnownCheck(RC_LH_SUN, GI_ARROW_FIRE);
|
||||||
func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 50.0f);
|
func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 50.0f);
|
||||||
} else {
|
} else {
|
||||||
func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f);
|
func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f);
|
||||||
|
@ -146,7 +143,7 @@ void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx) {
|
||||||
Flags_SetSwitch(globalCtx, 0xB);
|
Flags_SetSwitch(globalCtx, 0xB);
|
||||||
|
|
||||||
if (gSaveContext.n64ddFlag) {
|
if (gSaveContext.n64ddFlag) {
|
||||||
Flags_SetTreasure(globalCtx, 0x1F);
|
Flags_SetTreasure(globalCtx, 0x1E);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Actor_Kill(&this->actor);
|
Actor_Kill(&this->actor);
|
||||||
|
@ -154,7 +151,7 @@ void func_80B858B4(ItemEtcetera* this, GlobalContext* globalCtx) {
|
||||||
if (0) {} // Necessary to match
|
if (0) {} // Necessary to match
|
||||||
|
|
||||||
if (gSaveContext.n64ddFlag) {
|
if (gSaveContext.n64ddFlag) {
|
||||||
s32 getItemId = GetRandomizedItemId(GI_LETTER_RUTO, this->actor.id, this->actor.params, globalCtx->sceneNum);
|
s32 getItemId = GetRandomizedItemIdFromKnownCheck(RC_LH_UNDERWATER_ITEM, GI_LETTER_RUTO);
|
||||||
func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 50.0f);
|
func_8002F434(&this->actor, globalCtx, getItemId, 30.0f, 50.0f);
|
||||||
} else {
|
} else {
|
||||||
func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f);
|
func_8002F434(&this->actor, globalCtx, this->getItemId, 30.0f, 50.0f);
|
||||||
|
@ -234,9 +231,10 @@ void ItemEtcetera_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
ItemEtcetera* this = (ItemEtcetera*)thisx;
|
ItemEtcetera* this = (ItemEtcetera*)thisx;
|
||||||
s32 type = this->actor.params & 0xFF;
|
s32 type = this->actor.params & 0xFF;
|
||||||
|
|
||||||
if (gSaveContext.n64ddFlag && (type == ITEM_ETC_ARROW_FIRE || type == ITEM_ETC_LETTER)) {
|
if (gSaveContext.n64ddFlag && (type == ITEM_ETC_ARROW_FIRE)) {
|
||||||
this->giDrawId = GetItemModelFromId(
|
this->giDrawId = GetItemModelFromId(GetRandomizedItemIdFromKnownCheck(RC_LH_SUN, GI_ARROW_FIRE));
|
||||||
GetRandomizedItemId(this->getItemId, this->actor.id, this->actor.params, globalCtx->sceneNum));
|
} else if (gSaveContext.n64ddFlag && (type == ITEM_ETC_ARROW_FIRE)) {
|
||||||
|
this->giDrawId = GetItemModelFromId(GetRandomizedItemIdFromKnownCheck(RC_LH_UNDERWATER_ITEM, GI_LETTER_RUTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
func_8002EBCC(&this->actor, globalCtx, 0);
|
func_8002EBCC(&this->actor, globalCtx, 0);
|
||||||
|
|
|
@ -229,6 +229,7 @@ void DrawSeedHashSprites(FileChooseContext* this) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u8 generating;
|
u8 generating;
|
||||||
|
u8 changedSeed;
|
||||||
|
|
||||||
void FileChoose_UpdateMainMenu(GameState* thisx) {
|
void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||||
static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E };
|
static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E };
|
||||||
|
@ -245,13 +246,15 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
|
||||||
Audio_PlayFanfare(NA_BGM_HORSE_GOAL);
|
Audio_PlayFanfare(NA_BGM_HORSE_GOAL);
|
||||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
|
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
|
||||||
generating = 0;
|
generating = 0;
|
||||||
|
changedSeed = 1;
|
||||||
return;
|
return;
|
||||||
} else if (generating) {
|
} else if (generating) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CVar_GetS32("gDroppedNewSpoilerFile", 0) != 0 && !generating) {
|
if (CVar_GetS32("gDroppedNewSpoilerFile", 0) != 0 || changedSeed) {
|
||||||
CVar_SetS32("gDroppedNewSpoilerFile", 0);
|
CVar_SetS32("gDroppedNewSpoilerFile", 0);
|
||||||
|
changedSeed = 0;
|
||||||
const char* fileLoc = CVar_GetString("gSpoilerLog", "");
|
const char* fileLoc = CVar_GetString("gSpoilerLog", "");
|
||||||
LoadItemLocations(fileLoc);
|
LoadItemLocations(fileLoc);
|
||||||
}
|
}
|
||||||
|
@ -892,7 +895,9 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) {
|
||||||
s16 j;
|
s16 j;
|
||||||
s16 deathCountSplit[3];
|
s16 deathCountSplit[3];
|
||||||
|
|
||||||
DrawSeedHashSprites(this);
|
if (CVar_GetS32("gRandomizer", 0) != 0) {
|
||||||
|
DrawSeedHashSprites(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (1) {}
|
if (1) {}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue