mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 06:10:21 +00:00
En_Horse_Game_Check (#619)
* stuff * name functions * whoops * horse head * matched and documented * merge actor * relocs Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
parent
20c1f4e648
commit
6f6270100b
24 changed files with 485 additions and 1154 deletions
|
@ -18,7 +18,11 @@ typedef struct EnHorse {
|
|||
/* 0x0214 */ f32 unk_214;
|
||||
/* 0x0218 */ char unk_218[0x040];
|
||||
/* 0x0258 */ Vec3f unk_258;
|
||||
/* 0x0264 */ char unk_264[0x198];
|
||||
/* 0x0264 */ char unk_264[0x124];
|
||||
/* 0x0388 */ s32 unk_388;
|
||||
/* 0x038C */ char unk_38C[0x14];
|
||||
/* 0x03A0 */ s32 unk_3A0;
|
||||
/* 0x03A4 */ char unk_3A4[0x58];
|
||||
} EnHorse; // size = 0x03FC
|
||||
|
||||
#define EN_HORSE_CHECK_1(horseActor) \
|
||||
|
|
|
@ -5,17 +5,50 @@
|
|||
*/
|
||||
|
||||
#include "z_en_horse_game_check.h"
|
||||
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
|
||||
|
||||
#define FLAGS 0x00000010
|
||||
|
||||
#define THIS ((EnHorseGameCheck*)thisx)
|
||||
#define THIS ((EnHorseGameCheckBase*)thisx)
|
||||
#define AT_FINISH_LINE(actor) \
|
||||
(Math3D_PointInSquare2D(sFinishLine[0], sFinishLine[1], sFinishLine[2], sFinishLine[3], (actor)->world.pos.x, \
|
||||
(actor)->world.pos.z))
|
||||
#define AT_RANCH_EXIT(actor) \
|
||||
(Math3D_PointInSquare2D(sRanchExit[0], sRanchExit[1], sRanchExit[2], sRanchExit[3], (actor)->world.pos.x, \
|
||||
(actor)->world.pos.z))
|
||||
|
||||
#define INGORACE_PLAYER_MOVE (1 << 0)
|
||||
#define INGORACE_SET_TIMER (1 << 1)
|
||||
#define INGORACE_INGO_MOVE (1 << 2)
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ INGORACE_NO_RESULT,
|
||||
/* 1 */ INGORACE_PLAYER_WIN,
|
||||
/* 2 */ INGORACE_INGO_WIN,
|
||||
/* 3 */ INGORACE_TIME_UP
|
||||
} HorseGameIngoRaceResult;
|
||||
|
||||
#define MALONRACE_PLAYER_MOVE (1 << 0)
|
||||
#define MALONRACE_SET_TIMER (1 << 1)
|
||||
#define MALONRACE_SECOND_LAP (1 << 2)
|
||||
#define MALONRACE_BROKE_RULE (1 << 3)
|
||||
#define MALONRACE_START_SFX (1 << 4)
|
||||
#define MALONRACE_PLAYER_START (1 << 5)
|
||||
#define MALONRACE_PLAYER_ON_MARK (1 << 6)
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ MALONRACE_NO_RESULT,
|
||||
/* 1 */ MALONRACE_SUCCESS,
|
||||
/* 2 */ MALONRACE_TIME_UP,
|
||||
/* 3 */ MALONRACE_UNUSED,
|
||||
/* 4 */ MALONRACE_FAILURE
|
||||
} HorseGameMalonRaceResult;
|
||||
|
||||
void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
const ActorInit En_Horse_Game_Check_InitVars = {
|
||||
ACTOR_EN_HORSE_GAME_CHECK,
|
||||
ACTORCAT_BG,
|
||||
|
@ -27,39 +60,410 @@ const ActorInit En_Horse_Game_Check_InitVars = {
|
|||
(ActorFunc)EnHorseGameCheck_Update,
|
||||
(ActorFunc)EnHorseGameCheck_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67550.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67608.s")
|
||||
static Vec3f sIngoRaceCheckpoints[] = {
|
||||
{ 1700.0f, 1.0f, -540.0f },
|
||||
{ 117.0f, 1.0f, 488.0f },
|
||||
{ -1700.0f, 1.0f, -540.0f },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67618.s")
|
||||
static f32 sFinishLine[4] = { -200.0f, 80.0f, -2300.0f, -1470.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67764.s")
|
||||
static f32 sRanchExit[4] = { 800.0f, 1000.0f, -2900.0f, -2700.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67BDC.s")
|
||||
static Vec3f sUnusedZeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67BF8.s")
|
||||
static Vec3f sFencePos[] = {
|
||||
{ 820.0f, -44.0f, -1655.0f }, { 1497.0f, -21.0f, -1198.0f }, { 1655.0f, -44.0f, -396.0f },
|
||||
{ 1291.0f, -44.0f, 205.0f }, { 379.0f, -21.0f, 455.0f }, { -95.0f, -21.0f, 455.0f },
|
||||
{ -939.0f, 1.0f, 455.0f }, { -1644.0f, -21.0f, -1035.0f },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67C08.s")
|
||||
s32 EnHorseGameCheck_InitIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
EnHorseGameCheckIngoRace* this = (EnHorseGameCheckIngoRace*)base;
|
||||
s32 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67C50.s")
|
||||
this->base.type = HORSEGAME_INGO_RACE;
|
||||
this->startFlags = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
this->playerCheck[i] = 0;
|
||||
}
|
||||
this->ingoHorse =
|
||||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, -250.0f, 1.0f, -1650.0f, 0, 0x4000, 0, 0x8003);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67C68.s")
|
||||
if (this->ingoHorse == NULL) {
|
||||
LogUtils_HungupThread("../z_en_horse_game_check.c", 385);
|
||||
}
|
||||
this->startTimer = 0;
|
||||
this->finishTimer = 0;
|
||||
this->result = INGORACE_NO_RESULT;
|
||||
this->playerFinish = 0;
|
||||
this->ingoFinish = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67C78.s")
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67C88.s")
|
||||
s32 EnHorseGameCheck_DestroyIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67CD4.s")
|
||||
void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, GlobalContext* globalCtx) {
|
||||
gSaveContext.cutsceneIndex = 0;
|
||||
if (this->result == INGORACE_PLAYER_WIN) {
|
||||
globalCtx->nextEntranceIndex = 0x4CE;
|
||||
if (gSaveContext.eventInf[0] & 0x40) {
|
||||
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 6;
|
||||
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000;
|
||||
globalCtx->fadeTransition = 3;
|
||||
func_800775F0(0x42);
|
||||
} else {
|
||||
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 4;
|
||||
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000;
|
||||
func_800775F0(0x42);
|
||||
globalCtx->fadeTransition = 0x2E;
|
||||
}
|
||||
} else {
|
||||
globalCtx->nextEntranceIndex = 0x558;
|
||||
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 3;
|
||||
globalCtx->fadeTransition = 0x20;
|
||||
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x8000) | 0x8000;
|
||||
}
|
||||
DREG(25) = 0;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
gSaveContext.timer1State = 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67CE4.s")
|
||||
s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
EnHorseGameCheckIngoRace* this = (EnHorseGameCheckIngoRace*)base;
|
||||
Player* player = PLAYER;
|
||||
s32 i;
|
||||
EnHorse* ingoHorse;
|
||||
EnHorse* horse;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/func_80A67DFC.s")
|
||||
if ((this->startTimer > 50) && !(this->startFlags & INGORACE_SET_TIMER)) {
|
||||
this->startFlags |= INGORACE_SET_TIMER;
|
||||
func_80088B34(0);
|
||||
} else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->startFlags & INGORACE_PLAYER_MOVE)) {
|
||||
this->startFlags |= INGORACE_PLAYER_MOVE;
|
||||
horse = (EnHorse*)player->rideActor;
|
||||
horse->unk_388 = 1;
|
||||
} else if ((this->startTimer > 81) && !(this->startFlags & INGORACE_INGO_MOVE)) {
|
||||
ingoHorse = (EnHorse*)this->ingoHorse;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/EnHorseGameCheck_Init.s")
|
||||
ingoHorse->unk_388 = 1;
|
||||
this->startFlags |= INGORACE_INGO_MOVE;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_START_SHOT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/EnHorseGameCheck_Destroy.s")
|
||||
this->startTimer++;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/EnHorseGameCheck_Update.s")
|
||||
for (i = 0; i < 3; i++) {
|
||||
if ((player->rideActor != NULL) &&
|
||||
(Math3D_Vec3f_DistXYZ(&sIngoRaceCheckpoints[i], &player->rideActor->world.pos) < 400.0f)) {
|
||||
if ((i > 0) && (this->playerCheck[i - 1] == 1)) {
|
||||
this->playerCheck[i] = 1;
|
||||
} else if (i == 0) {
|
||||
this->playerCheck[i] = 1;
|
||||
}
|
||||
}
|
||||
if (Math3D_Vec3f_DistXYZ(&sIngoRaceCheckpoints[i], &this->ingoHorse->world.pos) < 400.0f) {
|
||||
if ((i > 0) && (this->ingoCheck[i - 1] == 1)) {
|
||||
this->ingoCheck[i] = 1;
|
||||
} else if (i == 0) {
|
||||
this->ingoCheck[i] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Horse_Game_Check/EnHorseGameCheck_Draw.s")
|
||||
if (this->result == INGORACE_NO_RESULT) {
|
||||
Player* player2 = player;
|
||||
|
||||
if ((player2->rideActor != NULL) && (this->playerCheck[2] == 1) && AT_FINISH_LINE(player2->rideActor)) {
|
||||
this->playerFinish++;
|
||||
if (this->playerFinish > 0) {
|
||||
this->result = INGORACE_PLAYER_WIN;
|
||||
this->finishTimer = 55;
|
||||
Audio_SetBGM(0x41);
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_START_SHOT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
for (i = 0; i < 3; i++) {
|
||||
this->playerCheck[i] = 0;
|
||||
}
|
||||
}
|
||||
if ((this->ingoHorse != NULL) && (this->ingoCheck[2] == 1) && AT_FINISH_LINE(this->ingoHorse)) {
|
||||
this->ingoFinish++;
|
||||
if (this->ingoFinish > 0) {
|
||||
ingoHorse = (EnHorse*)this->ingoHorse;
|
||||
|
||||
this->result = INGORACE_INGO_WIN;
|
||||
this->finishTimer = 70;
|
||||
ingoHorse->unk_1F0 |= 0x800000;
|
||||
Audio_SetBGM(0x41);
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_START_SHOT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
for (i = 0; i < 3; i++) {
|
||||
this->ingoCheck[i] = 0;
|
||||
}
|
||||
}
|
||||
if (((player2->rideActor != NULL) && AT_RANCH_EXIT(player2->rideActor)) || AT_RANCH_EXIT(&player2->actor)) {
|
||||
Audio_SetBGM(0x41);
|
||||
this->result = INGORACE_INGO_WIN;
|
||||
this->finishTimer = 20;
|
||||
}
|
||||
if ((gSaveContext.timer1Value >= 180) && (this->startFlags & 2)) {
|
||||
Audio_SetBGM(0x41);
|
||||
this->result = INGORACE_TIME_UP;
|
||||
this->finishTimer = 20;
|
||||
}
|
||||
} else {
|
||||
if (this->finishTimer > 0) {
|
||||
this->finishTimer--;
|
||||
} else {
|
||||
EnHorseGameCheck_FinishIngoRace(this, globalCtx);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_InitGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
EnHorseGameCheckGerudoArchery* this = (EnHorseGameCheckGerudoArchery*)base;
|
||||
|
||||
this->base.type = HORSEGAME_GERUDO_ARCHERY;
|
||||
this->unk_150 = 0;
|
||||
this->startTimer = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_DestroyGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_UpdateGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
EnHorseGameCheckGerudoArchery* this = (EnHorseGameCheckGerudoArchery*)base;
|
||||
Player* player = PLAYER;
|
||||
EnHorse* horse = (EnHorse*)player->rideActor;
|
||||
|
||||
if (horse == NULL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this->startTimer > 90) {
|
||||
if (globalCtx) {}
|
||||
horse->unk_3A0 = 1;
|
||||
}
|
||||
this->startTimer++;
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_InitType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
EnHorseGameCheck3* this = (EnHorseGameCheck3*)base;
|
||||
|
||||
this->base.type = HORSEGAME_TYPE3;
|
||||
this->unk_150 = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_DestroyType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_UpdateType3(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_InitMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
EnHorseGameCheckMalonRace* this = (EnHorseGameCheckMalonRace*)base;
|
||||
s32 i;
|
||||
|
||||
this->base.type = HORSEGAME_MALON_RACE;
|
||||
this->raceFlags = 0;
|
||||
this->finishTimer = 0;
|
||||
this->result = MALONRACE_NO_RESULT;
|
||||
for (i = 0; i < 16; i++) {
|
||||
this->fenceCheck[i] = 0;
|
||||
}
|
||||
this->lapCount = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_DestroyMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, GlobalContext* globalCtx) {
|
||||
if ((this->result == MALONRACE_SUCCESS) || (this->result == MALONRACE_TIME_UP)) {
|
||||
gSaveContext.cutsceneIndex = 0;
|
||||
globalCtx->nextEntranceIndex = 0x4CE;
|
||||
globalCtx->fadeTransition = 0x2E;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
} else if (this->result == MALONRACE_FAILURE) {
|
||||
gSaveContext.timer1Value = 240;
|
||||
gSaveContext.timer1State = 0xF;
|
||||
gSaveContext.cutsceneIndex = 0;
|
||||
globalCtx->nextEntranceIndex = 0x4CE;
|
||||
globalCtx->fadeTransition = 0x2E;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
} else {
|
||||
// not supported
|
||||
osSyncPrintf("En_HGC_Spot20_Ta_end():対応せず\n");
|
||||
gSaveContext.cutsceneIndex = 0;
|
||||
globalCtx->nextEntranceIndex = 0x157;
|
||||
globalCtx->fadeTransition = 0x2E;
|
||||
globalCtx->sceneLoadFlag = 0x14;
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) {
|
||||
EnHorseGameCheckMalonRace* this = (EnHorseGameCheckMalonRace*)base;
|
||||
s32 i;
|
||||
Player* player = PLAYER;
|
||||
EnHorse* horse;
|
||||
|
||||
if (!(this->raceFlags & MALONRACE_PLAYER_ON_MARK) && AT_FINISH_LINE(player->rideActor)) {
|
||||
this->raceFlags |= MALONRACE_PLAYER_ON_MARK;
|
||||
} else if ((this->raceFlags & MALONRACE_PLAYER_ON_MARK) && !(this->raceFlags & MALONRACE_PLAYER_START) && !AT_FINISH_LINE(player->rideActor)) {
|
||||
this->raceFlags |= MALONRACE_PLAYER_START;
|
||||
}
|
||||
if ((this->startTimer > 50) && !(this->raceFlags & MALONRACE_SET_TIMER)) {
|
||||
this->raceFlags |= MALONRACE_SET_TIMER;
|
||||
func_80088B34(0);
|
||||
} else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->raceFlags & MALONRACE_PLAYER_MOVE)) {
|
||||
this->raceFlags |= MALONRACE_PLAYER_MOVE;
|
||||
horse = (EnHorse*)player->rideActor;
|
||||
|
||||
horse->unk_388 = 1;
|
||||
} else if ((this->startTimer > 81) && !(this->raceFlags & MALONRACE_START_SFX)) {
|
||||
this->raceFlags |= MALONRACE_START_SFX;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_START_SHOT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
|
||||
this->startTimer++;
|
||||
if (this->result == MALONRACE_NO_RESULT) {
|
||||
Player* player2 = player;
|
||||
f32 dist;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
if ((this->lapCount == 0) && (i >= 8)) {
|
||||
break;
|
||||
}
|
||||
dist = Math_Vec3f_DistXZ(&sFencePos[i % 8], &player2->rideActor->world.pos);
|
||||
if ((player->rideActor != NULL) && (dist < 250.0f)) {
|
||||
horse = (EnHorse*)player2->rideActor;
|
||||
|
||||
if (horse->unk_1F0 & 4) {
|
||||
if ((i > 0) && (this->fenceCheck[i - 1] == 1)) {
|
||||
this->fenceCheck[i] = 1;
|
||||
} else if (i == 0) {
|
||||
this->fenceCheck[i] = 1;
|
||||
}
|
||||
|
||||
if ((this->fenceCheck[i - 1] == 0) && !(this->raceFlags & MALONRACE_BROKE_RULE)) {
|
||||
this->raceFlags |= MALONRACE_BROKE_RULE;
|
||||
func_8010B680(globalCtx, 0x208C, NULL);
|
||||
this->result = 4;
|
||||
this->finishTimer = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((player2->rideActor != NULL) && (this->raceFlags & MALONRACE_PLAYER_START) && AT_FINISH_LINE(player2->rideActor)) {
|
||||
if ((this->lapCount == 1) && (this->fenceCheck[15] == 0) && (player2->rideActor->prevPos.x < -200.0f)) {
|
||||
this->raceFlags |= MALONRACE_BROKE_RULE;
|
||||
func_8010B680(globalCtx, 0x208C, NULL);
|
||||
this->result = MALONRACE_FAILURE;
|
||||
this->finishTimer = 30;
|
||||
} else if (this->fenceCheck[15] == 1) {
|
||||
this->lapCount = 2;
|
||||
Audio_SetBGM(0x41);
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_START_SHOT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
this->result = MALONRACE_SUCCESS;
|
||||
this->finishTimer = 70;
|
||||
gSaveContext.timer1State = 0xF;
|
||||
} else if ((this->fenceCheck[7] == 1) && !(this->raceFlags & MALONRACE_SECOND_LAP)) {
|
||||
this->lapCount = 1;
|
||||
this->raceFlags |= MALONRACE_SECOND_LAP;
|
||||
func_8010B680(globalCtx, 0x208D, NULL);
|
||||
} else if (this->fenceCheck[7] == 0) {
|
||||
this->raceFlags |= MALONRACE_BROKE_RULE;
|
||||
func_8010B680(globalCtx, 0x208C, NULL);
|
||||
this->result = MALONRACE_FAILURE;
|
||||
this->finishTimer = 30;
|
||||
} else if (player2->rideActor->prevPos.x > 80.0f) {
|
||||
this->raceFlags |= MALONRACE_BROKE_RULE;
|
||||
func_8010B680(globalCtx, 0x208C, NULL);
|
||||
this->result = MALONRACE_FAILURE;
|
||||
this->finishTimer = 30;
|
||||
}
|
||||
}
|
||||
if ((gSaveContext.timer1Value >= 180) && (this->raceFlags & MALONRACE_SET_TIMER)) {
|
||||
gSaveContext.timer1Value = 240;
|
||||
this->result = MALONRACE_TIME_UP;
|
||||
this->finishTimer = 30;
|
||||
gSaveContext.timer1State = 0;
|
||||
}
|
||||
} else {
|
||||
if (this->finishTimer > 0) {
|
||||
this->finishTimer--;
|
||||
} else {
|
||||
EnHorseGameCheck_FinishMalonRace(this, globalCtx);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static EnHorseGameCheckFunc sInitFuncs[] = {
|
||||
NULL,
|
||||
EnHorseGameCheck_InitIngoRace,
|
||||
EnHorseGameCheck_InitGerudoArchery,
|
||||
EnHorseGameCheck_InitType3,
|
||||
EnHorseGameCheck_InitMalonRace,
|
||||
};
|
||||
|
||||
static EnHorseGameCheckFunc sDestroyFuncs[] = {
|
||||
NULL,
|
||||
EnHorseGameCheck_DestroyIngoRace,
|
||||
EnHorseGameCheck_DestroyGerudoArchery,
|
||||
EnHorseGameCheck_DestroyType3,
|
||||
EnHorseGameCheck_DestroyMalonRace,
|
||||
};
|
||||
|
||||
static EnHorseGameCheckFunc sUpdateFuncs[] = {
|
||||
NULL,
|
||||
EnHorseGameCheck_UpdateIngoRace,
|
||||
EnHorseGameCheck_UpdateGerudoArchery,
|
||||
EnHorseGameCheck_UpdateType3,
|
||||
EnHorseGameCheck_UpdateMalonRace,
|
||||
};
|
||||
|
||||
void EnHorseGameCheck_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnHorseGameCheckBase* this = THIS;
|
||||
|
||||
if ((globalCtx->sceneNum == SCENE_SPOT20) && (Flags_GetEventChkInf(0x18) || DREG(1))) {
|
||||
this->actor.params = HORSEGAME_MALON_RACE;
|
||||
}
|
||||
if (sInitFuncs[this->actor.params] != NULL) {
|
||||
sInitFuncs[this->actor.params](this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void EnHorseGameCheck_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnHorseGameCheckBase* this = THIS;
|
||||
|
||||
if (sDestroyFuncs[this->actor.params] != NULL) {
|
||||
sDestroyFuncs[this->actor.params](this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void EnHorseGameCheck_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnHorseGameCheckBase* this = THIS;
|
||||
|
||||
if (sUpdateFuncs[this->type] != NULL) {
|
||||
sUpdateFuncs[this->type](this, globalCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void EnHorseGameCheck_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
|
|
@ -4,13 +4,64 @@
|
|||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
|
||||
struct EnHorseGameCheck;
|
||||
struct EnHorseGameCheckBase;
|
||||
|
||||
typedef struct EnHorseGameCheck {
|
||||
typedef s32 (*EnHorseGameCheckFunc)(struct EnHorseGameCheckBase* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef struct EnHorseGameCheckBase {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x58];
|
||||
/* 0x014C */ s32 type;
|
||||
} EnHorseGameCheckBase; // size = 0x0150
|
||||
|
||||
typedef struct EnHorseGameCheckIngoRace {
|
||||
/* 0x0000 */ EnHorseGameCheckBase base;
|
||||
/* 0x0150 */ s32 startFlags;
|
||||
/* 0x0154 */ s32 playerCheck[3];
|
||||
/* 0x0160 */ s32 ingoCheck[3];
|
||||
/* 0x016C */ Actor* ingoHorse;
|
||||
/* 0x0170 */ s32 startTimer;
|
||||
/* 0x0174 */ s32 result;
|
||||
/* 0x0178 */ s32 finishTimer;
|
||||
/* 0x017C */ s32 playerFinish;
|
||||
/* 0x0180 */ s32 ingoFinish;
|
||||
} EnHorseGameCheckIngoRace; // size = 0x0184
|
||||
|
||||
typedef struct EnHorseGameCheckGerudoArchery {
|
||||
/* 0x0000 */ EnHorseGameCheckBase base;
|
||||
/* 0x0150 */ s32 unk_150;
|
||||
/* 0x0154 */ u32 startTimer;
|
||||
} EnHorseGameCheckGerudoArchery; // size = 0x0158
|
||||
|
||||
typedef struct EnHorseGameCheck3 {
|
||||
/* 0x0000 */ EnHorseGameCheckBase base;
|
||||
/* 0x0150 */ s32 unk_150;
|
||||
} EnHorseGameCheck3; // size = 0x0154
|
||||
|
||||
typedef struct EnHorseGameCheckMalonRace {
|
||||
/* 0x0000 */ EnHorseGameCheckBase base;
|
||||
/* 0x0150 */ s32 startTimer;
|
||||
/* 0x0154 */ s32 raceFlags;
|
||||
/* 0x0158 */ s32 fenceCheck[16];
|
||||
/* 0x0198 */ s32 finishTimer;
|
||||
/* 0x019C */ s32 result;
|
||||
/* 0x01A0 */ s32 lapCount;
|
||||
} EnHorseGameCheckMalonRace; // size = 0x01A4
|
||||
|
||||
typedef union EnHorseGameCheck {
|
||||
EnHorseGameCheckIngoRace ingo;
|
||||
EnHorseGameCheckGerudoArchery gerudo;
|
||||
EnHorseGameCheck3 type3;
|
||||
EnHorseGameCheckMalonRace malon;
|
||||
} EnHorseGameCheck; // size = 0x01A4
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ HORSEGAME_NONE,
|
||||
/* 1 */ HORSEGAME_INGO_RACE,
|
||||
/* 2 */ HORSEGAME_GERUDO_ARCHERY,
|
||||
/* 3 */ HORSEGAME_TYPE3,
|
||||
/* 4 */ HORSEGAME_MALON_RACE
|
||||
} EnHorseGameCheckType;
|
||||
|
||||
extern const ActorInit En_Horse_Game_Check_InitVars;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue