1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Fixup weird horse flags usage (#1214)

* wip: refactor flag defines for `eventInf[0]`

* Cleanup attempt

* run formatter

* remove spacing in enum indices comments

* Add line breaks

* Macros +`()` -`;`
This commit is contained in:
Dragorn421 2022-05-09 00:17:10 +02:00 committed by GitHub
parent 3b0e095ee6
commit 6cd8029cd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 146 additions and 185 deletions

View file

@ -644,31 +644,55 @@ typedef enum {
*/
// 0x00-0x0F
#define EVENTINF_0X_INDEX 0
#define EVENTINF_00_SHIFT 0
#define EVENTINF_01_SHIFT 1
#define EVENTINF_02_SHIFT 2
#define EVENTINF_03_SHIFT 3
#define EVENTINF_04_SHIFT 4
#define EVENTINF_05_SHIFT 5
#define EVENTINF_06_SHIFT 6
#define EVENTINF_08_SHIFT 8
#define EVENTINF_0A_SHIFT 10
#define EVENTINF_0F_SHIFT 15
#define EVENTINF_00_MASK (1 << EVENTINF_00_SHIFT)
#define EVENTINF_01_MASK (1 << EVENTINF_01_SHIFT)
#define EVENTINF_02_MASK (1 << EVENTINF_02_SHIFT)
#define EVENTINF_03_MASK (1 << EVENTINF_03_SHIFT)
#define EVENTINF_04_MASK (1 << EVENTINF_04_SHIFT)
#define EVENTINF_05_MASK (1 << EVENTINF_05_SHIFT)
#define EVENTINF_06_MASK (1 << EVENTINF_06_SHIFT)
#define EVENTINF_0F_MASK (1 << EVENTINF_0F_SHIFT)
#define EVENTINF_04 ((EVENTINF_0X_INDEX << 4) | EVENTINF_04_SHIFT)
#define EVENTINF_05 ((EVENTINF_0X_INDEX << 4) | EVENTINF_05_SHIFT)
#define EVENTINF_06 ((EVENTINF_0X_INDEX << 4) | EVENTINF_06_SHIFT)
#define EVENTINF_08 ((EVENTINF_0X_INDEX << 4) | EVENTINF_08_SHIFT)
#define EVENTINF_0A ((EVENTINF_0X_INDEX << 4) | EVENTINF_0A_SHIFT)
#define EVENTINF_0F ((EVENTINF_0X_INDEX << 4) | EVENTINF_0F_SHIFT)
// horses related
#define EVENTINF_HORSES_INDEX 0
#define EVENTINF_HORSES_STATE_SHIFT 0
#define EVENTINF_HORSES_HORSETYPE_SHIFT 4
#define EVENTINF_HORSES_05_SHIFT 5
#define EVENTINF_HORSES_06_SHIFT 6
#define EVENTINF_HORSES_08_SHIFT 8
#define EVENTINF_HORSES_0A_SHIFT 10
#define EVENTINF_HORSES_0F_SHIFT 15 // unused?
#define EVENTINF_HORSES_STATE_MASK (0xF << EVENTINF_HORSES_STATE_SHIFT)
#define EVENTINF_HORSES_HORSETYPE_MASK (1 << EVENTINF_HORSES_HORSETYPE_SHIFT)
#define EVENTINF_HORSES_05_MASK (1 << EVENTINF_HORSES_05_SHIFT)
#define EVENTINF_HORSES_06_MASK (1 << EVENTINF_HORSES_06_SHIFT)
#define EVENTINF_HORSES_0F_MASK (1 << EVENTINF_HORSES_0F_SHIFT)
#define EVENTINF_HORSES_05 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_05_SHIFT)
#define EVENTINF_HORSES_06 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_06_SHIFT)
#define EVENTINF_HORSES_08 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_08_SHIFT)
#define EVENTINF_HORSES_0A ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_0A_SHIFT)
typedef enum {
/* 0 */ EVENTINF_HORSES_STATE_0,
/* 1 */ EVENTINF_HORSES_STATE_1,
/* 2 */ EVENTINF_HORSES_STATE_2,
/* 3 */ EVENTINF_HORSES_STATE_3,
/* 4 */ EVENTINF_HORSES_STATE_4,
/* 5 */ EVENTINF_HORSES_STATE_5,
/* 6 */ EVENTINF_HORSES_STATE_6,
/* 7 */ EVENTINF_HORSES_STATE_7
} EventInfHorsesState;
// "InRaceSeq"
#define GET_EVENTINF_HORSES_STATE() \
((gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & EVENTINF_HORSES_STATE_MASK) >> EVENTINF_HORSES_STATE_SHIFT)
#define SET_EVENTINF_HORSES_STATE(v) \
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = \
(gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & ~EVENTINF_HORSES_STATE_MASK) | \
((v) << EVENTINF_HORSES_STATE_SHIFT)
#define GET_EVENTINF_HORSES_HORSETYPE() \
((gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & EVENTINF_HORSES_HORSETYPE_MASK) >> EVENTINF_HORSES_HORSETYPE_SHIFT)
#define SET_EVENTINF_HORSES_HORSETYPE(v) \
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = \
(gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & ~EVENTINF_HORSES_HORSETYPE_MASK) | \
((v) << EVENTINF_HORSES_HORSETYPE_SHIFT)
#define SET_EVENTINF_HORSES_0F(v) \
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = \
(gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & ~EVENTINF_HORSES_0F_MASK) | ((v) << EVENTINF_HORSES_0F_SHIFT)
#define EVENTINF_10 0x10

View file

@ -1,5 +1,6 @@
#include "global.h"
#include "vt.h"
#include "src/overlays/actors/ovl_En_Horse/z_en_horse.h"
s32 func_8006CFC0(s32 scene) {
s32 validScenes[] = { SCENE_SPOT00, SCENE_SPOT06, SCENE_SPOT09, SCENE_SPOT12, SCENE_SPOT20 };
@ -158,10 +159,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
Actor_MountHorse(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horseData.scene = globalCtx->sceneNum;
} else if ((globalCtx->sceneNum == SCENE_SPOT20) &&
((gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) ==
(EVENTINF_01_MASK | EVENTINF_02_MASK)) &&
} else if ((globalCtx->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
player->rideActor =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5);
@ -203,7 +201,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
Vec3f sp54;
s32 temp = 0;
if ((GET_EVENTINF(EVENTINF_04) >> EVENTINF_04_SHIFT) && D_8011F9B8[i].type == 6) {
if (GET_EVENTINF_HORSES_HORSETYPE() != HORSE_EPONA && D_8011F9B8[i].type == 6) {
temp = 0x8000;
}
@ -252,10 +250,7 @@ void func_8006DC68(GlobalContext* globalCtx, Player* player) {
((gSaveContext.entranceIndex == 0x028A || gSaveContext.entranceIndex == 0x028E ||
gSaveContext.entranceIndex == 0x0292 || gSaveContext.entranceIndex == 0x0476) &&
(gSaveContext.respawnFlag == 0)) ||
((globalCtx->sceneNum == SCENE_SPOT20) &&
((gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) ==
(EVENTINF_01_MASK | EVENTINF_02_MASK)) &&
((globalCtx->sceneNum == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0))) {
func_8006D684(globalCtx, player);
} else {

View file

@ -2464,9 +2464,7 @@ void Message_DrawMain(GlobalContext* globalCtx, Gfx** p) {
if (msgCtx->disableWarpSongs || interfaceCtx->restrictions.warpSongs == 3) {
Message_StartTextbox(globalCtx, 0x88C, NULL); // "You can't warp here!"
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
} else if ((gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) !=
EVENTINF_00_MASK) {
} else if (GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_1) {
Message_StartTextbox(globalCtx, msgCtx->lastPlayedSong + 0x88D,
NULL); // "Warp to [place name]?"
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_01;
@ -3227,10 +3225,8 @@ void Message_Update(GlobalContext* globalCtx) {
if (Message_ShouldAdvance(globalCtx)) {
osSyncPrintf("OCARINA_MODE=%d -> ", globalCtx->msgCtx.ocarinaMode);
globalCtx->msgCtx.ocarinaMode = (msgCtx->choiceIndex == 0) ? OCARINA_MODE_02 : OCARINA_MODE_04;
osSyncPrintf("InRaceSeq=%d(%d) OCARINA_MODE=%d --> ",
gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK),
1, globalCtx->msgCtx.ocarinaMode);
osSyncPrintf("InRaceSeq=%d(%d) OCARINA_MODE=%d --> ", GET_EVENTINF_HORSES_STATE(), 1,
globalCtx->msgCtx.ocarinaMode);
Message_CloseTextbox(globalCtx);
osSyncPrintf("OCARINA_MODE=%d\n", globalCtx->msgCtx.ocarinaMode);
}

View file

@ -768,9 +768,7 @@ void func_80083108(GlobalContext* globalCtx) {
gSaveContext.unk_13EA = 0;
Interface_ChangeAlpha(50);
}
} else if ((gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) ==
EVENTINF_00_MASK) {
} else if (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_1) {
if (player->stateFlags1 & PLAYER_STATE1_23) {
if ((gSaveContext.equips.buttonItems[0] != ITEM_NONE) &&
(gSaveContext.equips.buttonItems[0] != ITEM_BOW)) {
@ -3412,10 +3410,10 @@ void Interface_Draw(GlobalContext* globalCtx) {
// Revert any spoiling trade quest items
for (svar1 = 0; svar1 < ARRAY_COUNT(gSpoilingItems); svar1++) {
if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[svar1]) {
gSaveContext.eventInf[EVENTINF_0X_INDEX] &=
(u16) ~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK |
EVENTINF_04_MASK | EVENTINF_05_MASK | EVENTINF_06_MASK | EVENTINF_0F_MASK);
osSyncPrintf("EVENT_INF=%x\n", gSaveContext.eventInf[EVENTINF_0X_INDEX]);
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] &=
(u16) ~(EVENTINF_HORSES_STATE_MASK | EVENTINF_HORSES_HORSETYPE_MASK | EVENTINF_HORSES_05_MASK |
EVENTINF_HORSES_06_MASK | EVENTINF_HORSES_0F_MASK);
osSyncPrintf("EVENT_INF=%x\n", gSaveContext.eventInf[EVENTINF_HORSES_INDEX]);
globalCtx->nextEntranceIndex = spoilingItemEntrances[svar1];
INV_CONTENT(gSpoilingItemReverts[svar1]) = gSpoilingItemReverts[svar1];

View file

@ -51,9 +51,7 @@ void BgInGate_Init(Actor* thisx, GlobalContext* globalCtx) {
}
Actor_SetScale(&this->dyna.actor, 0.1f);
if (((this->dyna.actor.params & 1) != 0) &&
((gSaveContext.eventInf[EVENTINF_0X_INDEX] & (EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK |
EVENTINF_03_MASK)) == (EVENTINF_01_MASK | EVENTINF_02_MASK))) {
if (((this->dyna.actor.params & 1) != 0) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6)) {
globalCtx->csCtx.frames = 0;
BgInGate_SetupAction(this, func_80892890);
} else {

View file

@ -152,7 +152,7 @@ void EnGe1_Init(Actor* thisx, GlobalContext* globalCtx) {
// "Horseback archery Gerudo EVENT_INF(0) ="
osSyncPrintf(VT_FGCOL(CYAN) "やぶさめ ゲルド EVENT_INF(0) = %x\n" VT_RST, gSaveContext.eventInf[0]);
if (GET_EVENTINF(EVENTINF_08)) {
if (GET_EVENTINF(EVENTINF_HORSES_08)) {
this->actionFunc = EnGe1_TalkAfterGame_Archery;
} else if (EnGe1_CheckCarpentersFreed()) {
this->actionFunc = EnGe1_Wait_Archery;
@ -585,7 +585,7 @@ void EnGe1_BeginGame_Archery(EnGe1* this, GlobalContext* globalCtx) {
gSaveContext.nextCutsceneIndex = 0xFFF0;
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
SET_EVENTINF(EVENTINF_08);
SET_EVENTINF(EVENTINF_HORSES_08);
SET_EVENTCHKINF(EVENTCHKINF_68);
if (!(player->stateFlags1 & PLAYER_STATE1_23)) {
@ -627,7 +627,7 @@ void EnGe1_TalkNoPrize_Archery(EnGe1* this, GlobalContext* globalCtx) {
}
void EnGe1_TalkAfterGame_Archery(EnGe1* this, GlobalContext* globalCtx) {
CLEAR_EVENTINF(EVENTINF_08);
CLEAR_EVENTINF(EVENTINF_HORSES_08);
LOG_NUM("z_common_data.yabusame_total", gSaveContext.minigameScore, "../z_en_ge1.c", 1110);
LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", HIGH_SCORE(HS_HBA), "../z_en_ge1.c", 1111);
this->actor.flags |= ACTOR_FLAG_16;

View file

@ -684,10 +684,7 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) {
if (globalCtx->sceneNum != SCENE_SPOT20 ||
//! Same flag checked twice
(Flags_GetEventChkInf(EVENTCHKINF_18) &&
(!((gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) ==
(EVENTINF_01_MASK | EVENTINF_02_MASK)) ||
Flags_GetEventChkInf(EVENTCHKINF_18))) ||
(GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_6 || Flags_GetEventChkInf(EVENTCHKINF_18))) ||
// always load two spawns inside lon lon
((sHorseSpawns[i].pos.x == 856 && sHorseSpawns[i].pos.y == 0 && sHorseSpawns[i].pos.z == -918) ||
(sHorseSpawns[i].pos.x == -1003 && sHorseSpawns[i].pos.y == 0 && sHorseSpawns[i].pos.z == -755))) {
@ -801,7 +798,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) {
if (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0) {
this->stateFlags &= ~ENHORSE_CANT_JUMP;
this->stateFlags |= ENHORSE_FLAG_26;
} else if (GET_EVENTINF(EVENTINF_06) && this->type == HORSE_HNI) {
} else if (GET_EVENTINF(EVENTINF_HORSES_06) && this->type == HORSE_HNI) {
this->stateFlags |= ENHORSE_FLAG_21 | ENHORSE_FLAG_20;
}
} else if (this->actor.params == 1) {
@ -811,9 +808,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) {
}
}
if (globalCtx->sceneNum == SCENE_SPOT20 &&
((gSaveContext.eventInf[EVENTINF_0X_INDEX] & (EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK |
EVENTINF_03_MASK)) == (EVENTINF_01_MASK | EVENTINF_02_MASK)) &&
if (globalCtx->sceneNum == SCENE_SPOT20 && GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6 &&
!Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1)) {
this->stateFlags |= ENHORSE_FLAG_25;
}
@ -879,7 +874,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) {
if (this->rider == NULL) {
__assert("this->race.rider != NULL", "../z_en_horse.c", 3077);
}
if (!GET_EVENTINF(EVENTINF_06)) {
if (!GET_EVENTINF(EVENTINF_HORSES_06)) {
this->ingoHorseMaxSpeed = 12.07f;
} else {
this->ingoHorseMaxSpeed = 12.625f;

View file

@ -110,34 +110,22 @@ void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, GlobalConte
gSaveContext.cutsceneIndex = 0;
if (this->result == INGORACE_PLAYER_WIN) {
globalCtx->nextEntranceIndex = 0x4CE;
if (GET_EVENTINF(EVENTINF_06)) {
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) |
(EVENTINF_01_MASK | EVENTINF_02_MASK);
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_0F_MASK) | EVENTINF_0F_MASK;
if (GET_EVENTINF(EVENTINF_HORSES_06)) {
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_6);
SET_EVENTINF_HORSES_0F(1);
globalCtx->transitionType = TRANS_TYPE_FADE_WHITE;
Environment_ForcePlaySequence(NA_BGM_INGO);
} else {
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) |
EVENTINF_02_MASK;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_0F_MASK) | EVENTINF_0F_MASK;
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_4);
SET_EVENTINF_HORSES_0F(1);
Environment_ForcePlaySequence(NA_BGM_INGO);
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
}
} else {
globalCtx->nextEntranceIndex = 0x558;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) |
(EVENTINF_00_MASK | EVENTINF_01_MASK);
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_3);
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST);
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_0F_MASK) | EVENTINF_0F_MASK;
SET_EVENTINF_HORSES_0F(1);
}
DREG(25) = 0;
globalCtx->transitionTrigger = TRANS_TRIGGER_START;

View file

@ -141,9 +141,8 @@ u16 func_80A79010(GlobalContext* globalCtx) {
if (IS_NIGHT) {
return 0x204E;
}
switch (gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) {
case EVENTINF_00_MASK:
switch (GET_EVENTINF_HORSES_STATE()) {
case EVENTINF_HORSES_STATE_1:
if (!(player->stateFlags1 & PLAYER_STATE1_23)) {
return 0x2036;
} else if (GET_EVENTCHKINF(EVENTCHKINF_1B)) {
@ -155,20 +154,20 @@ u16 func_80A79010(GlobalContext* globalCtx) {
} else {
return 0x2037;
}
case EVENTINF_00_MASK | EVENTINF_01_MASK:
if (GET_EVENTINF(EVENTINF_06) || GET_EVENTINF(EVENTINF_05)) {
case EVENTINF_HORSES_STATE_3:
if (GET_EVENTINF(EVENTINF_HORSES_06) || GET_EVENTINF(EVENTINF_HORSES_05)) {
return 0x203E;
} else {
return 0x203D;
}
case EVENTINF_02_MASK:
case EVENTINF_HORSES_STATE_4:
return 0x203A;
case EVENTINF_00_MASK | EVENTINF_02_MASK:
case EVENTINF_01_MASK | EVENTINF_02_MASK:
case EVENTINF_HORSES_STATE_5:
case EVENTINF_HORSES_STATE_6:
return 0x203C;
case EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK:
case EVENTINF_HORSES_STATE_7:
return 0x205B;
case EVENTINF_01_MASK:
case EVENTINF_HORSES_STATE_2:
default:
if (GET_INFTABLE(INFTABLE_9A)) {
return 0x2031;
@ -258,10 +257,9 @@ s16 func_80A7924C(GlobalContext* globalCtx, Actor* thisx) {
sp18 = 2;
} else {
Message_ContinueTextbox(globalCtx, this->actor.textId = 0x2039);
gSaveContext.eventInf[EVENTINF_0X_INDEX] &=
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK);
CLEAR_EVENTINF(EVENTINF_05);
CLEAR_EVENTINF(EVENTINF_06);
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0);
CLEAR_EVENTINF(EVENTINF_HORSES_05);
CLEAR_EVENTINF(EVENTINF_HORSES_06);
this->actionFunc = func_80A7A4C8;
}
break;
@ -492,7 +490,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) {
respawnPos = respawn->pos;
// hardcoded coords for lon lon entrance
if (D_80A7B998 == 0 && respawnPos.x == 1107.0f && respawnPos.y == 0.0f && respawnPos.z == -3740.0f) {
gSaveContext.eventInf[EVENTINF_0X_INDEX] = 0;
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = 0;
D_80A7B998 = 1;
}
this->actionFunc = func_80A79FB0;
@ -516,7 +514,7 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) {
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
if (func_80A7975C(this, globalCtx)) {
CLEAR_EVENTINF(EVENTINF_0F);
SET_EVENTINF_HORSES_0F(0);
return;
}
Actor_SetScale(&this->actor, 0.01f);
@ -545,24 +543,23 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) {
Actor_Kill(&this->actor);
break;
default:
switch (gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) {
case 0:
case EVENTINF_01_MASK:
case EVENTINF_00_MASK | EVENTINF_01_MASK:
case EVENTINF_02_MASK:
case EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK:
switch (GET_EVENTINF_HORSES_STATE()) {
case EVENTINF_HORSES_STATE_0:
case EVENTINF_HORSES_STATE_2:
case EVENTINF_HORSES_STATE_3:
case EVENTINF_HORSES_STATE_4:
case EVENTINF_HORSES_STATE_7:
if (this->actor.params == 2) {
sp3C = 1;
}
break;
case EVENTINF_00_MASK:
case EVENTINF_HORSES_STATE_1:
if (this->actor.params == 3) {
sp3C = 1;
}
break;
case EVENTINF_00_MASK | EVENTINF_02_MASK:
case EVENTINF_01_MASK | EVENTINF_02_MASK:
case EVENTINF_HORSES_STATE_5:
case EVENTINF_HORSES_STATE_6:
if (this->actor.params == 4) {
sp3C = 1;
}
@ -572,37 +569,36 @@ void func_80A79FB0(EnIn* this, GlobalContext* globalCtx) {
Actor_Kill(&this->actor);
return;
}
switch (gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) {
case 0:
case EVENTINF_01_MASK:
switch (GET_EVENTINF_HORSES_STATE()) {
case EVENTINF_HORSES_STATE_0:
case EVENTINF_HORSES_STATE_2:
EnIn_ChangeAnim(this, ENIN_ANIM_2);
this->actionFunc = func_80A7A4C8;
gSaveContext.eventInf[EVENTINF_0X_INDEX] = 0;
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = 0;
break;
case EVENTINF_00_MASK:
case EVENTINF_HORSES_STATE_1:
this->actor.targetMode = 3;
EnIn_ChangeAnim(this, ENIN_ANIM_2);
this->actionFunc = func_80A7A568;
func_80088B34(0x3C);
break;
case EVENTINF_00_MASK | EVENTINF_01_MASK:
case EVENTINF_HORSES_STATE_3:
EnIn_ChangeAnim(this, ENIN_ANIM_4);
this->actionFunc = func_80A7A770;
break;
case EVENTINF_02_MASK:
case EVENTINF_HORSES_STATE_4:
EnIn_ChangeAnim(this, ENIN_ANIM_6);
this->unk_1EC = 8;
this->actionFunc = func_80A7A940;
break;
case EVENTINF_00_MASK | EVENTINF_02_MASK:
case EVENTINF_01_MASK | EVENTINF_02_MASK:
case EVENTINF_HORSES_STATE_5:
case EVENTINF_HORSES_STATE_6:
this->actor.targetMode = 3;
EnIn_ChangeAnim(this, ENIN_ANIM_6);
this->unk_1EC = 8;
this->actionFunc = func_80A7AA40;
break;
case EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK:
case EVENTINF_HORSES_STATE_7:
EnIn_ChangeAnim(this, ENIN_ANIM_2);
this->actionFunc = func_80A7A848;
break;
@ -643,12 +639,8 @@ void func_80A7A4BC(EnIn* this, GlobalContext* globalCtx) {
void func_80A7A4C8(EnIn* this, GlobalContext* globalCtx) {
if (this->unk_308.unk_00 == 2) {
func_80A79BAC(this, globalCtx, 1, TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST));
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) |
EVENTINF_00_MASK;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_0F_MASK) | EVENTINF_0F_MASK;
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_1);
SET_EVENTINF_HORSES_0F(1);
CLEAR_INFTABLE(INFTABLE_A2);
Environment_ForcePlaySequence(NA_BGM_HORSE);
globalCtx->msgCtx.stateTimer = 0;
@ -679,13 +671,8 @@ void func_80A7A568(EnIn* this, GlobalContext* globalCtx) {
this->unk_308.unk_00 = 0;
return;
}
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_04_MASK) |
(((EnHorse*)GET_PLAYER(globalCtx)->rideActor)->type << EVENTINF_04_SHIFT);
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) |
EVENTINF_01_MASK;
SET_EVENTINF_HORSES_HORSETYPE(((EnHorse*)GET_PLAYER(globalCtx)->rideActor)->type);
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_2);
phi_a2 = 2;
transitionType = TRANS_TYPE_FADE_BLACK;
} else {
@ -697,15 +684,13 @@ void func_80A7A568(EnIn* this, GlobalContext* globalCtx) {
SET_INFTABLE(INFTABLE_AB);
}
}
gSaveContext.eventInf[EVENTINF_0X_INDEX] &=
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK);
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0);
phi_a2 = 0;
transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST);
}
func_80A79BAC(this, globalCtx, phi_a2, transitionType);
globalCtx->msgCtx.stateTimer = 0;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_0F_MASK) | EVENTINF_0F_MASK;
SET_EVENTINF_HORSES_0F(1);
globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
this->unk_308.unk_00 = 0;
}
@ -719,14 +704,11 @@ void func_80A7A770(EnIn* this, GlobalContext* globalCtx) {
this->actor.flags &= ~ACTOR_FLAG_16;
EnIn_ChangeAnim(this, ENIN_ANIM_3);
this->actionFunc = func_80A7A848;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) |
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK);
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_7);
this->unk_308.unk_00 = 0;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & 0xFFFF) | EVENTINF_05_MASK;
if (!GET_EVENTINF(EVENTINF_06)) {
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] =
(gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & 0xFFFF) | EVENTINF_HORSES_05_MASK;
if (!GET_EVENTINF(EVENTINF_HORSES_06)) {
globalCtx->msgCtx.stateTimer = 4;
globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
}
@ -736,23 +718,18 @@ void func_80A7A770(EnIn* this, GlobalContext* globalCtx) {
void func_80A7A848(EnIn* this, GlobalContext* globalCtx) {
if (this->unk_308.unk_00 == 2) {
if ((globalCtx->msgCtx.choiceIndex == 0 && gSaveContext.rupees < 50) || globalCtx->msgCtx.choiceIndex == 1) {
gSaveContext.eventInf[EVENTINF_0X_INDEX] &=
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK);
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0);
this->actionFunc = func_80A7A4C8;
} else {
func_80A79BAC(this, globalCtx, 2, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST));
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) |
EVENTINF_01_MASK;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_0F_MASK) | EVENTINF_0F_MASK;
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_2);
SET_EVENTINF_HORSES_0F(1);
globalCtx->msgCtx.stateTimer = 0;
globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
}
this->unk_308.unk_00 = 0;
CLEAR_EVENTINF(EVENTINF_05);
CLEAR_EVENTINF(EVENTINF_06);
CLEAR_EVENTINF(EVENTINF_HORSES_05);
CLEAR_EVENTINF(EVENTINF_HORSES_06);
}
}
@ -770,17 +747,13 @@ void func_80A7A940(EnIn* this, GlobalContext* globalCtx) {
if (this->unk_308.unk_00 == 2) {
this->actor.flags &= ~ACTOR_FLAG_16;
func_80A79BAC(this, globalCtx, 2, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST));
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) |
EVENTINF_01_MASK;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_0F_MASK) | EVENTINF_0F_MASK;
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_2);
SET_EVENTINF_HORSES_0F(1);
globalCtx->msgCtx.stateTimer = 0;
globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
this->unk_308.unk_00 = 0;
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & 0xFFFF) | EVENTINF_06_MASK;
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] =
(gSaveContext.eventInf[EVENTINF_HORSES_INDEX] & 0xFFFF) | EVENTINF_HORSES_06_MASK;
}
}
@ -925,11 +898,8 @@ void func_80A7B024(EnIn* this, GlobalContext* globalCtx) {
SET_INFTABLE(INFTABLE_AB);
}
func_80A79BAC(this, globalCtx, 0, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST));
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
gSaveContext.eventInf[EVENTINF_0X_INDEX] &
~(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK);
gSaveContext.eventInf[EVENTINF_0X_INDEX] =
(gSaveContext.eventInf[EVENTINF_0X_INDEX] & ~EVENTINF_0F_MASK) | EVENTINF_0F_MASK;
SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0);
SET_EVENTINF_HORSES_0F(1);
globalCtx->msgCtx.stateTimer = 4;
globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
this->unk_308.unk_00 = 0;
@ -950,9 +920,7 @@ void EnIn_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actionFunc != func_80A7A304) {
SkelAnime_Update(&this->skelAnime);
if (this->skelAnime.animation == &object_in_Anim_001BE0 &&
((gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) !=
(EVENTINF_01_MASK | EVENTINF_02_MASK))) {
GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_6) {
func_80A79690(&this->skelAnime, this, globalCtx);
}
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);

View file

@ -79,7 +79,7 @@ u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) {
return 0x2000;
}
timer1ValuePtr = &gSaveContext.timer1Value;
if (GET_EVENTINF(EVENTINF_0A)) {
if (GET_EVENTINF(EVENTINF_HORSES_0A)) {
gSaveContext.timer1Value = gSaveContext.timer1Value;
thisx->flags |= ACTOR_FLAG_16;
if (gSaveContext.timer1Value >= 0xD3) {
@ -118,7 +118,7 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) {
gSaveContext.nextCutsceneIndex = 0xFFF0;
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
SET_EVENTINF(EVENTINF_0A);
SET_EVENTINF(EVENTINF_HORSES_0A);
gSaveContext.timer1State = 0xF;
}
break;
@ -150,7 +150,7 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) {
HIGH_SCORE(HS_HORSE_RACE) = gSaveContext.timer1Value;
}
case 0x208E:
CLEAR_EVENTINF(EVENTINF_0A);
CLEAR_EVENTINF(EVENTINF_HORSES_0A);
thisx->flags &= ~ACTOR_FLAG_16;
ret = 0;
gSaveContext.timer1State = 0xA;
@ -158,7 +158,7 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) {
case 0x2002:
SET_INFTABLE(INFTABLE_B9);
case 0x2003:
if (!GET_EVENTINF(EVENTINF_0A)) {
if (!GET_EVENTINF(EVENTINF_HORSES_0A)) {
ret = 0;
}
break;
@ -200,7 +200,7 @@ s32 func_80AA2EC8(EnMa3* this, GlobalContext* globalCtx) {
if (!GET_EVENTCHKINF(EVENTCHKINF_18)) {
return 2;
}
if (GET_EVENTINF(EVENTINF_0A)) {
if (GET_EVENTINF(EVENTINF_HORSES_0A)) {
return 1;
}
return 0;

View file

@ -71,8 +71,8 @@ void func_80B13AA0(EnTa* this, EnTaActionFunc arg1, EnTaUnkFunc arg2) {
void func_80B13AAC(EnTa* this, GlobalContext* globalCtx) {
u16 faceReaction = Text_GetFaceReaction(globalCtx, 24);
if (GET_EVENTINF(EVENTINF_0A)) {
if (GET_EVENTINF(EVENTINF_08)) {
if (GET_EVENTINF(EVENTINF_HORSES_0A)) {
if (GET_EVENTINF(EVENTINF_HORSES_08)) {
if (GET_ITEMGETINF(ITEMGETINF_02)) {
this->actor.textId = 0x2088;
} else {
@ -81,7 +81,7 @@ void func_80B13AAC(EnTa* this, GlobalContext* globalCtx) {
} else {
this->actor.textId = 0x2085;
}
CLEAR_EVENTINF(EVENTINF_08);
CLEAR_EVENTINF(EVENTINF_HORSES_08);
} else if (faceReaction == 0) {
if (GET_INFTABLE(INFTABLE_7E)) {
if (GET_ITEMGETINF(ITEMGETINF_02)) {
@ -193,12 +193,12 @@ void EnTa_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD);
func_80B13AAC(this, globalCtx);
if (GET_EVENTINF(EVENTINF_0A)) {
if (GET_EVENTINF(EVENTINF_HORSES_0A)) {
func_80B13AA0(this, func_80B16608, func_80B16938);
Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f,
Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f,
Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 0.0f);
CLEAR_EVENTINF(EVENTINF_0A);
CLEAR_EVENTINF(EVENTINF_HORSES_0A);
} else {
func_80B13AA0(this, func_80B16504, func_80B16854);
this->eyeIndex = 0;
@ -665,7 +665,7 @@ void func_80B15424(EnTa* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) {
globalCtx->nextEntranceIndex = 0x5E4;
if (GET_EVENTINF(EVENTINF_08)) {
if (GET_EVENTINF(EVENTINF_HORSES_08)) {
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
} else {
@ -674,7 +674,7 @@ void func_80B15424(EnTa* this, GlobalContext* globalCtx) {
}
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
SET_EVENTINF(EVENTINF_0A);
SET_EVENTINF(EVENTINF_HORSES_0A);
this->actionFunc = func_80B153D4;
this->unk_2CC = 22;
}
@ -708,7 +708,7 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) {
-10.0f);
this->unk_2E0 &= ~0x10;
this->unk_2E0 &= ~0x100;
SET_EVENTINF(EVENTINF_08);
SET_EVENTINF(EVENTINF_HORSES_08);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
this->unk_2E0 &= ~0x200;
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
@ -746,7 +746,7 @@ void func_80B154FC(EnTa* this, GlobalContext* globalCtx) {
Message_StartTextbox(globalCtx, 0x2081, &this->actor);
this->actionFunc = func_80B15424;
func_80B14E28(this, globalCtx);
CLEAR_EVENTINF(EVENTINF_08);
CLEAR_EVENTINF(EVENTINF_HORSES_08);
this->unk_2E0 |= 0x80;
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f);
this->unk_2E0 &= ~0x10;

View file

@ -81,8 +81,7 @@ void OceffSpot_End(OceffSpot* this, GlobalContext* globalCtx) {
} else {
Actor_Kill(&this->actor);
if (gTimeIncrement != 400 && globalCtx->msgCtx.unk_E40E == 0 &&
((gSaveContext.eventInf[EVENTINF_0X_INDEX] &
(EVENTINF_00_MASK | EVENTINF_01_MASK | EVENTINF_02_MASK | EVENTINF_03_MASK)) != EVENTINF_00_MASK)) {
GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_1) {
if (globalCtx->msgCtx.ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE ||
globalCtx->msgCtx.ocarinaMode != OCARINA_MODE_08) {
gSaveContext.sunsSongState = SUNSSONG_START;