mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 14:50:15 +00:00
EnHata OK (#155)
* EnHata OK * made/attempted suggested changes. still havent been able to fix the THIS in Update
This commit is contained in:
parent
53ceea717d
commit
c68d752813
12 changed files with 111 additions and 388 deletions
|
@ -15,7 +15,6 @@ void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EnHata_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnHata_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
const ActorInit En_Hata_InitVars = {
|
||||
ACTOR_EN_HATA,
|
||||
ACTORTYPE_PROP,
|
||||
|
@ -27,15 +26,104 @@ const ActorInit En_Hata_InitVars = {
|
|||
(ActorFunc)EnHata_Update,
|
||||
(ActorFunc)EnHata_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hata/EnHata_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hata/EnHata_Destroy.s")
|
||||
static UNK_TYPE4 sUnusedData[] = {
|
||||
0x0A000939, 0x20010000, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000,
|
||||
0x00050100, 0x001000F6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hata/EnHata_Update.s")
|
||||
static Vec3f sVec = { 0, 0, 0 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hata/func_80A510E4.s")
|
||||
extern AnimationHeader D_06000444;
|
||||
extern SkeletonHeader D_06002FD0;
|
||||
extern UNK_TYPE D_060000C0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hata/func_80A51164.s")
|
||||
void EnHata_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHata* this = THIS;
|
||||
u32 pad;
|
||||
u32 temp;
|
||||
f32 frameCount;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Hata/EnHata_Draw.s")
|
||||
temp = 0;
|
||||
frameCount = (f32)SkelAnime_GetFrameCount(&D_06000444.genericHeader);
|
||||
Actor_SetScale(&this->dyna.actor, 1.0f / 75.0f);
|
||||
SkelAnime_Init(globalCtx, &this->skelAnime, &D_06002FD0, &D_06000444, NULL, NULL, 0);
|
||||
SkelAnime_ChangeAnim(&this->skelAnime, &D_06000444, 1.0f, 0.0f, frameCount, 0, 0.0f);
|
||||
DynaPolyInfo_SetActorMove(&this->dyna, DPM_UNK);
|
||||
DynaPolyInfo_Alloc(&D_060000C0, &temp);
|
||||
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, temp);
|
||||
this->dyna.actor.unk_F8 = 500.0f;
|
||||
this->dyna.actor.unk_FC = 550.0f;
|
||||
this->dyna.actor.unk_F4 = 2200.0f;
|
||||
this->invScale = 6;
|
||||
this->maxStep = 1000;
|
||||
this->minStep = 1;
|
||||
this->unk_278 = (s16)(Math_Rand_ZeroOne() * 65535.0f);
|
||||
}
|
||||
|
||||
void EnHata_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHata* this = THIS;
|
||||
SkelAnime_Free(&this->skelAnime, globalCtx);
|
||||
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
|
||||
}
|
||||
|
||||
void EnHata_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
GlobalContext* gblCtx;
|
||||
s32 target;
|
||||
s32 pitch;
|
||||
Vec3f sp48;
|
||||
Vec3f sp3C;
|
||||
f32 sin;
|
||||
|
||||
sp48 = sVec;
|
||||
SkelAnime_FrameUpdateMatrix(&THIS->skelAnime);
|
||||
gblCtx = globalCtx;
|
||||
THIS->limbs[3].y = THIS->limbs[12].y = -0x4000;
|
||||
sp3C.x = gblCtx->envCtx.unk_A8;
|
||||
sp3C.y = gblCtx->envCtx.unk_AA;
|
||||
sp3C.z = gblCtx->envCtx.unk_AC;
|
||||
if (gblCtx->envCtx.unk_B0 > 255.0f) {
|
||||
gblCtx->envCtx.unk_B0 = 255.0f;
|
||||
}
|
||||
if (gblCtx->envCtx.unk_B0 < 0.0f) {
|
||||
gblCtx->envCtx.unk_B0 = 0.0f;
|
||||
}
|
||||
if (Math_Rand_ZeroOne() > 0.5f) {
|
||||
THIS->unk_278 += 6000;
|
||||
} else {
|
||||
THIS->unk_278 += 3000;
|
||||
}
|
||||
sin = Math_Sins(THIS->unk_278) * 80.0f;
|
||||
pitch = -Math_Vec3f_Pitch(&sp48, &sp3C);
|
||||
target = ((s32)((0x3A98 - pitch) * (1.0f - (gblCtx->envCtx.unk_B0 / (255.0f - sin))))) + pitch;
|
||||
Math_SmoothScaleMaxMinS(&THIS->limbs[4].y, target, THIS->invScale, THIS->maxStep, THIS->minStep);
|
||||
THIS->limbs[13].y = THIS->limbs[4].y;
|
||||
THIS->limbs[4].z = -Math_Vec3f_Yaw(&sp48, &sp3C);
|
||||
THIS->limbs[13].z = THIS->limbs[4].z;
|
||||
THIS->skelAnime.animPlaybackSpeed = (Math_Rand_ZeroFloat(1.25f) + 2.75f) * (gblCtx->envCtx.unk_B0 / 255.0f);
|
||||
}
|
||||
|
||||
s32 EnHata_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
Actor* thisx) {
|
||||
EnHata* this = THIS;
|
||||
Vec3s* limbs;
|
||||
|
||||
if (limbIndex == 12 || limbIndex == 3 || limbIndex == 13 || limbIndex == 4) {
|
||||
limbs = this->limbs;
|
||||
rot->x += limbs[limbIndex].x;
|
||||
rot->y += limbs[limbIndex].y;
|
||||
rot->z += limbs[limbIndex].z;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnHata_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
|
||||
}
|
||||
|
||||
void EnHata_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnHata* this = THIS;
|
||||
func_800943C8(globalCtx->state.gfxCtx);
|
||||
Matrix_Scale(1.0f, 1.1f, 1.0f, MTXMODE_APPLY);
|
||||
SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnHata_OverrideLimbDraw,
|
||||
EnHata_PostLimbDraw, &this->dyna.actor);
|
||||
}
|
||||
|
|
|
@ -4,11 +4,15 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
struct EnHata;
|
||||
|
||||
typedef struct EnHata {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x130];
|
||||
typedef struct {
|
||||
/* 0x0000 */ DynaPolyActor dyna;
|
||||
/* 0x0164 */ SkelAnime skelAnime;
|
||||
/* 0x01A8 */ char unk_1A8[0x4C];
|
||||
/* 0x01F4 */ Vec3s limbs[0x15];
|
||||
/* 0x0272 */ s16 invScale;
|
||||
/* 0x0274 */ s16 maxStep;
|
||||
/* 0x0276 */ s16 minStep;
|
||||
/* 0x0278 */ s16 unk_278;
|
||||
} EnHata; // size = 0x027C
|
||||
|
||||
extern const ActorInit En_Hata_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue