Animation Cleanup: En_I* (#1400)

* cleanup I

* oops
This commit is contained in:
engineer124 2023-09-29 23:14:05 +10:00 committed by GitHub
parent 64b1fafd33
commit 9b1335aa7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 242 additions and 171 deletions

View File

@ -2491,10 +2491,10 @@ void func_808819D8(EnHorse* this, PlayState* play) {
}
if (GET_WEEKEVENTREG_HORSE_RACE_STATE == WEEKEVENTREG_HORSE_RACE_STATE_3) {
this->rider->unk488 = 7;
this->rider->animIndex2 = ENIN_ANIM2_7;
} else {
EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1,
&this->rider->unk488);
&this->rider->animIndex2);
}
}
@ -3447,10 +3447,10 @@ void func_80884E0C(EnHorse* this, PlayState* play) {
this->unk_56C = Math3D_Distance(&this->actor.world.pos, &this->actor.prevPos);
if (((this->unk_550 == 5) || (this->unk_550 == 7)) && (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER)) {
this->rider->unk488 = 7;
this->rider->animIndex2 = ENIN_ANIM2_7;
} else {
EnHorse_SetIngoAnimation(this->animIndex, this->skin.skelAnime.curFrame, this->unk_394 & 1,
&this->rider->unk488);
&this->rider->animIndex2);
}
pos = this->actor.world.pos;

View File

@ -6,7 +6,6 @@
#include "z_en_ig.h"
#include "overlays/actors/ovl_En_Door/z_en_door.h"
#include "objects/object_dai/object_dai.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@ -143,17 +142,32 @@ static ColliderSphereInit sSphereInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
static AnimationInfoS sAnimationInfo[] = {
{ &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_dai_Anim_0010F8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &object_dai_Anim_001E44, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_dai_Anim_0014BC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &object_dai_Anim_003CAC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
{ &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
typedef enum EnIgAnimation {
/* -1 */ ENIG_ANIM_NONE = -1,
/* 0 */ ENIG_ANIM_0,
/* 1 */ ENIG_ANIM_1,
/* 2 */ ENIG_ANIM_2,
/* 3 */ ENIG_ANIM_3,
/* 4 */ ENIG_ANIM_4,
/* 5 */ ENIG_ANIM_5,
/* 6 */ ENIG_ANIM_6,
/* 7 */ ENIG_ANIM_7,
/* 8 */ ENIG_ANIM_8,
/* 9 */ ENIG_ANIM_9,
/* 10 */ ENIG_ANIM_MAX
} EnIgAnimation;
static AnimationInfoS sAnimationInfo[ENIG_ANIM_MAX] = {
{ &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_0
{ &object_dai_Anim_0048B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_1
{ &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_2
{ &object_dai_Anim_005100, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_3
{ &object_dai_Anim_0010F8, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIG_ANIM_4
{ &object_dai_Anim_001E44, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_5
{ &object_dai_Anim_0014BC, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIG_ANIM_6
{ &object_dai_Anim_003CAC, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENIG_ANIM_7
{ &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIG_ANIM_8
{ &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_9
};
Actor* func_80BF1150(EnIg* this, PlayState* play, u8 actorCat, s16 actorId) {
@ -204,44 +218,44 @@ EnDoor* func_80BF1200(PlayState* play, s32 arg1) {
return SubS_FindDoor(play, phi_a1);
}
void func_80BF1258(EnIg* this) {
this->skelAnime.playSpeed = this->unk_3D4;
void EnIg_UpdateSkelAnime(EnIg* this) {
this->skelAnime.playSpeed = this->animPlaySpeed;
SkelAnime_Update(&this->skelAnime);
}
s32 func_80BF1284(EnIg* this, s32 arg1) {
s32 phi_v1 = false;
s32 ret = false;
s32 EnIg_ChangeAnim(EnIg* this, s32 animIndex) {
s32 changeAnim = false;
s32 didAnimChange = false;
switch (arg1) {
case 0:
case 1:
if ((this->unk_3FC != 0) && (this->unk_3FC != 1)) {
phi_v1 = true;
switch (animIndex) {
case ENIG_ANIM_0:
case ENIG_ANIM_1:
if ((this->animIndex != ENIG_ANIM_0) && (this->animIndex != ENIG_ANIM_1)) {
changeAnim = true;
}
break;
case 2:
case 3:
if ((this->unk_3FC != 2) && (this->unk_3FC != 3)) {
phi_v1 = true;
case ENIG_ANIM_2:
case ENIG_ANIM_3:
if ((this->animIndex != ENIG_ANIM_2) && (this->animIndex != ENIG_ANIM_3)) {
changeAnim = true;
}
break;
default:
if (arg1 != this->unk_3FC) {
phi_v1 = true;
if (this->animIndex != animIndex) {
changeAnim = true;
}
break;
}
if (phi_v1) {
this->unk_3FC = arg1;
ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg1);
this->unk_3D4 = this->skelAnime.playSpeed;
if (changeAnim) {
this->animIndex = animIndex;
didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
this->animPlaySpeed = this->skelAnime.playSpeed;
}
return ret;
return didAnimChange;
}
void func_80BF1354(EnIg* this, PlayState* play) {
@ -358,16 +372,18 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) {
switch (this->unk_3F6) {
case 0:
if (func_80BF16C8(this, csId)) {
case 2:
case 4:
if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) {
Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)),
this->actor.child);
}
this->unk_3F6++;
ret = true;
if (!func_80BF16C8(this, csId)) {
break;
}
// fallthrough
case 2:
case 4:
if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) {
Camera_SetTargetActor(Play_GetCamera(play, CutsceneManager_GetCurrentSubCamId(csId)),
this->actor.child);
}
this->unk_3F6++;
ret = true;
break;
case 1:
@ -387,6 +403,9 @@ s32 func_80BF17BC(EnIg* this, PlayState* play) {
this->unk_3F6++;
ret = true;
break;
default:
break;
}
return ret;
}
@ -438,10 +457,10 @@ s32 func_80BF19A0(EnIg* this, PlayState* play) {
void func_80BF1A60(EnIg* this, PlayState* play) {
if (this->unk_3F4 == 0) {
func_80BF1284(this, 4);
EnIg_ChangeAnim(this, ENIG_ANIM_4);
this->unk_3F4++;
} else if ((this->unk_3F4 == 1) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_80BF1284(this, 5);
EnIg_ChangeAnim(this, ENIG_ANIM_5);
this->unk_3F4++;
}
}
@ -449,7 +468,7 @@ void func_80BF1A60(EnIg* this, PlayState* play) {
s32 func_80BF1AE0(EnIg* this, PlayState* play) {
switch (this->scheduleResult) {
case 3:
func_80BF1284(this, 0);
EnIg_ChangeAnim(this, ENIG_ANIM_0);
break;
case 10:
@ -457,7 +476,10 @@ s32 func_80BF1AE0(EnIg* this, PlayState* play) {
case 12:
case 13:
case 14:
func_80BF1284(this, 2);
EnIg_ChangeAnim(this, ENIG_ANIM_2);
break;
default:
break;
}
return true;
@ -471,8 +493,8 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) {
if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400 | PLAYER_STATE1_800)) {
this->unk_3D0 |= 0x400;
if (this->unk_3D2 != temp) {
if ((this->unk_3FC == 2) || (this->unk_3FC == 3)) {
func_80BF1284(this, 0);
if ((this->animIndex == ENIG_ANIM_2) || (this->animIndex == ENIG_ANIM_3)) {
EnIg_ChangeAnim(this, ENIG_ANIM_0);
}
if ((temp == 0x28B0) || (temp == 0x28B7)) {
@ -484,7 +506,10 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) {
} else if (this->unk_3D0 & 0x400) {
this->unk_3D2 = 0;
this->unk_3D0 &= ~0x400;
//! FAKE:
if (1) {}
func_80BF1AE0(this, play);
}
@ -529,7 +554,7 @@ s32 func_80BF1D78(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 sp2C = 0;
if (func_80BF1C44(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_AN)) {
func_80BF1284(this, 0);
EnIg_ChangeAnim(this, ENIG_ANIM_0);
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3D0 |= 0x20;
this->unk_3D0 |= 0x100;
@ -575,7 +600,7 @@ s32 func_80BF1DF4(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->unk_3E2 = sp56 - scheduleOutput->time0;
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->unk_3D0 |= 0x100;
func_80BF1284(this, 3);
EnIg_ChangeAnim(this, ENIG_ANIM_3);
this->actor.gravity = 0.0f;
ret = true;
}
@ -626,7 +651,7 @@ s32 func_80BF1FA8(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->unk_3D0 &= ~0x10;
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3D0 |= 0x100;
func_80BF1284(this, 2);
EnIg_ChangeAnim(this, ENIG_ANIM_2);
this->actor.gravity = -1.0f;
ret = true;
}
@ -662,7 +687,7 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->actor.home.rot.y += 0x8000;
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3D0 |= 0x100;
func_80BF1284(this, 1);
EnIg_ChangeAnim(this, ENIG_ANIM_1);
break;
case 4:
@ -670,7 +695,10 @@ s32 func_80BF219C(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->actor.shape.rot.y = this->actor.world.rot.y;
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3D0 |= 0x100;
func_80BF1284(this, 8);
EnIg_ChangeAnim(this, ENIG_ANIM_8);
break;
default:
break;
}
ret = true;
@ -710,6 +738,9 @@ s32 func_80BF2368(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput) {
case 3:
ret = func_80BF1D78(this, play, scheduleOutput);
break;
default:
break;
}
return ret;
}
@ -765,6 +796,7 @@ s32 func_80BF25E8(EnIg* this, PlayState* play) {
s32 pad;
SubS_TimePathing_FillKnots(knots, SUBS_TIME_PATHING_ORDER, this->timePath->count + SUBS_TIME_PATHING_ORDER);
if (!(this->unk_3D0 & 8)) {
timePathTargetPos = gZeroVec3f;
SubS_TimePathing_Update(this->timePath, &this->timePathProgress, &this->timePathElapsedTime,
@ -830,11 +862,11 @@ s32 func_80BF293C(EnIg* this, PlayState* play) {
Math_ApproachS(&this->actor.world.rot.y, this->actor.home.rot.y, 3, 0x2AA8);
} else {
this->actor.world.rot.y = this->actor.home.rot.y;
func_80BF1284(this, 7);
EnIg_ChangeAnim(this, ENIG_ANIM_7);
}
} else if ((this->unk_3FC == 7) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
} else if ((this->animIndex == ENIG_ANIM_7) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
SubS_SetOfferMode(&this->unk_3D0, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
func_80BF1284(this, 9);
EnIg_ChangeAnim(this, ENIG_ANIM_9);
}
return true;
}
@ -868,6 +900,9 @@ void func_80BF2A50(EnIg* this, PlayState* play) {
case 4:
func_80BF2890(this, play);
break;
default:
break;
}
Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8);
}
@ -916,9 +951,10 @@ void EnIg_Init(Actor* thisx, PlayState* play) {
EnIg* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 28.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable, 19);
this->unk_3FC = -1;
func_80BF1284(this, 0);
SkelAnime_InitFlex(play, &this->skelAnime, &object_dai_Skel_0130D0, NULL, this->jointTable, this->morphTable,
OBJECT_DAI_LIMB_MAX);
this->animIndex = ENIG_ANIM_NONE;
EnIg_ChangeAnim(this, ENIG_ANIM_0);
Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit);
Collider_InitAndSetSphere(play, &this->collider2, &this->actor, &sSphereInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
@ -946,7 +982,7 @@ void EnIg_Update(Actor* thisx, PlayState* play) {
func_80BF1B40(this, play);
if (this->scheduleResult != 0) {
func_80BF1258(this);
EnIg_UpdateSkelAnime(this);
func_80BF13E4(this);
func_80BF15EC(this);
SubS_Offer(&this->actor, play, 60.0f, 30.0f, PLAYER_IA_NONE, this->unk_3D0 & SUBS_OFFER_MODE_MASK);
@ -960,7 +996,7 @@ s32 EnIg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
Gfx** gfx) {
EnIg* this = THIS;
if (limbIndex == 10) {
if (limbIndex == OBJECT_DAI_LIMB_0A) {
*dList = NULL;
}
return false;
@ -973,7 +1009,7 @@ void EnIg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
EnIg* this = THIS;
Vec3f sp2C;
if (limbIndex == 11) {
if (limbIndex == OBJECT_DAI_LIMB_0B) {
Matrix_MultVec3f(&D_80BF3528, &this->actor.focus.pos);
Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot);
@ -981,17 +1017,17 @@ void EnIg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
gSPDisplayList((*gfx)++, object_dai_DL_0087B8);
}
if (limbIndex == 12) {
if (limbIndex == OBJECT_DAI_LIMB_0C) {
gSPDisplayList((*gfx)++, object_dai_DL_0089D8);
}
if (limbIndex == 9) {
if (limbIndex == OBJECT_DAI_LIMB_09) {
gSPDisplayList((*gfx)++, object_dai_DL_008B00);
Matrix_MultVec3f(&D_80BF351C, &sp2C);
Math_Vec3f_ToVec3s(&this->collider2.dim.worldSphere.center, &sp2C);
}
if (limbIndex == 10) {
if (limbIndex == OBJECT_DAI_LIMB_0A) {
Matrix_Get(&this->unk_190);
}
}
@ -1013,7 +1049,7 @@ void EnIg_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx, Gfx**
stepRot = false;
}
if (limbIndex == 9) {
if (limbIndex == OBJECT_DAI_LIMB_09) {
SubS_UpdateLimb(this->unk_3E8 + 0x4000, this->unk_3EA + this->actor.shape.rot.y + 0x4000, &this->unk_2D4,
&this->unk_2E6, stepRot, overrideRot);
Matrix_Pop();

View File

@ -2,6 +2,7 @@
#define Z_EN_IG_H
#include "global.h"
#include "objects/object_dai/object_dai.h"
struct EnIg;
@ -38,11 +39,11 @@ typedef struct EnIg {
/* 0x2D4 */ Vec3f unk_2D4;
/* 0x2E0 */ UNK_TYPE1 unk2E0[0x6];
/* 0x2E6 */ Vec3s unk_2E6;
/* 0x2EC */ Vec3s jointTable[19];
/* 0x35E */ Vec3s morphTable[19];
/* 0x2EC */ Vec3s jointTable[OBJECT_DAI_LIMB_MAX];
/* 0x35E */ Vec3s morphTable[OBJECT_DAI_LIMB_MAX];
/* 0x3D0 */ u16 unk_3D0;
/* 0x3D2 */ u16 unk_3D2;
/* 0x3D4 */ f32 unk_3D4;
/* 0x3D4 */ f32 animPlaySpeed;
/* 0x3D8 */ UNK_TYPE1 unk3D8[0x8];
/* 0x3E0 */ s16 unk_3E0;
/* 0x3E2 */ s16 unk_3E2;
@ -57,7 +58,7 @@ typedef struct EnIg {
/* 0x3F4 */ s16 unk_3F4;
/* 0x3F6 */ s16 unk_3F6;
/* 0x3F8 */ EnIgUnkFunc unk_3F8;
/* 0x3FC */ s32 unk_3FC;
/* 0x3FC */ s32 animIndex;
/* 0x400 */ UNK_TYPE1 unk400[0x8];
/* 0x408 */ s32 unk_408;
} EnIg; // size = 0x40C

View File

@ -365,15 +365,15 @@ void EnIk_CheckActions(EnIk* this, PlayState* play) {
}
void EnIk_SetupIdle(EnIk* this) {
f32 frameCount = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim);
f32 endFrame = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim);
if (this->drawArmorFlags != 0) {
this->timer = 10;
} else {
this->timer = 0;
}
Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, 1.0f, frameCount, frameCount,
ANIMMODE_ONCE, this->timer);
Animation_Change(&this->skelAnime, &gIronKnuckleEndHorizontalAttackAnim, 1.0f, endFrame, endFrame, ANIMMODE_ONCE,
this->timer);
this->actionFunc = EnIk_Idle;
this->actor.speed = 0.0f;
}
@ -461,7 +461,7 @@ void EnIk_SetupVerticalAttack(EnIk* this) {
playbackSpeed = 1.2f;
}
Animation_Change(&this->skelAnime, &gIronKnuckleVerticalAttackAnim, playbackSpeed, 0.0f,
Animation_GetLastFrame(&gIronKnuckleVerticalAttackAnim.common), 3, -4.0f);
Animation_GetLastFrame(&gIronKnuckleVerticalAttackAnim.common), ANIMMODE_ONCE_INTERP, -4.0f);
this->timer = 0;
this->blurEffectSpawnLock = -1;
this->actionFunc = EnIk_VerticalAttack;

View File

@ -118,25 +118,25 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0x0),
};
static AnimationInfoS sAnimationInfo[] = {
{ &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_000CB0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_0003B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_001BE0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_015918, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in_Anim_01B3C4, 0.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in_Anim_019EB4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
static AnimationInfoS sAnimationInfo[ENIN_ANIM_MAX] = {
{ &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_0
{ &object_in_Anim_001D10, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_1
{ &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_2
{ &object_in_Anim_014F8C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_3
{ &object_in_Anim_000CB0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_4
{ &object_in_Anim_0003B4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_5
{ &object_in_Anim_001BE0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_6
{ &object_in_Anim_015918, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_7
{ &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_8
{ &object_in_Anim_01C0B0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_9
{ &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_10
{ &object_in_Anim_01A140, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_11
{ &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_12
{ &object_in_Anim_01B904, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_13
{ &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENIN_ANIM_14
{ &object_in_Anim_01B3C4, 0.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENIN_ANIM_15
{ &object_in_Anim_01B3C4, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIN_ANIM_16
{ &object_in_Anim_019EB4, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENIN_ANIM_17
};
static TrackOptionsSet sTrackOptions = {
@ -147,20 +147,20 @@ static TrackOptionsSet sTrackOptions = {
};
s32 EnIn_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) {
s16 frameCount;
s32 ret = false;
s16 endFrame;
s32 didAnimChange = false;
if ((animIndex >= 0) && (animIndex < 18)) {
ret = true;
frameCount = sAnimationInfo[animIndex].frameCount;
if (frameCount < 0) {
frameCount = Animation_GetLastFrame(sAnimationInfo[animIndex].animation);
if ((animIndex > ENIN_ANIM_NONE) && (animIndex < ENIN_ANIM_MAX)) {
didAnimChange = true;
endFrame = sAnimationInfo[animIndex].frameCount;
if (endFrame < 0) {
endFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation);
}
Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed,
sAnimationInfo[animIndex].startFrame, frameCount, sAnimationInfo[animIndex].mode,
sAnimationInfo[animIndex].startFrame, endFrame, sAnimationInfo[animIndex].mode,
sAnimationInfo[animIndex].morphFrames);
}
return ret;
return didAnimChange;
}
s32 func_808F3178(EnIn* this, PlayState* play) {
@ -298,12 +298,19 @@ void func_808F3690(EnIn* this, PlayState* play) {
}
void func_808F374C(EnIn* this, PlayState* play) {
AnimationHeader* sAnimations[] = {
&object_in_Anim_015E38, &object_in_Anim_016A60, &object_in_Anim_0177AC, &object_in_Anim_016484,
&object_in_Anim_0170DC, &object_in_Anim_018240, &object_in_Anim_0187C8, &object_in_Anim_0198A8,
AnimationHeader* sAnimations[ENIN_ANIM2_MAX] = {
&object_in_Anim_015E38, // ENIN_ANIM2_0
&object_in_Anim_016A60, // ENIN_ANIM2_1
&object_in_Anim_0177AC, // ENIN_ANIM2_2
&object_in_Anim_016484, // ENIN_ANIM2_3
&object_in_Anim_0170DC, // ENIN_ANIM2_4
&object_in_Anim_018240, // ENIN_ANIM2_5
&object_in_Anim_0187C8, // ENIN_ANIM2_6
&object_in_Anim_0198A8, // ENIN_ANIM2_7
};
if (this->skelAnime.animation == &object_in_Anim_016484 || this->skelAnime.animation == &object_in_Anim_0170DC) {
if ((this->skelAnime.animation == &object_in_Anim_016484) ||
(this->skelAnime.animation == &object_in_Anim_0170DC)) {
if (Animation_OnFrame(&this->skelAnime, 8.0f)) {
Audio_PlaySfx_Randomized(&this->actor.projectedPos, NA_SE_VO_IN_LASH_0, 2);
if (Rand_ZeroOne() < 0.3f) {
@ -312,14 +319,16 @@ void func_808F374C(EnIn* this, PlayState* play) {
Audio_PlaySfx_AtPos(&this->actor.projectedPos, NA_SE_IT_LASH);
}
}
if (this->skelAnime.animation == &object_in_Anim_0198A8 && Animation_OnFrame(&this->skelAnime, 20.0f)) {
if ((this->skelAnime.animation == &object_in_Anim_0198A8) && Animation_OnFrame(&this->skelAnime, 20.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_VO_IN_CRY_0);
}
if (SkelAnime_Update(&this->skelAnime)) {
this->unk488 %= ARRAY_COUNT(sAnimations);
this->unk486 = this->unk488;
Animation_Change(&this->skelAnime, sAnimations[this->unk488], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimations[this->unk488]), ANIMMODE_ONCE, -10.0f);
this->animIndex2 %= ENIN_ANIM2_MAX;
this->unk486 = this->animIndex2;
Animation_Change(&this->skelAnime, sAnimations[this->animIndex2], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimations[this->animIndex2]), ANIMMODE_ONCE, -10.0f);
}
}
@ -407,7 +416,7 @@ void func_808F3B40(EnIn* this, PlayState* play) {
this->actor.parent = NULL;
this->actor.flags |= ACTOR_FLAG_10000;
this->actionFunc = func_808F3AD4;
textId = gSaveContext.save.day != 3 ? 0x3481 : 0x34A4;
textId = (gSaveContext.save.day != 3) ? 0x3481 : 0x34A4;
this->actor.textId = textId;
} else {
Actor_OfferGetItem(&this->actor, play, GI_MILK, 500.0f, 100.0f);
@ -958,6 +967,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) {
ret = false;
}
break;
case 0x347E:
func_808F35D8(this, play);
if (Inventory_HasEmptyBottle()) {
@ -1430,7 +1440,7 @@ void func_808F5A94(EnIn* this, PlayState* play) {
void func_808F5B58(EnIn* this, PlayState* play) {
if (Horse_IsActive(play, &play->actorCtx)) {
if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
if (((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) {
if (gSaveContext.save.day == 3) {
func_808F5728(play, this, 6, &this->unk48C);
@ -1438,8 +1448,8 @@ void func_808F5B58(EnIn* this, PlayState* play) {
func_808F5728(play, this, 2, &this->unk48C);
}
}
} else if (Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER ||
(Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40))) {
} else if ((Player_GetMask(play) != PLAYER_MASK_CIRCUS_LEADER) ||
((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40))) {
if (gSaveContext.save.day == 3) {
func_808F5728(play, this, 4, &this->unk48C);
} else {
@ -1452,7 +1462,7 @@ void func_808F5C98(EnIn* this, PlayState* play) {
if (this->unk4B0 == WEEKEVENTREG_HORSE_RACE_STATE_END) {
this->actionFunc = func_808F5B58;
}
if ((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
if (((Player_GetMask(play) == PLAYER_MASK_CIRCUS_LEADER) && CHECK_WEEKEVENTREG(WEEKEVENTREG_63_40)) ||
CHECK_WEEKEVENTREG(WEEKEVENTREG_56_08)) {
if (gSaveContext.save.day != 3) {
func_808F5728(play, this, 2, &this->unk48C);
@ -1484,7 +1494,8 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &object_in_Skel_014EA8, NULL, this->jointTable, this->morphTable, 20);
SkelAnime_InitFlex(play, &this->skelAnime, &object_in_Skel_014EA8, NULL, this->jointTable, this->morphTable,
OBJECT_IN_LIMB_MAX);
EnIn_ChangeAnim(&this->skelAnime, ENIN_ANIM_0);
Collider_InitCylinder(play, &this->colliderCylinder);
Collider_SetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit);
@ -1499,7 +1510,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
}
if ((type == ENIN_HORSE_RIDER_YELLOW_SHIRT) || (type == ENIN_HORSE_RIDER_BLUE_SHIRT)) {
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
this->unk488 = 1;
this->animIndex2 = ENIN_ANIM2_1;
Animation_Change(&this->skelAnime, &object_in_Anim_016A60, 1.0f, 0.0f,
Animation_GetLastFrame(&object_in_Anim_016A60), ANIMMODE_ONCE, 0.0f);
Actor_SetScale(&this->actor, 0.01f);
@ -1623,41 +1634,41 @@ void func_808F6334(EnIn* this, PlayState* play) {
s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnIn* this = THIS;
s32 pad;
Gfx* sp50[] = {
NULL,
NULL,
object_in_DL_0149A8,
object_in_DL_014AE0,
object_in_DL_014C30,
object_in_DL_0145D8,
object_in_DL_014710,
object_in_DL_014860,
object_in_DL_014420,
object_in_DL_012A78,
object_in_DL_013DE0,
object_in_DL_013F10,
object_in_DL_014040,
object_in_DL_0137A0,
object_in_DL_0138D0,
object_in_DL_013A00,
object_in_DL_012DF8,
object_in_DL_013670,
object_in_DL_013540,
object_in_DL_013440,
Gfx* sp50[OBJECT_IN_LIMB_MAX] = {
NULL, // OBJECT_IN_LIMB_NONE
NULL, // OBJECT_IN_LIMB_01
object_in_DL_0149A8, // OBJECT_IN_LIMB_02
object_in_DL_014AE0, // OBJECT_IN_LIMB_03
object_in_DL_014C30, // OBJECT_IN_LIMB_04
object_in_DL_0145D8, // OBJECT_IN_LIMB_05
object_in_DL_014710, // OBJECT_IN_LIMB_06
object_in_DL_014860, // OBJECT_IN_LIMB_07
object_in_DL_014420, // OBJECT_IN_LIMB_08
object_in_DL_012A78, // OBJECT_IN_LIMB_09
object_in_DL_013DE0, // OBJECT_IN_LIMB_0A
object_in_DL_013F10, // OBJECT_IN_LIMB_0B
object_in_DL_014040, // OBJECT_IN_LIMB_0C
object_in_DL_0137A0, // OBJECT_IN_LIMB_0D
object_in_DL_0138D0, // OBJECT_IN_LIMB_0E
object_in_DL_013A00, // OBJECT_IN_LIMB_0F
object_in_DL_012DF8, // OBJECT_IN_LIMB_10
object_in_DL_013670, // OBJECT_IN_LIMB_11
object_in_DL_013540, // OBJECT_IN_LIMB_12
object_in_DL_013440, // OBJECT_IN_LIMB_13
};
if ((this->unk23C != 0) && (limbIndex != 16)) {
if ((this->unk23C != 0) && (limbIndex != OBJECT_IN_LIMB_10)) {
if (sp50[limbIndex] != NULL) {
*dList = sp50[limbIndex];
}
}
if ((this->unk4AC & 4) && (limbIndex == 16)) {
if ((this->unk4AC & 4) && (limbIndex == OBJECT_IN_LIMB_10)) {
*dList = object_in_DL_01C528;
}
OPEN_DISPS(play->state.gfxCtx);
if (limbIndex == 16) {
if (limbIndex == OBJECT_IN_LIMB_10) {
TexturePtr sp38[] = { object_in_Tex_0035E0, object_in_Tex_004820, object_in_Tex_004C20, object_in_Tex_0043E0 };
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sp38[this->unk482]));
@ -1668,31 +1679,34 @@ s32 EnIn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
CLOSE_DISPS(play->state.gfxCtx);
if (limbIndex == 16) {
if (limbIndex == OBJECT_IN_LIMB_10) {
Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY);
Matrix_RotateZS(-this->headRot.x, MTXMODE_APPLY);
Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
func_808F6334(this, play);
}
if (limbIndex == 9) {
if (limbIndex == OBJECT_IN_LIMB_09) {
Matrix_RotateYS(this->torsoRot.y, MTXMODE_APPLY);
Matrix_RotateXS(this->torsoRot.x, MTXMODE_APPLY);
}
if ((limbIndex == 9) || (limbIndex == 10) || (limbIndex == 13)) {
if ((limbIndex == OBJECT_IN_LIMB_09) || (limbIndex == OBJECT_IN_LIMB_0A) || (limbIndex == OBJECT_IN_LIMB_0D)) {
rot->y += (s16)(Math_SinS(this->fidgetTableY[limbIndex]) * 200.0f);
rot->z += (s16)(Math_CosS(this->fidgetTableZ[limbIndex]) * 200.0f);
}
if (this->unk4AC & 0x40) {
if (limbIndex == 18) {
if (limbIndex == OBJECT_IN_LIMB_12) {
rot->x = 0x1F40;
rot->y = -0x3E8;
rot->z = 0x1D4C;
} else if (limbIndex == 17) {
} else if (limbIndex == OBJECT_IN_LIMB_11) {
rot->x = -0x1F40;
rot->y = 0x3E8;
rot->z = 0x1D4C;
} else if (limbIndex == 19) {
} else if (limbIndex == OBJECT_IN_LIMB_13) {
rot->x = 0;
rot->y = 0x7FFF;
rot->z = -0x2328;
@ -1706,26 +1720,26 @@ void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Vec3f sp50 = { 1600.0f, 0.0f, 0.0f };
Vec3f sp44 = { 0.0f, 0.0f, 0.0f };
if (limbIndex == 16) {
if (limbIndex == OBJECT_IN_LIMB_10) {
Matrix_MultVec3f(&sp50, &this->unk4B4);
Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk4B4);
}
if (this->unk23D == 0) {
Collider_UpdateSpheres(limbIndex, &this->colliderJntSph);
if (limbIndex == 4) {
if (limbIndex == OBJECT_IN_LIMB_04) {
Matrix_MultVec3f(&sp44, &this->unk248);
}
if (limbIndex == 7) {
if (limbIndex == OBJECT_IN_LIMB_07) {
Matrix_MultVec3f(&sp44, &this->unk254);
}
if (this->unk23C == 0) {
if (!(this->unk4AC & 8)) {
OPEN_DISPS(play->state.gfxCtx);
if (limbIndex == 12) {
if (limbIndex == OBJECT_IN_LIMB_0C) {
gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007A70);
}
if (limbIndex == 15) {
if (limbIndex == OBJECT_IN_LIMB_0F) {
gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48);
}
@ -1736,7 +1750,7 @@ void EnIn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
if (this->unk4AC & 0x20) {
OPEN_DISPS(play->state.gfxCtx);
if (limbIndex == 12) {
if (limbIndex == OBJECT_IN_LIMB_0C) {
gSPDisplayList(POLY_OPA_DISP++, object_in_DL_007C48);
}

View File

@ -16,7 +16,13 @@ typedef enum {
/* 4 */ ENIN_BLUE_SHIRT
} EnInType;
typedef enum {
#define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF)
#define ENIN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE
#define ENIN_PATH_INDEX_NONE 0x3F
typedef enum EnInAnimation {
/* -1 */ ENIN_ANIM_NONE = -1,
/* 0 */ ENIN_ANIM_0,
/* 1 */ ENIN_ANIM_1,
/* 2 */ ENIN_ANIM_2,
@ -34,13 +40,22 @@ typedef enum {
/* 14 */ ENIN_ANIM_14,
/* 15 */ ENIN_ANIM_15,
/* 16 */ ENIN_ANIM_16,
/* 17 */ ENIN_ANIM_17
/* 17 */ ENIN_ANIM_17,
/* 18 */ ENIN_ANIM_MAX
} EnInAnimation;
#define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF)
#define ENIN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE
#define ENIN_PATH_INDEX_NONE 0x3F
typedef enum EnInAnimation2 {
/* -1 */ ENIN_ANIM2_NONE = -1,
/* 0 */ ENIN_ANIM2_0,
/* 1 */ ENIN_ANIM2_1,
/* 2 */ ENIN_ANIM2_2,
/* 3 */ ENIN_ANIM2_3,
/* 4 */ ENIN_ANIM2_4,
/* 5 */ ENIN_ANIM2_5,
/* 6 */ ENIN_ANIM2_6,
/* 7 */ ENIN_ANIM2_7,
/* 8 */ ENIN_ANIM2_MAX
} EnInAnimation2;
typedef struct EnIn {
/* 0x000 */ Actor actor;
@ -70,7 +85,7 @@ typedef struct EnIn {
/* 0x482 */ s16 unk482;
/* 0x484 */ s16 unk484;
/* 0x486 */ s16 unk486;
/* 0x488 */ s16 unk488;
/* 0x488 */ s16 animIndex2;
/* 0x48A */ u16 unk48A;
/* 0x48C */ s32 unk48C;
/* 0x490 */ UNK_TYPE1 unk490[0x4];

View File

@ -5,7 +5,6 @@
*/
#include "z_en_insect.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS 0x00000000
@ -132,7 +131,7 @@ void EnInsect_Init(Actor* thisx, PlayState* play) {
func_8091A8A0(this);
SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, this->jointTable,
this->morphTable, 24);
this->morphTable, BUG_LIMB_MAX);
Animation_Change(&this->skelAnime, &gameplay_keep_Anim_05140C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f);
Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements);
@ -278,7 +277,9 @@ void func_8091B07C(EnInsect* this, PlayState* play) {
yaw -= 0x2000;
}
//! FAKE:
if (play) {}
Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 0x7D0);
}

View File

@ -2,6 +2,7 @@
#define Z_EN_INSECT_H
#include "global.h"
#include "objects/gameplay_keep/gameplay_keep.h"
struct EnInsect;
@ -16,8 +17,8 @@ typedef struct EnInsect {
/* 0x144 */ ColliderJntSph collider;
/* 0x164 */ ColliderJntSphElement colliderElements[1];
/* 0x1A4 */ SkelAnime skelAnime;
/* 0x1E8 */ Vec3s jointTable[24];
/* 0x278 */ Vec3s morphTable[24];
/* 0x1E8 */ Vec3s jointTable[BUG_LIMB_MAX];
/* 0x278 */ Vec3s morphTable[BUG_LIMB_MAX];
/* 0x308 */ EnInsectActionFunc actionFunc;
/* 0x30C */ u16 unk_30C;
/* 0x30E */ s16 unk_30E;

View File

@ -75,6 +75,9 @@ void func_80C2590C(EnInvisibleRuppe* this, PlayState* play) {
Audio_PlaySfx(NA_SE_SY_GET_RUPY);
Item_DropCollectible(play, &this->actor.world.pos, 0x8000 | ITEM00_RUPEE_RED);
break;
default:
break;
}
if (this->unk_190 >= 0) {

View File

@ -16283,8 +16283,8 @@
0x80BF0F10:("EffStk_Draw",),
0x80BF1150:("func_80BF1150",),
0x80BF1200:("func_80BF1200",),
0x80BF1258:("func_80BF1258",),
0x80BF1284:("func_80BF1284",),
0x80BF1258:("EnIg_UpdateSkelAnime",),
0x80BF1284:("EnIg_ChangeAnim",),
0x80BF1354:("func_80BF1354",),
0x80BF13E4:("func_80BF13E4",),
0x80BF146C:("func_80BF146C",),