Animation Cleanup: En_K* (#1402)

* cleanup k

* one more name
This commit is contained in:
engineer124 2023-10-01 12:56:38 +11:00 committed by GitHub
parent 33aaaea2c4
commit 1509349bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 354 additions and 195 deletions

View File

@ -1680,7 +1680,8 @@ void SkelAnime_AnimateFrame(SkelAnime* skelAnime) {
s32 frame = skelAnime->curFrame;
f32 partialFrame = skelAnime->curFrame - frame;
if (++frame >= (s32)skelAnime->animLength) {
frame++;
if (frame >= (s32)skelAnime->animLength) {
frame = 0;
}
SkelAnime_GetFrameData(skelAnime->animation, frame, skelAnime->limbCount, nextjointTable);

View File

@ -3931,10 +3931,11 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) {
SkelAnime_Free(&this->skelAnime, play);
if (this->unk_148 == 0) {
SkelAnime_InitFlex(play, &this->skelAnime, &gFishingBassSkel, &gFishingBassAnim, 0, 0, 0);
SkelAnime_InitFlex(play, &this->skelAnime, &gFishingBassSkel, &gFishingBassAnim, NULL, NULL, 0);
Animation_MorphToLoop(&this->skelAnime, &gFishingBassAnim, 0.0f);
} else {
SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, 0, 0, 0);
SkelAnime_InitFlex(play, &this->skelAnime, &gFishingLoachSkel, &gFishingLoachAnim, NULL, NULL,
0);
Animation_MorphToLoop(&this->skelAnime, &gFishingLoachAnim, 0.0f);
}
}

View File

@ -329,7 +329,8 @@ void EnGuardNuts_Update(Actor* thisx, PlayState* play) {
s32 pad;
if (this->blinkTimer == 0) {
if (++(this->eyeState) >= 3) {
this->eyeState++;
if (this->eyeState >= 3) {
this->eyeState = 0;
this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
}

View File

@ -442,8 +442,8 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) {
void EnKaizoku_ChangeAnim(EnKaizoku* this, EnKaizokuAnimation animIndex) {
this->animIndex = animIndex;
this->frameCount = Animation_GetLastFrame(sAnimations[this->animIndex]);
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount,
this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]);
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame,
sAnimationModes[this->animIndex], 0.0f);
}
@ -553,7 +553,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) {
break;
case 3:
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
sp54 = this->unk_2CA * 4 + this->unk_2C8;
if (Player_GetMask(play) == PLAYER_MASK_STONE) {
if (D_80B8A8D0[sp54] == 0x11A5) {
@ -595,7 +595,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) {
case 6:
Math_ApproachF(&this->unk_5E0, 5.0f, 0.3f, 1.0f);
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
this->unk_598 = 7;
this->unk_2F8.x = 1.0f;
this->unk_59C++;
@ -700,7 +700,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) {
switch (this->unk_59C) {
case 0:
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_14);
this->unk_2C8 = 3;
this->unk_598 = 0;
@ -709,7 +709,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) {
break;
case 1:
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
s32 textId;
EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_15);
@ -787,7 +787,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) {
break;
case 1:
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
if (this->unk_2D9 == 0) {
Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMM_BREATH);
this->unk_2D9 = 1;
@ -843,7 +843,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) {
255;
}
if ((this->frameCount <= curFrame) && (this->unk_5A0 >= 0x28)) {
if ((curFrame >= this->animEndFrame) && (this->unk_5A0 >= 0x28)) {
this->picto.actor.draw = NULL;
this->unk_598 = 10;
Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f);
@ -1127,7 +1127,7 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) {
}
this->unk_2D8 = 0;
if ((this->frameCount <= curFrame) &&
if ((curFrame >= this->animEndFrame) &&
(this->picto.actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) {
this->bodyCollider.info.elemType = ELEMTYPE_UNK1;
this->bodyCollider.base.colType = COLTYPE_HIT3;
@ -1157,7 +1157,7 @@ void func_80B87E9C(EnKaizoku* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
this->unk_2D8 = 0;
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
if ((this->picto.actor.xzDistToPlayer < 170.0f) && (this->picto.actor.xzDistToPlayer > 140.0f) &&
(Rand_ZeroOne() < 0.2f)) {
func_80B88910(this);
@ -1207,7 +1207,7 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) {
}
this->unk_2D8 = 0;
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) {
func_80B872A4(this);
@ -1252,7 +1252,7 @@ void func_80B88278(EnKaizoku* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
this->unk_2D8 = 0;
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
this->picto.actor.speed = 0.0f;
if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) {
func_80B872A4(this);
@ -1404,22 +1404,20 @@ void func_80B88964(EnKaizoku* this, PlayState* play) {
if (this->skelAnime.curFrame <= 8.0f) {
this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer;
} else {
if (Animation_OnFrame(&this->skelAnime, 13.0f)) {
Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0);
Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0);
this->swordState = 1;
this->picto.actor.speed = 10.0f;
Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK);
} else if (Animation_OnFrame(&this->skelAnime, 21.0f)) {
this->picto.actor.speed = 0.0f;
} else if (Animation_OnFrame(&this->skelAnime, 24.0f)) {
this->swordState = -1;
}
} else if (Animation_OnFrame(&this->skelAnime, 13.0f)) {
Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, 0);
Actor_SpawnFloorDustRing(play, &this->picto.actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, 0);
this->swordState = 1;
this->picto.actor.speed = 10.0f;
Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_ATTACK);
} else if (Animation_OnFrame(&this->skelAnime, 21.0f)) {
this->picto.actor.speed = 0.0f;
} else if (Animation_OnFrame(&this->skelAnime, 24.0f)) {
this->swordState = -1;
}
this->unk_2D8 = 0;
if ((this->frameCount <= curFrame) && (this->unk_2D0 < 2)) {
if ((curFrame >= this->animEndFrame) && (this->unk_2D0 < 2)) {
if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) {
func_80B872A4(this);
this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f;
@ -1755,7 +1753,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) {
Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1);
SkelAnime_Update(&this->skelAnime);
if (this->frameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
this->unk_2D8 = 0;
func_80B86B58(this);
} else if (Animation_OnFrame(&this->skelAnime, 10.0f)) {

View File

@ -80,7 +80,7 @@ typedef struct EnKaizoku {
/* 0x2D6 */ s16 csId;
/* 0x2D8 */ u8 unk_2D8;
/* 0x2D9 */ u8 unk_2D9;
/* 0x2DC */ f32 frameCount;
/* 0x2DC */ f32 animEndFrame;
/* 0x2E0 */ f32 unk_2E0;
/* 0x2E4 */ EnKaizokuAnimation animIndex;
/* 0x2E8 */ s32 bodyPartIndex;

View File

@ -121,18 +121,32 @@ typedef enum {
/* 5 */ ENKAKASI_ANIM_ARMS_CROSSED_STILL, // arms crossed but still, also some noise sfx
/* 6 */ ENKAKASI_ANIM_WAVE, // "wave" short sideways shake, stops early, partial? unused?
/* 7 */ ENKAKASI_ANIM_SLOWROLL, // partial bounch, ends looking left, OFFER anim takes over
/* 8 */ ENKAKASI_ANIM_IDLE // slow stretching wiggle, ends in regular position
/* 8 */ ENKAKASI_ANIM_IDLE, // slow stretching wiggle, ends in regular position
/* 9 */ ENKAKASI_ANIM_MAX
} EnKakasiAnimation;
static AnimationHeader* sAnimations[] = {
&object_ka_Anim_007444, &object_ka_Anim_00686C, &object_ka_Anim_0081A4,
&object_ka_Anim_007B90, &object_ka_Anim_0071EC, &object_ka_Anim_007444,
&object_ka_Anim_00686C, &object_ka_Anim_0081A4, &object_ka_Anim_000214,
static AnimationHeader* sAnimations[ENKAKASI_ANIM_MAX] = {
&object_ka_Anim_007444, // ENKAKASI_ANIM_ARMS_CROSSED_ROCKING
&object_ka_Anim_00686C, // ENKAKASI_ANIM_SIDEWAYS_SHAKING
&object_ka_Anim_0081A4, // ENKAKASI_ANIM_HOPPING_REGULAR
&object_ka_Anim_007B90, // ENKAKASI_ANIM_SPIN_REACH_OFFER
&object_ka_Anim_0071EC, // ENKAKASI_ANIM_TWIRL
&object_ka_Anim_007444, // ENKAKASI_ANIM_ARMS_CROSSED_STILL
&object_ka_Anim_00686C, // ENKAKASI_ANIM_WAVE
&object_ka_Anim_0081A4, // ENKAKASI_ANIM_SLOWROLL
&object_ka_Anim_000214, // ENKAKASI_ANIM_IDLE
};
static u8 sAnimationModes[] = {
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE,
ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE,
static u8 sAnimationModes[ENKAKASI_ANIM_MAX] = {
ANIMMODE_LOOP, // ENKAKASI_ANIM_ARMS_CROSSED_ROCKING
ANIMMODE_LOOP, // ENKAKASI_ANIM_SIDEWAYS_SHAKING
ANIMMODE_LOOP, // ENKAKASI_ANIM_HOPPING_REGULAR
ANIMMODE_ONCE, // ENKAKASI_ANIM_SPIN_REACH_OFFER
ANIMMODE_ONCE, // ENKAKASI_ANIM_TWIRL
ANIMMODE_ONCE, // ENKAKASI_ANIM_ARMS_CROSSED_STILL
ANIMMODE_ONCE, // ENKAKASI_ANIM_WAVE
ANIMMODE_ONCE, // ENKAKASI_ANIM_SLOWROLL
ANIMMODE_ONCE, // ENKAKASI_ANIM_IDLE
};
void EnKakasi_Destroy(Actor* thisx, PlayState* play) {
@ -147,7 +161,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) {
s32 i;
Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &D_80971D80);
SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, 0, 0, 0);
SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0);
this->songSummonDist = KAKASI_GET_SUMMON_DISTANCE(&this->picto.actor) * 20.0f;
if (this->songSummonDist < 40.0f) {
@ -278,7 +292,6 @@ void func_8096FBB8(EnKakasi* this, PlayState* play) {
(play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_RIGHT) ||
(play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_LEFT) ||
(play->msgCtx.ocarinaButtonIndex == OCARINA_BTN_C_UP)) {
// why not 0 < x < 4? fewer branches
this->unk190++;
}
if ((this->unk190 != 0) && (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING)) {
@ -364,7 +377,7 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) {
} else if ((day == 3) && gSaveContext.save.isNight) {
this->skelAnime.playSpeed = 1.0f;
if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) {
EnKakasi_ChangeAnim(this, 1);
EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING);
}
} else if (this->animIndex != ENKAKASI_ANIM_IDLE) {
EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_IDLE);
@ -403,7 +416,8 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) {
// if dialogue: oh sorry come back again
if ((this->picto.actor.textId == 0x1651) || (this->picto.actor.textId == 0x1659)) {
if ((curFrame >= this->animEndFrame) && (this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER)) {
if (++this->unkCounter1A4 >= 2) {
this->unkCounter1A4++;
if (this->unkCounter1A4 >= 2) {
this->unkCounter1A4 = 0;
EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER);
}
@ -1154,7 +1168,7 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) {
void EnKakasi_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnKakasi* this = THIS;
if (limbIndex == 4) {
if (limbIndex == OBJECT_KA_LIMB_04) {
Matrix_MultVec3f(&gZeroVec3f, &this->unk1BC);
}
}

View File

@ -647,10 +647,10 @@ void EnKame_Stunned(EnKame* this, PlayState* play) {
}
void EnKame_SetupDamaged(EnKame* this) {
s16 lastFrame = Animation_GetLastFrame(&gSnapperDamageAnim);
s16 endFrame = Animation_GetLastFrame(&gSnapperDamageAnim);
Animation_Change(&this->snapperSkelAnime, &gSnapperDamageAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -3.0f);
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, lastFrame);
Animation_Change(&this->snapperSkelAnime, &gSnapperDamageAnim, 1.0f, 0.0f, endFrame, ANIMMODE_ONCE, -3.0f);
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, endFrame);
Actor_PlaySfx(&this->actor, NA_SE_EN_PAMET_DAMAGE);
this->collider.base.acFlags &= ~AC_ON;
this->actionFunc = EnKame_Damaged;

View File

@ -17,11 +17,28 @@ void EnKbt_Draw(Actor* thisx, PlayState* play);
s32 func_80B33E64(PlayState* play);
s32 func_80B33E8C(PlayState* play);
void func_80B33EF0(EnKbt* this, s16 arg1);
void EnKbt_ChangeAnim(EnKbt* this, s16 animIndex);
Actor* func_80B3403C(PlayState* play);
void func_80B34314(EnKbt* this, PlayState* play);
void func_80B34598(EnKbt* this, PlayState* play);
typedef enum EnKbtAnimation {
/* 0 */ ENKBT_ANIM_0,
/* 1 */ ENKBT_ANIM_1,
/* 2 */ ENKBT_ANIM_2,
/* 3 */ ENKBT_ANIM_3,
/* 4 */ ENKBT_ANIM_4,
/* 5 */ ENKBT_ANIM_5,
/* 6 */ ENKBT_ANIM_6,
/* 7 */ ENKBT_ANIM_7,
/* 8 */ ENKBT_ANIM_8,
/* 9 */ ENKBT_ANIM_9,
/* 10 */ ENKBT_ANIM_10,
/* 11 */ ENKBT_ANIM_11,
/* 12 */ ENKBT_ANIM_12,
/* 13 */ ENKBT_ANIM_MAX
} EnKbtAnimation;
ActorInit En_Kbt_InitVars = {
ACTOR_EN_KBT,
ACTORCAT_NPC,
@ -44,13 +61,13 @@ void EnKbt_Init(Actor* thisx, PlayState* play) {
this->actor.home.rot.z = 0;
this->unk_27E = 4;
this->unk_27F = 0;
this->unk_280 = 13;
this->animIndex = ENKBT_ANIM_MAX;
this->unk_282 = 13;
this->unk_278 = func_80B3403C(play);
this->unk_284 = 0;
this->actor.textId = 0;
if (func_80B33E64(play)) {
func_80B33EF0(this, 6);
EnKbt_ChangeAnim(this, ENKBT_ANIM_6);
this->unk_282 = 11;
if (func_80B33E8C(play)) {
this->actor.textId = 0xC50;
@ -60,7 +77,7 @@ void EnKbt_Init(Actor* thisx, PlayState* play) {
}
this->actionFunc = func_80B34314;
} else {
func_80B33EF0(this, 0);
EnKbt_ChangeAnim(this, ENKBT_ANIM_0);
this->unk_282 = 0;
this->actionFunc = func_80B34598;
}
@ -82,27 +99,48 @@ s32 func_80B33E8C(PlayState* play) {
return false;
}
void func_80B33EF0(EnKbt* this, s16 arg1) {
static AnimationHeader* sAnimations[] = {
&object_kbt_Anim_000670, &object_kbt_Anim_001674, &object_kbt_Anim_002084, &object_kbt_Anim_000FE8,
&object_kbt_Anim_001940, &object_kbt_Anim_00E7BC, &object_kbt_Anim_00F0C8, &object_kbt_Anim_002710,
&object_kbt_Anim_002DE0, &object_kbt_Anim_003414, &object_kbt_Anim_003D24, &object_kbt_Anim_001BF4,
&object_kbt_Anim_002084,
void EnKbt_ChangeAnim(EnKbt* this, s16 animIndex) {
static AnimationHeader* sAnimations[ENKBT_ANIM_MAX] = {
&object_kbt_Anim_000670, // ENKBT_ANIM_0
&object_kbt_Anim_001674, // ENKBT_ANIM_1
&object_kbt_Anim_002084, // ENKBT_ANIM_2
&object_kbt_Anim_000FE8, // ENKBT_ANIM_3
&object_kbt_Anim_001940, // ENKBT_ANIM_4
&object_kbt_Anim_00E7BC, // ENKBT_ANIM_5
&object_kbt_Anim_00F0C8, // ENKBT_ANIM_6
&object_kbt_Anim_002710, // ENKBT_ANIM_7
&object_kbt_Anim_002DE0, // ENKBT_ANIM_8
&object_kbt_Anim_003414, // ENKBT_ANIM_9
&object_kbt_Anim_003D24, // ENKBT_ANIM_10
&object_kbt_Anim_001BF4, // ENKBT_ANIM_11
&object_kbt_Anim_002084, // ENKBT_ANIM_12
};
u8 sp38[] = {
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP,
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE,
u8 animationModes[ENKBT_ANIM_MAX] = {
ANIMMODE_LOOP, // ENKBT_ANIM_0
ANIMMODE_LOOP, // ENKBT_ANIM_1
ANIMMODE_ONCE, // ENKBT_ANIM_2
ANIMMODE_LOOP, // ENKBT_ANIM_3
ANIMMODE_ONCE, // ENKBT_ANIM_4
ANIMMODE_LOOP, // ENKBT_ANIM_5
ANIMMODE_LOOP, // ENKBT_ANIM_6
ANIMMODE_LOOP, // ENKBT_ANIM_7
ANIMMODE_LOOP, // ENKBT_ANIM_8
ANIMMODE_LOOP, // ENKBT_ANIM_9
ANIMMODE_LOOP, // ENKBT_ANIM_10
ANIMMODE_ONCE, // ENKBT_ANIM_11
ANIMMODE_ONCE, // ENKBT_ANIM_12
};
if (arg1 != this->unk_280) {
if (arg1 >= 12) {
Animation_Change(&this->skelAnime, sAnimations[arg1], -1.0f,
Animation_GetLastFrame(sAnimations[arg1]) - 1.0f, 0.0f, sp38[arg1], -5.0f);
if (this->animIndex != animIndex) {
if (animIndex >= ENKBT_ANIM_12) {
Animation_Change(&this->skelAnime, sAnimations[animIndex], -1.0f,
Animation_GetLastFrame(sAnimations[animIndex]) - 1.0f, 0.0f, animationModes[animIndex],
-5.0f);
} else {
Animation_Change(&this->skelAnime, sAnimations[arg1], 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[arg1]),
sp38[arg1], -5.0f);
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimations[animIndex]), animationModes[animIndex], -5.0f);
}
this->unk_280 = arg1;
this->animIndex = animIndex;
}
}
@ -124,11 +162,11 @@ void func_80B34078(EnKbt* this) {
if (this->unk_284 > 0) {
this->unk_284--;
} else {
switch (this->unk_280) {
case 2:
switch (this->animIndex) {
case ENKBT_ANIM_2:
switch (this->unk_282) {
case 0:
func_80B33EF0(this, 12);
EnKbt_ChangeAnim(this, ENKBT_ANIM_12);
break;
case 5:
@ -136,21 +174,24 @@ void func_80B34078(EnKbt* this) {
break;
default:
func_80B33EF0(this, 5);
EnKbt_ChangeAnim(this, ENKBT_ANIM_5);
break;
}
break;
case 12:
func_80B33EF0(this, 0);
case ENKBT_ANIM_12:
EnKbt_ChangeAnim(this, ENKBT_ANIM_0);
this->actor.home.rot.z = 0;
break;
case 4:
func_80B33EF0(this, 1);
case ENKBT_ANIM_4:
EnKbt_ChangeAnim(this, ENKBT_ANIM_1);
this->unk_27E = 2;
this->actor.home.rot.z = 0;
break;
default:
break;
}
}
}
@ -169,67 +210,70 @@ void func_80B3415C(EnKbt* this) {
switch (this->unk_282) {
case 0:
if ((this->unk_280 != 2) && (this->unk_280 != 12)) {
func_80B33EF0(this, 0);
if ((this->animIndex != ENKBT_ANIM_2) && (this->animIndex != ENKBT_ANIM_12)) {
EnKbt_ChangeAnim(this, ENKBT_ANIM_0);
}
break;
case 1:
func_80B33EF0(this, 2);
EnKbt_ChangeAnim(this, ENKBT_ANIM_2);
this->unk_282 = 0;
break;
case 2:
if (this->unk_280 != 12) {
func_80B33EF0(this, 3);
if (this->animIndex != ENKBT_ANIM_12) {
EnKbt_ChangeAnim(this, ENKBT_ANIM_3);
}
break;
case 3:
if (this->unk_280 != 1) {
func_80B33EF0(this, 4);
if (this->animIndex != ENKBT_ANIM_1) {
EnKbt_ChangeAnim(this, ENKBT_ANIM_4);
}
break;
case 10:
func_80B33EF0(this, 11);
EnKbt_ChangeAnim(this, ENKBT_ANIM_11);
break;
case 4:
func_80B33EF0(this, 2);
EnKbt_ChangeAnim(this, ENKBT_ANIM_2);
this->unk_282 = 6;
break;
case 6:
if (this->unk_280 != 2) {
func_80B33EF0(this, 5);
if (this->animIndex != ENKBT_ANIM_2) {
EnKbt_ChangeAnim(this, ENKBT_ANIM_5);
}
break;
case 11:
func_80B33EF0(this, 6);
EnKbt_ChangeAnim(this, ENKBT_ANIM_6);
break;
case 7:
if (this->unk_280 != 2) {
func_80B33EF0(this, 7);
if (this->animIndex != ENKBT_ANIM_2) {
EnKbt_ChangeAnim(this, ENKBT_ANIM_7);
}
break;
case 8:
if (this->unk_280 != 2) {
func_80B33EF0(this, 8);
if (this->animIndex != ENKBT_ANIM_2) {
EnKbt_ChangeAnim(this, ENKBT_ANIM_8);
}
break;
case 9:
if (this->unk_280 != 2) {
func_80B33EF0(this, 9);
if (this->animIndex != ENKBT_ANIM_2) {
EnKbt_ChangeAnim(this, ENKBT_ANIM_9);
}
break;
case 12:
func_80B33EF0(this, 10);
EnKbt_ChangeAnim(this, ENKBT_ANIM_10);
break;
default:
break;
}
}
@ -327,7 +371,7 @@ void func_80B34598(EnKbt* this, PlayState* play) {
this->unk_27E = 4;
this->unk_27F = 0;
this->unk_282 = 0;
func_80B33EF0(this, 12);
EnKbt_ChangeAnim(this, ENKBT_ANIM_12);
break;
case 0x6:
@ -411,26 +455,26 @@ void func_80B34598(EnKbt* this, PlayState* play) {
case 0xC35:
this->unk_27E = 4;
this->unk_27F = 0;
func_80B33EF0(this, 2);
EnKbt_ChangeAnim(this, ENKBT_ANIM_2);
this->unk_282 = 5;
break;
case 0xC36:
this->unk_27E = 1;
this->unk_27F = 1;
func_80B33EF0(this, 7);
EnKbt_ChangeAnim(this, ENKBT_ANIM_7);
this->unk_282 = 7;
break;
case 0xC37:
func_80B33EF0(this, 10);
EnKbt_ChangeAnim(this, ENKBT_ANIM_10);
this->unk_27E = 0;
this->unk_27F = 1;
break;
case 0xC38:
case 0xC39:
func_80B33EF0(this, 7);
EnKbt_ChangeAnim(this, ENKBT_ANIM_7);
this->unk_27E = 0;
this->unk_27F = 1;
break;
@ -517,6 +561,9 @@ void func_80B34598(EnKbt* this, PlayState* play) {
this->unk_27F = 1;
this->unk_282 = 12;
break;
default:
break;
}
this->actor.textId = 0;

View File

@ -17,7 +17,7 @@ typedef struct EnKbt {
/* 0x27C */ u16 unk_27C;
/* 0x27E */ u8 unk_27E;
/* 0x27F */ u8 unk_27F;
/* 0x280 */ s16 unk_280;
/* 0x280 */ s16 animIndex;
/* 0x282 */ s16 unk_282;
/* 0x284 */ s16 unk_284;
/* 0x288 */ EnKbtActionFunc actionFunc;

View File

@ -6,7 +6,6 @@
#include "z_en_kendo_js.h"
#include "overlays/actors/ovl_En_Maruta/z_en_maruta.h"
#include "objects/object_js/object_js.h"
#define FLAGS \
(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_2000000 | ACTOR_FLAG_CANT_LOCK_ON)
@ -72,12 +71,21 @@ static ColliderCylinderInit sCylinderInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
static AnimationInfo sAnimationInfo[] = {
{ &object_js_Anim_000C7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
{ &object_js_Anim_000F4C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
{ &object_js_Anim_00016C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
{ &object_js_Anim_0003DC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
{ &object_js_Anim_000AD4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
typedef enum EnKendoJsAnimation {
/* 0 */ ENKENDOJS_ANIM_0,
/* 1 */ ENKENDOJS_ANIM_1,
/* 2 */ ENKENDOJS_ANIM_2,
/* 3 */ ENKENDOJS_ANIM_3,
/* 4 */ ENKENDOJS_ANIM_4,
/* 5 */ ENKENDOJS_ANIM_MAX
} EnKendoJsAnimation;
static AnimationInfo sAnimationInfo[ENKENDOJS_ANIM_MAX] = {
{ &object_js_Anim_000C7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_0
{ &object_js_Anim_000F4C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_1
{ &object_js_Anim_00016C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_2
{ &object_js_Anim_0003DC, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENKENDOJS_ANIM_3
{ &object_js_Anim_000AD4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENKENDOJS_ANIM_4
};
s16 D_80B27CE0[][3] = {
@ -110,7 +118,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) {
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
SkelAnime_InitFlex(play, &this->skelAnime, &object_js_Skel_006990, &object_js_Anim_000F4C, this->jointTable,
this->morphTable, 13);
this->morphTable, OBJECT_JS_LIMB_MAX);
if ((CURRENT_DAY == 3) &&
!((gSaveContext.save.time <= CLOCK_TIME(23, 0)) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)))) {
@ -120,7 +128,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) {
this->actor.home.rot.z, 0x10);
Actor_Kill(&this->actor);
} else {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_4);
}
} else if (ENKENDOJS_GET_FF(&this->actor) == ENKENDOJS_FF_1) {
Actor_Kill(&this->actor);
@ -224,7 +232,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) {
Audio_PlaySfx(NA_SE_SY_ERROR);
Message_StartTextbox(play, 0x272C, &this->actor);
this->unk_288 = 0x272C;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2);
} else if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) {
Audio_PlaySfx(NA_SE_SY_ERROR);
Message_StartTextbox(play, 0x2718, &this->actor);
@ -242,7 +250,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) {
Audio_PlaySfx(NA_SE_SY_ERROR);
Message_StartTextbox(play, 0x272C, &this->actor);
this->unk_288 = 0x272C;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2);
} else if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk12070) {
Audio_PlaySfx(NA_SE_SY_ERROR);
Message_StartTextbox(play, 0x2718, &this->actor);
@ -259,6 +267,9 @@ void func_80B26758(EnKendoJs* this, PlayState* play) {
Audio_PlaySfx_MessageCancel();
Message_StartTextbox(play, 0x2717, &this->actor);
this->unk_288 = 0x2717;
default:
break;
}
}
}
@ -310,6 +321,9 @@ void func_80B269A4(EnKendoJs* this, PlayState* play) {
func_80B276C4(this);
func_80B276D8(this, play);
break;
default:
break;
}
}
@ -332,7 +346,7 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) {
case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) {
if (this->unk_288 == 0x272C) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_3);
}
if ((this->unk_288 == 0x272E) || (this->unk_288 == 0x272F) || (this->unk_288 == 0x2730)) {
@ -347,6 +361,7 @@ void func_80B26AFC(EnKendoJs* this, PlayState* play) {
case TEXT_STATE_1:
case TEXT_STATE_CLOSING:
case TEXT_STATE_3:
default:
break;
}
}
@ -443,6 +458,9 @@ s32 func_80B26BF8(EnKendoJs* this, PlayState* play) {
return 1;
}
break;
default:
break;
}
return 2;
}
@ -477,6 +495,9 @@ s32 func_80B26F6C(EnKendoJs* this, PlayState* play) {
return true;
}
break;
default:
break;
}
return false;
}
@ -523,7 +544,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) {
func_80B26F14(this, play);
} else if (!func_80B26F6C(this, play)) {
if (this->skelAnime.animation == &object_js_Anim_00016C) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_3);
}
this->unk_286 = 2;
Message_CloseTextbox(play);
@ -548,7 +569,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) {
player->stateFlags1 |= PLAYER_STATE1_20;
Message_StartTextbox(play, 0x2729, &this->actor);
this->unk_288 = 0x2729;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_2);
break;
default:
@ -564,7 +585,7 @@ void func_80B27188(EnKendoJs* this, PlayState* play) {
if ((this->skelAnime.animation == &object_js_Anim_0003DC) &&
Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENKENDOJS_ANIM_1);
}
if (this->unk_284 == 7) {
@ -764,7 +785,7 @@ void EnKendoJs_Update(Actor* thisx, PlayState* play) {
s32 EnKendoJs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnKendoJs* this = THIS;
if (limbIndex == 12) {
if (limbIndex == OBJECT_JS_LIMB_0C) {
rot->y -= this->unk_278.y;
}
return false;

View File

@ -2,6 +2,7 @@
#define Z_EN_KENDO_JS_H
#include "global.h"
#include "objects/object_js/object_js.h"
struct EnKendoJs;
@ -17,8 +18,8 @@ typedef struct EnKendoJs {
/* 0x144 */ ColliderCylinder collider;
/* 0x190 */ SkelAnime skelAnime;
/* 0x1D4 */ EnKendoJsActionFunc actionFunc;
/* 0x1D8 */ Vec3s jointTable[13];
/* 0x226 */ Vec3s morphTable[13];
/* 0x1D8 */ Vec3s jointTable[OBJECT_JS_LIMB_MAX];
/* 0x226 */ Vec3s morphTable[OBJECT_JS_LIMB_MAX];
/* 0x274 */ Vec3s* unk_274;
/* 0x278 */ Vec3s unk_278;
/* 0x27E */ Vec3s unk_27E;

View File

@ -5,7 +5,6 @@
*/
#include "z_en_kgy.h"
#include "objects/object_kgy/object_kgy.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@ -31,6 +30,21 @@ void func_80B425A0(EnKgy* this, PlayState* play);
void func_80B42714(EnKgy* this, PlayState* play);
void func_80B42D28(EnKgy* this, PlayState* play);
typedef enum EnKgyAnimation {
/* -1 */ ENKGY_ANIM_NONE = -1,
/* 0 */ ENKGY_ANIM_0,
/* 1 */ ENKGY_ANIM_1,
/* 2 */ ENKGY_ANIM_2,
/* 3 */ ENKGY_ANIM_3,
/* 4 */ ENKGY_ANIM_4,
/* 5 */ ENKGY_ANIM_5,
/* 6 */ ENKGY_ANIM_6,
/* 7 */ ENKGY_ANIM_7,
/* 8 */ ENKGY_ANIM_8,
/* 9 */ ENKGY_ANIM_9,
/* 10 */ ENKGY_ANIM_MAX
} EnKgyAnimation;
ActorInit En_Kgy_InitVars = {
ACTOR_EN_KGY,
ACTORCAT_NPC,
@ -50,11 +64,11 @@ void EnKgy_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
SkelAnime_InitFlex(play, &this->skelAnime, &object_kgy_Skel_00F910, &object_kgy_Anim_004B98, this->jointTable,
this->morphTable, 23);
this->unk_2D2 = -1;
this->morphTable, OBJECT_KGY_LIMB_MAX);
this->animIndex = ENKGY_ANIM_NONE;
this->unk_29C = 0;
this->unk_2E4 = 0;
this->unk_2E2 = -1;
this->animIndex2 = ENKGY_ANIM_NONE;
this->zubora = EnKgy_FindZubora(play);
this->iceBlock = EnKgy_FindIceBlock(play);
Flags_UnsetSwitch(play, ENKGY_GET_FE00(&this->actor) + 1);
@ -64,25 +78,25 @@ void EnKgy_Init(Actor* thisx, PlayState* play) {
play->envCtx.lightSettingOverride = 1;
SET_WEEKEVENTREG(WEEKEVENTREG_21_01);
if (!func_80B40D64(play)) {
EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0);
EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0);
this->actionFunc = func_80B425A0;
this->actor.textId = 0xC35;
} else if (!func_80B40DB4(play)) {
EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, 0);
EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, 0);
this->actionFunc = func_80B419B0;
this->actor.textId = 0xC4E;
this->unk_29C |= 1;
this->getItemId = GI_RUPEE_10;
} else {
EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0);
EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0);
this->actionFunc = func_80B42714;
this->actor.textId = 0xC50;
}
} else {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_80)) {
EnKgy_ChangeAnim(this, 4, ANIMMODE_LOOP, 0);
EnKgy_ChangeAnim(this, ENKGY_ANIM_4, ANIMMODE_LOOP, 0);
} else {
EnKgy_ChangeAnim(this, 0, ANIMMODE_LOOP, 0);
EnKgy_ChangeAnim(this, ENKGY_ANIM_0, ANIMMODE_LOOP, 0);
}
this->actionFunc = func_80B42D28;
}
@ -109,21 +123,28 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play) {
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
}
void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames) {
static AnimationHeader* sAnimations[] = {
&object_kgy_Anim_004B98, &object_kgy_Anim_0008FC, &object_kgy_Anim_00292C, &object_kgy_Anim_0042E4,
&object_kgy_Anim_0101F0, &object_kgy_Anim_001764, &object_kgy_Anim_003334, &object_kgy_Anim_010B84,
&object_kgy_Anim_001EA4, &object_kgy_Anim_003D88,
};
static AnimationHeader* sAnimations[ENKGY_ANIM_MAX] = {
&object_kgy_Anim_004B98, // ENKGY_ANIM_0
&object_kgy_Anim_0008FC, // ENKGY_ANIM_1
&object_kgy_Anim_00292C, // ENKGY_ANIM_2
&object_kgy_Anim_0042E4, // ENKGY_ANIM_3
&object_kgy_Anim_0101F0, // ENKGY_ANIM_4
&object_kgy_Anim_001764, // ENKGY_ANIM_5
&object_kgy_Anim_003334, // ENKGY_ANIM_6
&object_kgy_Anim_010B84, // ENKGY_ANIM_7
&object_kgy_Anim_001EA4, // ENKGY_ANIM_8
&object_kgy_Anim_003D88, // ENKGY_ANIM_9
};
void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames) {
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames);
this->unk_2D2 = animIndex;
this->animIndex = animIndex;
}
void func_80B40BC0(EnKgy* this, s16 arg1) {
if (arg1 != this->unk_2D2) {
EnKgy_ChangeAnim(this, arg1, ANIMMODE_LOOP, -5.0f);
void EnKgy_ChangeAnimLoopMorph(EnKgy* this, s16 animIndex) {
if (this->animIndex != animIndex) {
EnKgy_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f);
}
}
@ -218,13 +239,13 @@ void func_80B40EE8(EnKgy* this, PlayState* play) {
if (this->unk_2E4 > 0) {
this->unk_2E4--;
if ((this->unk_2E4 == 0) && (this->unk_2E2 >= 0)) {
if (this->unk_2E2 == 3) {
EnKgy_ChangeAnim(this, 3, ANIMMODE_ONCE, -5.0f);
if ((this->unk_2E4 == 0) && (this->animIndex2 > ENKGY_ANIM_NONE)) {
if (this->animIndex2 == ENKGY_ANIM_3) {
EnKgy_ChangeAnim(this, ENKGY_ANIM_3, ANIMMODE_ONCE, -5.0f);
} else {
func_80B40BC0(this, this->unk_2E2);
EnKgy_ChangeAnimLoopMorph(this, this->animIndex2);
}
this->unk_2E2 = -1;
this->animIndex2 = ENKGY_ANIM_NONE;
}
}
@ -258,14 +279,14 @@ void func_80B40EE8(EnKgy* this, PlayState* play) {
switch (this->actor.textId) {
case 0xC22:
this->unk_2E4 = 20;
this->unk_2E2 = 3;
this->animIndex2 = ENKGY_ANIM_3;
break;
case 0xC43:
if (func_80B40D64(play)) {
func_80B40BC0(this, 7);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7);
} else {
func_80B40BC0(this, 1);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
}
this->unk_2E4 = 30;
this->actionFunc = func_80B41A48;
@ -273,7 +294,10 @@ void func_80B40EE8(EnKgy* this, PlayState* play) {
case 0xC52:
case 0xC54:
func_80B40BC0(this, 1);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
break;
default:
break;
}
}
@ -288,7 +312,7 @@ void func_80B40EE8(EnKgy* this, PlayState* play) {
if (this->unk_2E8 == 0) {
if ((this->actor.textId == 0xC1D) || (this->actor.textId == 0xC2D)) {
this->unk_2E4 = 20;
this->unk_2E2 = 3;
this->animIndex2 = ENKGY_ANIM_3;
func_80B40EBC(this, play, this->actor.textId);
} else {
func_80B40EBC(this, play, this->actor.textId);
@ -339,6 +363,9 @@ void func_80B411DC(EnKgy* this, PlayState* play, s32 arg2) {
}
this->csIdIndex = 4;
break;
default:
break;
}
}
@ -419,16 +446,16 @@ void func_80B4163C(EnKgy* this, PlayState* play) {
this->actor.focus.pos = this->unk_2A8;
if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_2D2 == 6) {
if (this->animIndex == ENKGY_ANIM_6) {
if (this->getItemId > GI_NONE) {
EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, 0.0f);
EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, 0.0f);
this->getItemId--;
} else {
EnKgy_ChangeAnim(this, 9, ANIMMODE_ONCE, -5.0f);
EnKgy_ChangeAnim(this, ENKGY_ANIM_9, ANIMMODE_ONCE, -5.0f);
this->getItemId = (s32)Rand_ZeroFloat(GI_RUPEE_PURPLE - GI_RUPEE_BLUE) + GI_RUPEE_BLUE;
}
} else {
EnKgy_ChangeAnim(this, 6, ANIMMODE_ONCE, -5.0f);
EnKgy_ChangeAnim(this, ENKGY_ANIM_6, ANIMMODE_ONCE, -5.0f);
}
SkelAnime_Update(&this->skelAnime);
}
@ -446,6 +473,9 @@ void func_80B4163C(EnKgy* this, PlayState* play) {
this->unk_300 = 200;
Actor_PlaySfx(&this->actor, NA_SE_EV_SWORD_FORGE);
break;
default:
break;
}
this->lightInfo.params.point.radius = this->unk_300;
@ -608,11 +638,11 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
s32 pad;
Player* player = GET_PLAYER(play);
if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 3)) {
func_80B40BC0(this, 4);
if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_3)) {
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
}
if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && func_80B40E54(this) == 0) {
if ((this->unk_2E4 <= 0) && !(this->unk_29C & 2) && (func_80B40E54(this) == 0)) {
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(play)) {
@ -636,6 +666,9 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
Audio_PlaySfx_MessageCancel();
func_80B40EBC(this, play, textId);
break;
default:
break;
}
break;
@ -650,8 +683,14 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
Audio_PlaySfx_MessageCancel();
func_80B40E74(this, play, 0xC3C);
break;
default:
break;
}
break;
default:
break;
}
}
break;
@ -683,13 +722,13 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
this->actionFunc = func_80B425A0;
func_80B413C8(this);
func_80B40E18(this, 5);
func_80B40BC0(this, 4);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
this->actor.textId = 0xC35;
break;
case 0xC3A:
func_80B40E74(this, play, func_80B41528(play));
func_80B40BC0(this, 4);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
break;
case 0xC3C:
@ -758,7 +797,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
break;
case 0xC47:
func_80B40BC0(this, 1);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
if (this->unk_29C & 8) {
player->exchangeItemAction = PLAYER_IA_NONE;
this->unk_29C &= ~8;
@ -780,7 +819,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
case 0xC4A:
case 0xC4B:
func_80B40BC0(this, 4);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
Message_CloseTextbox(play);
this->actionFunc = func_80B41C54;
this->actor.textId = 0xC4B;
@ -817,9 +856,15 @@ void func_80B41E18(EnKgy* this, PlayState* play) {
func_80B413C8(this);
func_80B40E18(this, 8);
break;
default:
break;
}
}
break;
default:
break;
}
}
@ -844,7 +889,7 @@ void func_80B425A0(EnKgy* this, PlayState* play) {
this->actor.focus.pos = this->unk_2A8;
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->actionFunc = func_80B41E18;
func_80B40BC0(this, 1);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
func_80B411DC(this, play, 0);
func_80B40E18(this, this->actor.textId);
} else if (this->actor.xzDistToPlayer < 200.0f) {
@ -887,11 +932,11 @@ void func_80B427C8(EnKgy* this, PlayState* play) {
u16 textId;
if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_2D2 == 5) {
func_80B40BC0(this, 7);
if (this->animIndex == ENKGY_ANIM_5) {
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7);
}
if (this->unk_2D2 == 3) {
func_80B40BC0(this, 4);
if (this->animIndex == ENKGY_ANIM_3) {
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
}
}
@ -923,26 +968,29 @@ void func_80B427C8(EnKgy* this, PlayState* play) {
this->actionFunc = func_80B41C54;
func_80B413C8(this);
func_80B40E18(this, 6);
func_80B40BC0(this, 4);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
this->actor.textId = 0xC3A;
break;
default:
break;
}
}
func_80B40EE8(this, play);
}
void func_80B4296C(EnKgy* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) {
func_80B40BC0(this, 2);
if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_8)) {
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_2);
}
this->actor.focus.pos = this->unk_2A8;
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->actionFunc = func_80B427C8;
if (this->unk_2D2 == 4) {
func_80B40BC0(this, 7);
if (this->animIndex == ENKGY_ANIM_4) {
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_7);
} else {
EnKgy_ChangeAnim(this, 5, ANIMMODE_ONCE, -5.0f);
EnKgy_ChangeAnim(this, ENKGY_ANIM_5, ANIMMODE_ONCE, -5.0f);
}
func_80B411DC(this, play, 0);
func_80B40E18(this, this->actor.textId);
@ -958,12 +1006,12 @@ void func_80B42A8C(EnKgy* this, PlayState* play) {
s32 pad;
if (SkelAnime_Update(&this->skelAnime)) {
if (this->unk_2D2 == 5) {
func_80B40BC0(this, 1);
if (this->animIndex == ENKGY_ANIM_5) {
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
}
if (this->unk_2D2 == 3) {
func_80B40BC0(this, 4);
if (this->animIndex == ENKGY_ANIM_3) {
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_4);
}
}
@ -995,7 +1043,7 @@ void func_80B42A8C(EnKgy* this, PlayState* play) {
case 0xC20:
case 0xC28:
func_80B40BC0(this, 1);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
play->msgCtx.msgLength = 0;
this->unk_29C |= 4;
this->unk_2E8 = 3;
@ -1027,7 +1075,7 @@ void func_80B42A8C(EnKgy* this, PlayState* play) {
case 0xC2A:
this->unk_2E4 = 20;
this->unk_2E2 = 3;
this->animIndex2 = ENKGY_ANIM_3;
func_80B40EBC(this, play, this->actor.textId);
break;
@ -1038,23 +1086,26 @@ void func_80B42A8C(EnKgy* this, PlayState* play) {
func_80B413C8(this);
func_80B40E18(this, 1);
break;
default:
break;
}
}
func_80B40EE8(this, play);
}
void func_80B42D28(EnKgy* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime) && (this->unk_2D2 == 8)) {
func_80B40BC0(this, 2);
if (SkelAnime_Update(&this->skelAnime) && (this->animIndex == ENKGY_ANIM_8)) {
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_2);
}
this->actor.focus.pos = this->unk_2A8;
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->actionFunc = func_80B42A8C;
if (this->actor.textId == 0xC2D) {
func_80B40BC0(this, 1);
EnKgy_ChangeAnimLoopMorph(this, ENKGY_ANIM_1);
} else {
EnKgy_ChangeAnim(this, 5, ANIMMODE_ONCE, -5.0f);
EnKgy_ChangeAnim(this, ENKGY_ANIM_5, ANIMMODE_ONCE, -5.0f);
SET_WEEKEVENTREG(WEEKEVENTREG_20_80);
}
func_80B411DC(this, play, 0);
@ -1065,7 +1116,7 @@ void func_80B42D28(EnKgy* this, PlayState* play) {
this->actionFunc = func_80B4296C;
SET_WEEKEVENTREG(WEEKEVENTREG_21_01);
} else if (this->actor.xzDistToPlayer < 200.0f) {
if (this->unk_2D2 == 4) {
if (this->animIndex == ENKGY_ANIM_4) {
this->actor.textId = 0xC2D;
} else {
this->actor.textId = 0xC1D;
@ -1073,8 +1124,8 @@ void func_80B42D28(EnKgy* this, PlayState* play) {
Actor_OfferTalk(&this->actor, play, 210.0f);
}
if ((this->unk_2D2 == 0) && (this->actor.xzDistToPlayer < 200.0f)) {
EnKgy_ChangeAnim(this, 8, ANIMMODE_ONCE, 5.0f);
if ((this->animIndex == ENKGY_ANIM_0) && (this->actor.xzDistToPlayer < 200.0f)) {
EnKgy_ChangeAnim(this, ENKGY_ANIM_8, ANIMMODE_ONCE, 5.0f);
}
}
}
@ -1085,7 +1136,7 @@ void EnKgy_Update(Actor* thisx, PlayState* play) {
Vec3s sp30;
this->actionFunc(this, play);
if (this->unk_2D2 == 2) {
if (this->animIndex == ENKGY_ANIM_2) {
sp30.z = 0;
sp30.y = 0;
sp30.x = 0;
@ -1100,14 +1151,14 @@ s32 EnKgy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
EnKgy* this = THIS;
if (!(this->unk_29C & 1)) {
if (limbIndex == 17) {
if (limbIndex == OBJECT_KGY_LIMB_11) {
*dList = NULL;
}
} else if (limbIndex == 16) {
} else if (limbIndex == OBJECT_KGY_LIMB_10) {
*dList = NULL;
}
if (limbIndex == 11) {
if (limbIndex == OBJECT_KGY_LIMB_0B) {
rot->x += this->unk_2CC.y;
}
@ -1119,11 +1170,11 @@ void EnKgy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
static Vec3f D_80B432E4 = { 3000.0f, 4000.0f, 300.0f };
EnKgy* this = THIS;
if (limbIndex == 11) {
if (limbIndex == OBJECT_KGY_LIMB_0B) {
Matrix_MultVec3f(&D_80B432D8, &this->unk_2A8);
}
if (limbIndex == 16) {
if (limbIndex == OBJECT_KGY_LIMB_10) {
Matrix_MultVec3f(&D_80B432E4, &this->unk_2C0);
}
}

View File

@ -2,6 +2,7 @@
#define Z_EN_KGY_H
#include "global.h"
#include "objects/object_kgy/object_kgy.h"
#include "overlays/actors/ovl_En_Kbt/z_en_kbt.h"
#include "overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.h"
@ -15,8 +16,8 @@ typedef void (*EnKgyActionFunc)(struct EnKgy*, PlayState*);
typedef struct EnKgy {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[23];
/* 0x212 */ Vec3s morphTable[23];
/* 0x188 */ Vec3s jointTable[OBJECT_KGY_LIMB_MAX];
/* 0x212 */ Vec3s morphTable[OBJECT_KGY_LIMB_MAX];
/* 0x29C */ u16 unk_29C;
/* 0x2A0 */ EnKbt* zubora;
/* 0x2A4 */ ObjIcePoly* iceBlock;
@ -24,10 +25,10 @@ typedef struct EnKgy {
/* 0x2B4 */ Vec3f unk_2B4;
/* 0x2C0 */ Vec3f unk_2C0;
/* 0x2CC */ Vec3s unk_2CC;
/* 0x2D2 */ s16 unk_2D2;
/* 0x2D2 */ s16 animIndex;
/* 0x2D4 */ s16 csIdList[6];
/* 0x2E0 */ s16 csIdIndex;
/* 0x2E2 */ s16 unk_2E2;
/* 0x2E2 */ s16 animIndex2;
/* 0x2E4 */ s16 unk_2E4;
/* 0x2E6 */ s16 unk_2E6;
/* 0x2E8 */ s16 unk_2E8;

View File

@ -173,6 +173,9 @@ void EnKujiya_ChooseNextDialogue(EnKujiya* this, PlayState* play) {
EnKujiya_SetupGivePrize(this);
EnKujiya_GivePrize(this, play);
break;
default:
break;
}
}
}
@ -207,6 +210,9 @@ void EnKujiya_Talk(EnKujiya* this, PlayState* play) {
this->textId = 0x2B60; // Will announce winning numbers after 6
}
break;
default:
break;
}
}
@ -251,6 +257,9 @@ s32 EnKujiya_CheckBoughtTicket(void) {
return true;
}
break;
default:
break;
}
return false;
}
@ -268,6 +277,9 @@ void EnKujiya_SetBoughtTicket(void) {
case 3:
SET_WEEKEVENTREG(WEEKEVENTREG_33_40);
break;
default:
break;
}
}
@ -287,6 +299,9 @@ void EnKujiya_UnsetBoughtTicket(void) {
case 3:
CLEAR_WEEKEVENTREG(WEEKEVENTREG_33_40);
break;
default:
break;
}
}

View File

@ -571,6 +571,9 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) {
EnKusa_SetupUprootedWaitRegrow(this);
this->actor.shape.shadowDraw = NULL;
break;
default:
break;
}
} else {
@ -621,9 +624,13 @@ void EnKusa_SetupCut(EnKusa* this) {
case ENKUSA_TYPE_GRASS_2:
this->actionFunc = EnKusa_DoNothing;
break;
case ENKUSA_TYPE_REGROWING_GRASS:
this->actionFunc = EnKusa_CutWaitRegrow;
break;
default:
break;
}
this->timer = 0;
}

View File

@ -248,7 +248,8 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) {
this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER;
}
} else {
if (++sNumLitTorchesInGroup >= groupSize) {
sNumLitTorchesInGroup++;
if (sNumLitTorchesInGroup >= groupSize) {
this->pendingAction = OBJ_SYOKUDAI_PENDING_ACTION_CUTSCENE_AND_SWITCH;
} else {
this->snuffTimer =

View File

@ -13493,7 +13493,7 @@
0x80B33E54:("EnKbt_Destroy",),
0x80B33E64:("func_80B33E64",),
0x80B33E8C:("func_80B33E8C",),
0x80B33EF0:("func_80B33EF0",),
0x80B33EF0:("EnKbt_ChangeAnim",),
0x80B3403C:("func_80B3403C",),
0x80B34078:("func_80B34078",),
0x80B3415C:("func_80B3415C",),
@ -13678,7 +13678,7 @@
0x80B40800:("EnKgy_Init",),
0x80B40B04:("EnKgy_Destroy",),
0x80B40B38:("func_80B40B38",),
0x80B40BC0:("func_80B40BC0",),
0x80B40BC0:("EnKgy_ChangeAnimLoopMorph",),
0x80B40BFC:("func_80B40BFC",),
0x80B40C38:("func_80B40C38",),
0x80B40C74:("func_80B40C74",),