Obj_Hariko (#766)

* Initial decompilation of hariko

* Documented and touched up on ObjHariko header

* Documented Hariko assets and added review suggestions

* Added file comment, shuffled function order

* Added DL suffix to hariko dlists

* Updated hariko body out name to hariko_body
This commit is contained in:
Thomas 2022-03-29 21:13:44 -06:00 committed by GitHub
parent 89ecf74189
commit 33643b9471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 26 deletions

View File

@ -1,8 +1,9 @@
<Root>
<!-- Object for the Clock Town cow statues -->
<File Name="object_hariko" Segment="6">
<DList Name="object_hariko_DL_000080" Offset="0x80" />
<DList Name="object_hariko_DL_000110" Offset="0x110" />
<Texture Name="object_hariko_Tex_0001A0" OutName="tex_0001A0" Format="rgba16" Width="8" Height="8" Offset="0x1A0" />
<Texture Name="object_hariko_Tex_000220" OutName="tex_000220" Format="rgba16" Width="16" Height="16" Offset="0x220" />
<DList Name="gHarikoBodyDL" Offset="0x80" />
<DList Name="gHarikoFaceDL" Offset="0x110" />
<Texture Name="gHarikoBodyTex" OutName="hariko_body" Format="rgba16" Width="8" Height="8" Offset="0x1A0" />
<Texture Name="gHarikoFaceTex" OutName="hariko_face" Format="rgba16" Width="16" Height="16" Offset="0x220" />
</File>
</Root>

3
spec
View File

@ -4092,8 +4092,7 @@ beginseg
name "ovl_Obj_Hariko"
compress
include "build/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.o"
include "build/data/ovl_Obj_Hariko/ovl_Obj_Hariko.data.o"
include "build/data/ovl_Obj_Hariko/ovl_Obj_Hariko.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Hariko/ovl_Obj_Hariko_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_obj_hariko.h"
#include "assets/objects/object_hariko/object_hariko.h"
#define FLAGS (ACTOR_FLAG_20 | ACTOR_FLAG_2000000)
@ -15,10 +16,12 @@ void ObjHariko_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjHariko_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjHariko_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_80B66A90(ObjHariko* this, GlobalContext* globalCtx);
void func_80B66AC4(ObjHariko* this, GlobalContext* globalCtx);
void ObjHariko_SetupWait(ObjHariko* this);
void ObjHariko_Wait(ObjHariko* this, GlobalContext* globalCtx);
void ObjHariko_SetupBobHead(ObjHariko* this);
void ObjHariko_BobHead(ObjHariko* this, GlobalContext* globalCtx);
void ObjHariko_CheckForQuakes(ObjHariko* this);
#if 0
const ActorInit Obj_Hariko_InitVars = {
ACTOR_OBJ_HARIKO,
ACTORCAT_PROP,
@ -31,24 +34,71 @@ const ActorInit Obj_Hariko_InitVars = {
(ActorFunc)ObjHariko_Draw,
};
#endif
void ObjHariko_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjHariko* this = THIS;
extern UNK_TYPE D_06000080;
Actor_SetScale(&this->actor, 0.1f);
this->headRotation.x = 0;
this->headRotation.y = 0;
this->headRotation.z = 0;
this->headOffset = 0;
this->bobbleStep = 0.0f;
ObjHariko_SetupWait(this);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/ObjHariko_Init.s")
void ObjHariko_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/ObjHariko_Destroy.s")
void ObjHariko_SetupWait(ObjHariko* this) {
this->actionFunc = ObjHariko_Wait;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/func_80B66A7C.s")
void ObjHariko_Wait(ObjHariko* this, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/func_80B66A90.s")
void ObjHariko_SetupBobHead(ObjHariko* this) {
this->bobbleStep = 2730.0f;
this->unk154 = 0;
this->actionFunc = ObjHariko_BobHead;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/func_80B66AA0.s")
void ObjHariko_BobHead(ObjHariko* this, GlobalContext* globalCtx) {
this->headOffset += 0x1555;
this->headRotation.x = Math_SinS(this->headOffset) * this->bobbleStep;
this->headRotation.y = Math_CosS(this->headOffset) * this->bobbleStep;
Math_SmoothStepToF(&this->bobbleStep, 0, 0.5f, 18.0f, 18.0f);
if (this->bobbleStep < 182.0f) {
ObjHariko_SetupWait(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/func_80B66AC4.s")
void ObjHariko_CheckForQuakes(ObjHariko* this) {
if (Quake_NumActiveQuakes() != 0) {
ObjHariko_SetupBobHead(this);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/func_80B66B78.s")
void ObjHariko_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjHariko* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/ObjHariko_Update.s")
this->actionFunc(this, globalCtx);
ObjHariko_CheckForQuakes(this);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Hariko/ObjHariko_Draw.s")
void ObjHariko_Draw(Actor* thisx, GlobalContext* globalCtx) {
ObjHariko* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
Matrix_StatePush();
Matrix_InsertXRotation_s(this->headRotation.x, MTXMODE_APPLY);
Matrix_RotateY(this->headRotation.y, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gHarikoBodyDL);
gSPDisplayList(POLY_OPA_DISP++, gHarikoFaceDL);
Matrix_StatePop();
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -10,7 +10,10 @@ typedef void (*ObjHarikoActionFunc)(struct ObjHariko*, GlobalContext*);
typedef struct ObjHariko {
/* 0x0000 */ Actor actor;
/* 0x0144 */ ObjHarikoActionFunc actionFunc;
/* 0x0148 */ char unk_148[0x10];
/* 0x0148 */ f32 bobbleStep;
/* 0x014C */ Vec3s headRotation;
/* 0x0152 */ s16 headOffset;
/* 0x0154 */ s16 unk154; // Set but not used
} ObjHariko; // size = 0x158
extern const ActorInit Obj_Hariko_InitVars;

View File

@ -1652,11 +1652,6 @@ D_06000BA0 = 0x06000BA0;
D_06003FD0 = 0x06003FD0;
D_06004160 = 0x06004160;
// ovl_Obj_Hariko
D_06000080 = 0x06000080;
D_06000110 = 0x06000110;
// ovl_Obj_Jgame_Light
D_060003A0 = 0x060003A0;