mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-04 01:23:18 -04:00
Add flag set/unset hooks and GI actions (#3065)
This commit is contained in:
@@ -668,6 +668,7 @@ void Flags_SetSwitch(PlayState* play, s32 flag) {
|
||||
} else {
|
||||
play->actorCtx.flags.tempSwch |= (1 << (flag - 0x20));
|
||||
}
|
||||
GameInteractor_ExecuteOnSceneFlagSet(play->sceneNum, FLAG_SCENE_SWITCH, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,6 +681,7 @@ void Flags_UnsetSwitch(PlayState* play, s32 flag) {
|
||||
} else {
|
||||
play->actorCtx.flags.tempSwch &= ~(1 << (flag - 0x20));
|
||||
}
|
||||
GameInteractor_ExecuteOnSceneFlagUnset(play->sceneNum, FLAG_SCENE_SWITCH, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -728,6 +730,7 @@ s32 Flags_GetTreasure(PlayState* play, s32 flag) {
|
||||
void Flags_SetTreasure(PlayState* play, s32 flag) {
|
||||
lusprintf(__FILE__, __LINE__, 2, "Treasure Flag Set - %#x", flag);
|
||||
play->actorCtx.flags.chest |= (1 << flag);
|
||||
GameInteractor_ExecuteOnSceneFlagSet(play->sceneNum, FLAG_SCENE_TREASURE, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -742,6 +745,7 @@ s32 Flags_GetClear(PlayState* play, s32 flag) {
|
||||
*/
|
||||
void Flags_SetClear(PlayState* play, s32 flag) {
|
||||
play->actorCtx.flags.clear |= (1 << flag);
|
||||
GameInteractor_ExecuteOnSceneFlagSet(play->sceneNum, FLAG_SCENE_CLEAR, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -749,6 +753,7 @@ void Flags_SetClear(PlayState* play, s32 flag) {
|
||||
*/
|
||||
void Flags_UnsetClear(PlayState* play, s32 flag) {
|
||||
play->actorCtx.flags.clear &= ~(1 << flag);
|
||||
GameInteractor_ExecuteOnSceneFlagUnset(play->sceneNum, FLAG_SCENE_CLEAR, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -795,6 +800,7 @@ void Flags_SetCollectible(PlayState* play, s32 flag) {
|
||||
play->actorCtx.flags.tempCollect |= (1 << (flag - 0x20));
|
||||
}
|
||||
}
|
||||
GameInteractor_ExecuteOnSceneFlagSet(play->sceneNum, FLAG_SCENE_COLLECTIBLE, flag);
|
||||
}
|
||||
|
||||
void func_8002CDE4(PlayState* play, TitleCardContext* titleCtx) {
|
||||
@@ -4718,6 +4724,7 @@ s32 Flags_GetEventChkInf(s32 flag) {
|
||||
*/
|
||||
void Flags_SetEventChkInf(s32 flag) {
|
||||
gSaveContext.eventChkInf[flag >> 4] |= (1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4725,6 +4732,7 @@ void Flags_SetEventChkInf(s32 flag) {
|
||||
*/
|
||||
void Flags_UnsetEventChkInf(s32 flag) {
|
||||
gSaveContext.eventChkInf[flag >> 4] &= ~(1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagUnset(FLAG_EVENT_CHECK_INF, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4739,6 +4747,7 @@ s32 Flags_GetItemGetInf(s32 flag) {
|
||||
*/
|
||||
void Flags_SetItemGetInf(s32 flag) {
|
||||
gSaveContext.itemGetInf[flag >> 4] |= (1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_ITEM_GET_INF, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4746,6 +4755,7 @@ void Flags_SetItemGetInf(s32 flag) {
|
||||
*/
|
||||
void Flags_UnsetItemGetInf(s32 flag) {
|
||||
gSaveContext.itemGetInf[flag >> 4] &= ~(1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagUnset(FLAG_ITEM_GET_INF, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4760,6 +4770,7 @@ s32 Flags_GetInfTable(s32 flag) {
|
||||
*/
|
||||
void Flags_SetInfTable(s32 flag) {
|
||||
gSaveContext.infTable[flag >> 4] |= (1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_INF_TABLE, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4767,6 +4778,7 @@ void Flags_SetInfTable(s32 flag) {
|
||||
*/
|
||||
void Flags_UnsetInfTable(s32 flag) {
|
||||
gSaveContext.infTable[flag >> 4] &= ~(1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagUnset(FLAG_INF_TABLE, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4781,6 +4793,7 @@ s32 Flags_GetEventInf(s32 flag) {
|
||||
*/
|
||||
void Flags_SetEventInf(s32 flag) {
|
||||
gSaveContext.eventInf[flag >> 4] |= (1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_INF, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4788,6 +4801,7 @@ void Flags_SetEventInf(s32 flag) {
|
||||
*/
|
||||
void Flags_UnsetEventInf(s32 flag) {
|
||||
gSaveContext.eventInf[flag >> 4] &= ~(1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagUnset(FLAG_EVENT_INF, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4802,6 +4816,7 @@ s32 Flags_GetRandomizerInf(RandomizerInf flag) {
|
||||
*/
|
||||
void Flags_SetRandomizerInf(RandomizerInf flag) {
|
||||
gSaveContext.randomizerInf[flag >> 4] |= (1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_RANDOMIZER_INF, flag);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4809,6 +4824,7 @@ void Flags_SetRandomizerInf(RandomizerInf flag) {
|
||||
*/
|
||||
void Flags_UnsetRandomizerInf(RandomizerInf flag) {
|
||||
gSaveContext.randomizerInf[flag >> 4] &= ~(1 << (flag & 0xF));
|
||||
GameInteractor_ExecuteOnFlagUnset(FLAG_RANDOMIZER_INF, flag);
|
||||
}
|
||||
|
||||
u32 func_80035BFC(PlayState* play, s16 arg1) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "z_en_daiku.h"
|
||||
#include "overlays/actors/ovl_En_GeldB/z_en_geldb.h"
|
||||
#include "objects/object_daiku/object_daiku.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED)
|
||||
|
||||
@@ -403,6 +404,7 @@ void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) {
|
||||
this->stateFlags &= ~(ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2);
|
||||
|
||||
gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] |= EVENTCHKINF_CARPENTERS_FREE_MASK(this->actor.params & 3);
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, (EVENTCHKINF_CARPENTERS_FREE_INDEX << 4) + (this->actor.params & 3));
|
||||
|
||||
this->actor.gravity = -1.0f;
|
||||
this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "vt.h"
|
||||
#include "objects/object_fr/object_fr.h"
|
||||
#include <assert.h>
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_NO_FREEZE_OCARINA)
|
||||
|
||||
@@ -103,6 +104,17 @@ static u16 sSongIndex[] = {
|
||||
0x0002, 0x0004, 0x0010, 0x0008, 0x0020, 0x0040, 0x0001, 0x0000,
|
||||
};
|
||||
|
||||
static u16 sSongIndexShift[] = {
|
||||
EVENTCHKINF_SONGS_FOR_FROGS_ZL_SHIFT,
|
||||
EVENTCHKINF_SONGS_FOR_FROGS_EPONA_SHIFT,
|
||||
EVENTCHKINF_SONGS_FOR_FROGS_SARIA_SHIFT,
|
||||
EVENTCHKINF_SONGS_FOR_FROGS_SUNS_SHIFT,
|
||||
EVENTCHKINF_SONGS_FOR_FROGS_SOT_SHIFT,
|
||||
EVENTCHKINF_SONGS_FOR_FROGS_STORMS_SHIFT,
|
||||
EVENTCHKINF_SONGS_FOR_FROGS_CHOIR_SHIFT,
|
||||
0x0, // FROG_NO_SONG
|
||||
};
|
||||
|
||||
// Frog to Index for Song Flag (sSongIndex) Mapping
|
||||
static u8 sFrogToSongIndex[] = {
|
||||
FROG_SARIA, FROG_SUNS, FROG_SOT, FROG_ZL, FROG_EPONA,
|
||||
@@ -955,6 +967,7 @@ void EnFr_SetReward(EnFr* this, PlayState* play) {
|
||||
if ((songIndex >= FROG_ZL) && (songIndex <= FROG_SOT)) {
|
||||
if (!(gSaveContext.eventChkInf[13] & sSongIndex[songIndex])) {
|
||||
gSaveContext.eventChkInf[13] |= sSongIndex[songIndex];
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, (EVENTCHKINF_SONGS_FOR_FROGS_INDEX << 4) + sSongIndexShift[songIndex]);
|
||||
if (!gSaveContext.n64ddFlag) {
|
||||
this->reward = GI_RUPEE_PURPLE;
|
||||
} else {
|
||||
@@ -967,6 +980,7 @@ void EnFr_SetReward(EnFr* this, PlayState* play) {
|
||||
} else if (songIndex == FROG_STORMS) {
|
||||
if (!(gSaveContext.eventChkInf[13] & sSongIndex[songIndex])) {
|
||||
gSaveContext.eventChkInf[13] |= sSongIndex[songIndex];
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, (EVENTCHKINF_SONGS_FOR_FROGS_INDEX << 4) + sSongIndexShift[songIndex]);
|
||||
if (!gSaveContext.n64ddFlag) {
|
||||
this->reward = GI_HEART_PIECE;
|
||||
} else {
|
||||
@@ -979,6 +993,7 @@ void EnFr_SetReward(EnFr* this, PlayState* play) {
|
||||
} else if (songIndex == FROG_CHOIR_SONG) {
|
||||
if (!(gSaveContext.eventChkInf[13] & sSongIndex[songIndex])) {
|
||||
gSaveContext.eventChkInf[13] |= sSongIndex[songIndex];
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, (EVENTCHKINF_SONGS_FOR_FROGS_INDEX << 4) + sSongIndexShift[songIndex]);
|
||||
if (!gSaveContext.n64ddFlag) {
|
||||
this->reward = GI_HEART_PIECE;
|
||||
} else {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "z_en_si.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
extern void func_8083C148(Player*, PlayState*);
|
||||
extern void func_80078884(uint16_t);
|
||||
@@ -183,6 +184,7 @@ void func_80AFB950(EnSi* this, PlayState* play) {
|
||||
player->actor.freezeTimer = 10;
|
||||
} else {
|
||||
SET_GS_FLAGS((this->actor.params & 0x1F00) >> 8, this->actor.params & 0xFF);
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_GS_TOKEN, this->actor.params);
|
||||
Actor_Kill(&this->actor);
|
||||
if (gSaveContext.pendingIceTrapCount > 0 && player->heldItemId == 11) {
|
||||
player->actor.freezeTimer = 0;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "objects/object_ahg/object_ahg.h"
|
||||
#include "objects/object_boj/object_boj.h"
|
||||
#include <assert.h>
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED)
|
||||
|
||||
@@ -81,7 +82,21 @@ static EnSthActionFunc sRewardObtainedWaitActions[6] = {
|
||||
};
|
||||
|
||||
static u16 sEventFlags[6] = {
|
||||
0, EVENTCHKINF_SKULLTULA_REWARD_10_MASK, EVENTCHKINF_SKULLTULA_REWARD_20_MASK, EVENTCHKINF_SKULLTULA_REWARD_30_MASK, EVENTCHKINF_SKULLTULA_REWARD_40_MASK, EVENTCHKINF_SKULLTULA_REWARD_50_MASK,
|
||||
0,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_10_MASK,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_20_MASK,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_30_MASK,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_40_MASK,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_50_MASK,
|
||||
};
|
||||
|
||||
static u16 sEventFlagsShift[6] = {
|
||||
0,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_10_SHIFT,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_20_SHIFT,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_30_SHIFT,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_40_SHIFT,
|
||||
EVENTCHKINF_SKULLTULA_REWARD_50_SHIFT,
|
||||
};
|
||||
|
||||
static s16 sGetItemIds[6] = {
|
||||
@@ -298,6 +313,7 @@ void EnSth_GiveReward(EnSth* this, PlayState* play) {
|
||||
this->actor.parent = NULL;
|
||||
EnSth_SetupAction(this, EnSth_RewardObtainedTalk);
|
||||
gSaveContext.eventChkInf[EVENTCHKINF_SKULLTULA_REWARD_INDEX] |= this->eventFlag;
|
||||
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, (EVENTCHKINF_SKULLTULA_REWARD_INDEX << 4) + sEventFlagsShift[this->actor.params]);
|
||||
} else {
|
||||
EnSth_GivePlayerItem(this, play);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user