1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-28 07:46:18 +00:00

updated ovl_bg_zg formatting

This commit is contained in:
shawlucas 2020-03-23 12:10:06 -07:00
parent a3ba02618b
commit 3c53052726
2 changed files with 37 additions and 65 deletions

View file

@ -22,15 +22,11 @@ static void func_808C0EEC(BgZg* this, GlobalContext* globalCtx);
static const ActorFunc funcTbl[] = { (ActorFunc)func_808C0CD4, (ActorFunc)func_808C0D08 }; static const ActorFunc funcTbl[] = { (ActorFunc)func_808C0CD4, (ActorFunc)func_808C0D08 };
static InitChainEntry initChain[] = static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP) };
{
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP)
};
static const ActorFunc funcTbl2[] = { (ActorFunc) func_808C0EEC }; static const ActorFunc funcTbl2[] = { (ActorFunc)func_808C0EEC };
const ActorInit Bg_Zg_InitVars = const ActorInit Bg_Zg_InitVars = {
{
ACTOR_BG_ZG, ACTOR_BG_ZG,
ACTORTYPE_NPC, ACTORTYPE_NPC,
ROOM, ROOM,
@ -46,69 +42,54 @@ const ActorInit Bg_Zg_InitVars =
extern u32 D_06001080; extern u32 D_06001080;
extern u32 D_060011D4; extern u32 D_060011D4;
static void BgZg_Destroy(BgZg* this, GlobalContext* globalCtx) static void BgZg_Destroy(BgZg* this, GlobalContext* globalCtx) {
{
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
} }
static void func_808C0C50(BgZg* this) 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);
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) static s32 func_808C0C98(BgZg* this, GlobalContext* globalCtx) {
{
Actor* thisx = &this->dyna.actor; Actor* thisx = &this->dyna.actor;
s32 flag; s32 flag;
flag = (thisx->params >> 8) & 0xFF; flag = (thisx->params >> 8) & 0xFF;
return Flags_GetSwitch(globalCtx, flag); return Flags_GetSwitch(globalCtx, flag);
} }
static s32 func_808C0CC8(BgZg* this) static s32 func_808C0CC8(BgZg* this) {
{
s32 flag = this->dyna.actor.params & 0xFF; s32 flag = this->dyna.actor.params & 0xFF;
return flag; return flag;
} }
static void func_808C0CD4(BgZg* this, GlobalContext* globalCtx) static void func_808C0CD4(BgZg* this, GlobalContext* globalCtx) {
{ if (func_808C0C98(this, globalCtx) != 0) {
if (func_808C0C98(this, globalCtx) != 0)
{
this->funcIndex = 1; this->funcIndex = 1;
func_808C0C50(this); func_808C0C50(this);
} }
} }
static void func_808C0D08(BgZg* this, GlobalContext* globalCtx) static void func_808C0D08(BgZg* this, GlobalContext* globalCtx) {
{
Actor* thisx = &this->dyna.actor; Actor* thisx = &this->dyna.actor;
thisx->posRot.pos.y += (kREG(16) + 20.0f) * 1.2f; 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) if ((((kREG(17) + 200.0f) * 1.2f) + thisx->initPosRot.pos.y) <= thisx->posRot.pos.y) {
{
Actor_Kill(thisx); Actor_Kill(thisx);
} }
} }
static void BgZg_Update(BgZg *this,GlobalContext *globalCtx) static void BgZg_Update(BgZg* this, GlobalContext* globalCtx) {
{ s32 funcIndex = this->funcIndex;
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);
}
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) static void BgZg_Init(BgZg* this, GlobalContext* globalCtx) {
{
s32 sp20[2]; s32 sp20[2];
Actor* thisx = &this->dyna.actor; Actor* thisx = &this->dyna.actor;
u32 local_c; u32 local_c;
@ -118,28 +99,23 @@ static void BgZg_Init(BgZg* this, GlobalContext* globalCtx)
local_c = 0; local_c = 0;
DynaPolyInfo_Alloc(&D_060011D4, &local_c); DynaPolyInfo_Alloc(&D_060011D4, &local_c);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c);
if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) {
{
thisx->scale.x = thisx->scale.x * 1.3f; thisx->scale.x = thisx->scale.x * 1.3f;
thisx->scale.z = thisx->scale.z * 1.3f; thisx->scale.z = thisx->scale.z * 1.3f;
thisx->scale.y = thisx->scale.y * 1.2f; thisx->scale.y = thisx->scale.y * 1.2f;
} }
else else {
{
} }
this->funcIndex = 0; this->funcIndex = 0;
this->unk_168 = 0; this->unk_168 = 0;
if (func_808C0C98(this, globalCtx) != 0) if (func_808C0C98(this, globalCtx) != 0) {
{
Actor_Kill(thisx); Actor_Kill(thisx);
} }
} }
static void func_808C0EEC(BgZg* this, GlobalContext* globalCtx) static void func_808C0EEC(BgZg* this, GlobalContext* globalCtx) {
{
GraphicsContext* gfxCtx; GraphicsContext* gfxCtx;
GraphicsContext* tempgfxCtx; // oddly needs this to match GraphicsContext* tempgfxCtx; // oddly needs this to match
@ -150,23 +126,20 @@ static void func_808C0EEC(BgZg* this, GlobalContext* globalCtx)
func_800C6AC4(gfxArr, gfxCtx, "../z_bg_zg.c", 311); func_800C6AC4(gfxArr, gfxCtx, "../z_bg_zg.c", 311);
func_80093D18(gfxCtx); func_80093D18(gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(gfxCtx, "../z_bg_zg.c", 315), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(gfxCtx, "../z_bg_zg.c", 315),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyOpa.p++, &D_06001080); gSPDisplayList(gfxCtx->polyOpa.p++, &D_06001080);
func_800C6B54(gfxArr, gfxCtx, "../z_bg_zg.c", 320); func_800C6B54(gfxArr, gfxCtx, "../z_bg_zg.c", 320);
} }
static void BgZg_Draw(BgZg* this, GlobalContext* globalCtx) static void BgZg_Draw(BgZg* this, GlobalContext* globalCtx) {
{
s32 funcIndex = this->unk_168; s32 funcIndex = this->unk_168;
if (((funcIndex < 0) || (0 < funcIndex)) || funcTbl2[funcIndex] == 0) if (((funcIndex < 0) || (0 < funcIndex)) || funcTbl2[funcIndex] == 0) {
{
// Translates to: "Drawing mode is wrong !!!!!!!!!!!!!!!!!!!!!!!!!" // Translates to: "Drawing mode is wrong !!!!!!!!!!!!!!!!!!!!!!!!!"
osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
} } else {
else
{
funcTbl2[funcIndex](this, globalCtx); funcTbl2[funcIndex](this, globalCtx);
} }
} }

View file

@ -5,8 +5,7 @@
#include <global.h> #include <global.h>
#include <vt.h> #include <vt.h>
typedef struct typedef struct {
{
/* 0x0000 */ DynaPolyActor dyna; /* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ s32 funcIndex; /* 0x0164 */ s32 funcIndex;
/* 0x0168 */ s32 unk_168; /* 0x0168 */ s32 unk_168;