EnZo OK and documented (#503)

* EnZo OK, sort of documented

* fix variable naming

* fix suspicious match, add -ing to `PlayWalkSound`

* name `FollowPath`, waypoint struct member

* update description to say unused

* name `TreadWater`, fix a snake case i missed

* name `Walk`

* cleanup a bit

* address comments

pointers -> symbols, remove static and array length, inline data,
define var on same line, update file description, use ARRAY_COUNT

* space things out, move data, add ENZO_NO_PATH

* fix ENZO_NO_PATH define

* remove array pad, dec for size, thisx in limbdraw, renames in draw

* name some object_zo stuff, use symbols

* funny single member damage enum

* name textures

* name the rest of the used items in object_zo

* name the dlist

* suggestions

* actually fix the return false

* formatting
This commit is contained in:
LtPeriwinkle 2022-01-30 13:09:17 -08:00 committed by GitHub
parent 35d8154ef0
commit 4460d086d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 413 additions and 152 deletions

View File

@ -1,67 +1,67 @@
<Root>
<File Name="object_zo" Segment="6">
<Animation Name="object_zo_Anim_000598" Offset="0x598" />
<Animation Name="object_zo_Anim_000D48" Offset="0xD48" />
<Animation Name="object_zo_Anim_00219C" Offset="0x219C" />
<Animation Name="object_zo_Anim_002898" Offset="0x2898" />
<Texture Name="object_zo_Tex_0028B0" OutName="tex_0028B0" Format="ia8" Width="16" Height="16" Offset="0x28B0" />
<Animation Name="gZoraHandsOnHipsTappingFootAnim" Offset="0x598" />
<Animation Name="gZoraArmsOpenAnim" Offset="0xD48" />
<Animation Name="gZoraThrowRupeeAnim" Offset="0x219C" />
<Animation Name="gZoraWalkAnim" Offset="0x2898" />
<Texture Name="gZoraBubbleTex" OutName="bubble" Format="ia8" Width="16" Height="16" Offset="0x28B0" />
<DList Name="object_zo_DL_0029F0" Offset="0x29F0" />
<DList Name="object_zo_DL_002A50" Offset="0x2A50" />
<Texture Name="object_zo_Tex_002A70" OutName="tex_002A70" Format="i8" Width="16" Height="16" Offset="0x2A70" />
<Texture Name="gZoraSplashTex" OutName="splash" Format="i8" Width="16" Height="16" Offset="0x2A70" />
<DList Name="object_zo_DL_002BA0" Offset="0x2BA0" />
<DList Name="object_zo_DL_002C10" Offset="0x2C10" />
<Animation Name="object_zo_Anim_003610" Offset="0x3610" />
<Animation Name="gZoraSurfacingAnim" Offset="0x3610" />
<Animation Name="object_zo_Anim_004168" Offset="0x4168" />
<Animation Name="object_zo_Anim_004248" Offset="0x4248" />
<Texture Name="object_zo_TLUT_004260" OutName="tlut_004260" Format="rgba16" Width="16" Height="16" Offset="0x4260" />
<Texture Name="object_zo_Tex_004460" OutName="tex_004460" Format="ci8" Width="32" Height="32" Offset="0x4460" />
<Texture Name="object_zo_Tex_004860" OutName="tex_004860" Format="ci8" Width="32" Height="64" Offset="0x4860" />
<Animation Name="gZoraIdleAnim" Offset="0x4248" />
<Texture Name="gZoraTLUT" OutName="tlut" Format="rgba16" Width="16" Height="16" Offset="0x4260" />
<Texture Name="gZoraFinTex" OutName="fin" Format="ci8" Width="32" Height="32" Offset="0x4460" />
<Texture Name="gZoraBackAndHeadTailTex" OutName="back_head_tail" Format="ci8" Width="32" Height="64" Offset="0x4860" />
<Texture Name="object_zo_Tex_005060" OutName="tex_005060" Format="ci8" Width="8" Height="8" Offset="0x5060" />
<Texture Name="object_zo_Tex_0050A0" OutName="tex_0050A0" Format="rgba16" Width="32" Height="32" Offset="0x50A0" />
<Texture Name="object_zo_Tex_0058A0" OutName="tex_0058A0" Format="rgba16" Width="32" Height="32" Offset="0x58A0" />
<Texture Name="object_zo_Tex_0060A0" OutName="tex_0060A0" Format="rgba16" Width="32" Height="32" Offset="0x60A0" />
<Texture Name="object_zo_Tex_0068A0" OutName="tex_0068A0" Format="rgba16" Width="32" Height="32" Offset="0x68A0" />
<Texture Name="object_zo_Tex_0070A0" OutName="tex_0070A0" Format="ci8" Width="16" Height="16" Offset="0x70A0" />
<Texture Name="object_zo_Tex_0071A0" OutName="tex_0071A0" Format="ci8" Width="8" Height="8" Offset="0x71A0" />
<DList Name="object_zo_DL_00A2A0" Offset="0xA2A0" />
<DList Name="object_zo_DL_00A448" Offset="0xA448" />
<DList Name="object_zo_DL_00A7C0" Offset="0xA7C0" />
<DList Name="object_zo_DL_00AA38" Offset="0xAA38" />
<DList Name="object_zo_DL_00ABD8" Offset="0xABD8" />
<DList Name="object_zo_DL_00AD70" Offset="0xAD70" />
<DList Name="object_zo_DL_00AF08" Offset="0xAF08" />
<DList Name="object_zo_DL_00B148" Offset="0xB148" />
<DList Name="object_zo_DL_00B3A8" Offset="0xB3A8" />
<DList Name="object_zo_DL_00B688" Offset="0xB688" />
<DList Name="object_zo_DL_00B890" Offset="0xB890" />
<DList Name="object_zo_DL_00BAF0" Offset="0xBAF0" />
<DList Name="object_zo_DL_00BDD0" Offset="0xBDD0" />
<DList Name="object_zo_DL_00BFD8" Offset="0xBFD8" />
<DList Name="object_zo_DL_00C2B8" Offset="0xC2B8" />
<DList Name="object_zo_DL_00C590" Offset="0xC590" />
<DList Name="object_zo_DL_00C858" Offset="0xC858" />
<DList Name="object_zo_DL_00CB38" Offset="0xCB38" />
<DList Name="object_zo_DL_00CE10" Offset="0xCE10" />
<Limb Name="object_zo_Standardlimb_00D0D8" Type="Standard" Offset="0xD0D8" />
<Limb Name="object_zo_Standardlimb_00D0E4" Type="Standard" Offset="0xD0E4" />
<Limb Name="object_zo_Standardlimb_00D0F0" Type="Standard" Offset="0xD0F0" />
<Limb Name="object_zo_Standardlimb_00D0FC" Type="Standard" Offset="0xD0FC" />
<Limb Name="object_zo_Standardlimb_00D108" Type="Standard" Offset="0xD108" />
<Limb Name="object_zo_Standardlimb_00D114" Type="Standard" Offset="0xD114" />
<Limb Name="object_zo_Standardlimb_00D120" Type="Standard" Offset="0xD120" />
<Limb Name="object_zo_Standardlimb_00D12C" Type="Standard" Offset="0xD12C" />
<Limb Name="object_zo_Standardlimb_00D138" Type="Standard" Offset="0xD138" />
<Limb Name="object_zo_Standardlimb_00D144" Type="Standard" Offset="0xD144" />
<Limb Name="object_zo_Standardlimb_00D150" Type="Standard" Offset="0xD150" />
<Limb Name="object_zo_Standardlimb_00D15C" Type="Standard" Offset="0xD15C" />
<Limb Name="object_zo_Standardlimb_00D168" Type="Standard" Offset="0xD168" />
<Limb Name="object_zo_Standardlimb_00D174" Type="Standard" Offset="0xD174" />
<Limb Name="object_zo_Standardlimb_00D180" Type="Standard" Offset="0xD180" />
<Limb Name="object_zo_Standardlimb_00D18C" Type="Standard" Offset="0xD18C" />
<Limb Name="object_zo_Standardlimb_00D198" Type="Standard" Offset="0xD198" />
<Limb Name="object_zo_Standardlimb_00D1A4" Type="Standard" Offset="0xD1A4" />
<Limb Name="object_zo_Standardlimb_00D1B0" Type="Standard" Offset="0xD1B0" />
<Skeleton Name="object_zo_Skel_00D208" Type="Flex" LimbType="Standard" Offset="0xD208" />
<Texture Name="gZoraEyeOpenTex" OutName="eye_open" Format="rgba16" Width="32" Height="32" Offset="0x50A0" />
<Texture Name="gZoraEyeHalfTex" OutName="eye_half" Format="rgba16" Width="32" Height="32" Offset="0x58A0" />
<Texture Name="gZoraEyeClosedTex" OutName="eye_closed" Format="rgba16" Width="32" Height="32" Offset="0x60A0" />
<Texture Name="gZoraMouthTex" OutName="mouth" Format="rgba16" Width="32" Height="32" Offset="0x68A0" />
<Texture Name="gZoraHandTex" OutName="hand" Format="ci8" Width="16" Height="16" Offset="0x70A0" />
<Texture Name="gZoraKneeTex" OutName="knee" Format="ci8" Width="8" Height="8" Offset="0x71A0" />
<DList Name="gZoraPelvisDL" Offset="0xA2A0" />
<DList Name="gZoraTorsoDL" Offset="0xA448" />
<DList Name="gZoraHeadDL" Offset="0xA7C0" />
<DList Name="gZoraHeadTail1DL" Offset="0xAA38" />
<DList Name="gZoraHeadTail2DL" Offset="0xABD8" />
<DList Name="gZoraHeadTail3DL" Offset="0xAD70" />
<DList Name="gZoraHeadTailFinDL" Offset="0xAF08" />
<DList Name="gZoraRightUpperArmDL" Offset="0xB148" />
<DList Name="gZoraRightForearmDL" Offset="0xB3A8" />
<DList Name="gZoraRightHandDL" Offset="0xB688" />
<DList Name="gZoraLeftUpperArmDL" Offset="0xB890" />
<DList Name="gZoraLeftForearmDL" Offset="0xBAF0" />
<DList Name="gZoraLeftHandDL" Offset="0xBDD0" />
<DList Name="gZoraRightThighDL" Offset="0xBFD8" />
<DList Name="gZoraRightShinDL" Offset="0xC2B8" />
<DList Name="gZoraRightFootDL" Offset="0xC590" />
<DList Name="gZoraLeftThighDL" Offset="0xC858" />
<DList Name="gZoraLeftShinDL" Offset="0xCB38" />
<DList Name="gZoraLeftFootDL" Offset="0xCE10" />
<Limb Name="gZoraPelvisLimb" Type="Standard" Offset="0xD0D8" />
<Limb Name="gZoraLeftThighLimb" Type="Standard" Offset="0xD0E4" />
<Limb Name="gZoraLeftShinLimb" Type="Standard" Offset="0xD0F0" />
<Limb Name="gZoraLeftFootLimb" Type="Standard" Offset="0xD0FC" />
<Limb Name="gZoraRightThighLimb" Type="Standard" Offset="0xD108" />
<Limb Name="gZoraRightShinLimb" Type="Standard" Offset="0xD114" />
<Limb Name="gZoraRightFootLimb" Type="Standard" Offset="0xD120" />
<Limb Name="gZoraTorsoLimb" Type="Standard" Offset="0xD12C" />
<Limb Name="gZoraLeftUpperArmLimb" Type="Standard" Offset="0xD138" />
<Limb Name="gZoraLeftForearmLimb" Type="Standard" Offset="0xD144" />
<Limb Name="gZoraLeftHandLimb" Type="Standard" Offset="0xD150" />
<Limb Name="gZoraRightUpperArmLimb" Type="Standard" Offset="0xD15C" />
<Limb Name="gZoraRightForearmLimb" Type="Standard" Offset="0xD168" />
<Limb Name="gZoraRightHandLimb" Type="Standard" Offset="0xD174" />
<Limb Name="gZoraHeadLimb" Type="Standard" Offset="0xD180" />
<Limb Name="gZoraHeadTail1Limb" Type="Standard" Offset="0xD18C" />
<Limb Name="gZoraHeadTail2Limb" Type="Standard" Offset="0xD198" />
<Limb Name="gZoraHeadTail3Limb" Type="Standard" Offset="0xD1A4" />
<Limb Name="gZoraHeadTailFinLimb" Type="Standard" Offset="0xD1B0" />
<Skeleton Name="gZoraSkel" Type="Flex" LimbType="Standard" Offset="0xD208" />
<DList Name="object_zo_DL_00D220" Offset="0xD220" />
<DList Name="object_zo_DL_00D288" Offset="0xD288" />
<DList Name="object_zo_DL_00D2A0" Offset="0xD2A0" />

3
spec
View File

@ -2223,8 +2223,7 @@ beginseg
name "ovl_En_Zo"
compress
include "build/src/overlays/actors/ovl_En_Zo/z_en_zo.o"
include "build/data/ovl_En_Zo/ovl_En_Zo.data.o"
include "build/data/ovl_En_Zo/ovl_En_Zo.reloc.o"
include "build/src/overlays/actors/ovl_En_Zo/ovl_En_Zo_reloc.o"
endseg
beginseg

View File

@ -1320,8 +1320,7 @@ s32 EnSob1_AreObjectsLoaded(EnSob1* this, GlobalContext* globalCtx) {
}
void EnSob1_InitZoraShopkeeper(EnSob1* this, GlobalContext* globalCtx) {
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zo_Skel_00D208, NULL, this->jointTable, this->morphTable,
20);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20);
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objIndices[2]].segment);
Animation_Change(&this->skelAnime, &object_masterzoora_Anim_00078C, 1.0f, 0.0f,
Animation_GetLastFrame(&object_masterzoora_Anim_00078C), 0, 0.0f);
@ -1623,8 +1622,7 @@ Gfx* EnSob1_EndDList(GraphicsContext* gfxCtx) {
}
void EnSob1_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx) {
static TexturePtr sZoraShopkeeperEyeTextures[] = { object_zo_Tex_0050A0, object_zo_Tex_0058A0,
object_zo_Tex_0060A0 };
static TexturePtr sZoraShopkeeperEyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex };
EnSob1* this = THIS;
s32 pad;
s32 i;

View File

@ -1,10 +1,11 @@
/*
* File: z_en_zo.c
* Overlay: ovl_En_Zo
* Description: Zoras
* Description: Zoras (unused)
*/
#include "z_en_zo.h"
#include "objects/object_zo/object_zo.h"
#define FLAGS 0x00000019
@ -15,12 +16,12 @@ void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnZo_Update(Actor* thisx, GlobalContext* globalCtx);
void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_8099EBD8(EnZo* this, GlobalContext* globalCtx);
void func_8099EC50(EnZo* this, GlobalContext* globalCtx);
void func_8099ED4C(EnZo* this, GlobalContext* globalCtx);
void func_8099EE24(EnZo* this, GlobalContext* globalCtx);
void EnZo_FollowPath(EnZo* this, GlobalContext* globalCtx);
void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx);
void EnZo_DoNothing(EnZo* this, GlobalContext* globalCtx);
typedef enum { ZO_DMG_EFF_NONE } EnZoDamageEffect;
#if 0
const ActorInit En_Zo_InitVars = {
ACTOR_EN_ZO,
ACTORCAT_NPC,
@ -33,86 +34,333 @@ const ActorInit En_Zo_InitVars = {
(ActorFunc)EnZo_Draw,
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_8099F4B0 = {
{ COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
{ ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_HIT0,
AT_NONE,
AC_ON | AC_TYPE_PLAYER,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_1,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK1,
{ 0x00000000, 0x00, 0x00 },
{ 0xF7CFFFFF, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_ON,
},
{ 18, 64, 0, { 0, 0, 0 } },
};
// sColChkInfoInit
static CollisionCheckInfoInit2 D_8099F4DC = { 0, 0, 0, 0, MASS_IMMOVABLE };
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
// static DamageTable sDamageTable = {
static DamageTable D_8099F4E8 = {
/* Deku Nut */ DMG_ENTRY(0, 0x0),
/* Deku Stick */ DMG_ENTRY(0, 0x0),
/* Horse trample */ DMG_ENTRY(0, 0x0),
/* Explosives */ DMG_ENTRY(0, 0x0),
/* Zora boomerang */ DMG_ENTRY(0, 0x0),
/* Normal arrow */ DMG_ENTRY(0, 0x0),
/* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0),
/* Hookshot */ DMG_ENTRY(0, 0x0),
/* Goron punch */ DMG_ENTRY(0, 0x0),
/* Sword */ DMG_ENTRY(0, 0x0),
/* Goron pound */ DMG_ENTRY(0, 0x0),
/* Fire arrow */ DMG_ENTRY(0, 0x0),
/* Ice arrow */ DMG_ENTRY(0, 0x0),
/* Light arrow */ DMG_ENTRY(0, 0x0),
/* Goron spikes */ DMG_ENTRY(0, 0x0),
/* Deku spin */ DMG_ENTRY(0, 0x0),
/* Deku bubble */ DMG_ENTRY(0, 0x0),
/* Deku launch */ DMG_ENTRY(0, 0x0),
/* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0),
/* Zora barrier */ DMG_ENTRY(0, 0x0),
/* Normal shield */ DMG_ENTRY(0, 0x0),
/* Light ray */ DMG_ENTRY(0, 0x0),
/* Thrown object */ DMG_ENTRY(0, 0x0),
/* Zora punch */ DMG_ENTRY(0, 0x0),
/* Spin attack */ DMG_ENTRY(0, 0x0),
/* Sword beam */ DMG_ENTRY(0, 0x0),
/* Normal Roll */ DMG_ENTRY(0, 0x0),
/* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0),
/* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0),
/* Unblockable */ DMG_ENTRY(0, 0x0),
/* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0),
/* Powder Keg */ DMG_ENTRY(0, 0x0),
static DamageTable sDamageTable = {
/* Deku Nut */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Deku Stick */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Horse trample */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Explosives */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Zora boomerang */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Normal arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* UNK_DMG_0x06 */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Hookshot */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Goron punch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Sword */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Goron pound */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Fire arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Ice arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Light arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Goron spikes */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Deku spin */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Deku bubble */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Deku launch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* UNK_DMG_0x12 */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Zora barrier */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Normal shield */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Light ray */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Thrown object */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Zora punch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Spin attack */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Sword beam */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Normal Roll */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* UNK_DMG_0x1B */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* UNK_DMG_0x1C */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Unblockable */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* UNK_DMG_0x1E */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
/* Powder Keg */ DMG_ENTRY(0, ZO_DMG_EFF_NONE),
};
#endif
static ActorAnimationEntryS sAnimations[] = {
{ &gZoraIdleAnim, 1.0f, 0, -1, 0, 0 }, { &gZoraIdleAnim, 1.0f, 0, -1, 0, -4 },
{ &gZoraSurfacingAnim, 1.0f, 0, -1, 0, -4 }, { &gZoraHandsOnHipsTappingFootAnim, 1.0f, 0, -1, 0, -4 },
{ &gZoraArmsOpenAnim, 1.0f, 0, -1, 0, -4 }, { &gZoraThrowRupeeAnim, 1.0f, 0, -1, 0, -4 },
{ &gZoraWalkAnim, 1.0f, 0, -1, 0, -4 },
};
extern ColliderCylinderInit D_8099F4B0;
extern CollisionCheckInfoInit2 D_8099F4DC;
extern DamageTable D_8099F4E8;
s8 D_8099F578[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2, -1, -1, -1, -1 };
s8 D_8099F58C[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 };
u8 D_8099F59C[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
extern UNK_TYPE D_0600D208;
s32 EnZo_SetAnimation(SkelAnime* skelAnime, s16 index) {
s16 frameCount;
s32 didChange = false;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099E790.s")
if ((index >= 0) && (index < ARRAY_COUNT(sAnimations))) {
didChange = true;
frameCount = sAnimations[index].frameCount;
if (frameCount < 0) {
frameCount = Animation_GetLastFrame(sAnimations[index].animationSeg);
}
Animation_Change(skelAnime, sAnimations[index].animationSeg, sAnimations[index].playbackSpeed,
sAnimations[index].frame, frameCount, sAnimations[index].mode,
sAnimations[index].transitionRate);
}
return didChange;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099E858.s")
s32 EnZo_PlayWalkingSound(EnZo* this, GlobalContext* globalCtx) {
u8 leftWasGrounded;
u8 rightWasGrounded;
s32 waterSfxId;
u16 sfxId;
u8 isFootGrounded;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099E96C.s")
leftWasGrounded = this->isLeftFootGrounded;
rightWasGrounded = this->isRightFootGrounded;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099E9E0.s")
if (this->actor.bgCheckFlags & 0x20) {
if (this->actor.depthInWater < 20.0f) {
waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
} else {
waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG;
}
sfxId = waterSfxId + SFX_FLAG;
} else {
sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EA60.s")
this->isLeftFootGrounded = isFootGrounded = func_8013DB90(globalCtx, &this->leftFootPos, -6.0f);
if ((this->isLeftFootGrounded) && (!leftWasGrounded) && (isFootGrounded)) {
Actor_PlaySfxAtPos(&this->actor, sfxId);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EBD8.s")
this->isRightFootGrounded = isFootGrounded = func_8013DB90(globalCtx, &this->rightFootPos, -6.0f);
if ((this->isRightFootGrounded) && (!rightWasGrounded) && (isFootGrounded)) {
Actor_PlaySfxAtPos(&this->actor, sfxId);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EC50.s")
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099ED4C.s")
void EnZo_Blink(EnZo* this, s32 maxEyeIndex) {
if (DECR(this->blinkTimer) == 0) {
this->eyeIndex++;
if (this->eyeIndex >= maxEyeIndex) {
this->eyeIndex = 0;
this->blinkTimer = Rand_S16Offset(30, 30);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EE24.s")
void EnZo_UpdateCollider(EnZo* this, GlobalContext* globalCtx) {
this->collider.dim.pos.x = this->actor.world.pos.x;
this->collider.dim.pos.y = this->actor.world.pos.y;
this->collider.dim.pos.z = this->actor.world.pos.z;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/EnZo_Init.s")
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/EnZo_Destroy.s")
void EnZo_LookAtPlayer(EnZo* this, GlobalContext* globalCtx) {
static u16 D_8099F5AC[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 };
Player* player = GET_PLAYER(globalCtx);
Vec3f focus;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/EnZo_Update.s")
SkelAnime_Update(&this->skelAnime);
if (func_8013D5E8(this->actor.shape.rot.y, 10000, this->actor.yawTowardsPlayer)) {
focus.x = player->actor.world.pos.x;
focus.y = player->bodyPartsPos[7].y + 3.0f;
focus.z = player->actor.world.pos.z;
func_8013D2E0(&focus, &this->actor.focus.pos, &this->actor.shape.rot, &this->headRotTarget, &this->headRot,
&this->upperBodyRot, D_8099F5AC);
} else {
Math_SmoothStepToS(&this->headRotTarget.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->headRotTarget.y, 0, 4, 1000, 1);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EFF4.s")
Math_SmoothStepToS(&this->headRot.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->headRot.y, 0, 4, 1000, 1);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099F15C.s")
Math_SmoothStepToS(&this->upperBodyRot.x, 0, 4, 1000, 1);
Math_SmoothStepToS(&this->upperBodyRot.y, 0, 4, 1000, 1);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/EnZo_Draw.s")
EnZo_Blink(this, 3);
func_8013D9C8(globalCtx, this->limbRotY, this->limbRotZ, 20);
}
void EnZo_Walk(EnZo* this, GlobalContext* globalCtx) {
if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) {
EnZo_SetAnimation(&this->skelAnime, 6);
}
if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) {
this->actionFunc = EnZo_FollowPath;
} else {
this->actionFunc = EnZo_DoNothing;
}
}
void EnZo_FollowPath(EnZo* this, GlobalContext* globalCtx) {
s16 speed;
Vec3f pos;
Math_SmoothStepToF(&this->actor.speedXZ, 1.0f, 0.4f, 1000.0f, 0.0f);
speed = this->actor.speedXZ * 400.0f;
if (func_8013D68C(this->path, this->waypoint, &pos) && func_8013D768(&this->actor, &pos, speed)) {
this->waypoint++;
if (this->waypoint >= this->path->count) {
this->waypoint = 0;
}
}
if (this->actor.depthInWater > 60.0f) {
EnZo_SetAnimation(&this->skelAnime, 1);
this->actionFunc = EnZo_TreadWater;
this->actor.gravity = 0.0f;
this->actor.speedXZ = 0.0f;
}
}
void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) {
f32 targetYVel;
if (this->actor.depthInWater < (sREG(0) + 50.0f)) {
targetYVel = -1.0f;
} else {
targetYVel = 1.0f;
}
Math_ApproachF(&this->actor.velocity.y, targetYVel, (sREG(1) + 18.0f) * 0.01f, (sREG(2) + 12.0f) * 0.01f);
}
void EnZo_DoNothing(EnZo* this, GlobalContext* globalCtx) {
}
void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) {
EnZo* this = THIS;
s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20);
EnZo_SetAnimation(&this->skelAnime, 0);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
this->path = func_8013D648(globalCtx, ENZO_GET_PATH(&this->actor), ENZO_NO_PATH);
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = EnZo_Walk;
this->actor.gravity = -4.0f;
}
void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnZo* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider);
}
void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) {
EnZo* this = THIS;
this->actionFunc(this, globalCtx);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
EnZo_LookAtPlayer(this, globalCtx);
EnZo_PlayWalkingSound(this, globalCtx);
EnZo_UpdateCollider(this, globalCtx);
}
s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx,
Gfx** gfx) {
EnZo* this = THIS;
if (limbIndex == 15) {
Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->headRot.x, MTXMODE_APPLY);
Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 8) {
Matrix_InsertXRotation_s(-this->upperBodyRot.y, MTXMODE_APPLY);
Matrix_InsertZRotation_s(-this->upperBodyRot.x, MTXMODE_APPLY);
}
if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) {
rot->y += (s16)(Math_SinS(this->limbRotY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->limbRotZ[limbIndex]) * 200.0f);
}
return false;
}
void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) {
EnZo* this = THIS;
Vec3f sp30 = { 400.0f, 0.0f, 0.0f };
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
if (D_8099F578[limbIndex] >= 0) {
Matrix_MultiplyVector3fByState(&zeroVec, &this->unk_364[D_8099F578[limbIndex]]);
}
if (limbIndex == 15) {
Matrix_MultiplyVector3fByState(&sp30, &this->actor.focus.pos);
}
if (limbIndex == 4) {
Matrix_MultiplyVector3fByState(&zeroVec, &this->leftFootPos);
}
if (limbIndex == 7) {
Matrix_MultiplyVector3fByState(&zeroVec, &this->rightFootPos);
}
}
static Gfx sTransparencyDlist[] = {
gsDPSetRenderMode(AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
G_RM_FOG_SHADE_A,
AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL |
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)),
gsDPSetAlphaCompare(G_AC_THRESHOLD),
gsSPEndDisplayList(),
};
void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnZo* this = THIS;
s32 i;
u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(u8) * SQ(64));
u8* shadowTexIter;
TexturePtr eyeTextures[] = { &gZoraEyeOpenTex, &gZoraEyeHalfTex, &gZoraEyeClosedTex };
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gDPPipeSync(POLY_OPA_DISP++);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(eyeTextures[this->eyeIndex]));
gSPSegment(POLY_OPA_DISP++, 0x0C, &sTransparencyDlist[2]);
POLY_OPA_DISP =
SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, &this->actor, POLY_OPA_DISP);
Matrix_InsertXRotation_s(0, 0);
for (i = 0, shadowTexIter = shadowTex; i < (s32)sizeof(u8) * SQ(64); i++) {
*shadowTexIter = 0;
shadowTexIter++;
}
for (i = 0; i < 5; i++) {
func_8013CD64(this->unk_364, &this->actor.world.pos, shadowTex, i / 5.0f, 15, D_8099F59C, D_8099F58C);
}
func_8013CF04(&this->actor, &globalCtx->state.gfxCtx, shadowTex);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -7,12 +7,33 @@ struct EnZo;
typedef void (*EnZoActionFunc)(struct EnZo*, GlobalContext*);
#define ENZO_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9)
#define ENZO_NO_PATH 0x3F
typedef struct EnZo {
/* 0x0000 */ Actor actor;
/* 0x0144 */ EnZoActionFunc actionFunc;
/* 0x0148 */ char unk_148[0x2DC];
/* 0x0148 */ SkelAnime skelAnime;
/* 0x0194 */ ColliderCylinder collider;
/* 0x01D8 */ UNK_TYPE1 unk_1D8[0x4];
/* 0x01DC */ Path* path;
/* 0x01E0 */ s16 waypoint;
/* 0x01E4 */ Vec3f leftFootPos;
/* 0x01F0 */ Vec3f rightFootPos;
/* 0x01FC */ u8 isLeftFootGrounded;
/* 0x01FD */ u8 isRightFootGrounded;
/* 0x01FE */ Vec3s jointTable[20];
/* 0x0276 */ Vec3s morphTable[20];
/* 0x02EE */ Vec3s headRotTarget;
/* 0x02F4 */ Vec3s headRot;
/* 0x02FA */ Vec3s upperBodyRot;
/* 0x0300 */ UNK_TYPE1 unk_300[0x12];
/* 0x0312 */ s16 limbRotY[20];
/* 0x033A */ s16 limbRotZ[20];
/* 0x0364 */ Vec3f unk_364[15];
/* 0x041A */ UNK_TYPE1 unk_41A[0x6];
/* 0x041E */ s16 eyeIndex;
/* 0x0420 */ s16 blinkTimer;
} EnZo; // size = 0x424
extern const ActorInit En_Zo_InitVars;
#endif // Z_EN_ZO_H

View File

@ -86,8 +86,7 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f);
Actor_SetScale(&this->actor, 0.01f);
this->actionFunc = func_80B97100;
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zo_Skel_00D208, &object_zo_Anim_004248, this->jointTable,
this->morphTable, 20);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20);
Animation_PlayLoop(&this->skelAnime, &object_zo_Anim_00DE20);
this->unk_2F0 = 0;
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
@ -236,7 +235,7 @@ void EnZot_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void func_80B96BEC(EnZot* this, s16 arg1, u8 arg2) {
static AnimationHeader* sAnimations[] = {
&object_zo_Anim_00DE20, &object_zo_Anim_002898, &object_zo_Anim_00F4E8, &object_zo_Anim_00E400,
&object_zo_Anim_00DE20, &gZoraWalkAnim, &object_zo_Anim_00F4E8, &object_zo_Anim_00E400,
&object_zo_Anim_00FDF0, &object_zo_Anim_010B18, &object_zo_Anim_011424, &object_zo_Anim_00EDF0,
&object_zo_Anim_00DF54, &object_zo_Anim_00DF54,
};
@ -1386,9 +1385,9 @@ void EnZot_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
void EnZot_Draw(Actor* thisx, GlobalContext* globalCtx) {
TexturePtr sp4C[] = {
object_zo_Tex_0050A0,
object_zo_Tex_0058A0,
object_zo_Tex_0060A0,
gZoraEyeOpenTex,
gZoraEyeHalfTex,
gZoraEyeClosedTex,
};
EnZot* this = THIS;

View File

@ -8615,20 +8615,20 @@
0x8099D7DC:("OceffWipe4_Destroy",),
0x8099D810:("OceffWipe4_Update",),
0x8099D870:("OceffWipe4_Draw",),
0x8099E790:("func_8099E790",),
0x8099E858:("func_8099E858",),
0x8099E96C:("func_8099E96C",),
0x8099E9E0:("func_8099E9E0",),
0x8099EA60:("func_8099EA60",),
0x8099EBD8:("func_8099EBD8",),
0x8099EC50:("func_8099EC50",),
0x8099ED4C:("func_8099ED4C",),
0x8099EE24:("func_8099EE24",),
0x8099E790:("EnZo_SetAnimation",),
0x8099E858:("EnZo_PlayWalkingSound",),
0x8099E96C:("EnZo_Blink",),
0x8099E9E0:("EnZo_UpdateCollider",),
0x8099EA60:("EnZo_LookAtPlayer",),
0x8099EBD8:("EnZo_Walk",),
0x8099EC50:("EnZo_FollowPath",),
0x8099ED4C:("EnZo_TreadWater",),
0x8099EE24:("EnZo_DoNothing",),
0x8099EE34:("EnZo_Init",),
0x8099EF40:("EnZo_Destroy",),
0x8099EF6C:("EnZo_Update",),
0x8099EFF4:("func_8099EFF4",),
0x8099F15C:("func_8099F15C",),
0x8099EFF4:("EnZo_OverrideLimbDraw",),
0x8099F15C:("EnZo_PostLimbDraw",),
0x8099F268:("EnZo_Draw",),
0x8099F730:("EffectSsIceSmoke_Init",),
0x8099F7F4:("EffectSsIceSmoke_Draw",),

View File

@ -2118,10 +2118,6 @@ D_06005F48 = 0x06005F48;
D_06013328 = 0x06013328;
// ovl_En_Zo
D_0600D208 = 0x0600D208;
// ovl_En_Zob
D_06006998 = 0x06006998;