1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-07 06:40:15 +00:00

Merge branch 'master' into skelanime

This commit is contained in:
KrimtonZ 2020-03-25 10:52:04 -05:00
commit 498d19655b
41 changed files with 339 additions and 1011 deletions

View file

@ -1,14 +1,23 @@
/*
* File: z_bg_spot09_obj.c
* Overlay: ovl_Bg_Spot09_Obj
* Description:
*/
#include "z_bg_spot09_obj.h"
#define ROOM 0x00
#define FLAGS 0x00000000
void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx);
void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx);
void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx);
void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx);
static void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx);
static void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx);
static void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx);
static void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx);
static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx);
static s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx);
static s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx);
/*
const ActorInit Bg_Spot09_Obj_InitVars = {
ACTOR_BG_SPOT09_OBJ,
ACTORTYPE_BG,
@ -21,25 +30,155 @@ const ActorInit Bg_Spot09_Obj_InitVars = {
(ActorFunc)BgSpot09Obj_Update,
(ActorFunc)BgSpot09Obj_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1AE0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BA0.s")
static u32 D_808B1F90[] = { 0x00000000, 0x06005520, 0x0600283C, 0x06008458, 0x06007580 };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1BEC.s")
static s32 (*D_808B1FA4[])(BgSpot09Obj* this, GlobalContext* globalCtx) = {
func_808B1BEC,
func_808B1AE0,
func_808B1BA0,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1C70.s")
static InitChainEntry initChain1[] = {
ICHAIN_F32(unk_F4, 7200, ICHAIN_CONTINUE),
ICHAIN_F32(unk_F8, 3000, ICHAIN_CONTINUE),
ICHAIN_F32(unk_FC, 7200, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1CEC.s")
static InitChainEntry initChain2[] = {
ICHAIN_F32(unk_F4, 7200, ICHAIN_CONTINUE),
ICHAIN_F32(unk_F8, 800, ICHAIN_CONTINUE),
ICHAIN_F32(unk_FC, 1500, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D18.s")
static u32 dlists[] = { 0x06000100, 0x06003970, 0x06001120, 0x06007D40, 0x06006210 };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/func_808B1D44.s")
extern UNK_TYPE D_06008010;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Init.s")
static s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) {
s32 carpentersRescued;
Actor* thisx = &this->dyna.actor;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Destroy.s")
if (gSaveContext.scene_setup_index >= 4) {
return thisx->params == 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Update.s")
carpentersRescued = (gSaveContext.event_chk_inf[9] & 0xF) == 0xF;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot09_Obj/BgSpot09Obj_Draw.s")
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
switch (thisx->params) {
case 0:
return 0;
case 1:
return !carpentersRescued;
case 4:
return carpentersRescued;
case 3:
return 1;
}
} else {
return thisx->params == 2;
}
return 0;
}
static s32 func_808B1BA0(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
if (thisx->params == 3) {
Actor_SetScale(thisx, 0.1f);
} else {
Actor_SetScale(thisx, 1.0f);
}
return 1;
}
static s32 func_808B1BEC(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
s32 localC = 0;
s32 pad[2];
if (D_808B1F90[thisx->params] != 0) {
DynaPolyInfo_SetActorMove(thisx, 0);
DynaPolyInfo_Alloc(D_808B1F90[thisx->params], &localC);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localC);
}
return 1;
}
static s32 func_808B1C70(BgSpot09Obj* this, GlobalContext* globalCtx) {
s32 i;
for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) {
if (!D_808B1FA4[i](this, globalCtx)) {
return 0;
}
}
return 1;
}
static s32 func_808B1CEC(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, &initChain1);
return 1;
}
static s32 func_808B1D18(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, &initChain2);
return 1;
}
static s32 func_808B1D44(BgSpot09Obj* this, GlobalContext* globalCtx) {
if (this->dyna.actor.params == 3) {
return func_808B1D18(this, globalCtx);
} else {
return func_808B1CEC(this, globalCtx);
}
}
static void BgSpot09Obj_Init(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", thisx->params,
gSaveContext.event_chk_inf[9] & 0xF);
thisx->params &= 0xFF;
if ((thisx->params < 0) || (thisx->params >= 5)) {
osSyncPrintf("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n",
"../z_bg_spot09_obj.c", 322, thisx->params);
}
if (!func_808B1C70(this, globalCtx)) {
Actor_Kill(thisx);
} else if (!func_808B1D44(this, globalCtx)) {
Actor_Kill(thisx);
}
}
static void BgSpot09Obj_Destroy(BgSpot09Obj* this, GlobalContext* globalCtx) {
DynaCollisionContext* dynaColCtx = &globalCtx->colCtx.dyna;
Actor* thisx = &this->dyna.actor;
if (thisx->params != 0) {
DynaPolyInfo_Free(globalCtx, dynaColCtx, this->dyna.dynaPolyId);
}
}
static void BgSpot09Obj_Update(BgSpot09Obj* this, GlobalContext* globalCtx) {
}
static void BgSpot09Obj_Draw(BgSpot09Obj* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
GraphicsContext* gfxCtx;
Gfx* gfxArr[3];
Draw_DListOpa(globalCtx, dlists[thisx->params]);
if (thisx->params == 3) {
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 388);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 391),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyXlu.p++, &D_06008010);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 396);
}
}

View file

@ -5,8 +5,8 @@
#include <global.h>
typedef struct {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x1C];
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ char unk_164[0x04];
} BgSpot09Obj; // size = 0x0168
extern const ActorInit Bg_Spot09_Obj_InitVars;

View file

@ -1,14 +1,28 @@
/*
* File: z_bg_spot12_gate.c
* Overlay: Bg_Spot12_Gate
* Description:
*/
#include "z_bg_spot12_gate.h"
#define ROOM 0x00
#define FLAGS 0x00000000
void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx);
void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx);
void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx);
void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx);
static void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx);
static void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx);
static void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx);
static void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx);
static void func_808B30C0(BgSpot12Gate* this);
static void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx);
static void func_808B3134(BgSpot12Gate* this);
static void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx);
static void func_808B317C(BgSpot12Gate* this);
static void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx);
static void func_808B3274(BgSpot12Gate* this);
static void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx);
/*
const ActorInit Bg_Spot12_Gate_InitVars = {
ACTOR_BG_SPOT12_GATE,
ACTORTYPE_BG,
@ -21,29 +35,113 @@ const ActorInit Bg_Spot12_Gate_InitVars = {
(ActorFunc)BgSpot12Gate_Update,
(ActorFunc)BgSpot12Gate_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B2F90.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Init.s")
static InitChainEntry initChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
ICHAIN_F32(unk_F4, 2500, ICHAIN_CONTINUE),
ICHAIN_F32(unk_F8, 500, ICHAIN_CONTINUE),
ICHAIN_F32(unk_FC, 1200, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Destroy.s")
extern UNK_TYPE D_06001080;
extern UNK_TYPE D_060011EC;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30C0.s")
static void func_808B2F90(BgSpot12Gate* this, GlobalContext* globalCtx, UNK_TYPE collision, DynaPolyMoveFlag flags) {
Actor* thisx = &this->dyna.actor;
s32 localC = 0;
s32 pad[2];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B30D8.s")
DynaPolyInfo_SetActorMove(thisx, flags);
DynaPolyInfo_Alloc(collision, &localC);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localC);
if (this->dyna.dynaPolyId == 0x32) {
osSyncPrintf("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145,
thisx->id, thisx->params);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3134.s")
static void BgSpot12Gate_Init(BgSpot12Gate* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B314C.s")
func_808B2F90(this, globalCtx, &D_060011EC, 0);
Actor_ProcessInitChain(thisx, initChain);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B317C.s")
if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) {
func_808B3274(this);
} else {
func_808B30C0(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B318C.s")
static void BgSpot12Gate_Destroy(BgSpot12Gate* this, GlobalContext* globalCtx) {
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3274.s")
static void func_808B30C0(BgSpot12Gate* this) {
Actor* thisx = &this->dyna.actor;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/func_808B3298.s")
this->actionFunc = (ActorFunc)func_808B30D8;
thisx->posRot.pos.y = thisx->initPosRot.pos.y;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Update.s")
static void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot12_Gate/BgSpot12Gate_Draw.s")
if (Flags_GetSwitch(globalCtx, thisx->params & 0x3F)) {
func_808B3134(this);
func_800800F8(globalCtx, 0x1040, -0x63, thisx, 0);
}
}
static void func_808B3134(BgSpot12Gate* this) {
this->actionFunc = (ActorFunc)func_808B314C;
this->unk_168 = 0x28;
}
static void func_808B314C(BgSpot12Gate* this, GlobalContext* globalCtx) {
if (this->unk_168 <= 0) {
func_808B317C(this);
}
}
static void func_808B317C(BgSpot12Gate* this) {
this->actionFunc = (ActorFunc)func_808B318C;
}
static void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
s32 var;
Math_ApproxF(&thisx->velocity.y, 1.6f, 0.03f);
if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y + 200.0f, thisx->velocity.y)) {
func_808B3274(this);
var = func_80092F88(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0], 3);
func_80092DAC(var, -0x3CB0);
func_80092E70(var, 3, 0, 0, 0);
func_80092DF0(var, 0xC);
Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP);
} else {
func_8002F974(thisx, 0x2067);
}
}
static void func_808B3274(BgSpot12Gate* this) {
Actor* thisx = &this->dyna.actor;
this->actionFunc = (ActorFunc)func_808B3298;
thisx->posRot.pos.y = thisx->initPosRot.pos.y + 200.0f;
}
static void func_808B3298(BgSpot12Gate* this, GlobalContext* globalCtx) {
}
static void BgSpot12Gate_Update(BgSpot12Gate* this, GlobalContext* globalCtx) {
if (this->unk_168 > 0) {
this->unk_168 -= 1;
}
this->actionFunc(this, globalCtx);
}
static void BgSpot12Gate_Draw(BgSpot12Gate* this, GlobalContext* globalCtx) {
Draw_DListOpa(globalCtx, &D_06001080);
}

View file

@ -5,8 +5,9 @@
#include <global.h>
typedef struct {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x20];
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ ActorFunc actionFunc;
/* 0x0168 */ s16 unk_168;
} BgSpot12Gate; // size = 0x016C
extern const ActorInit Bg_Spot12_Gate_InitVars;

View file

@ -86,19 +86,15 @@ void EnBird_Init(EnBird* this, GlobalContext* globalCtx) {
void EnBird_Destroy(EnBird* this, GlobalContext* globalCtx) {
}
#ifdef NON_MATCHING
// D_0600006C address is reused when it shouldn't be
// also minor ordering differences
void func_809C1CAC(EnBird* this, s16 params) {
f32 frameCount = SkelAnime_GetFrameCount(&D_0600006C);
f32 playbackSpeed = this->unk_19C ? 0.0f : 1.0f;
u32* anim = &D_0600006C;
this->unk_198 = Math_Rand_S16Offset(5, 0x23);
SkelAnime_ChangeAnimation(&this->skelAnime, &D_0600006C, playbackSpeed, 0.0f, frameCount, 0, 0.0f);
SkelAnime_ChangeAnimation(&this->skelAnime, anim, playbackSpeed, 0.0f, frameCount, 0, 0.0f);
EnBird_SetNewUpdate(this, func_809C1D60);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Bird/func_809C1CAC.s")
#endif
void func_809C1D60(EnBird* this, GlobalContext* globalCtx) {
f32 fVar2 = sinf(this->unk_1B4);