1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

object_sa OK (#789)

* object_sa OK

* PR fixes (AngheloAlf)

* PR fixes (Roman)
This commit is contained in:
louist103 2021-05-23 16:02:54 -04:00 committed by GitHub
parent 4f9c02aaec
commit aebf11b8be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 282 additions and 171 deletions

View file

@ -0,0 +1,100 @@
<Root>
<File Name="object_sa" Segment="6">
<Skeleton Name="gSariaSkel" Type="Flex" LimbType="Standard" Offset="0xB1A0"/>
<Limb Name="gSariaRootLimb" LimbType="Standard" Offset="0xB0A0"/>
<Limb Name="gSariaWaistLimb" LimbType="Standard" Offset="0xB0AC"/>
<Limb Name="gSariaLeftThighLimb" LimbType="Standard" Offset="0xB0B8"/>
<Limb Name="gSariaLeftShinLimb" LimbType="Standard" Offset="0xB0C4"/>
<Limb Name="gSariaLeftFootLimb" LimbType="Standard" Offset="0xB0D0"/>
<Limb Name="gSariaRightThighLimb" LimbType="Standard" Offset="0xB0DC"/>
<Limb Name="gSariaRightShinLimb" LimbType="Standard" Offset="0xB0E8"/>
<Limb Name="gSariaRightFootLimb" LimbType="Standard" Offset="0xB0F4"/>
<Limb Name="gSariaRightChestLimb" LimbType="Standard" Offset="0xB100"/>
<Limb Name="gSariaLeftShoulderLimb" LimbType="Standard" Offset="0xB10C"/>
<Limb Name="gSariaLeftArmLimb" LimbType="Standard" Offset="0xB118"/>
<Limb Name="gSariaLeftHandLimb" LimbType="Standard" Offset="0xB124"/>
<Limb Name="gSariaRightShoulderLimb" LimbType="Standard" Offset="0xB130"/>
<Limb Name="gSariaRightArmLimb" LimbType="Standard" Offset="0xB13C"/>
<Limb Name="gSariaRightHandLimb" LimbType="Standard" Offset="0xB148"/>
<Limb Name="gSariaHeadLimb" LimbType="Standard" Offset="0xB154"/>
<Animation Name="gSariaSealGanonAnim" Offset="0x1334"/>
<Animation Name="gSariaOcarinaToMouthAnim" Offset="0x1D50"/>
<Animation Name="gSariaWaitArmsToSideAnim" Offset="0x21D8"/>
<Animation Name="gSariaPlayingOcarinaAnim" Offset="0xBAEC"/>
<Animation Name="gSariaStopPlayingOcarinaAnim" Offset="0xC500"/>
<Animation Name="gSariaLinkLearnedSariasSongAnim" Offset="0xCFD8"/>
<Animation Name="gSariaReturnToOcarinaAnim" Offset="0xD7E8"/>
<Animation Name="gSariaGiveForestMedallionAnim" Offset="0xDF80"/>
<Animation Name="gSariaGiveForestMedallionStandAnim" Offset="0xE500"/>
<Animation Name="gSariaLookUpArmExtendedAnim" Offset="0xE908"/>
<Animation Name="gSariaRunAnim" Offset="0xEBB0"/>
<Animation Name="gSariaWaveAnim" Offset="0xF1D4"/>
<Animation Name="gSariaSitting1Anim" Offset="0xF580"/>
<Animation Name="gSariaSitting2Anim" Offset="0xFCE0"/>
<Animation Name="gSariaSitting3Anim" Offset="0xFFD4"/>
<Animation Name="gSariaLookOverShoulderAnim" Offset="0x10C44"/>
<Animation Name="gSariaWaitOnBridgeAnim" Offset="0x1113C"/>
<Animation Name="gSariaTransitionHandsSideToBackAnim" Offset="0x11580"/>
<Animation Name="gSariaHandsOutAnim" Offset="0x1186C"/>
<Animation Name="gSariaTransitionHandsSideToHipsAnim" Offset="0x11C38"/>
<Animation Name="gSariaHandsBehindBackWaitAnim" Offset="0x12100"/>
<Animation Name="gSariaTransitionHandsSideToChestToSideAnim" Offset="0x1291C"/>
<Animation Name="gSariaRightArmExtendedWaitAnim" Offset="0x13008"/>
<Animation Name="gSariaGiveLinkOcarinaAnim" Offset="0x135EC"/>
<Animation Name="gSariaHoldOutOcarinaAnim" Offset="0x13CD8"/>
<Animation Name="gSariaHoldOcarinaAnim" Offset="0x140BC"/>
<Animation Name="gSariaStandHandsOnHipsAnim" Offset="0x14470"/>
<Animation Name="gSariaExtendRightArmAnim" Offset="0x14850"/>
<Animation Name="gSariaHandsOnFaceAnim" Offset="0x15220"/>
<DList Name="gSariaHeadDL" Offset="0x6BF8"/>
<DList Name="gSariaLeftHandDL" Offset="0x7900"/>
<DList Name="gSariaRightHandDL" Offset="0x7A40"/>
<DList Name="gSariaRightHandAndOcarinaDL" Offset="0x7B80"/>
<DList Name="gSariaChestDL" Offset="0x9918"/>
<DList Name="gSariaRightShoulderDL" Offset="0x9AA8"/>
<DList Name="gSariaRightArmDL" Offset="0x9C70"/>
<DList Name="gSariaLeftShoulderDL" Offset="0x9DA8"/>
<DList Name="gSariaLeftArmDL" Offset="0x9F70"/>
<DList Name="gSariaWaistDL" Offset="0xA0A8"/>
<DList Name="gSariaRightThighDL" Offset="0xA300"/>
<DList Name="gSariaRightShinDL" Offset="0xA550"/>
<DList Name="gSariaRightFootDL" Offset="0xA810"/>
<DList Name="gSariaLeftThighDL" Offset="0xA9D0"/>
<DList Name="gSariaLeftShinDL" Offset="0xAC20"/>
<DList Name="gSariaLeftFootDL" Offset="0xAEE0"/>
<Texture Name="gSariaClothesTLUT" OutName="clothes_tlut" Format="rgb5a1" Width="18" Height="6" Offset="0x21F0"/>
<Texture Name="gSariaMouthTLUT" OutName="mouth_tlut" Format="rgb5a1" Width="18" Height="6" Offset="0x2CF8"/>
<Texture Name="gSariaEyeTLUT" OutName="eye_tlut" Format="rgb5a1" Width="18" Height="6" Offset="0x2B00"/>
<Texture Name="gSariaSkinTLUT" OutName="skin_tlut" Format="rgb5a1" Width="8" Height="9" Offset="0x2A70"/>
<Texture Name="gSariaUnkTLUT" OutName="unk_tlut" Format="rgb5a1" Width="16" Height="9" Offset="0x2BD8"/>
<Texture Name="gSariaBootsTex" OutName="boots" Format="ci8" Width="16" Height="16" Offset="0x23F0"/>
<Texture Name="gSariaGreenTex" OutName="green" Format="ci8" Width="8" Height="8" Offset="0x24F0"/>
<Texture Name="gSariaKneeTex" OutName="knee" Format="ci8" Width="16" Height="16" Offset="0x2570"/>
<Texture Name="gSariaTorsoTex" OutName="torso" Format="ci8" Width="16" Height="16" Offset="0x2670"/>
<Texture Name="gSariaBeltTex" OutName="belt" Format="ci8" Width="16" Height="16" Offset="0x2770"/>
<Texture Name="gSariaUnkGreenTex" Format="ci8" Width="16" Height="8" Offset="0x2870"/>
<Texture Name="gSariaUnusedHandTex" OutName="unused_hand" Format="ci8" Width="16" Height="16" Offset="0x28F0"/>
<Texture Name="gSariaSleeveTex" OutName="sleeve" Format="ci8" Width="8" Height="16" Offset="0x29F0"/>
<Texture Name="gSariaHairTex" OutName="hair" Format="ci8" Width="8" Height="16" Offset="0x2EC8"/>
<Texture Name="gSariaEyeOpenTex" OutName="eye_open" Format="ci8" Width="32" Height="32" Offset="0x2F48"/>
<Texture Name="gSariaMouthClosedTex" OutName="mouth_closed" Format="ci8" Width="32" Height="16" Offset="0x3348"/>
<Texture Name="gSariaSkinTex" OutName="skin" Format="ci8" Width="8" Height="8" Offset="0x3548"/>
<Texture Name="gSariaMouthClosed2Tex" OutName="mouth_closed2" Format="ci8" Width="32" Height="16" Offset="0x3588"/>
<Texture Name="gSariaEarTex" OutName="ear" Format="ci8" Width="8" Height="8" Offset="0x3788"/>
<Texture Name="gSariaCollarTex" OutName="collar" Format="ci8" Width="8" Height="8" Offset="0x37C8"/>
<Texture Name="gSariaHandTex" OutName="hand" Format="ci8" Width="8" Height="8" Offset="0x3808"/>
<Texture Name="gSariaEyeClosedTex" OutName="eye_closed" Format="ci8" Width="32" Height="32" Offset="0x3848"/>
<Texture Name="gSariaEyeHalfTex" OutName="eye_half" Format="ci8" Width="32" Height="32" Offset="0x3C48"/>
<Texture Name="gSariaFairyOcarinaTex" OutName="fairy_ocarina" Format="rgb5a1" Width="32" Height="16" Offset="0x4048"/>
<Texture Name="gSariaMouthSmilingOpenTex" OutName="mouth_smiling_open" Format="ci8" Width="32" Height="16" Offset="0x4448"/>
<Texture Name="gSariaMouthFrowningTex" OutName="mouth_frowning" Format="ci8" Width="32" Height="16" Offset="0x4648"/>
<Texture Name="gSariaEyeSuprisedTex" OutName="eye_suprised" Format="ci8" Width="32" Height="32" Offset="0x4848"/>
<Texture Name="gSariaMouthSuprisedTex" OutName="mouth_suprised" Format="ci8" Width="32" Height="16" Offset="0x4C48"/>
<Texture Name="gSariaEyeSadTex" OutName="eye_sad" Format="ci8" Width="32" Height="32" Offset="0x4E48"/>
</File>
</Root>

3
spec
View file

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

View file

@ -6,6 +6,7 @@
#include "z_demo_sa.h" #include "z_demo_sa.h"
#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h"
#include "objects/object_sa/object_sa.h"
#include "vt.h" #include "vt.h"
@ -40,16 +41,33 @@ void func_8098FC9C(DemoSa* this, GlobalContext* globalCtx);
void func_8098FCD4(DemoSa* this, GlobalContext* globalCtx); void func_8098FCD4(DemoSa* this, GlobalContext* globalCtx);
void func_8098FD0C(DemoSa* this, GlobalContext* globalCtx); void func_8098FD0C(DemoSa* this, GlobalContext* globalCtx);
void func_8098FEA8(DemoSa* this, GlobalContext* globalCtx); void DemoSa_DrawNothing(DemoSa* this, GlobalContext* globalCtx);
void func_8098FEB4(DemoSa* this, GlobalContext* globalCtx); void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx);
void func_8098F1C0(DemoSa* this, GlobalContext* globalCtx); void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx);
static UNK_PTR D_809900E0[] = { typedef enum {
0x06002F48, 0x06003C48, 0x06003848, 0x06004848, 0x06004E48, /* 0 */ SARIA_EYE_OPEN,
/* 1 */ SARIA_EYE_HALF,
/* 2 */ SARIA_EYE_CLOSED,
/* 3 */ SARIA_EYE_SUPRISED,
/* 4 */ SARIA_EYE_SAD
} SariaEyeState;
typedef enum {
/* 0 */ SARIA_MOUTH_CLOSED2,
/* 1 */ SARIA_MOUTH_SUPRISED,
/* 2 */ SARIA_MOUTH_CLOSED,
/* 3 */ SARIA_MOUTH_SMILING_OPEN,
/* 4 */ SARIA_MOUTH_FROWNING
} SariaMouthState;
static u64* sEyeTextures[] = {
gSariaEyeOpenTex, gSariaEyeHalfTex, gSariaEyeClosedTex, gSariaEyeSuprisedTex, gSariaEyeSadTex,
}; };
static UNK_PTR D_809900F4[] = { static u64* sMouthTextures[] = {
0x06003588, 0x06004C48, 0x06003348, 0x06004448, 0x06004648, gSariaMouthClosed2Tex, gSariaMouthSuprisedTex, gSariaMouthClosedTex,
gSariaMouthSmilingOpenTex, gSariaMouthFrowningTex,
}; };
static u32 D_80990108 = 0; static u32 D_80990108 = 0;
@ -63,9 +81,9 @@ static DemoSaActionFunc sActionFuncs[] = {
}; };
static DemoSaDrawFunc sDrawFuncs[] = { static DemoSaDrawFunc sDrawFuncs[] = {
func_8098FEA8, DemoSa_DrawNothing,
func_8098FEB4, DemoSa_DrawOpa,
func_8098F1C0, DemoSa_DrawXlu,
}; };
const ActorInit Demo_Sa_InitVars = { const ActorInit Demo_Sa_InitVars = {
@ -86,41 +104,27 @@ void DemoSa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
SkelAnime_Free(&this->skelAnime, globalCtx); SkelAnime_Free(&this->skelAnime, globalCtx);
} }
extern AnimationHeader D_06001334;
extern AnimationHeader D_060021D8;
extern Gfx D_06007B80[];
extern FlexSkeletonHeader D_0600B1A0;
extern AnimationHeader D_0600DF80;
extern AnimationHeader D_0600E500;
extern AnimationHeader D_0600F580;
extern AnimationHeader D_0600FCE0;
extern AnimationHeader D_0600FFD4;
extern AnimationHeader D_0601113C;
extern AnimationHeader D_060135EC;
extern AnimationHeader D_06013CD8;
extern AnimationHeader D_060140BC;
void func_8098E480(DemoSa* this) { void func_8098E480(DemoSa* this) {
s32 pad[2]; s32 pad[2];
s16* unk_190 = &this->unk_190; s16* eyeIndex = &this->eyeIndex;
s16* unk_192 = &this->unk_192; s16* blinkTimer = &this->blinkTimer;
if (DECR(*unk_192) == 0) { if (DECR(*blinkTimer) == 0) {
*unk_192 = Rand_S16Offset(0x3C, 0x3C); *blinkTimer = Rand_S16Offset(0x3C, 0x3C);
} }
*unk_190 = *unk_192; *eyeIndex = *blinkTimer;
if (*unk_190 >= 3) { if (*eyeIndex >= 3) {
*unk_190 = 0; *eyeIndex = 0;
} }
} }
void func_8098E508(DemoSa* this, s16 arg1) { void DemoSa_SetEyeIndex(DemoSa* this, s16 eyeIndex) {
this->unk_190 = arg1; this->eyeIndex = eyeIndex;
} }
void func_8098E51C(DemoSa* this, s16 arg1) { void DemoSa_SetMouthIndex(DemoSa* this, s16 mouthIndex) {
this->unk_194 = arg1; this->mouthIndex = mouthIndex;
} }
void func_8098E530(DemoSa* this) { void func_8098E530(DemoSa* this) {
@ -212,10 +216,10 @@ void func_8098E76C(DemoSa* this, AnimationHeader* animHeaderSeg, u8 arg2, f32 tr
} }
void func_8098E7FC(DemoSa* this, GlobalContext* globalCtx) { void func_8098E7FC(DemoSa* this, GlobalContext* globalCtx) {
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, &D_060021D8, NULL, NULL, 0); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0);
this->actor.shape.yOffset = -10000.0f; this->actor.shape.yOffset = -10000.0f;
func_8098E508(this, 1); DemoSa_SetEyeIndex(this, SARIA_EYE_HALF);
func_8098E51C(this, 0); DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED2);
} }
void func_8098E86C(DemoSa* this, GlobalContext* globalCtx) { void func_8098E86C(DemoSa* this, GlobalContext* globalCtx) {
@ -282,8 +286,8 @@ void func_8098EA68(DemoSa* this, GlobalContext* globalCtx) {
if (globalCtx->csCtx.state != CS_STATE_IDLE) { if (globalCtx->csCtx.state != CS_STATE_IDLE) {
npcAction = globalCtx->csCtx.npcActions[4]; npcAction = globalCtx->csCtx.npcActions[4];
if ((npcAction != NULL) && (npcAction->action == 3)) { if ((npcAction != NULL) && (npcAction->action == 3)) {
Animation_Change(&this->skelAnime, &D_0600DF80, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600DF80), Animation_Change(&this->skelAnime, &gSariaGiveForestMedallionAnim, 1.0f, 0.0f,
ANIMMODE_ONCE, -4.0f); Animation_GetLastFrame(&gSariaGiveForestMedallionAnim), ANIMMODE_ONCE, -4.0f);
this->action = 4; this->action = 4;
} }
} }
@ -291,8 +295,8 @@ void func_8098EA68(DemoSa* this, GlobalContext* globalCtx) {
void func_8098EB00(DemoSa* this, s32 arg1) { void func_8098EB00(DemoSa* this, s32 arg1) {
if (arg1 != 0) { if (arg1 != 0) {
Animation_Change(&this->skelAnime, &D_0600E500, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600E500), ANIMMODE_LOOP, Animation_Change(&this->skelAnime, &gSariaGiveForestMedallionStandAnim, 1.0f, 0.0f,
0.0f); Animation_GetLastFrame(&gSariaGiveForestMedallionStandAnim), ANIMMODE_LOOP, 0.0f);
this->action = 5; this->action = 5;
} }
} }
@ -348,22 +352,22 @@ void func_8098ECCC(DemoSa* this, GlobalContext* globalCtx) {
void func_8098ECF4(DemoSa* this, GlobalContext* globalCtx) { void func_8098ECF4(DemoSa* this, GlobalContext* globalCtx) {
s32 pad[2]; s32 pad[2];
SkelAnime* skelAnime = &this->skelAnime; SkelAnime* skelAnime = &this->skelAnime;
f32 frameCount = Animation_GetLastFrame(&D_06001334); f32 frameCount = Animation_GetLastFrame(&gSariaSealGanonAnim);
SkelAnime_InitFlex(globalCtx, skelAnime, &D_0600B1A0, NULL, NULL, NULL, 0); SkelAnime_InitFlex(globalCtx, skelAnime, &gSariaSkel, NULL, NULL, NULL, 0);
Animation_Change(skelAnime, &D_06001334, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); Animation_Change(skelAnime, &gSariaSealGanonAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f);
this->action = 7; this->action = 7;
this->actor.shape.shadowAlpha = 0; this->actor.shape.shadowAlpha = 0;
func_8098E508(this, 2); DemoSa_SetEyeIndex(this, SARIA_EYE_CLOSED);
func_8098E51C(this, 2); DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED);
} }
void func_8098EDB0(DemoSa* this) { void func_8098EDB0(DemoSa* this) {
f32 curFrame = this->skelAnime.curFrame; f32 curFrame = this->skelAnime.curFrame;
if ((this->skelAnime.mode == 2) && (curFrame >= 32.0f)) { if ((this->skelAnime.mode == 2) && (curFrame >= 32.0f)) {
func_8098E508(this, 1); DemoSa_SetEyeIndex(this, SARIA_EYE_HALF);
func_8098E51C(this, 0); DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED2);
} }
} }
@ -450,13 +454,13 @@ void func_8098F16C(DemoSa* this, GlobalContext* globalCtx) {
func_8098E554(this, globalCtx); func_8098E554(this, globalCtx);
} }
void func_8098F1C0(DemoSa* this, GlobalContext* globalCtx) { void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx) {
s32 pad[2]; s32 pad[2];
s16 unk_190 = this->unk_190; s16 eyeIndex = this->eyeIndex;
UNK_PTR sp78 = D_809900E0[unk_190]; UNK_PTR sp78 = sEyeTextures[eyeIndex];
s16 unk_194 = this->unk_194; s16 mouthIndex = this->mouthIndex;
s32 pad2; s32 pad2;
UNK_PTR sp6C = D_809900F4[unk_194]; UNK_PTR sp6C = sMouthTextures[mouthIndex];
SkelAnime* skelAnime = &this->skelAnime; SkelAnime* skelAnime = &this->skelAnime;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 296); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 296);
@ -476,7 +480,7 @@ void func_8098F1C0(DemoSa* this, GlobalContext* globalCtx) {
} }
void func_8098F390(DemoSa* this, GlobalContext* globalCtx) { void func_8098F390(DemoSa* this, GlobalContext* globalCtx) {
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, &D_060021D8, NULL, NULL, 0); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0);
this->action = 10; this->action = 10;
this->drawConfig = 1; this->drawConfig = 1;
} }
@ -488,7 +492,7 @@ void func_8098F3F0(DemoSa* this, GlobalContext* globalCtx) {
} }
void func_8098F420(DemoSa* this, GlobalContext* globalCtx) { void func_8098F420(DemoSa* this, GlobalContext* globalCtx) {
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, &D_0600FFD4, NULL, NULL, 0); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaSitting3Anim, NULL, NULL, 0);
this->action = 11; this->action = 11;
this->drawConfig = 0; this->drawConfig = 0;
this->actor.shape.shadowAlpha = 0; this->actor.shape.shadowAlpha = 0;
@ -523,18 +527,18 @@ void func_8098F544(DemoSa* this) {
} }
void func_8098F590(DemoSa* this) { void func_8098F590(DemoSa* this) {
func_8098E76C(this, &D_0600F580, 2, -8.0f, 0); func_8098E76C(this, &gSariaSitting1Anim, 2, -8.0f, 0);
this->action = 14; this->action = 14;
} }
void func_8098F5D0(DemoSa* this) { void func_8098F5D0(DemoSa* this) {
func_8098E76C(this, &D_0600FCE0, 2, 0.0f, 0); func_8098E76C(this, &gSariaSitting2Anim, 2, 0.0f, 0);
this->action = 15; this->action = 15;
} }
void func_8098F610(DemoSa* this, s32 arg1) { void func_8098F610(DemoSa* this, s32 arg1) {
if (arg1 != 0) { if (arg1 != 0) {
func_8098E76C(this, &D_0600FFD4, 0, 0.0f, 0); func_8098E76C(this, &gSariaSitting3Anim, 0, 0.0f, 0);
this->action = 13; this->action = 13;
} }
} }
@ -604,14 +608,14 @@ void func_8098F7FC(DemoSa* this, GlobalContext* globalCtx) {
void func_8098F83C(DemoSa* this, GlobalContext* globalCtx) { void func_8098F83C(DemoSa* this, GlobalContext* globalCtx) {
Vec3f* thisPos = &this->actor.world.pos; Vec3f* thisPos = &this->actor.world.pos;
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, &D_0601113C, NULL, NULL, 0); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitOnBridgeAnim, NULL, NULL, 0);
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, thisPos->x, thisPos->y, thisPos->z, Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, thisPos->x, thisPos->y, thisPos->z,
0, 0, 0, FAIRY_KOKIRI); 0, 0, 0, FAIRY_KOKIRI);
this->action = 16; this->action = 16;
this->drawConfig = 0; this->drawConfig = 0;
this->actor.shape.shadowAlpha = 0; this->actor.shape.shadowAlpha = 0;
func_8098E508(this, 4); DemoSa_SetEyeIndex(this, SARIA_EYE_SAD);
func_8098E51C(this, 2); DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED);
} }
void func_8098F8F8(DemoSa* this) { void func_8098F8F8(DemoSa* this) {
@ -643,13 +647,13 @@ void func_8098F998(DemoSa* this, GlobalContext* globalCtx) {
this->unk_1B0 = 0; this->unk_1B0 = 0;
this->actor.shape.shadowAlpha = 0; this->actor.shape.shadowAlpha = 0;
} else { } else {
func_8098E76C(this, &D_0601113C, 0, 0.0f, 0); func_8098E76C(this, &gSariaWaitOnBridgeAnim, 0, 0.0f, 0);
this->action = 18; this->action = 18;
this->drawConfig = 1; this->drawConfig = 1;
this->unk_1B0 = 0; this->unk_1B0 = 0;
this->actor.shape.shadowAlpha = 0xFF; this->actor.shape.shadowAlpha = 0xFF;
} }
func_8098E508(this, 4); DemoSa_SetEyeIndex(this, SARIA_EYE_SAD);
} }
void func_8098FA2C(DemoSa* this) { void func_8098FA2C(DemoSa* this) {
@ -662,16 +666,16 @@ void func_8098FA2C(DemoSa* this) {
} }
void func_8098FA84(DemoSa* this) { void func_8098FA84(DemoSa* this) {
func_8098E76C(this, &D_060140BC, 0, 0.0f, 0); func_8098E76C(this, &gSariaHoldOcarinaAnim, 0, 0.0f, 0);
this->action = 19; this->action = 19;
this->drawConfig = 1; this->drawConfig = 1;
this->unk_1B0 = 1; this->unk_1B0 = 1;
this->actor.shape.shadowAlpha = 0xFF; this->actor.shape.shadowAlpha = 0xFF;
func_8098E508(this, 2); DemoSa_SetEyeIndex(this, SARIA_EYE_CLOSED);
} }
void func_8098FAE0(DemoSa* this) { void func_8098FAE0(DemoSa* this) {
func_8098E76C(this, &D_060135EC, 2, -8.0f, 0); func_8098E76C(this, &gSariaGiveLinkOcarinaAnim, 2, -8.0f, 0);
this->action = 20; this->action = 20;
this->drawConfig = 1; this->drawConfig = 1;
this->unk_1B0 = 1; this->unk_1B0 = 1;
@ -680,7 +684,7 @@ void func_8098FAE0(DemoSa* this) {
void func_8098FB34(DemoSa* this, s32 arg1) { void func_8098FB34(DemoSa* this, s32 arg1) {
if (arg1 != 0) { if (arg1 != 0) {
func_8098E76C(this, &D_06013CD8, 0, 0, 0); func_8098E76C(this, &gSariaHoldOutOcarinaAnim, 0, 0, 0);
} }
} }
@ -780,30 +784,30 @@ s32 DemoSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList
DemoSa* this = THIS; DemoSa* this = THIS;
if ((limbIndex == 15) && (this->unk_1B0 != 0)) { if ((limbIndex == 15) && (this->unk_1B0 != 0)) {
*dList = D_06007B80; *dList = gSariaRightHandAndOcarinaDL;
} }
return false; return false;
} }
void func_8098FEA8(DemoSa* this, GlobalContext* globalCtx) { void DemoSa_DrawNothing(DemoSa* this, GlobalContext* globalCtx) {
} }
void func_8098FEB4(DemoSa* this, GlobalContext* globalCtx) { void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx) {
s32 pad[2]; s32 pad[2];
s16 unk_190 = this->unk_190; s16 eyeIndex = this->eyeIndex;
UNK_PTR sp70 = D_809900E0[unk_190]; UNK_PTR eyeTex = sEyeTextures[eyeIndex];
s32 pad2; s32 pad2;
s16 unk_194 = this->unk_194; s16 mouthIndex = this->mouthIndex;
UNK_PTR sp64 = D_809900F4[unk_194]; UNK_PTR mouthTex = sMouthTextures[mouthIndex];
SkelAnime* skelAnime = &this->skelAnime; SkelAnime* skelAnime = &this->skelAnime;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa.c", 602); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa.c", 602);
func_80093D18(globalCtx->state.gfxCtx); func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sp70)); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex));
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sp70)); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex));
gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sp64)); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(mouthTex));
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]);

View file

@ -12,9 +12,9 @@ typedef void (*DemoSaDrawFunc)(struct DemoSa*, GlobalContext*);
typedef struct DemoSa { typedef struct DemoSa {
/* 0x0000 */ Actor actor; /* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime; /* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ s16 unk_190; /* 0x0190 */ s16 eyeIndex;
/* 0x0192 */ s16 unk_192; /* 0x0192 */ s16 blinkTimer;
/* 0x0194 */ s16 unk_194; /* 0x0194 */ s16 mouthIndex;
/* 0x0198 */ s32 action; /* 0x0198 */ s32 action;
/* 0x019C */ s32 drawConfig; /* 0x019C */ s32 drawConfig;
/* 0x01A0 */ f32 unk_1A0; /* 0x01A0 */ f32 unk_1A0;

View file

@ -1,5 +1,6 @@
#include "z_en_sa.h" #include "z_en_sa.h"
#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h"
#include "objects/object_sa/object_sa.h"
#define FLAGS 0x02000019 #define FLAGS 0x02000019
@ -16,6 +17,22 @@ void func_80AF683C(EnSa* this, GlobalContext* globalCtx);
void func_80AF68E4(EnSa* this, GlobalContext* globalCtx); void func_80AF68E4(EnSa* this, GlobalContext* globalCtx);
void func_80AF6B20(EnSa* this, GlobalContext* globalCtx); void func_80AF6B20(EnSa* this, GlobalContext* globalCtx);
typedef enum {
/* 0 */ SARIA_EYE_OPEN,
/* 1 */ SARIA_EYE_HALF,
/* 2 */ SARIA_EYE_CLOSED,
/* 3 */ SARIA_EYE_SUPRISED,
/* 4 */ SARIA_EYE_SAD
} SariaEyeState;
typedef enum {
/* 0 */ SARIA_MOUTH_CLOSED2,
/* 1 */ SARIA_MOUTH_SUPRISED,
/* 2 */ SARIA_MOUTH_CLOSED,
/* 3 */ SARIA_MOUTH_SMILING_OPEN,
/* 4 */ SARIA_MOUTH_FROWNING
} SariaMouthState;
const ActorInit En_Sa_InitVars = { const ActorInit En_Sa_InitVars = {
ACTOR_EN_SA, ACTOR_EN_SA,
ACTORCAT_NPC, ACTORCAT_NPC,
@ -53,32 +70,36 @@ static CollisionCheckInfoInit2 sColChkInfoInit = {
}; };
static struct_D_80AA1678 sAnimationInfo[] = { static struct_D_80AA1678 sAnimationInfo[] = {
{ 0x060021D8, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x0600E908, 1.0f, ANIMMODE_ONCE, -10.0f }, { &gSariaWaitArmsToSideAnim, 1.0f, ANIMMODE_LOOP, 0.0f },
{ 0x0600F1D4, 1.0f, ANIMMODE_LOOP, -10.0f }, { 0x0600EBB0, 1.0f, ANIMMODE_LOOP, -10.0f }, { &gSariaLookUpArmExtendedAnim, 1.0f, ANIMMODE_ONCE, -10.0f },
{ 0x060021D8, 1.0f, ANIMMODE_LOOP, -10.0f }, { 0x06010C44, 1.0f, ANIMMODE_LOOP, -10.0f }, { &gSariaWaveAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
{ 0x0600BAEC, 1.0f, ANIMMODE_LOOP, -10.0f }, { 0x0600C500, 1.0f, ANIMMODE_ONCE, -10.0f }, { &gSariaRunAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
{ 0x06001D50, 1.0f, ANIMMODE_ONCE, -10.0f }, { 0x0600CFD8, 1.0f, ANIMMODE_ONCE, -10.0f }, { &gSariaWaitArmsToSideAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
{ 0x0600D7E8, 1.0f, ANIMMODE_ONCE, -10.0f }, { 0x0600BAEC, 1.0f, ANIMMODE_LOOP, 0.0f }, { &gSariaLookOverShoulderAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
{ &gSariaPlayingOcarinaAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
{ &gSariaStopPlayingOcarinaAnim, 1.0f, ANIMMODE_ONCE, -10.0f },
{ &gSariaOcarinaToMouthAnim, 1.0f, ANIMMODE_ONCE, -10.0f },
{ &gSariaLinkLearnedSariasSongAnim, 1.0f, ANIMMODE_ONCE, -10.0f },
{ &gSariaReturnToOcarinaAnim, 1.0f, ANIMMODE_ONCE, -10.0f },
{ &gSariaPlayingOcarinaAnim, 1.0f, ANIMMODE_LOOP, 0.0f },
}; };
static struct_80034EC0_Entry sAnimations[] = { static struct_80034EC0_Entry sAnimations[] = {
{ 0x0601291C, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { 0x06011580, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -4.0f }, { &gSariaTransitionHandsSideToChestToSideAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f },
{ 0x06013008, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { 0x0601186C, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { &gSariaTransitionHandsSideToBackAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -4.0f },
{ 0x06014470, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { 0x06014850, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { &gSariaRightArmExtendedWaitAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f },
{ 0x06011C38, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { 0x06012100, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { &gSariaHandsOutAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f },
{ 0x06015220, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { 0x060021D8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { &gSariaStandHandsOnHipsAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f },
{ &gSariaExtendRightArmAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f },
{ &gSariaTransitionHandsSideToHipsAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f },
{ &gSariaHandsBehindBackWaitAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f },
{ &gSariaHandsOnFaceAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f },
{ &gSariaWaitArmsToSideAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f },
}; };
extern CutsceneData D_02005730[]; extern CutsceneData D_02005730[];
extern CutsceneData D_02010E20[]; extern CutsceneData D_02010E20[];
extern AnimationHeader D_06001D50;
extern Gfx D_06007B80[];
extern FlexSkeletonHeader D_0600B1A0;
extern AnimationHeader D_0600BAEC;
extern AnimationHeader D_0600C500;
extern AnimationHeader D_06012100;
s16 func_80AF5560(EnSa* this, GlobalContext* globalCtx) { s16 func_80AF5560(EnSa* this, GlobalContext* globalCtx) {
s16 textState = func_8010BDBC(&globalCtx->msgCtx); s16 textState = func_8010BDBC(&globalCtx->msgCtx);
@ -319,7 +340,7 @@ void func_80AF5CE4(EnSa* this) {
} }
} }
void func_80AF5D8C(EnSa* this, s32 action) { void EnSa_ChangeAnim(EnSa* this, s32 action) {
Animation_Change(&this->skelAnime, sAnimationInfo[action].animation, 1.0f, 0.0f, Animation_Change(&this->skelAnime, sAnimationInfo[action].animation, 1.0f, 0.0f,
Animation_GetLastFrame(sAnimationInfo[action].animation), sAnimationInfo[action].mode, Animation_GetLastFrame(sAnimationInfo[action].animation), sAnimationInfo[action].mode,
sAnimationInfo[action].transitionRate); sAnimationInfo[action].transitionRate);
@ -358,14 +379,14 @@ void func_80AF5F34(EnSa* this, GlobalContext* globalCtx) {
phi_a3 = (this->actionFunc == func_80AF68E4) ? 1 : 4; phi_a3 = (this->actionFunc == func_80AF68E4) ? 1 : 4;
} }
if (globalCtx->sceneNum == SCENE_SPOT05) { if (globalCtx->sceneNum == SCENE_SPOT05) {
phi_a3 = (this->skelAnime.animation == &D_0600BAEC) ? 1 : 3; phi_a3 = (this->skelAnime.animation == &gSariaPlayingOcarinaAnim) ? 1 : 3;
} }
if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF6448 && if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF6448 &&
this->skelAnime.animation == &D_0600C500) { this->skelAnime.animation == &gSariaStopPlayingOcarinaAnim) {
phi_a3 = 1; phi_a3 = 1;
} }
if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 && if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 &&
this->skelAnime.animation == &D_06001D50) { this->skelAnime.animation == &gSariaOcarinaToMouthAnim) {
phi_a3 = 1; phi_a3 = 1;
} }
this->unk_1E0.unk_18 = player->actor.world.pos; this->unk_1E0.unk_18 = player->actor.world.pos;
@ -374,14 +395,15 @@ void func_80AF5F34(EnSa* this, GlobalContext* globalCtx) {
} }
s32 func_80AF603C(EnSa* this) { s32 func_80AF603C(EnSa* this) {
if (this->skelAnime.animation != &D_0600BAEC && this->skelAnime.animation != &D_06001D50) { if (this->skelAnime.animation != &gSariaPlayingOcarinaAnim &&
this->skelAnime.animation != &gSariaOcarinaToMouthAnim) {
return 0; return 0;
} }
if (this->unk_1E0.unk_00 != 0) { if (this->unk_1E0.unk_00 != 0) {
return 0; return 0;
} }
this->unk_20E = 0; this->unk_20E = 0;
if (this->unk_212 != 2) { if (this->rightEyeIndex != SARIA_EYE_CLOSED) {
return 0; return 0;
} }
return 1; return 1;
@ -398,13 +420,13 @@ void func_80AF609C(EnSa* this) {
phi_v1 = this->unk_20E; phi_v1 = this->unk_20E;
} }
if (phi_v1 == 0) { if (phi_v1 == 0) {
this->unk_212++; this->rightEyeIndex++;
if (this->unk_212 < 3) { if (this->rightEyeIndex < SARIA_EYE_SUPRISED) {
this->unk_214 = this->unk_212; this->leftEyeIndex = this->rightEyeIndex;
} else { } else {
this->unk_20E = Rand_S16Offset(30, 30); this->unk_20E = Rand_S16Offset(30, 30);
this->unk_214 = 0; this->leftEyeIndex = SARIA_EYE_OPEN;
this->unk_212 = this->unk_214; this->rightEyeIndex = this->leftEyeIndex;
} }
} }
} }
@ -427,23 +449,23 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad; s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 12.0f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 12.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, NULL, this->jointTable, this->morphTable, 17); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, NULL, this->jointTable, this->morphTable, 17);
Collider_InitCylinder(globalCtx, &this->collider); Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
switch (func_80AF5DFC(this, globalCtx)) { switch (func_80AF5DFC(this, globalCtx)) {
case 2: case 2:
func_80AF5D8C(this, 0xB); EnSa_ChangeAnim(this, 0xB);
this->actionFunc = func_80AF6448; this->actionFunc = func_80AF6448;
break; break;
case 5: case 5:
func_80AF5D8C(this, 0xB); EnSa_ChangeAnim(this, 0xB);
this->actionFunc = func_80AF683C; this->actionFunc = func_80AF683C;
break; break;
case 1: case 1:
this->actor.gravity = -1.0f; this->actor.gravity = -1.0f;
func_80AF5D8C(this, 0); EnSa_ChangeAnim(this, 0);
this->actionFunc = func_80AF6448; this->actionFunc = func_80AF6448;
break; break;
case 4: case 4:
@ -451,13 +473,13 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.gravity = -1.0f; this->actor.gravity = -1.0f;
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(D_02010E20); globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(D_02010E20);
gSaveContext.cutsceneTrigger = 1; gSaveContext.cutsceneTrigger = 1;
func_80AF5D8C(this, 4); EnSa_ChangeAnim(this, 4);
this->actionFunc = func_80AF68E4; this->actionFunc = func_80AF68E4;
break; break;
case 3: case 3:
this->unk_210 = 0; this->unk_210 = 0;
this->actor.gravity = -1.0f; this->actor.gravity = -1.0f;
func_80AF5D8C(this, 0); EnSa_ChangeAnim(this, 0);
this->actionFunc = func_80AF68E4; this->actionFunc = func_80AF68E4;
break; break;
case 0: case 0:
@ -489,14 +511,14 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) {
case 0x1002: case 0x1002:
if (this->unk_208 == 0 && this->unk_20B != 1) { if (this->unk_208 == 0 && this->unk_20B != 1) {
func_80AF5CD4(this, 1); func_80AF5CD4(this, 1);
this->unk_216 = 1; this->mouthIndex = 1;
} }
if (this->unk_208 == 2 && this->unk_20B != 2) { if (this->unk_208 == 2 && this->unk_20B != 2) {
func_80AF5CD4(this, 2); func_80AF5CD4(this, 2);
this->unk_216 = 1; this->mouthIndex = 1;
} }
if (this->unk_208 == 5) { if (this->unk_208 == 5) {
this->unk_216 = 0; this->mouthIndex = 0;
} }
break; break;
case 0x1003: case 0x1003:
@ -505,21 +527,23 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) {
} }
break; break;
case 0x1031: case 0x1031:
if (this->unk_208 == 0 && this->unk_20B != 4 && this->skelAnime.animation == &D_06012100) { if (this->unk_208 == 0 && this->unk_20B != 4 &&
this->skelAnime.animation == &gSariaHandsBehindBackWaitAnim) {
func_80AF5CD4(this, 4); func_80AF5CD4(this, 4);
this->unk_216 = 3; this->mouthIndex = 3;
} }
if (this->unk_208 == 2 && this->unk_20B != 5) { if (this->unk_208 == 2 && this->unk_20B != 5) {
func_80AF5CD4(this, 5); func_80AF5CD4(this, 5);
this->unk_216 = 2; this->mouthIndex = 2;
} }
if (this->unk_208 == 4 && this->unk_20B != 6) { if (this->unk_208 == 4 && this->unk_20B != 6) {
func_80AF5CD4(this, 6); func_80AF5CD4(this, 6);
this->unk_216 = 0; this->mouthIndex = 0;
} }
break; break;
case 0x1032: case 0x1032:
if (this->unk_208 == 0 && this->unk_20B != 4 && this->skelAnime.animation == &D_06012100) { if (this->unk_208 == 0 && this->unk_20B != 4 &&
this->skelAnime.animation == &gSariaHandsBehindBackWaitAnim) {
func_80AF5CD4(this, 4); func_80AF5CD4(this, 4);
} }
break; break;
@ -544,21 +568,21 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) {
} }
func_80AF5CE4(this); func_80AF5CE4(this);
} }
if (this->skelAnime.animation == &D_0600C500) { if (this->skelAnime.animation == &gSariaStopPlayingOcarinaAnim) {
this->skelAnime.playSpeed = -1.0f; this->skelAnime.playSpeed = -1.0f;
if ((s32)this->skelAnime.curFrame == 0) { if ((s32)this->skelAnime.curFrame == 0) {
func_80AF5D8C(this, 6); EnSa_ChangeAnim(this, 6);
} }
} }
if (this->unk_1E0.unk_00 != 0 && globalCtx->sceneNum == SCENE_SPOT05) { if (this->unk_1E0.unk_00 != 0 && globalCtx->sceneNum == SCENE_SPOT05) {
Animation_Change(&this->skelAnime, &D_0600C500, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f); Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f);
this->actionFunc = func_80AF67D0; this->actionFunc = func_80AF67D0;
} }
} }
void func_80AF67D0(EnSa* this, GlobalContext* globalCtx) { void func_80AF67D0(EnSa* this, GlobalContext* globalCtx) {
if (this->unk_1E0.unk_00 == 0) { if (this->unk_1E0.unk_00 == 0) {
Animation_Change(&this->skelAnime, &D_0600C500, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f);
this->actionFunc = func_80AF6448; this->actionFunc = func_80AF6448;
} }
} }
@ -597,16 +621,16 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) {
if (this->unk_210 != csAction->action) { if (this->unk_210 != csAction->action) {
switch (csAction->action) { switch (csAction->action) {
case 2: case 2:
this->unk_216 = 1; this->mouthIndex = 1;
break; break;
case 9: case 9:
this->unk_216 = 1; this->mouthIndex = 1;
break; break;
default: default:
this->unk_216 = 0; this->mouthIndex = 0;
break; break;
} }
func_80AF5D8C(this, csAction->action); EnSa_ChangeAnim(this, csAction->action);
this->unk_210 = csAction->action; this->unk_210 = csAction->action;
} }
if (phi_v0) {} if (phi_v0) {}
@ -648,14 +672,14 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) {
void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) { void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) {
if (globalCtx->sceneNum == SCENE_SPOT05) { if (globalCtx->sceneNum == SCENE_SPOT05) {
Item_Give(globalCtx, ITEM_SONG_SARIA); Item_Give(globalCtx, ITEM_SONG_SARIA);
func_80AF5D8C(this, 6); EnSa_ChangeAnim(this, 6);
} }
if (globalCtx->sceneNum == SCENE_SPOT04) { if (globalCtx->sceneNum == SCENE_SPOT04) {
func_80AF5D8C(this, 4); EnSa_ChangeAnim(this, 4);
this->actor.world.pos = this->actor.home.pos; this->actor.world.pos = this->actor.home.pos;
this->actor.world.rot = this->unk_21A; this->actor.world.rot = this->unk_21A;
this->unk_216 = 0; this->mouthIndex = 0;
gSaveContext.infTable[0] |= 1; gSaveContext.infTable[0] |= 1;
} }
@ -670,8 +694,9 @@ void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
SkelAnime_Update(&this->skelAnime); SkelAnime_Update(&this->skelAnime);
if (this->skelAnime.animation == &D_06001D50 && this->skelAnime.curFrame >= Animation_GetLastFrame(&D_06001D50)) { if (this->skelAnime.animation == &gSariaOcarinaToMouthAnim &&
func_80AF5D8C(this, 6); this->skelAnime.curFrame >= Animation_GetLastFrame(&gSariaOcarinaToMouthAnim)) {
EnSa_ChangeAnim(this, 6);
} }
if (this->actionFunc != func_80AF68E4) { if (this->actionFunc != func_80AF68E4) {
@ -721,7 +746,7 @@ s32 EnSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
} }
if (globalCtx->sceneNum == SCENE_SPOT05 && limbIndex == 15) { if (globalCtx->sceneNum == SCENE_SPOT05 && limbIndex == 15) {
*dList = D_06007B80; *dList = gSariaRightHandAndOcarinaDL;
} }
return 0; return 0;
@ -737,22 +762,24 @@ void EnSa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
} }
void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx) { void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx) {
static UNK_PTR D_80AF7460[] = { 0x06003588, 0x06004448, 0x06004648, 0x06004C48, 0x06003348 }; static u64* sMouthTextures[] = { gSariaMouthClosed2Tex, gSariaMouthSmilingOpenTex, gSariaMouthFrowningTex,
static UNK_PTR D_80AF7474[] = { 0x06002F48, 0x06003C48, 0x06003848, 0x06004848, 0x06004E48 }; gSariaMouthSuprisedTex, gSariaMouthClosedTex };
static u64* sEyeTextures[] = { gSariaEyeOpenTex, gSariaEyeHalfTex, gSariaEyeClosedTex, gSariaEyeSuprisedTex,
gSariaEyeSadTex };
EnSa* this = THIS; EnSa* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sa.c", 1444); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sa.c", 1444);
if (this->alpha == 255) { if (this->alpha == 255) {
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AF7474[this->unk_212])); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->rightEyeIndex]));
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AF7474[this->unk_214])); gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->leftEyeIndex]));
gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80AF7460[this->unk_216])); gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex]));
func_80034BA0(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); func_80034BA0(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha);
} else if (this->alpha != 0) { } else if (this->alpha != 0) {
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AF7474[this->unk_212])); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->rightEyeIndex]));
gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AF7474[this->unk_214])); gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->leftEyeIndex]));
gSPSegment(POLY_XLU_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80AF7460[this->unk_216])); gSPSegment(POLY_XLU_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex]));
func_80034CC4(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); func_80034CC4(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha);
} }

View file

@ -21,9 +21,9 @@ typedef struct EnSa {
/* 0x020C */ s16 unk_20C; /* 0x020C */ s16 unk_20C;
/* 0x020E */ s16 unk_20E; /* 0x020E */ s16 unk_20E;
/* 0x0210 */ s16 unk_210; /* 0x0210 */ s16 unk_210;
/* 0x0212 */ s16 unk_212; /* 0x0212 */ s16 rightEyeIndex;
/* 0x0214 */ s16 unk_214; /* 0x0214 */ s16 leftEyeIndex;
/* 0x0216 */ s16 unk_216; /* 0x0216 */ s16 mouthIndex;
/* 0x0218 */ s16 alpha; /* 0x0218 */ s16 alpha;
/* 0x021A */ Vec3s unk_21A; /* 0x021A */ Vec3s unk_21A;
/* 0x0220 */ Vec3s jointTable[17]; /* 0x0220 */ Vec3s jointTable[17];

View file

@ -501,21 +501,6 @@ D_0601182C = 0x0601182C;
D_06011C08 = 0x06011C08; D_06011C08 = 0x06011C08;
D_06012218 = 0x06012218; D_06012218 = 0x06012218;
// z_demo_sa
D_06001334 = 0x06001334;
D_060021D8 = 0x060021D8;
D_06007B80 = 0x06007B80;
D_0600B1A0 = 0x0600B1A0;
D_0600DF80 = 0x0600DF80;
D_0600E500 = 0x0600E500;
D_0600F580 = 0x0600F580;
D_0600FCE0 = 0x0600FCE0;
D_0600FFD4 = 0x0600FFD4;
D_0601113C = 0x0601113C;
D_060135EC = 0x060135EC;
D_06013CD8 = 0x06013CD8;
D_060140BC = 0x060140BC;
// z_demo_ec // z_demo_ec
D_06013B88 = 0x06013B88; D_06013B88 = 0x06013B88;
D_060048F4 = 0x060048F4; D_060048F4 = 0x060048F4;
@ -2189,12 +2174,6 @@ D_06001C80 = 0x06001C80;
// z_en_sa // z_en_sa
D_02005730 = 0x02005730; D_02005730 = 0x02005730;
D_02010E20 = 0x02010E20; D_02010E20 = 0x02010E20;
D_06001D50 = 0x06001D50;
D_06007B80 = 0x06007B80;
D_0600B1A0 = 0x0600B1A0;
D_0600BAEC = 0x0600BAEC;
D_0600C500 = 0x0600C500;
D_06012100 = 0x06012100;
// z_en_shopnuts // z_en_shopnuts
D_060001EC = 0x060001EC; D_060001EC = 0x060001EC;