mirror of https://github.com/zeldaret/mm.git
ovl_Bg_Last_Bwall OK (#971)
* `ovl_Bg_Last_Bwall` decompiled * Suggested changes * Rename ObjRobliftModelInfo * Rename functions * Remove upcast macro * Suggested changes
This commit is contained in:
parent
4a33baf936
commit
191e779189
3
spec
3
spec
|
|
@ -5003,8 +5003,7 @@ beginseg
|
|||
name "ovl_Bg_Last_Bwall"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Bg_Last_Bwall/z_bg_last_bwall.o"
|
||||
include "build/data/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall.data.o"
|
||||
include "build/data/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Bg_Last_Bwall/ovl_Bg_Last_Bwall_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
|||
|
|
@ -10,12 +10,33 @@
|
|||
|
||||
#define THIS ((BgLastBwall*)thisx)
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ Vec3s* posOffsets;
|
||||
/* 0x4 */ s16* indices;
|
||||
/* 0x8 */ s32 count;
|
||||
} BgLastBwallInitColliderStruct; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ Gfx* dList;
|
||||
/* 0x4 */ void* pad4;
|
||||
/* 0x8 */ CollisionHeader* colHeader;
|
||||
} BgLastBwallModelInfo; // size = 0xC
|
||||
|
||||
void BgLastBwall_Init(Actor* thisx, PlayState* play);
|
||||
void BgLastBwall_Destroy(Actor* thisx, PlayState* play);
|
||||
void BgLastBwall_Update(Actor* thisx, PlayState* play);
|
||||
void BgLastBwall_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
#if 0
|
||||
void BgLastBwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, ColliderTris* collider,
|
||||
BgLastBwallInitColliderStruct* arg4);
|
||||
void func_80C187E4(BgLastBwall* this);
|
||||
void func_80C184EC(BgLastBwall* this, PlayState* play);
|
||||
void func_80C187F8(BgLastBwall* this, PlayState* play);
|
||||
void func_80C1886C(BgLastBwall* this, PlayState* play);
|
||||
void func_80C18884(BgLastBwall* this, PlayState* play);
|
||||
void func_80C188C4(BgLastBwall* this, PlayState* play);
|
||||
void BgLastBwall_DoNothing(BgLastBwall* this, PlayState* play);
|
||||
|
||||
const ActorInit Bg_Last_Bwall_InitVars = {
|
||||
ACTOR_BG_LAST_BWALL,
|
||||
ACTORCAT_BG,
|
||||
|
|
@ -28,57 +49,217 @@ const ActorInit Bg_Last_Bwall_InitVars = {
|
|||
(ActorFunc)BgLastBwall_Draw,
|
||||
};
|
||||
|
||||
// static ColliderTrisElementInit sTrisElementsInit[2] = {
|
||||
static ColliderTrisElementInit D_80C189C0[2] = {
|
||||
static ColliderTrisElementInit sTrisElementsInit[] = {
|
||||
{
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0x00000008, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ { { -70.0f, 0.0f, 3.0f }, { 70.0f, 0.0f, 3.0f }, { -70.0f, 200.0f, 3.0f } } },
|
||||
},
|
||||
{
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000008, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0x00000008, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ { { 70.0f, 0.0f, 3.0f }, { 70.0f, 200.0f, 3.0f }, { -70.0f, 200.0f, 3.0f } } },
|
||||
},
|
||||
};
|
||||
|
||||
// static ColliderTrisInit sTrisInit = {
|
||||
static ColliderTrisInit D_80C18A38 = {
|
||||
{ COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_TRIS, },
|
||||
ARRAY_COUNT(sTrisElementsInit), D_80C189C0, // sTrisElementsInit,
|
||||
static ColliderTrisInit sTrisInit = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_NONE,
|
||||
AC_ON | AC_TYPE_PLAYER,
|
||||
OC1_NONE,
|
||||
OC2_NONE,
|
||||
COLSHAPE_TRIS,
|
||||
},
|
||||
ARRAY_COUNT(sTrisElementsInit),
|
||||
sTrisElementsInit,
|
||||
};
|
||||
|
||||
// static InitChainEntry sInitChain[] = {
|
||||
static BgLastBwallModelInfo D_80C18A48[] = {
|
||||
{ object_last_obj_DL_0001A8, NULL, &object_last_obj_Colheader_000288 },
|
||||
{ object_last_obj_DL_001318, NULL, &object_last_obj_Colheader_001450 },
|
||||
};
|
||||
|
||||
static Vec3s D_80C18A60[] = {
|
||||
{ 280, 280, -40 },
|
||||
{ 280, 280, 120 },
|
||||
{ 280, 400, 120 },
|
||||
{ 280, 400, -40 },
|
||||
};
|
||||
|
||||
static s16 D_80C18A78[] = { 0, 1, 2, 0, 2, 3 };
|
||||
|
||||
static BgLastBwallInitColliderStruct D_80C18A84 = { D_80C18A60, D_80C18A78, 2 };
|
||||
|
||||
static Vec3s D_80C18A90[] = {
|
||||
{ -80, 400, -80 },
|
||||
{ -80, 400, 80 },
|
||||
{ 80, 400, 80 },
|
||||
{ 80, 400, -80 },
|
||||
};
|
||||
|
||||
static s16 D_80C18AA8[] = { 0, 3, 2, 0, 2, 1 };
|
||||
|
||||
static BgLastBwallInitColliderStruct D_80C18AB4 = { D_80C18A90, D_80C18AA8, 2 };
|
||||
|
||||
static BgLastBwallInitColliderStruct* D_80C18AC0[] = { &D_80C18A84, &D_80C18AB4 };
|
||||
|
||||
static InitChainEntry D_80C18AC8[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#endif
|
||||
void BgLastBwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, ColliderTris* collider,
|
||||
BgLastBwallInitColliderStruct* arg4) {
|
||||
s32 i;
|
||||
s32 j;
|
||||
Vec3f sp6C[3];
|
||||
Vec3f sp60;
|
||||
Vec3f sp54;
|
||||
|
||||
extern ColliderTrisElementInit D_80C189C0[2];
|
||||
extern ColliderTrisInit D_80C18A38;
|
||||
extern InitChainEntry D_80C18AC8[];
|
||||
Matrix_RotateYS(rot->y, MTXMODE_NEW);
|
||||
Matrix_RotateXS(rot->x, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(rot->z, MTXMODE_APPLY);
|
||||
for (i = 0; i < init->count; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
Math_Vec3s_ToVec3f(&sp60, &arg4->posOffsets[arg4->indices[j]]);
|
||||
Matrix_MultVec3f(&sp60, &sp54);
|
||||
Math_Vec3f_Sum(&sp54, pos, &sp6C[j]);
|
||||
}
|
||||
|
||||
extern UNK_TYPE D_06000098;
|
||||
arg4->indices += 3;
|
||||
Collider_SetTrisVertices(collider, i, &sp6C[0], &sp6C[1], &sp6C[2]);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18240.s")
|
||||
void BgLastBwall_Init(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
BgLastBwall* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Init.s")
|
||||
Actor_ProcessInitChain(&this->dyna.actor, D_80C18AC8);
|
||||
this->type = BGLASTBWALL_GET_TYPE(&this->dyna.actor);
|
||||
DynaPolyActor_Init(&this->dyna, 1);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, D_80C18A48[this->type].colHeader);
|
||||
Collider_InitTris(play, &this->colliderTris);
|
||||
if (Flags_GetSwitch(play, BGLASTBWALL_GET_SWITCHFLAGS(&this->dyna.actor))) {
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
} else if (!Collider_SetTris(play, &this->colliderTris, &this->dyna.actor, &sTrisInit, this->colliderTrisElement)) {
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
} else {
|
||||
BgLastBwall_InitCollider(&sTrisInit, &this->dyna.actor.world.pos, &this->dyna.actor.shape.rot,
|
||||
&this->colliderTris, D_80C18AC0[this->type]);
|
||||
SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes));
|
||||
func_80C187E4(this);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Destroy.s")
|
||||
void BgLastBwall_Destroy(Actor* thisx, PlayState* play) {
|
||||
BgLastBwall* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C184EC.s")
|
||||
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C187E4.s")
|
||||
void func_80C184EC(BgLastBwall* this, PlayState* play) {
|
||||
f32 randVar;
|
||||
Vec3f spD0;
|
||||
Vec3f effectPosAndAccel;
|
||||
s32 var_v0;
|
||||
Vec3f effectVelocity;
|
||||
s32 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C187F8.s")
|
||||
Matrix_RotateYS(this->dyna.actor.shape.rot.y, MTXMODE_NEW);
|
||||
Matrix_RotateXS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY);
|
||||
Matrix_RotateZS(this->dyna.actor.shape.rot.y, MTXMODE_APPLY);
|
||||
for (i = 0; i < 30; i++) {
|
||||
switch (this->type) {
|
||||
case BGLASTBWALL_TYPE_0:
|
||||
spD0.x = 280.0f;
|
||||
spD0.y = Rand_Centered() * 160.0f + 320.0f;
|
||||
spD0.z = Rand_Centered() * 160.0f;
|
||||
Matrix_MultVec3f(&spD0, &effectPosAndAccel);
|
||||
Math_Vec3f_Sum(&this->dyna.actor.world.pos, &effectPosAndAccel, &effectPosAndAccel);
|
||||
break;
|
||||
case BGLASTBWALL_TYPE_1:
|
||||
spD0.x = Rand_Centered() * 160.0f;
|
||||
spD0.y = 400.0f;
|
||||
spD0.z = Rand_Centered() * 160.0f;
|
||||
Matrix_MultVec3f(&spD0, &effectPosAndAccel);
|
||||
Math_Vec3f_Sum(&this->dyna.actor.world.pos, &effectPosAndAccel, &effectPosAndAccel);
|
||||
break;
|
||||
}
|
||||
func_800BBFB0(play, &effectPosAndAccel, 50.0f, 2, Rand_ZeroOne() * 120.0f + 20.0f,
|
||||
Rand_ZeroOne() * 240.0f + 20.0f, 0);
|
||||
effectVelocity.x = Rand_ZeroOne() * 2.5f;
|
||||
effectVelocity.y = Rand_ZeroOne() * 2.5f + 1.0f;
|
||||
effectVelocity.z = Rand_ZeroOne() * 2.5f;
|
||||
randVar = Rand_ZeroOne();
|
||||
if (randVar < 0.2f) {
|
||||
var_v0 = 0x60;
|
||||
} else if (randVar < 0.6f) {
|
||||
var_v0 = 0x40;
|
||||
} else {
|
||||
var_v0 = 0x20;
|
||||
}
|
||||
EffectSsKakera_Spawn(play, &effectPosAndAccel, &effectVelocity, &effectPosAndAccel, -260, var_v0, 20, 0, 0, 10,
|
||||
0, 0, 50, -1, OBJECT_LAST_OBJ, object_last_obj_DL_000098);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C1886C.s")
|
||||
void func_80C187E4(BgLastBwall* this) {
|
||||
this->actionFunc = func_80C187F8;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18884.s")
|
||||
void func_80C187F8(BgLastBwall* this, PlayState* play) {
|
||||
if (this->colliderTris.base.acFlags & 2) {
|
||||
this->colliderTris.base.acFlags &= ~2;
|
||||
Flags_SetSwitch(play, BGLASTBWALL_GET_SWITCHFLAGS(&this->dyna.actor));
|
||||
func_80C1886C(this, play);
|
||||
} else {
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderTris.base);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C188C4.s")
|
||||
void func_80C1886C(BgLastBwall* this, PlayState* play) {
|
||||
this->actionFunc = func_80C18884;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/func_80C18928.s")
|
||||
void func_80C18884(BgLastBwall* this, PlayState* play) {
|
||||
if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) {
|
||||
func_80C188C4(this, play);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Update.s")
|
||||
void func_80C188C4(BgLastBwall* this, PlayState* play) {
|
||||
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->dyna.actor.draw = NULL;
|
||||
func_80C184EC(this, play);
|
||||
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_WALL_BROKEN);
|
||||
this->actionFunc = BgLastBwall_DoNothing;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Last_Bwall/BgLastBwall_Draw.s")
|
||||
void BgLastBwall_DoNothing(BgLastBwall* this, PlayState* play) {
|
||||
}
|
||||
|
||||
void BgLastBwall_Update(Actor* thisx, PlayState* play) {
|
||||
BgLastBwall* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
||||
void BgLastBwall_Draw(Actor* thisx, PlayState* play2) {
|
||||
PlayState* play = play2;
|
||||
BgLastBwall* this = THIS;
|
||||
|
||||
Gfx_DrawDListOpa(play, D_80C18A48[this->type].dList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,16 +2,27 @@
|
|||
#define Z_BG_LAST_BWALL_H
|
||||
|
||||
#include "global.h"
|
||||
#include "objects/object_last_obj/object_last_obj.h"
|
||||
|
||||
struct BgLastBwall;
|
||||
|
||||
typedef void (*BgLastBwallActionFunc)(struct BgLastBwall*, PlayState*);
|
||||
|
||||
#define BGLASTBWALL_GET_SWITCHFLAGS(thisx) ((thisx)->params & 0x7F)
|
||||
#define BGLASTBWALL_GET_TYPE(thisx) (((thisx)->params >> 0xC) & 0xF)
|
||||
|
||||
typedef enum {
|
||||
BGLASTBWALL_TYPE_0 = 0,
|
||||
BGLASTBWALL_TYPE_1 = 1,
|
||||
} BgLastBwallType;
|
||||
|
||||
typedef struct BgLastBwall {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x18];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ BgLastBwallActionFunc actionFunc;
|
||||
/* 0x160 */ char unk_160[0xDC];
|
||||
/* 0x160 */ ColliderTris colliderTris;
|
||||
/* 0x180 */ ColliderTrisElement colliderTrisElement[2];
|
||||
/* 0x238 */ u8 type;
|
||||
/* 0x23A */ s16 cutscenes[1];
|
||||
} BgLastBwall; // size = 0x23C
|
||||
|
||||
extern const ActorInit Bg_Last_Bwall_InitVars;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ void ObjRotlift_Draw(Actor* thisx, PlayState* play);
|
|||
|
||||
void ObjRotlift_MoveDekuFlowers(ObjRotlift* this);
|
||||
|
||||
typedef struct ModelInfo {
|
||||
typedef struct ObjRotliftModelInfo {
|
||||
/* 0x0 */ Gfx* dList;
|
||||
/* 0x4 */ AnimatedMaterial* animMat;
|
||||
/* 0x8 */ CollisionHeader* colHeader;
|
||||
} ModelInfo; // size = 0xC
|
||||
} ObjRotliftModelInfo; // size = 0xC
|
||||
|
||||
const ActorInit Obj_Rotlift_InitVars = {
|
||||
ACTOR_OBJ_ROTLIFT,
|
||||
|
|
@ -37,7 +37,7 @@ const ActorInit Obj_Rotlift_InitVars = {
|
|||
(ActorFunc)ObjRotlift_Draw,
|
||||
};
|
||||
|
||||
struct ModelInfo sModelInfo[] = {
|
||||
struct ObjRotliftModelInfo sModelInfo[] = {
|
||||
{
|
||||
gDekuMoonDungeonRotatingPlatformsDL,
|
||||
gDekuMoonDungeonRotatingPlatformsUnusedTexAnim,
|
||||
|
|
@ -87,7 +87,7 @@ void ObjRotlift_Init(Actor* thisx, PlayState* play2) {
|
|||
s32 type = OBJROTLIFT_GET_TYPE(&this->dyna.actor);
|
||||
s32 dekuFlowerParams;
|
||||
s32 i;
|
||||
ModelInfo* modelInfo;
|
||||
ObjRotliftModelInfo* modelInfo;
|
||||
ObjEtcetera** dekuFlowers;
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
|
|
@ -146,7 +146,7 @@ void ObjRotlift_Update(Actor* thisx, PlayState* play) {
|
|||
void ObjRotlift_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
ObjRotlift* this = THIS;
|
||||
ModelInfo* modelInfo = &sModelInfo[OBJROTLIFT_GET_TYPE(&this->dyna.actor)];
|
||||
ObjRotliftModelInfo* modelInfo = &sModelInfo[OBJROTLIFT_GET_TYPE(&this->dyna.actor)];
|
||||
|
||||
// Neither of the displaylists reference other segments, so this call is ultimately pointless.
|
||||
AnimatedMat_Draw(play, modelInfo->animMat);
|
||||
|
|
|
|||
|
|
@ -16856,7 +16856,7 @@
|
|||
0x80C18120:("BgLbfshot_Init",),
|
||||
0x80C1817C:("BgLbfshot_Destroy",),
|
||||
0x80C181B0:("BgLbfshot_Draw",),
|
||||
0x80C18240:("func_80C18240",),
|
||||
0x80C18240:("BgLastBwall_InitCollider",),
|
||||
0x80C1838C:("BgLastBwall_Init",),
|
||||
0x80C184B8:("BgLastBwall_Destroy",),
|
||||
0x80C184EC:("func_80C184EC",),
|
||||
|
|
@ -16865,7 +16865,7 @@
|
|||
0x80C1886C:("func_80C1886C",),
|
||||
0x80C18884:("func_80C18884",),
|
||||
0x80C188C4:("func_80C188C4",),
|
||||
0x80C18928:("func_80C18928",),
|
||||
0x80C18928:("BgLastBwall_DoNothing",),
|
||||
0x80C18938:("BgLastBwall_Update",),
|
||||
0x80C1895C:("BgLastBwall_Draw",),
|
||||
0x80C18B90:("func_80C18B90",),
|
||||
|
|
|
|||
Loading…
Reference in New Issue