mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-06-14 14:28:42 -04:00
[Enhancement] Restore Saria's gesture animation in her house (#6569)
under Graphical Restorations
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "src/overlays/actors/ovl_En_Sa/z_en_sa.h"
|
||||
extern "C" PlayState* gPlayState;
|
||||
|
||||
void EnSa_ChangeAnim(EnSa* enSa, s32 index);
|
||||
}
|
||||
|
||||
static constexpr int32_t CVAR_SARIA_GESTURE_DEFAULT = 0;
|
||||
#define CVAR_SARIA_GESTURE_NAME CVAR_ENHANCEMENT("SariaGestureFriendsForever")
|
||||
#define CVAR_SARIA_GESTURE_VALUE CVarGetInteger(CVAR_SARIA_GESTURE_NAME, CVAR_SARIA_GESTURE_DEFAULT)
|
||||
|
||||
// Resets Saria back to her usual swaying animation; otherwise, she stands frozen
|
||||
static void EnSa_ResetAnimation(EnSa* enSa) {
|
||||
static bool sAnimationStarted = false;
|
||||
|
||||
if (enSa->unk_20B == 7 && enSa->unk_20A == 2 && !sAnimationStarted) {
|
||||
sAnimationStarted = true;
|
||||
}
|
||||
|
||||
if (sAnimationStarted && Animation_OnFrame(&enSa->skelAnime, enSa->skelAnime.endFrame)) {
|
||||
EnSa_ChangeAnim(enSa, 4);
|
||||
sAnimationStarted = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void RegisterSariaGestureFriendsForever() {
|
||||
COND_VB_SHOULD(VB_SARIA_GESTURE, CVAR_SARIA_GESTURE_VALUE, {
|
||||
bool isInHouse = gPlayState->sceneNum == SCENE_SARIAS_HOUSE;
|
||||
*should = *should || isInHouse;
|
||||
|
||||
if (isInHouse) {
|
||||
EnSa* enSa = va_arg(args, EnSa*);
|
||||
EnSa_ResetAnimation(enSa);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterSariaGestureFriendsForever, { CVAR_SARIA_GESTURE_NAME });
|
||||
@@ -935,6 +935,14 @@ typedef enum {
|
||||
// - `*PlayState`
|
||||
VB_PLAY_HORSEBACK_ARCHERY,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// play->sceneNum == SCENE_KOKIRI_FOREST
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `*EnSa`
|
||||
VB_SARIA_GESTURE,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
|
||||
@@ -1202,6 +1202,11 @@ void SohMenu::AddMenuEnhancements() {
|
||||
.RaceDisable(false)
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Restores an unfinished feature to pulsate the boss room icon when you are in the boss room."));
|
||||
AddWidget(path, "Saria's Friends Forever Gesture", WIDGET_CVAR_CHECKBOX)
|
||||
.CVar(CVAR_ENHANCEMENT("SariaGestureFriendsForever"))
|
||||
.RaceDisable(false)
|
||||
.Options(CheckboxOptions().Tooltip(
|
||||
"Restores an unused animation of Saria when she says, \"Saria and Link will be friends forever.\""));
|
||||
|
||||
AddWidget(path, "Glitch Restorations", WIDGET_SEPARATOR_TEXT);
|
||||
AddWidget(path, "Fish while Hovering", WIDGET_CVAR_CHECKBOX)
|
||||
|
||||
@@ -544,7 +544,7 @@ void EnSa_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void func_80AF6448(EnSa* this, PlayState* play) {
|
||||
if (play->sceneNum == SCENE_KOKIRI_FOREST) {
|
||||
if (GameInteractor_Should(VB_SARIA_GESTURE, play->sceneNum == SCENE_KOKIRI_FOREST, this)) {
|
||||
if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
|
||||
switch (this->actor.textId) {
|
||||
case 0x1002:
|
||||
|
||||
Reference in New Issue
Block a user