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;
@@ -5,6 +5,7 @@
*/
#include "z_en_horse_game_check.h"
#include "objects/object_horse_game_check/object_horse_game_check.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -15,7 +16,25 @@ void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx);
void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx);
#if 0
s32 func_808F8AA0(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F8C24(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F8C5C(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F8C70(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F8CCC(EnHorseGameCheck* this, GlobalContext* globalCtx2);
s32 func_808F8E94(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F96E4(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F9830(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F9868(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F987C(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F990C(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F9944(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F9958(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F999C(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F99B0(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F99C4(EnHorseGameCheck* this, GlobalContext* globalCtx);
s32 func_808F99D8(EnHorseGameCheck* this, GlobalContext* globalCtx);
const ActorInit En_Horse_Game_Check_InitVars = {
ACTOR_EN_HORSE_GAME_CHECK,
ACTORCAT_BG,
@@ -28,63 +47,454 @@ const ActorInit En_Horse_Game_Check_InitVars = {
(ActorFunc)EnHorseGameCheck_Draw,
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_808F9BDC[] = {
#include "overlays/ovl_En_Horse_Game_Check/ovl_En_Horse_Game_Check.c"
s32 func_808F8AA0(EnHorseGameCheck* this, GlobalContext* globalCtx) {
s32 pad[3];
CollisionHeader* sp78 = NULL;
MtxF sp38;
this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = this->unk_160 * 0.001f;
this->dyna.actor.flags |= ACTOR_FLAG_400000;
DynaPolyActor_Init(&this->dyna, 0);
if (GET_RACE_FLAGS != RACE_FLAG_START) {
Actor_MarkForDeath(&this->dyna.actor);
return false;
}
CollisionHeader_GetVirtual(&object_horse_game_check_Colheader_003918, &sp78);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp78);
this->unk_15C = ENHORSEGAMECHECK_FF_5;
this->dyna.actor.floorPoly = NULL;
this->dyna.actor.world.pos.y += 100.0f;
this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor2(
globalCtx, &globalCtx->colCtx, &this->dyna.actor.floorPoly, &this->dyna.actor.world.pos);
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight + 3.0f;
func_800C0094(this->dyna.actor.floorPoly, this->dyna.actor.world.pos.x, this->dyna.actor.floorHeight,
this->dyna.actor.world.pos.z, &sp38);
Matrix_SetCurrentState(&sp38);
Matrix_RotateY(this->dyna.actor.shape.rot.y, MTXMODE_APPLY);
Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.y, MTXMODE_APPLY);
Matrix_CopyCurrentState(&sp38);
func_8018219C(&sp38, &this->dyna.actor.shape.rot, 1);
this->dyna.actor.world.rot = this->dyna.actor.shape.rot;
return true;
}
s32 func_808F8C24(EnHorseGameCheck* this, GlobalContext* globalCtx) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
return true;
}
s32 func_808F8C5C(EnHorseGameCheck* this, GlobalContext* globalCtx) {
return true;
}
s32 func_808F8C70(EnHorseGameCheck* this, GlobalContext* globalCtx) {
if (Matrix_NewMtx(globalCtx->state.gfxCtx) == NULL) {
return true;
} else {
Gfx_DrawDListXlu(globalCtx, object_horse_game_check_DL_003030);
Gfx_DrawDListOpa(globalCtx, object_horse_game_check_DL_0030C0);
}
return true;
}
s32 func_808F8CCC(EnHorseGameCheck* this, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
s32 pad;
Vec3f sp4C = { -1262.0f, 15.0f, 780.0f };
Vec3f sp40 = { -1262.0f, -26.0f, 470.0f };
this->unk_164 = 0;
this->unk_168 = 0;
this->unk_174 = 0;
if (GET_RACE_FLAGS != RACE_FLAG_START) {
Actor_MarkForDeath(&this->dyna.actor);
return false;
}
func_8010E9F0(4, 0);
globalCtx->interfaceCtx.unk_280 = 1;
this->horse1 = (EnHorse*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0,
0x7FFF, 0, 0x2004);
if (this->horse1 == NULL) {
__assert("../z_en_horse_game_check.c", 1517);
}
this->horse2 = (EnHorse*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -1376.0f, -106.0f, 470.0f, 0,
0x7FFF, 0, 0x2005);
if (this->horse2 == NULL) {
__assert("../z_en_horse_game_check.c", 1526);
}
this->unk_17C = -1;
func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 10);
Play_CameraSetAtEye(globalCtx, 0, &sp40, &sp4C);
Play_CameraSetFov(globalCtx, 0, 45.0f);
func_800FE484();
return false;
}
s32 func_808F8E94(EnHorseGameCheck* this, GlobalContext* globalCtx) {
gSaveContext.unk_3DD0[4] = 0;
return true;
}
s32 func_808F8EB0(EnHorseGameCheck* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
if (globalCtx->nextEntranceIndex == 0xCE20) {
return false;
}
if (GET_RACE_FLAGS == RACE_FLAG_3) {
globalCtx->unk_1887F = 0x40;
gSaveContext.nextTransition = 2;
} else if (GET_RACE_FLAGS == RACE_FLAG_2) {
globalCtx->unk_1887F = 0x50;
gSaveContext.nextTransition = 3;
} else if (GET_RACE_FLAGS == RACE_FLAG_4) {
SET_RACE_FLAGS(RACE_FLAG_3);
globalCtx->unk_1887F = 2;
gSaveContext.nextTransition = 2;
}
D_801BDA9C = 0;
if (player->stateFlags1 & 0x800000) {
D_801BDAA0 = 1;
}
globalCtx->nextEntranceIndex = 0xCE20;
globalCtx->sceneLoadFlag = 0x14;
return false;
}
f32 D_808F9BAC[] = {
-1825.0f,
-237.0f,
-2867.0f,
-1987.0f,
};
f32 D_808F9BBC[] = {
1564.0f,
3395.0f,
-1665.0f,
-200.0f,
};
f32 D_808F9BCC[] = {
-22.0f,
2005.0f,
3869.0f,
5368.0f,
};
s32 func_808F8FAC(EnHorseGameCheck* this, GlobalContext* globalCtx) {
s32 pad[2];
Player* player = GET_PLAYER(globalCtx);
s32 pad2;
EnHorse* horse = (EnHorse*)player->rideActor;
s32 pad3[2];
EnHorseGameCheck* horseGameCheck;
if (horse == NULL) {
return true;
}
if ((this->unk_168 > 50) && !(this->unk_164 & 2)) {
this->unk_164 |= 2;
} else if ((globalCtx->interfaceCtx.unk_280 >= 8) && !(this->unk_164 & 1)) {
this->unk_164 |= 1;
horse->inRace = true;
} else if ((globalCtx->interfaceCtx.unk_280 >= 8) && !(this->unk_164 & 8)) {
EnHorse* horse = this->horse1;
horse->inRace = true;
horse = this->horse2;
horse->inRace = true;
this->unk_164 |= 8;
this->unk_17C = this->unk_168;
}
if ((this->unk_17C != -1) && ((this->unk_168 - this->unk_17C) > 10)) {
this->unk_17C = -1;
func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 4);
}
this->unk_168++;
if ((this->unk_164 & 0x4000) && (this->unk_164 & 0x200000)) {
if (!(this->unk_164 & 0x10)) {
this->unk_164 |= 0x10;
}
}
if ((this->unk_164 & 0x800) || (this->unk_164 & 0x40000) || (this->unk_164 & 0x02000000)) {
if (this->unk_174 > 0) {
this->unk_174--;
} else {
func_808F8EB0(this, globalCtx);
}
return true;
}
if (gSaveContext.unk_3DE0[4] >= 0x4650) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x40000;
gSaveContext.unk_3DD0[4] = 6;
SET_RACE_FLAGS(RACE_FLAG_4)
this->unk_174 = 60;
}
if (!(this->unk_164 & 0x1000)) {
if (Math3D_XZBoundCheck(D_808F9BAC[0], D_808F9BAC[1], D_808F9BAC[2], D_808F9BAC[3],
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
this->unk_164 |= 0x1000;
}
}
if (!(this->unk_164 & 0x2000) && (this->unk_164 & 0x1000)) {
if (Math3D_XZBoundCheck(D_808F9BBC[0], D_808F9BBC[1], D_808F9BBC[2], D_808F9BBC[3],
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
this->unk_164 |= 0x2000;
}
}
if (!(this->unk_164 & 0x4000) && (this->unk_164 & 0x2000)) {
if (Math3D_XZBoundCheck(D_808F9BCC[0], D_808F9BCC[1], D_808F9BCC[2], D_808F9BCC[3],
this->horse1->actor.world.pos.x, this->horse1->actor.world.pos.z)) {
this->unk_164 |= 0x4000;
}
}
horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&globalCtx->colCtx, this->horse1->unk_24C);
if ((this->unk_164 & 0x4000) && (horseGameCheck != NULL) &&
(horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) &&
(horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x40000)) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x40000;
gSaveContext.unk_3DD0[4] = 6;
SET_RACE_FLAGS(RACE_FLAG_3)
this->unk_174 = 60;
}
if (!(this->unk_164 & 0x80000)) {
if (Math3D_XZBoundCheck(D_808F9BAC[0], D_808F9BAC[1], D_808F9BAC[2], D_808F9BAC[3],
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
this->unk_164 |= 0x80000;
}
}
if (!(this->unk_164 & 0x100000) && (this->unk_164 & 0x80000)) {
if (Math3D_XZBoundCheck(D_808F9BBC[0], D_808F9BBC[1], D_808F9BBC[2], D_808F9BBC[3],
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
this->unk_164 |= 0x100000;
}
}
if (!(this->unk_164 & 0x200000) && (this->unk_164 & 0x100000)) {
if (Math3D_XZBoundCheck(D_808F9BCC[0], D_808F9BCC[1], D_808F9BCC[2], D_808F9BCC[3],
this->horse2->actor.world.pos.x, this->horse2->actor.world.pos.z)) {
this->unk_164 |= 0x200000;
}
}
horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&globalCtx->colCtx, this->horse2->unk_24C);
if ((this->unk_164 & 0x200000) && (horseGameCheck != NULL) &&
(horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) &&
(horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x02000000)) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x02000000;
gSaveContext.unk_3DD0[4] = 6;
SET_RACE_FLAGS(RACE_FLAG_3)
this->unk_174 = 60;
}
if (!(this->unk_164 & 0x20) && Math3D_XZBoundCheck(D_808F9BAC[0], D_808F9BAC[1], D_808F9BAC[2], D_808F9BAC[3],
horse->actor.world.pos.x, horse->actor.world.pos.z)) {
this->unk_164 |= 0x20;
}
if (!(this->unk_164 & 0x40) && (this->unk_164 & 0x20) &&
Math3D_XZBoundCheck(D_808F9BBC[0], D_808F9BBC[1], D_808F9BBC[2], D_808F9BBC[3], horse->actor.world.pos.x,
horse->actor.world.pos.z)) {
this->unk_164 |= 0x40;
}
if (!(this->unk_164 & 0x80) && (this->unk_164 & 0x40) &&
Math3D_XZBoundCheck(D_808F9BCC[0], D_808F9BCC[1], D_808F9BCC[2], D_808F9BCC[3], horse->actor.world.pos.x,
horse->actor.world.pos.z)) {
this->unk_164 |= 0x80;
}
horseGameCheck = (EnHorseGameCheck*)DynaPoly_GetActor(&globalCtx->colCtx, horse->unk_24C);
if ((this->unk_164 & 0x80) && (horseGameCheck != NULL) &&
(horseGameCheck->dyna.actor.id == ACTOR_EN_HORSE_GAME_CHECK) &&
(horseGameCheck->unk_15C == ENHORSEGAMECHECK_FF_7) && !(this->unk_164 & 0x800)) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x800;
gSaveContext.unk_3DD0[4] = 6;
SET_RACE_FLAGS(RACE_FLAG_2)
this->unk_174 = 60;
}
return true;
}
s32 func_808F96E4(EnHorseGameCheck* this, GlobalContext* globalCtx) {
s32 pad[3];
CollisionHeader* sp78 = NULL;
MtxF sp38;
this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = this->unk_160 * 0.01f;
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&ovl_En_Horse_Game_Check_Colheader_0010C8, &sp78);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp78);
this->unk_15C = ENHORSEGAMECHECK_FF_7;
this->dyna.actor.floorPoly = NULL;
this->dyna.actor.world.pos.y += 100.0f;
this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor2(
globalCtx, &globalCtx->colCtx, &this->dyna.actor.floorPoly, &this->dyna.actor.world.pos);
this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight + 1.0f;
func_800C0094(this->dyna.actor.floorPoly, this->dyna.actor.world.pos.x, this->dyna.actor.floorHeight,
this->dyna.actor.world.pos.z, &sp38);
Matrix_SetCurrentState(&sp38);
Matrix_RotateY(this->dyna.actor.shape.rot.y, MTXMODE_APPLY);
Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.y, MTXMODE_APPLY);
Matrix_CopyCurrentState(&sp38);
func_8018219C(&sp38, &this->dyna.actor.shape.rot, 1);
this->dyna.actor.world.rot = this->dyna.actor.shape.rot;
return true;
}
s32 func_808F9830(EnHorseGameCheck* this, GlobalContext* globalCtx) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
return true;
}
s32 func_808F9868(EnHorseGameCheck* this, GlobalContext* globalCtx) {
return true;
}
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneScale, 2400, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_STOP),
};
#endif
s32 func_808F987C(EnHorseGameCheck* this, GlobalContext* globalCtx) {
s32 pad[3];
CollisionHeader* sp28 = NULL;
s32 pad2;
extern InitChainEntry D_808F9BDC[];
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->dyna.actor.scale.z = 1.0f;
this->dyna.actor.scale.y = 1.0f;
this->dyna.actor.scale.x = 1.0f;
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&object_horse_game_check_Colheader_002FB8, &sp28);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp28);
this->unk_15C = ENHORSEGAMECHECK_FF_8;
return true;
}
extern UNK_TYPE D_060014B0;
extern UNK_TYPE D_06002FB8;
extern UNK_TYPE D_06003030;
extern UNK_TYPE D_06003918;
s32 func_808F990C(EnHorseGameCheck* this, GlobalContext* globalCtx) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F8AA0.s")
s32 func_808F9944(EnHorseGameCheck* this, GlobalContext* globalCtx) {
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F8C24.s")
s32 func_808F9958(EnHorseGameCheck* this, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, object_horse_game_check_DL_0014B0);
Gfx_DrawDListOpa(globalCtx, object_horse_game_check_DL_0013A0);
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F8C5C.s")
s32 func_808F999C(EnHorseGameCheck* this, GlobalContext* globalCtx) {
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F8C70.s")
s32 func_808F99B0(EnHorseGameCheck* this, GlobalContext* globalCtx) {
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F8CCC.s")
s32 func_808F99C4(EnHorseGameCheck* this, GlobalContext* globalCtx) {
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F8E94.s")
s32 func_808F99D8(EnHorseGameCheck* this, GlobalContext* globalCtx) {
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F8EB0.s")
EnHorseGameCheckUnkFunc D_808F9BE4[] = {
NULL, NULL, NULL, NULL, NULL, func_808F8AA0, func_808F8CCC, func_808F96E4, func_808F987C, func_808F999C,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F8FAC.s")
EnHorseGameCheckUnkFunc D_808F9C0C[] = {
NULL, NULL, NULL, NULL, NULL, func_808F8C24, func_808F8E94, func_808F9830, func_808F990C, func_808F99B0,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F96E4.s")
EnHorseGameCheckUnkFunc D_808F9C34[] = {
NULL, NULL, NULL, NULL, NULL, func_808F8C5C, func_808F8FAC, func_808F9868, func_808F9944, func_808F99C4,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F9830.s")
EnHorseGameCheckUnkFunc D_808F9C5C[] = {
NULL, NULL, NULL, NULL, NULL, func_808F8C70, NULL, NULL, func_808F9958, func_808F99D8,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F9868.s")
void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx) {
EnHorseGameCheck* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F987C.s")
this->unk_15C = ENHORSEGAMECHECK_GET_FF(&this->dyna.actor);
this->unk_160 = ENHORSEGAMECHECK_GET_FF00(&this->dyna.actor);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F990C.s")
if (this->unk_15C >= ENHORSEGAMECHECK_FF_MAX) {
this->unk_15C = ENHORSEGAMECHECK_FF_0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F9944.s")
if (D_808F9BE4[this->unk_15C] != NULL) {
D_808F9BE4[this->unk_15C](this, globalCtx);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F9958.s")
void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnHorseGameCheck* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F999C.s")
if (D_808F9C0C[this->unk_15C] != NULL) {
D_808F9C0C[this->unk_15C](this, globalCtx);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F99B0.s")
void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx) {
EnHorseGameCheck* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F99C4.s")
if (D_808F9C34[this->unk_15C] != NULL) {
D_808F9C34[this->unk_15C](this, globalCtx);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/func_808F99D8.s")
void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnHorseGameCheck* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/EnHorseGameCheck_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/EnHorseGameCheck_Destroy.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/EnHorseGameCheck_Update.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Horse_Game_Check/EnHorseGameCheck_Draw.s")
if (D_808F9C5C[this->unk_15C] != NULL) {
D_808F9C5C[this->unk_15C](this, globalCtx);
}
}
@@ -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;