1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-17 13:24:45 +00:00

Merge pull request #49 from shawlucas/en_tana

Decompiled ovl_En_Tana and ovl_Bg_Spot05_Soko
This commit is contained in:
fig02 2020-04-02 18:47:39 -04:00 committed by GitHub
commit b96c016948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 169 additions and 535 deletions

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,
};
#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 pad1;
u32 sp24;
u32 pad2;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/BgSpot05Soko_Update.s")
sp24 = 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);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot05_Soko/BgSpot05Soko_Draw.s")
static void BgSpot05Soko_Destroy(BgSpot05Soko* this, GlobalContext* globalCtx) {
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
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) {
this->actionFunc(this, globalCtx);
}
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

@ -1,13 +1,20 @@
/*
* File: z_en_tana.c
* Overlay: ovl_En_Tana
* Description: Shop Shelves
*/
#include "z_en_tana.h"
#define ROOM 0x00
#define FLAGS 0x00000009
void EnTana_Init(EnTana* this, GlobalContext* globalCtx);
void EnTana_Destroy(EnTana* this, GlobalContext* globalCtx);
void EnTana_Update(EnTana* this, GlobalContext* globalCtx);
static void EnTana_Init(EnTana* this, GlobalContext* globalCtx);
static void EnTana_Destroy(EnTana* this, GlobalContext* globalCtx);
static void EnTana_Update(EnTana* this, GlobalContext* globalCtx);
static void func_80B17FC4(EnTana* this, GlobalContext* globalCtx);
static void func_80B1809C(EnTana* this, GlobalContext* globalCtx);
/*
const ActorInit En_Tana_InitVars = {
ACTOR_EN_TANA,
ACTORTYPE_PROP,
@ -20,13 +27,70 @@ const ActorInit En_Tana_InitVars = {
(ActorFunc)EnTana_Update,
NULL,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tana/EnTana_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tana/EnTana_Destroy.s")
static char* shelfTypes[] = {
"木の棚", // "Wooden Shelves"
"石の棚", // "Stone Shelves"
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tana/EnTana_Update.s")
static const ActorFunc drawFuncs[] = {
(ActorFunc)func_80B17FC4,
(ActorFunc)func_80B1809C,
(ActorFunc)func_80B1809C,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tana/func_80B17FC4.s")
static Gfx* dListTbl[] = {
0x06000B80,
0x060027E8,
0x060027E8,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Tana/func_80B1809C.s")
static Gfx* dListTbl2[] = {
NULL,
0x06000E08,
0x06001608,
};
static void EnTana_Init(EnTana* this, GlobalContext* globalCtx) {
Actor* thisx = &this->actor;
osSyncPrintf("☆☆☆ %s ☆☆☆\n", shelfTypes[thisx->params]);
Actor_SetScale(thisx, 1.0f);
thisx->flags &= ~1;
thisx->draw = drawFuncs[thisx->params];
}
static void EnTana_Destroy(EnTana* this, GlobalContext* globalCtx) {
}
static void EnTana_Update(EnTana* this, GlobalContext* globalCtx) {
}
static void func_80B17FC4(EnTana* this, GlobalContext* globalCtx) {
Actor* thisx = &this->actor;
GraphicsContext* gfxCtx;
Gfx* gfxArr[4];
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_en_tana.c", 148);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tana.c", 152),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyOpa.p++, dListTbl[thisx->params]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_tana.c", 157);
}
static void func_80B1809C(EnTana* this, GlobalContext* globalCtx) {
Actor* thisx = &this->actor;
GraphicsContext* gfxCtx;
Gfx* gfxArr[4];
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_en_tana.c", 163);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(dListTbl2[thisx->params]));
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tana.c", 169),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyOpa.p++, dListTbl[thisx->params]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_tana.c", 174);
}