mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-14 03:44:34 +00:00
ovl_en_hs2 OK (#423)
* Decompiled ovl_en_hs2 * Replaced skelAnime pointer with pad, changed some values to hex, replaced early return with else statment, removed unnecessary padding in the header, removed unneeded & on a function pointer * Replaced a tab with whitespace, removed address operator in front of ActorShadow_DrawFunc_Circle, moved vec3f inside the PostLimbDraw function * Changed 0xFFFE to ~1
This commit is contained in:
parent
024d5d69bf
commit
7a8e00e49d
17 changed files with 136 additions and 420 deletions
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include "z_en_hs2.h"
|
||||
|
||||
#include <vt.h>
|
||||
|
||||
#define FLAGS 0x00000009
|
||||
|
||||
#define THIS ((EnHs2*)thisx)
|
||||
|
@ -14,8 +16,8 @@ void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnHs2_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHs2_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void func_80A6F1A4(EnHs2* this, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
const ActorInit En_Hs2_InitVars = {
|
||||
ACTOR_EN_HS2,
|
||||
ACTORTYPE_NPC,
|
||||
|
@ -27,25 +29,131 @@ const ActorInit En_Hs2_InitVars = {
|
|||
(ActorFunc)EnHs2_Update,
|
||||
(ActorFunc)EnHs2_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/EnHs2_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/EnHs2_Destroy.s")
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{ COLTYPE_UNK10, 0x00, 0x11, 0x39, 0x10, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x00, 0x01, 0x01 },
|
||||
{ 40, 40, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/func_80A6F0B4.s")
|
||||
extern SkeletonHeader D_06006260;
|
||||
extern AnimationHeader D_060005C0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/func_80A6F164.s")
|
||||
void EnHs2_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHs2* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/func_80A6F1A4.s")
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 36.0f);
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06006260, &D_060005C0, this->limbDrawTable,
|
||||
this->transitionDrawTable, 16);
|
||||
SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060005C0);
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
|
||||
this->actor.colChkInfo.mass = 0xFF;
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
osSyncPrintf(VT_FGCOL(CYAN) " ヒヨコの店(子人の時) \n" VT_RST);
|
||||
this->actionFunc = func_80A6F1A4;
|
||||
this->unk_2A8 = 0;
|
||||
this->actor.unk_1F = 6;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/EnHs2_Update.s")
|
||||
void EnHs2_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHs2* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/func_80A6F358.s")
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/func_80A6F390.s")
|
||||
s32 func_80A6F0B4(EnHs2* this, GlobalContext* globalCtx, u16 textId, EnHs2ActionFunc actionFunc) {
|
||||
if (func_8002F194(&this->actor, globalCtx)) {
|
||||
this->actionFunc = actionFunc;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/func_80A6F3C8.s")
|
||||
this->actor.textId = textId;
|
||||
if (ABS((s16)(this->actor.yawTowardsLink - this->actor.shape.rot.y)) < 0x2151 &&
|
||||
this->actor.xzDistFromLink < 100.0f) {
|
||||
this->unk_2A8 |= 0x1;
|
||||
func_8002F2CC(&this->actor, globalCtx, 100.0f);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/func_80A6F3E0.s")
|
||||
void func_80A6F164(EnHs2* this, GlobalContext* globalCtx) {
|
||||
if (func_8002F334(&this->actor, globalCtx)) {
|
||||
this->actionFunc = func_80A6F1A4;
|
||||
}
|
||||
this->unk_2A8 |= 0x1;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hs2/EnHs2_Draw.s")
|
||||
void func_80A6F1A4(EnHs2* this, GlobalContext* globalCtx) {
|
||||
u16 textId;
|
||||
|
||||
textId = Text_GetFaceReaction(globalCtx, 9);
|
||||
if (textId == 0) {
|
||||
textId = 0x5069;
|
||||
}
|
||||
|
||||
func_80A6F0B4(this, globalCtx, textId, func_80A6F164);
|
||||
}
|
||||
|
||||
void EnHs2_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHs2* this = THIS;
|
||||
s32 pad;
|
||||
|
||||
Collider_CylinderUpdate(&this->actor, &this->collider);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
Actor_MoveForward(&this->actor);
|
||||
func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) {
|
||||
this->skelAnime.animCurrentFrame = 0.0f;
|
||||
}
|
||||
this->actionFunc(this, globalCtx);
|
||||
if (this->unk_2A8 & 0x1) {
|
||||
func_80038290(globalCtx, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.posRot2.pos);
|
||||
this->unk_2A8 &= ~1;
|
||||
} else {
|
||||
Math_SmoothScaleMaxMinS(&this->unk_29C.x, 12800, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(&this->unk_29C.y, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(&this->unk_2A2.x, 0, 6, 6200, 100);
|
||||
Math_SmoothScaleMaxMinS(&this->unk_2A2.y, 0, 6, 6200, 100);
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnHs2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* pos, Vec3s* rot, Actor* thisx) {
|
||||
EnHs2* this = THIS;
|
||||
|
||||
switch (limbIndex) {
|
||||
case 12:
|
||||
case 13:
|
||||
*dList = NULL;
|
||||
return 0;
|
||||
case 9:
|
||||
rot->x += this->unk_29C.y;
|
||||
rot->z += this->unk_29C.x;
|
||||
break;
|
||||
case 10:
|
||||
*dList = NULL;
|
||||
return 0;
|
||||
case 11:
|
||||
*dList = NULL;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnHs2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
|
||||
static Vec3f D_80A6F4CC = { 300.0f, 1000.0f, 0.0f };
|
||||
EnHs2* this = THIS;
|
||||
|
||||
if (limbIndex == 9) {
|
||||
Matrix_MultVec3f(&D_80A6F4CC, &this->actor.posRot2.pos);
|
||||
}
|
||||
}
|
||||
|
||||
void EnHs2_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHs2* this = THIS;
|
||||
|
||||
func_800943C8(globalCtx->state.gfxCtx);
|
||||
SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount,
|
||||
EnHs2_OverrideLimbDraw, EnHs2_PostLimbDraw, &this->actor);
|
||||
}
|
||||
|
|
|
@ -6,9 +6,18 @@
|
|||
|
||||
struct EnHs2;
|
||||
|
||||
typedef void (*EnHs2ActionFunc)(struct EnHs2*, GlobalContext*);
|
||||
|
||||
typedef struct EnHs2 {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x164];
|
||||
/* 0x014C */ ColliderCylinder collider;
|
||||
/* 0x0198 */ SkelAnime skelAnime;
|
||||
/* 0x01DC */ Vec3s limbDrawTable[16];
|
||||
/* 0x023C */ Vec3s transitionDrawTable[16];
|
||||
/* 0x029C */ Vec3s unk_29C;
|
||||
/* 0x02A2 */ Vec3s unk_2A2;
|
||||
/* 0x02A8 */ u16 unk_2A8;
|
||||
/* 0x02AC */ EnHs2ActionFunc actionFunc;
|
||||
} EnHs2; // size = 0x02B0
|
||||
|
||||
extern const ActorInit En_Hs2_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue