En_Horse_Game_Check (#706)

* En_Horse_Game_Check

* PR
This commit is contained in:
Maide
2022-03-26 02:16:28 +00:00
committed by GitHub
parent 9362fee5e8
commit 7c624422de
7 changed files with 523 additions and 84 deletions
@@ -0,0 +1,5 @@
<Root>
<File Name="ovl_En_Horse_Game_Check" BaseAddress="0x808F8AA0" RangeStart="0x1080" RangeEnd="0x10F4">
<Collision Name="ovl_En_Horse_Game_Check_Colheader_0010C8" Offset="0x10C8" />
</File>
</Root>
+1 -2
View File
@@ -1290,8 +1290,7 @@ beginseg
name "ovl_En_Horse_Game_Check"
compress
include "build/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.o"
include "build/data/ovl_En_Horse_Game_Check/ovl_En_Horse_Game_Check.data.o"
include "build/data/ovl_En_Horse_Game_Check/ovl_En_Horse_Game_Check.reloc.o"
include "build/src/overlays/actors/ovl_En_Horse_Game_Check/ovl_En_Horse_Game_Check_reloc.o"
endseg
beginseg
@@ -12,7 +12,11 @@ typedef struct EnHorse {
/* 0x150 */ s32 unk_150;
/* 0x154 */ char unk_154[0x98];
/* 0x1EC */ UNK_TYPE4 unk_1EC;
/* 0x1F0 */ char unk_1F0[0x3A4];
/* 0x1F0 */ char unk_1F0[0x5C];
/* 0x24C */ u32 unk_24C;
/* 0x250 */ char unk_250[0x138];
/* 0x388 */ s32 inRace;
/* 0x38C */ char unk_38C[0x208];
} EnHorse; // size = 0x594
extern const ActorInit En_Horse_InitVars;
File diff suppressed because it is too large Load Diff
@@ -2,12 +2,56 @@
#define Z_EN_HORSE_GAME_CHECK_H
#include "global.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
struct EnHorseGameCheck;
typedef s32 (*EnHorseGameCheckUnkFunc)(struct EnHorseGameCheck*, GlobalContext*);
#define ENHORSEGAMECHECK_GET_FF(thisx) ((thisx)->params & 0xFF)
#define ENHORSEGAMECHECK_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8)
enum {
/* 0 */ ENHORSEGAMECHECK_FF_0,
/* 1 */ ENHORSEGAMECHECK_FF_1,
/* 2 */ ENHORSEGAMECHECK_FF_2,
/* 3 */ ENHORSEGAMECHECK_FF_3,
/* 4 */ ENHORSEGAMECHECK_FF_4,
/* 5 */ ENHORSEGAMECHECK_FF_5,
/* 6 */ ENHORSEGAMECHECK_FF_6,
/* 7 */ ENHORSEGAMECHECK_FF_7,
/* 8 */ ENHORSEGAMECHECK_FF_8,
/* 9 */ ENHORSEGAMECHECK_FF_9,
/* 10 */ ENHORSEGAMECHECK_FF_MAX,
};
#define RACE_FLAG_END 0
#define RACE_FLAG_START 1
#define RACE_FLAG_2 2
#define RACE_FLAG_3 3
#define RACE_FLAG_4 4
#define RACE_FLAGS 7
#define GET_RACE_FLAGS (gSaveContext.weekEventReg[92] & RACE_FLAGS)
#define SET_RACE_FLAGS(flag) { \
gSaveContext.weekEventReg[92] &= (u8) ~RACE_FLAGS; \
gSaveContext.weekEventReg[92] = \
gSaveContext.weekEventReg[92] | (u8)((gSaveContext.weekEventReg[92] & ~RACE_FLAGS) | (flag)); \
}
typedef struct EnHorseGameCheck {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x74];
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ s32 unk_15C;
/* 0x160 */ s32 unk_160;
/* 0x164 */ s32 unk_164;
/* 0x168 */ s32 unk_168;
/* 0x16C */ EnHorse* horse1;
/* 0x170 */ EnHorse* horse2;
/* 0x174 */ s32 unk_174;
/* 0x178 */ UNK_TYPE1 pad178[0x4];
/* 0x17C */ s32 unk_17C;
/* 0x180 */ UNK_TYPE1 pad180[0x38];
} EnHorseGameCheck; // size = 0x1B8
extern const ActorInit En_Horse_Game_Check_InitVars;
+21 -35
View File
@@ -6,25 +6,12 @@
#include "z_en_in.h"
#include "objects/object_in/object_in.h"
#include "overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10)
#define THIS ((EnIn*)thisx)
#define SET_FLAGS_FINISH_RACE \
{ \
gSaveContext.weekEventReg[92] &= (u8) ~(1 | 2 | 4); \
gSaveContext.weekEventReg[92] = \
gSaveContext.weekEventReg[92] | (u8)(gSaveContext.weekEventReg[92] & ~(1 | 2 | 4)); \
}
#define SET_FLAGS_START_RACE \
{ \
gSaveContext.weekEventReg[92] &= (u8) ~(1 | 2 | 4); \
gSaveContext.weekEventReg[92] = \
gSaveContext.weekEventReg[92] | (u8)((gSaveContext.weekEventReg[92] & ~(1 | 2 | 4)) | 1); \
}
void EnIn_Init(Actor* thisx, GlobalContext* globalCtx);
void EnIn_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnIn_Update(Actor* thisx, GlobalContext* globalCtx);
@@ -345,7 +332,7 @@ void func_808F38F8(EnIn* this, GlobalContext* globalCtx) {
}
void func_808F395C(EnIn* this, GlobalContext* globalCtx) {
if (this->unk4B0 == 0) {
if (this->unk4B0 == RACE_FLAG_END) {
this->actionFunc = func_808F5A94;
}
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) {
@@ -361,30 +348,30 @@ void func_808F39DC(EnIn* this, GlobalContext* globalCtx) {
u16 textId = 0;
if (gSaveContext.day != 3) {
switch (gSaveContext.weekEventReg[92] & (1 | 2 | 4)) {
case 2:
switch (GET_RACE_FLAGS) {
case RACE_FLAG_2:
textId = 0x347A;
break;
case 3:
case RACE_FLAG_3:
textId = 0x3476;
break;
}
SET_FLAGS_FINISH_RACE;
SET_RACE_FLAGS(RACE_FLAG_END);
} else {
switch (gSaveContext.weekEventReg[92] & (1 | 2 | 4)) {
case 2:
switch (GET_RACE_FLAGS) {
case RACE_FLAG_2:
textId = 0x349D;
break;
case 3:
case RACE_FLAG_3:
textId = 0x3499;
break;
}
SET_FLAGS_FINISH_RACE;
SET_RACE_FLAGS(RACE_FLAG_END);
}
this->actor.flags |= ACTOR_FLAG_10000;
this->actor.textId = textId;
this->actionFunc = func_808F395C;
if (this->unk4B0 == 2) {
if (this->unk4B0 == RACE_FLAG_2) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_LOST);
} else {
Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_JOY0);
@@ -644,7 +631,7 @@ s32 func_808F4270(GlobalContext* globalCtx, EnIn* this, s32 arg2, MessageContext
s32 func_808F43E0(EnIn* this) {
this->unk48C = 0;
this->actor.textId = 0;
SET_FLAGS_FINISH_RACE;
SET_RACE_FLAGS(RACE_FLAG_END);
return 0;
}
@@ -826,7 +813,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) {
func_80151BB4(globalCtx, 0x11);
break;
case 0x3475:
SET_FLAGS_START_RACE;
SET_RACE_FLAGS(RACE_FLAG_START);
func_800FD750(NA_BGM_HORSE);
globalCtx->nextEntranceIndex = 0xCE50;
globalCtx->unk_1887F = 5;
@@ -1073,7 +1060,7 @@ s32 func_808F4414(GlobalContext* globalCtx, EnIn* this, s32 arg2) {
ret = false;
break;
case 0x3475:
SET_FLAGS_START_RACE;
SET_RACE_FLAGS(RACE_FLAG_START);
func_800FD750(NA_BGM_HORSE);
globalCtx->nextEntranceIndex = 0xCE50;
globalCtx->unk_1887F = 5;
@@ -1331,7 +1318,7 @@ void func_808F5B58(EnIn* this, GlobalContext* globalCtx) {
}
void func_808F5C98(EnIn* this, GlobalContext* globalCtx) {
if (this->unk4B0 == 0) {
if (this->unk4B0 == RACE_FLAG_END) {
this->actionFunc = func_808F5B58;
}
if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADER && gSaveContext.weekEventReg[63] & 0x40) ||
@@ -1343,7 +1330,7 @@ void func_808F5C98(EnIn* this, GlobalContext* globalCtx) {
}
}
if (this->unk4A8 == 2) {
if (this->unk4B0 == 2) {
if (this->unk4B0 == RACE_FLAG_2) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_LOST);
} else {
Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_IN_JOY0);
@@ -1376,7 +1363,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk48C = 0;
this->unk4AC = 0;
type = ENIN_GET_TYPE(thisx);
this->unk4B0 = gSaveContext.weekEventReg[92] & (1 | 2 | 4);
this->unk4B0 = GET_RACE_FLAGS;
if (type == ENIN_HORSE_RIDER_BLUE_SHIRT || type == 4) {
this->unk4AC |= 8;
}
@@ -1397,20 +1384,19 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) {
this->path = func_8013D648(globalCtx, ENIN_GET_PATH(&this->actor), 0x3F);
this->unk23D = 0;
if (type == ENIN_YELLOW_SHIRT || type == ENIN_BLUE_SHIRT) {
if ((gSaveContext.weekEventReg[92] & (1 | 2 | 4)) == 2 ||
(gSaveContext.weekEventReg[92] & (1 | 2 | 4)) == 3) {
if (GET_RACE_FLAGS == RACE_FLAG_2 || (GET_RACE_FLAGS) == RACE_FLAG_3) {
gSaveContext.weekEventReg[56] &= (u8)~8;
this->unk4A8 = 0;
this->unk4AC |= 2;
func_808F35AC(this, globalCtx);
this->unk23C = 0;
D_801BDAA0 = 0;
if ((gSaveContext.weekEventReg[92] & (1 | 2 | 4)) == 2) {
if (GET_RACE_FLAGS == RACE_FLAG_2) {
func_808F30B0(&this->skelAnime, 6);
} else {
func_808F30B0(&this->skelAnime, 4);
}
if ((gSaveContext.weekEventReg[92] & (1 | 2 | 4)) == 2) {
if (GET_RACE_FLAGS == RACE_FLAG_2) {
this->skelAnime.curFrame = ((Rand_ZeroOne() * 0.6f) + 0.2f) * this->skelAnime.endFrame;
}
if (this->unk4AC & 8) {
@@ -1419,7 +1405,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = func_808F5C98;
}
} else {
if ((gSaveContext.weekEventReg[92] & (1 | 2 | 4)) != 1) {
if (GET_RACE_FLAGS != RACE_FLAG_START) {
gSaveContext.weekEventReg[56] &= (u8)~8;
this->unk23C = 0;
this->unk4AC |= 2;
-9
View File
@@ -1325,15 +1325,6 @@ D_0600D178 = 0x0600D178;
D_0600D4E8 = 0x0600D4E8;
D_060150D8 = 0x060150D8;
// ovl_En_Horse_Game_Check
D_060013A0 = 0x060013A0;
D_060014B0 = 0x060014B0;
D_06002FB8 = 0x06002FB8;
D_06003030 = 0x06003030;
D_060030C0 = 0x060030C0;
D_06003918 = 0x06003918;
// ovl_En_Horse_Link_Child
D_06002F98 = 0x06002F98;