Animation Cleanup: En_J* (#1401)

* cleanup J

* small fix
This commit is contained in:
engineer124 2023-10-01 17:12:09 +11:00 committed by GitHub
parent 1509349bd7
commit 2a485ad774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 281 additions and 169 deletions

View File

@ -5,7 +5,6 @@
*/
#include "z_en_ja.h"
#include "objects/object_boj/object_boj.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@ -89,27 +88,41 @@ static ColliderCylinderInit sCylinderInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
static AnimationInfoS sAnimationInfo[] = {
{ &object_boj_Anim_002734, 1.0f, 0, -1, 0, 0 }, { &object_boj_Anim_0033B0, 1.0f, 0, -1, 0, 0 },
{ &object_boj_Anim_002734, 1.0f, 0, -1, 0, -4 }, { &object_boj_Anim_0033B0, 1.0f, 0, -1, 0, -4 },
{ &object_boj_Anim_004078, 1.0f, 0, -1, 0, 0 }, { &object_boj_Anim_005CE4, 1.0f, 0, -1, 0, 0 },
typedef enum EnJaAnimation {
/* -1 */ ENJA_ANIM_NONE = -1,
/* 0 */ ENJA_ANIM_0,
/* 1 */ ENJA_ANIM_1,
/* 2 */ ENJA_ANIM_2,
/* 3 */ ENJA_ANIM_3,
/* 4 */ ENJA_ANIM_4,
/* 5 */ ENJA_ANIM_5,
/* 6 */ ENJA_ANIM_MAX
} EnJaAnimation;
static AnimationInfoS sAnimationInfo[ENJA_ANIM_MAX] = {
{ &object_boj_Anim_002734, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_0
{ &object_boj_Anim_0033B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_1
{ &object_boj_Anim_002734, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENJA_ANIM_2
{ &object_boj_Anim_0033B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENJA_ANIM_3
{ &object_boj_Anim_004078, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_4
{ &object_boj_Anim_005CE4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENJA_ANIM_5
};
void func_80BC1900(EnJa* this) {
this->skelAnime.playSpeed = this->unk_344;
void EnJa_UpdateSkelAnime(EnJa* this) {
this->skelAnime.playSpeed = this->animPlaySpeed;
SkelAnime_Update(&this->skelAnime);
}
s32 func_80BC192C(EnJa* this, s32 arg1) {
s32 ret = false;
s32 EnJa_ChangeAnim(EnJa* this, s32 animIndex) {
s32 didAnimChange = false;
if (arg1 != this->unk_36C) {
this->unk_36C = arg1;
ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1);
this->unk_344 = this->skelAnime.playSpeed;
if (this->animIndex != animIndex) {
this->animIndex = animIndex;
didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
this->animPlaySpeed = this->skelAnime.playSpeed;
}
return ret;
return didAnimChange;
}
void func_80BC1984(EnJa* this, PlayState* play) {
@ -246,7 +259,7 @@ s32 func_80BC1FC8(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
if (func_80BC1AE0(this, play)) {
SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_340 |= 0x10;
func_80BC192C(this, 5);
EnJa_ChangeAnim(this, ENJA_ANIM_5);
func_80BC2EA4(this);
ret = true;
}
@ -258,9 +271,9 @@ s32 func_80BC203C(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
if (func_80BC1AE0(this, play)) {
if (ENJA_GET_3(&this->actor) == 0) {
func_80BC192C(this, 1);
EnJa_ChangeAnim(this, ENJA_ANIM_1);
} else {
func_80BC192C(this, 4);
EnJa_ChangeAnim(this, ENJA_ANIM_4);
}
SubS_SetOfferMode(&this->unk_340, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->actor.shape.shadowDraw = NULL;
@ -284,6 +297,9 @@ s32 func_80BC20D0(EnJa* this, PlayState* play, ScheduleOutput* scheduleOutput) {
case 2:
ret = func_80BC203C(this, play, scheduleOutput);
break;
default:
break;
}
return ret;
}
@ -329,8 +345,10 @@ s32* func_80BC2274(EnJa* this, PlayState* play) {
return D_80BC362C;
}
return D_80BC366C;
default:
return D_80BC360C;
}
return D_80BC360C;
}
void func_80BC22F4(EnJa* this, PlayState* play) {
@ -348,9 +366,10 @@ void EnJa_Init(Actor* thisx, PlayState* play) {
EnJa* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, NULL, this->jointTable, this->morphTable, 16);
this->unk_36C = -1;
func_80BC192C(this, 0);
SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, NULL, this->jointTable, this->morphTable,
OBJECT_BOJ_LIMB_MAX);
this->animIndex = ENJA_ANIM_NONE;
EnJa_ChangeAnim(this, ENJA_ANIM_0);
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
Actor_SetScale(&this->actor, 0.01f);
@ -380,7 +399,7 @@ void EnJa_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->unk_1D8.unk_00 != 0) {
func_80BC1900(this);
EnJa_UpdateSkelAnime(this);
func_80BC1A68(this);
func_80BC1D70(this, play);
@ -403,7 +422,7 @@ void EnJa_Update(Actor* thisx, PlayState* play) {
s32 EnJa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnJa* this = THIS;
if (limbIndex == 15) {
if (limbIndex == OBJECT_BOJ_LIMB_0F) {
func_80BC1E40(this, play);
}
return false;
@ -419,10 +438,10 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
EnJa* this = THIS;
s32 pad2;
if (limbIndex == 15) {
if (limbIndex == OBJECT_BOJ_LIMB_0F) {
Matrix_MultVec3f(&D_80BC3780, &this->actor.focus.pos);
Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot);
} else if ((this->unk_340 & 0x40) && (limbIndex == 11)) {
} else if ((this->unk_340 & 0x40) && (limbIndex == OBJECT_BOJ_LIMB_0B)) {
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
@ -437,8 +456,9 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
}
if (this->unk_1D8.unk_00 == 1) {
if ((limbIndex == 11) && (((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 6.0f)) ||
((this->skelAnime.curFrame >= 35.0f) && (this->skelAnime.curFrame <= 47.0f)))) {
if ((limbIndex == OBJECT_BOJ_LIMB_0B) &&
(((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 6.0f)) ||
((this->skelAnime.curFrame >= 35.0f) && (this->skelAnime.curFrame <= 47.0f)))) {
OPEN_DISPS(play->state.gfxCtx);
Matrix_Push();
@ -475,7 +495,7 @@ void EnJa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx);
} else if (limbIndex == 14) {
} else if (limbIndex == OBJECT_BOJ_LIMB_0E) {
if ((this->skelAnime.curFrame >= 0.0f) && (this->skelAnime.curFrame <= 18.0f)) {
OPEN_DISPS(play->state.gfxCtx);
@ -541,8 +561,8 @@ void EnJa_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
overrideRot = false;
}
if (limbIndex != 8) {
if (limbIndex == 15) {
switch (limbIndex) {
case OBJECT_BOJ_LIMB_0F:
SubS_UpdateLimb(this->unk_354 + this->unk_358 + 0x4000,
this->unk_356 + this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1EC,
&this->unk_274, stepRot, overrideRot);
@ -553,17 +573,22 @@ void EnJa_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
Matrix_RotateXS(this->unk_274.x, MTXMODE_APPLY);
Matrix_RotateZS(this->unk_274.z, MTXMODE_APPLY);
Matrix_Push();
}
} else {
SubS_UpdateLimb(this->unk_358 + 0x4000, this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1F8,
&this->unk_27A, stepRot, overrideRot);
Matrix_Pop();
Matrix_Translate(this->unk_1F8.x, this->unk_1F8.y, this->unk_1F8.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->unk_27A.y, MTXMODE_APPLY);
Matrix_RotateXS(this->unk_27A.x, MTXMODE_APPLY);
Matrix_RotateZS(this->unk_27A.z, MTXMODE_APPLY);
Matrix_Push();
break;
case OBJECT_BOJ_LIMB_08:
SubS_UpdateLimb(this->unk_358 + 0x4000, this->unk_35A + this->actor.shape.rot.y + 0x4000, &this->unk_1F8,
&this->unk_27A, stepRot, overrideRot);
Matrix_Pop();
Matrix_Translate(this->unk_1F8.x, this->unk_1F8.y, this->unk_1F8.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->unk_27A.y, MTXMODE_APPLY);
Matrix_RotateXS(this->unk_27A.x, MTXMODE_APPLY);
Matrix_RotateZS(this->unk_27A.z, MTXMODE_APPLY);
Matrix_Push();
break;
default:
break;
}
}

View File

@ -2,6 +2,7 @@
#define Z_EN_JA_H
#include "global.h"
#include "objects/object_boj/object_boj.h"
struct EnJa;
@ -37,10 +38,10 @@ typedef struct EnJa {
/* 0x234 */ EnJaStruct unk_234[4];
/* 0x274 */ Vec3s unk_274;
/* 0x27A */ Vec3s unk_27A;
/* 0x280 */ Vec3s jointTable[16];
/* 0x2E0 */ Vec3s morphTable[16];
/* 0x280 */ Vec3s jointTable[OBJECT_BOJ_LIMB_MAX];
/* 0x2E0 */ Vec3s morphTable[OBJECT_BOJ_LIMB_MAX];
/* 0x340 */ u16 unk_340;
/* 0x344 */ f32 unk_344;
/* 0x344 */ f32 animPlaySpeed;
/* 0x348 */ f32 unk_348;
/* 0x34C */ f32 unk_34C;
/* 0x350 */ UNK_TYPE1 unk350[0x4];
@ -55,7 +56,7 @@ typedef struct EnJa {
/* 0x364 */ s16 unk_364;
/* 0x366 */ s16 unk_366;
/* 0x368 */ void* unk_368;
/* 0x36C */ s32 unk_36C;
/* 0x36C */ s32 animIndex;
/* 0x370 */ UNK_TYPE1 unk_370[4];
/* 0x374 */ s32 prevTalkState;
} EnJa; // size = 0x378

View File

@ -122,7 +122,7 @@ void EnJcMato_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
Collider_InitSphere(play, &this->collider);
Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit);
this->collider.dim.worldSphere.radius = 0xF;
this->collider.dim.worldSphere.radius = 15;
this->actor.colChkInfo.damageTable = &sDamageTable;
Actor_SetScale(&this->actor, 0.008f);
this->hitFlag = false;

View File

@ -34,29 +34,6 @@ s32 EnJg_GetNextTextId(EnJg* this);
s32 EnJg_GetStartingConversationTextId(EnJg* this, PlayState* play);
void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play);
typedef enum {
/* 0 */ EN_JG_ANIM_IDLE,
/* 1 */ EN_JG_ANIM_WALK,
/* 2 */ EN_JG_ANIM_WAVING,
/* 3 */ EN_JG_ANIM_SHAKING_HEAD,
/* 4 */ EN_JG_ANIM_SURPRISE_START,
/* 5 */ EN_JG_ANIM_SURPRISE_LOOP,
/* 6 */ EN_JG_ANIM_ANGRY,
/* 7 */ EN_JG_ANIM_FROZEN_START,
/* 8 */ EN_JG_ANIM_FROZEN_LOOP,
/* 9 */ EN_JG_ANIM_WALK_2,
/* 10 */ EN_JG_ANIM_TAKING_OUT_DRUM,
/* 11 */ EN_JG_ANIM_DRUM_IDLE,
/* 12 */ EN_JG_ANIM_PLAYING_DRUM,
/* 13 */ EN_JG_ANIM_THINKING,
/* 14 */ EN_JG_ANIM_REMEMBERING,
/* 15 */ EN_JG_ANIM_STRONG_REMEMBERING,
/* 16 */ EN_JG_ANIM_DEPRESSED,
/* 17 */ EN_JG_ANIM_CUTSCENE_IDLE,
/* 18 */ EN_JG_ANIM_CRADLE,
/* 19 */ EN_JG_ANIM_MAX
} EnJgAnimation;
typedef enum {
/* 0 */ EN_JG_ACTION_FIRST_THAW,
/* 1 */ EN_JG_ACTION_SPAWNING,
@ -133,26 +110,49 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0x0),
};
static AnimationInfoS sAnimationInfo[] = {
{ &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
{ &gGoronElderWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
{ &gGoronElderWavingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
{ &gGoronElderHeadShakeAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
{ &gGoronElderSurpriseStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -10 },
{ &gGoronElderSurpriseLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
{ &gGoronElderAngryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 },
{ &gGoronElderSurpriseStartAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gGoronElderSurpriseStartAnim, -2.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gGoronElderWalkAnim, -1.0f, 0, -1, ANIMMODE_LOOP, -10 },
{ &gGoronElderTakeOutDrumAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gGoronElderDrumIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronElderPlayingDrumAnim, 1.0f, 1, 44, ANIMMODE_ONCE, 0 },
{ &gGoronElderThinkingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronElderRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gGoronElderStrongRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gGoronElderDepressedAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronElderCradleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
typedef enum EnJgAnimation {
/* 0 */ EN_JG_ANIM_IDLE,
/* 1 */ EN_JG_ANIM_WALK,
/* 2 */ EN_JG_ANIM_WAVING,
/* 3 */ EN_JG_ANIM_SHAKING_HEAD,
/* 4 */ EN_JG_ANIM_SURPRISE_START,
/* 5 */ EN_JG_ANIM_SURPRISE_LOOP,
/* 6 */ EN_JG_ANIM_ANGRY,
/* 7 */ EN_JG_ANIM_FROZEN_START,
/* 8 */ EN_JG_ANIM_FROZEN_LOOP,
/* 9 */ EN_JG_ANIM_WALK_2,
/* 10 */ EN_JG_ANIM_TAKING_OUT_DRUM,
/* 11 */ EN_JG_ANIM_DRUM_IDLE,
/* 12 */ EN_JG_ANIM_PLAYING_DRUM,
/* 13 */ EN_JG_ANIM_THINKING,
/* 14 */ EN_JG_ANIM_REMEMBERING,
/* 15 */ EN_JG_ANIM_STRONG_REMEMBERING,
/* 16 */ EN_JG_ANIM_DEPRESSED,
/* 17 */ EN_JG_ANIM_CUTSCENE_IDLE,
/* 18 */ EN_JG_ANIM_CRADLE,
/* 19 */ EN_JG_ANIM_MAX
} EnJgAnimation;
static AnimationInfoS sAnimationInfo[EN_JG_ANIM_MAX] = {
{ &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_IDLE
{ &gGoronElderWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WALK
{ &gGoronElderWavingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WAVING
{ &gGoronElderHeadShakeAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_SHAKING_HEAD
{ &gGoronElderSurpriseStartAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -10 }, // EN_JG_ANIM_SURPRISE_START
{ &gGoronElderSurpriseLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_SURPRISE_LOOP
{ &gGoronElderAngryAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_ANGRY
{ &gGoronElderSurpriseStartAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_FROZEN_START
{ &gGoronElderSurpriseStartAnim, -2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_FROZEN_LOOP
{ &gGoronElderWalkAnim, -1.0f, 0, -1, ANIMMODE_LOOP, -10 }, // EN_JG_ANIM_WALK_2
{ &gGoronElderTakeOutDrumAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_TAKING_OUT_DRUM
{ &gGoronElderDrumIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_DRUM_IDLE
{ &gGoronElderPlayingDrumAnim, 1.0f, 1, 44, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_PLAYING_DRUM
{ &gGoronElderThinkingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_THINKING
{ &gGoronElderRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_REMEMBERING
{ &gGoronElderStrongRememberingAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // EN_JG_ANIM_STRONG_REMEMBERING
{ &gGoronElderDepressedAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_DEPRESSED
{ &gGoronElderIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_CUTSCENE_IDLE
{ &gGoronElderCradleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // EN_JG_ANIM_CRADLE
};
static Vec3f sSfxPos = { 0.0f, 0.0f, 0.0f };
@ -340,6 +340,9 @@ void EnJg_SetupTalk(EnJg* this, PlayState* play) {
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
this->actionFunc = EnJg_Talk;
break;
default:
break;
}
}
@ -418,10 +421,10 @@ void EnJg_GoronShrineCheer(EnJg* this, PlayState* play) {
void EnJg_AlternateTalkOrWalkInPlace(EnJg* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s16 curFrame = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (this->animIndex == EN_JG_ANIM_SURPRISE_START) {
if (curFrame == lastFrame) {
if (curFrame == endFrame) {
this->animIndex = EN_JG_ANIM_SURPRISE_LOOP;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
}
@ -473,10 +476,10 @@ void EnJg_Walk(EnJg* this, PlayState* play) {
void EnJg_Talk(EnJg* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s16 curFrame = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
u16 temp;
if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (curFrame == lastFrame)) {
if ((this->animIndex == EN_JG_ANIM_SURPRISE_START) && (curFrame == endFrame)) {
this->animIndex = EN_JG_ANIM_SURPRISE_LOOP;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
}
@ -543,12 +546,12 @@ void EnJg_SetupWalk(EnJg* this, PlayState* play) {
void EnJg_Freeze(EnJg* this, PlayState* play) {
s16 curFrame = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (this->action == EN_JG_ACTION_SPAWNING) {
this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW;
this->freezeTimer = 1000;
this->skelAnime.curFrame = lastFrame;
this->skelAnime.curFrame = endFrame;
this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x,
this->actor.world.rot.y, this->actor.world.rot.z, 0xFF50);
@ -557,7 +560,7 @@ void EnJg_Freeze(EnJg* this, PlayState* play) {
this->actionFunc = EnJg_FrozenIdle;
} else if (this->animIndex == EN_JG_ANIM_FROZEN_START) {
this->action = EN_JG_ACTION_FROZEN_OR_NON_FIRST_THAW;
if (curFrame == lastFrame) {
if (curFrame == endFrame) {
this->freezeTimer = 1000;
this->icePoly = Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ICE_POLY, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x,
@ -899,7 +902,7 @@ void EnJg_SpawnBreath(EnJg* this, PlayState* play) {
*/
void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play) {
s16 curFrame = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->flags |= FLAG_LOOKING_AT_PLAYER;
@ -924,7 +927,7 @@ void EnJg_CheckIfTalkingToPlayerAndHandleFreezeTimer(EnJg* this, PlayState* play
}
this->freezeTimer--;
if ((this->freezeTimer <= 0) && (curFrame == lastFrame)) {
if ((this->freezeTimer <= 0) && (curFrame == endFrame)) {
this->animIndex = EN_JG_ANIM_FROZEN_START;
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
Audio_PlaySfx_AtPos(&sSfxPos, NA_SE_EV_FREEZE_S);

View File

@ -48,10 +48,18 @@ ActorInit En_Jgame_Tsn_InitVars = {
(ActorFunc)EnJgameTsn_Draw,
};
static AnimationInfo sAnimationInfo[] = {
{ &object_tsn_Anim_0092FC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f },
{ &object_tsn_Anim_000964, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f },
{ &object_tsn_Anim_001198, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f },
typedef enum EnJgameTsnAnimation {
/* -1 */ ENJGAMETSN_ANIM_NONE = -1,
/* 0 */ ENJGAMETSN_ANIM_0,
/* 1 */ ENJGAMETSN_ANIM_1,
/* 2 */ ENJGAMETSN_ANIM_2,
/* 3 */ ENJGAMETSN_ANIM_MAX
} EnJgameTsnAnimation;
static AnimationInfo sAnimationInfo[ENJGAMETSN_ANIM_MAX] = {
{ &object_tsn_Anim_0092FC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_0
{ &object_tsn_Anim_000964, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_1
{ &object_tsn_Anim_001198, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f }, // ENJGAMETSN_ANIM_2
};
static ColliderCylinderInit sCylinderInit = {
@ -145,7 +153,7 @@ void EnJgameTsn_Destroy(Actor* thisx, PlayState* play) {
}
void func_80C13B74(EnJgameTsn* this) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_0);
this->actionFunc = func_80C13BB8;
}
@ -156,15 +164,15 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) {
if (this->actor.flags & ACTOR_FLAG_10000) {
this->actor.flags &= ~ACTOR_FLAG_10000;
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] > SECONDS_TO_TIMER(0)) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x10A2, &this->actor);
this->unk_300 = 0x10A2;
} else if (gSaveContext.minigameScore < 20) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x10A2, &this->actor);
this->unk_300 = 0x10A2;
} else {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x10A3, &this->actor);
this->unk_300 = 0x10A3;
}
@ -174,11 +182,11 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) {
this->unk_300 = 0x1094;
} else if (this->unk_2F8 == 0) {
this->unk_2F8 = 1;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x1095, &this->actor);
this->unk_300 = 0x1095;
} else {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x1096, &this->actor);
this->unk_300 = 0x1096;
}
@ -211,11 +219,11 @@ void func_80C13E90(EnJgameTsn* this, PlayState* play) {
this->actor.flags &= ~ACTOR_FLAG_10000;
if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) ||
((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x1094, &this->actor);
this->unk_300 = 0x1094;
} else {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_1);
Message_StartTextbox(play, 0x1098, &this->actor);
this->unk_300 = 0x1098;
}
@ -273,6 +281,9 @@ void func_80C14044(EnJgameTsn* this, PlayState* play) {
func_80C13B74(this);
}
break;
default:
break;
}
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x71C, 0xB6);
@ -335,7 +346,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) {
this->unk_2FC++;
if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && func_80C149B0(play, &this->unk_200)) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x109F, &this->actor);
this->unk_300 = 0x109F;
player->stateFlags1 |= PLAYER_STATE1_20;
@ -344,7 +355,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) {
func_80C14030(this);
} else if ((player->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) ||
(player->actor.bgCheckFlags & BGCHECKFLAG_WATER)) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x10A0, &this->actor);
this->unk_300 = 0x10A0;
player->stateFlags1 |= PLAYER_STATE1_20;
@ -413,12 +424,12 @@ void func_80C14684(EnJgameTsn* this, PlayState* play) {
this->unk_300 = 0x109E;
Rupees_ChangeBy(-20);
} else {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x109D, &this->actor);
this->unk_300 = 0x109D;
}
} else {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2);
Message_StartTextbox(play, 0x109C, &this->actor);
this->unk_300 = 0x109C;
}
@ -461,7 +472,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) {
break;
case 0x109A:
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_0);
Message_StartTextbox(play, 0x109B, &this->actor);
this->unk_300 = 0x109B;
break;
@ -490,6 +501,9 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) {
func_80C14540(this);
func_80C14554(this, play);
break;
default:
break;
}
}
}

View File

@ -117,6 +117,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_84_20);
}
break;
case 1:
case 2:
case 3:
@ -130,6 +131,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) {
return;
}
break;
case 5:
case 6:
case 7:
@ -137,6 +139,7 @@ void EnJs_Init(Actor* thisx, PlayState* play) {
this->maskType = ENJS_GET_TYPE(&this->actor) - 4;
this->actionFunc = func_8096A104;
break;
default:
break;
}
@ -153,6 +156,7 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) {
case 0:
Play_DisableMotionBlur();
break;
case 5:
case 6:
case 7:
@ -161,6 +165,7 @@ void EnJs_Destroy(Actor* thisx, PlayState* play) {
func_80969400(ENJS_GET_TYPE(&this->actor));
}
break;
default:
break;
}
@ -414,6 +419,7 @@ s32 func_809692A8(s32 arg0) {
return false;
}
return true;
case 5:
case 6:
case 7:
@ -422,6 +428,7 @@ s32 func_809692A8(s32 arg0) {
return false;
}
return true;
default:
return false;
}
@ -441,6 +448,7 @@ s32 func_8096933C(s32 arg0) {
} else {
return true;
}
case 5:
case 6:
case 7:
@ -451,6 +459,7 @@ s32 func_8096933C(s32 arg0) {
} else {
return true;
}
default:
return false;
}
@ -579,13 +588,18 @@ void func_80969898(EnJs* this, PlayState* play) {
Audio_PlaySfx_MessageDecide();
Message_ContinueTextbox(play, 0x2217);
break;
case 1:
Audio_PlaySfx_MessageCancel();
Message_ContinueTextbox(play, 0x2216);
break;
default:
break;
}
}
break;
case TEXT_STATE_5:
if (Message_ShouldAdvance(play)) {
switch (play->msgCtx.currentTextId) {
@ -593,18 +607,21 @@ void func_80969898(EnJs* this, PlayState* play) {
this->unk_2B8 |= 1;
if (!func_8096933C(ENJS_GET_TYPE(&this->actor))) {
Message_ContinueTextbox(play, 0x220F);
break;
} else {
Message_ContinueTextbox(play, 0x220D);
}
Message_ContinueTextbox(play, 0x220D);
break;
case 0x220D:
case 0x2213:
Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1);
break;
case 0x220E:
Message_ContinueTextbox(play, 0xFF);
this->actionFunc = func_80969748;
break;
case 0x2210:
case 0x2211:
case 0x2212:
@ -612,19 +629,23 @@ void func_80969898(EnJs* this, PlayState* play) {
Message_ContinueTextbox(play, 0xFF);
this->actionFunc = func_80969748;
break;
case 0x2214:
case 0x2217:
if (!func_809695FC(this, play)) {
func_80969494(this, play);
break;
}
break;
default:
func_80969494(this, play);
break;
}
}
break;
default:
break;
}
}
@ -729,13 +750,16 @@ void func_80969DA4(EnJs* this, PlayState* play) {
Audio_PlaySfx_MessageDecide();
if (!func_809695FC(this, play)) {
func_809694E8(this, play);
break;
}
break;
case 1:
Audio_PlaySfx_MessageCancel();
Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1);
break;
default:
break;
}
}
break;
@ -745,49 +769,60 @@ void func_80969DA4(EnJs* this, PlayState* play) {
case 0x221B:
if (!func_8096933C(ENJS_GET_TYPE(&this->actor))) {
Message_ContinueTextbox(play, 0x2219);
break;
} else {
Message_ContinueTextbox(play, 0x221C);
}
Message_ContinueTextbox(play, 0x221C);
break;
case 0x2224:
case 0x2226:
case 0x2228:
case 0x222A:
Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1);
break;
case 0x2225:
case 0x2227:
case 0x2229:
case 0x222B:
if (!func_809695FC(this, play)) {
func_809694E8(this, play);
break;
}
break;
case 0x2222:
player->exchangeItemAction = PLAYER_IA_NONE;
Message_ContinueTextbox(play, play->msgCtx.currentTextId + 1);
break;
case 0x2223:
switch (ENJS_GET_TYPE(&this->actor)) {
case 5:
Message_ContinueTextbox(play, 0x2224);
break;
case 6:
Message_ContinueTextbox(play, 0x2226);
break;
case 7:
Message_ContinueTextbox(play, 0x2228);
break;
case 8:
Message_ContinueTextbox(play, 0x222A);
break;
default:
break;
}
break;
case 0x221C:
Message_ContinueTextbox(play, 0xFF);
this->actionFunc = func_80969C54;
break;
case 0x221D:
case 0x2220:
case 0x2221:
@ -795,12 +830,16 @@ void func_80969DA4(EnJs* this, PlayState* play) {
Message_ContinueTextbox(play, 0xFF);
this->actionFunc = func_80969C54;
break;
default:
func_809694E8(this, play);
break;
}
}
break;
default:
break;
}
}
@ -892,6 +931,9 @@ void func_8096A38C(EnJs* this, PlayState* play) {
case 1:
Audio_PlaySfx_MessageCancel();
break;
default:
break;
}
switch (play->msgCtx.currentTextId) {
@ -902,9 +944,13 @@ void func_8096A38C(EnJs* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gMoonChildGettingUpAnim, -5.0f);
this->unk_2B8 |= 0x10;
break;
case 1:
Message_ContinueTextbox(play, 0x21FD);
break;
default:
break;
}
break;
@ -914,9 +960,13 @@ void func_8096A38C(EnJs* this, PlayState* play) {
Message_ContinueTextbox(play, 0x2200);
func_809696EC(this, 0);
break;
case 1:
Message_ContinueTextbox(play, 0x21FF);
break;
default:
break;
}
break;
@ -927,13 +977,21 @@ void func_8096A38C(EnJs* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gMoonChildGettingUpAnim, -5.0f);
this->unk_2B8 |= 0x10;
break;
case 1:
Message_ContinueTextbox(play, 0x2204);
break;
default:
break;
}
default:
break;
}
}
break;
case TEXT_STATE_5:
if (Message_ShouldAdvance(play)) {
switch (play->msgCtx.currentTextId) {
@ -962,7 +1020,6 @@ void func_8096A38C(EnJs* this, PlayState* play) {
break;
case 0x2201:
case 0x220A:
if (!func_809695FC(this, play)) {
func_80969530(this, play);
@ -975,6 +1032,9 @@ void func_8096A38C(EnJs* this, PlayState* play) {
}
}
break;
default:
break;
}
}

View File

@ -1381,53 +1381,62 @@ void EnSGoro_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
s32 overrideRot;
EnSGoro* this = THIS;
if (limbIndex != GORON_LIMB_BODY) {
if ((limbIndex == GORON_LIMB_HEAD) && (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY)) {
if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) {
overrideRot = true;
} else {
overrideRot = false;
switch (limbIndex) {
case GORON_LIMB_HEAD:
if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) {
if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) {
overrideRot = true;
} else {
overrideRot = false;
}
if (this->loseAttentionTimer != 0) {
stepRot = true;
} else {
stepRot = false;
}
EnSGoro_UpdateLimb(this->headRotZ + this->bodyRotZ + 0x4000,
this->headRotY + this->bodyRotY + this->actor.shape.rot.y + 0x4000,
&this->headTranslate, &this->headRotate, stepRot, overrideRot);
Matrix_Pop();
Matrix_Translate(this->headTranslate.x, this->headTranslate.y, this->headTranslate.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->headRotate.y, MTXMODE_APPLY);
Matrix_RotateXS(this->headRotate.x, MTXMODE_APPLY);
Matrix_RotateZS(this->headRotate.z, MTXMODE_APPLY);
Matrix_Push();
}
if (this->loseAttentionTimer != 0) {
stepRot = true;
} else {
stepRot = false;
break;
case GORON_LIMB_BODY:
if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) {
if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) {
overrideRot = true;
} else {
overrideRot = false;
}
if (this->loseAttentionTimer != 0) {
stepRot = true;
} else {
stepRot = false;
}
EnSGoro_UpdateLimb(this->bodyRotZ + 0x4000, this->bodyRotY + this->actor.shape.rot.y + 0x4000,
&this->bodyTranslate, &this->bodyRotate, stepRot, overrideRot);
Matrix_Pop();
Matrix_Translate(this->bodyTranslate.x, this->bodyTranslate.y, this->bodyTranslate.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->bodyRotate.y, MTXMODE_APPLY);
Matrix_RotateXS(this->bodyRotate.x, MTXMODE_APPLY);
Matrix_RotateZS(this->bodyRotate.z, MTXMODE_APPLY);
Matrix_Push();
}
break;
EnSGoro_UpdateLimb(this->headRotZ + this->bodyRotZ + 0x4000,
this->headRotY + this->bodyRotY + this->actor.shape.rot.y + 0x4000, &this->headTranslate,
&this->headRotate, stepRot, overrideRot);
Matrix_Pop();
Matrix_Translate(this->headTranslate.x, this->headTranslate.y, this->headTranslate.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->headRotate.y, MTXMODE_APPLY);
Matrix_RotateXS(this->headRotate.x, MTXMODE_APPLY);
Matrix_RotateZS(this->headRotate.z, MTXMODE_APPLY);
Matrix_Push();
}
} else if (this->animInfoIndex != EN_S_GORO_ANIM_SLEEPY) {
if (this->actionFlags & EN_S_GORO_ACTIONFLAG_FACEPLAYER) {
overrideRot = true;
} else {
overrideRot = false;
}
if (this->loseAttentionTimer != 0) {
stepRot = true;
} else {
stepRot = false;
}
EnSGoro_UpdateLimb(this->bodyRotZ + 0x4000, this->bodyRotY + this->actor.shape.rot.y + 0x4000,
&this->bodyTranslate, &this->bodyRotate, stepRot, overrideRot);
Matrix_Pop();
Matrix_Translate(this->bodyTranslate.x, this->bodyTranslate.y, this->bodyTranslate.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_RotateYS(this->bodyRotate.y, MTXMODE_APPLY);
Matrix_RotateXS(this->bodyRotate.x, MTXMODE_APPLY);
Matrix_RotateZS(this->bodyRotate.z, MTXMODE_APPLY);
Matrix_Push();
default:
break;
}
}

View File

@ -15482,8 +15482,8 @@
0x80BC11B4:("EnNb_PostLimbDraw",),
0x80BC1278:("EnNb_TransformLimbDraw",),
0x80BC1374:("EnNb_Draw",),
0x80BC1900:("func_80BC1900",),
0x80BC192C:("func_80BC192C",),
0x80BC1900:("EnJa_UpdateSkelAnime",),
0x80BC192C:("EnJa_ChangeAnim",),
0x80BC1984:("func_80BC1984",),
0x80BC19FC:("func_80BC19FC",),
0x80BC1A68:("func_80BC1A68",),