mirror of https://github.com/zeldaret/mm.git
ovl_Obj_Rotlift decompiled (#850)
* ovl_Obj_Rotlift decompiled * fixes * fixes 2 * format * PR review fixes * PR review fixes * PR review fixes * PR review fixes * PR review fixes * pr review fixes Co-authored-by: SonicDcer <noreply@github.com>
This commit is contained in:
parent
2c10d51022
commit
064b3e5493
3
spec
3
spec
|
@ -4229,8 +4229,7 @@ beginseg
|
||||||
name "ovl_Obj_Rotlift"
|
name "ovl_Obj_Rotlift"
|
||||||
compress
|
compress
|
||||||
include "build/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.o"
|
include "build/src/overlays/actors/ovl_Obj_Rotlift/z_obj_rotlift.o"
|
||||||
include "build/data/ovl_Obj_Rotlift/ovl_Obj_Rotlift.data.o"
|
include "build/src/overlays/actors/ovl_Obj_Rotlift/ovl_Obj_Rotlift_reloc.o"
|
||||||
include "build/data/ovl_Obj_Rotlift/ovl_Obj_Rotlift.reloc.o"
|
|
||||||
endseg
|
endseg
|
||||||
|
|
||||||
beginseg
|
beginseg
|
||||||
|
|
|
@ -5,17 +5,25 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "z_obj_rotlift.h"
|
#include "z_obj_rotlift.h"
|
||||||
|
#include "objects/object_rotlift/object_rotlift.h"
|
||||||
|
|
||||||
#define FLAGS 0x00000000
|
#define FLAGS 0x00000000
|
||||||
|
|
||||||
#define THIS ((ObjRotlift*)thisx)
|
#define THIS ((ObjRotlift*)thisx)
|
||||||
|
|
||||||
void ObjRotlift_Init(Actor* thisx, GlobalContext* globalCtx);
|
void ObjRotlift_Init(Actor* thisx, GlobalContext* globalCtx2);
|
||||||
void ObjRotlift_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
void ObjRotlift_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||||
void ObjRotlift_Update(Actor* thisx, GlobalContext* globalCtx);
|
void ObjRotlift_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||||
void ObjRotlift_Draw(Actor* thisx, GlobalContext* globalCtx);
|
void ObjRotlift_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||||
|
|
||||||
#if 0
|
void ObjRotlift_MoveDekuFlowers(ObjRotlift* this);
|
||||||
|
|
||||||
|
typedef struct ModelInfo {
|
||||||
|
/* 0x0 */ Gfx* dList;
|
||||||
|
/* 0x4 */ AnimatedMaterial* animMat;
|
||||||
|
/* 0x8 */ CollisionHeader* colHeader;
|
||||||
|
} ModelInfo; // size = 0xC
|
||||||
|
|
||||||
const ActorInit Obj_Rotlift_InitVars = {
|
const ActorInit Obj_Rotlift_InitVars = {
|
||||||
ACTOR_OBJ_ROTLIFT,
|
ACTOR_OBJ_ROTLIFT,
|
||||||
ACTORCAT_BG,
|
ACTORCAT_BG,
|
||||||
|
@ -28,24 +36,107 @@ const ActorInit Obj_Rotlift_InitVars = {
|
||||||
(ActorFunc)ObjRotlift_Draw,
|
(ActorFunc)ObjRotlift_Draw,
|
||||||
};
|
};
|
||||||
|
|
||||||
// static InitChainEntry sInitChain[] = {
|
struct ModelInfo sModelInfo[] = {
|
||||||
static InitChainEntry D_80B96178[] = {
|
{
|
||||||
|
object_rotlift_DL_000400,
|
||||||
|
object_rotlift_Matanimheader_001F98,
|
||||||
|
&object_rotlift_Colheader_002190,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
object_rotlift_DL_002CE0,
|
||||||
|
object_rotlift_Matanimheader_004A08,
|
||||||
|
&object_rotlift_Colheader_004DF0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static InitChainEntry sInitChain[] = {
|
||||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
|
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
|
||||||
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
|
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
|
||||||
ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE),
|
ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE),
|
||||||
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
|
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
void ObjRotlift_MoveDekuFlowers(ObjRotlift* this) {
|
||||||
|
ObjEtcetera** dekuFlower = this->dekuFlowers;
|
||||||
|
ObjEtcetera* curDekuFlower;
|
||||||
|
f32 posOffset = 300.0f;
|
||||||
|
s32 i;
|
||||||
|
|
||||||
extern InitChainEntry D_80B96178[];
|
for (i = 0; i < ARRAY_COUNT(this->dekuFlowers); i++, dekuFlower++) {
|
||||||
|
curDekuFlower = *dekuFlower;
|
||||||
|
if (curDekuFlower->dyna.actor.update == NULL) {
|
||||||
|
*dekuFlower = NULL;
|
||||||
|
} else {
|
||||||
|
curDekuFlower->dyna.actor.world.pos.x =
|
||||||
|
this->dyna.actor.world.pos.x + posOffset * Math_SinS(this->dyna.actor.shape.rot.y);
|
||||||
|
curDekuFlower->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y + 380.0f * this->dyna.actor.scale.y;
|
||||||
|
curDekuFlower->dyna.actor.world.pos.z =
|
||||||
|
this->dyna.actor.world.pos.z + posOffset * Math_CosS(this->dyna.actor.shape.rot.y);
|
||||||
|
curDekuFlower->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y;
|
||||||
|
}
|
||||||
|
posOffset -= 600.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Rotlift/func_80B95E20.s")
|
void ObjRotlift_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
||||||
|
GlobalContext* globalCtx = globalCtx2;
|
||||||
|
ObjRotlift* this = THIS;
|
||||||
|
s32 type = OBJROTLIFT_GET_TYPE(&this->dyna.actor);
|
||||||
|
s32 dekuFlowerType;
|
||||||
|
s32 i;
|
||||||
|
ModelInfo* modelInfo;
|
||||||
|
ObjEtcetera** dekuFlowers;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Rotlift/ObjRotlift_Init.s")
|
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||||
|
if (type == 0) {
|
||||||
|
for (dekuFlowers = this->dekuFlowers, i = 0; i < ARRAY_COUNT(this->dekuFlowers); i++, dekuFlowers++) {
|
||||||
|
if (!OBJROTLIFT_GET_4000(thisx) || (i != 0)) {
|
||||||
|
dekuFlowerType = 0;
|
||||||
|
} else {
|
||||||
|
dekuFlowerType = 0x100;
|
||||||
|
}
|
||||||
|
*dekuFlowers = (ObjEtcetera*)Actor_SpawnAsChild(
|
||||||
|
&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_OBJ_ETCETERA, this->dyna.actor.world.pos.x,
|
||||||
|
this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x,
|
||||||
|
this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, dekuFlowerType);
|
||||||
|
}
|
||||||
|
ObjRotlift_MoveDekuFlowers(this);
|
||||||
|
}
|
||||||
|
DynaPolyActor_Init(&this->dyna, 3);
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Rotlift/ObjRotlift_Destroy.s")
|
modelInfo = &sModelInfo[type];
|
||||||
|
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, modelInfo->colHeader);
|
||||||
|
modelInfo->animMat = Lib_SegmentedToVirtual(modelInfo->animMat);
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Rotlift/ObjRotlift_Update.s")
|
void ObjRotlift_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
|
ObjRotlift* this = THIS;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Rotlift/ObjRotlift_Draw.s")
|
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjRotlift_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
|
ObjRotlift* this = THIS;
|
||||||
|
s16 angShift;
|
||||||
|
s32 angVelocity;
|
||||||
|
|
||||||
|
if (OBJROTLIFT_GET_TYPE(&this->dyna.actor) == 0) {
|
||||||
|
ObjRotlift_MoveDekuFlowers(this);
|
||||||
|
}
|
||||||
|
if (thisx->params >= 0) {
|
||||||
|
angVelocity = -0xC8;
|
||||||
|
} else {
|
||||||
|
angVelocity = 0xC8;
|
||||||
|
}
|
||||||
|
angShift = angVelocity;
|
||||||
|
this->dyna.actor.shape.rot.y += angShift;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjRotlift_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
|
s32 pad;
|
||||||
|
ObjRotlift* this = THIS;
|
||||||
|
ModelInfo* modelInfo = &sModelInfo[OBJROTLIFT_GET_TYPE(&this->dyna.actor)];
|
||||||
|
|
||||||
|
AnimatedMat_Draw(globalCtx, modelInfo->animMat);
|
||||||
|
Gfx_DrawDListOpa(globalCtx, modelInfo->dList);
|
||||||
|
}
|
||||||
|
|
|
@ -3,11 +3,16 @@
|
||||||
|
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
|
#include "overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h"
|
||||||
|
|
||||||
|
#define OBJROTLIFT_GET_TYPE(thisx) ((thisx)->params & 1)
|
||||||
|
#define OBJROTLIFT_GET_4000(thisx) ((thisx)->params & 0x4000)
|
||||||
|
|
||||||
struct ObjRotlift;
|
struct ObjRotlift;
|
||||||
|
|
||||||
typedef struct ObjRotlift {
|
typedef struct ObjRotlift {
|
||||||
/* 0x000 */ Actor actor;
|
/* 0x000 */ DynaPolyActor dyna;
|
||||||
/* 0x144 */ char unk_144[0x20];
|
/* 0x15C */ ObjEtcetera* dekuFlowers[2];
|
||||||
} ObjRotlift; // size = 0x164
|
} ObjRotlift; // size = 0x164
|
||||||
|
|
||||||
extern const ActorInit Obj_Rotlift_InitVars;
|
extern const ActorInit Obj_Rotlift_InitVars;
|
||||||
|
|
Loading…
Reference in New Issue