mirror of https://github.com/zeldaret/mm.git
ovl_Obj_Yasi (#719)
* parking * z_obj_yasi successfully decompiled and matched * removed commented code. * more cleanup.. * Code Styling changes. * Swapped to use BINANG_SUB macro. * Formatting. * addressing PR comments * formatting
This commit is contained in:
parent
fa8c723da8
commit
ad9e6e2ae5
3
spec
3
spec
|
@ -4504,8 +4504,7 @@ beginseg
|
|||
name "ovl_Obj_Yasi"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Obj_Yasi/z_obj_yasi.o"
|
||||
include "build/data/ovl_Obj_Yasi/ovl_Obj_Yasi.data.o"
|
||||
include "build/data/ovl_Obj_Yasi/ovl_Obj_Yasi.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Obj_Yasi/ovl_Obj_Yasi_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
@ -5,17 +5,19 @@
|
|||
*/
|
||||
|
||||
#include "z_obj_yasi.h"
|
||||
#include "objects/object_obj_yasi/object_obj_yasi.h"
|
||||
|
||||
#define FLAGS 0x00000000
|
||||
|
||||
#define THIS ((ObjYasi*)thisx)
|
||||
|
||||
#define CAN_DROP_NUT(thisx) (thisx->params < 0)
|
||||
|
||||
void ObjYasi_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjYasi_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjYasi_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjYasi_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
#if 0
|
||||
const ActorInit Obj_Yasi_InitVars = {
|
||||
ACTOR_OBJ_YASI,
|
||||
ACTORCAT_PROP,
|
||||
|
@ -28,25 +30,72 @@ const ActorInit Obj_Yasi_InitVars = {
|
|||
(ActorFunc)ObjYasi_Draw,
|
||||
};
|
||||
|
||||
// static InitChainEntry sInitChain[] = {
|
||||
static InitChainEntry D_80BB4D90[] = {
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneScale, 400, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#endif
|
||||
void ObjYasi_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjYasi* this = THIS;
|
||||
|
||||
extern InitChainEntry D_80BB4D90[];
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_obj_yasi_Colheader_001428);
|
||||
|
||||
extern UNK_TYPE D_06000360;
|
||||
extern UNK_TYPE D_06001428;
|
||||
this->dyna.actor.home.rot.y = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Yasi/ObjYasi_Init.s")
|
||||
if (OBJYASI_IS_WIDE(thisx)) {
|
||||
this->dyna.actor.scale.x = 0.2f;
|
||||
this->dyna.actor.scale.z = 0.2f;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Yasi/ObjYasi_Destroy.s")
|
||||
void ObjYasi_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjYasi* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Yasi/ObjYasi_Update.s")
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Yasi/ObjYasi_Draw.s")
|
||||
void ObjYasi_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjYasi* this = THIS;
|
||||
s16 temp;
|
||||
Vec3f dropPos;
|
||||
|
||||
if (this->dyna.actor.home.rot.z != 0) {
|
||||
if (CAN_DROP_NUT(thisx)) {
|
||||
if (Rand_ZeroOne() < 0.5f) {
|
||||
dropPos.x = this->dyna.actor.world.pos.x;
|
||||
dropPos.y = this->dyna.actor.world.pos.y + 280.0f;
|
||||
dropPos.z = this->dyna.actor.world.pos.z;
|
||||
Item_DropCollectible(globalCtx, &dropPos, ITEM00_NUTS_1);
|
||||
}
|
||||
}
|
||||
this->dyna.actor.home.rot.y = GET_PLAYER(globalCtx)->actor.shape.rot.y;
|
||||
this->dyna.actor.home.rot.x = 400;
|
||||
this->dyna.actor.home.rot.z = 0;
|
||||
}
|
||||
temp = (s16)(this->dyna.actor.shape.rot.x * 0.1f);
|
||||
this->dyna.actor.home.rot.x -= temp;
|
||||
this->dyna.actor.shape.rot.x +=
|
||||
BINANG_SUB(this->dyna.actor.home.rot.x, (s16)(this->dyna.actor.shape.rot.x * 0.08f));
|
||||
}
|
||||
|
||||
void ObjYasi_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjYasi* this = THIS;
|
||||
|
||||
Matrix_InsertTranslation(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
|
||||
MTXMODE_NEW);
|
||||
|
||||
if (this->dyna.actor.shape.rot.x != 0) {
|
||||
Matrix_RotateY(this->dyna.actor.home.rot.y, MTXMODE_APPLY);
|
||||
Matrix_InsertXRotation_s(this->dyna.actor.shape.rot.x, MTXMODE_APPLY);
|
||||
Matrix_RotateY(BINANG_SUB(this->dyna.actor.shape.rot.y, this->dyna.actor.home.rot.y), MTXMODE_APPLY);
|
||||
} else {
|
||||
Matrix_RotateY(this->dyna.actor.shape.rot.y, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
|
||||
Gfx_DrawDListOpa(globalCtx, object_obj_yasi_DL_000360);
|
||||
}
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
struct ObjYasi;
|
||||
|
||||
typedef struct ObjYasi {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x18];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
} ObjYasi; // size = 0x15C
|
||||
|
||||
extern const ActorInit Obj_Yasi_InitVars;
|
||||
|
||||
#define OBJYASI_IS_WIDE(thisx) ((thisx)->params & 1)
|
||||
|
||||
#endif // Z_OBJ_YASI_H
|
||||
|
|
|
@ -1965,11 +1965,6 @@ D_06000F80 = 0x06000F80;
|
|||
D_06001680 = 0x06001680;
|
||||
D_060019B0 = 0x060019B0;
|
||||
|
||||
// ovl_Obj_Yasi
|
||||
|
||||
D_06000360 = 0x06000360;
|
||||
D_06001428 = 0x06001428;
|
||||
|
||||
// ovl_player_actor
|
||||
|
||||
D_06008860 = 0x06008860;
|
||||
|
|
Loading…
Reference in New Issue