1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 14:20:11 +00:00

Decompile object_zo 🐬 (#794)

* Initial xml

* most of in-code references

* Add limbs and evrything else

* Functions used by EnRiverSound

* Fix forearm and use void* for textures

* Run formatter
This commit is contained in:
Anghelo Carvajal 2021-04-30 19:55:52 -04:00 committed by GitHub
parent 0432011bd9
commit 722017814d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 137 additions and 64 deletions

View file

@ -1,4 +1,11 @@
/*
* File: z_demo_ec.c
* Overlay: ovl_Demo_Ec
* Description: Credits revelers in Lon Lon
*/
#include "z_demo_ec.h"
#include "objects/object_zo/object_zo.h"
#include "vt.h"
#define FLAGS 0x00000010
@ -751,7 +758,7 @@ void DemoEc_DrawGerudo(DemoEc* this, GlobalContext* globalCtx) {
void DemoEc_InitDancingZora(DemoEc* this, GlobalContext* globalCtx) {
DemoEc_UseDrawObject(this, globalCtx);
DemoEc_InitSkelAnime(this, globalCtx, &D_0600BFA8);
DemoEc_InitSkelAnime(this, globalCtx, &gZoraSkel);
DemoEc_UseAnimationObject(this, globalCtx);
DemoEc_ChangeAnimation(this, &D_0600C918, 0, 0.0f, false);
func_8096D5D4(this, globalCtx);
@ -768,7 +775,7 @@ void DemoEc_UpdateDancingZora(DemoEc* this, GlobalContext* globalCtx) {
}
void DemoEc_DrawDancingZora(DemoEc* this, GlobalContext* globalCtx) {
static void* eyeTextures[] = { 0x06003E40, 0x06004640, 0x06004E40 };
static void* eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex };
s32 eyeTexIndex = this->eyeTexIndex;
void* eyeTexture = eyeTextures[eyeTexIndex];

View file

@ -5,8 +5,9 @@
*/
#include "z_en_diving_game.h"
#include "vt.h"
#include "overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h"
#include "objects/object_zo/object_zo.h"
#include "vt.h"
#define FLAGS 0x00000019
@ -70,21 +71,17 @@ static ColliderCylinderInit sCylinderInit = {
};
static u64* sEyeTextures[] = {
0x06003E40,
0x06004640,
0x06004E40,
gZoraEyeOpenTex,
gZoraEyeHalfTex,
gZoraEyeClosedTex,
};
extern FlexSkeletonHeader D_0600BFA8;
extern AnimationHeader D_06002FE8; // Stand/static.
extern AnimationHeader D_0600219C; // Throw rupees animation.
void EnDivingGame_Init(Actor* thisx, GlobalContext* globalCtx) {
EnDivingGame* this = THIS;
this->actor.gravity = -3.0f;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600BFA8, &D_06002FE8, this->jointTable, this->morphTable, 20);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 素もぐりGO ☆☆☆☆☆ \n" VT_RST);
@ -178,9 +175,9 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, GlobalContext* globalCt
// EnDivingGame_FinishMinigame ? // Reset probably
void func_809EDCB0(EnDivingGame* this, GlobalContext* globalCtx) {
f32 frameCount = Animation_GetLastFrame(&D_06002FE8);
f32 frameCount = Animation_GetLastFrame(&gZoraIdleAnim);
Animation_Change(&this->skelAnime, &D_06002FE8, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
Animation_Change(&this->skelAnime, &gZoraIdleAnim, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->notPlayingMinigame = true;
this->actionFunc = EnDivingGame_Talk;
}
@ -283,9 +280,9 @@ void func_809EE048(EnDivingGame* this, GlobalContext* globalCtx) {
// another "start minigame" step
void func_809EE0FC(EnDivingGame* this, GlobalContext* globalCtx) {
f32 frameCount = Animation_GetLastFrame(&D_0600219C);
f32 frameCount = Animation_GetLastFrame(&gZoraThrowRupeesAnim);
Animation_Change(&this->skelAnime, &D_0600219C, 1.0f, 0.0f, (s16)frameCount, 2, -10.0f);
Animation_Change(&this->skelAnime, &gZoraThrowRupeesAnim, 1.0f, 0.0f, (s16)frameCount, 2, -10.0f);
this->notPlayingMinigame = false;
this->actionFunc = func_809EE194;
}

View file

@ -5,6 +5,7 @@
*/
#include "z_en_zo.h"
#include "objects/object_zo/object_zo.h"
#define FLAGS 0x00000009
@ -29,20 +30,6 @@ void EnZo_Surface(EnZo* this, GlobalContext* globalCtx);
void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx);
void EnZo_Dive(EnZo* this, GlobalContext* globalCtx);
extern Gfx D_060022F0[];
extern Gfx D_06002350[];
extern Gfx D_060024A0[];
extern Gfx D_06002510[];
extern Gfx D_0600BFC0[];
extern Gfx D_0600C028[];
extern FlexSkeletonHeader D_0600BFA8;
extern AnimationHeader D_06002FE8;
extern AnimationHeader D_06002F10;
extern AnimationHeader D_0600219C;
extern AnimationHeader D_06000598;
extern AnimationHeader D_06000D48;
void EnZo_Ripple(EnZo* this, Vec3f* pos, f32 scale, f32 targetScale, u8 alpha) {
EnZoEffect* effect;
Vec3f vec = { 0.0f, 0.0f, 0.0f };
@ -198,7 +185,7 @@ void EnZo_DrawRipples(EnZo* this, GlobalContext* globalCtx) {
if (!setup) {
if (1) {}
gDPPipeSync(POLY_XLU_DISP++);
gSPDisplayList(POLY_XLU_DISP++, D_0600BFC0);
gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesVisualDL);
gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0);
setup = true;
}
@ -208,7 +195,7 @@ void EnZo_DrawRipples(EnZo* this, GlobalContext* globalCtx) {
Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 242),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_0600C028);
gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesGeometryDL);
}
effect++;
}
@ -216,11 +203,10 @@ void EnZo_DrawRipples(EnZo* this, GlobalContext* globalCtx) {
}
void EnZo_DrawBubbles(EnZo* this, GlobalContext* globalCtx) {
EnZoEffect* effect;
EnZoEffect* effect = this->effects;
s16 i;
u8 setup;
effect = this->effects;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 260);
setup = false;
func_80093D84(globalCtx->state.gfxCtx);
@ -228,7 +214,7 @@ void EnZo_DrawBubbles(EnZo* this, GlobalContext* globalCtx) {
if (effect->type == ENZO_EFFECT_BUBBLE) {
if (!setup) {
if (1) {}
gSPDisplayList(POLY_XLU_DISP++, D_060022F0);
gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesVisualDL);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 150, 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
@ -242,7 +228,7 @@ void EnZo_DrawBubbles(EnZo* this, GlobalContext* globalCtx) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 281),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_06002350);
gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesGeometryDL);
}
effect++;
}
@ -262,7 +248,7 @@ void EnZo_DrawSplashes(EnZo* this, GlobalContext* globalCtx) {
if (effect->type == ENZO_EFFECT_SPLASH) {
if (!setup) {
if (1) {}
gSPDisplayList(POLY_XLU_DISP++, D_060024A0);
gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesVisualDL);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 200, 0);
setup = true;
@ -275,7 +261,7 @@ void EnZo_DrawSplashes(EnZo* this, GlobalContext* globalCtx) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 325),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, D_06002510);
gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesGeometryDL);
}
effect++;
}
@ -326,10 +312,14 @@ const ActorInit En_Zo_InitVars = {
};
static struct_80034EC0_Entry sAnimations[] = {
{ &D_06002FE8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { &D_06002FE8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f },
{ &D_06002F10, 0.0f, 1.0f, 1.0f, ANIMMODE_ONCE, 0.0f }, { &D_06002F10, 1.0f, 1.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
{ &D_06002F10, 1.0f, 8.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { &D_0600219C, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
{ &D_06000598, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { &D_06000D48, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
{ &gZoraIdleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
{ &gZoraIdleAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f },
{ &gZoraSurfaceAnim, 0.0f, 1.0f, 1.0f, ANIMMODE_ONCE, 0.0f },
{ &gZoraSurfaceAnim, 1.0f, 1.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
{ &gZoraSurfaceAnim, 1.0f, 8.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
{ &gZoraThrowRupeesAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
{ &gZoraHandsOnHipsTappingFootAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
{ &gZoraOpenArmsAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
};
void EnZo_SpawnSplashes(EnZo* this) {
@ -540,7 +530,8 @@ s32 EnZo_PlayerInProximity(EnZo* this, GlobalContext* globalCtx) {
void EnZo_SetAnimation(EnZo* this) {
s32 animId = 8;
if (this->skelAnime.animation == &D_06000598 || this->skelAnime.animation == &D_06000D48) {
if (this->skelAnime.animation == &gZoraHandsOnHipsTappingFootAnim ||
this->skelAnime.animation == &gZoraOpenArmsAnim) {
if (this->unk_194.unk_00 == 0) {
if (this->actionFunc == EnZo_Standing) {
animId = 0;
@ -550,11 +541,12 @@ void EnZo_SetAnimation(EnZo* this) {
}
}
if (this->unk_194.unk_00 != 0 && this->actor.textId == 0x4006 && this->skelAnime.animation != &D_06000598) {
if (this->unk_194.unk_00 != 0 && this->actor.textId == 0x4006 &&
this->skelAnime.animation != &gZoraHandsOnHipsTappingFootAnim) {
animId = 6;
}
if (this->unk_194.unk_00 != 0 && this->actor.textId == 0x4007 && this->skelAnime.animation != &D_06000D48) {
if (this->unk_194.unk_00 != 0 && this->actor.textId == 0x4007 && this->skelAnime.animation != &gZoraOpenArmsAnim) {
animId = 7;
}
@ -571,7 +563,7 @@ void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) {
EnZo* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600BFA8, NULL, this->jointTable, this->morphTable, 20);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInit);
@ -786,7 +778,7 @@ void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnZo* this = THIS;
UNK_PTR eyeTextures[] = { 0x06003E40, 0x06004640, 0x06004E40 };
void* eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex };
Matrix_Push();
EnZo_DrawRipples(this, globalCtx);