This commit is contained in:
Eric Hoey 2024-04-10 22:32:15 +00:00 committed by GitHub
commit a3f446d9bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 63 additions and 15 deletions

View File

@ -26,6 +26,7 @@
#include "src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h"
#include "objects/object_link_boy/object_link_boy.h"
#include "objects/object_link_child/object_link_child.h"
#include "src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.h"
extern "C" {
#include <z64.h>
@ -1360,7 +1361,6 @@ void RegisterToTMedallions() {
});
}
void RegisterFloorSwitchesHook() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor);
@ -1393,6 +1393,20 @@ void RegisterPauseMenuHooks() {
}
});
}
void RegisterBridgeDownAllNight() {
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorUpdate>([](void* refActor) {
Actor* actor = static_cast<Actor*>(refActor);
if (CVarGetInteger("gEnhancements.BridgeOpenAtNight", 0) && (actor->id == ACTOR_BG_SPOT00_HANEBASI) &&
gSaveContext.cutsceneIndex != 0xFFF1) {
BgSpot00Hanebasi* bgSpot00Hanebasi = static_cast<BgSpot00Hanebasi*>(refActor);
((BgSpot00Hanebasi*)actor)->dyna.actor.shape.rot.x = 0;
((BgSpot00Hanebasi*)actor)->destAngle = 0;
}
});
}
void InitMods() {
RegisterTTS();
@ -1428,6 +1442,7 @@ void InitMods() {
RegisterRandomizedEnemySizes();
RegisterOpenAllHours();
RegisterToTMedallions();
RegisterBridgeDownAllNight();
NameTag_RegisterHooks();
RegisterFloorSwitchesHook();
RegisterPatchHandHandler();

View File

@ -145,6 +145,7 @@ const std::vector<const char*> enhancementsCvars = {
"gDampeAllNight",
"gQuitFishingAtDoor",
"gSkipSwimDeepEndAnim",
"gEnhancements.BridgeOpenAtNight",
"gSkipScarecrow",
"gBlueFireArrows",
"gSunlightArrows",

View File

@ -2622,7 +2622,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_PIECE);
messageEntry.Replace("{{heartPieceCount}}", std::to_string(gSaveContext.sohStats.heartPieces + 1));
}
if (textId == TEXT_MARKET_GUARD_NIGHT && CVarGetInteger("gMarketSneak", 0) && play->sceneNum == SCENE_MARKET_ENTRANCE_NIGHT) {
if (textId == TEXT_MARKET_GUARD_NIGHT && (CVarGetInteger("gMarketSneak", 0) || CVarGetInteger("gEnhancements.BridgeOpenAtNight", 0)) && play->sceneNum == SCENE_MARKET_ENTRANCE_NIGHT) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_MARKET_GUARD_NIGHT);
}
if (textId == TEXT_FISHERMAN_LEAVE && CVarGetInteger("gQuitFishingAtDoor", 0)) {

View File

@ -647,8 +647,12 @@ void DrawEnhancementsMenu() {
UIWidgets::Tooltip("Adds a prompt to equip newly-obtained swords, shields and tunics");
UIWidgets::PaddedEnhancementCheckbox("Better Owl", "gBetterOwl", true, false);
UIWidgets::Tooltip("The default response to Kaepora Gaebora is always that you understood what he said");
UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", "gMarketSneak", true, false);
UIWidgets::Tooltip("Allows exiting Hyrule Castle Market Town to Hyrule Field at night by speaking to the guard next to the gate.");
UIWidgets::PaddedEnhancementCheckbox("Bridge Open At Night", "gEnhancements.BridgeOpenAtNight", true, false);
UIWidgets::Tooltip("Makes the bridge to Hyrule Market stay open at night.");
const bool bBridgeOpenAtNightEnabled = CVarGetInteger("gEnhancements.BridgeOpenAtNight", 0);
UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", "gMarketSneak", true, false, bBridgeOpenAtNightEnabled, "Forced enabled when Bridge Open At Night is enabled");
UIWidgets::Tooltip("Allows exiting Hyrule Castle Market Town to Hyrule Field at night by speaking "
"to the guard next to the gate.");
UIWidgets::PaddedEnhancementCheckbox("Shops and Games Always Open", "gEnhancements.OpenAllHours", true, false);
UIWidgets::Tooltip("Shops and minigames are open both day and night. Requires scene reload to take effect.");
UIWidgets::PaddedEnhancementCheckbox("Link as default file name", "gLinkDefaultName", true, false);

View File

@ -154,10 +154,11 @@ void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) {
if (this) {} // required to match
}
if ((this->dyna.actor.shape.rot.x == 0) && (gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT && !IS_DAY) {
this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall;
this->destAngle = -0x4000;
child->destAngle = -0xFE0;
if ((this->dyna.actor.shape.rot.x == 0) && (gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT &&
!IS_DAY) {
this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall;
this->destAngle = -0x4000;
child->destAngle = -0xFE0;
}
}
}
@ -266,10 +267,26 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, PlayState* play2) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
if (gSaveContext.sceneSetupIndex >= 4) {
sTorchFlameScale = 0.008f;
// #region SOH [Enhancement]
if (CVarGetInteger("gEnhancements.BridgeOpenAtNight", 0)) {
if (gSaveContext.sceneSetupIndex >= 4) {
sTorchFlameScale = 0.008f;
} else {
if (gSaveContext.dayTime > 17760 && gSaveContext.dayTime < 18440) {
sTorchFlameScale = (18440 - gSaveContext.dayTime) * (1.0f / 85000.0f);
} else if (gSaveContext.dayTime > 50523 && gSaveContext.dayTime < 51883) {
sTorchFlameScale = (gSaveContext.dayTime - 50523) * (1.0f / 170000.0f);
} else if (gSaveContext.dayTime < 17760 || gSaveContext.dayTime > 51883) {
sTorchFlameScale = 0.008f;
}
}
// #endregion
} else {
sTorchFlameScale = ((thisx->shape.rot.x * -1) - 0x2000) * (1.0f / 1024000.0f);
if (gSaveContext.sceneSetupIndex >= 4) {
sTorchFlameScale = 0.008f;
} else {
sTorchFlameScale = ((thisx->shape.rot.x * -1) - 0x2000) * (1.0f / 1024000.0f);
}
}
angle = (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000) * (M_PI / 32768.0f);
@ -323,10 +340,21 @@ void BgSpot00Hanebasi_Draw(Actor* thisx, PlayState* play) {
thisx->child->child->world.pos.z = newPos.z;
if (gSaveContext.sceneSetupIndex != 12) {
if ((gSaveContext.sceneSetupIndex >= 4) || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) {
BgSpot00Hanebasi_DrawTorches(thisx, play);
// #region SOH [Enhancement]
if (CVarGetInteger("gEnhancements.BridgeOpenAtNight", 0)) {
if ((gSaveContext.sceneSetupIndex >= 4) ||
(!LINK_IS_ADULT && (gSaveContext.dayTime < 18440 || gSaveContext.dayTime > 50523))) {
BgSpot00Hanebasi_DrawTorches(thisx, play);
} else {
sTorchFlameScale = 0.0f;
}
// #endregion
} else {
sTorchFlameScale = 0.0f;
if ((gSaveContext.sceneSetupIndex >= 4) || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) {
BgSpot00Hanebasi_DrawTorches(thisx, play);
} else {
sTorchFlameScale = 0.0f;
}
}
}
} else {

View File

@ -337,7 +337,7 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) {
Player* player = GET_PLAYER(play);
// Only allow sneaking when not wearing a mask as that triggers different dialogue. MM Bunny hood disables
// these interactions, so bunny hood is fine in that case.
if (CVarGetInteger("gMarketSneak", 0) &&
if ((CVarGetInteger("gMarketSneak", 0) || CVarGetInteger("gEnhancements.BridgeOpenAtNight", 0)) &&
(player->currentMask == PLAYER_MASK_NONE ||
(player->currentMask == PLAYER_MASK_BUNNY && CVarGetInteger("gMMBunnyHood", 0)))) {
this->actionFunc = EnHeishi4_MarketSneak;