2023-01-25 18:13:33 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef GameInteractor_h
|
|
|
|
#define GameInteractor_h
|
|
|
|
|
|
|
|
#include "GameInteractionEffect.h"
|
2023-03-12 03:00:03 -04:00
|
|
|
#include "soh/Enhancements/item-tables/ItemTableTypes.h"
|
2023-01-25 18:13:33 -05:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
/* 0x00 */ GI_LINK_SIZE_NORMAL,
|
|
|
|
/* 0x01 */ GI_LINK_SIZE_GIANT,
|
|
|
|
/* 0x02 */ GI_LINK_SIZE_MINISH,
|
|
|
|
/* 0x03 */ GI_LINK_SIZE_PAPER,
|
2023-03-13 06:37:50 -04:00
|
|
|
/* 0x03 */ GI_LINK_SIZE_SQUISHED,
|
2023-01-31 07:21:16 -05:00
|
|
|
/* 0x04 */ GI_LINK_SIZE_RESET
|
2023-01-25 18:13:33 -05:00
|
|
|
} GILinkSize;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
/* 0x00 */ GI_GRAVITY_LEVEL_LIGHT,
|
|
|
|
/* 0x01 */ GI_GRAVITY_LEVEL_NORMAL,
|
|
|
|
/* 0x02 */ GI_GRAVITY_LEVEL_HEAVY,
|
|
|
|
} GIGravityLevel;
|
|
|
|
|
2023-03-13 06:37:50 -04:00
|
|
|
typedef enum {
|
|
|
|
/* 0x00 */ GI_BUTTONS_CBUTTONS,
|
|
|
|
/* 0x01 */ GI_BUTTONS_DPAD,
|
|
|
|
} GIButtonSet;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
/* */ GI_TIMEOFDAY_DAWN = 32768,
|
|
|
|
/* */ GI_TIMEOFDAY_NOON = 49152,
|
|
|
|
/* */ GI_TIMEOFDAY_DUSK = 0,
|
|
|
|
/* */ GI_TIMEOFDAY_MIDNIGHT = 16384,
|
|
|
|
} GITimeOfDay;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
/* 0x00 */ GI_COSMETICS_TUNICS,
|
|
|
|
/* 0x01 */ GI_COSMETICS_NAVI,
|
|
|
|
/* 0x02 */ GI_COSMETICS_HAIR,
|
|
|
|
} GICosmeticCategories;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
/* 0x00 */ GI_COLOR_RED,
|
|
|
|
/* 0x01 */ GI_COLOR_GREEN,
|
|
|
|
/* 0x02 */ GI_COLOR_BLUE,
|
|
|
|
/* 0x03 */ GI_COLOR_ORANGE,
|
|
|
|
/* 0x04 */ GI_COLOR_YELLOW,
|
|
|
|
/* 0x05 */ GI_COLOR_PURPLE,
|
|
|
|
/* 0x06 */ GI_COLOR_PINK,
|
|
|
|
/* 0x07 */ GI_COLOR_BROWN,
|
|
|
|
/* 0x08 */ GI_COLOR_BLACK,
|
|
|
|
} GIColors;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
/* */ GI_TP_DEST_LINKSHOUSE = 187,
|
|
|
|
/* */ GI_TP_DEST_MINUET = 1536,
|
|
|
|
/* */ GI_TP_DEST_BOLERO = 1270,
|
|
|
|
/* */ GI_TP_DEST_SERENADE = 1540,
|
|
|
|
/* */ GI_TP_DEST_REQUIEM = 497,
|
|
|
|
/* */ GI_TP_DEST_NOCTURNE = 1384,
|
|
|
|
/* */ GI_TP_DEST_PRELUDE = 1524,
|
|
|
|
} GITeleportDestinations;
|
|
|
|
|
2023-01-25 18:13:33 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
uint8_t GameInteractor_NoUIActive();
|
2023-01-31 07:21:16 -05:00
|
|
|
GILinkSize GameInteractor_GetLinkSize();
|
|
|
|
void GameInteractor_SetLinkSize(GILinkSize size);
|
2023-01-25 18:13:33 -05:00
|
|
|
uint8_t GameInteractor_InvisibleLinkActive();
|
|
|
|
uint8_t GameInteractor_OneHitKOActive();
|
|
|
|
uint8_t GameInteractor_PacifistModeActive();
|
|
|
|
uint8_t GameInteractor_DisableZTargetingActive();
|
|
|
|
uint8_t GameInteractor_ReverseControlsActive();
|
|
|
|
int32_t GameInteractor_DefenseModifier();
|
|
|
|
int32_t GameInteractor_RunSpeedModifier();
|
|
|
|
GIGravityLevel GameInteractor_GravityLevel();
|
2023-03-13 06:37:50 -04:00
|
|
|
uint32_t GameInteractor_GetEmulatedButtons();
|
|
|
|
void GameInteractor_SetEmulatedButtons(uint32_t buttons);
|
|
|
|
uint8_t GameInteractor_GetRandomBombFuseTimerActive();
|
|
|
|
uint8_t GameInteractor_GetDisableLedgeGrabsActive();
|
|
|
|
uint8_t GameInteractor_GetRandomWindActive();
|
|
|
|
uint8_t GameInteractor_GetRandomBonksActive();
|
|
|
|
uint8_t GameInteractor_GetSlipperyFloorActive();
|
2023-04-02 04:00:21 -04:00
|
|
|
uint8_t GameInteractor_SecondCollisionUpdate();
|
2023-01-25 18:13:33 -05:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2023-02-15 14:30:34 -05:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#define DEFINE_HOOK(name, type) \
|
|
|
|
struct name { \
|
|
|
|
typedef std::function<type> fn; \
|
|
|
|
}
|
|
|
|
|
2023-01-25 18:13:33 -05:00
|
|
|
class GameInteractor {
|
|
|
|
public:
|
|
|
|
static GameInteractor* Instance;
|
|
|
|
|
|
|
|
// Gsme State
|
|
|
|
class State {
|
|
|
|
public:
|
|
|
|
static bool NoUIActive;
|
|
|
|
static GILinkSize LinkSize;
|
|
|
|
static bool InvisibleLinkActive;
|
|
|
|
static bool OneHitKOActive;
|
|
|
|
static bool PacifistModeActive;
|
|
|
|
static bool DisableZTargetingActive;
|
|
|
|
static bool ReverseControlsActive;
|
|
|
|
static int32_t DefenseModifier;
|
|
|
|
static int32_t RunSpeedModifier;
|
|
|
|
static GIGravityLevel GravityLevel;
|
2023-03-13 06:37:50 -04:00
|
|
|
static uint32_t EmulatedButtons;
|
|
|
|
static uint8_t RandomBombFuseTimerActive;
|
|
|
|
static uint8_t DisableLedgeGrabsActive;
|
|
|
|
static uint8_t RandomWindActive;
|
|
|
|
static uint8_t RandomWindSecondsSinceLastDirectionChange;
|
|
|
|
static uint8_t RandomBonksActive;
|
|
|
|
static uint8_t SlipperyFloorActive;
|
2023-04-02 04:00:21 -04:00
|
|
|
static uint8_t SecondCollisionUpdate;
|
2023-01-25 18:13:33 -05:00
|
|
|
|
|
|
|
static void SetPacifistMode(bool active);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Effects
|
|
|
|
static GameInteractionEffectQueryResult CanApplyEffect(GameInteractionEffectBase* effect);
|
|
|
|
static GameInteractionEffectQueryResult ApplyEffect(GameInteractionEffectBase* effect);
|
|
|
|
static GameInteractionEffectQueryResult RemoveEffect(GameInteractionEffectBase* effect);
|
|
|
|
|
2023-02-15 14:30:34 -05:00
|
|
|
// Game Hooks
|
|
|
|
template <typename H> struct RegisteredGameHooks { inline static std::vector<typename H::fn> functions; };
|
|
|
|
template <typename H> void RegisterGameHook(typename H::fn h) { RegisteredGameHooks<H>::functions.push_back(h); }
|
|
|
|
template <typename H, typename... Args> void ExecuteHooks(Args&&... args) {
|
|
|
|
for (auto& fn : RegisteredGameHooks<H>::functions) {
|
|
|
|
fn(std::forward<Args>(args)...);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-26 23:04:57 -05:00
|
|
|
DEFINE_HOOK(OnLoadGame, void(int32_t fileNum));
|
|
|
|
DEFINE_HOOK(OnExitGame, void(int32_t fileNum));
|
2023-02-28 05:20:43 -05:00
|
|
|
DEFINE_HOOK(OnGameFrameUpdate, void());
|
2023-03-12 03:00:03 -04:00
|
|
|
DEFINE_HOOK(OnItemReceive, void(GetItemEntry itemEntry));
|
|
|
|
DEFINE_HOOK(OnSaleEnd, void(GetItemEntry itemEntry));
|
2023-03-02 03:27:28 -05:00
|
|
|
DEFINE_HOOK(OnSceneInit, void(int16_t sceneNum));
|
2023-02-28 03:52:32 -05:00
|
|
|
DEFINE_HOOK(OnPlayerUpdate, void());
|
2023-04-02 04:00:21 -04:00
|
|
|
DEFINE_HOOK(OnActorUpdate, void(void* actor));
|
2023-03-12 03:10:03 -04:00
|
|
|
DEFINE_HOOK(OnPlayerBonk, void());
|
2023-02-15 14:30:34 -05:00
|
|
|
|
2023-02-26 23:04:57 -05:00
|
|
|
DEFINE_HOOK(OnSaveFile, void(int32_t fileNum));
|
|
|
|
DEFINE_HOOK(OnLoadFile, void(int32_t fileNum));
|
|
|
|
DEFINE_HOOK(OnDeleteFile, void(int32_t fileNum));
|
2023-03-02 03:27:28 -05:00
|
|
|
|
|
|
|
DEFINE_HOOK(OnDialogMessage, void());
|
|
|
|
DEFINE_HOOK(OnPresentTitleCard, void());
|
|
|
|
DEFINE_HOOK(OnInterfaceUpdate, void());
|
|
|
|
DEFINE_HOOK(OnKaleidoscopeUpdate, void(int16_t inDungeonScene));
|
|
|
|
|
|
|
|
DEFINE_HOOK(OnPresentFileSelect, void());
|
|
|
|
DEFINE_HOOK(OnUpdateFileSelectSelection, void(uint16_t optionIndex));
|
|
|
|
DEFINE_HOOK(OnUpdateFileCopySelection, void(uint16_t optionIndex));
|
|
|
|
DEFINE_HOOK(OnUpdateFileCopyConfirmationSelection, void(uint16_t optionIndex));
|
|
|
|
DEFINE_HOOK(OnUpdateFileEraseSelection, void(uint16_t optionIndex));
|
|
|
|
DEFINE_HOOK(OnUpdateFileEraseConfirmationSelection, void(uint16_t optionIndex));
|
|
|
|
DEFINE_HOOK(OnUpdateFileAudioSelection, void(uint8_t optionIndex));
|
|
|
|
DEFINE_HOOK(OnUpdateFileTargetSelection, void(uint8_t optionIndex));
|
|
|
|
|
|
|
|
DEFINE_HOOK(OnSetGameLanguage, void());
|
2023-02-15 14:30:34 -05:00
|
|
|
|
2023-01-25 18:13:33 -05:00
|
|
|
// Helpers
|
|
|
|
static bool IsSaveLoaded();
|
|
|
|
static bool IsGameplayPaused();
|
2023-03-13 06:37:50 -04:00
|
|
|
static bool CanSpawnActor();
|
|
|
|
static bool CanAddOrTakeAmmo(int16_t amount, int16_t item);
|
2023-01-25 18:13:33 -05:00
|
|
|
|
|
|
|
class RawAction {
|
|
|
|
public:
|
|
|
|
static void AddOrRemoveHealthContainers(int16_t amount);
|
|
|
|
static void AddOrRemoveMagic(int8_t amount);
|
|
|
|
static void HealOrDamagePlayer(int16_t hearts);
|
|
|
|
static void SetPlayerHealth(int16_t hearts);
|
|
|
|
static void SetLinkInvisibility(bool active);
|
|
|
|
static void SetWeatherStorm(bool active);
|
|
|
|
static void ForceEquipBoots(int8_t boots);
|
|
|
|
static void FreezePlayer();
|
|
|
|
static void BurnPlayer();
|
|
|
|
static void ElectrocutePlayer();
|
|
|
|
static void KnockbackPlayer(float strength);
|
2023-03-13 06:37:50 -04:00
|
|
|
static void GiveOrTakeShield(int32_t shield);
|
2023-01-25 18:13:33 -05:00
|
|
|
static void ForceInterfaceUpdate();
|
2023-04-02 04:00:21 -04:00
|
|
|
static void UpdateActor(void* refActor);
|
2023-03-13 06:37:50 -04:00
|
|
|
static void TeleportPlayer(int32_t nextEntrance);
|
|
|
|
static void ClearAssignedButtons(uint8_t buttonSet);
|
|
|
|
static void SetTimeOfDay(uint32_t time);
|
|
|
|
static void SetCollisionViewer(bool active);
|
|
|
|
static void SetCosmeticsColor(uint8_t cosmeticCategory, uint8_t colorValue);
|
|
|
|
static void RandomizeCosmeticsColors(bool excludeBiddingWarColors);
|
|
|
|
static void EmulateButtonPress(int32_t button);
|
|
|
|
static void AddOrTakeAmmo(int16_t amount, int16_t item);
|
|
|
|
static void EmulateRandomButtonPress(uint32_t chancePercentage = 100);
|
|
|
|
static void SetRandomWind(bool active);
|
|
|
|
static void SetPlayerInvincibility(bool active);
|
2023-01-25 18:13:33 -05:00
|
|
|
|
|
|
|
static GameInteractionEffectQueryResult SpawnEnemyWithOffset(uint32_t enemyId, int32_t enemyParams);
|
2023-03-13 06:37:50 -04:00
|
|
|
static GameInteractionEffectQueryResult SpawnActor(uint32_t actorId, int32_t actorParams);
|
2023-01-25 18:13:33 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* GameInteractor_h */
|