Port Dampe behavior to vanilla (#1364)

* Port Dampe behavior to vanilla

* Add Dampe winning to Enhanced preset
This commit is contained in:
Josh Bodner 2022-09-19 19:58:10 -07:00 committed by GitHub
parent b18cc9d628
commit e97ba37a5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 7 deletions

View File

@ -24,6 +24,7 @@
#include "UIWidgets.hpp" #include "UIWidgets.hpp"
#include "include/z64audio.h" #include "include/z64audio.h"
#include "soh/SaveManager.h"
#define EXPERIMENTAL() \ #define EXPERIMENTAL() \
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 50, 50, 255)); \ ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 50, 50, 255)); \
@ -157,6 +158,8 @@ namespace GameMenuBar {
CVar_SetS32("gBombchuDrops", 0); CVar_SetS32("gBombchuDrops", 0);
// Always Win Goron Pot // Always Win Goron Pot
CVar_SetS32("gGoronPot", 0); CVar_SetS32("gGoronPot", 0);
// Always Win Dampe Digging First Try
CVar_SetS32("gDampeWin", 0);
// Change Red Potion Effect // Change Red Potion Effect
CVar_SetS32("gRedPotionEffect", 0); CVar_SetS32("gRedPotionEffect", 0);
@ -379,6 +382,8 @@ namespace GameMenuBar {
CVar_SetS32("gFastBoomerang", 1); CVar_SetS32("gFastBoomerang", 1);
// Mask Select in Inventory // Mask Select in Inventory
CVar_SetS32("gMaskSelect", 1); CVar_SetS32("gMaskSelect", 1);
// Always Win Dampe Digging
CVar_SetS32("gDampeWin", 1);
// Disable Navi Call Audio // Disable Navi Call Audio
CVar_SetS32("gDisableNaviCallAudio", 1); CVar_SetS32("gDisableNaviCallAudio", 1);
@ -775,6 +780,9 @@ namespace GameMenuBar {
UIWidgets::Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series"); UIWidgets::Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series");
UIWidgets::PaddedEnhancementCheckbox("Always Win Goron Pot", "gGoronPot", true, false); UIWidgets::PaddedEnhancementCheckbox("Always Win Goron Pot", "gGoronPot", true, false);
UIWidgets::Tooltip("Always get the heart piece/purple rupee from the spinning Goron pot"); UIWidgets::Tooltip("Always get the heart piece/purple rupee from the spinning Goron pot");
UIWidgets::PaddedEnhancementCheckbox("Always Win Dampe Digging Game", "gDampeWin", true, false, SaveManager::Instance->IsRandoFile(),
"This setting is always enabled in randomizer files", UIWidgets::CheckboxGraphics::Checkmark);
UIWidgets::Tooltip("Always win the heart piece/purple rupee on the first dig in Dampe's grave digging game, just like in rando\nIn a rando file, this is unconditionally enabled");
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
if (ImGui::BeginMenu("Potion Values")) if (ImGui::BeginMenu("Potion Values"))

View File

@ -1214,6 +1214,10 @@ void SaveManager::DeleteZeldaFile(int fileNum) {
fileMetaInfo[fileNum].randoSave = false; fileMetaInfo[fileNum].randoSave = false;
} }
bool SaveManager::IsRandoFile() {
return gSaveContext.n64ddFlag != 0 ? true : false;
}
// Functionality required to convert old saves into versioned saves // Functionality required to convert old saves into versioned saves
// DO NOT EDIT ANY OF THE FOLLOWING STRUCTS // DO NOT EDIT ANY OF THE FOLLOWING STRUCTS

View File

@ -57,6 +57,7 @@ public:
void CopyZeldaFile(int from, int to); void CopyZeldaFile(int from, int to);
void DeleteZeldaFile(int fileNum); void DeleteZeldaFile(int fileNum);
bool IsRandoFile();
// Use a name of "" to save to an array. You must be in a SaveArray callback. // Use a name of "" to save to an array. You must be in a SaveArray callback.
template<typename T> template<typename T>

View File

@ -408,7 +408,7 @@ s32 EnTk_ChooseReward(EnTk* this) {
f32 luck; f32 luck;
s32 reward; s32 reward;
if (gSaveContext.n64ddFlag && !Flags_GetCollectible(gGlobalCtx, 0x1F) && this->heartPieceSpawned == 0) { if ((gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && !Flags_GetCollectible(gGlobalCtx, 0x1F) && this->heartPieceSpawned == 0) {
return 3; return 3;
} }
@ -604,7 +604,7 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) {
this->rewardTimer = 0; this->rewardTimer = 0;
if (this->validDigHere == 1 || gSaveContext.n64ddFlag) { if (this->validDigHere == 1 || gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) {
rewardOrigin.x = 0.0f; rewardOrigin.x = 0.0f;
rewardOrigin.y = 0.0f; rewardOrigin.y = 0.0f;
rewardOrigin.z = -40.0f; rewardOrigin.z = -40.0f;
@ -620,21 +620,21 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) {
// merging in dampe tour fix seems messy, so i'm just wrapping this whole thing // merging in dampe tour fix seems messy, so i'm just wrapping this whole thing
// in an n64dd check for now // in an n64dd check for now
if(gSaveContext.n64ddFlag) { if (gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) {
if (this->currentReward == 3) { if (this->currentReward == 3) {
/* /*
* Upgrade the purple rupee reward to the heart piece if this * Upgrade the purple rupee reward to the heart piece if this
* is the first grand prize dig. * is the first grand prize dig.
*/ */
if (!(gSaveContext.itemGetInf[1] & 0x1000) && !gSaveContext.n64ddFlag) { if (!(gSaveContext.itemGetInf[1] & 0x1000) && !(gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0))) {
gSaveContext.itemGetInf[1] |= 0x1000; gSaveContext.itemGetInf[1] |= 0x1000;
this->currentReward = 4; this->currentReward = 4;
} else if (gSaveContext.n64ddFlag && !Flags_GetCollectible(gGlobalCtx, 0x1F) && this->heartPieceSpawned == 0) { } else if ((gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && !Flags_GetCollectible(gGlobalCtx, 0x1F) && this->heartPieceSpawned == 0) {
this->currentReward = 4; this->currentReward = 4;
} }
} }
if (gSaveContext.n64ddFlag && this->currentReward == 4) { if ((gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && this->currentReward == 4) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, rewardPos.x, rewardPos.y, rewardPos.z, 0, Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ITEM00, rewardPos.x, rewardPos.y, rewardPos.z, 0,
0, 0, 0x1F06); 0, 0, 0x1F06);
this->heartPieceSpawned = 1; this->heartPieceSpawned = 1;
@ -670,7 +670,7 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) {
if (this->skelAnime.curFrame >= 32.0f && this->rewardTimer == 10) { if (this->skelAnime.curFrame >= 32.0f && this->rewardTimer == 10) {
/* Play a reward sound shortly after digging */ /* Play a reward sound shortly after digging */
if (!gSaveContext.n64ddFlag && this->validDigHere == 0) { if (!(gSaveContext.n64ddFlag || CVar_GetS32("gDampeWin", 0)) && this->validDigHere == 0) {
/* Bad dig spot */ /* Bad dig spot */
Audio_PlayActorSound2(&this->actor, NA_SE_SY_ERROR); Audio_PlayActorSound2(&this->actor, NA_SE_SY_ERROR);
} else if (this->currentReward == 4) { } else if (this->currentReward == 4) {