1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 04:24:43 +00:00

Doc Actor: En_Ma1 (Child Malon) (#1584)

* started malon documentation

* docd all event and inf table checks

* doc cleanup

* ran formatter

* fixed misnamed eventcheck

* revert isNotSinging oops

* removed unnecessary comments

* changed from handle to update

* revert vec3f name change

* moved texture information

* isNotSinging to singingDisabled

* rename of inftable and eventchk

* small cleanup

* anim enum change

* enum names for child malon limbs
This commit is contained in:
hiisuya 2023-12-10 13:36:12 -06:00 committed by GitHub
parent 2ab90bc517
commit cc96184a96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 140 additions and 134 deletions

View File

@ -1,25 +1,25 @@
<Root>
<File Name="object_ma1" Segment="6">
<Skeleton Name="gMalonChildSkel" Type="Flex" LimbType="Standard" Offset="0x8460"/>
<Skeleton Name="gMalonChildSkel" Type="Flex" LimbType="Standard" LimbNone="CHILD_MALON_LIMB_NONE" LimbMax="CHILD_MALON_LIMB_MAX" EnumName="ChildMalonLimb" Offset="0x8460"/>
<Limb Name="gMalonChildRootLimb" LimbType="Standard" Offset="0x8340"/>
<Limb Name="gMalonChildLeftThighLimb" LimbType="Standard" Offset="0x834C"/>
<Limb Name="gMalonChildLeftShinLimb" LimbType="Standard" Offset="0x8358"/>
<Limb Name="gMalonChildLeftFootLimb" LimbType="Standard" Offset="0x8364"/>
<Limb Name="gMalonChildRightThighLimb" LimbType="Standard" Offset="0x8370"/>
<Limb Name="gMalonChildRightShinLimb" LimbType="Standard" Offset="0x837C"/>
<Limb Name="gMalonChildRightFootLimb" LimbType="Standard" Offset="0x8388"/>
<Limb Name="gMalonChildChestLimb" LimbType="Standard" Offset="0x8394"/>
<Limb Name="gMalonChildLeftShoulderLimb" LimbType="Standard" Offset="0x83A0"/>
<Limb Name="gMalonChildLeftArmLimb" LimbType="Standard" Offset="0x83AC"/>
<Limb Name="gMalonChildLeftHandLimb" LimbType="Standard" Offset="0x83B8"/>
<Limb Name="gMalonChildRightShoulderLimb" LimbType="Standard" Offset="0x83C4"/>
<Limb Name="gMalonChildRightArmLimb" LimbType="Standard" Offset="0x83D0"/>
<Limb Name="gMalonChildRightHandLimb" LimbType="Standard" Offset="0x83DC"/>
<Limb Name="gMalonChildHeadLimb" LimbType="Standard" Offset="0x83E8"/>
<Limb Name="gMalonChildLimb_0083F4" LimbType="Standard" Offset="0x83F4"/>
<Limb Name="gMalonChildDressMiddleLimb" LimbType="Standard" Offset="0x8400"/>
<Limb Name="gMalonChildDressLowerLimb" LimbType="Standard" Offset="0x840C"/>
<Limb Name="gMalonChildRootLimb" LimbType="Standard" EnumName="CHILD_MALON_ROOT" Offset="0x8340"/>
<Limb Name="gMalonChildLeftThighLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_LEFT_THIGH" Offset="0x834C"/>
<Limb Name="gMalonChildLeftShinLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_LEFT_SHIN" Offset="0x8358"/>
<Limb Name="gMalonChildLeftFootLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_LEFT_FOOT" Offset="0x8364"/>
<Limb Name="gMalonChildRightThighLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_RIGHT_THIGH" Offset="0x8370"/>
<Limb Name="gMalonChildRightShinLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_RIGHT_SHIN" Offset="0x837C"/>
<Limb Name="gMalonChildRightFootLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_RIGHT_FOOT" Offset="0x8388"/>
<Limb Name="gMalonChildChestLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_CHEST" Offset="0x8394"/>
<Limb Name="gMalonChildLeftShoulderLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_LEFT_SHOULDER" Offset="0x83A0"/>
<Limb Name="gMalonChildLeftArmLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_LEFT_ARM" Offset="0x83AC"/>
<Limb Name="gMalonChildLeftHandLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_LEFT_HAND" Offset="0x83B8"/>
<Limb Name="gMalonChildRightShoulderLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_RIGHT_SHOULDER" Offset="0x83C4"/>
<Limb Name="gMalonChildRightArmLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_RIGHT_ARM" Offset="0x83D0"/>
<Limb Name="gMalonChildRightHandLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_RIGHT_HAND" Offset="0x83DC"/>
<Limb Name="gMalonChildHeadLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_HEAD" Offset="0x83E8"/>
<Limb Name="gMalonChildDressUpperLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_DRESS_UPPER" Offset="0x83F4"/>
<Limb Name="gMalonChildDressMiddleLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_DRESS_MIDDLE" Offset="0x8400"/>
<Limb Name="gMalonChildDressLowerLimb" LimbType="Standard" EnumName="CHILD_MALON_LIMB_DRESS_LOWER" Offset="0x840C"/>
<Animation Name="gMalonChildRaiseHandsAnim" Offset="0x244"/>
<Animation Name="gMalonChildIdleAnim" Offset="0x820"/>

View File

@ -388,13 +388,13 @@ typedef enum {
#define EVENTCHKINF_0B 0x0B
#define EVENTCHKINF_0C 0x0C
#define EVENTCHKINF_0F 0x0F
#define EVENTCHKINF_10 0x10
#define EVENTCHKINF_TALKED_TO_MALON_FIRST_TIME 0x10
#define EVENTCHKINF_11 0x11
#define EVENTCHKINF_12 0x12
#define EVENTCHKINF_RECEIVED_WEIRD_EGG 0x12
#define EVENTCHKINF_TALON_WOKEN_IN_CASTLE 0x13
#define EVENTCHKINF_TALON_RETURNED_FROM_CASTLE 0x14
#define EVENTCHKINF_15 0x15
#define EVENTCHKINF_16 0x16
#define EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH 0x15
#define EVENTCHKINF_CAN_LEARN_EPONAS_SONG 0x16
#define EVENTCHKINF_EPONA_OBTAINED 0x18
#define EVENTCHKINF_1B 0x1B
#define EVENTCHKINF_1C 0x1C
@ -662,9 +662,9 @@ typedef enum {
#define INFTABLE_76 0x76
#define INFTABLE_77 0x77
#define INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE 0x7E
#define INFTABLE_84 0x84
#define INFTABLE_85 0x85
#define INFTABLE_8B 0x8B
#define INFTABLE_TALKED_TO_MALON_FIRST_TIME 0x84
#define INFTABLE_TOLD_EPONA_IS_SCARED 0x85
#define INFTABLE_MALON_SPAWNED_AT_HYRULE_CASTLE 0x8B
#define INFTABLE_8C 0x8C
#define INFTABLE_8D 0x8D
#define INFTABLE_8E 0x8E

View File

@ -4782,7 +4782,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
Flags_GetEventChkInf(EVENTCHKINF_37)) {
retTextId = 0x7006;
} else {
if (Flags_GetEventChkInf(EVENTCHKINF_12)) {
if (Flags_GetEventChkInf(EVENTCHKINF_RECEIVED_WEIRD_EGG)) {
if (Flags_GetInfTable(INFTABLE_71)) {
retTextId = 0x7072;
} else {
@ -5144,16 +5144,16 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
}
break;
case 71:
if (Flags_GetEventChkInf(EVENTCHKINF_16)) {
if (Flags_GetEventChkInf(EVENTCHKINF_CAN_LEARN_EPONAS_SONG)) {
retTextId = 0x2049;
} else if (Flags_GetEventChkInf(EVENTCHKINF_15)) {
} else if (Flags_GetEventChkInf(EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH)) {
retTextId = 0x2048;
} else if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
retTextId = 0x2047;
} else if (Flags_GetEventChkInf(EVENTCHKINF_12) &&
} else if (Flags_GetEventChkInf(EVENTCHKINF_RECEIVED_WEIRD_EGG) &&
!Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
retTextId = 0x2044;
} else if (Flags_GetEventChkInf(EVENTCHKINF_10)) {
} else if (Flags_GetEventChkInf(EVENTCHKINF_TALKED_TO_MALON_FIRST_TIME)) {
if (Flags_GetEventChkInf(EVENTCHKINF_11)) {
retTextId = 0x2043;
} else {
@ -5445,16 +5445,16 @@ void func_80036E50(u16 textId, s16 arg1) {
return;
case 71:
if (textId == 0x2041) {
Flags_SetEventChkInf(EVENTCHKINF_10);
Flags_SetEventChkInf(EVENTCHKINF_TALKED_TO_MALON_FIRST_TIME);
}
if (textId == 0x2044) {
Flags_SetEventChkInf(EVENTCHKINF_12);
Flags_SetEventChkInf(EVENTCHKINF_RECEIVED_WEIRD_EGG);
}
if (textId == 0x2047) {
Flags_SetEventChkInf(EVENTCHKINF_15);
Flags_SetEventChkInf(EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH);
}
if (textId == 0x2048) {
Flags_SetEventChkInf(EVENTCHKINF_16);
Flags_SetEventChkInf(EVENTCHKINF_CAN_LEARN_EPONAS_SONG);
}
return;
case 72:
@ -5596,7 +5596,7 @@ s32 func_800374E0(PlayState* play, Actor* actor, u16 textId) {
ret = 0;
break;
case 0x2043:
if (Flags_GetEventChkInf(EVENTCHKINF_12)) {
if (Flags_GetEventChkInf(EVENTCHKINF_RECEIVED_WEIRD_EGG)) {
break;
}
func_80035B18(play, actor, 0x2044);

View File

@ -4,7 +4,7 @@
QuestHintCmd gOverworldNaviQuestHints[] = {
QUEST_HINT_FLAG(CHECK, EVENTCHKINF_05, false, 0x40),
QUEST_HINT_FLAG(CHECK, EVENTCHKINF_09, false, 0x41),
QUEST_HINT_FLAG(CHECK, EVENTCHKINF_12, false, 0x42),
QUEST_HINT_FLAG(CHECK, EVENTCHKINF_RECEIVED_WEIRD_EGG, false, 0x42),
QUEST_HINT_FLAG(CHECK, EVENTCHKINF_TALON_RETURNED_FROM_CASTLE, false, 0x43),
QUEST_HINT_FLAG(CHECK, EVENTCHKINF_40, false, 0x44),
QUEST_HINT_SONG(CHECK, ITEM_SONG_SARIA, false, 0x45),

View File

@ -208,7 +208,7 @@ void func_80A53278(EnHeishi2* this, PlayState* play) {
this->unk_300 = TEXT_STATE_DONE;
this->actor.textId = 0x7099;
this->actionFunc = func_80A5475C;
} else if (GET_EVENTCHKINF(EVENTCHKINF_12)) {
} else if (GET_EVENTCHKINF(EVENTCHKINF_RECEIVED_WEIRD_EGG)) {
if (this->unk_30E == 0) {
// "Start under the first sleeve!"
osSyncPrintf(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ 1回目袖の下開始! ☆☆☆☆☆ \n" VT_RST);

View File

@ -169,7 +169,7 @@ void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) {
Actor_Kill(&this->actor);
return;
}
this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_16);
this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG);
func_80A69EC0(this);
} else {
func_80A69EC0(this);
@ -358,17 +358,17 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) {
return;
}
if ((GET_EVENTCHKINF(EVENTCHKINF_16) && R_EPONAS_SONG_PLAYED) ||
if ((GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG) && R_EPONAS_SONG_PLAYED) ||
((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == 0xFFF1))) {
func_80A6A4DC(this);
} else {
this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_16);
this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG);
}
newAnimationIdx = this->animationIdx;
animationEnded = SkelAnime_Update(&this->skin.skelAnime);
if (animationEnded || (this->animationIdx == 1) || (this->animationIdx == 0)) {
if (GET_EVENTCHKINF(EVENTCHKINF_15)) {
if (GET_EVENTCHKINF(EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH)) {
distFromHome = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos);
distLinkFromHome = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos);
if (distLinkFromHome > 250.0f) {

View File

@ -461,7 +461,7 @@ u16 EnHy_GetTextId(PlayState* play, Actor* thisx) {
return GET_INFTABLE(INFTABLE_C3) ? 0x701A : 0x7047;
} else if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 0x701A;
} else if (GET_EVENTCHKINF(EVENTCHKINF_10)) {
} else if (GET_EVENTCHKINF(EVENTCHKINF_TALKED_TO_MALON_FIRST_TIME)) {
return 0x701B;
} else if (GET_INFTABLE(INFTABLE_C2)) {
return 0x701C;
@ -508,7 +508,7 @@ u16 EnHy_GetTextId(PlayState* play, Actor* thisx) {
return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x7046 : (GET_INFTABLE(INFTABLE_CD) ? 0x7019 : 0x7018);
}
case ENHY_TYPE_CNE_11:
return GET_INFTABLE(INFTABLE_8B) ? (GET_INFTABLE(INFTABLE_CC) ? 0x7014 : 0x70A4) : 0x7014;
return GET_INFTABLE(INFTABLE_MALON_SPAWNED_AT_HYRULE_CASTLE) ? (GET_INFTABLE(INFTABLE_CC) ? 0x7014 : 0x70A4) : 0x7014;
case ENHY_TYPE_BOJ_12:
if (play->sceneId == SCENE_KAKARIKO_VILLAGE) {
return !IS_DAY ? 0x5084 : 0x5083;

View File

@ -14,13 +14,13 @@ void EnMa1_Destroy(Actor* thisx, PlayState* play);
void EnMa1_Update(Actor* thisx, PlayState* play);
void EnMa1_Draw(Actor* thisx, PlayState* play);
void func_80AA0D88(EnMa1* this, PlayState* play);
void func_80AA0EA0(EnMa1* this, PlayState* play);
void func_80AA0EFC(EnMa1* this, PlayState* play);
void func_80AA0F44(EnMa1* this, PlayState* play);
void func_80AA106C(EnMa1* this, PlayState* play);
void func_80AA10EC(EnMa1* this, PlayState* play);
void func_80AA1150(EnMa1* this, PlayState* play);
void EnMa1_Idle(EnMa1* this, PlayState* play);
void EnMa1_GiveWeirdEgg(EnMa1* this, PlayState* play);
void EnMa1_FinishGivingWeirdEgg(EnMa1* this, PlayState* play);
void EnMa1_IdleTeachSong(EnMa1* this, PlayState* play);
void EnMa1_StartTeachSong(EnMa1* this, PlayState* play);
void EnMa1_TeachSong(EnMa1* this, PlayState* play);
void EnMa1_WaitForPlayback(EnMa1* this, PlayState* play);
void EnMa1_DoNothing(EnMa1* this, PlayState* play);
ActorInit En_Ma1_InitVars = {
@ -58,10 +58,10 @@ static ColliderCylinderInit sCylinderInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
typedef enum {
/* 0 */ ENMA1_ANIM_0,
/* 1 */ ENMA1_ANIM_1,
/* 2 */ ENMA1_ANIM_2,
/* 3 */ ENMA1_ANIM_3
/* 0 */ MALON_ANIM_IDLE_NOMORPH,
/* 1 */ MALON_ANIM_IDLE,
/* 2 */ MALON_ANIM_SING_NOMORPH,
/* 3 */ MALON_ANIM_SING
} EnMa1Animation;
static AnimationFrameCountInfo sAnimationInfo[] = {
@ -71,20 +71,6 @@ static AnimationFrameCountInfo sAnimationInfo[] = {
{ &gMalonChildSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
};
static Vec3f D_80AA16B8 = { 800.0f, 0.0f, 0.0f };
static void* sMouthTextures[] = {
gMalonChildNeutralMouthTex,
gMalonChildSmilingMouthTex,
gMalonChildTalkingMouthTex,
};
static void* sEyeTextures[] = {
gMalonChildEyeOpenTex,
gMalonChildEyeHalfTex,
gMalonChildEyeClosedTex,
};
u16 EnMa1_GetTextId(PlayState* play, Actor* thisx) {
u16 faceReaction = Text_GetFaceReaction(play, 0x17);
@ -94,11 +80,11 @@ u16 EnMa1_GetTextId(PlayState* play, Actor* thisx) {
if (CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
return 0x204A;
}
if (GET_EVENTCHKINF(EVENTCHKINF_16)) {
if (GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG)) {
return 0x2049;
}
if (GET_EVENTCHKINF(EVENTCHKINF_15)) {
if (GET_INFTABLE(INFTABLE_85)) {
if (GET_EVENTCHKINF(EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH)) {
if (GET_INFTABLE(INFTABLE_TOLD_EPONA_IS_SCARED)) {
return 0x2049;
} else {
return 0x2048;
@ -107,11 +93,11 @@ u16 EnMa1_GetTextId(PlayState* play, Actor* thisx) {
if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 0x2047;
}
if (GET_EVENTCHKINF(EVENTCHKINF_12)) {
if (GET_EVENTCHKINF(EVENTCHKINF_RECEIVED_WEIRD_EGG)) {
return 0x2044;
}
if (GET_INFTABLE(INFTABLE_84)) {
if (GET_INFTABLE(INFTABLE_8B)) {
if (GET_INFTABLE(INFTABLE_TALKED_TO_MALON_FIRST_TIME)) {
if (GET_INFTABLE(INFTABLE_MALON_SPAWNED_AT_HYRULE_CASTLE)) {
return 0x2043;
} else {
return 0x2042;
@ -127,23 +113,23 @@ s16 EnMa1_UpdateTalkState(PlayState* play, Actor* thisx) {
case TEXT_STATE_CLOSING:
switch (thisx->textId) {
case 0x2041:
SET_INFTABLE(INFTABLE_84);
SET_EVENTCHKINF(EVENTCHKINF_10);
SET_INFTABLE(INFTABLE_TALKED_TO_MALON_FIRST_TIME);
SET_EVENTCHKINF(EVENTCHKINF_TALKED_TO_MALON_FIRST_TIME);
talkState = NPC_TALK_STATE_IDLE;
break;
case 0x2043:
talkState = NPC_TALK_STATE_TALKING;
break;
case 0x2047:
SET_EVENTCHKINF(EVENTCHKINF_15);
SET_EVENTCHKINF(EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH);
talkState = NPC_TALK_STATE_IDLE;
break;
case 0x2048:
SET_INFTABLE(INFTABLE_85);
SET_INFTABLE(INFTABLE_TOLD_EPONA_IS_SCARED);
talkState = NPC_TALK_STATE_IDLE;
break;
case 0x2049:
SET_EVENTCHKINF(EVENTCHKINF_16);
SET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG);
talkState = NPC_TALK_STATE_IDLE;
break;
case 0x2061:
@ -177,36 +163,44 @@ s16 EnMa1_UpdateTalkState(PlayState* play, Actor* thisx) {
return talkState;
}
s32 func_80AA08C4(EnMa1* this, PlayState* play) {
s32 EnMa1_ShouldSpawn(EnMa1* this, PlayState* play) {
if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneLayer == 5)) {
return 1;
return true;
}
if (!LINK_IS_CHILD) {
return 0;
return false;
}
if (((play->sceneId == SCENE_MARKET_NIGHT) || (play->sceneId == SCENE_MARKET_DAY)) &&
!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) && !GET_INFTABLE(INFTABLE_8B)) {
return 1;
!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) &&
!GET_INFTABLE(INFTABLE_MALON_SPAWNED_AT_HYRULE_CASTLE)) {
return true;
}
if ((play->sceneId == SCENE_HYRULE_CASTLE) && !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
if (GET_INFTABLE(INFTABLE_8B)) {
return 1;
if (GET_INFTABLE(INFTABLE_MALON_SPAWNED_AT_HYRULE_CASTLE)) {
return true;
} else {
SET_INFTABLE(INFTABLE_8B);
return 0;
SET_INFTABLE(INFTABLE_MALON_SPAWNED_AT_HYRULE_CASTLE);
return false;
}
}
if ((play->sceneId == SCENE_LON_LON_BUILDINGS) && IS_NIGHT &&
GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 1;
return true;
}
if (play->sceneId != SCENE_LON_LON_RANCH) {
return 0;
return false;
}
if ((this->actor.shape.rot.z == 3) && IS_DAY && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 1;
return true;
}
return 0;
return false;
}
void EnMa1_UpdateEyes(EnMa1* this) {
@ -226,7 +220,7 @@ void EnMa1_ChangeAnim(EnMa1* this, s32 index) {
sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames);
}
void func_80AA0AF4(EnMa1* this, PlayState* play) {
void EnMa1_UpdateTracking(EnMa1* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 trackingMode;
@ -242,18 +236,16 @@ void func_80AA0AF4(EnMa1* this, PlayState* play) {
Npc_TrackPoint(&this->actor, &this->interactInfo, 0, trackingMode);
}
void func_80AA0B74(EnMa1* this) {
void EnMa1_UpdateSinging(EnMa1* this) {
if (this->skelAnime.animation == &gMalonChildSingAnim) {
if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) {
if (this->isNotSinging) {
// Turn on singing
this->isNotSinging = false;
if (this->singingDisabled) {
this->singingDisabled = false;
Audio_ToggleMalonSinging(false);
}
} else {
if (!this->isNotSinging) {
// Turn off singing
this->isNotSinging = true;
if (!this->singingDisabled) {
this->singingDisabled = true;
Audio_ToggleMalonSinging(true);
}
}
@ -270,7 +262,7 @@ void EnMa1_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit);
if (!func_80AA08C4(this, play)) {
if (!EnMa1_ShouldSpawn(this, play)) {
Actor_Kill(&this->actor);
return;
}
@ -281,11 +273,11 @@ void EnMa1_Init(Actor* thisx, PlayState* play) {
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
this->actionFunc = func_80AA0D88;
EnMa1_ChangeAnim(this, ENMA1_ANIM_2);
this->actionFunc = EnMa1_Idle;
EnMa1_ChangeAnim(this, MALON_ANIM_SING_NOMORPH);
} else {
this->actionFunc = func_80AA0F44;
EnMa1_ChangeAnim(this, ENMA1_ANIM_2);
this->actionFunc = EnMa1_IdleTeachSong;
EnMa1_ChangeAnim(this, MALON_ANIM_SING_NOMORPH);
}
}
@ -296,14 +288,14 @@ void EnMa1_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
void func_80AA0D88(EnMa1* this, PlayState* play) {
void EnMa1_Idle(EnMa1* this, PlayState* play) {
if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if (this->skelAnime.animation != &gMalonChildIdleAnim) {
EnMa1_ChangeAnim(this, ENMA1_ANIM_1);
EnMa1_ChangeAnim(this, MALON_ANIM_IDLE);
}
} else {
if (this->skelAnime.animation != &gMalonChildSingAnim) {
EnMa1_ChangeAnim(this, ENMA1_ANIM_3);
EnMa1_ChangeAnim(this, MALON_ANIM_SING);
}
}
@ -311,45 +303,45 @@ void func_80AA0D88(EnMa1* this, PlayState* play) {
Actor_Kill(&this->actor);
} else if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
this->actionFunc = func_80AA0EA0;
this->actionFunc = EnMa1_GiveWeirdEgg;
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
}
}
}
void func_80AA0EA0(EnMa1* this, PlayState* play) {
void EnMa1_GiveWeirdEgg(EnMa1* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
this->actionFunc = func_80AA0EFC;
this->actionFunc = EnMa1_FinishGivingWeirdEgg;
} else {
Actor_OfferGetItem(&this->actor, play, GI_WEIRD_EGG, 120.0f, 10.0f);
}
}
void func_80AA0EFC(EnMa1* this, PlayState* play) {
void EnMa1_FinishGivingWeirdEgg(EnMa1* this, PlayState* play) {
if (this->interactInfo.talkState == NPC_TALK_STATE_ITEM_GIVEN) {
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
this->actionFunc = func_80AA0D88;
SET_EVENTCHKINF(EVENTCHKINF_12);
this->actionFunc = EnMa1_Idle;
SET_EVENTCHKINF(EVENTCHKINF_RECEIVED_WEIRD_EGG);
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
}
}
void func_80AA0F44(EnMa1* this, PlayState* play) {
void EnMa1_IdleTeachSong(EnMa1* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) {
if (this->skelAnime.animation != &gMalonChildIdleAnim) {
EnMa1_ChangeAnim(this, ENMA1_ANIM_1);
EnMa1_ChangeAnim(this, MALON_ANIM_IDLE);
}
} else {
if (this->skelAnime.animation != &gMalonChildSingAnim) {
EnMa1_ChangeAnim(this, ENMA1_ANIM_3);
EnMa1_ChangeAnim(this, MALON_ANIM_SING);
}
}
if (GET_EVENTCHKINF(EVENTCHKINF_16)) {
if (GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG)) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
player->stateFlags2 |= PLAYER_STATE2_25;
player->unk_6A8 = &this->actor;
@ -357,32 +349,32 @@ void func_80AA0F44(EnMa1* this, PlayState* play) {
Message_StartTextbox(play, this->actor.textId, NULL);
this->interactInfo.talkState = NPC_TALK_STATE_TALKING;
this->actor.flags |= ACTOR_FLAG_16;
this->actionFunc = func_80AA106C;
this->actionFunc = EnMa1_StartTeachSong;
} else if (this->actor.xzDistToPlayer < 30.0f + (f32)this->collider.dim.radius) {
player->stateFlags2 |= PLAYER_STATE2_23;
}
}
}
void func_80AA106C(EnMa1* this, PlayState* play) {
void EnMa1_StartTeachSong(EnMa1* this, PlayState* play) {
GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23;
if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_MALON);
Message_StartOcarina(play, OCARINA_ACTION_TEACH_EPONA);
this->actor.flags &= ~ACTOR_FLAG_16;
this->actionFunc = func_80AA10EC;
this->actionFunc = EnMa1_TeachSong;
}
}
void func_80AA10EC(EnMa1* this, PlayState* play) {
void EnMa1_TeachSong(EnMa1* this, PlayState* play) {
GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23;
if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) {
Message_StartOcarina(play, OCARINA_ACTION_PLAYBACK_EPONA);
this->actionFunc = func_80AA1150;
this->actionFunc = EnMa1_WaitForPlayback;
}
}
void func_80AA1150(EnMa1* this, PlayState* play) {
void EnMa1_WaitForPlayback(EnMa1* this, PlayState* play) {
GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23;
if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) {
play->nextEntranceIndex = ENTR_LON_LON_RANCH_0;
@ -402,32 +394,36 @@ void EnMa1_Update(Actor* thisx, PlayState* play) {
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
SkelAnime_Update(&this->skelAnime);
EnMa1_UpdateEyes(this);
this->actionFunc(this, play);
if (this->actionFunc != EnMa1_DoNothing) {
Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, (f32)this->collider.dim.radius + 30.0f,
EnMa1_GetTextId, EnMa1_UpdateTalkState);
}
func_80AA0B74(this);
func_80AA0AF4(this, play);
EnMa1_UpdateSinging(this);
EnMa1_UpdateTracking(this, play);
}
s32 EnMa1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnMa1* this = (EnMa1*)thisx;
Vec3s limbRot;
if ((limbIndex == 2) || (limbIndex == 5)) {
if ((limbIndex == CHILD_MALON_LIMB_LEFT_THIGH) || (limbIndex == CHILD_MALON_LIMB_RIGHT_THIGH)) {
*dList = NULL;
}
if (limbIndex == 15) {
if (limbIndex == CHILD_MALON_LIMB_HEAD) {
Matrix_Translate(1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
limbRot = this->interactInfo.headRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY);
Matrix_Translate(-1400.0f, 0.0f, 0.0f, MTXMODE_APPLY);
}
if (limbIndex == 8) {
if (limbIndex == CHILD_MALON_LIMB_CHEST) {
limbRot = this->interactInfo.torsoRot;
Matrix_RotateX(BINANG_TO_RAD_ALT(-limbRot.y), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(-limbRot.x), MTXMODE_APPLY);
@ -437,14 +433,24 @@ s32 EnMa1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
void EnMa1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnMa1* this = (EnMa1*)thisx;
Vec3f vec = D_80AA16B8;
Vec3f offset = { 800.0f, 0.0f, 0.0f };
if (limbIndex == 15) {
Matrix_MultVec3f(&vec, &this->actor.focus.pos);
if (limbIndex == CHILD_MALON_LIMB_HEAD) {
Matrix_MultVec3f(&offset, &this->actor.focus.pos);
}
}
void EnMa1_Draw(Actor* thisx, PlayState* play) {
static void* sMouthTextures[] = {
gMalonChildNeutralMouthTex,
gMalonChildSmilingMouthTex,
gMalonChildTalkingMouthTex,
};
static void* sEyeTextures[] = {
gMalonChildEyeOpenTex,
gMalonChildEyeHalfTex,
gMalonChildEyeClosedTex,
};
EnMa1* this = (EnMa1*)thisx;
Camera* activeCam;
f32 distFromCamEye;

View File

@ -13,7 +13,7 @@ typedef struct EnMa1 {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnMa1ActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ s16 isNotSinging;
/* 0x01E0 */ s16 singingDisabled;
/* 0x01E2 */ s16 blinkTimer;
/* 0x01E4 */ s16 eyeIndex;
/* 0x01E6 */ s16 mouthIndex;