Document EnAob01 (doggy racetrack owner) and use macros for weekEventRegs in all dog racing files (#1234)

* Document EnAob01 (doggy racetrack owner) and use macros for weekEventRegs in all dog racing files

* Respond to first review

* Respond to anon's review

* Forgot a _FLAG_ on one of my flags

* Respond to anon's review

* Respond to engineer's review

* Delete extra period

* Undo the EVENTINF stuff I goofed up

* Update comment

* Fix bss

* Respond to engineer's review
This commit is contained in:
Tom Overton
2023-05-13 18:27:31 -07:00
committed by GitHub
parent 7bdbca10a5
commit 389a2bf33c
19 changed files with 751 additions and 591 deletions
+1
View File
@@ -1,3 +1,4 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "stack.h"
#include "stackcheck.h"
-1
View File
@@ -1,4 +1,3 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "buffers.h"
#include "z64debug_display.h"
File diff suppressed because it is too large Load Diff
+34 -16
View File
@@ -8,38 +8,56 @@ struct EnAob01;
typedef void (*EnAob01ActionFunc)(struct EnAob01*, PlayState*);
#define ENAOB01_GET_7E00_1(thisx) ((thisx)->params & 0x7E00)
#define ENAOB01_GET_7E00_2(thisx) (((thisx)->params & 0x7E00) >> 9)
// This needs to be kept in sync with the number of weekEventRegs used to store the text ID offsets for
// the race dogs. In particular, there needs to be one weekEventReg for every two dogs. This needs to be
// an even number to ensure that all text ID offsets are created (see EnAob01_InitializeDogTextOffsets).
#define RACEDOG_COUNT 14
#define ENAOB01_GET_STARTING_DOG_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9)
//! @bug This should be shifted up by 1 to match how EnRacedog expects the path index to be supplied.
//! It doesn't cause any problems in the final game because every time EnAob01 is spawned, all the
//! bits here are zero.
#define ENAOB01_GET_RACEDOG_PATH_INDEX(thisx) ((thisx)->params & 0x7E00)
#define ENAOB01_FLAG_PLAYER_CONFIRMED_CHOICE (1 << 1)
#define ENAOB01_FLAG_PLAYER_TOLD_TO_PICK_A_DOG (1 << 2)
#define ENAOB01_FLAG_TALKING_TO_PLAYER_HOLDING_DOG (1 << 3)
#define ENAOB01_FLAG_CONVERSATION_OVER (1 << 4)
#define ENAOB01_FLAG_STARTED_RACE (1 << 5)
#define ENAOB01_FLAG_LAUGH (1 << 6)
#define ENAOB01_FLAG_SURPRISE (1 << 7)
#define ENAOB01_FLAG_PLAYER_CAN_TALK (1 << 8)
typedef struct EnAob01 {
/* 0x000 */ Actor actor;
/* 0x144 */ EnAob01ActionFunc actionFunc;
/* 0x148 */ SkelAnime skelAnime;
/* 0x18C */ ColliderCylinder collider;
/* 0x1D8 */ Path* unk_1D8[14];
/* 0x210 */ u16 unk_210;
/* 0x1D8 */ Path* dogPaths[RACEDOG_COUNT];
/* 0x210 */ u16 textId;
/* 0x212 */ Vec3s jointTable[MAMAMU_YAN_LIMB_MAX];
/* 0x272 */ Vec3s morphTable[MAMAMU_YAN_LIMB_MAX];
/* 0x2D2 */ u16 unk_2D2;
/* 0x2D2 */ u16 stateFlags;
/* 0x2D4 */ Vec3s trackTarget;
/* 0x2DA */ Vec3s headRot;
/* 0x2E0 */ Vec3s torsoRot;
/* 0x2E6 */ Vec3s unk_2E6;
/* 0x2EC */ Vec3s unk_2EC;
/* 0x2F2 */ Vec3s unk_2F2;
/* 0x2F8 */ s16 unk_2F8[MAMAMU_YAN_LIMB_MAX];
/* 0x318 */ s16 unk_318[MAMAMU_YAN_LIMB_MAX];
/* 0x2E6 */ Vec3s prevTrackTarget;
/* 0x2EC */ Vec3s prevHeadRot;
/* 0x2F2 */ Vec3s prevTorsoRot;
/* 0x2F8 */ s16 limbRotTableY[MAMAMU_YAN_LIMB_MAX];
/* 0x318 */ s16 limbRotTableZ[MAMAMU_YAN_LIMB_MAX];
/* 0x338 */ UNK_TYPE1 unk338[0xB6];
/* 0x3EE */ s16 eyeIndex;
/* 0x3F0 */ s16 blinkTimer;
/* 0x3F4 */ Actor* unk_3F4;
/* 0x3F8 */ Actor* unk_3F8[14];
/* 0x3F4 */ Actor* dogToFollow;
/* 0x3F8 */ Actor* dogs[RACEDOG_COUNT];
/* 0x430 */ s16 csId;
/* 0x432 */ s16 unk_432;
/* 0x434 */ s32 unk_434;
/* 0x432 */ s16 selectedDogIndex;
/* 0x434 */ s32 rupeesBet; // Also used for determining how many rupees to give to the player if they place 1st-5th in the race.
/* 0x438 */ UNK_TYPE1 unk438[4];
/* 0x43C */ s32 unk_43C;
/* 0x440 */ s16 unk_440;
/* 0x43C */ s32 animIndex;
/* 0x440 */ s16 forceRaceEndTimer;
} EnAob01; // size = 0x444
#endif // Z_EN_AOB_01_H
@@ -4,7 +4,6 @@
* Description: Bad Bat
*/
#include "prevent_bss_reordering.h"
#include "z_en_bat.h"
#include "objects/object_bat/object_bat.h"
+5 -13
View File
@@ -5,13 +5,12 @@
*/
#include "z_en_dg.h"
#include "overlays/actors/ovl_En_Aob_01/z_en_aob_01.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_800000)
#define THIS ((EnDg*)thisx)
//! TODO: this file require macros for its uses of weekEventReg
void EnDg_Init(Actor* thisx, PlayState* play);
void EnDg_Destroy(Actor* thisx, PlayState* play);
void EnDg_Update(Actor* thisx, PlayState* play);
@@ -417,20 +416,13 @@ void EnDg_SetupIdleMove(EnDg* this, PlayState* play) {
/**
* Updates the text ID in sRacetrackDogInfo based on what was set in the weekEventRegs by
* En_Aob_01. This makes it sp the proper message can be displayed when the player picks up
* En_Aob_01. This makes it so the proper message can be displayed when the player picks up
* the dog with the Mask of Truth equipped.
*/
void EnDg_UpdateTextId(EnDg* this) {
if (this->index < 14) {
// Assuming that the weekEventRegs haven't been tampered with, then this will produce a text ID in
// the range of 0x3538 to 0x3545.
if (this->index % 2) {
sRacetrackDogInfo[this->index].textId =
0x3538 + ((gSaveContext.save.saveInfo.weekEventReg[42 + (this->index / 2)] & 0xF0) >> 4);
} else {
sRacetrackDogInfo[this->index].textId =
0x3538 + (gSaveContext.save.saveInfo.weekEventReg[42 + (this->index / 2)] & 0x0F);
}
if (this->index < RACEDOG_COUNT) {
// This will produce a text ID in the range of 0x3538 to 0x3545.
sRacetrackDogInfo[this->index].textId = GET_WEEKEVENTREG_DOG_RACE_TEXT(this->index, 0x3538);
} else {
Actor_Kill(&this->actor);
}
@@ -792,7 +792,8 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
this->stateFlags = 0;
}
if (((play->sceneId == SCENE_KOEPONARACE) && (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_START)) ||
if (((play->sceneId == SCENE_KOEPONARACE) &&
(GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_START)) ||
((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && (Cutscene_GetSceneLayer(play) != 0))) {
this->stateFlags |= ENHORSE_FLAG_25;
}
@@ -2471,7 +2472,7 @@ void func_808819D8(EnHorse* this, PlayState* play) {
func_8088168C(this);
}
if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_3) {
if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3) {
this->rider->unk488 = 7;
} else {
EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1,
@@ -59,7 +59,7 @@ s32 func_808F8AA0(EnHorseGameCheck* this, PlayState* play) {
DynaPolyActor_Init(&this->dyna, 0);
if (GET_WEEKEVENTREG_RACE_FLAGS != WEEKEVENTREG_RACE_FLAG_START) {
if (GET_WEEKEVENTREG_HORSE_RACE_STATE != WEEKEVENTREG_HORSE_RACE_STATE_START) {
Actor_Kill(&this->dyna.actor);
return false;
}
@@ -116,7 +116,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) {
this->unk_168 = 0;
this->unk_174 = 0;
if (GET_WEEKEVENTREG_RACE_FLAGS != WEEKEVENTREG_RACE_FLAG_START) {
if (GET_WEEKEVENTREG_HORSE_RACE_STATE != WEEKEVENTREG_HORSE_RACE_STATE_START) {
Actor_Kill(&this->dyna.actor);
return false;
}
@@ -156,14 +156,14 @@ s32 func_808F8EB0(EnHorseGameCheck* this, PlayState* play) {
return false;
}
if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_3) {
if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3) {
play->transitionType = TRANS_TYPE_64;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
} else if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) {
} else if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2) {
play->transitionType = TRANS_TYPE_80;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
} else if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_4) {
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_3);
} else if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_4) {
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_3);
play->transitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
}
@@ -252,7 +252,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x40000;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_4);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_4);
this->unk_174 = 60;
}
@@ -285,7 +285,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x40000;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_3);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_3);
this->unk_174 = 60;
}
@@ -318,7 +318,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x02000000;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_3);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_3);
this->unk_174 = 60;
}
@@ -347,7 +347,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x800;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_2);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_2);
this->unk_174 = 60;
}
return true;
+21 -21
View File
@@ -336,7 +336,7 @@ void func_808F38F8(EnIn* this, PlayState* play) {
}
void func_808F395C(EnIn* this, PlayState* play) {
if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_END) {
if (this->unk4B0 == WEEKEVENTREG_HORSE_RACE_STATE_END) {
this->actionFunc = func_808F5A94;
}
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
@@ -352,30 +352,30 @@ void func_808F39DC(EnIn* this, PlayState* play) {
u16 textId = 0;
if (gSaveContext.save.day != 3) {
switch (GET_WEEKEVENTREG_RACE_FLAGS) {
case WEEKEVENTREG_RACE_FLAG_2:
switch (GET_WEEKEVENTREG_HORSE_RACE_STATE) {
case WEEKEVENTREG_HORSE_RACE_STATE_2:
textId = 0x347A;
break;
case WEEKEVENTREG_RACE_FLAG_3:
case WEEKEVENTREG_HORSE_RACE_STATE_3:
textId = 0x3476;
break;
}
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_END);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_END);
} else {
switch (GET_WEEKEVENTREG_RACE_FLAGS) {
case WEEKEVENTREG_RACE_FLAG_2:
switch (GET_WEEKEVENTREG_HORSE_RACE_STATE) {
case WEEKEVENTREG_HORSE_RACE_STATE_2:
textId = 0x349D;
break;
case WEEKEVENTREG_RACE_FLAG_3:
case WEEKEVENTREG_HORSE_RACE_STATE_3:
textId = 0x3499;
break;
}
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_END);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_END);
}
this->actor.flags |= ACTOR_FLAG_10000;
this->actor.textId = textId;
this->actionFunc = func_808F395C;
if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_2) {
if (this->unk4B0 == WEEKEVENTREG_HORSE_RACE_STATE_2) {
Actor_PlaySfx(&this->actor, NA_SE_VO_IN_LOST);
} else {
Actor_PlaySfx(&this->actor, NA_SE_VO_IN_JOY0);
@@ -635,7 +635,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx,
s32 func_808F43E0(EnIn* this) {
this->unk48C = 0;
this->actor.textId = 0;
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_END);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_END);
return 0;
}
@@ -817,7 +817,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) {
func_80151BB4(play, 0x11);
break;
case 0x3475:
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_START);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_START);
func_800FD750(NA_BGM_HORSE);
play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5);
play->transitionType = TRANS_TYPE_FADE_WHITE_FAST;
@@ -1064,7 +1064,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) {
ret = false;
break;
case 0x3475:
SET_WEEKEVENTREG_RACE_FLAGS(WEEKEVENTREG_RACE_FLAG_START);
SET_WEEKEVENTREG_HORSE_RACE_STATE(WEEKEVENTREG_HORSE_RACE_STATE_START);
func_800FD750(NA_BGM_HORSE);
play->nextEntrance = ENTRANCE(GORMAN_TRACK, 5);
play->transitionType = TRANS_TYPE_FADE_WHITE_FAST;
@@ -1322,7 +1322,7 @@ void func_808F5B58(EnIn* this, PlayState* play) {
}
void func_808F5C98(EnIn* this, PlayState* play) {
if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_END) {
if (this->unk4B0 == WEEKEVENTREG_HORSE_RACE_STATE_END) {
this->actionFunc = func_808F5B58;
}
if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
@@ -1334,7 +1334,7 @@ void func_808F5C98(EnIn* this, PlayState* play) {
}
}
if (this->unk4A8 == 2) {
if (this->unk4B0 == WEEKEVENTREG_RACE_FLAG_2) {
if (this->unk4B0 == WEEKEVENTREG_HORSE_RACE_STATE_2) {
Actor_PlaySfx(&this->actor, NA_SE_VO_IN_LOST);
} else {
Actor_PlaySfx(&this->actor, NA_SE_VO_IN_JOY0);
@@ -1366,7 +1366,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
this->unk48C = 0;
this->unk4AC = 0;
type = ENIN_GET_TYPE(thisx);
this->unk4B0 = GET_WEEKEVENTREG_RACE_FLAGS;
this->unk4B0 = GET_WEEKEVENTREG_HORSE_RACE_STATE;
if (type == ENIN_HORSE_RIDER_BLUE_SHIRT || type == ENIN_BLUE_SHIRT) {
this->unk4AC |= 8;
}
@@ -1387,8 +1387,8 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
this->path = SubS_GetPathByIndex(play, ENIN_GET_PATH(&this->actor), 0x3F);
this->unk23D = 0;
if (type == ENIN_YELLOW_SHIRT || type == ENIN_BLUE_SHIRT) {
if ((GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) ||
(GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_3)) {
if ((GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2) ||
(GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3)) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08);
this->unk4A8 = 0;
this->unk4AC |= 2;
@@ -1396,12 +1396,12 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
this->unk23C = 0;
D_801BDAA0 = 0;
if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) {
if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2) {
EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_6);
} else {
EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_4);
}
if (GET_WEEKEVENTREG_RACE_FLAGS == WEEKEVENTREG_RACE_FLAG_2) {
if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_2) {
this->skelAnime.curFrame = ((Rand_ZeroOne() * 0.6f) + 0.2f) * this->skelAnime.endFrame;
}
if (this->unk4AC & 8) {
@@ -1410,7 +1410,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
this->actionFunc = func_808F5C98;
}
} else {
if (GET_WEEKEVENTREG_RACE_FLAGS != WEEKEVENTREG_RACE_FLAG_START) {
if (GET_WEEKEVENTREG_HORSE_RACE_STATE != WEEKEVENTREG_HORSE_RACE_STATE_START) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_56_08);
this->unk23C = 0;
this->unk4AC |= 2;
@@ -9,14 +9,13 @@
*/
#include "z_en_racedog.h"
#include "overlays/actors/ovl_En_Aob_01/z_en_aob_01.h"
#include "overlays/actors/ovl_En_Dg/z_en_dg.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_80000000)
#define THIS ((EnRacedog*)thisx)
//! TODO: this file require macros for its uses of weekEventReg
void EnRacedog_Init(Actor* thisx, PlayState* play);
void EnRacedog_Destroy(Actor* thisx, PlayState* play);
void EnRacedog_Update(Actor* thisx, PlayState* play);
@@ -317,7 +316,7 @@ void EnRacedog_Init(Actor* thisx, PlayState* play) {
this->path = SubS_GetPathByIndex(play, ENRACEDOG_GET_PATH(&this->actor), 0x3F);
Actor_SetScale(&this->actor, 0.0075f);
this->actor.gravity = -3.0f;
if (ENRACEDOG_GET_INDEX(&this->actor) < 14) {
if (ENRACEDOG_GET_INDEX(&this->actor) < RACEDOG_COUNT) {
this->index = ENRACEDOG_GET_INDEX(&this->actor);
} else {
Actor_Kill(&this->actor);
@@ -353,7 +352,7 @@ void EnRacedog_Init(Actor* thisx, PlayState* play) {
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_20;
sSelectedDogInfo = sDogInfo[(s16)((gSaveContext.eventInf[0] & 0xF8) >> 3)];
sSelectedDogInfo = sDogInfo[(s16)GET_EVENTINF_DOG_RACE_SELECTED_DOG_INDEX];
this->selectedDogIndex = sSelectedDogInfo.index;
EnRacedog_ChangeAnim(&this->skelAnime, sAnimationInfo, RACEDOG_ANIM_IDLE);
@@ -439,15 +438,8 @@ void EnRacedog_Race(EnRacedog* this, PlayState* play) {
* or an intentional choice to introduce a bit of extra variance to the race.
*/
void EnRacedog_UpdateTextId(EnRacedog* this) {
// Assuming that the weekEventRegs haven't been tampered with, then this will produce a text ID in the
// range of 0x3539 to 0x3546.
if (this->index % 2) {
sDogInfo[this->index].textId =
(((gSaveContext.save.saveInfo.weekEventReg[42 + (this->index / 2)]) & 0xF0) >> 4) + 0x3539;
} else {
sDogInfo[this->index].textId =
((gSaveContext.save.saveInfo.weekEventReg[42 + (this->index / 2)]) & 0x0F) + 0x3539;
}
// This will produce a text ID in the range of 0x3539 to 0x3546.
sDogInfo[this->index].textId = GET_WEEKEVENTREG_DOG_RACE_TEXT(this->index, 0x3539);
// As a sanity check, this makes sure the text ID is something in the expected range of 0x3539 to 0x3546.
if ((sDogInfo[this->index].textId > 0x3546) || (sDogInfo[this->index].textId < 0x3539)) {
@@ -593,7 +585,7 @@ void EnRacedog_CheckForFinish(EnRacedog* this) {
this->raceStatus = RACEDOG_RACE_STATUS_FINISHED;
if (this->index == this->selectedDogIndex) {
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & 7) | (sNumberOfDogsFinished * 8);
SET_EVENTINF_DOG_RACE_RACE_STANDING(sNumberOfDogsFinished);
}
}
}
@@ -6,6 +6,7 @@
#define ENRACEDOG_GET_INDEX(thisx) (((thisx)->params & 0x3E0) >> 5)
#define ENRACEDOG_GET_PATH(thisx) (((thisx)->params & 0xFC00) >> 10)
#define ENRACEDOG_PARAMS(index, path) ((index << 5) | (path))
/**
* The main point of this seems to be some very light anti-cheat detection. The dog
+2 -2
View File
@@ -708,11 +708,11 @@ void EnSsh_Talk(EnSsh* this, PlayState* play) {
void func_809756D0(EnSsh* this, PlayState* play) {
u16 nextTextId;
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED)) {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_SWAMP_SPIDER_HOUSE_MAN)) {
nextTextId = 0x914; // In here, cursed spiders, defeat them to make me normal
} else {
nextTextId = 0x910; // Help me! I am not a monster, I was cursed this way
SET_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED);
SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_SWAMP_SPIDER_HOUSE_MAN);
}
Message_StartTextbox(play, nextTextId, &this->actor);
}
+4 -4
View File
@@ -148,7 +148,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) {
}
this->actor.textId = 0;
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH) ||
!CHECK_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED)) {
!CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_SWAMP_SPIDER_HOUSE_MAN)) {
this->sthFlags |= STH_FLAG_DRAW_MASK_OF_TRUTH;
}
break;
@@ -479,7 +479,7 @@ void EnSth_GetInitialSwampSpiderHouseText(EnSth* this, PlayState* play) {
nextTextId = 0x90F; // (does not exist)
EnSth_ChangeAnim(this, STH_ANIM_TALK);
} else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH)) {
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED)) {
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_SWAMP_SPIDER_HOUSE_MAN)) {
nextTextId = 0x91B; // As soon as I calm down, getting rid of it
} else {
nextTextId = 0x918; // I've had enough of this, going home
@@ -525,7 +525,7 @@ void EnSth_SwampSpiderHouseGiveMask(EnSth* this, PlayState* play) {
} else {
this->sthFlags &= ~STH_FLAG_DRAW_MASK_OF_TRUTH;
// This flag is used to keep track if the player has already spoken to the actor, triggering secondary dialogue.
SET_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED);
SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_SWAMP_SPIDER_HOUSE_MAN);
Actor_OfferGetItem(&this->actor, play, GI_MASK_TRUTH, 10000.0f, 50.0f);
}
}
@@ -566,7 +566,7 @@ void EnSth_HandleSwampSpiderHouseConversation(EnSth* this, PlayState* play) {
case 0x91A: // Someone gave me this mask and said it would make me rich, getting rid of it
SET_WEEKEVENTREG(WEEKEVENTREG_RECEIVED_MASK_OF_TRUTH);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_SWAMP_SPIDER_HOUSE_TALKED);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_TALKED_SWAMP_SPIDER_HOUSE_MAN);
case 0x902: // (does not exist)
case 0x903: // (does not exist)
@@ -230,7 +230,7 @@ void EnSuttari_TriggerTransition(PlayState* play, u16 entrance) {
play->transitionTrigger = TRANS_TRIGGER_START;
}
void EnSuttari_UpdateTime(void) {
void EnSuttari_AdvanceTime(void) {
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED;
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.timeSpeedOffset);
}
@@ -1483,7 +1483,7 @@ void EnSuttari_Update(Actor* thisx, PlayState* play) {
func_80BAB4F0(this, play);
}
if (this->flags2 & 2) {
EnSuttari_UpdateTime();
EnSuttari_AdvanceTime();
}
if (this->unk428 != 0) {
if (this->animIndex == 2 || this->animIndex == 6) {
@@ -4,6 +4,7 @@
* Description: Sakon's Hideout Objects (Sun's Mask, doors, etc)
*/
#include "prevent_bss_reordering.h"
#include "z_obj_nozoki.h"
#include "objects/object_secom_obj/object_secom_obj.h"