1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Merge branch 'ovl_Bg_Spot05_Soko' into en_tana

This commit is contained in:
shawlucas 2020-04-01 17:28:25 -07:00
commit 64b66029ad
4 changed files with 94 additions and 18 deletions

3
spec
View file

@ -1400,8 +1400,7 @@ endseg
beginseg
name "ovl_Bg_Spot05_Soko"
include "build/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko.o"
include "build/data/overlays/actors/z_bg_spot05_soko.data.o"
include "build/data/overlays/actors/z_bg_spot05_soko.reloc.o"
include "build/src/overlays/actors/ovl_Bg_Spot05_Soko/z_bg_spot05_soko_reloc.o"
endseg
beginseg

View file

@ -1,14 +1,25 @@
/*
* File: z_bg_spot05_soko.c
* Overlay: ovl_Bg_Spot05_Soko
* Description: Sacred Forest Meadow Entities
*/
#include "z_bg_spot05_soko.h"
#define ROOM 0x00
#define FLAGS 0x00000000
void BgSpot05Soko_Init(BgSpot05Soko* this, GlobalContext* globalCtx);
void BgSpot05Soko_Destroy(BgSpot05Soko* this, GlobalContext* globalCtx);
void BgSpot05Soko_Update(BgSpot05Soko* this, GlobalContext* globalCtx);
void BgSpot05Soko_Draw(BgSpot05Soko* this, GlobalContext* globalCtx);
static void BgSpot05Soko_Init(BgSpot05Soko* this, GlobalContext* globalCtx);
static void BgSpot05Soko_Destroy(BgSpot05Soko* this, GlobalContext* globalCtx);
static void BgSpot05Soko_Update(BgSpot05Soko* this, GlobalContext* globalCtx);
static void BgSpot05Soko_Draw(BgSpot05Soko* this, GlobalContext* globalCtx);
static void func_808AE5A8(BgSpot05Soko* this, GlobalContext* globalCtx);
static void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx);
static void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx);
extern Gfx* D_060012C0;
extern Gfx* D_06000918;
/*
const ActorInit Bg_Spot05_Soko_InitVars = {
ACTOR_BG_SPOT05_SOKO,
ACTORTYPE_PROP,
@ -21,17 +32,78 @@ const ActorInit Bg_Spot05_Soko_InitVars = {
(ActorFunc)BgSpot05Soko_Update,
(ActorFunc)BgSpot05Soko_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/BgSpot05Soko_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/BgSpot05Soko_Destroy.s")
static InitChainEntry initChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/func_808AE5A8.s")
static Gfx* dListTbl[] = {
0x06000840,
0x06001190,
NULL,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/func_808AE5B4.s")
static void BgSpot05Soko_Init(BgSpot05Soko* this, GlobalContext* globalCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/func_808AE630.s")
Actor* thisx = &this->dyna.actor;
u32 sp24[2];
sp24[0] = 0;
Actor_ProcessInitChain(thisx, initChain);
this->switchFlag = (thisx->params >> 8) & 0xFF;
thisx->params &= 0xFF;
DynaPolyInfo_SetActorMove(thisx, DPM_UNK);
if (thisx->params == 0) {
DynaPolyInfo_Alloc(&D_06000918, &sp24);
if (LINK_IS_ADULT) {
Actor_Kill(thisx);
} else {
this->actionFunc = &func_808AE5A8;
}
} else {
DynaPolyInfo_Alloc(&D_060012C0, &sp24);
if (Flags_GetSwitch(globalCtx, this->switchFlag) != 0) {
Actor_Kill(thisx);
} else {
this->actionFunc = &func_808AE5B4;
thisx->flags |= 0x10;
}
}
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, sp24[0]);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/BgSpot05Soko_Update.s")
static void BgSpot05Soko_Destroy(BgSpot05Soko* this, GlobalContext* globalCtx) {
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/BgSpot05Soko_Draw.s")
static void func_808AE5A8(BgSpot05Soko* this, GlobalContext* globalCtx) {
}
static void func_808AE5B4(BgSpot05Soko* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
if (Flags_GetSwitch(globalCtx, this->switchFlag)) {
Audio_PlaySoundAtPosition(globalCtx, &thisx->posRot.pos, 0x1E, NA_SE_EV_METALDOOR_CLOSE);
Actor_SetHeight(thisx, 50.0f);
func_80080480(globalCtx, thisx);
this->actionFunc = &func_808AE630;
thisx->speedXZ = 0.5f;
}
}
static void func_808AE630(BgSpot05Soko* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
thisx->speedXZ *= 1.5f;
if (Math_ApproxF(&thisx->posRot.pos.y, thisx->initPosRot.pos.y - 120.0f, thisx->speedXZ) != 0) {
Actor_Kill(thisx);
}
}
static void BgSpot05Soko_Update(BgSpot05Soko* this, GlobalContext* globalCtx) {
Actor* thisx = &this->dyna.actor;
this->actionFunc(thisx, globalCtx);
}
extern Gfx* D_808AE724[];
static void BgSpot05Soko_Draw(BgSpot05Soko* this, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, dListTbl[this->dyna.actor.params]);
}

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 */ s32 switchFlag;
} BgSpot05Soko; // size = 0x016C
extern const ActorInit Bg_Spot05_Soko_InitVars;

View file

@ -467,4 +467,8 @@ link_animetion_segment = 0x07000000;
// z_en_ds
D_06004768 = 0x06004768;
D_0600039C = 0x0600039C;
D_0600039C = 0x0600039C;
// z_bg_spot05_soko
D_06000918 = 0x06000918;
D_060012C0 = 0x060012C0;