En_Horse_Link_Child and object_horse_link_child partially documented. (#1353)

* ChildHorse: some documentation

* OOT Horse: more documentation

* OOT Horse: more documentation

* OOT Horse: more documentation

* might be busted

* OOT Epona: more documents aft

* OOT Epona: some object documentation, continued documentation

* format

* OOT Epona: requested changes

* OOT Epona: minor documentation changes

* what is this warning, c pls

* OOT Horse: git nudge

* OOT Epona: requested changes to enums

* OOT Epona: Anim

* Update src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* OOT Epona: change enum name

* OOT Epona: Requested changes

* OOT Epona: More requested changes

* OOT Epona: removed incorrect padding guess

---------

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Isghj 2023-08-14 21:59:51 -07:00 committed by GitHub
parent 0cceee6eba
commit c5d6185a88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 353 additions and 272 deletions

View File

@ -1,4 +1,5 @@
<Root>
<!-- Epona -->
<File Name="object_horse_link_child" Segment="6">
<DList Name="object_horse_link_child_DL_000C70" Offset="0xC70" />
<DList Name="object_horse_link_child_DL_001028" Offset="0x1028" />
@ -9,10 +10,13 @@
<DList Name="object_horse_link_child_DL_0014B8" Offset="0x14B8" />
<DList Name="object_horse_link_child_DL_001568" Offset="0x1568" />
<DList Name="object_horse_link_child_DL_001678" Offset="0x1678" />
<Texture Name="object_horse_link_child_Tex_001728" OutName="tex_001728" Format="rgba16" Width="16" Height="16" Offset="0x1728" />
<Texture Name="object_horse_link_child_Tex_001928" OutName="tex_001928" Format="ci8" Width="32" Height="16" Offset="0x1928" />
<Texture Name="object_horse_link_child_Tex_001B28" OutName="tex_001B28" Format="ci8" Width="32" Height="16" Offset="0x1B28" />
<Texture Name="object_horse_link_child_Tex_001D28" OutName="tex_001D28" Format="ci8" Width="32" Height="16" Offset="0x1D28" />
<Texture Name="gEponaTLUT" OutName="epona_tlut" Format="rgba16" Width="16" Height="16" Offset="0x1728" />
<Texture Name="gEponaEyeHalfTex" OutName="epona_eye_half" Format="ci8" Width="32" Height="16" Offset="0x1928" TlutOffset="0x1728" />
<Texture Name="gEponaEyeClosedTex" OutName="epona_eye_closed" Format="ci8" Width="32" Height="16" Offset="0x1B28" TlutOffset="0x1728" />
<Texture Name="gEponaEyeOpenTex" OutName="epona_eye_open" Format="ci8" Width="32" Height="16" Offset="0x1D28" TlutOffset="0x1728" />
<Texture Name="object_horse_link_child_Tex_001F28" OutName="tex_001F28" Format="rgba16" Width="4" Height="8" Offset="0x1F28" />
<Texture Name="object_horse_link_child_Tex_001F68" OutName="tex_001F68" Format="rgba16" Width="16" Height="16" Offset="0x1F68" />
<Texture Name="object_horse_link_child_Tex_002168" OutName="tex_002168" Format="rgba16" Width="16" Height="16" Offset="0x2168" />
@ -20,16 +24,20 @@
<Texture Name="object_horse_link_child_Tex_002568" OutName="tex_002568" Format="rgba16" Width="4" Height="4" Offset="0x2568" />
<Texture Name="object_horse_link_child_Tex_002588" OutName="tex_002588" Format="rgba16" Width="8" Height="32" Offset="0x2588" />
<Texture Name="object_horse_link_child_Tex_002788" OutName="tex_002788" Format="rgba16" Width="16" Height="16" Offset="0x2788" />
<Animation Name="object_horse_link_child_Anim_002F98" Offset="0x2F98" /> <!-- Original name is "hlc_anim_fastrun_30" -->
<Animation Name="gEponaGallopAnim" Offset="0x2F98" /> <!-- Original name is "hlc_anim_fastrun_30" -->
<Animation Name="object_horse_link_child_Anim_0035B0" Offset="0x35B0" /> <!-- Original name is "hlc_anim_jump100" -->
<Animation Name="object_horse_link_child_Anim_003D38" Offset="0x3D38" /> <!-- Original name is "hlc_anim_jump200" -->
<Animation Name="object_horse_link_child_Anim_0043AC" Offset="0x43AC" /> <!-- Original name is "hlc_anim_slowrun_30" -->
<Animation Name="gEponaTrotAnim" Offset="0x43AC" /> <!-- Original name is "hlc_anim_slowrun_30" -->
<Animation Name="object_horse_link_child_Anim_004DE8" Offset="0x4DE8" /> <!-- Original name is "hlc_anim_stand" -->
<Animation Name="object_horse_link_child_Anim_005F64" Offset="0x5F64" /> <!-- Original name is "hlc_anim_stop" -->
<Animation Name="object_horse_link_child_Anim_006D44" Offset="0x6D44" /> <!-- Original name is "hlc_anim_wait" -->
<Animation Name="object_horse_link_child_Anim_007468" Offset="0x7468" /> <!-- Original name is "hlc_anim_wait02" -->
<Animation Name="object_horse_link_child_Anim_007D50" Offset="0x7D50" /> <!-- Original name is "hlc_anim_walk_30" -->
<Animation Name="gEponaIdleAnim" Offset="0x6D44" /> <!-- Original name is "hlc_anim_wait" -->
<Animation Name="gEponaWhinnyAnim" Offset="0x7468" /> <!-- Original name is "hlc_anim_wait02" -->
<Animation Name="gEponaWalkAnim" Offset="0x7D50" /> <!-- Original name is "hlc_anim_walk_30" -->
<!-- <Blob Name="object_horse_link_child_Blob_007D60" Size="0x2388" Offset="0x7D60" /> -->
<!-- z64Utils will not render because of skin type skeleton -->
<Limb Name="object_horse_link_child_Skinlimb_00A0E8" Type="Skin" EnumName="OBJECT_HORSE_LINK_CHILD_LIMB_01" Offset="0xA0E8" />
<Limb Name="object_horse_link_child_Skinlimb_00A0F8" Type="Skin" EnumName="OBJECT_HORSE_LINK_CHILD_LIMB_02" Offset="0xA0F8" />
<Limb Name="object_horse_link_child_Skinlimb_00A108" Type="Skin" EnumName="OBJECT_HORSE_LINK_CHILD_LIMB_03" Offset="0xA108" />
@ -76,14 +84,17 @@
<Limb Name="object_horse_link_child_Skinlimb_00A398" Type="Skin" EnumName="OBJECT_HORSE_LINK_CHILD_LIMB_2C" Offset="0xA398" />
<Limb Name="object_horse_link_child_Skinlimb_00A3A8" Type="Skin" EnumName="OBJECT_HORSE_LINK_CHILD_LIMB_2D" Offset="0xA3A8" />
<Limb Name="object_horse_link_child_Skinlimb_00A3B8" Type="Skin" EnumName="OBJECT_HORSE_LINK_CHILD_LIMB_2E" Offset="0xA3B8" />
<Skeleton Name="object_horse_link_child_Skel_00A480" Type="Normal" LimbType="Standard" LimbNone="OBJECT_HORSE_LINK_CHILD_LIMB_NONE" LimbMax="OBJECT_HORSE_LINK_CHILD_LIMB_MAX" EnumName="ObjectHorseLinkChildLimb" Offset="0xA480" />
<Skeleton Name="gEponaSkel" Type="Normal" LimbType="Standard" LimbNone="OBJECT_HORSE_LINK_CHILD_LIMB_NONE" LimbMax="OBJECT_HORSE_LINK_CHILD_LIMB_MAX" EnumName="ObjectHorseLinkChildLimb" Offset="0xA480" />
<Animation Name="object_horse_link_child_Anim_00A8DC" Offset="0xA8DC" /> <!-- Original name is "hlc_inanaki" -->
<Animation Name="object_horse_link_child_Anim_00AD08" Offset="0xAD08" /> <!-- Original name is "hlc_inanaki_modori" -->
<Animation Name="object_horse_link_child_Anim_00B3E0" Offset="0xB3E0" /> <!-- Original name is "hlc_inanaki_wait" -->
<Animation Name="object_horse_link_child_Anim_00BDE0" Offset="0xBDE0" /> <!-- Original name is "hlc_lost_house2" -->
<Animation Name="object_horse_link_child_Anim_00D178" Offset="0xD178" /> <!-- Original name is "hlc_lost_house_inanaki" -->
<Animation Name="object_horse_link_child_Anim_00D4E8" Offset="0xD4E8" /> <!-- Original name is "hlc_lost_house_inanaki_run" -->
<DList Name="object_horse_link_child_DL_00D500" Offset="0xD500" />
<!-- skin textures -->
<Texture Name="object_horse_link_child_Tex_00DAF0" OutName="tex_00DAF0" Format="rgba16" Width="16" Height="16" Offset="0xDAF0" />
<Texture Name="object_horse_link_child_Tex_00DCF0" OutName="tex_00DCF0" Format="rgba16" Width="32" Height="32" Offset="0xDCF0" />
</File>

View File

@ -110,9 +110,15 @@ typedef struct {
} RaceInfo; // size = 0x8
static AnimationHeader* sEponaAnimations[] = {
&object_horse_link_child_Anim_006D44, &object_horse_link_child_Anim_007468, &object_horse_link_child_Anim_005F64,
&object_horse_link_child_Anim_004DE8, &object_horse_link_child_Anim_007D50, &object_horse_link_child_Anim_0043AC,
&object_horse_link_child_Anim_002F98, &object_horse_link_child_Anim_0035B0, &object_horse_link_child_Anim_003D38,
&gEponaIdleAnim,
&gEponaWhinnyAnim,
&object_horse_link_child_Anim_005F64,
&object_horse_link_child_Anim_004DE8,
&gEponaWalkAnim,
&gEponaTrotAnim,
&gEponaGallopAnim,
&object_horse_link_child_Anim_0035B0,
&object_horse_link_child_Anim_003D38,
};
static AnimationHeader* sHniAnimations[] = {
@ -130,7 +136,7 @@ static f32 sPlaybackSpeeds[] = {
};
static SkeletonHeader* sSkeletonHeaders[] = {
NULL, NULL, &object_horse_link_child_Skel_00A480, NULL, NULL,
NULL, NULL, &gEponaSkel, NULL, NULL,
};
ActorInit En_Horse_InitVars = {
@ -4633,9 +4639,9 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) {
s32 EnHorse_OverrideLimbDraw(Actor* thisx, PlayState* play, s32 limbIndex, Skin* skin) {
static TexturePtr D_80889204[] = {
object_horse_link_child_Tex_001D28,
object_horse_link_child_Tex_001928,
object_horse_link_child_Tex_001B28,
gEponaEyeOpenTex,
gEponaEyeHalfTex,
gEponaEyeClosedTex,
};
static u8 D_80889210[] = { 0, 1, 2, 1 };
EnHorse* this = THIS;

View File

@ -1,7 +1,8 @@
/*
* File: z_en_horse_link_child.c
* Overlay: ovl_En_Horse_Link_Child
* Description: Child Epona
* Description: Child Epona from OoT, when player learns Epona's song
* (Unused in MM and broken)
*/
#include "z_en_horse_link_child.h"
@ -17,15 +18,17 @@ void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play);
void EnHorseLinkChild_Update(Actor* thisx, PlayState* play);
void EnHorseLinkChild_Draw(Actor* thisx, PlayState* play);
void func_808DEA0C(EnHorseLinkChild* this, PlayState* play);
void func_808DEB14(EnHorseLinkChild* this, PlayState* play);
void func_808DECA0(EnHorseLinkChild* this);
void func_808DED40(EnHorseLinkChild* this, PlayState* play);
void func_808DEFE8(EnHorseLinkChild* this);
void func_808DF194(EnHorseLinkChild* this, PlayState* play);
void func_808DF620(EnHorseLinkChild* this, PlayState* play);
void func_808DF788(EnHorseLinkChild* this);
void func_808DF838(EnHorseLinkChild* this, PlayState* play);
void EnHorseLinkChild_ActionFunc0(EnHorseLinkChild* this, PlayState* play);
void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 nextAnimIndex);
void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play);
void EnHorseLinkChild_SetupGreetPlayer(EnHorseLinkChild* this);
void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play);
void EnHorseLinkChild_SetupLonLonIdle(EnHorseLinkChild* this);
void EnHorseLinkChild_LonLonIdle(EnHorseLinkChild* this, PlayState* play);
void EnHorseLinkChild_SetupActionFunc5(EnHorseLinkChild* this);
void EnHorseLinkChild_ActionFunc5(EnHorseLinkChild* this, PlayState* play);
void EnHorseLinkChild_SetupActionFunc4(EnHorseLinkChild* this);
void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play);
ActorInit En_Horse_Link_Child_InitVars = {
ACTOR_EN_HORSE_LINK_CHILD,
@ -39,9 +42,21 @@ ActorInit En_Horse_Link_Child_InitVars = {
(ActorFunc)EnHorseLinkChild_Draw,
};
AnimationHeader* D_808DFEC0[] = {
&object_horse_link_child_Anim_006D44, &object_horse_link_child_Anim_007468, &object_horse_link_child_Anim_007D50,
&object_horse_link_child_Anim_0043AC, &object_horse_link_child_Anim_002F98,
typedef enum {
/* 0 */ OOT_CHILD_EPONA_ANIM_IDLE, // head down + pawing
/* 1 */ OOT_CHILD_EPONA_ANIM_WHINNY, // head shake
/* 2 */ OOT_CHILD_EPONA_ANIM_WALK, // slow
/* 3 */ OOT_CHILD_EPONA_ANIM_TROT, // mid
/* 4 */ OOT_CHILD_EPONA_ANIM_GALLOP, // fast
/* 5 */ OOT_CHILD_EPONA_ANIM_MAX
} OoTEponaAnimation;
AnimationHeader* sAnimations[OOT_CHILD_EPONA_ANIM_MAX] = {
&gEponaIdleAnim, // OOT_CHILD_EPONA_ANIM_IDLE
&gEponaWhinnyAnim, // OOT_CHILD_EPONA_ANIM_WHINNY
&gEponaWalkAnim, // OOT_CHILD_EPONA_ANIM_WALK
&gEponaTrotAnim, // OOT_CHILD_EPONA_ANIM_TROT
&gEponaGallopAnim, // OOT_CHILD_EPONA_ANIM_GALLOP
};
static ColliderJntSphElementInit sJntSphElementsInit[] = {
@ -73,41 +88,65 @@ static ColliderJntSphInit sJntSphInit = {
static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_HEAVY };
s32 D_808DFF10[] = { 1, 19 };
// the animation frames that should have sfx
static s32 sAnimSoundFrames[] = { 1, 19 };
f32 D_808DFF18[] = { 1.0f, 1.0f, 1.5f, 1.5f, 1.5f };
static f32 sAnimPlaySpeeds[OOT_CHILD_EPONA_ANIM_MAX] = {
1.0f, // OOT_CHILD_EPONA_ANIM_IDLE
1.0f, // OOT_CHILD_EPONA_ANIM_WHINNY
1.5f, // OOT_CHILD_EPONA_ANIM_WALK
1.5f, // OOT_CHILD_EPONA_ANIM_TROT
1.5f // OOT_CHILD_EPONA_ANIM_GALLOP
};
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneScale, 1200, ICHAIN_STOP),
};
EnHorseLinkChildUnkFunc D_808DFF30[] = {
func_808DEA0C, func_808DED40, func_808DEB14, func_808DF194, func_808DF838, func_808DF620,
typedef enum {
/* 0 */ OOT_CHILD_EPONA_ACTION_0, // unfinished
/* 1 */ OOT_CHILD_EPONA_ACTION_GREET_PLAYER, // approaching
/* 2 */ OOT_CHILD_EPONA_ACTION_WAIT_FOR_PLAYER,
/* 3 */ OOT_CHILD_EPONA_ACTION_LONLON_IDLE,
/* 4 */ OOT_CHILD_EPONA_ACTION_4,
/* 5 */ OOT_CHILD_EPONA_ACTION_5,
/* 6 */ OOT_CHILD_EPONA_ACTION_MAX
} OoTEponaAction;
static EnHorseLinkChildActionFunc sActionFuncs[] = {
EnHorseLinkChild_ActionFunc0, // OOT_CHILD_EPONA_ACTION_0
EnHorseLinkChild_GreetPlayer, // OOT_CHILD_EPONA_ACTION_GREET_PLAYER
EnHorseLinkChild_WaitForPlayer, // OOT_CHILD_EPONA_ACTION_WAIT_FOR_PLAYER
EnHorseLinkChild_LonLonIdle, // OOT_CHILD_EPONA_ACTION_LONLON_IDLE
EnHorseLinkChild_ActionFunc4, // OOT_CHILD_EPONA_ACTION_4
EnHorseLinkChild_ActionFunc5, // OOT_CHILD_EPONA_ACTION_5
};
TexturePtr D_808DFF48[] = { object_horse_link_child_Tex_001D28, object_horse_link_child_Tex_001928,
object_horse_link_child_Tex_001B28 };
static TexturePtr sEyeTextures[] = { gEponaEyeOpenTex, gEponaEyeHalfTex, gEponaEyeClosedTex };
s8 D_808DFF54[] = { 0, 1, 2, 1 };
s8 sEyeTextureIndexOverride[] = { 0, 1, 2, 1 };
void func_808DE5C0(EnHorseLinkChild* this) {
if ((D_808DFF10[this->unk_1E8] < this->skin.skelAnime.curFrame) &&
((this->unk_1E8 != 0) || !(D_808DFF10[1] < this->skin.skelAnime.curFrame))) {
// This plays the walking/gallop sfx, which needs to be timed based on horse speed,
// this is only used for animation OOT_CHILD_EPONA_ANIM_WALK
void EnHorseLinkChild_PlayWalkingSound(EnHorseLinkChild* this) {
if ((sAnimSoundFrames[this->footstepCounter] < this->skin.skelAnime.curFrame) &&
((this->footstepCounter != 0) || !(sAnimSoundFrames[1] < this->skin.skelAnime.curFrame))) {
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_WALK);
this->unk_1E8++;
if (this->unk_1E8 >= 2) {
this->unk_1E8 = 0;
this->footstepCounter++;
if (this->footstepCounter >= 2) {
this->footstepCounter = 0;
}
}
}
void func_808DE660(EnHorseLinkChild* this) {
if (this->unk_148 == 2) {
func_808DE5C0(this);
void EnHorseLinkChild_PlaySound(EnHorseLinkChild* this) {
if (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK) {
EnHorseLinkChild_PlayWalkingSound(this);
} else if (this->skin.skelAnime.curFrame == 0.0f) {
if ((this->unk_148 == 3) || (this->unk_148 == 4)) {
if ((this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) || (this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP)) {
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_RUN);
} else if (this->unk_148 == 1) {
} else if (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) {
if (Rand_ZeroOne() > 0.5f) {
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_GROAN);
} else {
@ -117,52 +156,55 @@ void func_808DE660(EnHorseLinkChild* this) {
}
}
f32 func_808DE728(EnHorseLinkChild* this) {
f32 phi_fv1;
f32 EnHorseLinkChild_GetAnimSpeed(EnHorseLinkChild* this) {
f32 animSpeed;
if (this->unk_148 == 2) {
phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 2.0f);
} else if (this->unk_148 == 3) {
phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 3.0f);
} else if (this->unk_148 == 4) {
phi_fv1 = D_808DFF18[this->unk_148] * this->actor.speed * (1.0f / 5.0f);
if (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK) {
animSpeed = sAnimPlaySpeeds[this->animIndex] * this->actor.speed * (1.0f / 2.0f);
} else if (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) {
animSpeed = sAnimPlaySpeeds[this->animIndex] * this->actor.speed * (1.0f / 3.0f);
} else if (this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) {
animSpeed = sAnimPlaySpeeds[this->animIndex] * this->actor.speed * (1.0f / 5.0f);
} else {
phi_fv1 = D_808DFF18[this->unk_148];
animSpeed = sAnimPlaySpeeds[this->animIndex];
}
return phi_fv1;
return animSpeed;
}
void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) {
EnHorseLinkChild* this = THIS;
Actor_ProcessInitChain(&this->actor, sInitChain);
Actor_SetScale(&this->actor, 0.00648f);
Actor_SetScale(&this->actor, 64.8f * 0.0001f);
this->actor.gravity = -3.5f;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawHorse, 20.0f);
this->unk_144 = 1;
this->action = OOT_CHILD_EPONA_ACTION_GREET_PLAYER;
this->actor.speed = 0.0f;
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += 70.0f;
Skin_Init(&play->state, &this->skin, &object_horse_link_child_Skel_00A480, &object_horse_link_child_Anim_002F98);
this->unk_148 = 0;
Animation_PlayOnce(&this->skin.skelAnime, D_808DFEC0[0]);
Skin_Init(&play->state, &this->skin, &gEponaSkel, &gEponaGallopAnim);
this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE;
// this gets overwritten by EnHorseLinkChild_SetupLonLonIdle below
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[OOT_CHILD_EPONA_ANIM_IDLE]);
Collider_InitCylinder(play, &this->colldierCylinder);
Collider_InitJntSph(play, &this->colliderJntSph);
Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements);
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
this->unk_1E8 = 0;
this->unk_1E4 = 0;
this->footstepCounter = 0;
this->eyeTexIndex = 0;
if (gSaveContext.sceneLayer >= 4) {
func_808DEFE8(this);
if (gSaveContext.sceneLayer >= 4) { // IS_CUTSCENE_LAYER in OoT
EnHorseLinkChild_SetupLonLonIdle(this);
} else {
func_808DEFE8(this);
EnHorseLinkChild_SetupLonLonIdle(this);
}
this->actor.home.rot.z = this->actor.world.rot.z = this->actor.shape.rot.z = 0;
@ -176,303 +218,324 @@ void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyJntSph(play, &this->colliderJntSph);
}
void func_808DE9A8(EnHorseLinkChild* this) {
this->unk_144 = 0;
this->unk_148++;
if (this->unk_148 >= ARRAY_COUNT(D_808DFF18)) {
this->unk_148 = 0;
void EnHorseLinkChild_SetupActionFunc0(EnHorseLinkChild* this) {
this->action = OOT_CHILD_EPONA_ACTION_0;
this->animIndex++;
if (this->animIndex >= ARRAY_COUNT(sAnimPlaySpeeds)) {
this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE;
}
Animation_PlayOnce(&this->skin.skelAnime, D_808DFEC0[this->unk_148]);
this->skin.skelAnime.playSpeed = func_808DE728(this);
Animation_PlayOnce(&this->skin.skelAnime, sAnimations[this->animIndex]);
this->skin.skelAnime.playSpeed = EnHorseLinkChild_GetAnimSpeed(this);
}
void func_808DEA0C(EnHorseLinkChild* this, PlayState* play) {
/**
* Mostly broken
*/
void EnHorseLinkChild_ActionFunc0(EnHorseLinkChild* this, PlayState* play) {
this->actor.speed = 0.0f;
if (SkelAnime_Update(&this->skin.skelAnime)) {
func_808DE9A8(this);
EnHorseLinkChild_SetupActionFunc0(this);
}
}
void func_808DEA54(EnHorseLinkChild* this, s32 arg1) {
this->unk_144 = 2;
void EnHorseLinkChild_SetupWaitForPlayer(EnHorseLinkChild* this, s32 nextAnimIndex) {
this->action = OOT_CHILD_EPONA_ACTION_WAIT_FOR_PLAYER;
this->actor.speed = 0.0f;
if ((arg1 != 0) && (arg1 != 1)) {
arg1 = 0;
if ((nextAnimIndex != OOT_CHILD_EPONA_ANIM_IDLE) && (nextAnimIndex != OOT_CHILD_EPONA_ANIM_WHINNY)) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_IDLE;
}
if (arg1 != this->unk_148) {
this->unk_148 = arg1;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f);
if (nextAnimIndex != this->animIndex) {
this->animIndex = nextAnimIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
}
}
void func_808DEB14(EnHorseLinkChild* this, PlayState* play) {
f32 sp44 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
s32 phi_v0;
/**
* Waiting for the player to get close, to notice and begin to approach the player.
*/
void EnHorseLinkChild_WaitForPlayer(EnHorseLinkChild* this, PlayState* play) {
f32 distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
s32 nextAnimIndex;
if (SkelAnime_Update(&this->skin.skelAnime)) {
if ((sp44 < 1000.0f) && (sp44 > 70.0f)) {
func_808DECA0(this);
if ((distToPlayer < 1000.0f) && (distToPlayer > 70.0f)) {
EnHorseLinkChild_SetupGreetPlayer(this);
return;
}
if (this->unk_148 == 1) {
phi_v0 = 0;
if (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_IDLE;
} else {
phi_v0 = 1;
nextAnimIndex = OOT_CHILD_EPONA_ANIM_WHINNY;
}
if (phi_v0 != this->unk_148) {
this->unk_148 = phi_v0;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f);
if (nextAnimIndex != this->animIndex) {
this->animIndex = nextAnimIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
} else {
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f);
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f);
}
}
}
void func_808DECA0(EnHorseLinkChild* this) {
this->unk_144 = 1;
this->unk_148 = 0;
void EnHorseLinkChild_SetupGreetPlayer(EnHorseLinkChild* this) {
this->action = OOT_CHILD_EPONA_ACTION_GREET_PLAYER;
this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE;
this->actor.speed = 0.0f;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f);
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
}
void func_808DED40(EnHorseLinkChild* this, PlayState* play) {
f32 temp_fv0;
s16 temp_a0;
s32 phi_v0;
/**
* Chasing the player down.
*/
void EnHorseLinkChild_GreetPlayer(EnHorseLinkChild* this, PlayState* play) {
f32 distToPlayer;
s16 yawTowardPlayerDiff;
s32 nextAnimIndex;
if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) {
temp_a0 = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y;
if (temp_a0 > 0x12C) {
if ((this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) || (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) ||
(this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) {
yawTowardPlayerDiff =
Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y;
if (yawTowardPlayerDiff > 0x12C) {
this->actor.world.rot.y += 0x12C;
} else if (temp_a0 < -0x12C) {
} else if (yawTowardPlayerDiff < -0x12C) {
this->actor.world.rot.y -= 0x12C;
} else {
this->actor.world.rot.y += temp_a0;
this->actor.world.rot.y += yawTowardPlayerDiff;
}
this->actor.shape.rot.y = this->actor.world.rot.y;
}
if (SkelAnime_Update(&this->skin.skelAnime)) {
temp_fv0 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
if (temp_fv0 > 1000.0f) {
func_808DEA54(this, 0);
distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
if (distToPlayer > 1000.0f) {
EnHorseLinkChild_SetupWaitForPlayer(this, 0);
return;
}
if ((temp_fv0 < 1000.0f) && (temp_fv0 >= 300.0f)) {
phi_v0 = 4;
if ((distToPlayer < 1000.0f) && (distToPlayer >= 300.0f)) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if ((temp_fv0 < 300.0f) && (temp_fv0 >= 150.0f)) {
phi_v0 = 3;
} else if ((distToPlayer < 300.0f) && (distToPlayer >= 150.0f)) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else if ((temp_fv0 < 150.0f) && (temp_fv0 >= 70.0f)) {
phi_v0 = 2;
this->unk_1E8 = 0;
} else if ((distToPlayer < 150.0f) && (distToPlayer >= 70.0f)) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
} else {
func_808DEA54(this, 1);
EnHorseLinkChild_SetupWaitForPlayer(this, 1);
return;
}
if (phi_v0 != this->unk_148) {
this->unk_148 = phi_v0;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f);
if (nextAnimIndex != this->animIndex) {
this->animIndex = nextAnimIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
} else {
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f);
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f);
}
}
}
void func_808DEFE8(EnHorseLinkChild* this) {
this->unk_144 = 3;
this->unk_148 = 0;
void EnHorseLinkChild_SetupLonLonIdle(EnHorseLinkChild* this) {
this->action = OOT_CHILD_EPONA_ACTION_LONLON_IDLE;
this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE;
this->actor.speed = 0.0f;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f);
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
}
void func_808DF088(EnHorseLinkChild* this, PlayState* play) {
if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) {
if ((this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) || (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) ||
(this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) {
Player* player = GET_PLAYER(play);
s16 sp32;
s32 phi_v0;
s16 newYawDiff;
s32 newYawDir;
s32 pad;
if (Math3D_Distance(&player->actor.world.pos, &this->actor.home.pos) < 250.0f) {
sp32 = player->actor.shape.rot.y;
newYawDiff = player->actor.shape.rot.y;
if (Actor_WorldYawTowardActor(&this->actor, &player->actor) > 0) {
phi_v0 = 1;
newYawDir = 1;
} else {
phi_v0 = -1;
newYawDir = -1;
}
sp32 += (phi_v0 * 0x4000);
newYawDiff += (newYawDir * 0x4000);
} else {
sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos) - this->actor.world.rot.y;
newYawDiff = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos) - this->actor.world.rot.y;
}
if (sp32 > 0x12C) {
if (newYawDiff > 0x12C) {
this->actor.world.rot.y += 0x12C;
} else if (sp32 < -0x12C) {
} else if (newYawDiff < -0x12C) {
this->actor.world.rot.y += -0x12C;
} else {
this->actor.world.rot.y += sp32;
this->actor.world.rot.y += newYawDiff;
}
this->actor.shape.rot.y = this->actor.world.rot.y;
}
}
void func_808DF194(EnHorseLinkChild* this, PlayState* play) {
/**
* Idle in one spot, waiting for player to finish getting Epona song.
* However, the flag was not migrated from OoT corectly, so it checks for the wrong flag.
*/
void EnHorseLinkChild_LonLonIdle(EnHorseLinkChild* this, PlayState* play) {
Player* player;
f32 sp50;
s32 sp4C;
s32 sp48;
f32 distToPlayer;
s32 isAnimFinished;
s32 nextAnimIndex;
func_808DF088(this, play);
player = GET_PLAYER(play);
sp50 = Actor_WorldDistXZToActor(&this->actor, &player->actor);
sp48 = this->unk_148;
sp4C = SkelAnime_Update(&this->skin.skelAnime);
distToPlayer = Actor_WorldDistXZToActor(&this->actor, &player->actor);
nextAnimIndex = this->animIndex;
isAnimFinished = SkelAnime_Update(&this->skin.skelAnime);
if ((sp4C != 0) || (this->unk_148 == 1) || (this->unk_148 == 0)) {
// The carry-over of this flag from OoT was not done correctly
if ((isAnimFinished) || (this->animIndex == OOT_CHILD_EPONA_ANIM_WHINNY) ||
(this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE)) {
//! @bug: The carry-over of this flag from OoT was not done correctly
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_ENTERED_ZORA_HALL)) {
f32 sp44 = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos);
f32 distToHome = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos);
s32 pad;
if (Math3D_Distance(&player->actor.world.pos, &this->actor.home.pos) > 250.0f) {
if (sp44 >= 300.0f) {
sp48 = 4;
if (distToHome >= 300.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if ((sp44 < 300.0f) && (sp44 >= 150.0f)) {
sp48 = 3;
} else if ((distToHome < 300.0f) && (distToHome >= 150.0f)) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else if ((sp44 < 150.0f) && (sp44 >= 70.0f)) {
sp48 = 2;
this->unk_1E8 = 0;
} else if ((distToHome < 150.0f) && (distToHome >= 70.0f)) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
} else {
this->actor.speed = 0.0f;
if (this->unk_148 == 0) {
sp48 = (sp4C == 1) ? 1 : 0;
if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) {
nextAnimIndex =
(isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
} else {
sp48 = (sp4C == 1) ? 0 : 1;
nextAnimIndex =
(isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
}
}
} else if (sp50 < 200.0f) {
sp48 = 4;
} else if (distToPlayer < 200.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if (sp50 < 300.0f) {
sp48 = 3;
} else if (distToPlayer < 300.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else if (sp50 < 400.0f) {
sp48 = 2;
this->unk_1E8 = 0;
} else if (distToPlayer < 400.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
} else {
this->actor.speed = 0.0f;
if (this->unk_148 == 0) {
sp48 = (sp4C == 1) ? 1 : 0;
if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) {
nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
} else {
sp48 = (sp4C == 1) ? 0 : 1;
nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
}
}
} else {
this->actor.speed = 0.0f;
if (this->unk_148 == 0) {
sp48 = (sp4C == 1) ? 1 : 0;
if (this->animIndex == OOT_CHILD_EPONA_ANIM_IDLE) {
nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_WHINNY : OOT_CHILD_EPONA_ANIM_IDLE;
} else {
sp48 = (sp4C == 1) ? 0 : 1;
nextAnimIndex = (isAnimFinished == true) ? OOT_CHILD_EPONA_ANIM_IDLE : OOT_CHILD_EPONA_ANIM_WHINNY;
}
}
}
if ((sp48 != this->unk_148) || (sp4C == 1)) {
this->unk_148 = sp48;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f);
if ((nextAnimIndex != this->animIndex) || (isAnimFinished == true)) {
this->animIndex = nextAnimIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
} else {
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this),
this->skin.skelAnime.curFrame, Animation_GetLastFrame(D_808DFEC0[this->unk_148]),
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
this->skin.skelAnime.curFrame, Animation_GetLastFrame(sAnimations[this->animIndex]),
ANIMMODE_ONCE, 0.0f);
}
}
void func_808DF560(EnHorseLinkChild* this) {
this->unk_144 = 5;
void EnHorseLinkChild_SetupActionFunc5(EnHorseLinkChild* this) {
this->action = OOT_CHILD_EPONA_ACTION_5;
if (Rand_ZeroOne() > 0.5f) {
this->unk_148 = 0;
this->animIndex = OOT_CHILD_EPONA_ANIM_IDLE;
} else {
this->unk_148 = 1;
this->animIndex = OOT_CHILD_EPONA_ANIM_WHINNY;
}
gHorsePlayedEponasSong = false;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f);
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f);
}
void func_808DF620(EnHorseLinkChild* this, PlayState* play) {
s16 sp36;
void EnHorseLinkChild_ActionFunc5(EnHorseLinkChild* this, PlayState* play) {
s16 yawTowardsPlayer;
if (gHorsePlayedEponasSong) {
gHorsePlayedEponasSong = false;
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_EV_KID_HORSE_NEIGH);
func_808DF788(this);
EnHorseLinkChild_SetupActionFunc4(this);
return;
}
this->actor.speed = 0.0f;
sp36 = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y;
yawTowardsPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y;
if ((Math_CosS(sp36) < 0.7071f) && (this->unk_148 == 2)) {
if ((Math_CosS(yawTowardsPlayer) < 0.7071f) && (this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) {
Horse_RotateToPoint(&this->actor, &GET_PLAYER(play)->actor.world.pos, 0x12C);
}
if (SkelAnime_Update(&this->skin.skelAnime)) {
if (Math_CosS(sp36) < 0.0f) {
this->unk_148 = 2;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], D_808DFF18[this->unk_148], 0.0f,
Animation_GetLastFrame(D_808DFEC0[2]), ANIMMODE_ONCE, -5.0f);
if (Math_CosS(yawTowardsPlayer) < 0.0f) {
this->animIndex = OOT_CHILD_EPONA_ANIM_WALK;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], sAnimPlaySpeeds[this->animIndex],
0.0f, Animation_GetLastFrame(sAnimations[OOT_CHILD_EPONA_ANIM_WALK]), ANIMMODE_ONCE,
-5.0f);
} else {
func_808DF560(this);
EnHorseLinkChild_SetupActionFunc5(this);
}
}
}
void func_808DF788(EnHorseLinkChild* this) {
this->unk_1DC = 0;
this->unk_144 = 4;
this->unk_148 = 2;
this->unk_1E0 = 0;
void EnHorseLinkChild_SetupActionFunc4(EnHorseLinkChild* this) {
this->timer = 0;
this->action = OOT_CHILD_EPONA_ACTION_4;
this->animIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->isReturningHome = false;
this->actor.speed = 2.0f;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f);
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this), 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
}
void func_808DF838(EnHorseLinkChild* this, PlayState* play) {
void EnHorseLinkChild_ActionFunc4(EnHorseLinkChild* this, PlayState* play) {
Player* player = GET_PLAYER(play);
f32 phi_fv0;
s32 phi_v0;
f32 distToTargetPos;
s32 nextAnimIndex;
this->unk_1DC++;
if (this->unk_1DC > 300) {
this->unk_1E0 = 1;
this->timer++;
if (this->timer > 300) {
this->isReturningHome = true;
}
if ((this->unk_148 == 4) || (this->unk_148 == 3) || (this->unk_148 == 2)) {
if (this->unk_1E0 == 0) {
if ((this->animIndex == OOT_CHILD_EPONA_ANIM_GALLOP) || (this->animIndex == OOT_CHILD_EPONA_ANIM_TROT) ||
(this->animIndex == OOT_CHILD_EPONA_ANIM_WALK)) {
if (!this->isReturningHome) {
Horse_RotateToPoint(&this->actor, &player->actor.world.pos, 0x12C);
} else {
Horse_RotateToPoint(&this->actor, &this->actor.home.pos, 0x12C);
@ -480,46 +543,46 @@ void func_808DF838(EnHorseLinkChild* this, PlayState* play) {
}
if (SkelAnime_Update(&this->skin.skelAnime)) {
if (this->unk_1E0 == 0) {
phi_fv0 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
if (!this->isReturningHome) {
distToTargetPos = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor);
} else {
phi_fv0 = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos);
distToTargetPos = Math3D_Distance(&this->actor.world.pos, &this->actor.home.pos);
}
if (this->unk_1E0 == 0) {
if (phi_fv0 >= 300.0f) {
phi_v0 = 4;
if (!this->isReturningHome) {
if (distToTargetPos >= 300.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if (phi_fv0 >= 150.0f) {
phi_v0 = 3;
} else if (distToTargetPos >= 150.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else {
phi_v0 = 2;
this->unk_1E8 = 0;
nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
}
} else if (phi_fv0 >= 300.0f) {
phi_v0 = 4;
} else if (distToTargetPos >= 300.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_GALLOP;
this->actor.speed = 6.0f;
} else if (phi_fv0 >= 150.0f) {
phi_v0 = 3;
} else if (distToTargetPos >= 150.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_TROT;
this->actor.speed = 4.0f;
} else if (phi_fv0 >= 70.0f) {
phi_v0 = 2;
this->unk_1E8 = 0;
} else if (distToTargetPos >= 70.0f) {
nextAnimIndex = OOT_CHILD_EPONA_ANIM_WALK;
this->footstepCounter = 0;
this->actor.speed = 2.0f;
} else {
func_808DF560(this);
EnHorseLinkChild_SetupActionFunc5(this);
return;
}
if (phi_v0 != this->unk_148) {
this->unk_148 = phi_v0;
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, -5.0f);
if (nextAnimIndex != this->animIndex) {
this->animIndex = nextAnimIndex;
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, -5.0f);
} else {
Animation_Change(&this->skin.skelAnime, D_808DFEC0[this->unk_148], func_808DE728(this), 0.0f,
Animation_GetLastFrame(D_808DFEC0[this->unk_148]), ANIMMODE_ONCE, 0.0f);
Animation_Change(&this->skin.skelAnime, sAnimations[this->animIndex], EnHorseLinkChild_GetAnimSpeed(this),
0.0f, Animation_GetLastFrame(sAnimations[this->animIndex]), ANIMMODE_ONCE, 0.0f);
}
}
}
@ -528,7 +591,8 @@ void EnHorseLinkChild_Update(Actor* thisx, PlayState* play) {
s32 pad;
EnHorseLinkChild* this = THIS;
D_808DFF30[this->unk_144](this, play);
sActionFuncs[this->action](this, play);
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 55.0f, 100.0f,
UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 |
@ -537,19 +601,19 @@ void EnHorseLinkChild_Update(Actor* thisx, PlayState* play) {
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += 70.0f;
if ((Rand_ZeroOne() < 0.025f) && (this->unk_1E4 == 0)) {
this->unk_1E4++;
} else if (this->unk_1E4 > 0) {
this->unk_1E4++;
if (this->unk_1E4 >= 4) {
this->unk_1E4 = 0;
if ((Rand_ZeroOne() < 0.025f) && (this->eyeTexIndex == 0)) {
this->eyeTexIndex++;
} else if (this->eyeTexIndex > 0) {
this->eyeTexIndex++;
if (this->eyeTexIndex >= 4) {
this->eyeTexIndex = 0;
}
}
Collider_UpdateCylinder(&this->actor, &this->colldierCylinder);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colldierCylinder.base);
func_808DE660(this);
EnHorseLinkChild_PlaySound(this);
}
void EnHorseLinkChild_PostSkinDraw(Actor* thisx, PlayState* play, Skin* skin) {
@ -581,9 +645,9 @@ s32 EnHorseLinkChild_OverrideSkinDraw(Actor* thisx, PlayState* play, s32 limbInd
OPEN_DISPS(play->state.gfxCtx);
if (limbIndex == OBJECT_HORSE_LINK_CHILD_LIMB_0D) {
u8 index = D_808DFF54[this->unk_1E4];
u8 index = sEyeTextureIndexOverride[this->eyeTexIndex];
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_808DFF48[index]));
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[index]));
}
CLOSE_DISPS(play->state.gfxCtx);

View File

@ -6,17 +6,17 @@
struct EnHorseLinkChild;
typedef void (*EnHorseLinkChildUnkFunc)(struct EnHorseLinkChild*, PlayState*);
typedef void (*EnHorseLinkChildActionFunc)(struct EnHorseLinkChild*, PlayState*);
typedef struct EnHorseLinkChild {
/* 0x000 */ Actor actor;
/* 0x144 */ s32 unk_144;
/* 0x148 */ s32 unk_148;
/* 0x144 */ s32 action; // index to action func list
/* 0x148 */ s32 animIndex;
/* 0x14C */ Skin skin;
/* 0x1DC */ s32 unk_1DC;
/* 0x1DC */ s32 unk_1E0;
/* 0x1E4 */ u8 unk_1E4;
/* 0x1E8 */ s32 unk_1E8;
/* 0x1DC */ s32 timer;
/* 0x1DC */ s32 isReturningHome;
/* 0x1E4 */ u8 eyeTexIndex;
/* 0x1E8 */ s32 footstepCounter; // two sfx per animation loop
/* 0x1EC */ ColliderCylinder colldierCylinder;
/* 0x238 */ ColliderJntSph colliderJntSph;
/* 0x258 */ ColliderJntSphElement colliderJntSphElements[1];

View File

@ -6473,24 +6473,24 @@
0x808DD970:("func_808DD970",),
0x808DDE74:("func_808DDE74",),
0x808DDE9C:("func_808DDE9C",),
0x808DE5C0:("func_808DE5C0",),
0x808DE660:("func_808DE660",),
0x808DE728:("func_808DE728",),
0x808DE5C0:("EnHorseLinkChild_PlayWalkingSound",),
0x808DE660:("EnHorseLinkChild_PlaySound",),
0x808DE728:("EnHorseLinkChild_GetAnimSpeed",),
0x808DE7F0:("EnHorseLinkChild_Init",),
0x808DE958:("EnHorseLinkChild_Destroy",),
0x808DE9A8:("func_808DE9A8",),
0x808DEA0C:("func_808DEA0C",),
0x808DEA54:("func_808DEA54",),
0x808DEB14:("func_808DEB14",),
0x808DECA0:("func_808DECA0",),
0x808DED40:("func_808DED40",),
0x808DEFE8:("func_808DEFE8",),
0x808DE9A8:("EnHorseLinkChild_SetupActionFunc0",),
0x808DEA0C:("EnHorseLinkChild_ActionFunc0",),
0x808DEA54:("EnHorseLinkChild_SetupWaitForPlayer",),
0x808DEB14:("EnHorseLinkChild_WaitForPlayer",),
0x808DECA0:("EnHorseLinkChild_SetupGreetPlayer",),
0x808DED40:("EnHorseLinkChild_GreetPlayer",),
0x808DEFE8:("EnHorseLinkChild_SetupLonLonIdle",),
0x808DF088:("func_808DF088",),
0x808DF194:("func_808DF194",),
0x808DF560:("func_808DF560",),
0x808DF620:("func_808DF620",),
0x808DF788:("func_808DF788",),
0x808DF838:("func_808DF838",),
0x808DF194:("EnHorseLinkChild_LonLonIdle",),
0x808DF560:("EnHorseLinkChild_SetupActionFunc5",),
0x808DF620:("EnHorseLinkChild_ActionFunc5",),
0x808DF788:("EnHorseLinkChild_SetupActionFunc4",),
0x808DF838:("EnHorseLinkChild_ActionFunc4",),
0x808DFB14:("EnHorseLinkChild_Update",),
0x808DFC3C:("EnHorseLinkChild_PostSkinDraw",),
0x808DFDC8:("EnHorseLinkChild_OverrideSkinDraw",),