|
|
|
@@ -5,6 +5,7 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "z_bg_umajump.h"
|
|
|
|
|
#include "assets/objects/object_umajump/object_umajump.h"
|
|
|
|
|
|
|
|
|
|
#define FLAGS 0x00000000
|
|
|
|
|
|
|
|
|
@@ -13,8 +14,10 @@
|
|
|
|
|
void BgUmajump_Init(Actor* thisx, PlayState* play);
|
|
|
|
|
void BgUmajump_Destroy(Actor* thisx, PlayState* play);
|
|
|
|
|
void BgUmajump_Update(Actor* thisx, PlayState* play);
|
|
|
|
|
void BgUmajump_Draw(Actor* thisx, PlayState* play);
|
|
|
|
|
|
|
|
|
|
void func_8091A5A0(Actor* thisx, PlayState* play);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
const ActorInit Bg_Umajump_InitVars = {
|
|
|
|
|
ACTOR_BG_UMAJUMP,
|
|
|
|
|
ACTORCAT_PROP,
|
|
|
|
@@ -27,34 +30,190 @@ const ActorInit Bg_Umajump_InitVars = {
|
|
|
|
|
(ActorFunc)NULL,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// static InitChainEntry sInitChain[] = {
|
|
|
|
|
static InitChainEntry D_8091A810[] = {
|
|
|
|
|
static InitChainEntry sInitChain[] = {
|
|
|
|
|
ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_CONTINUE),
|
|
|
|
|
ICHAIN_F32(uncullZoneDownward, 300, ICHAIN_CONTINUE),
|
|
|
|
|
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
void func_80919F30(BgUmajump* this, PlayState* play) {
|
|
|
|
|
if (this->rotationTimer >= 90) {
|
|
|
|
|
this->rotationTimer = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern InitChainEntry D_8091A810[];
|
|
|
|
|
this->rotationTimer++;
|
|
|
|
|
this->dyna.actor.shape.yOffset =
|
|
|
|
|
Math_SinS((this->rotationTimer / 90.0f) * 0x10000) * (20.0f / this->dyna.actor.scale.y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern UNK_TYPE D_06001220;
|
|
|
|
|
extern UNK_TYPE D_06001558;
|
|
|
|
|
void BgUmajump_StopCutscene(BgUmajump* this, PlayState* play) {
|
|
|
|
|
if ((play->csCtx.frames >= 6) && !this->hasSoundPlayed) {
|
|
|
|
|
this->hasSoundPlayed = true;
|
|
|
|
|
play_sound(NA_SE_EV_KID_HORSE_NEIGH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/func_80919F30.s")
|
|
|
|
|
if (play->csCtx.state == CS_STATE_0) {
|
|
|
|
|
ActorCutscene_Stop(this->dyna.actor.cutscene);
|
|
|
|
|
this->dyna.actor.update = Actor_Noop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/func_80919FC8.s")
|
|
|
|
|
void BgUmajump_PlayCutscene(BgUmajump* this, PlayState* play) {
|
|
|
|
|
if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) {
|
|
|
|
|
ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor);
|
|
|
|
|
gSaveContext.save.weekEventReg[89] |= 0x20;
|
|
|
|
|
this->actionFunc = BgUmajump_StopCutscene;
|
|
|
|
|
} else {
|
|
|
|
|
ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/func_8091A044.s")
|
|
|
|
|
void BgUmajump_CheckDistance(BgUmajump* this, PlayState* play) {
|
|
|
|
|
Player* player = GET_PLAYER(play);
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/func_8091A0B8.s")
|
|
|
|
|
if ((this->horse != NULL) && (player != NULL) &&
|
|
|
|
|
(Math3D_XZDistance(this->horse->world.pos.x, this->horse->world.pos.z, player->actor.world.pos.x,
|
|
|
|
|
player->actor.world.pos.z) < 1400.0f)) {
|
|
|
|
|
this->actionFunc = BgUmajump_PlayCutscene;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/BgUmajump_Init.s")
|
|
|
|
|
void BgUmajump_Init(Actor* thisx, PlayState* play) {
|
|
|
|
|
BgUmajump* this = THIS;
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/BgUmajump_Destroy.s")
|
|
|
|
|
Actor_ProcessInitChain(thisx, sInitChain);
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/BgUmajump_Update.s")
|
|
|
|
|
this->actionFunc = NULL;
|
|
|
|
|
this->horse = NULL;
|
|
|
|
|
this->hasSoundPlayed = false;
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/func_8091A5A0.s")
|
|
|
|
|
DynaPolyActor_Init(&this->dyna, 0);
|
|
|
|
|
|
|
|
|
|
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Umajump/func_8091A7B0.s")
|
|
|
|
|
this->objectIndex = BG_UMAJUMP_GET_OBJECT_INDEX(thisx);
|
|
|
|
|
thisx->params = BG_UMAJUMP_GET_FF(thisx);
|
|
|
|
|
|
|
|
|
|
if ((thisx->params == BG_UMAJUMP_TYPE_2)) {
|
|
|
|
|
if ((((play->sceneId == SCENE_F01) && !(gSaveContext.save.weekEventReg[89] & 0x20)) &&
|
|
|
|
|
!CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) &&
|
|
|
|
|
(thisx->cutscene != -1)) {
|
|
|
|
|
this->actionFunc = BgUmajump_CheckDistance;
|
|
|
|
|
thisx->update = func_8091A5A0;
|
|
|
|
|
thisx->flags |= ACTOR_FLAG_10;
|
|
|
|
|
this->horse = SubS_FindActor(play, this->horse, ACTORCAT_BG, ACTOR_EN_HORSE);
|
|
|
|
|
} else {
|
|
|
|
|
thisx->update = Actor_Noop;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this->objectIndex = Object_GetIndex(&play->objectCtx, OBJECT_UMAJUMP);
|
|
|
|
|
|
|
|
|
|
if (this->objectIndex < 0) {
|
|
|
|
|
Actor_MarkForDeath(thisx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((thisx->params == BG_UMAJUMP_TYPE_3) && CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
|
|
|
|
|
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_KANBAN, thisx->world.pos.x, thisx->world.pos.y,
|
|
|
|
|
thisx->world.pos.z, thisx->shape.rot.x, thisx->shape.rot.y, thisx->shape.rot.z, 0x3E);
|
|
|
|
|
Actor_MarkForDeath(thisx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BgUmajump_Destroy(Actor* thisx, PlayState* play) {
|
|
|
|
|
BgUmajump* this = THIS;
|
|
|
|
|
|
|
|
|
|
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BgUmajump_Update(Actor* thisx, PlayState* play) {
|
|
|
|
|
BgUmajump* this = THIS;
|
|
|
|
|
|
|
|
|
|
if (Object_IsLoaded(&play->objectCtx, this->objectIndex)) {
|
|
|
|
|
this->dyna.actor.objBankIndex = this->objectIndex;
|
|
|
|
|
this->dyna.actor.draw = BgUmajump_Draw;
|
|
|
|
|
|
|
|
|
|
Actor_SetObjectDependency(play, &this->dyna.actor);
|
|
|
|
|
|
|
|
|
|
if (this->dyna.actor.params == BG_UMAJUMP_TYPE_5) {
|
|
|
|
|
if (gSaveContext.save.weekEventReg[22] & 1) {
|
|
|
|
|
DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558);
|
|
|
|
|
}
|
|
|
|
|
} else if (this->dyna.actor.params == BG_UMAJUMP_TYPE_6) {
|
|
|
|
|
if (!(gSaveContext.save.weekEventReg[22] & 1)) {
|
|
|
|
|
DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558);
|
|
|
|
|
}
|
|
|
|
|
} else if ((this->dyna.actor.params == BG_UMAJUMP_TYPE_4) || (this->dyna.actor.params == BG_UMAJUMP_TYPE_3)) {
|
|
|
|
|
DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558);
|
|
|
|
|
} else {
|
|
|
|
|
DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001438);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->dyna.actor.params == BG_UMAJUMP_TYPE_1) {
|
|
|
|
|
this->rotationTimer = 0;
|
|
|
|
|
this->actionFunc = func_80919F30;
|
|
|
|
|
this->dyna.actor.update = func_8091A5A0;
|
|
|
|
|
} else if (this->dyna.actor.params == BG_UMAJUMP_TYPE_3) {
|
|
|
|
|
this->dyna.actor.update = func_8091A5A0;
|
|
|
|
|
} else if ((this->dyna.actor.params == BG_UMAJUMP_TYPE_5) || (this->dyna.actor.params == BG_UMAJUMP_TYPE_6)) {
|
|
|
|
|
if (this->dyna.actor.params == BG_UMAJUMP_TYPE_5) {
|
|
|
|
|
if ((this->dyna.bgId == BGACTOR_NEG_ONE) && (gSaveContext.save.weekEventReg[22] & 1)) {
|
|
|
|
|
DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558);
|
|
|
|
|
}
|
|
|
|
|
} else if ((this->dyna.actor.params == BG_UMAJUMP_TYPE_6) && (this->dyna.bgId == BGACTOR_NEG_ONE) &&
|
|
|
|
|
(!(gSaveContext.save.weekEventReg[22] & 1) ||
|
|
|
|
|
((gSaveContext.save.day == 2) && (gSaveContext.save.isNight == true) &&
|
|
|
|
|
((gSaveContext.save.time >= CLOCK_TIME(5, 30)) &&
|
|
|
|
|
(gSaveContext.save.time <= CLOCK_TIME(6, 0)))))) {
|
|
|
|
|
DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558);
|
|
|
|
|
}
|
|
|
|
|
func_800C641C(play, &play->colCtx.dyna, this->dyna.bgId);
|
|
|
|
|
this->dyna.actor.update = func_8091A5A0;
|
|
|
|
|
} else if (this->dyna.actor.params == BG_UMAJUMP_TYPE_4) {
|
|
|
|
|
func_800C641C(play, &play->colCtx.dyna, this->dyna.bgId);
|
|
|
|
|
this->dyna.actor.update = Actor_Noop;
|
|
|
|
|
} else {
|
|
|
|
|
this->dyna.actor.update = Actor_Noop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void func_8091A5A0(Actor* thisx, PlayState* play) {
|
|
|
|
|
BgUmajump* this = THIS;
|
|
|
|
|
|
|
|
|
|
if (this->actionFunc != NULL) {
|
|
|
|
|
this->actionFunc(this, play);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((this->dyna.actor.params == BG_UMAJUMP_TYPE_3) && CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
|
|
|
|
|
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_KANBAN, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
|
|
|
|
|
this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y,
|
|
|
|
|
this->dyna.actor.shape.rot.z, 0x3E);
|
|
|
|
|
Actor_MarkForDeath(&this->dyna.actor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->dyna.actor.params == BG_UMAJUMP_TYPE_5) {
|
|
|
|
|
if ((this->dyna.bgId == BGACTOR_NEG_ONE) && (gSaveContext.save.weekEventReg[22] & 1)) {
|
|
|
|
|
DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558);
|
|
|
|
|
} else if ((this->dyna.bgId != BGACTOR_NEG_ONE) && !(gSaveContext.save.weekEventReg[22] & 1)) {
|
|
|
|
|
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
|
|
|
|
}
|
|
|
|
|
} else if (this->dyna.actor.params == BG_UMAJUMP_TYPE_6) {
|
|
|
|
|
if ((this->dyna.bgId == BGACTOR_NEG_ONE) &&
|
|
|
|
|
(!(gSaveContext.save.weekEventReg[22] & 1) ||
|
|
|
|
|
((gSaveContext.save.day == 2) && (gSaveContext.save.isNight == true) &&
|
|
|
|
|
(gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= CLOCK_TIME(6, 0))))) {
|
|
|
|
|
DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558);
|
|
|
|
|
} else if ((this->dyna.bgId != BGACTOR_NEG_ONE) && (gSaveContext.save.weekEventReg[22] & 1) &&
|
|
|
|
|
((gSaveContext.save.day != 2) || (gSaveContext.save.isNight != true) ||
|
|
|
|
|
(gSaveContext.save.time < CLOCK_TIME(5, 30)) || (gSaveContext.save.time > CLOCK_TIME(6, 0)))) {
|
|
|
|
|
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BgUmajump_Draw(Actor* thisx, PlayState* play) {
|
|
|
|
|
BgUmajump* this = THIS;
|
|
|
|
|
|
|
|
|
|
if (this->dyna.bgId != BGACTOR_NEG_ONE) {
|
|
|
|
|
Gfx_DrawDListOpa(play, gHorseJumpFenceDL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|