1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 04:24:43 +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

@ -0,0 +1,88 @@
<Root>
<File Name="object_zo" Segment="6">
<Skeleton Name="gZoraSkel" Type="Flex" LimbType="Standard" Offset="0xBFA8"/>
<Limb Name="gZoraPelvisLimb" LimbType="Standard" Offset="0xBE78"/>
<DList Name="gZoraPelvisDL" Offset="0x9040"/>
<!-- Left leg -->
<Limb Name="gZoraLeftThighsLimb" LimbType="Standard" Offset="0xBE84"/>
<DList Name="gZoraLeftThighsDL" Offset="0xB5F8"/>
<Limb Name="gZoraLeftShinLimb" LimbType="Standard" Offset="0xBE90"/>
<DList Name="gZoraLeftShinDL" Offset="0xB8D8"/>
<Limb Name="gZoraLeftFootLimb" LimbType="Standard" Offset="0xBE9C"/>
<DList Name="gZoraLeftFootDL" Offset="0xBBB0"/>
<!-- Right leg -->
<Limb Name="gZoraRightThighsLimb" LimbType="Standard" Offset="0xBEA8"/>
<DList Name="gZoraRightThighsDL" Offset="0xAD78"/>
<Limb Name="gZoraRightShinLimb" LimbType="Standard" Offset="0xBEB4"/>
<DList Name="gZoraRightShinDL" Offset="0xB058"/>
<Limb Name="gZoraRightFootLimb" LimbType="Standard" Offset="0xBEC0"/>
<DList Name="gZoraRightFootDL" Offset="0xB330"/>
<Limb Name="gZoraTorsoLimb" LimbType="Standard" Offset="0xBECC"/>
<DList Name="gZoraTorsoDL" Offset="0x91E8"/>
<!-- Left arm -->
<Limb Name="gZoraLeftArmLimb" LimbType="Standard" Offset="0xBED8"/>
<DList Name="gZoraLeftArmDL" Offset="0xA630"/>
<Limb Name="gZoraLeftForearmLimb" LimbType="Standard" Offset="0xBEE4"/>
<DList Name="gZoraLeftForearmDL" Offset="0xA890"/>
<Limb Name="gZoraLeftHandLimb" LimbType="Standard" Offset="0xBEF0"/>
<DList Name="gZoraLeftHandDL" Offset="0xAB70"/>
<!-- Right arm -->
<Limb Name="gZoraRightArmLimb" LimbType="Standard" Offset="0xBEFC"/>
<DList Name="gZoraRightArmDL" Offset="0x9EE8"/>
<Limb Name="gZoraRightForearmLimb" LimbType="Standard" Offset="0xBF08"/>
<DList Name="gZoraRightForearmDL" Offset="0xA148"/>
<Limb Name="gZoraRightHandLimb" LimbType="Standard" Offset="0xBF14"/>
<DList Name="gZoraRightHandDL" Offset="0xA428"/>
<!-- Head and head tail -->
<Limb Name="gZoraHeadLimb" LimbType="Standard" Offset="0xBF20"/>
<DList Name="gZoraHeadDL" Offset="0x9560"/>
<Limb Name="gZoraHeadTail1Limb" LimbType="Standard" Offset="0xBF2C"/>
<DList Name="gZoraHeadTail1DL" Offset="0x97D8"/>
<Limb Name="gZoraHeadTail2Limb" LimbType="Standard" Offset="0xBF38"/>
<DList Name="gZoraHeadTail2DL" Offset="0x9978"/>
<Limb Name="gZoraHeadTail3Limb" LimbType="Standard" Offset="0xBF44"/>
<DList Name="gZoraHeadTail3DL" Offset="0x9B10"/>
<Limb Name="gZoraHeadTailFinLimb" LimbType="Standard" Offset="0xBF50"/>
<DList Name="gZoraHeadTailFinDL" Offset="0x9CA8"/>
<Animation Name="gZoraIdleAnim" Offset="0x2FE8"/>
<Animation Name="gZoraSurfaceAnim" Offset="0x2F10"/>
<Animation Name="gZoraThrowRupeesAnim" Offset="0x219C"/>
<Animation Name="gZoraHandsOnHipsTappingFootAnim" Offset="0x598"/>
<Animation Name="gZoraOpenArmsAnim" Offset="0xD48"/>
<!-- Eyes textures -->
<Texture Name="gZoraEyeOpenTex" OutName="eye_open" Format="rgb5a1" Width="32" Height="32" Offset="0x3E40"/>
<Texture Name="gZoraEyeHalfTex" OutName="eye_half" Format="rgb5a1" Width="32" Height="32" Offset="0x4640"/>
<Texture Name="gZoraEyeClosedTex" OutName="eye_closed" Format="rgb5a1" Width="32" Height="32" Offset="0x4E40"/>
<!-- Other body parts textures -->
<Texture Name="gZoraMouthTex" OutName="mouth" Format="rgb5a1" Width="32" Height="32" Offset="0x5640"/>
<Texture Name="gZoraHeadTailTex" OutName="head_tail" Format="ci8" Width="32" Height="64" Offset="0x3600"/>
<Texture Name="gZoraHandTex" OutName="hand" Format="ci8" Width="16" Height="16" Offset="0x5E40"/>
<Texture Name="gZoraKneeTex" OutName="knee" Format="ci8" Width="8" Height="8" Offset="0x5F40"/>
<Texture Name="gZoraHeadTex" OutName="head" Format="ci8" Width="8" Height="8" Offset="0x3E00"/>
<Texture Name="gZoraFinTex" OutName="fin" Format="ci8" Width="32" Height="32" Offset="0x3200"/>
<!-- Palette / Tlut -->
<Texture Name="gZoraTLUT" OutName="tlut" Format="rgb5a1" Width="16" Height="16" Offset="0x3000"/>
<Texture Name="gZoraBubblesTex" OutName="bubbles" Format="ia8" Width="16" Height="16" Offset="0x21B0"/>
<DList Name="gZoraBubblesVisualDL" Offset="0x22F0"/>
<DList Name="gZoraBubblesGeometryDL" Offset="0x2350"/>
<Texture Name="gZoraSplashesTex" OutName="splashes" Format="i8" Width="16" Height="16" Offset="0x2370"/>
<DList Name="gZoraSplashesVisualDL" Offset="0x24A0"/>
<DList Name="gZoraSplashesGeometryDL" Offset="0x2510"/>
<DList Name="gZoraRipplesVisualDL" Offset="0xBFC0"/>
<DList Name="gZoraRipplesGeometryDL" Offset="0xC028"/>
</File>
</Root>

View File

@ -2267,12 +2267,16 @@ void func_800F47FC(void);
void func_800F483C(UNK_TYPE arg0, UNK_TYPE arg1);
void func_800F4870(u8);
// ? func_800F491C(?);
void func_800F4A54(u8);
// ? func_800F4A70(?);
void func_800F4BF4(Vec3f*, u16 sfxId, s8);
void func_800F4C58(Vec3f*, u16 sfxId, u8);
void func_800F4E30(Vec3f*, f32);
// ? func_800F50CC(?);
void func_800F50EC(Vec3f*);
// ? func_800F510C(?);
void func_800F52A0(Vec3f*, u16, u16);
void func_800F5504();
// ? func_800F5510(?);
// ? func_800F5550(?);
// ? func_800F56A8(?);
@ -2311,7 +2315,7 @@ void func_800F6C14();
// ? func_800F6C34(?);
void func_800F6D58(u8, u8, u8);
// ? func_800F6E7C(?);
// ? func_800F6FB4(?);
void func_800F6FB4(u8);
void func_800F70F8();
void func_800F711C();
// ? func_800F7170(?);

3
spec
View File

@ -4940,7 +4940,8 @@ endseg
beginseg
name "object_zo"
romalign 0x1000
include "build/baserom/object_zo.o"
include "build/assets/objects/object_zo/object_zo.o"
number 6
endseg
beginseg

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);

0
tools/xmlcreate.py Normal file → Executable file
View File

View File

@ -954,11 +954,6 @@ D_060009E0 = 0x060009E0;
D_06000660 = 0x06000660;
D_06000FC0 = 0x06000FC0;
// z_en_diving_game
D_0600BFA8 = 0x0600BFA8;
D_06002FE8 = 0x06002FE8;
D_0600219C = 0x0600219C;
// z_en_poh
D_060001A8 = 0x060001A8;
D_0600020C = 0x0600020C;
@ -2395,17 +2390,6 @@ D_0601B874 = 0x0601B874;
D_0601BCF0 = 0x0601BCF0;
D_0601CE08 = 0x0601CE08;
// z_en_zo
D_06000598 = 0x06000598;
D_06000D48 = 0x06000D48;
D_060022F0 = 0x060022F0;
D_06002350 = 0x06002350;
D_060024A0 = 0x060024A0;
D_06002510 = 0x06002510;
D_0600BFA8 = 0x0600BFA8;
D_0600BFC0 = 0x0600BFC0;
D_0600C028 = 0x0600C028;
// z_fishing
D_0600007C = 0x0600007C;
D_060029C0 = 0x060029C0;