diff options
| author | Lucas Shaw <lgs84@cornell.edu> | 2020-03-22 22:55:05 -0700 |
|---|---|---|
| committer | Lucas Shaw <lgs84@cornell.edu> | 2020-03-22 22:55:05 -0700 |
| commit | 8c99bdd00f2fd191d69e02f5091bc36d3eb2a45d (patch) | |
| tree | 9681dcbe28a4323be728efca5eb04801163ce7c1 /src | |
| parent | e066751e220cbd63a9f5086bceb332098acd8d6f (diff) | |
ovl_Bg_Zg OK
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 153 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h | 6 |
2 files changed, 141 insertions, 18 deletions
diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index 5bc3369bb..3db69157c 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -3,12 +3,26 @@ #define ROOM 0x00 #define FLAGS 0x00000010 -void BgZg_Init(BgZg* this, GlobalContext* globalCtx); -void BgZg_Destroy(BgZg* this, GlobalContext* globalCtx); -void BgZg_Update(BgZg* this, GlobalContext* globalCtx); -void BgZg_Draw(BgZg* this, GlobalContext* globalCtx); +static void BgZg_Init(BgZg* this, GlobalContext* globalCtx); +static void BgZg_Destroy(BgZg* this, GlobalContext* globalCtx); +static void BgZg_Update(BgZg* this, GlobalContext* globalCtx); +static void BgZg_Draw(BgZg* this, GlobalContext* globalCtx); +static void func_808C0C50(BgZg* this); +static s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx); +static s32 func_808C0CC8(BgZg* this); +static void func_808C0CD4(BgZg* this, GlobalContext* globalCtx); +static void func_808C0D08(BgZg* this, GlobalContext* globalCtx); +static void func_808C0EEC(BgZg* this, GlobalContext* globalCtx); + +static const ActorFunc funcTbl[] = { (ActorFunc)func_808C0CD4, (ActorFunc)func_808C0D08 }; + +static InitChainEntry initChain[] = +{ + ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP) +}; + +static const ActorFunc funcTbl2[] = { (ActorFunc) func_808C0EEC }; -/* const ActorInit Bg_Zg_InitVars = { ACTOR_BG_ZG, @@ -22,23 +36,130 @@ const ActorInit Bg_Zg_InitVars = (ActorFunc)BgZg_Update, (ActorFunc)BgZg_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/BgZg_Destroy.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/func_808C0C50.s") +extern u32 D_06001080; +extern u32 D_060011D4; + +static void BgZg_Destroy(BgZg* this, GlobalContext* globalCtx) +{ + DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); +} + +static void func_808C0C50(BgZg* this) +{ + Audio_PlaySoundGeneral(NA_SE_EV_METALDOOR_OPEN, &this->dyna.actor.unk_E4, 4, + &D_801333E0, &D_801333E0, &D_801333E8); +} + +static s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx) +{ + Actor* thisx = &this->dyna.actor; + s32 flag; + flag = (thisx->params >> 8) & 0xFF; + return Flags_GetSwitch(globalCtx, flag); +} + +static s32 func_808C0CC8(BgZg* this) +{ + s32 flag = this->dyna.actor.params & 0xFF; + return flag; +} + +static void func_808C0CD4(BgZg* this, GlobalContext* globalCtx) +{ + if (func_808C0C98(this, globalCtx) != 0) + { + this->funcIndex = 1; + func_808C0C50(this); + } +} + +static void func_808C0D08(BgZg* this, GlobalContext* globalCtx) +{ + Actor* thisx = &this->dyna.actor; + + thisx->posRot.pos.y += (kREG(16) + 20.0f) * 1.2f; + if ((((kREG(17) + 200.0f) * 1.2f) + thisx->initPosRot.pos.y) <= thisx->posRot.pos.y) + { + Actor_Kill(thisx); + } +} + +static void BgZg_Update(BgZg *this,GlobalContext *globalCtx) +{ + s32 funcIndex = this->funcIndex; + + if (((funcIndex < 0) || (1 < funcIndex)) || (funcTbl[funcIndex] == NULL)) + { + // Translates to: "Main Mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!" + osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + } + else + { + funcTbl[funcIndex](&this->dyna.actor, globalCtx); + } + +} + +static void BgZg_Init(BgZg* this, GlobalContext* globalCtx) { + s32 sp20[2]; + Actor* thisx = &this->dyna.actor; + u32 local_c; + + Actor_ProcessInitChain(thisx, initChain); + DynaPolyInfo_SetActorMove(thisx, DPM_UNK); + local_c = 0; + DynaPolyInfo_Alloc(&D_060011D4, &local_c); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); + if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) + { + thisx->scale.x = thisx->scale.x * 1.3f; + thisx->scale.z = thisx->scale.z * 1.3f; + thisx->scale.y = thisx->scale.y * 1.2f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/func_808C0C98.s") + else + { -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/func_808C0CC8.s") + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/func_808C0CD4.s") + this->funcIndex = 0; + this->unk_168 = 0; + if (func_808C0C98(this, globalCtx) != 0) + { + Actor_Kill(thisx); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/func_808C0D08.s") +static void func_808C0EEC(BgZg* this, GlobalContext* globalCtx) +{ + + GraphicsContext* gfxCtx; + GraphicsContext* tempgfxCtx; // oddly needs this to match + Gfx* gfxArr[4]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/BgZg_Update.s") + tempgfxCtx = globalCtx->state.gfxCtx; + gfxCtx = tempgfxCtx; + func_800C6AC4(gfxArr, gfxCtx, "../z_bg_zg.c", 311); + + func_80093D18(gfxCtx); + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(gfxCtx, "../z_bg_zg.c", 315), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/BgZg_Init.s") + gSPDisplayList(gfxCtx->polyOpa.p++, &D_06001080); + func_800C6B54(gfxArr, gfxCtx, "../z_bg_zg.c", 320); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/func_808C0EEC.s") +static void BgZg_Draw(BgZg* this, GlobalContext* globalCtx) +{ + s32 funcIndex = this->unk_168; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Zg/BgZg_Draw.s") + if (((funcIndex < 0) || (0 < funcIndex)) || funcTbl2[funcIndex] == 0) + { + // Translates to: "Drawing mode is wrong !!!!!!!!!!!!!!!!!!!!!!!!!" + osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); + } + else + { + funcTbl2[funcIndex](this, globalCtx); + } +}
\ No newline at end of file diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h index 3a856be40..6d7d6f7dc 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.h @@ -3,11 +3,13 @@ #include <ultra64.h> #include <global.h> +#include <vt.h> typedef struct { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x20]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ s32 funcIndex; + /* 0x0168 */ s32 unk_168; } BgZg; // size = 0x016C extern const ActorInit Bg_Zg_InitVars; |
