Animation Cleanup: En_G* (#1395)

* wip

* more cleanup

* more cleanup

* one more thing

* one more default case

* missed brackets

* PR Review
This commit is contained in:
engineer124 2023-09-27 07:24:12 +10:00 committed by GitHub
parent 1d1e6ef03b
commit 775501b28b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 976 additions and 676 deletions

View File

@ -5,7 +5,6 @@
*/
#include "z_en_gb2.h"
#include "objects/object_ps/object_ps.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20)
@ -163,7 +162,7 @@ u16 func_80B0F7FC(EnGb2* this) {
return 0x14E4;
}
if (gSaveContext.save.saveInfo.playerData.health > 48) {
if (gSaveContext.save.saveInfo.playerData.health > 0x30) {
return 0x14D2;
}
@ -171,7 +170,7 @@ u16 func_80B0F7FC(EnGb2* this) {
return 0x14D3;
case 0x14E4:
if (gSaveContext.save.saveInfo.playerData.health > 48) {
if (gSaveContext.save.saveInfo.playerData.health > 0x30) {
return 0x14D2;
}
@ -193,8 +192,10 @@ u16 func_80B0F7FC(EnGb2* this) {
case 0x14D9:
return 0x14DA;
default:
return 0;
}
return 0;
}
u16 func_80B0F8F8(EnGb2* this) {
@ -213,8 +214,10 @@ u16 func_80B0F8F8(EnGb2* this) {
case 0x14E1:
return 0x14E2;
default:
return 0;
}
return 0;
}
u16 func_80B0F97C(EnGb2* this) {
@ -236,8 +239,10 @@ u16 func_80B0F97C(EnGb2* this) {
case 0x14FA:
this->unk_26C |= 2;
return 0x14FB;
default:
return 0;
}
return 0;
}
void func_80B0FA04(EnGb2* this) {
@ -262,17 +267,19 @@ s32 func_80B0FA48(EnGb2* this, PlayState* play) {
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_40)) {
this->unk_26E = 0x14EB;
return false;
} else {
this->unk_26E = 0x14EE;
return true;
}
this->unk_26E = 0x14EE;
return true;
}
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_20)) {
this->unk_26E = 0x14EF;
return false;
} else {
this->unk_26E = 0x14F4;
return true;
default:
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_80_20)) {
this->unk_26E = 0x14EF;
return false;
} else {
this->unk_26E = 0x14F4;
return true;
}
}
}
@ -314,12 +321,14 @@ u16 func_80B0FB24(EnGb2* this) {
case 0x14F2:
this->unk_26C |= 2;
return 0x14F3;
default:
return 0;
}
return 0;
}
void func_80B0FBF0(EnGb2* this, PlayState* play) {
Vec3f sp90[4] = {
Vec3f sp90[] = {
{ 120.0f, 0.0f, 800.0f },
{ -120.0f, 0.0f, 750.0f },
{ 60.0f, 0.0f, 750.0f },
@ -425,6 +434,9 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) {
this->unk_26C |= 2;
Message_StartTextbox(play, this->unk_26E, &this->actor);
break;
default:
break;
}
} else if (this->unk_26E == 0x14DA) {
switch (play->msgCtx.choiceIndex) {
@ -443,6 +455,9 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) {
this->unk_26C |= 2;
Message_StartTextbox(play, this->unk_26E, &this->actor);
break;
default:
break;
}
}
}
@ -505,7 +520,7 @@ void func_80B10344(EnGb2* this, PlayState* play) {
}
}
if (gSaveContext.save.saveInfo.playerData.health < 49) {
if (gSaveContext.save.saveInfo.playerData.health <= 0x30) {
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
SET_EVENTINF(EVENTINF_46);
SET_EVENTINF(EVENTINF_45);
@ -596,6 +611,9 @@ void func_80B10634(EnGb2* this, PlayState* play) {
this->unk_26C |= 2;
Message_StartTextbox(play, this->unk_26E, &this->actor);
break;
default:
break;
}
}
}
@ -673,6 +691,9 @@ void func_80B10A48(EnGb2* this, PlayState* play) {
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->actionFunc = func_80B111AC;
break;
default:
break;
}
}
}
@ -877,7 +898,7 @@ void EnGb2_Init(Actor* thisx, PlayState* play) {
this->actor.room = -1;
Actor_ProcessInitChain(&this->actor, sInitChain);
SkelAnime_InitFlex(play, &this->skelAnime, &object_ps_Skel_007230, &object_ps_Anim_00049C, this->jointTable,
this->morphTable, 12);
this->morphTable, OBJECT_PS_LIMB_MAX);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit);
@ -981,11 +1002,11 @@ s32 EnGb2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
Gfx** gfx) {
EnGb2* this = THIS;
if (limbIndex == 7) {
if (limbIndex == OBJECT_PS_LIMB_07) {
Matrix_RotateYS(this->unk_270.y, MTXMODE_APPLY);
}
if (limbIndex == 1) {
if (limbIndex == OBJECT_PS_LIMB_01) {
*dList = NULL;
}
@ -996,7 +1017,7 @@ void EnGb2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
EnGb2* this = THIS;
Vec3f sp18 = { 2400.0f, 0.0f, 0.0f };
if (limbIndex == 7) {
if (limbIndex == OBJECT_PS_LIMB_07) {
Matrix_MultVec3f(&sp18, &this->actor.focus.pos);
}
}

View File

@ -2,6 +2,7 @@
#define Z_EN_GB2_H
#include "global.h"
#include "objects/object_ps/object_ps.h"
struct EnGb2;
@ -19,8 +20,8 @@ typedef enum {
typedef struct EnGb2 {
/* 0x0000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[12];
/* 0x1D0 */ Vec3s morphTable[12];
/* 0x188 */ Vec3s jointTable[OBJECT_PS_LIMB_MAX];
/* 0x1D0 */ Vec3s morphTable[OBJECT_PS_LIMB_MAX];
/* 0x218 */ EnGb2ActionFunc actionFunc;
/* 0x21C */ ColliderCylinder collider;
/* 0x268 */ Actor* unk_268;

View File

@ -69,10 +69,11 @@ typedef enum {
/* 6 */ GERUDO_WHITE_ANIM_EXCITED_CLAPPING,
/* 7 */ GERUDO_WHITE_ANIM_SALUTE,
/* 8 */ GERUDO_WHITE_ANIM_LEADING_BOAT,
/* 9 */ GERUDO_WHITE_ANIM_BLOWN_AWAY
/* 9 */ GERUDO_WHITE_ANIM_BLOWN_AWAY,
/* 10 */ GERUDO_WHITE_ANIM_MAX
} GerudoWhiteAnimation;
void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames);
void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 animMode, f32 morphFrames);
void EnGe1_ShadowDraw(Actor* thisx, Lights* lights, PlayState* play);
void EnGe1_Wait(EnGe1* this, PlayState* play);
void EnGe1_PerformCutsceneActions(EnGe1* this, PlayState* play);
@ -127,8 +128,8 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames) {
static AnimationHeader* sAnimations[] = {
void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 animMode, f32 morphFrames) {
static AnimationHeader* sAnimations[GERUDO_WHITE_ANIM_MAX] = {
&gGerudoWhiteArmsFoldedAnim, // GERUDO_WHITE_ANIM_ARMS_FOLDED,
&gGerudoWhiteUnfoldingArmsAnim, // GERUDO_WHITE_ANIM_UNFOLDING_ARMS
&gGerudoWhiteStandingHeadBowedAnim, // GERUDO_WHITE_ANIM_STANDING_HEAD_BOWED,
@ -154,7 +155,7 @@ void EnGe1_ChangeAnim(EnGe1* this, s16 animIndex, u8 mode, f32 morphFrames) {
default:
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames);
Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames);
break;
}

View File

@ -119,7 +119,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) {
switch (GERUDO_PURPLE_GET_TYPE(&this->picto.actor)) {
case GERUDO_PURPLE_TYPE_BOAT_SENTRY:
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, 0.0f);
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, 0.0f);
this->actionFunc = EnGe2_GuardStationary;
this->picto.actor.speed = 0.0f;
this->picto.actor.uncullZoneForward = 4000.0f;
@ -343,18 +343,18 @@ s32 EnGe2_FollowPathWithoutGravity(EnGe2* this) {
/* Action and helper functions */
void EnGe2_SpawnEffects(EnGe2* this, PlayState* play) {
static Vec3f effectVelocity = { 0.0f, -0.05f, 0.0f };
static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f };
static Color_RGBA8 effectPrimColor = { 255, 255, 255, 0 };
static Color_RGBA8 effectEnvColor = { 255, 150, 0, 0 };
static Vec3f sEffectVelocity = { 0.0f, -0.05f, 0.0f };
static Vec3f sEffectAccel = { 0.0f, -0.025f, 0.0f };
static Color_RGBA8 sEffectPrimColor = { 255, 255, 255, 0 };
static Color_RGBA8 sEffectEnvColor = { 255, 150, 0, 0 };
s16 effectAngle = play->state.frames * 0x2800;
Vec3f effectPos;
effectPos.x = (Math_CosS(effectAngle) * 5.0f) + this->picto.actor.focus.pos.x;
effectPos.y = this->picto.actor.focus.pos.y + 10.0f;
effectPos.z = (Math_SinS(effectAngle) * 5.0f) + this->picto.actor.focus.pos.z;
EffectSsKirakira_SpawnDispersed(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, &effectEnvColor,
1000, 16);
EffectSsKirakira_SpawnDispersed(play, &effectPos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor,
&sEffectEnvColor, 1000, 16);
}
void EnGe2_Scream(EnGe2* this) {
@ -396,7 +396,7 @@ void EnGe2_SetupCapturePlayer(EnGe2* this) {
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_CapturePlayer;
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
}
void EnGe2_Charge(EnGe2* this, PlayState* play) {
@ -429,7 +429,7 @@ void EnGe2_SetupCharge(EnGe2* this, PlayState* play) {
if (this->picto.actor.shape.rot.y == this->picto.actor.yawTowardsPlayer) {
Animation_Change(&this->skelAnime, &gGerudoPurpleChargingAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleChargingAnim), 0, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleChargingAnim), ANIMMODE_LOOP, -8.0f);
this->timer = 50;
this->picto.actor.speed = 4.0f;
this->actionFunc = EnGe2_Charge;
@ -438,7 +438,7 @@ void EnGe2_SetupCharge(EnGe2* this, PlayState* play) {
void EnGe2_SetupLookAround(EnGe2* this) {
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
this->timer = 60;
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_LookAround;
@ -483,13 +483,13 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) {
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_SetupCharge;
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
this->stateFlags |= GERUDO_PURPLE_STATE_CAPTURING;
} else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_80_08)) {
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_TurnToPlayerFast;
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
} else if (EnGe2_LookForPlayer(play, &this->picto.actor, &this->picto.actor.focus.pos,
this->picto.actor.shape.rot.y, 0x1800, visionRange, this->verticalDetectRange)) {
if ((GERUDO_PURPLE_GET_EXIT(&this->picto.actor) != GERUDO_PURPLE_EXIT_NONE) && !Play_InCsMode(play)) {
@ -499,7 +499,7 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) {
Message_StartTextbox(play, 0x1194, &this->picto.actor);
this->actionFunc = EnGe2_SetupCharge;
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
}
} else if (this->collider.base.acFlags & AC_HIT) {
if ((this->collider.info.acHitInfo != NULL) &&
@ -510,7 +510,7 @@ void EnGe2_PatrolDuties(EnGe2* this, PlayState* play) {
this->stateFlags |= GERUDO_PURPLE_STATE_STUNNED;
} else {
Animation_Change(&this->skelAnime, &gGerudoPurpleFallingToGroundAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleFallingToGroundAnim), 2, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleFallingToGroundAnim), ANIMMODE_ONCE, -8.0f);
this->timer = 200;
this->picto.actor.speed = 0.0f;
this->actionFunc = EnGe2_KnockedOut;
@ -543,7 +543,7 @@ void EnGe2_LookAround(EnGe2* this, PlayState* play) {
} else {
this->actionFunc = EnGe2_Walk;
Animation_Change(&this->skelAnime, &gGerudoPurpleWalkingAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleWalkingAnim), 0, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleWalkingAnim), ANIMMODE_LOOP, -8.0f);
this->headRot.y = 0;
this->detectedStatus = GERUDO_PURPLE_DETECTION_UNDETECTED;
}
@ -602,13 +602,14 @@ void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) {
switch (cueId) {
case ENGE2_CUEID_BEEHIVE_PATROL:
Animation_Change(&this->skelAnime, &gGerudoPurpleLookingAboutAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), 0, -8.0f);
Animation_GetLastFrame(&gGerudoPurpleLookingAboutAnim), ANIMMODE_LOOP, -8.0f);
EnGe2_GetNextPath(this, play);
break;
case ENGE2_CUEID_BEEHIVE_RUN_AWAY:
Animation_Change(&this->skelAnime, &gGerudoPurpleRunningAwayCutsceneAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gGerudoPurpleRunningAwayCutsceneAnim), 0, -5.0f);
Animation_GetLastFrame(&gGerudoPurpleRunningAwayCutsceneAnim), ANIMMODE_LOOP,
-5.0f);
this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f);
break;
@ -617,11 +618,13 @@ void EnGe2_PerformCutsceneActions(EnGe2* this, PlayState* play) {
break;
case ENGE2_CUEID_GBT_ENTR_STAND_STILL:
Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 0.0f, 0.0f, 2, 0.0f);
Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 0.0f, 0.0f,
ANIMMODE_ONCE, 0.0f);
break;
case ENGE2_CUEID_GBT_ENTR_BLOWN_AWAY:
Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 1.0f, 1.0f, 2, 0.0f);
Animation_Change(&this->skelAnime, &gGerudoPurpleGreatBayCutsceneAnim, 0.0f, 1.0f, 1.0f,
ANIMMODE_ONCE, 0.0f);
EnGe2_SetupBlownAwayPath(this, play);
this->stateFlags |= GERUDO_PURPLE_STATE_DISABLE_MOVEMENT;
this->screamTimer = (s32)(Rand_ZeroFloat(10.0f) + 20.0f);

View File

@ -15,7 +15,7 @@ void EnGe3_Destroy(Actor* thisx, PlayState* play);
void EnGe3_Update(Actor* thisx, PlayState* play);
void EnGe3_Draw(Actor* thisx, PlayState* play);
void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 mode, f32 morphFrames);
void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 animMode, f32 morphFrames);
void EnGe3_SetupPath(EnGe3* this, PlayState* play);
void EnGe3_Idle(EnGe3* this, PlayState* play);
void EnGe3_AveilsChamberIdle(EnGe3* this, PlayState* play);
@ -111,7 +111,7 @@ void EnGe3_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 mode, f32 morphFrames) {
void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 animMode, f32 morphFrames) {
static AnimationHeader* sAnimations[GERUDO_AVEIL_ANIM_MAX] = {
&gGerudoRedStandAnim, // GERUDO_AVEIL_ANIM_STAND
&gGerudoRedWalkAnim, // GERUDO_AVEIL_ANIM_WALK
@ -125,7 +125,7 @@ void EnGe3_ChangeAnim(EnGe3* this, s16 animIndex, u8 mode, f32 morphFrames) {
};
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames);
Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames);
this->animIndex = animIndex;
}

View File

@ -7,7 +7,6 @@
#include "z_en_geg.h"
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#include "objects/object_oF1d_map/object_oF1d_map.h"
#include "objects/object_taisou/object_taisou.h"
#include "objects/object_hakugin_demo/object_hakugin_demo.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@ -126,68 +125,112 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(1, 0x0),
};
static AnimationInfoS sAnimationInfo[] = {
{ &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, -4 },
{ &gGoronUnrollAnim, -2.0f, 0, -1, ANIMMODE_ONCE, -4 },
{ &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &gGoronDropKegAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
{ &gGoronAthleticsSquatSideToSideAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronAthleticsDoubleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronAthleticsShakeLimbsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronAthleticsSingleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronAthleticsHamstringStretchSittingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronAthleticsCheerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronAthleticsShoutAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronAthleticsHamstringStretchStandingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronCoverEarsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &gGoronSpringLookAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gGoronSpringLookAroundLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &gGoronShiveringSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &gGoronStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
typedef enum {
/* -1 */ ENGEG_ANIM_NONE = -1,
/* 0x00 */ ENGEG_ANIM_0,
/* 0x01 */ ENGEG_ANIM_1,
/* 0x02 */ ENGEG_ANIM_2,
/* 0x03 */ ENGEG_ANIM_3,
/* 0x04 */ ENGEG_ANIM_4,
/* 0x05 */ ENGEG_ANIM_5,
/* 0x06 */ ENGEG_ANIM_6,
/* 0x07 */ ENGEG_ANIM_7,
/* 0x08 */ ENGEG_ANIM_8,
/* 0x09 */ ENGEG_ANIM_9,
/* 0x0A */ ENGEG_ANIM_10,
/* 0x0B */ ENGEG_ANIM_11,
/* 0x0C */ ENGEG_ANIM_12,
/* 0x0D */ ENGEG_ANIM_13,
/* 0x0E */ ENGEG_ANIM_14,
/* 0x0F */ ENGEG_ANIM_15,
/* 0x10 */ ENGEG_ANIM_16,
/* 0x11 */ ENGEG_ANIM_17,
/* 0x12 */ ENGEG_ANIM_18,
/* 0x13 */ ENGEG_ANIM_19,
/* 0x14 */ ENGEG_ANIM_20,
/* 0x15 */ ENGEG_ANIM_MAX
} EnGegAnimation;
static AnimationInfoS sAnimationInfo[ENGEG_ANIM_MAX] = {
{ &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_0
{ &gGoronLyingDownIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_1
{ &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_2
{ &gGoronUnrollAnim, 2.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_3
{ &gGoronUnrollAnim, -2.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_4
{ &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_5
{ &gGoronShiverAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_6
{ &gGoronDropKegAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGEG_ANIM_7
{ &gGoronAthleticsSquatSideToSideAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_8
{ &gGoronAthleticsDoubleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_9
{ &gGoronAthleticsShakeLimbsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_10
{ &gGoronAthleticsSingleArmSideBendAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_11
{ &gGoronAthleticsHamstringStretchSittingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_12
{ &gGoronAthleticsCheerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_13
{ &gGoronAthleticsShoutAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_14
{ &gGoronAthleticsHamstringStretchStandingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_15
{ &gGoronCoverEarsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_16
{ &gGoronSpringLookAroundAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_17
{ &gGoronSpringLookAroundLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGEG_ANIM_18
{ &gGoronShiveringSurprisedAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGEG_ANIM_19
{ &gGoronStandingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGEG_ANIM_20
};
u16 func_80BB16D0(EnGeg* this) {
switch (this->unk_496) {
case 0xD5E:
return 0xD5F;
case 0xD5F:
return 0xD60;
case 0xD60:
return 0xD61;
case 0xD62:
return 0xD63;
case 0xD64:
return 0xD65;
case 0xD66:
return 0xD67;
case 0xD67:
return 0xD68;
case 0xD68:
return 0xD69;
case 0xD6A:
return 0xD6B;
case 0xD6B:
return 0xD6C;
case 0xD6C:
return 0xD6D;
case 0xD6E:
return 0xD6F;
case 0xD70:
return 0xD71;
case 0xD71:
return 0xD72;
case 0xD73:
return 0xD74;
case 0xD74:
return 0xD75;
case 0xD89:
return 0xD8A;
default:
return 0;
}
return 0;
}
void func_80BB178C(EnGeg* this, PlayState* play) {
@ -372,14 +415,14 @@ s32 func_80BB1D64(EnGeg* this, PlayState* play) {
return true;
}
void func_80BB1FCC(EnGeg* this, PlayState* play) {
void EnGeg_UpdateSkelAnime(EnGeg* this, PlayState* play) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_248].segment);
SkelAnime_Update(&this->skelAnime);
}
void func_80BB2020(EnGeg* this, PlayState* play) {
void EnGeg_ChangeAnim(EnGeg* this, PlayState* play) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->unk_248].segment);
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->unk_4AC);
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->animIndex);
}
s32 func_80BB2088(EnGeg* this, PlayState* play) {
@ -393,7 +436,7 @@ s32 func_80BB2088(EnGeg* this, PlayState* play) {
}
if (Actor_IsFacingAndNearPlayer(&this->actor, 300.0f, 0x7FF8) &&
((this->unk_4AC == 5) || ((this->unk_4AC == 13) && (this->unk_496 == 0xD69)))) {
((this->animIndex == ENGEG_ANIM_5) || ((this->animIndex == ENGEG_ANIM_13) && (this->unk_496 == 0xD69)))) {
this->unk_230 |= 2;
func_80BB1D64(this, play);
} else {
@ -412,8 +455,8 @@ s32 func_80BB2088(EnGeg* this, PlayState* play) {
void func_80BB217C(EnGeg* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->unk_248)) {
this->unk_4AC = 5;
func_80BB2020(this, play);
this->animIndex = ENGEG_ANIM_5;
EnGeg_ChangeAnim(this, play);
Actor_SetScale(&this->actor, 0.01f);
this->unk_230 = 0;
this->actor.shape.shadowScale = 20.0f;
@ -509,8 +552,8 @@ void func_80BB2520(EnGeg* this, PlayState* play) {
case 0xD66:
this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP);
if (this->unk_248 >= 0) {
this->unk_4AC = 19;
func_80BB2020(this, play);
this->animIndex = ENGEG_ANIM_19;
EnGeg_ChangeAnim(this, play);
}
this->unk_230 |= 0x20;
this->actionFunc = func_80BB2944;
@ -527,11 +570,14 @@ void func_80BB2520(EnGeg* this, PlayState* play) {
case 0xD8B:
this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_OF1D_MAP);
if (this->unk_248 >= 0) {
this->unk_4AC = 4;
func_80BB2020(this, play);
this->animIndex = ENGEG_ANIM_4;
EnGeg_ChangeAnim(this, play);
}
this->actionFunc = func_80BB2E00;
break;
default:
break;
}
} else {
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
@ -557,6 +603,9 @@ void func_80BB26EC(EnGeg* this, PlayState* play) {
this->unk_230 &= ~0x10;
this->actionFunc = func_80BB221C;
return;
default:
break;
}
this->unk_496 = func_80BB16D0(this);
@ -609,12 +658,12 @@ void func_80BB27D4(EnGeg* this, PlayState* play) {
void func_80BB2944(EnGeg* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx);
s16 curFrame = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_4AC].animation);
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (this->unk_4AC == 19) {
if (curFrame == lastFrame) {
this->unk_4AC = 6;
func_80BB2020(this, play);
if (this->animIndex == ENGEG_ANIM_19) {
if (curFrame == endFrame) {
this->animIndex = ENGEG_ANIM_6;
EnGeg_ChangeAnim(this, play);
}
} else if ((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
if (this->unk_496 == 0xD67) {
@ -666,8 +715,8 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) {
Message_ContinueTextbox(play, this->unk_496);
this->unk_248 = Object_GetIndex(&play->objectCtx, OBJECT_TAISOU);
if (this->unk_248 >= 0) {
this->unk_4AC = 13;
func_80BB2020(this, play);
this->animIndex = ENGEG_ANIM_13;
EnGeg_ChangeAnim(this, play);
}
this->actionFunc = func_80BB27D4;
} else {
@ -704,21 +753,21 @@ void func_80BB2B1C(EnGeg* this, PlayState* play) {
}
void func_80BB2E00(EnGeg* this, PlayState* play) {
s16 sp2E = this->skelAnime.curFrame;
s16 sp2C = Animation_GetLastFrame(sAnimationInfo[this->unk_4AC].animation);
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (this->unk_4AC == 2) {
if (this->animIndex == ENGEG_ANIM_2) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100);
this->actor.world.rot.y = this->actor.shape.rot.y;
if (sp2E == sp2C) {
if (curFrame == endFrame) {
CutsceneManager_Stop(this->csId);
this->unk_4AC = 20;
func_80BB2020(this, play);
this->animIndex = ENGEG_ANIM_20;
EnGeg_ChangeAnim(this, play);
this->actionFunc = func_80BB30B4;
} else if (Animation_OnFrame(&this->skelAnime, 24.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_STAND_IMT);
}
} else if (this->unk_4AC == 4) {
} else if (this->animIndex == ENGEG_ANIM_4) {
if (Animation_OnFrame(&this->skelAnime, 0.0f)) {
this->unk_230 |= 1;
this->actor.shape.yOffset = 14.0f;
@ -740,11 +789,11 @@ void func_80BB2F7C(EnGeg* this, PlayState* play) {
if ((this->actor.xzDistToPlayer < 150.0f) && (fabsf(this->actor.playerHeightRel) < 10.0f) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
this->unk_4AC = 2;
this->animIndex = ENGEG_ANIM_2;
this->actor.speed = 0.0f;
this->unk_230 &= ~1;
this->actor.shape.yOffset = 0.0f;
func_80BB2020(this, play);
EnGeg_ChangeAnim(this, play);
this->actionFunc = func_80BB2E00;
} else {
this->actor.speed = 5.0f;
@ -902,7 +951,7 @@ void EnGeg_Update(Actor* thisx, PlayState* play) {
EnGeg* this = THIS;
this->actionFunc(this, play);
func_80BB1FCC(this, play);
EnGeg_UpdateSkelAnime(this, play);
func_80BB2088(this, play);
func_80BB1C8C(this);
SubS_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENGEG_FIDGET_TABLE_LEN);

View File

@ -2,6 +2,7 @@
#define Z_EN_GEG_H
#include "global.h"
#include "objects/object_oF1d_map/object_oF1d_map.h"
struct EnGeg;
@ -23,8 +24,8 @@ typedef struct EnGeg {
/* 0x242 */ s16 unk_242;
/* 0x244 */ s16 unk_244;
/* 0x248 */ s32 unk_248;
/* 0x24C */ Vec3s jointTable[18];
/* 0x2B8 */ Vec3s morphTable[18];
/* 0x24C */ Vec3s jointTable[GORON_LIMB_MAX];
/* 0x2B8 */ Vec3s morphTable[GORON_LIMB_MAX];
/* 0x324 */ UNK_TYPE1 unk324[0x144];
/* 0x468 */ s16 unk_468;
/* 0x46A */ s16 unk_46A;
@ -38,7 +39,7 @@ typedef struct EnGeg {
/* 0x498 */ s16 csId;
/* 0x49A */ s16 nextCsId;
/* 0x49C */ s16 csIdList[8];
/* 0x4AC */ s32 unk_4AC;
/* 0x4AC */ s32 animIndex;
/* 0x4B0 */ s16 unk_4B0;
/* 0x4B4 */ Vec3f unk_4B4;
/* 0x4C0 */ Vec3f unk_4C0[2];

View File

@ -6,7 +6,6 @@
#include "z_en_gg.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_gg/object_gg.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_REACT_TO_LENS)
@ -95,15 +94,44 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0x0),
};
static AnimationInfo sAnimationInfo[] = {
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, 2, -10.0f },
{ &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, 2, -10.0f },
{ &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f },
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f },
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, 0, 0.0f },
{ &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, 0, 0.0f },
{ &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, 2, 0.0f },
{ &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, 0, 0.0f },
typedef enum {
/* -1 */ ENGG_ANIM_NONE = -1,
/* 0x00 */ ENGG_ANIM_0,
/* 0x01 */ ENGG_ANIM_1,
/* 0x02 */ ENGG_ANIM_2,
/* 0x03 */ ENGG_ANIM_3,
/* 0x04 */ ENGG_ANIM_4,
/* 0x05 */ ENGG_ANIM_5,
/* 0x06 */ ENGG_ANIM_6,
/* 0x07 */ ENGG_ANIM_7,
/* 0x08 */ ENGG_ANIM_8,
/* 0x09 */ ENGG_ANIM_9,
/* 0x0A */ ENGG_ANIM_10,
/* 0x0B */ ENGG_ANIM_11,
/* 0x0C */ ENGG_ANIM_12,
/* 0x0D */ ENGG_ANIM_13,
/* 0x0E */ ENGG_ANIM_14,
/* 0x0F */ ENGG_ANIM_15,
/* 0x10 */ ENGG_ANIM_MAX
} EnGgAnimation;
static AnimationInfo sAnimationInfo[ENGG_ANIM_MAX] = {
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_0
{ &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_1
{ &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_2
{ &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG_ANIM_3
{ &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_4
{ &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_5
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_6
{ &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_7
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG_ANIM_8
{ &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_9
{ &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_10
{ &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_11
{ &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_12
{ &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_13
{ &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG_ANIM_14
{ &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG_ANIM_15
};
void func_80B34F70(EnGg* this) {
@ -149,7 +177,7 @@ void func_80B35108(EnGg* this, PlayState* play) {
}
void func_80B351A4(EnGg* this) {
if ((this->unk_2E6 == 2) || (this->unk_2E6 == 3)) {
if ((this->animIndex == ENGG_ANIM_2) || (this->animIndex == ENGG_ANIM_3)) {
this->unk_2E2 = 3;
} else {
s16 temp = this->unk_2E4 - 1;
@ -170,57 +198,57 @@ void func_80B351A4(EnGg* this) {
void func_80B35250(EnGg* this) {
this->unk_2E4 = 20;
this->unk_2E2 = 0;
this->unk_2E6 = 0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
this->animIndex = ENGG_ANIM_0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0);
this->actionFunc = func_80B35450;
}
void func_80B352A4(EnGg* this, PlayState* play) {
s16 sp26 = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E6].animation);
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (sp26 == lastFrame) {
if (curFrame == endFrame) {
switch (this->actor.textId) {
case 0xCE5:
this->unk_2E6 = 1;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
this->animIndex = ENGG_ANIM_1;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_1);
break;
case 0xCE6:
case 0xCEC:
this->unk_2E6 = 0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
this->animIndex = ENGG_ANIM_0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0);
break;
case 0xCE8:
this->unk_2E6 = 2;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
this->animIndex = ENGG_ANIM_2;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_2);
break;
case 0xCE9:
this->unk_2E6 = 3;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
this->animIndex = ENGG_ANIM_3;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_3);
break;
case 0xCED:
case 0xCEE:
this->unk_2E6 = 4;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4);
this->animIndex = ENGG_ANIM_4;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_4);
break;
default:
this->unk_2E6 = 0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
this->animIndex = ENGG_ANIM_0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_0);
break;
}
SET_WEEKEVENTREG(WEEKEVENTREG_19_80);
this->actionFunc = func_80B3556C;
} else if ((this->unk_2E6 == 0) && ((this->actor.textId == 0xCED) || (this->actor.textId == 0xCEE))) {
if (sp26 < (lastFrame - 1)) {
} else if ((this->animIndex == ENGG_ANIM_0) && ((this->actor.textId == 0xCED) || (this->actor.textId == 0xCEE))) {
if (curFrame < (endFrame - 1)) {
this->skelAnime.playSpeed = 2.0f;
} else {
this->unk_2E6 = 4;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4);
this->animIndex = ENGG_ANIM_4;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_4);
}
}
}
@ -249,7 +277,7 @@ void func_80B35450(EnGg* this, PlayState* play) {
void func_80B3556C(EnGg* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
if (this->unk_2E6 == 4) {
if (this->animIndex == ENGG_ANIM_4) {
play->msgCtx.msgMode = 0x43;
play->msgCtx.stateTimer = 4;
this->unk_308 = 0;
@ -275,47 +303,43 @@ void func_80B35634(EnGg* this, PlayState* play) {
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
this->unk_2DA = 0;
this->unk_2E6 = 0;
this->csAnimIndex = ENGG_ANIM_0;
this->animIndex = ENGG_ANIM_0;
break;
case 2:
this->unk_2DA = 9;
this->unk_2E6 = 9;
this->csAnimIndex = ENGG_ANIM_9;
this->animIndex = ENGG_ANIM_9;
break;
case 3:
this->unk_2DA = 10;
this->unk_2E6 = 10;
this->csAnimIndex = ENGG_ANIM_10;
this->animIndex = ENGG_ANIM_10;
break;
case 4:
do {
this->unk_344.unk_30 = this->unk_2DA = 11;
} while (0);
this->unk_2E6 = 11;
this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_11;
this->animIndex = ENGG_ANIM_11;
func_80B364D4(&this->unk_344, play);
break;
case 5:
do {
this->unk_344.unk_30 = this->unk_2DA = 12;
} while (0);
this->unk_2E6 = 12;
this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_12;
//! FAKE:
if (1) {}
this->animIndex = ENGG_ANIM_12;
break;
case 6:
do {
this->unk_344.unk_30 = this->unk_2DA = 13;
} while (0);
this->unk_2E6 = 13;
this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_13;
//! FAKE:
if (1) {}
this->animIndex = ENGG_ANIM_13;
break;
case 7:
do {
this->unk_344.unk_30 = this->unk_2DA = 14;
} while (0);
this->unk_2E6 = 14;
this->unk_344.animIndex = this->csAnimIndex = ENGG_ANIM_14;
this->animIndex = ENGG_ANIM_14;
func_80B364D4(&this->unk_344, play);
break;
@ -324,13 +348,13 @@ void func_80B35634(EnGg* this, PlayState* play) {
return;
default:
this->unk_2DA = 0;
this->csAnimIndex = ENGG_ANIM_0;
break;
}
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2DA);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->csAnimIndex);
}
if (this->unk_2DA == 14) {
if (this->csAnimIndex == ENGG_ANIM_14) {
func_80B358D8(this, play);
}
@ -345,16 +369,22 @@ u16 func_80B357F0(EnGg* this) {
switch (this->actor.textId) {
case 0xCE5:
return 0xCE6;
case 0xCE6:
return 0xCE8;
case 0xCE8:
return 0xCE9;
case 0xCE9:
return 0xCEC;
case 0xCEC:
return 0xCED;
default:
return 0;
}
return 0;
}
void func_80B3584C(EnGg* this) {
@ -366,12 +396,12 @@ void func_80B3584C(EnGg* this) {
}
void func_80B358D8(EnGg* this, PlayState* play) {
s16 sp1E = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2DA].animation);
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->csAnimIndex].animation);
if ((this->unk_2E6 == 14) && (sp1E == lastFrame)) {
this->unk_2E6 = 15;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 15);
if ((this->animIndex == ENGG_ANIM_14) && (curFrame == endFrame)) {
this->animIndex = ENGG_ANIM_15;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG_ANIM_15);
}
}
@ -379,8 +409,8 @@ void func_80B35968(EnGg* this, PlayState* play) {
if (this->unk_344.unk_34 != NULL) {
this->unk_344.unk_34(&this->unk_344, play);
} else {
if ((this->unk_2DA == 11) || (this->unk_2DA == 14)) {
this->unk_344.unk_30 = this->unk_2DA;
if ((this->csAnimIndex == ENGG_ANIM_11) || (this->csAnimIndex == ENGG_ANIM_14)) {
this->unk_344.animIndex = this->csAnimIndex;
}
func_80B363E8(&this->unk_344, play, &this->unk_320, &this->unk_32C, &this->unk_338);
}
@ -433,7 +463,7 @@ void func_80B35B24(EnGgStruct* ptr, PlayState* play) {
}
void func_80B35B44(EnGgStruct* ptr, PlayState* play) {
if (ptr->unk_30 == 0xE) {
if (ptr->animIndex == ENGG_ANIM_14) {
ptr->unk_40++;
if (ptr->unk_40 > 0x46) {
ptr->unk_48 = 1;
@ -455,13 +485,13 @@ void func_80B35B44(EnGgStruct* ptr, PlayState* play) {
ptr->unk_44 = 0x37;
}
}
} else if ((ptr->unk_30 == 11) || (ptr->unk_30 == 12)) {
} else if ((ptr->animIndex == ENGG_ANIM_11) || (ptr->animIndex == ENGG_ANIM_12)) {
ptr->unk_40++;
if (ptr->unk_40 > 0x46) {
ptr->unk_48 = 1;
ptr->unk_40 = 0;
}
} else if (ptr->unk_30 == 0xD) {
} else if (ptr->animIndex == ENGG_ANIM_13) {
ptr->unk_48 = 0;
ptr->unk_40++;
if (ptr->unk_40 > 0x46) {
@ -496,7 +526,7 @@ void func_80B35C84(EnGgStruct* ptr, PlayState* play) {
sp74 = ptr->unk_40 % temp;
ptr->unk_40 = sp74;
phi_s7 = 0x46;
} else if (ptr->unk_30 == 0xD) {
} else if (ptr->animIndex == ENGG_ANIM_13) {
sp74 = ptr->unk_40;
phi_s7 = 0x46;
} else {
@ -519,6 +549,7 @@ void func_80B35C84(EnGgStruct* ptr, PlayState* play) {
temp_f26 = ptr->unk_00.z + (ptr->unk_18.z * temp_f20) + (0.5f * ptr->unk_24.z * temp_f20 * temp_f20);
temp_f20 = Rand_ZeroOne() * 0.003f;
//! FAKE:
if (1) {}
Matrix_Translate(temp_f22, temp_f24, temp_f26, MTXMODE_NEW);
@ -630,9 +661,9 @@ void func_80B363E8(EnGgStruct* ptr, PlayState* play, Vec3f* arg1, Vec3f* arg2, V
ptr->unk_00.x += -4.0f;
ptr->unk_0C.x += 4.0f;
if ((ptr->unk_30 == 11) || (ptr->unk_30 == 12) || (ptr->unk_30 == 13)) {
if ((ptr->animIndex == ENGG_ANIM_11) || (ptr->animIndex == ENGG_ANIM_12) || (ptr->animIndex == ENGG_ANIM_13)) {
ptr->unk_38 = func_80B35C84;
} else if (ptr->unk_30 == 14) {
} else if (ptr->animIndex == ENGG_ANIM_14) {
ptr->unk_38 = func_80B3610C;
}
}
@ -655,7 +686,7 @@ void EnGg_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400;
SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable,
this->morphTable, 20);
this->morphTable, OBJECT_GG_LIMB_MAX);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
@ -700,11 +731,13 @@ void EnGg_Update(Actor* thisx, PlayState* play) {
}
if ((play->csCtx.state == CS_STATE_IDLE) &&
((this->unk_2DA != 14) && (this->unk_2DA != 11) && (this->unk_2DA != 12) && (this->unk_2DA != 13))) {
((this->csAnimIndex != ENGG_ANIM_14) && (this->csAnimIndex != ENGG_ANIM_11) &&
(this->csAnimIndex != ENGG_ANIM_12) && (this->csAnimIndex != ENGG_ANIM_13))) {
func_80B364D4(&this->unk_344, play);
}
if (((this->unk_2DA == 14) || (this->unk_2DA == 11) || (this->unk_2DA == 12) || (this->unk_2DA == 13)) &&
if (((this->csAnimIndex == ENGG_ANIM_14) || (this->csAnimIndex == ENGG_ANIM_11) ||
(this->csAnimIndex == ENGG_ANIM_12) || (this->csAnimIndex == ENGG_ANIM_13)) &&
(this->unk_309 == 1)) {
func_80B35968(this, play);
}
@ -738,7 +771,7 @@ s32 EnGg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
Gfx** gfx) {
EnGg* this = THIS;
if (limbIndex == 2) {
if (limbIndex == OBJECT_GG_LIMB_02) {
Matrix_RotateZS(this->unk_2E8, MTXMODE_APPLY);
}
return false;
@ -750,12 +783,13 @@ void EnGg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Vec3f sp30 = { 0.0f, 0.0f, 0.0f };
Vec3f sp24 = { 0.0f, 0.0f, 0.0f };
if (this->unk_2DA == 14) {
if (this->csAnimIndex == ENGG_ANIM_14) {
sp30.y = 3.0f;
sp30.z = -1.0f;
sp24.y = -0.07f;
this->unk_309 = 1;
} else if ((this->unk_2DA == 11) || (this->unk_2DA == 12) || (this->unk_2DA == 13)) {
} else if ((this->csAnimIndex == ENGG_ANIM_11) || (this->csAnimIndex == ENGG_ANIM_12) ||
(this->csAnimIndex == ENGG_ANIM_13)) {
sp30.x = 3.0f;
sp24.x = 0.5f;
this->unk_309 = 1;
@ -763,7 +797,7 @@ void EnGg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
this->unk_309 = 0;
}
if (limbIndex == 4) {
if (limbIndex == OBJECT_GG_LIMB_04) {
Matrix_MultVec3f(&D_80B36DF0, &this->unk_320);
Matrix_Push();
Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW);

View File

@ -2,6 +2,7 @@
#define Z_EN_GG_H
#include "global.h"
#include "objects/object_gg/object_gg.h"
struct EnGg;
struct EnGgStruct;
@ -14,7 +15,7 @@ typedef struct EnGgStruct {
/* 0x0C */ Vec3f unk_0C;
/* 0x18 */ Vec3f unk_18;
/* 0x24 */ Vec3f unk_24;
/* 0x30 */ u8 unk_30;
/* 0x30 */ u8 animIndex;
/* 0x34 */ EnGgUnkFunc unk_34;
/* 0x38 */ EnGgUnkFunc unk_38;
/* 0x3C */ s32 unk_3C;
@ -30,16 +31,16 @@ typedef struct EnGg {
/* 0x1D4 */ EnGgActionFunc actionFunc;
/* 0x1D8 */ Vec3s unk_1D8;
/* 0x1DE */ Vec3s unk_1DE;
/* 0x1E4 */ Vec3s jointTable[20];
/* 0x25C */ Vec3s morphTable[20];
/* 0x1E4 */ Vec3s jointTable[OBJECT_GG_LIMB_MAX];
/* 0x25C */ Vec3s morphTable[OBJECT_GG_LIMB_MAX];
/* 0x2D4 */ UNK_TYPE1 unk_2D4[0x6];
/* 0x2DA */ u8 unk_2DA;
/* 0x2DA */ u8 csAnimIndex;
/* 0x2DB */ u8 cueId;
/* 0x2DC */ s16 csId;
/* 0x2DE */ UNK_TYPE1 unk2DE[4];
/* 0x2E2 */ s16 unk_2E2;
/* 0x2E4 */ s16 unk_2E4;
/* 0x2E6 */ s16 unk_2E6;
/* 0x2E6 */ s16 animIndex;
/* 0x2E8 */ s16 unk_2E8;
/* 0x2EA */ UNK_TYPE1 unk2EA[0x1A];
/* 0x304 */ s16 unk_304;

View File

@ -5,7 +5,6 @@
*/
#include "z_en_gg2.h"
#include "objects/object_gg/object_gg.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_REACT_TO_LENS)
@ -39,15 +38,44 @@ ActorInit En_Gg2_InitVars = {
(ActorFunc)EnGg2_Draw,
};
AnimationInfo D_80B3BF00[] = {
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, 2, -10.0f },
{ &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, 2, -10.0f }, { &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, 2, -10.0f },
{ &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f },
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, 0, -10.0f },
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, 0, -10.0f }, { &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, 0, 0.0f },
{ &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, 0, 0.0f },
{ &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, 2, 0.0f },
{ &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, 2, 0.0f }, { &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, 0, 0.0f },
typedef enum {
/* -1 */ ENGG2_ANIM_NONE = -1,
/* 0x00 */ ENGG2_ANIM_0,
/* 0x01 */ ENGG2_ANIM_1,
/* 0x02 */ ENGG2_ANIM_2,
/* 0x03 */ ENGG2_ANIM_3,
/* 0x04 */ ENGG2_ANIM_4,
/* 0x05 */ ENGG2_ANIM_5,
/* 0x06 */ ENGG2_ANIM_6,
/* 0x07 */ ENGG2_ANIM_7,
/* 0x08 */ ENGG2_ANIM_8,
/* 0x09 */ ENGG2_ANIM_9,
/* 0x0A */ ENGG2_ANIM_10,
/* 0x0B */ ENGG2_ANIM_11,
/* 0x0C */ ENGG2_ANIM_12,
/* 0x0D */ ENGG2_ANIM_13,
/* 0x0E */ ENGG2_ANIM_14,
/* 0x0F */ ENGG2_ANIM_15,
/* 0x10 */ ENGG2_ANIM_MAX
} EnGg2Animation;
static AnimationInfo sAnimationInfo[ENGG2_ANIM_MAX] = {
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_0
{ &object_gg_Anim_00D528, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_1
{ &object_gg_Anim_00D174, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_2
{ &object_gg_Anim_00ECC0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -10.0f }, // ENGG2_ANIM_3
{ &object_gg_Anim_00BAF0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_4
{ &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_5
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_6
{ &object_gg_Anim_00AF40, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_7
{ &object_gg_Anim_00F578, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -10.0f }, // ENGG2_ANIM_8
{ &object_gg_Anim_0100C8, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_9
{ &object_gg_Anim_00CDA0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_10
{ &object_gg_Anim_00B560, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_11
{ &object_gg_Anim_00A4B4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_12
{ &object_gg_Anim_00E86C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_13
{ &object_gg_Anim_00D99C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGG2_ANIM_14
{ &object_gg_Anim_00E2A4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGG2_ANIM_15
};
Color_RGBA8 D_80B3C080 = { 255, 255, 255, 255 };
@ -116,38 +144,38 @@ void func_80B3ADD8(EnGg2* this) {
void func_80B3AE60(EnGg2* this, PlayState* play) {
s16 curFrame = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(D_80B3BF00[this->unk_2EE].animation);
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (curFrame == lastFrame) {
switch (this->unk_2EE) {
case 0:
this->unk_2EE = 1;
Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 1);
if (curFrame == endFrame) {
switch (this->animIndex) {
case ENGG2_ANIM_0:
this->animIndex = ENGG2_ANIM_1;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_1);
this->actionFunc = func_80B3B0A0;
break;
case 1:
case 8:
this->unk_2EE = 5;
case ENGG2_ANIM_1:
case ENGG2_ANIM_8:
this->animIndex = ENGG2_ANIM_5;
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 5);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_5);
this->actionFunc = func_80B3B120;
break;
case 5:
this->unk_2EE = 6;
Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
case ENGG2_ANIM_5:
this->animIndex = ENGG2_ANIM_6;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3B21C;
break;
case 6:
this->unk_2EE = 7;
Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 5);
case ENGG2_ANIM_6:
this->animIndex = ENGG2_ANIM_7;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_5);
this->actionFunc = func_80B3B294;
break;
default:
Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3AFB0;
break;
}
@ -338,7 +366,7 @@ f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) {
void func_80B3B8A4(EnGg2* this) {
f32 sp1C;
if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) {
if ((this->animIndex != ENGG2_ANIM_5) && (this->animIndex != ENGG2_ANIM_7)) {
this->unk_2F2 += 0x62C;
sp1C = 1100.0f;
} else {
@ -368,7 +396,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400;
SkelAnime_InitFlex(play, &this->skelAnime, &object_gg_Skel_00F6C0, &object_gg_Anim_00F578, this->jointTable,
this->morphTable, 20);
this->morphTable, OBJECT_GG_LIMB_MAX);
this->path = SubS_GetPathByIndex(play, ENGG2_GET_PATH_INDEX(&this->actor), ENGG2_PATH_INDEX_NONE);
this->actor.flags &= ~ACTOR_FLAG_REACT_TO_LENS;
this->unk_2F0 = 0;
@ -384,15 +412,15 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_10);
this->unk_2EE = 0;
Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
this->animIndex = ENGG2_ANIM_0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3AFB0;
} else if (play->sceneId == SCENE_17SETUGEN) {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_20_04) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_20_08) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_10)) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_04);
this->unk_2EE = 8;
Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
this->animIndex = ENGG2_ANIM_8;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3B05C;
} else {
Actor_Kill(&this->actor);
@ -401,8 +429,8 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) {
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_04) && CHECK_WEEKEVENTREG(WEEKEVENTREG_20_08) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_20_10)) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_20_08);
this->unk_2EE = 8;
Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0);
this->animIndex = ENGG2_ANIM_8;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGG2_ANIM_0);
this->actionFunc = func_80B3B05C;
} else {
Actor_Kill(&this->actor);
@ -424,7 +452,7 @@ void EnGg2_Update(Actor* thisx, PlayState* play) {
if (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) {
this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS;
this->actor.flags |= ACTOR_FLAG_TARGETABLE;
if ((this->unk_2EE == 5) && (this->unk_2EE == 7)) {
if ((this->animIndex == ENGG2_ANIM_5) && (this->animIndex == ENGG2_ANIM_7)) {
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
}
} else {
@ -441,7 +469,7 @@ void EnGg2_Update(Actor* thisx, PlayState* play) {
func_80B3B8A4(this);
Actor_TrackPlayer(play, &this->actor, &this->unk_1E0, &this->unk_1E6, this->actor.focus.pos);
if ((this->unk_2EE == 5) || (this->unk_2EE == 7)) {
if ((this->animIndex == ENGG2_ANIM_5) || (this->animIndex == ENGG2_ANIM_7)) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_SHARP_FLOAT - SFX_FLAG);
if ((play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) && ((play->state.frames % 4) == 0)) {
func_80B3B4B0(this, play);
@ -454,12 +482,12 @@ void EnGg2_Update(Actor* thisx, PlayState* play) {
s32 func_80B3BD44(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, Gfx** gfx) {
EnGg2* this = THIS;
if ((this->unk_2EE != 5) && (this->unk_2EE != 7)) {
if (limbIndex == 1) {
if ((this->animIndex != ENGG2_ANIM_5) && (this->animIndex != ENGG2_ANIM_7)) {
if (limbIndex == OBJECT_GG_LIMB_01) {
Matrix_RotateYS(this->unk_2F6, MTXMODE_APPLY);
}
if (limbIndex == 2) {
if (limbIndex == OBJECT_GG_LIMB_02) {
Matrix_RotateZS(this->unk_2F4, MTXMODE_APPLY);
}
}
@ -469,7 +497,7 @@ s32 func_80B3BD44(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s
void func_80B3BDC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) {
EnGg2* this = THIS;
if (limbIndex == 4) {
if (limbIndex == OBJECT_GG_LIMB_04) {
Matrix_MultVec3f(&D_80B3C0A0, &this->unk_304);
}
}

View File

@ -2,6 +2,7 @@
#define Z_EN_GG2_H
#include "global.h"
#include "objects/object_gg/object_gg.h"
struct EnGg2;
@ -20,14 +21,14 @@ typedef struct EnGg2 {
/* 0x1DC */ s32 unk_1DC;
/* 0x1E0 */ Vec3s unk_1E0;
/* 0x1E6 */ Vec3s unk_1E6;
/* 0x1EC */ Vec3s jointTable[20];
/* 0x264 */ Vec3s morphTable[20];
/* 0x1EC */ Vec3s jointTable[OBJECT_GG_LIMB_MAX];
/* 0x264 */ Vec3s morphTable[OBJECT_GG_LIMB_MAX];
/* 0x2DC */ UNK_TYPE1 unk2DC[0x8];
/* 0x2E4 */ s16 csId;
/* 0x2E6 */ UNK_TYPE1 unk2E6[4];
/* 0x2EA */ s16 unk_2EA;
/* 0x2EC */ s16 unk_2EC;
/* 0x2EE */ s16 unk_2EE;
/* 0x2EE */ s16 animIndex;
/* 0x2F0 */ u8 unk_2F0;
/* 0x2F1 */ u8 unk_2F1;
/* 0x2F2 */ s16 unk_2F2;

View File

@ -28,10 +28,45 @@ void EnGiant_PerformCutsceneActions(EnGiant* this, PlayState* play);
#define GIANT_TYPE_IS_CLOCK_TOWER_FAILURE(type) \
(type >= GIANT_TYPE_MOUNTAIN_CLOCK_TOWER_FAILURE && type <= GIANT_TYPE_OCEAN_CLOCK_TOWER_FAILURE)
/**
* Used as values for cueId. The UNKNOWN ones are never used in-game.
*/
typedef enum {
/* 0 */ GIANT_CUEID_NONE,
/* 1 */ GIANT_CUEID_IDLE,
/* 2 */ GIANT_CUEID_WALKING,
/* 3 */ GIANT_CUEID_LOOKING_UP,
/* 4 */ GIANT_CUEID_RAISING_ARMS,
/* 5 */ GIANT_CUEID_STRUGGLING,
/* 6 */ GIANT_CUEID_FALLING_OVER,
/* 7 */ GIANT_CUEID_IDLE_FADE_IN,
/* 8 */ GIANT_CUEID_TALKING,
/* 9 */ GIANT_CUEID_DONE_TALKING,
/* 10 */ GIANT_CUEID_TEACHING_OATH_TO_ORDER,
/* 11 */ GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER,
/* 12 */ GIANT_CUEID_UNKNOWN_12,
/* 13 */ GIANT_CUEID_UNKNOWN_13,
/* 14 */ GIANT_CUEID_UNKNOWN_14,
/* 15 */ GIANT_CUEID_HOLDING_UP_MOON_IN_CLOCK_TOWER
} GiantCueId;
ActorInit En_Giant_InitVars = {
ACTOR_EN_GIANT,
ACTORCAT_NPC,
FLAGS,
OBJECT_GIANT,
sizeof(EnGiant),
(ActorFunc)EnGiant_Init,
(ActorFunc)EnGiant_Destroy,
(ActorFunc)EnGiant_Update,
(ActorFunc)EnGiant_Draw,
};
/**
* These values are used to index into sAnimations to pick the appropriate animation.
*/
typedef enum {
/* -1 */ GIANT_ANIM_NONE = -1,
/* 0 */ GIANT_ANIM_LOOK_UP_START,
/* 1 */ GIANT_ANIM_LOOK_UP_LOOP,
/* 2 */ GIANT_ANIM_FALLING_OVER,
@ -50,49 +85,26 @@ typedef enum {
/* 15 */ GIANT_ANIM_MAX
} GiantAnimation;
/**
* Used as values for cueId. The UNKNOWN ones are never used in-game.
*/
typedef enum {
/* 0 */ GIANT_CUE_ID_NONE,
/* 1 */ GIANT_CUE_ID_IDLE,
/* 2 */ GIANT_CUE_ID_WALKING,
/* 3 */ GIANT_CUE_ID_LOOKING_UP,
/* 4 */ GIANT_CUE_ID_RAISING_ARMS,
/* 5 */ GIANT_CUE_ID_STRUGGLING,
/* 6 */ GIANT_CUE_ID_FALLING_OVER,
/* 7 */ GIANT_CUE_ID_IDLE_FADE_IN,
/* 8 */ GIANT_CUE_ID_TALKING,
/* 9 */ GIANT_CUE_ID_DONE_TALKING,
/* 10 */ GIANT_CUE_ID_TEACHING_OATH_TO_ORDER,
/* 11 */ GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER,
/* 12 */ GIANT_CUE_ID_UNKNOWN_12,
/* 13 */ GIANT_CUE_ID_UNKNOWN_13,
/* 14 */ GIANT_CUE_ID_UNKNOWN_14,
/* 15 */ GIANT_CUE_ID_HOLDING_UP_MOON_IN_CLOCK_TOWER
} GiantCueId;
ActorInit En_Giant_InitVars = {
ACTOR_EN_GIANT,
ACTORCAT_NPC,
FLAGS,
OBJECT_GIANT,
sizeof(EnGiant),
(ActorFunc)EnGiant_Init,
(ActorFunc)EnGiant_Destroy,
(ActorFunc)EnGiant_Update,
(ActorFunc)EnGiant_Draw,
};
static AnimationHeader* sAnimations[] = {
&gGiantLookUpStartAnim, &gGiantLookUpLoopAnim, &gGiantFallingOverAnim, &gGiantRaisedArmsStartAnim,
&gGiantRaisedArmsLoopAnim, &gGiantStruggleStartAnim, &gGiantStruggleLoopAnim, &gGiantIdleAnim,
&gGiantWalkingAnim, &gGiantBigCallStartAnim, &gGiantBigCallLoopAnim, &gGiantBigCallEndAnim,
&gGiantSmallCallStartAnim, &gGiantSmallCallLoopAnim, &gGiantSmallCallEndAnim,
static AnimationHeader* sAnimations[GIANT_ANIM_MAX] = {
&gGiantLookUpStartAnim, // GIANT_ANIM_LOOK_UP_START
&gGiantLookUpLoopAnim, // GIANT_ANIM_LOOK_UP_LOOP
&gGiantFallingOverAnim, // GIANT_ANIM_FALLING_OVER
&gGiantRaisedArmsStartAnim, // GIANT_ANIM_RAISED_ARMS_START
&gGiantRaisedArmsLoopAnim, // GIANT_ANIM_RAISED_ARMS_LOOP
&gGiantStruggleStartAnim, // GIANT_ANIM_STRUGGLE_START
&gGiantStruggleLoopAnim, // GIANT_ANIM_STRUGGLE_LOOP
&gGiantIdleAnim, // GIANT_ANIM_IDLE_LOOP
&gGiantWalkingAnim, // GIANT_ANIM_WALKING_LOOP
&gGiantBigCallStartAnim, // GIANT_ANIM_BIG_CALL_START
&gGiantBigCallLoopAnim, // GIANT_ANIM_BIG_CALL_LOOP
&gGiantBigCallEndAnim, // GIANT_ANIM_BIG_CALL_END
&gGiantSmallCallStartAnim, // GIANT_ANIM_SMALL_CALL_START
&gGiantSmallCallLoopAnim, // GIANT_ANIM_SMALL_CALL_LOOP
&gGiantSmallCallEndAnim, // GIANT_ANIM_SMALL_CALL_END
};
void EnGiant_ChangeAnim(EnGiant* this, s16 animIndex) {
if (animIndex >= GIANT_ANIM_LOOK_UP_START && animIndex < GIANT_ANIM_MAX) {
if ((animIndex >= GIANT_ANIM_LOOK_UP_START) && (animIndex < GIANT_ANIM_MAX)) {
if (((this->animIndex == GIANT_ANIM_WALKING_LOOP) && (animIndex != GIANT_ANIM_WALKING_LOOP)) ||
((animIndex == GIANT_ANIM_WALKING_LOOP) && (this->animIndex != GIANT_ANIM_WALKING_LOOP))) {
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
@ -160,7 +172,7 @@ void EnGiant_Init(Actor* thisx, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gGiantSkel, &gGiantLargeStrideAnim, this->jointTable, this->morphTable,
GIANT_LIMB_MAX);
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
this->cueId = GIANT_CUE_ID_NONE;
this->cueId = GIANT_CUEID_NONE;
this->actionFunc = EnGiant_PerformCutsceneActions;
this->actor.draw = NULL;
this->alpha = 0;
@ -275,58 +287,58 @@ void EnGiant_ChangeToStartOrLoopAnimation(EnGiant* this, s16 requestedAnimIndex)
*/
void EnGiant_ChangeAnimBasedOnCueId(EnGiant* this) {
switch (this->cueId) {
case GIANT_CUE_ID_IDLE:
case GIANT_CUEID_IDLE:
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
break;
case GIANT_CUE_ID_WALKING:
case GIANT_CUEID_WALKING:
EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP);
break;
case GIANT_CUE_ID_STRUGGLING:
case GIANT_CUEID_STRUGGLING:
EnGiant_ChangeAnim(this, GIANT_ANIM_STRUGGLE_START);
break;
case GIANT_CUE_ID_FALLING_OVER:
case GIANT_CUEID_FALLING_OVER:
EnGiant_ChangeAnim(this, GIANT_ANIM_FALLING_OVER);
break;
case GIANT_CUE_ID_IDLE_FADE_IN:
case GIANT_CUEID_IDLE_FADE_IN:
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
this->alpha = 0;
break;
case GIANT_CUE_ID_TALKING:
case GIANT_CUEID_TALKING:
EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_START);
break;
case GIANT_CUE_ID_DONE_TALKING:
case GIANT_CUEID_DONE_TALKING:
EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_END);
break;
case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER:
case GIANT_CUEID_TEACHING_OATH_TO_ORDER:
EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_START);
break;
case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER:
case GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER:
EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_END);
break;
case GIANT_CUE_ID_UNKNOWN_12:
case GIANT_CUEID_UNKNOWN_12:
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
break;
case GIANT_CUE_ID_UNKNOWN_13:
case GIANT_CUEID_UNKNOWN_13:
EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP);
break;
case GIANT_CUE_ID_UNKNOWN_14:
case GIANT_CUEID_UNKNOWN_14:
if (this->animIndex != GIANT_ANIM_WALKING_LOOP) {
EnGiant_ChangeAnim(this, GIANT_ANIM_WALKING_LOOP);
}
break;
case GIANT_CUE_ID_HOLDING_UP_MOON_IN_CLOCK_TOWER:
case GIANT_CUEID_HOLDING_UP_MOON_IN_CLOCK_TOWER:
Animation_Change(&this->skelAnime, &gGiantRaisedArmsStartAnim, 0.0f,
Animation_GetLastFrame(&gGiantRaisedArmsStartAnim) - 1.0f,
Animation_GetLastFrame(&gGiantRaisedArmsStartAnim), ANIMMODE_ONCE, 0.0f);
@ -339,14 +351,16 @@ void EnGiant_ChangeAnimBasedOnCueId(EnGiant* this) {
void EnGiant_UpdateAlpha(EnGiant* this) {
switch (this->cueId) {
case GIANT_CUE_ID_FALLING_OVER:
case GIANT_CUEID_FALLING_OVER:
if (this->skelAnime.curFrame >= 90.0f && this->alpha > 0) {
this->alpha -= 12;
}
break;
case GIANT_CUE_ID_UNKNOWN_14:
case GIANT_CUEID_UNKNOWN_14:
this->alpha -= 12;
break;
default:
if (this->alpha < 255) {
this->alpha += 8;
@ -363,36 +377,37 @@ void EnGiant_UpdateAlpha(EnGiant* this) {
*/
void EnGiant_PlayAndUpdateAnimation(EnGiant* this) {
if (SkelAnime_Update(&this->skelAnime) &&
(this->animIndex != GIANT_ANIM_FALLING_OVER || this->cueId != GIANT_CUE_ID_FALLING_OVER)) {
((this->animIndex != GIANT_ANIM_FALLING_OVER) || (this->cueId != GIANT_CUEID_FALLING_OVER))) {
EnGiant_ChangeAnim(this, this->animIndex);
switch (this->cueId) {
case GIANT_CUE_ID_LOOKING_UP:
case GIANT_CUEID_LOOKING_UP:
EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_LOOK_UP_START);
break;
case GIANT_CUE_ID_RAISING_ARMS:
case GIANT_CUEID_RAISING_ARMS:
EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_RAISED_ARMS_START);
break;
case GIANT_CUE_ID_STRUGGLING:
case GIANT_CUEID_STRUGGLING:
EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_STRUGGLE_START);
break;
case GIANT_CUE_ID_FALLING_OVER:
case GIANT_CUEID_FALLING_OVER:
// Unused
EnGiant_ChangeToStartOrLoopAnimation(this, GIANT_ANIM_FALLING_OVER);
break;
case GIANT_CUE_ID_TALKING:
case GIANT_CUEID_TALKING:
EnGiant_ChangeAnim(this, GIANT_ANIM_BIG_CALL_LOOP);
break;
case GIANT_CUE_ID_DONE_TALKING:
case GIANT_CUE_ID_PLAYER_LEARNED_OATH_TO_ORDER:
case GIANT_CUEID_DONE_TALKING:
case GIANT_CUEID_PLAYER_LEARNED_OATH_TO_ORDER:
EnGiant_ChangeAnim(this, GIANT_ANIM_IDLE_LOOP);
break;
case GIANT_CUE_ID_TEACHING_OATH_TO_ORDER:
case GIANT_CUEID_TEACHING_OATH_TO_ORDER:
EnGiant_ChangeAnim(this, GIANT_ANIM_SMALL_CALL_LOOP);
break;
@ -445,7 +460,7 @@ void EnGiant_PerformClockTowerSuccessActions(EnGiant* this, PlayState* play) {
}
EnGiant_PlaySound(this);
if (this->cueId == GIANT_CUE_ID_STRUGGLING) {
if (this->cueId == GIANT_CUEID_STRUGGLING) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_IT_KYOJIN_BEARING - SFX_FLAG);
}
EnGiant_PlayAndUpdateAnimation(this);

View File

@ -5,7 +5,6 @@
*/
#include "z_en_ginko_man.h"
#include "objects/object_boj/object_boj.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@ -47,15 +46,16 @@ typedef enum {
/* 1 */ GINKO_ANIM_SITTING,
/* 2 */ GINKO_ANIM_REACHING,
/* 3 */ GINKO_ANIM_AMAZED,
/* 4 */ GINKO_ANIM_ADVERTISING
/* 4 */ GINKO_ANIM_ADVERTISING, // looking around for customers
/* 5 */ GINKO_ANIM_MAX
} GinkoAnimation;
static AnimationInfo sAnimationInfo[] = {
{ &object_boj_Anim_0008C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
{ &object_boj_Anim_0043F0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
{ &object_boj_Anim_004F40, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f },
{ &object_boj_Anim_000AC4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // looking around for customers
{ &object_boj_Anim_004A7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f },
static AnimationInfo sAnimationInfo[GINKO_ANIM_MAX] = {
{ &object_boj_Anim_0008C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_LEGSMACKING
{ &object_boj_Anim_0043F0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_SITTING
{ &object_boj_Anim_004F40, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // GINKO_ANIM_REACHING
{ &object_boj_Anim_000AC4, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_AMAZED
{ &object_boj_Anim_004A7C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // GINKO_ANIM_ADVERTISING
};
void EnGinkoMan_Init(Actor* thisx, PlayState* play) {
@ -71,7 +71,7 @@ void EnGinkoMan_Init(Actor* thisx, PlayState* play) {
this->choiceDepositWithdrawl = GINKOMAN_CHOICE_RESET;
this->serviceFee = 0;
SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_00C240, &object_boj_Anim_0043F0, this->jointTable,
this->morphTable, 16);
this->morphTable, OBJECT_BOJ_LIMB_MAX);
EnGinkoMan_SetupIdle(this);
}
@ -172,7 +172,7 @@ void EnGinkoMan_DepositDialogue(EnGinkoMan* this, PlayState* play) {
SET_WEEKEVENTREG(WEEKEVENTREG_59_40);
Message_StartTextbox(play, 0x45B, &this->actor);
this->curTextId = 0x45B;
} else if ((HS_GET_BANK_RUPEES() >= 1000) && ((this->previousBankValue) < 1000) &&
} else if ((HS_GET_BANK_RUPEES() >= 1000) && (this->previousBankValue < 1000) &&
!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_80)) {
SET_WEEKEVENTREG(WEEKEVENTREG_59_80);
Message_StartTextbox(play, 0x45C, &this->actor);
@ -664,16 +664,16 @@ void EnGinkoMan_Update(Actor* thisx, PlayState* play) {
s32 EnGinkoMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnGinkoMan* this = THIS;
if (limbIndex == 15) {
if (limbIndex == OBJECT_BOJ_LIMB_0F) {
*dList = object_boj_DL_00B1D8;
}
if (limbIndex == 15) {
if (limbIndex == OBJECT_BOJ_LIMB_0F) {
Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateXS(this->limb15Rot.y, MTXMODE_APPLY);
Matrix_RotateZS(this->limb15Rot.x, MTXMODE_APPLY);
Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} else if (limbIndex == 8) {
} else if (limbIndex == OBJECT_BOJ_LIMB_08) {
Matrix_RotateXS(-this->limb8Rot.y, MTXMODE_APPLY);
Matrix_RotateZS(-this->limb8Rot.x, MTXMODE_APPLY);
}

View File

@ -2,6 +2,7 @@
#define Z_EN_GINKO_MAN_H
#include "global.h"
#include "objects/object_boj/object_boj.h"
struct EnGinkoMan;
@ -11,8 +12,8 @@ typedef struct EnGinkoMan {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ EnGinkoManActionFunc actionFunc;
/* 0x18C */ Vec3s jointTable[0x10];
/* 0x1EC */ Vec3s morphTable[0x10];
/* 0x18C */ Vec3s jointTable[OBJECT_BOJ_LIMB_MAX];
/* 0x1EC */ Vec3s morphTable[OBJECT_BOJ_LIMB_MAX];
/* 0x24C */ Vec3s limb15Rot;
/* 0x252 */ Vec3s limb8Rot;
/* 0x258 */ s16 curTextId;

View File

@ -5,7 +5,6 @@
*/
#include "z_en_gk.h"
#include "objects/object_gk/object_gk.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@ -102,14 +101,38 @@ static DamageTable sDamageTable = {
/* Powder Keg */ DMG_ENTRY(0, 0x0),
};
static AnimationInfo sAnimationInfo[] = {
{ &object_gk_Anim_00787C, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_007DC4, 1.0f, 0.0f, 0.0f, 2, 0.0f },
{ &object_gk_Anim_0092C0, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_005EDC, 1.0f, 0.0f, 0.0f, 0, 0.0f },
{ &object_gk_Anim_009638, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_008774, 1.0f, 0.0f, 0.0f, 0, 0.0f },
{ &object_gk_Anim_00AE34, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_00BD90, 1.0f, 0.0f, 0.0f, 2, 0.0f },
{ &object_gk_Anim_00C308, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_009858, 1.0f, 0.0f, 0.0f, 2, 0.0f },
{ &object_gk_Anim_009D88, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &object_gk_Anim_00A21C, 1.0f, 0.0f, 0.0f, 2, 0.0f },
{ &object_gk_Anim_00AAEC, 1.0f, 0.0f, 0.0f, 0, 0.0f },
typedef enum {
/* -1 */ ENGK_ANIM_NONE = -1,
/* 0x0 */ ENGK_ANIM_0,
/* 0x1 */ ENGK_ANIM_1,
/* 0x2 */ ENGK_ANIM_2,
/* 0x3 */ ENGK_ANIM_3,
/* 0x4 */ ENGK_ANIM_4,
/* 0x5 */ ENGK_ANIM_5,
/* 0x6 */ ENGK_ANIM_6,
/* 0x7 */ ENGK_ANIM_7,
/* 0x8 */ ENGK_ANIM_8,
/* 0x9 */ ENGK_ANIM_9,
/* 0xA */ ENGK_ANIM_10,
/* 0xB */ ENGK_ANIM_11,
/* 0xC */ ENGK_ANIM_12,
/* 0xD */ ENGK_ANIM_MAX
} EnGkAnimation;
static AnimationInfo sAnimationInfo[ENGK_ANIM_MAX] = {
{ &object_gk_Anim_00787C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_0
{ &object_gk_Anim_007DC4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_1
{ &object_gk_Anim_0092C0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_2
{ &object_gk_Anim_005EDC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_3
{ &object_gk_Anim_009638, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_4
{ &object_gk_Anim_008774, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_5
{ &object_gk_Anim_00AE34, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_6
{ &object_gk_Anim_00BD90, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_7
{ &object_gk_Anim_00C308, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_8
{ &object_gk_Anim_009858, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_9
{ &object_gk_Anim_009D88, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_10
{ &object_gk_Anim_00A21C, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // ENGK_ANIM_11
{ &object_gk_Anim_00AAEC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // ENGK_ANIM_12
};
Color_RGBA8 D_80B533A0 = { 255, 255, 255, 255 };
@ -124,18 +147,24 @@ u16 func_80B50410(EnGk* this, PlayState* play) {
switch (this->unk_31C) {
case 0xE7A:
return 0xE7B;
case 0xE7B:
return 0xE7C;
case 0xE7C:
return 0xE7D;
case 0xE7D:
return 0xE7E;
case 0xE7E:
return 0xE7F;
case 0xE7F:
SET_WEEKEVENTREG(WEEKEVENTREG_40_80);
this->unk_1E4 |= 1;
return 0xE80;
default:
return 0xE7A;
}
@ -147,16 +176,21 @@ u16 func_80B50410(EnGk* this, PlayState* play) {
switch (this->unk_31C) {
case 0xE82:
return 0xE83;
case 0xE83:
return 0xE7D;
case 0xE7D:
return 0xE7E;
case 0xE7E:
return 0xE7F;
case 0xE7F:
SET_WEEKEVENTREG(WEEKEVENTREG_41_01);
this->unk_1E4 |= 1;
return 0xE80;
default:
return 0xE82;
}
@ -197,10 +231,12 @@ u16 func_80B50410(EnGk* this, PlayState* play) {
switch (this->unk_31C) {
case 0xE85:
return 0xE86;
case 0xE86:
SET_WEEKEVENTREG(WEEKEVENTREG_41_02);
this->unk_1E4 |= 1;
return 0xE87;
default:
return 0xE85;
}
@ -208,9 +244,9 @@ u16 func_80B50410(EnGk* this, PlayState* play) {
this->unk_1E4 |= 1;
return 0xE87;
}
} else {
return 0;
}
return 0;
}
u16 func_80B50710(EnGk* this) {
@ -229,8 +265,10 @@ u16 func_80B50710(EnGk* this) {
this->unk_1E4 |= 0x10;
this->unk_1E4 |= 1;
return 0xE8C;
default:
return 0;
}
return 0;
}
void func_80B507A0(EnGk* this, PlayState* play) {
@ -259,8 +297,8 @@ s32 func_80B50854(EnGk* this, PlayState* play) {
if ((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) &&
(play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY)) {
Flags_SetSwitch(play, ENGK_GET_3F00(&this->actor));
this->unk_2E4 = 3;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3);
this->animIndex = ENGK_ANIM_3;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_3);
this->actionFunc = func_80B521E8;
return true;
}
@ -285,12 +323,13 @@ void func_80B509A8(EnGk* this, PlayState* play) {
this->unk_30C.y += Rand_ZeroOne();
this->unk_30C.z += 2.0f * Rand_Centered();
if (this->unk_2E4 == 0) {
if (this->animIndex == ENGK_ANIM_0) {
sp4C.x = 0.0f;
sp4C.z = 0.0f;
sp4C.y = -1.2f;
phi_s1 = 25;
} else if ((this->unk_2E4 == 2) || (this->unk_2E4 == 9) || (this->unk_2E4 == 10) || (this->unk_2E4 == 11)) {
} else if ((this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_9) ||
(this->animIndex == ENGK_ANIM_10) || (this->animIndex == ENGK_ANIM_11)) {
sp4C.x = 0.0f;
sp4C.z = 0.0f;
sp4C.y = -0.5f;
@ -307,28 +346,28 @@ void func_80B50B38(EnGk* this, PlayState* play) {
s16 i;
s16 temp;
switch (this->unk_2E4) {
case 0:
switch (this->animIndex) {
case ENGK_ANIM_0:
this->unk_2E0 = 3;
for (i = 0; i < 2; i++) {
func_80B509A8(this, play);
}
break;
case 2:
case ENGK_ANIM_2:
this->unk_2E0 = 3;
func_80B509A8(this, play);
break;
case 1:
case 3:
case 12:
case ENGK_ANIM_1:
case ENGK_ANIM_3:
case ENGK_ANIM_12:
this->unk_2E0 = 2;
break;
case 9:
case 10:
case 11:
case ENGK_ANIM_9:
case ENGK_ANIM_10:
case ENGK_ANIM_11:
this->unk_2E0 = 3;
func_80B509A8(this, play);
break;
@ -483,22 +522,22 @@ s32 func_80B5123C(EnGk* this, PlayState* play) {
}
void func_80B51308(EnGk* this, PlayState* play) {
s16 sp1E = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_31A].animation);
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->csAnimIndex].animation);
if ((this->unk_2E4 == 7) && (sp1E == lastFrame)) {
this->unk_2E4 = 8;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 8);
if ((this->animIndex == ENGK_ANIM_7) && (curFrame == endFrame)) {
this->animIndex = ENGK_ANIM_8;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_8);
}
}
void func_80B51398(EnGk* this, PlayState* play) {
s16 sp1E = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[9].animation);
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[9].animation);
if ((this->unk_2E4 == 9) && (sp1E == lastFrame)) {
this->unk_2E4 = 10;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 10);
if ((this->animIndex == ENGK_ANIM_9) && (curFrame == endFrame)) {
this->animIndex = ENGK_ANIM_10;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_10);
}
}
@ -541,35 +580,35 @@ void func_80B51510(EnGk* this, PlayState* play) {
this->cueId = play->csCtx.actorCues[cueChannel]->id;
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
this->unk_31A = 0;
this->unk_2E4 = 0;
this->csAnimIndex = ENGK_ANIM_0;
this->animIndex = ENGK_ANIM_0;
break;
case 2:
this->unk_31A = 2;
this->unk_2E4 = 2;
this->csAnimIndex = ENGK_ANIM_2;
this->animIndex = ENGK_ANIM_2;
break;
case 3:
this->unk_31A = 7;
this->unk_2E4 = 7;
this->csAnimIndex = ENGK_ANIM_7;
this->animIndex = ENGK_ANIM_7;
break;
case 4:
this->unk_31A = 3;
this->unk_2E4 = 3;
this->csAnimIndex = ENGK_ANIM_3;
this->animIndex = ENGK_ANIM_3;
break;
case 5:
this->unk_31A = 1;
this->unk_2E4 = 1;
this->csAnimIndex = ENGK_ANIM_1;
this->animIndex = ENGK_ANIM_1;
this->unk_1E4 |= 0x80;
this->actionFunc = func_80B5227C;
break;
case 6:
this->unk_31A = 12;
this->unk_2E4 = 12;
this->csAnimIndex = ENGK_ANIM_12;
this->animIndex = ENGK_ANIM_12;
break;
case 7:
@ -579,10 +618,10 @@ void func_80B51510(EnGk* this, PlayState* play) {
default:
break;
}
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_31A);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->csAnimIndex);
}
if (this->unk_31A == 7) {
if (this->csAnimIndex == ENGK_ANIM_7) {
func_80B51308(this, play);
}
@ -594,41 +633,44 @@ void func_80B51510(EnGk* this, PlayState* play) {
}
void func_80B51698(EnGk* this, PlayState* play) {
s16 sp26 = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (sp26 == lastFrame) {
switch (this->unk_2E4) {
case 0:
this->unk_2E4 = 2;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2);
if (curFrame == endFrame) {
switch (this->animIndex) {
case ENGK_ANIM_0:
this->animIndex = ENGK_ANIM_2;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_2);
this->actionFunc = func_80B5216C;
break;
case 2:
this->unk_2E4 = 0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
case ENGK_ANIM_2:
this->animIndex = ENGK_ANIM_0;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_0);
this->actionFunc = func_80B5202C;
break;
default:
break;
}
}
}
void func_80B51760(EnGk* this, PlayState* play) {
s16 sp2E = this->skelAnime.curFrame;
s16 lastFrame;
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame;
if (this->unk_2E4 == 11) {
lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
if (sp2E == lastFrame) {
this->unk_2E4 = 5;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2E4);
if (this->animIndex == ENGK_ANIM_11) {
endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (curFrame == endFrame) {
this->animIndex = ENGK_ANIM_5;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex);
}
} else if (this->unk_2E4 == 10) {
lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
if (sp2E == lastFrame) {
this->unk_2E4 = 11;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_2E4);
} else if (this->animIndex == ENGK_ANIM_10) {
endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (curFrame == endFrame) {
this->animIndex = ENGK_ANIM_11;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex);
}
} else {
if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) {
@ -643,7 +685,7 @@ void func_80B51760(EnGk* this, PlayState* play) {
Message_StartTextbox(play, this->unk_31C, &this->actor);
this->actionFunc = func_80B51970;
if (this->unk_31C == 0xE81) {
this->unk_2E4 = 0;
this->animIndex = ENGK_ANIM_0;
this->unk_1E4 |= 2;
}
} else if (((this->actor.xzDistToPlayer < 100.0f) || this->actor.isLockedOn) &&
@ -673,7 +715,7 @@ void func_80B51970(EnGk* this, PlayState* play) {
if (this->unk_1E4 & 1) {
this->unk_1E4 &= ~1;
this->unk_1E4 &= ~4;
if (this->unk_2E4 == 10) {
if (this->animIndex == ENGK_ANIM_10) {
this->unk_1E4 &= ~2;
}
this->actionFunc = func_80B51760;
@ -691,10 +733,10 @@ void func_80B51970(EnGk* this, PlayState* play) {
if (this->unk_1E4 & 2) {
Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG);
if (this->unk_2E4 != 10) {
if (this->unk_2E4 != 9) {
this->unk_2E4 = 9;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9);
if (this->animIndex != ENGK_ANIM_10) {
if (this->animIndex != ENGK_ANIM_9) {
this->animIndex = ENGK_ANIM_9;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_9);
} else {
func_80B51398(this, play);
}
@ -703,7 +745,7 @@ void func_80B51970(EnGk* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100);
this->actor.world.rot.y = this->actor.shape.rot.y;
if (this->unk_2E4 == 6) {
if (this->animIndex == ENGK_ANIM_6) {
func_80B50954(this);
}
}
@ -717,7 +759,7 @@ void func_80B51B40(EnGk* this, PlayState* play) {
this->unk_1E4 &= ~1;
this->unk_1E4 &= ~4;
if (this->unk_2E4 == 10) {
if (this->animIndex == ENGK_ANIM_10) {
this->unk_1E4 &= ~2;
}
@ -752,15 +794,18 @@ void func_80B51B40(EnGk* this, PlayState* play) {
this->unk_31C = 0xE8A;
Message_StartTextbox(play, this->unk_31C, &this->actor);
break;
default:
break;
}
}
if (this->unk_1E4 & 2) {
Audio_PlaySfx_AtFixedPos(&this->actor.projectedPos, NA_SE_EN_GOLON_KID_CRY - SFX_FLAG);
if (this->unk_2E4 != 10) {
if (this->unk_2E4 != 9) {
this->unk_2E4 = 9;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9);
if (this->animIndex != ENGK_ANIM_10) {
if (this->animIndex != ENGK_ANIM_9) {
this->animIndex = ENGK_ANIM_9;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_9);
} else {
func_80B51398(this, play);
}
@ -778,8 +823,8 @@ void func_80B51D9C(EnGk* this, PlayState* play) {
CutsceneManager_StartWithPlayerCsAndSetFlag(this->csId, &this->actor);
if (this->unk_1E4 & 4) {
this->unk_1E4 &= ~4;
this->unk_2E4 = 6;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 6);
this->animIndex = ENGK_ANIM_6;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_6);
this->actionFunc = func_80B51EA4;
} else {
this->unk_1E4 |= 4;
@ -880,21 +925,21 @@ void func_80B5216C(EnGk* this, PlayState* play) {
}
void func_80B521E8(EnGk* this, PlayState* play) {
s16 sp1E = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if (sp1E == lastFrame) {
this->unk_2E4 = 1;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
if (curFrame == endFrame) {
this->animIndex = ENGK_ANIM_1;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_1);
this->actionFunc = func_80B5227C;
}
}
void func_80B5227C(EnGk* this, PlayState* play) {
s16 sp26 = this->skelAnime.curFrame;
s16 lastFrame = Animation_GetLastFrame(sAnimationInfo[this->unk_2E4].animation);
s16 curFrame = this->skelAnime.curFrame;
s16 endFrame = Animation_GetLastFrame(sAnimationInfo[this->animIndex].animation);
if ((sp26 + 1) == lastFrame) {
if (curFrame == (endFrame - 1)) {
func_800B14D4(play, 20.0f, &this->actor.home.pos);
this->unk_350 = 60;
if (!(this->unk_1E4 & 0x80)) {
@ -948,6 +993,9 @@ void func_80B52430(EnGk* this, PlayState* play) {
this->unk_1E4 &= ~4;
this->actionFunc = func_80B51760;
return;
default:
break;
}
}
@ -1005,7 +1053,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) {
EnGk* this = THIS;
SkelAnime_InitFlex(play, &this->skelAnime, &object_gk_Skel_0079C0, &object_gk_Anim_00787C, this->jointTable,
this->morphTable, 20);
this->morphTable, OBJECT_GK_LIMB_MAX);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
@ -1019,16 +1067,16 @@ void EnGk_Init(Actor* thisx, PlayState* play) {
this->actor.gravity = -1.0f;
if (ENGK_GET_F(&this->actor) == ENGK_F_1) {
this->unk_2E4 = 5;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5);
this->animIndex = ENGK_ANIM_5;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_5);
if (play->sceneId == SCENE_17SETUGEN2) {
if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) {
Actor_Kill(&this->actor);
} else {
this->csId = this->actor.csId;
this->path = SubS_GetPathByIndex(play, ENGK_GET_PATH_INDEX(&this->actor), ENGK_PATH_INDEX_NONE);
this->actionFunc = func_80B51760;
return;
}
this->csId = this->actor.csId;
this->path = SubS_GetPathByIndex(play, ENGK_GET_PATH_INDEX(&this->actor), ENGK_PATH_INDEX_NONE);
this->actionFunc = func_80B51760;
} else if (play->sceneId == SCENE_GORONRACE) {
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) {
if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) {
@ -1054,11 +1102,11 @@ void EnGk_Init(Actor* thisx, PlayState* play) {
Actor_Kill(&this->actor);
}
} else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_CALMED_GORON_ELDERS_SON)) {
this->unk_2E4 = 0;
this->animIndex = ENGK_ANIM_0;
this->csId = this->actor.csId;
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_2000000;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENGK_ANIM_0);
this->actionFunc = func_80B5202C;
} else {
this->actionFunc = func_80B52654;
@ -1111,7 +1159,7 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
sp28.x = 1100.0f;
sp28.z = -500.0f;
if (this->unk_2E4 == 0) {
if (this->animIndex == ENGK_ANIM_0) {
sp34.y = -100.0f;
sp28.y = -100.0f;
@ -1121,7 +1169,8 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
sp4C = sp40;
sp4C.x *= -1.0f;
} else if ((this->unk_2E4 == 2) || (this->unk_2E4 == 9) || (this->unk_2E4 == 10) || (this->unk_2E4 == 11)) {
} else if ((this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_9) ||
(this->animIndex == ENGK_ANIM_10) || (this->animIndex == ENGK_ANIM_11)) {
sp34.y = 400.0f;
sp28.y = 400.0f;
@ -1133,7 +1182,7 @@ void EnGk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
sp4C.x *= -1.0f;
}
if (limbIndex == 17) {
if (limbIndex == OBJECT_GK_LIMB_11) {
if (ENGK_GET_F(&this->actor) == ENGK_F_1) {
phi_f0 = 100.0f;
} else {
@ -1164,7 +1213,7 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
s32 phi_v1;
switch (limbIndex) {
case 18:
case OBJECT_GK_LIMB_12:
if (this->unk_1E4 & 8) {
phi_v1 = true;
} else {
@ -1191,7 +1240,7 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
Matrix_Push();
break;
case 9:
case OBJECT_GK_LIMB_09:
if (this->unk_1E4 & 8) {
phi_v1 = true;
} else {
@ -1216,6 +1265,9 @@ void EnGk_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
Matrix_Push();
break;
default:
break;
}
}
@ -1260,8 +1312,9 @@ void EnGk_Draw(Actor* thisx, PlayState* play) {
if (ENGK_GET_F(&this->actor) != ENGK_F_2) {
Gfx_SetupDL25_Xlu(play->state.gfxCtx);
if ((this->unk_2E4 == 0) || (this->unk_2E4 == 1) || (this->unk_2E4 == 2) || (this->unk_2E4 == 3) ||
(this->unk_2E4 == 4)) {
if ((this->animIndex == ENGK_ANIM_0) || (this->animIndex == ENGK_ANIM_1) ||
(this->animIndex == ENGK_ANIM_2) || (this->animIndex == ENGK_ANIM_3) ||
(this->animIndex == ENGK_ANIM_4)) {
pos.x = this->actor.world.pos.x - 15.0f;
pos.y = this->actor.world.pos.y;
pos.z = this->actor.world.pos.z;

View File

@ -2,6 +2,7 @@
#define Z_EN_GK_H
#include "global.h"
#include "objects/object_gk/object_gk.h"
struct EnGk;
@ -32,17 +33,17 @@ typedef struct EnGk {
/* 0x1E4 */ u16 unk_1E4;
/* 0x1E8 */ Path* path;
/* 0x1EC */ s32 unk_1EC;
/* 0x1F0 */ Vec3s jointTable[20];
/* 0x1F0 */ Vec3s morphTable[20];
/* 0x1F0 */ Vec3s jointTable[OBJECT_GK_LIMB_MAX];
/* 0x1F0 */ Vec3s morphTable[OBJECT_GK_LIMB_MAX];
/* 0x2E0 */ s16 unk_2E0;
/* 0x2E2 */ s16 unk_2E2;
/* 0x2E4 */ s16 unk_2E4;
/* 0x2E4 */ s16 animIndex;
/* 0x2E8 */ Vec3f unk_2E8;
/* 0x2F4 */ Vec3f unk_2F4;
/* 0x300 */ Vec3f unk_300;
/* 0x30C */ Vec3f unk_30C;
/* 0x318 */ s16 csId;
/* 0x31A */ u8 unk_31A;
/* 0x31A */ u8 csAnimIndex;
/* 0x31B */ u8 cueId;
/* 0x31C */ u16 unk_31C;
/* 0x31E */ s16 unk_31E;

View File

@ -6,7 +6,6 @@
#include "z_en_gm.h"
#include "overlays/actors/ovl_En_Door/z_en_door.h"
#include "objects/object_in2/object_in2.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@ -209,20 +208,38 @@ static ColliderSphereInit sSphereInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
static AnimationInfoS sAnimationInfo[] = {
{ &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in2_Anim_00A5E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in2_Anim_00A70C, 1.0f, 0, 1, ANIMMODE_LOOP, 0 },
{ &object_in2_Anim_008090, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in2_Anim_00898C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
{ &object_in2_Anim_009450, 1.0f, 0, -1, ANIMMODE_ONCE, -4 },
{ &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
{ &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in2_Anim_00B8B0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 },
{ &object_in2_Anim_00BA80, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in2_Anim_00C03C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
{ &object_in2_Anim_00B990, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
typedef enum {
/* -1 */ ENGM_ANIM_NONE = -1,
/* 0x0 */ ENGM_ANIM_0,
/* 0x1 */ ENGM_ANIM_1,
/* 0x2 */ ENGM_ANIM_2,
/* 0x3 */ ENGM_ANIM_3,
/* 0x4 */ ENGM_ANIM_4,
/* 0x5 */ ENGM_ANIM_5,
/* 0x6 */ ENGM_ANIM_6,
/* 0x7 */ ENGM_ANIM_7,
/* 0x8 */ ENGM_ANIM_8,
/* 0x9 */ ENGM_ANIM_9,
/* 0xA */ ENGM_ANIM_10,
/* 0xB */ ENGM_ANIM_11,
/* 0xC */ ENGM_ANIM_12,
/* 0xD */ ENGM_ANIM_MAX
} EnGmAnimation;
static AnimationInfoS sAnimationInfo[ENGM_ANIM_MAX] = {
{ &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_0
{ &object_in2_Anim_009CDC, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_1
{ &object_in2_Anim_00A5E0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_2
{ &object_in2_Anim_00A70C, 1.0f, 0, 1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_3
{ &object_in2_Anim_008090, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_4
{ &object_in2_Anim_00898C, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGM_ANIM_5
{ &object_in2_Anim_009450, 1.0f, 0, -1, ANIMMODE_ONCE, -4 }, // ENGM_ANIM_6
{ &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // ENGM_ANIM_7
{ &object_in2_Anim_00AD18, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_8
{ &object_in2_Anim_00B8B0, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // ENGM_ANIM_9
{ &object_in2_Anim_00BA80, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_10
{ &object_in2_Anim_00C03C, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_11
{ &object_in2_Anim_00B990, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_12
};
Actor* func_8094DEE0(EnGm* this, PlayState* play, u8 arg2, s16 arg3) {
@ -286,43 +303,43 @@ EnDoor* func_8094DF90(PlayState* play, s32 arg1) {
return SubS_FindDoor(play, phi_a1);
}
s32 func_8094DFF8(EnGm* this, PlayState* play) {
s32 ret = false;
s32 EnGm_UpdateSkelAnime(EnGm* this, PlayState* play) {
s32 isAnimFinished = false;
if (this->unk_262 < 0) {
return false;
}
if (this->unk_262 >= 0) {
this->skelAnime.playSpeed = this->unk_3A8;
ret = SkelAnime_Update(&this->skelAnime);
this->skelAnime.playSpeed = this->animPlaySpeed;
isAnimFinished = SkelAnime_Update(&this->skelAnime);
}
return ret;
return isAnimFinished;
}
s32 func_8094E054(EnGm* this, PlayState* play, s32 arg2) {
s32 EnGm_ChangeAnim(EnGm* this, PlayState* play, s32 animIndex) {
s8 tmp = this->unk_262;
s32 phi_v1 = false;
s32 ret = false;
s32 changeAnim = false;
s32 didAnimChange = false;
if ((arg2 == 0) || (arg2 == 1)) {
if ((this->unk_3E8 != 0) && (this->unk_3E8 != 1)) {
phi_v1 = true;
if ((animIndex == ENGM_ANIM_0) || (animIndex == ENGM_ANIM_1)) {
if ((this->animIndex != ENGM_ANIM_0) && (this->animIndex != ENGM_ANIM_1)) {
changeAnim = true;
}
} else if (arg2 != this->unk_3E8) {
phi_v1 = true;
} else if (this->animIndex != animIndex) {
changeAnim = true;
}
if (phi_v1) {
if (changeAnim) {
if (tmp >= 0) {
this->unk_3E8 = arg2;
ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, arg2);
this->unk_3A8 = this->skelAnime.playSpeed;
this->animIndex = animIndex;
didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
this->animPlaySpeed = this->skelAnime.playSpeed;
}
}
return ret;
return didAnimChange;
}
s32 func_8094E0F8(EnGm* this, PlayState* play) {
@ -486,6 +503,9 @@ s32 func_8094E52C(EnGm* this, PlayState* play) {
this->unk_3E0++;
ret = true;
break;
default:
break;
}
return ret;
@ -502,7 +522,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) {
switch (this->unk_3E0) {
case 0:
Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL);
func_8094E054(this, play, 2);
EnGm_ChangeAnim(this, play, ENGM_ANIM_2);
this->unk_3E2 = 0;
this->unk_3E0++;
break;
@ -558,6 +578,7 @@ s32 func_8094E69C(EnGm* this, PlayState* play) {
this->unk_3E2 = 0;
this->unk_3E0++;
break;
case 9:
sp48 = this->actor.world.rot.y;
this->unk_3E2++;
@ -565,13 +586,16 @@ s32 func_8094E69C(EnGm* this, PlayState* play) {
Math_ApproachS(&this->actor.shape.rot.y, sp48, 3, 0x2AA8);
this->unk_3A4 &= ~0x20;
} else {
func_8094E054(this, play, 1);
EnGm_ChangeAnim(this, play, ENGM_ANIM_1);
this->actor.shape.rot.y = sp48;
this->unk_3E0++;
this->unk_3E2 = 0;
ret = true;
}
break;
default:
break;
}
return ret;
}
@ -639,7 +663,7 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) {
break;
}
Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL);
func_8094E054(this, play, 2);
EnGm_ChangeAnim(this, play, ENGM_ANIM_2);
this->unk_3E2 = 0;
this->unk_3E0++;
@ -669,7 +693,7 @@ s32 func_8094EB1C(EnGm* this, PlayState* play) {
Math_ApproachS(&this->actor.shape.rot.y, oldYaw, 3, 0x2AA8);
this->unk_3A4 &= ~0x20;
} else {
func_8094E054(this, play, 1);
EnGm_ChangeAnim(this, play, ENGM_ANIM_1);
this->actor.shape.rot.y = oldYaw;
this->unk_3E2 = 0;
this->unk_3E0++;
@ -763,7 +787,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) {
if (play->csCtx.state != CS_STATE_IDLE) {
if (this->unk_3F8 == 0) {
if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.sceneLayer == 2)) {
func_8094E054(this, play, 0);
EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
this->unk_258 = 255;
}
this->cueId = 255;
@ -879,9 +903,9 @@ void func_8094F3D0(EnGm* this, PlayState* play) {
}
s32 func_8094F4EC(EnGm* this, PlayState* play) {
if ((this->unk_258 != 6) && (this->unk_3E8 == 12)) {
if ((this->unk_258 != 6) && (this->animIndex == ENGM_ANIM_12)) {
this->unk_3A4 &= ~0x2000;
func_8094E054(this, play, 8);
EnGm_ChangeAnim(this, play, ENGM_ANIM_8);
}
return true;
}
@ -897,30 +921,30 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
if (this->unk_3A6 != sp32) {
switch (sp32) {
case 0x2B13:
func_8094E054(this, play, 2);
EnGm_ChangeAnim(this, play, ENGM_ANIM_2);
break;
case 0x2B14:
case 0x2B18:
func_8094E054(this, play, 0);
EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
break;
case 0x2B16:
func_8094E054(this, play, 1);
EnGm_ChangeAnim(this, play, ENGM_ANIM_1);
break;
case 0x2B15:
func_8094E054(this, play, 5);
EnGm_ChangeAnim(this, play, ENGM_ANIM_5);
break;
case 0x2B17:
func_8094E054(this, play, 6);
EnGm_ChangeAnim(this, play, ENGM_ANIM_6);
break;
default:
if ((this->unk_3E8 == 7) || (this->unk_3E8 == 8)) {
if ((this->animIndex == ENGM_ANIM_7) || (this->animIndex == ENGM_ANIM_8)) {
this->unk_3A4 |= 0x2000;
func_8094E054(this, play, 12);
EnGm_ChangeAnim(this, play, ENGM_ANIM_12);
}
break;
}
@ -941,6 +965,9 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
this->unk_268 = toto;
}
break;
default:
break;
}
if (sp32 == 0x2AA8) {
@ -963,7 +990,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
this->unk_18C(this, play);
}
if ((this->unk_3E8 == 6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) &&
if ((this->animIndex == ENGM_ANIM_6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) &&
Animation_OnFrame(&this->skelAnime, 20.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EV_HANKO);
}
@ -1039,7 +1066,7 @@ s32 func_8094F904(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
this->unk_3A4 |= 0x100;
this->unk_3A4 |= 0x200;
func_8094E054(this, play, 7);
EnGm_ChangeAnim(this, play, ENGM_ANIM_7);
this->actor.gravity = 0.0f;
ret = true;
}
@ -1087,7 +1114,7 @@ s32 func_8094FAC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3A4 |= 0x100;
this->unk_3A4 |= 0x200;
func_8094E054(this, play, 7);
EnGm_ChangeAnim(this, play, ENGM_ANIM_7);
this->actor.gravity = -1.0f;
ret = true;
}
@ -1102,9 +1129,9 @@ s32 func_8094FCC4(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
if (this->unk_258 == 0) {
Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D90);
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
func_8094E054(this, play, 0);
EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
} else {
func_8094E054(this, play, 9);
EnGm_ChangeAnim(this, play, ENGM_ANIM_9);
this->skelAnime.moveFlags = ANIM_FLAG_NOMOVE;
}
this->unk_3A4 |= 0x100;
@ -1118,7 +1145,7 @@ s32 func_8094FD88(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
s32 ret = false;
if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) {
func_8094E054(this, play, 11);
EnGm_ChangeAnim(this, play, ENGM_ANIM_11);
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3A4 |= 0x100;
this->unk_3A4 |= 0x200;
@ -1134,7 +1161,7 @@ s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL);
if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) &&
(al->update != NULL)) {
func_8094E054(this, play, 11);
EnGm_ChangeAnim(this, play, ENGM_ANIM_11);
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_268 = al;
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_86_20)) {
@ -1176,11 +1203,11 @@ s32 func_8094FF04(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->unk_3C8 = 4;
this->unk_3CA = 4;
this->unk_3CC = 8;
func_8094E054(this, play, 0);
EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
func_8094E278(play);
} else {
Math_Vec3f_Copy(&this->actor.world.pos, &sp30);
func_8094E054(this, play, 9);
EnGm_ChangeAnim(this, play, ENGM_ANIM_9);
this->skelAnime.moveFlags = ANIM_FLAG_NOMOVE;
}
this->unk_400 = 0;
@ -1202,7 +1229,7 @@ s32 func_80950088(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3A4 |= (0x2000 | 0x100);
this->unk_3A4 |= 0x200;
func_8094E054(this, play, 12);
EnGm_ChangeAnim(this, play, ENGM_ANIM_12);
return true;
}
@ -1217,7 +1244,7 @@ s32 func_80950120(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3A4 |= (0x800 | 0x100);
this->unk_3A4 |= 0x200;
func_8094E054(this, play, 4);
EnGm_ChangeAnim(this, play, ENGM_ANIM_4);
return true;
}
@ -1238,7 +1265,7 @@ s32 func_809501B8(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) {
this->unk_3CC = 8;
this->actor.targetMode = TARGET_MODE_6;
this->unk_3B4 = 60.0f;
func_8094E054(this, play, 10);
EnGm_ChangeAnim(this, play, ENGM_ANIM_10);
return true;
}
@ -1334,11 +1361,11 @@ s32 func_80950388(EnGm* this, PlayState* play) {
s32 func_809503F8(EnGm* this, PlayState* play) {
s32 pad;
if (this->unk_3E8 == 9) {
if (this->animIndex == ENGM_ANIM_9) {
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
func_8094E054(this, play, 0);
EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
} else {
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
}
@ -1348,7 +1375,8 @@ s32 func_809503F8(EnGm* this, PlayState* play) {
s32 func_80950490(EnGm* this, PlayState* play) {
static s32 D_80951DE4[] = {
1, 5, 5, 1, 6, 5, 1, 5, 6, 1, 5, 6,
ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_5, ENGM_ANIM_1, ENGM_ANIM_6, ENGM_ANIM_5,
ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_6, ENGM_ANIM_1, ENGM_ANIM_5, ENGM_ANIM_6,
};
s32 pad;
@ -1358,32 +1386,32 @@ s32 func_80950490(EnGm* this, PlayState* play) {
this->unk_3CA = 1;
this->unk_3CC = 8;
this->unk_400 = 1;
func_8094E054(this, play, 3);
EnGm_ChangeAnim(this, play, ENGM_ANIM_3);
}
return false;
}
this->unk_400 = 0;
switch (this->unk_3E8) {
case 9:
switch (this->animIndex) {
case ENGM_ANIM_9:
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK);
this->unk_3C8 = 4;
this->unk_3CA = 4;
this->unk_3CC = 8;
func_8094E054(this, play, 0);
EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
func_8094E278(play);
} else {
AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f);
}
break;
case 5:
case 6:
case ENGM_ANIM_5:
case ENGM_ANIM_6:
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
func_8094E054(this, play, D_80951DE4[this->unk_3F4]);
EnGm_ChangeAnim(this, play, D_80951DE4[this->unk_3F4]);
this->unk_3F4++;
this->unk_3F4 %= 12;
this->unk_3DE = Rand_S16Offset(30, 30);
@ -1392,7 +1420,7 @@ s32 func_80950490(EnGm* this, PlayState* play) {
default:
if (DECR(this->unk_3DE) == 0) {
func_8094E054(this, play, D_80951DE4[this->unk_3F4]);
EnGm_ChangeAnim(this, play, D_80951DE4[this->unk_3F4]);
this->unk_3F4++;
this->unk_3F4 %= 12;
this->unk_3DE = Rand_S16Offset(30, 30);
@ -1433,6 +1461,7 @@ s32 func_80950690(EnGm* this, PlayState* play) {
break;
case 8:
default:
break;
}
@ -1574,6 +1603,9 @@ void func_80950C24(EnGm* this, PlayState* play) {
case 30:
func_8095097C(this, play);
break;
default:
break;
}
Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x2AA8);
@ -1629,7 +1661,7 @@ void func_80950DB8(EnGm* this, PlayState* play) {
}
void func_80950F2C(EnGm* this, PlayState* play) {
s32 sp50[] = { 0, 0, 3, 2 };
s32 csAnimIndex[] = { ENGM_ANIM_0, ENGM_ANIM_0, ENGM_ANIM_3, ENGM_ANIM_2 };
Player* player = GET_PLAYER(play);
s32 pad;
Vec3f sp3C;
@ -1644,7 +1676,7 @@ void func_80950F2C(EnGm* this, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_EV_CHAIR_ROLL);
}
this->cueId = cueId;
func_8094E054(this, play, sp50[cueId]);
EnGm_ChangeAnim(this, play, csAnimIndex[cueId]);
}
if ((this->cueId == 3) && (this->unk_268 != NULL) && (this->unk_268->update != NULL)) {
@ -1670,9 +1702,10 @@ void EnGm_Init(Actor* thisx, PlayState* play) {
}
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &object_in2_Skel_0078B0, NULL, this->jointTable, this->morphTable, 20);
this->unk_3E8 = -1;
func_8094E054(this, play, 0);
SkelAnime_InitFlex(play, &this->skelAnime, &object_in2_Skel_0078B0, NULL, this->jointTable, this->morphTable,
OBJECT_IN2_LIMB_MAX);
this->animIndex = ENGM_ANIM_NONE;
EnGm_ChangeAnim(this, play, ENGM_ANIM_0);
Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInit);
Collider_InitAndSetSphere(play, &this->colliderSphere, &this->actor, &sSphereInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
@ -1698,7 +1731,7 @@ void EnGm_Update(Actor* thisx, PlayState* play) {
if (!func_8094E0F8(this, play)) {
if (!func_8094EE84(this, play) && func_8094EFC4(this, play)) {
func_80950F2C(this, play);
func_8094DFF8(this, play);
EnGm_UpdateSkelAnime(this, play);
func_8094E2D0(this);
return;
}
@ -1708,7 +1741,7 @@ void EnGm_Update(Actor* thisx, PlayState* play) {
func_8094F53C(this, play);
if (this->unk_258 != 0) {
func_8094DFF8(this, play);
EnGm_UpdateSkelAnime(this, play);
func_8094E2D0(this);
func_8094F2E8(this);
SubS_Offer(&this->actor, play, this->unk_3B4, 30.0f, PLAYER_IA_NONE, this->unk_3A4 & SUBS_OFFER_MODE_MASK);
@ -1726,20 +1759,20 @@ s32 EnGm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
EnGm* this = THIS;
s32 fidgetIndex;
if (limbIndex == 16) {
if (limbIndex == OBJECT_IN2_LIMB_10) {
func_8094F3D0(this, play);
}
switch (limbIndex) {
case 9:
case OBJECT_IN2_LIMB_09:
fidgetIndex = 0;
break;
case 10:
case OBJECT_IN2_LIMB_0A:
fidgetIndex = 1;
break;
case 13:
case OBJECT_IN2_LIMB_0D:
fidgetIndex = 2;
break;
@ -1763,20 +1796,20 @@ void EnGm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Vec3f sp30;
s32 pad2;
if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (limbIndex == 16)) {
if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (limbIndex == OBJECT_IN2_LIMB_10)) {
Matrix_MultVec3f(&D_80951E24, &this->actor.focus.pos);
Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot);
}
OPEN_DISPS(play->state.gfxCtx);
if ((limbIndex == 15) && (this->unk_3A4 & 0x800)) {
if ((limbIndex == OBJECT_IN2_LIMB_0F) && (this->unk_3A4 & 0x800)) {
gSPDisplayList(POLY_OPA_DISP++, object_in2_DL_007528);
}
CLOSE_DISPS(play->state.gfxCtx);
if (limbIndex == 9) {
if (limbIndex == OBJECT_IN2_LIMB_09) {
Matrix_MultVec3f(&gZeroVec3f, &sp30);
Math_Vec3f_ToVec3s(&this->colliderSphere.dim.worldSphere.center, &sp30);
}
@ -1799,7 +1832,7 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
overrideRot = false;
}
if (limbIndex == 16) {
if (limbIndex == OBJECT_IN2_LIMB_10) {
SubS_UpdateLimb(BINANG_ADD(this->unk_3BC + this->unk_3C0, 0x4000),
BINANG_ADD(this->unk_3BE + this->unk_3C2 + this->actor.shape.rot.y, 0x4000), &this->unk_290,
&this->unk_2A8, stepRot, overrideRot);
@ -1810,7 +1843,7 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
Matrix_RotateXS(this->unk_2A8.x, MTXMODE_APPLY);
Matrix_RotateZS(this->unk_2A8.z, MTXMODE_APPLY);
Matrix_Push();
} else if (limbIndex == 9) {
} else if (limbIndex == OBJECT_IN2_LIMB_09) {
SubS_UpdateLimb(BINANG_ADD(this->unk_3C0, 0x4000), BINANG_ADD(this->unk_3C2 + this->actor.shape.rot.y, 0x4000),
&this->unk_29C, &this->unk_2AE, stepRot, overrideRot);
Matrix_Pop();
@ -1824,8 +1857,10 @@ void EnGm_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
}
void EnGm_Draw(Actor* thisx, PlayState* play) {
static TexturePtr D_80951E30[] = { object_in2_Tex_0054A8, object_in2_Tex_005028, object_in2_Tex_006828,
object_in2_Tex_005028, object_in2_Tex_005CE8, object_in2_Tex_006C68 };
static TexturePtr D_80951E30[] = {
object_in2_Tex_0054A8, object_in2_Tex_005028, object_in2_Tex_006828,
object_in2_Tex_005028, object_in2_Tex_005CE8, object_in2_Tex_006C68,
};
EnGm* this = THIS;
if ((this->unk_258 != 0) && (this->unk_262 >= 0)) {

View File

@ -2,6 +2,7 @@
#define Z_EN_GM_H
#include "global.h"
#include "objects/object_in2/object_in2.h"
struct EnGm;
@ -42,11 +43,11 @@ typedef struct EnGm {
/* 0x29C */ Vec3f unk_29C;
/* 0x2A8 */ Vec3s unk_2A8;
/* 0x2AE */ Vec3s unk_2AE;
/* 0x2B4 */ Vec3s jointTable[20];
/* 0x32C */ Vec3s morphTable[20];
/* 0x2B4 */ Vec3s jointTable[OBJECT_IN2_LIMB_MAX];
/* 0x32C */ Vec3s morphTable[OBJECT_IN2_LIMB_MAX];
/* 0x3A4 */ u16 unk_3A4;
/* 0x3A6 */ u16 unk_3A6;
/* 0x3A8 */ f32 unk_3A8;
/* 0x3A8 */ f32 animPlaySpeed;
/* 0x3AC */ f32 unk_3AC;
/* 0x3B0 */ f32 unk_3B0;
/* 0x3B4 */ f32 unk_3B4;
@ -69,7 +70,7 @@ typedef struct EnGm {
/* 0x3E0 */ s16 unk_3E0;
/* 0x3E2 */ s16 unk_3E2;
/* 0x3E4 */ EnGmUnkFunc unk_3E4;
/* 0x3E8 */ s32 unk_3E8;
/* 0x3E8 */ s32 animIndex;
/* 0x3EC */ UNK_TYPE1 unk3EC[0x4];
/* 0x3F0 */ s32 prevTalkState;
/* 0x3F4 */ s32 unk_3F4;

View File

@ -82,8 +82,8 @@ typedef enum EnGoEffectType {
/* 7 */ ENGO_EFFECT_STEAM = ENGO_EFFECT_STEAM_MIN
} EnGoEffectType;
typedef enum EnGoAnimationIndex {
/* -1 */ ENGO_ANIM_INVALID = -1,
typedef enum EnGoAnimation {
/* -1 */ ENGO_ANIM_NONE = -1,
/* 0 */ ENGO_ANIM_GORON_MIN,
/* 0 */ ENGO_ANIM_LYINGDOWNIDLE = ENGO_ANIM_GORON_MIN,
/* 1 */ ENGO_ANIM_LYINGDOWNIDLE_IMM,
@ -95,21 +95,21 @@ typedef enum EnGoAnimationIndex {
/* 7 */ ENGO_ANIM_DROPKEG,
/* 8 */ ENGO_ANIM_COVEREARS,
/* 9 */ ENGO_ANIM_SHIVERINGSURPRISED,
/* 10 */ ENGO_ANIM_ATHLETICS_MIN,
/* 10 */ ENGO_ANIM_DOUBLE_ARM_SIDEBEND = ENGO_ANIM_ATHLETICS_MIN,
/* 11 */ ENGO_ANIM_SQUAT_SIDE_TO_SIDE,
/* 12 */ ENGO_ANIM_SHAKE_LIMBS,
/* 13 */ ENGO_ANIM_SINGLE_ARM_SIDEBEND,
/* 14 */ ENGO_ANIM_SITTING_STRETCH,
/* 15 */ ENGO_ANIM_CHEER,
/* 16 */ ENGO_ANIM_SHOUT,
/* 17 */ ENGO_ANIM_HELP_SITTING_STRETCH,
/* 18 */ ENGO_ANIM_SPRING_MIN,
/* 18 */ ENGO_ANIM_SHOW = ENGO_ANIM_SPRING_MIN,
/* 19 */ ENGO_ANIM_SHOW_LOOPED,
/* 20 */ ENGO_ANIM_LOOK_AROUND,
/* 21 */ ENGO_ANIM_LOOK_AROUND_LOOPED
} EnGoAnimationIndex;
/* 10 */ ENGO_ANIM_ATHLETICS_MIN,
/* 10 */ ENGO_ANIM_DOUBLE_ARM_SIDEBEND = ENGO_ANIM_ATHLETICS_MIN,
/* 11 */ ENGO_ANIM_SQUAT_SIDE_TO_SIDE,
/* 12 */ ENGO_ANIM_SHAKE_LIMBS,
/* 13 */ ENGO_ANIM_SINGLE_ARM_SIDEBEND,
/* 14 */ ENGO_ANIM_SITTING_STRETCH,
/* 15 */ ENGO_ANIM_CHEER,
/* 16 */ ENGO_ANIM_SHOUT,
/* 17 */ ENGO_ANIM_HELP_SITTING_STRETCH,
/* 18 */ ENGO_ANIM_SPRING_MIN,
/* 18 */ ENGO_ANIM_SHOW = ENGO_ANIM_SPRING_MIN,
/* 19 */ ENGO_ANIM_SHOW_LOOPED,
/* 20 */ ENGO_ANIM_LOOK_AROUND,
/* 21 */ ENGO_ANIM_LOOK_AROUND_LOOPED
} EnGoAnimation;
void EnGo_Idle(EnGo* this, PlayState* play);
void EnGo_Sleep(EnGo* this, PlayState* play);
@ -309,7 +309,7 @@ static DamageTable sDamageTable = {
/**
* Animations used in the actor.
*
* @see EnGoAnimationIndex
* @see EnGoAnimation
*/
static AnimationInfoS sAnimationInfo[] = {
@ -530,7 +530,7 @@ void EnGo_DrawDust(EnGoEffect effect[ENGO_EFFECT_COUNT], PlayState* play2) {
* @param pos Position around which the effects appear
*/
void EnGo_InitSnow(EnGoEffect effect[ENGO_SNOW_EFFECT_COUNT], Vec3f pos) {
static u8 effectIndexToSnowEffectTable[ENGO_SNOW_EFFECT_COUNT] = {
static u8 sEffectIndexToSnowEffectTable[ENGO_SNOW_EFFECT_COUNT] = {
ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2,
ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2,
ENGO_EFFECT_SNOW3, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW1, ENGO_EFFECT_SNOW2,
@ -570,7 +570,7 @@ void EnGo_InitSnow(EnGoEffect effect[ENGO_SNOW_EFFECT_COUNT], Vec3f pos) {
effect->alphaDenom = effect->alphaNumer = 1;
// Assign a snow effect value of 'ENGO_EFFECT_SNOW1'/'2'/'3'
effect->type = effectIndexToSnowEffectTable[i];
effect->type = sEffectIndexToSnowEffectTable[i];
// Initialize the parameters for the paired element
randRelativeToWorldPos.x = ((Rand_ZeroOne() - 0.5f) * 80.0f) + effect->pos.x;
@ -977,27 +977,27 @@ s32 EnGo_UpdateSpringArrivalCutscene(EnGo* this, PlayState* play) {
*
* @return True if non-repeating animation has finished
*/
s32 EnGo_UpdateAnimationToCurrent(EnGo* this, PlayState* play) {
s32 EnGo_UpdateSkelAnime(EnGo* this, PlayState* play) {
s8 objIndex = this->actor.objBankIndex;
s8 extraObjIndex = -1;
s32 ret = false;
s32 isAnimFinished = false;
if ((this->curAnimIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjIndex >= 0)) {
if ((this->animIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjIndex >= 0)) {
extraObjIndex = this->hakuginDemoObjIndex;
} else if ((this->curAnimIndex >= ENGO_ANIM_ATHLETICS_MIN) && (this->taisouObjIndex >= 0)) {
} else if ((this->animIndex >= ENGO_ANIM_ATHLETICS_MIN) && (this->taisouObjIndex >= 0)) {
extraObjIndex = this->taisouObjIndex;
} else if (this->curAnimIndex < ENGO_ANIM_ATHLETICS_MIN) {
} else if (this->animIndex < ENGO_ANIM_ATHLETICS_MIN) {
extraObjIndex = this->actor.objBankIndex;
}
if (extraObjIndex >= 0) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[extraObjIndex].segment);
this->skelAnime.playSpeed = this->curAnimPlaySpeed;
ret = SkelAnime_Update(&this->skelAnime);
this->skelAnime.playSpeed = this->animPlaySpeed;
isAnimFinished = SkelAnime_Update(&this->skelAnime);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIndex].segment);
}
return ret;
return isAnimFinished;
}
/**
@ -1005,7 +1005,7 @@ s32 EnGo_UpdateAnimationToCurrent(EnGo* this, PlayState* play) {
*/
s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) {
if (play->csCtx.state == CS_STATE_IDLE) {
if (this->curAnimIndex == ENGO_ANIM_ROLL) {
if (this->animIndex == ENGO_ANIM_ROLL) {
if (Animation_OnFrame(&this->skelAnime, 2.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE);
}
@ -1013,7 +1013,7 @@ s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, 22.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_SIT_IMT);
}
} else if ((this->curAnimIndex == ENGO_ANIM_UNROLL) || (this->curAnimIndex == ENGO_ANIM_UNROLL_IMM)) {
} else if ((this->animIndex == ENGO_ANIM_UNROLL) || (this->animIndex == ENGO_ANIM_UNROLL_IMM)) {
if (Animation_OnFrame(&this->skelAnime, 2.0f)) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GOLON_CIRCLE_OFF);
}
@ -1037,10 +1037,10 @@ s32 EnGo_UpdateSfx(EnGo* this, PlayState* play) {
*
* @return True if animation was changed
*/
s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimationIndex animIndex) {
s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimation animIndex) {
s8 objIndex = this->actor.objBankIndex;
s8 extraObjIndex = -1;
s32 ret = false;
s32 didAnimChange = false;
if ((animIndex >= ENGO_ANIM_SPRING_MIN) && (this->hakuginDemoObjIndex >= 0)) {
extraObjIndex = this->hakuginDemoObjIndex;
@ -1052,13 +1052,13 @@ s32 EnGo_ChangeAnim(EnGo* this, PlayState* play, EnGoAnimationIndex animIndex) {
if (extraObjIndex >= 0) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[extraObjIndex].segment);
this->curAnimIndex = animIndex;
ret = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
this->curAnimPlaySpeed = this->skelAnime.playSpeed;
this->animIndex = animIndex;
didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex);
this->animPlaySpeed = this->skelAnime.playSpeed;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objIndex].segment);
}
return ret;
return didAnimChange;
}
/**
@ -1651,7 +1651,7 @@ void EnGo_ChangeToStretchingAnimation(EnGo* this, PlayState* play) {
EnGo_ChangeAnim(this, play, sSubtypeToAnimIndex[subtypeLookup]);
// Move the sitting Goron forward, since their spawn location is the same as their standing counterpart.
if (this->curAnimIndex == ENGO_ANIM_SITTING_STRETCH) {
if (this->animIndex == ENGO_ANIM_SITTING_STRETCH) {
Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, this->actor.shape.rot.y, &sStretchingGoronOffset,
&newSittingStretcherPos);
@ -1701,7 +1701,7 @@ void EnGo_ChangeToSpectatingAnimation(EnGo* this, PlayState* play) {
void EnGo_ChangeToFrozenAnimation(EnGo* this, PlayState* play) {
Collider_InitAndSetCylinder(play, &this->colliderCylinder, &this->actor, &sCylinderInitFrozen);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
this->curAnimIndex = -1;
this->animIndex = ENGO_ANIM_NONE;
EnGo_ChangeAnim(this, play, ENGO_ANIM_SHIVER);
this->sleepState = ENGO_AWAKE;
this->iceBlockScale = (this->scaleFactor / 0.01f) * 0.9f;
@ -1899,7 +1899,7 @@ void EnGo_SetupInitialAction(EnGo* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable,
GORON_LIMB_MAX);
this->curAnimIndex = ENGO_ANIM_INVALID;
this->animIndex = ENGO_ANIM_NONE;
EnGo_ChangeAnim(this, play, ENGO_ANIM_UNROLL);
this->actor.draw = EnGo_Draw;
@ -2168,14 +2168,14 @@ void EnGo_HandleSpringArrivalCutscene(EnGo* this, PlayState* play) {
switch (this->springArrivalCueId) {
case 3:
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) &&
(this->curAnimIndex == ENGO_ANIM_LOOK_AROUND)) {
(this->animIndex == ENGO_ANIM_LOOK_AROUND)) {
EnGo_ChangeAnim(this, play, ENGO_ANIM_LOOK_AROUND_LOOPED);
}
break;
case 4:
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) &&
(this->curAnimIndex == ENGO_ANIM_SHOW)) {
(this->animIndex == ENGO_ANIM_SHOW)) {
EnGo_ChangeAnim(this, play, ENGO_ANIM_SHOW_LOOPED);
}
break;
@ -2439,7 +2439,7 @@ void EnGo_Update(Actor* thisx, PlayState* play) {
if (!(this->actionFlags & ENGO_FLAG_FROZEN)) {
EnGo_UpdateEyes(this);
EnGo_UpdateAnimationToCurrent(this, play);
EnGo_UpdateSkelAnime(this, play);
EnGo_UpdateAttentionTargetAndReactions(this, play);
EnGo_UpdateSfx(this, play);
}
@ -2599,7 +2599,7 @@ void EnGo_Draw(Actor* thisx, PlayState* play) {
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeTexIndex]));
if (this->curAnimIndex == ENGO_ANIM_SITTING_STRETCH) {
if (this->animIndex == ENGO_ANIM_SITTING_STRETCH) {
Matrix_Translate(0.0f, 0.0f, -4000.0f, MTXMODE_APPLY);
}
SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,

View File

@ -106,7 +106,7 @@ typedef struct EnGo {
/* 0x390 */ u16 actionFlags;
/* 0x392 */ u16 lastTextId;
/* 0x394 */ u8 springArrivalCueId;
/* 0x398 */ f32 curAnimPlaySpeed;
/* 0x398 */ f32 animPlaySpeed;
/* 0x39C */ f32 iceBlockScale;
/* 0x3A0 */ f32 iceBlockAlpha;
/* 0x3A4 */ f32 scaleFactor;
@ -132,7 +132,7 @@ typedef struct EnGo {
/* 0x3CE */ s16 fidgetTableY[ENGO_FIDGET_TABLE_LEN];
/* 0x3D4 */ s16 surprisePhase;
/* 0x3D8 */ MsgEventFunc msgEventFunc;
/* 0x3DC */ s32 curAnimIndex;
/* 0x3DC */ s32 animIndex;
/* 0x3E0 */ UNK_TYPE1 unk3E0[0x4];
/* 0x3E4 */ s32 indexPathPoint;
/* 0x3E8 */ s32 indexEffect;

View File

@ -674,6 +674,7 @@ void func_80940090(EnGoroiwa* this, PlayState* play) {
sp10C.x = this->actor.world.pos.x;
sp10C.y = this->actor.world.pos.y + this->unk_1DC;
sp10C.z = this->actor.world.pos.z;
//! FAKE:
if (1) {}
spD8 = spEC * 150.0f;
spA8 = 0x10000 / spD8;
@ -1117,8 +1118,8 @@ void func_809419D0(EnGoroiwa* this) {
void func_80941A10(EnGoroiwa* this, PlayState* play) {
static EnGoroiwaUnkFunc D_80942E94[] = {
&func_8093F498,
&func_8093F34C,
func_8093F498,
func_8093F34C,
};
static u16 D_80942E9C[][2] = {
{ NA_SE_EV_BIGBALL_ROLL - SFX_FLAG, NA_SE_EV_BIGBALL_ROLL_SR - SFX_FLAG },
@ -1507,6 +1508,9 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) {
this->actor.floorBgId = 50;
}
break;
default:
break;
}
func_8093FAA4(this, play);

View File

@ -75,8 +75,9 @@ typedef enum {
/* 4 */ DRAGONFLY_ANIM_HOVER,
/* 5 */ DRAGONFLY_ANIM_DAMAGE,
/* 6 */ DRAGONFLY_ANIM_DEAD,
/* 7 */ DRAGONFLY_ANIM_FALL
} EnGrasshopperAnim;
/* 7 */ DRAGONFLY_ANIM_FALL,
/* 8 */ DRAGONFLY_ANIM_MAX
} DragonflyAnimation;
static s32 sOccupiedIndices[] = {
false, false, false, false, false,
@ -333,7 +334,7 @@ void EnGrasshopper_Destroy(Actor* thisx, PlayState* play) {
sOccupiedIndices[this->index] = false;
}
static AnimationHeader* sAnimations[] = {
static AnimationHeader* sAnimations[DRAGONFLY_ANIM_MAX] = {
&gDragonflyRaiseTailAnim, // DRAGONFLY_ANIM_RAISE_TAIL
&gDragonflyLowerTailAnim, // DRAGONFLY_ANIM_LOWER_TAIL
&gDragonflyFlyAnim, // DRAGONFLY_ANIM_FLY
@ -344,7 +345,7 @@ static AnimationHeader* sAnimations[] = {
&gDragonflyFallAnim, // DRAGONFLY_ANIM_FALL
};
static u8 sAnimationModes[] = {
static u8 sAnimationModes[DRAGONFLY_ANIM_MAX] = {
ANIMMODE_ONCE, // DRAGONFLY_ANIM_RAISE_TAIL
ANIMMODE_ONCE, // DRAGONFLY_ANIM_LOWER_TAIL
ANIMMODE_LOOP, // DRAGONFLY_ANIM_FLY
@ -358,15 +359,15 @@ static u8 sAnimationModes[] = {
void EnGrasshopper_ChangeAnim(EnGrasshopper* this, s32 animIndex) {
f32 morphFrames;
this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]);
this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]);
morphFrames = 0.0f;
if ((animIndex == DRAGONFLY_ANIM_ATTACK) || (animIndex == DRAGONFLY_ANIM_HOVER) ||
(animIndex == DRAGONFLY_ANIM_DAMAGE)) {
morphFrames = -3.0f;
}
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->endFrame, sAnimationModes[animIndex],
morphFrames);
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f, this->animEndFrame,
sAnimationModes[animIndex], morphFrames);
}
void EnGrasshopper_RaiseTail(EnGrasshopper* this) {
@ -389,7 +390,7 @@ void EnGrasshopper_LowerTail(EnGrasshopper* this) {
void EnGrasshopper_DecideAction(EnGrasshopper* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
if (curFrame >= this->endFrame) {
if (curFrame >= this->animEndFrame) {
if (this->decision == DRAGONFLY_DECISION_ATTACK) {
EnGrasshopper_SetupAttack(this);
} else {
@ -580,6 +581,9 @@ void EnGrasshopper_Bank(EnGrasshopper* this, PlayState* play) {
this->actionFunc = EnGrasshopper_RoamInCircles;
}
break;
default:
break;
}
}
@ -735,7 +739,7 @@ void EnGrasshopper_Attack(EnGrasshopper* this, PlayState* play) {
Math_ApproachF(&this->actor.world.pos.y, this->targetApproachPos.y, 0.1f, this->approachSpeed);
Math_ApproachF(&this->approachSpeed, 10.0f, 0.1f, 1.0f);
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0xA, 0xFA0, 0xA);
if (curFrame >= this->endFrame) {
if (curFrame >= this->animEndFrame) {
EnGrasshopper_SetupWaitAfterAttack(this);
}
}
@ -831,7 +835,7 @@ void EnGrasshopper_Dead(EnGrasshopper* this, PlayState* play) {
this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE;
}
if (curFrame >= this->endFrame) {
if (curFrame >= this->animEndFrame) {
this->actor.flags &= ~ACTOR_FLAG_10;
EnGrasshopper_SetupFall(this);
}

View File

@ -91,7 +91,7 @@ typedef struct EnGrasshopper {
/* 0x035E */ s16 type;
/* 0x0360 */ f32 dragonflyScale;
/* 0x0364 */ f32 angularVelocity;
/* 0x0368 */ f32 endFrame;
/* 0x0368 */ f32 animEndFrame;
/* 0x036C */ f32 approachSpeed;
/* 0x0370 */ f32 baseFlyHeight;
/* 0x0374 */ f32 targetPosY;

View File

@ -250,6 +250,9 @@ void func_80997E4C(EnGs* this, PlayState* play) {
case ENGS_2:
this->unk_210 = this->unk_195 + 0x20F7;
break;
default:
break;
}
Message_ContinueTextbox(play, this->unk_210);
break;
@ -260,6 +263,9 @@ void func_80997E4C(EnGs* this, PlayState* play) {
}
}
break;
default:
break;
}
}
@ -329,6 +335,9 @@ void func_8099807C(EnGs* this, PlayState* play) {
func_809984F4(this, play);
}
break;
default:
break;
}
break;
@ -339,6 +348,9 @@ void func_8099807C(EnGs* this, PlayState* play) {
case 26:
func_80997D14(this, play);
break;
default:
break;
}
}
@ -444,6 +456,9 @@ void func_8099874C(EnGs* this, PlayState* play) {
case 4:
phi_v0 = func_809995A4(this, play);
break;
default:
break;
}
if (phi_v0 == 0) {
@ -483,6 +498,9 @@ void func_8099874C(EnGs* this, PlayState* play) {
SET_WEEKEVENTREG(WEEKEVENTREG_77_20);
}
break;
default:
break;
}
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_90_10)) {
@ -754,16 +772,16 @@ void func_80999584(Color_RGB8* arg0, Color_RGB8* arg1) {
}
s32 func_809995A4(EnGs* this, PlayState* play) {
static Color_RGB8 flashColours[] = {
static Color_RGB8 sFlashColours[] = {
{ 255, 50, 50 },
{ 50, 50, 255 },
{ 255, 255, 255 },
};
static Vec3f dustAccel = { 0.0f, -0.3f, 0.0f };
static Color_RGBA8 dustPrim = { 200, 200, 200, 128 };
static Color_RGBA8 dustEnv = { 100, 100, 100, 0 };
static Vec3f bomb2Velocity = { 0.0f, 0.0f, 0.0f };
static Vec3f bomb2Accel = { 0.0f, 0.0f, 0.0f };
static Vec3f sDustAccel = { 0.0f, -0.3f, 0.0f };
static Color_RGBA8 sDustPrimColor = { 200, 200, 200, 128 };
static Color_RGBA8 sDustEnvColor = { 100, 100, 100, 0 };
static Vec3f sBomb2Velocity = { 0.0f, 0.0f, 0.0f };
static Vec3f sBomb2Accel = { 0.0f, 0.0f, 0.0f };
s32 sp7C = -1;
if (this->unk_19D == 0) {
@ -784,18 +802,18 @@ s32 func_809995A4(EnGs* this, PlayState* play) {
u8 pad;
this->unk_1D4--;
func_80999584(&this->unk_1FA, &flashColours[2]);
func_80999584(&this->unk_1FA, &sFlashColours[2]);
if (this->unk_1D4 < 80) {
if ((this->unk_1D4 % 20) < 8) {
if (this->unk_1D4 < 20) {
if ((this->unk_1D4 % 20) == 7) {
func_80999584(&this->unk_1FA, &flashColours[0]);
func_80999584(&this->unk_1FA, &sFlashColours[0]);
this->unk_1F4 = this->unk_1FA;
Audio_PlaySfx(NA_SE_SY_WARNING_COUNT_E);
this->unk_200 = 0.0f;
}
} else if ((this->unk_1D4 % 20) == 7) {
func_80999584(&this->unk_1FA, &flashColours[1]);
func_80999584(&this->unk_1FA, &sFlashColours[1]);
this->unk_1F4 = this->unk_1FA;
Audio_PlaySfx(NA_SE_SY_WARNING_COUNT_N);
this->unk_200 = 0.0f;
@ -826,7 +844,8 @@ s32 func_809995A4(EnGs* this, PlayState* play) {
sp6C.y = this->actor.world.pos.y + 7.0f;
sp6C.z = this->actor.world.pos.z + (2.0f * sp60.z);
func_800B0EB0(play, &sp6C, &sp60, &dustAccel, &dustPrim, &dustEnv, Rand_ZeroFloat(50.0f) + 200.0f, 40, 15);
func_800B0EB0(play, &sp6C, &sp60, &sDustAccel, &sDustPrimColor, &sDustEnvColor,
Rand_ZeroFloat(50.0f) + 200.0f, 40, 15);
}
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG);
@ -856,7 +875,7 @@ s32 func_809995A4(EnGs* this, PlayState* play) {
sp54.y = this->actor.world.pos.y;
sp54.z = this->actor.world.pos.z;
Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION);
EffectSsBomb2_SpawnLayered(play, &sp54, &bomb2Velocity, &bomb2Accel, 100, 20);
EffectSsBomb2_SpawnLayered(play, &sp54, &sBomb2Velocity, &sBomb2Accel, 100, 20);
this->unk_1D4 = 10;
this->unk_19A |= 8;
this->unk_216 = 0;

View File

@ -61,18 +61,32 @@ s32 sGuardCount = 0;
s32 D_80ABBE20 = 0;
static u16 sTextIDs[] = { 0x0824, 0x0825, 0x0826, 0x082D, 0x0827, 0x0828, 0x0829, 0x082A, 0x082B, 0x082C };
static u16 sTextIds[] = { 0x0824, 0x0825, 0x0826, 0x082D, 0x0827, 0x0828, 0x0829, 0x082A, 0x082B, 0x082C };
s16 D_80ABBE38[] = { 0x0000, 0x0000, 0x0002, 0x0001, 0x0000, 0x0000, 0x0002, 0x0000, 0x0000, 0x0002 };
static AnimationHeader* sAnimations[] = {
&gDekuPalaceGuardWaitAnim,
&gDekuPalaceGuardWalkAnim,
&gDekuPalaceGuardDigAnim,
&gDekuPalaceGuardWalkAnim,
typedef enum {
/* -1 */ GUARD_NUTS_ANIM_NONE = -1,
/* 0 */ GUARD_NUTS_ANIM_WAIT_HEAD_TILT,
/* 1 */ GUARD_NUTS_ANIM_WALK,
/* 2 */ GUARD_NUTS_ANIM_DIG,
/* 3 */ GUARD_NUTS_ANIM_WALK_2,
/* 4 */ GUARD_NUTS_ANIM_MAX
} EnGuardNutsAnimation;
static AnimationHeader* sAnimations[GUARD_NUTS_ANIM_MAX] = {
&gDekuPalaceGuardWaitAnim, // GUARD_NUTS_ANIM_WAIT_HEAD_TILT
&gDekuPalaceGuardWalkAnim, // GUARD_NUTS_ANIM_WALK
&gDekuPalaceGuardDigAnim, // GUARD_NUTS_ANIM_DIG
&gDekuPalaceGuardWalkAnim, // GUARD_NUTS_ANIM_WALK_2
};
static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE };
static u8 sAnimationModes[GUARD_NUTS_ANIM_MAX] = {
ANIMMODE_LOOP, // GUARD_NUTS_ANIM_WAIT_HEAD_TILT
ANIMMODE_LOOP, // GUARD_NUTS_ANIM_WALK
ANIMMODE_ONCE, // GUARD_NUTS_ANIM_DIG
ANIMMODE_ONCE, // GUARD_NUTS_ANIM_WALK_2
};
static TexturePtr sEyeTextures[] = {
gDekuPalaceGuardEyeOpenTex,
@ -80,13 +94,6 @@ static TexturePtr sEyeTextures[] = {
gDekuPalaceGuardEyeClosedTex,
};
typedef enum {
/* 0 */ WAIT_HEAD_TILT_ANIM,
/* 1 */ WALK_ANIM,
/* 2 */ DIG_ANIM,
/* 3 */ WALK_ANIM_2
} EnGuardNutsAnim;
typedef enum {
/* 0 */ GUARD_NUTS_WAIT_STATE,
/* 1 */ GUARD_NUTS_TALKING_STATE,
@ -123,20 +130,20 @@ void EnGuardNuts_Destroy(Actor* thisx, PlayState* play) {
}
/**
* @brief Changes the animation to the provided index. Updates animIndex and animFrameCount for the animation.
* @brief Changes the animation to the provided index. Updates animIndex and animEndFrame for the animation.
*
* @param this
* @param animIndex the index of sAnimations to change to
*/
void EnGuardNuts_ChangeAnim(EnGuardNuts* this, s32 animIndex) {
this->animIndex = animIndex;
this->animFrameCount = Animation_GetLastFrame(sAnimations[this->animIndex]);
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animFrameCount,
this->animEndFrame = Animation_GetLastFrame(sAnimations[this->animIndex]);
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame,
sAnimationModes[this->animIndex], -2.0f);
}
void EnGuardNuts_SetupWait(EnGuardNuts* this) {
EnGuardNuts_ChangeAnim(this, WAIT_HEAD_TILT_ANIM);
EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WAIT_HEAD_TILT);
this->state = GUARD_NUTS_WAIT_STATE;
this->actionFunc = EnGuardNuts_Wait;
}
@ -169,22 +176,22 @@ void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play) {
// No place for an outsider
this->guardTextIndex = 3;
}
this->actor.textId = sTextIDs[this->guardTextIndex];
this->actor.textId = sTextIds[this->guardTextIndex];
phi_a1 = this->actor.world.rot.y;
if (D_80ABBE20 == 2) {
EnGuardNuts_Burrow(this, play);
return;
}
if (D_80ABBE20 == 1) {
if (this->animIndex != WALK_ANIM) {
EnGuardNuts_ChangeAnim(this, WALK_ANIM);
if (this->animIndex != GUARD_NUTS_ANIM_WALK) {
EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK);
}
phi_a1 = (this->actor.home.rot.y + 0x8000);
}
if (fabsf((f32)(this->actor.shape.rot.y - phi_a1)) < 100.0f) {
this->actor.shape.rot.y = phi_a1;
if ((D_80ABBE20 == 1) && (this->animIndex != WALK_ANIM_2)) {
EnGuardNuts_ChangeAnim(this, WALK_ANIM_2);
if ((D_80ABBE20 == 1) && (this->animIndex != GUARD_NUTS_ANIM_WALK_2)) {
EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK_2);
}
} else {
Math_SmoothStepToS(&this->actor.shape.rot.y, phi_a1, 1, 0xBB8, 0);
@ -199,7 +206,7 @@ void EnGuardNuts_Wait(EnGuardNuts* this, PlayState* play) {
}
void func_80ABB540(EnGuardNuts* this) {
EnGuardNuts_ChangeAnim(this, WALK_ANIM);
EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WALK);
this->targetHeadPos.x = this->targetHeadPos.y = 0;
this->timer = 16;
this->state = GUARD_NUTS_TALKING_STATE;
@ -216,7 +223,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) {
if (fabsf((this->actor.shape.rot.y - yaw)) < 100.0f) {
this->actor.shape.rot.y = yaw;
curFrame = this->skelAnime.curFrame;
if ((curFrame < this->animFrameCount) || (this->guardTextIndex >= 7)) {
if ((curFrame < this->animEndFrame) || (this->guardTextIndex >= 7)) {
SkelAnime_Update(&this->skelAnime);
}
} else {
@ -226,8 +233,8 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_5) {
this->targetHeadPos.y = 0;
this->targetHeadPos.x = 0;
if ((this->guardTextIndex == 3) && (this->animIndex == WAIT_HEAD_TILT_ANIM)) {
EnGuardNuts_ChangeAnim(this, WAIT_HEAD_TILT_ANIM);
if ((this->guardTextIndex == 3) && (this->animIndex == GUARD_NUTS_ANIM_WAIT_HEAD_TILT)) {
EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_WAIT_HEAD_TILT);
}
if (Message_ShouldAdvance(play)) {
if (D_80ABBE38[this->guardTextIndex] != 1) {
@ -238,7 +245,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) {
EnGuardNuts_Burrow(this, play);
} else {
this->guardTextIndex++;
Message_StartTextbox(play, sTextIDs[this->guardTextIndex], &this->actor);
Message_StartTextbox(play, sTextIds[this->guardTextIndex], &this->actor);
if (D_80ABBE38[this->guardTextIndex] == 2) {
D_80ABBE20 = 1;
}
@ -271,7 +278,7 @@ void func_80ABB590(EnGuardNuts* this, PlayState* play) {
void EnGuardNuts_Burrow(EnGuardNuts* this, PlayState* play) {
Vec3f digPos;
EnGuardNuts_ChangeAnim(this, DIG_ANIM);
EnGuardNuts_ChangeAnim(this, GUARD_NUTS_ANIM_DIG);
Math_Vec3f_Copy(&digPos, &this->actor.world.pos);
digPos.y = this->actor.floorHeight;
EffectSsHahen_SpawnBurst(play, &digPos, 4.0f, 0, 10, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL);
@ -287,7 +294,7 @@ void EnGuardNuts_SetupUnburrow(EnGuardNuts* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
SkelAnime_Update(&this->skelAnime);
if (this->animFrameCount <= curFrame) {
if (curFrame >= this->animEndFrame) {
this->state = GUARD_NUTS_BURROWED_STATE;
this->actionFunc = EnGuardNuts_Unburrow;
this->actor.world.rot.y = this->actor.home.rot.y;
@ -327,7 +334,7 @@ void EnGuardNuts_Update(Actor* thisx, PlayState* play) {
this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
}
}
if ((this->animIndex == WALK_ANIM) &&
if ((this->animIndex == GUARD_NUTS_ANIM_WALK) &&
(Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 5.0f))) {
Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_WALK);
}

View File

@ -25,7 +25,7 @@ typedef struct EnGuardNuts {
/* 0x228 */ Vec3f guardPos;
/* 0x234 */ Vec3s headRot;
/* 0x23A */ Vec3s targetHeadPos;
/* 0x240 */ f32 animFrameCount;
/* 0x240 */ f32 animEndFrame;
/* 0x244 */ ColliderCylinder collider;
} EnGuardNuts; // size = 0x290

View File

@ -5,7 +5,6 @@
*/
#include "z_en_guruguru.h"
#include "objects/object_fu/object_fu.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@ -62,9 +61,27 @@ static ColliderCylinderInit sCylinderInit = {
{ 15, 20, 0, { 0, 0, 0 } },
};
static AnimationHeader* sAnimations[] = { &gGuruGuruPlayStillAnim, &gGuruGuruPlayAndMoveHeadAnim };
static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP };
static f32 sPlaySpeeds[] = { 1.0f, 1.0f };
typedef enum {
/* 0 */ GURU_GURU_ANIM_PLAY_STILL,
/* 1 */ GURU_GURU_ANIM_PLAY_MOVE_HEAD,
/* 2 */ GURU_GURU_ANIM_MAX
} GuruGuruAnimation;
static AnimationHeader* sAnimations[GURU_GURU_ANIM_MAX] = {
&gGuruGuruPlayStillAnim, // GURU_GURU_ANIM_PLAY_STILL
&gGuruGuruPlayAndMoveHeadAnim, // GURU_GURU_ANIM_PLAY_MOVE_HEAD
};
static u8 sAnimationModes[GURU_GURU_ANIM_MAX] = {
ANIMMODE_LOOP, // GURU_GURU_ANIM_PLAY_STILL
ANIMMODE_LOOP, // GURU_GURU_ANIM_PLAY_MOVE_HEAD
};
static f32 sPlaySpeeds[GURU_GURU_ANIM_MAX] = {
1.0f, // GURU_GURU_ANIM_PLAY_STILL
1.0f, // GURU_GURU_ANIM_PLAY_MOVE_HEAD
};
static TexturePtr sEyeTextures[] = { gGuruGuruEyeClosedTex, gGuruGuruEyeAngryTex };
static TexturePtr sMouthTextures[] = { gGuruGuruMouthOpenTex, gGuruGuruMouthAngryTex };
@ -74,7 +91,7 @@ void EnGuruguru_Init(Actor* thisx, PlayState* play) {
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &gGuruGuruSkel, &gGuruGuruPlayStillAnim, this->jointTable,
this->morphTable, 16);
this->morphTable, GURU_GURU_LIMB_MAX);
this->actor.targetMode = TARGET_MODE_0;
if (this->actor.params != 2) {
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
@ -106,8 +123,8 @@ void EnGuruguru_Destroy(Actor* thisx, PlayState* play) {
}
void EnGuruguru_ChangeAnim(EnGuruguru* this, s32 animIndex) {
this->frameCount = Animation_GetLastFrame(sAnimations[animIndex]);
Animation_Change(&this->skelAnime, sAnimations[animIndex], sPlaySpeeds[animIndex], 0.0f, this->frameCount,
this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]);
Animation_Change(&this->skelAnime, sAnimations[animIndex], sPlaySpeeds[animIndex], 0.0f, this->animEndFrame,
sAnimationModes[animIndex], -4.0f);
}
@ -115,7 +132,7 @@ void EnGuruguru_DoNothing(EnGuruguru* this, PlayState* play) {
}
void func_80BC6E10(EnGuruguru* this) {
EnGuruguru_ChangeAnim(this, 0);
EnGuruguru_ChangeAnim(this, GURU_GURU_ANIM_PLAY_STILL);
this->textIdIndex = 0;
this->unk270 = 0;
if (this->actor.params == 0) {
@ -373,7 +390,7 @@ void EnGuruguru_Update(Actor* thisx, PlayState* play) {
s32 EnGuruguru_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnGuruguru* this = THIS;
if (limbIndex == 14) {
if (limbIndex == GURU_GURU_LIMB_HEAD) {
rot->x += this->headXRot;
rot->z += this->headZRot;
}

View File

@ -2,6 +2,7 @@
#define Z_EN_GURUGURU_H
#include "global.h"
#include "objects/object_fu/object_fu.h"
struct EnGuruguru;
@ -10,8 +11,8 @@ typedef void (*EnGuruguruActionFunc)(struct EnGuruguru*, PlayState*);
typedef struct EnGuruguru {
/* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[16];
/* 0x1E8 */ Vec3s morphTable[16];
/* 0x188 */ Vec3s jointTable[GURU_GURU_LIMB_MAX];
/* 0x1E8 */ Vec3s morphTable[GURU_GURU_LIMB_MAX];
/* 0x248 */ EnGuruguruActionFunc actionFunc;
/* 0x24C */ s16 headZRot;
/* 0x24E */ s16 headXRot;
@ -22,7 +23,7 @@ typedef struct EnGuruguru {
/* 0x264 */ s16 unusedTimer; // set to 6 and decremented, but never has any effect
/* 0x266 */ s16 unk266;
/* 0x268 */ s16 unk268;
/* 0x26C */ f32 frameCount;
/* 0x26C */ f32 animEndFrame;
/* 0x270 */ u8 unk270;
/* 0x272 */ s16 unk272; // set, but never used
/* 0x274 */ s16 textIdIndex;

View File

@ -631,7 +631,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) {
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
this->cutsceneAnimIndex = EN_JG_ANIM_CUTSCENE_IDLE;
this->csAnimIndex = EN_JG_ANIM_CUTSCENE_IDLE;
if (this->drum != NULL) {
Actor_Kill(this->drum);
this->drum = NULL;
@ -639,50 +639,49 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) {
break;
case 2:
this->cutsceneAnimIndex = EN_JG_ANIM_TAKING_OUT_DRUM;
this->csAnimIndex = EN_JG_ANIM_TAKING_OUT_DRUM;
break;
case 3:
this->cutsceneAnimIndex = EN_JG_ANIM_DRUM_IDLE;
this->csAnimIndex = EN_JG_ANIM_DRUM_IDLE;
break;
case 4:
this->cutsceneAnimIndex = EN_JG_ANIM_PLAYING_DRUM;
this->csAnimIndex = EN_JG_ANIM_PLAYING_DRUM;
break;
case 5:
this->cutsceneAnimIndex = EN_JG_ANIM_THINKING;
this->csAnimIndex = EN_JG_ANIM_THINKING;
break;
case 6:
this->cutsceneAnimIndex = EN_JG_ANIM_REMEMBERING;
this->csAnimIndex = EN_JG_ANIM_REMEMBERING;
break;
case 7:
this->cutsceneAnimIndex = EN_JG_ANIM_STRONG_REMEMBERING;
this->csAnimIndex = EN_JG_ANIM_STRONG_REMEMBERING;
break;
case 8:
this->cutsceneAnimIndex = EN_JG_ANIM_DEPRESSED;
this->csAnimIndex = EN_JG_ANIM_DEPRESSED;
break;
case 9:
this->cutsceneAnimIndex = EN_JG_ANIM_CRADLE;
this->csAnimIndex = EN_JG_ANIM_CRADLE;
break;
default:
this->cutsceneAnimIndex = EN_JG_ANIM_IDLE;
this->csAnimIndex = EN_JG_ANIM_IDLE;
break;
}
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->cutsceneAnimIndex);
SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, this->csAnimIndex);
}
if (!(this->flags & FLAG_DRUM_SPAWNED) &&
(((this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) && Animation_OnFrame(&this->skelAnime, 14.0f) &&
(((this->csAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) && Animation_OnFrame(&this->skelAnime, 14.0f) &&
(this->action != EN_JG_ACTION_LULLABY_INTRO_CS)) ||
(((this->cutsceneAnimIndex == EN_JG_ANIM_DRUM_IDLE) ||
(this->cutsceneAnimIndex == EN_JG_ANIM_PLAYING_DRUM)) &&
(((this->csAnimIndex == EN_JG_ANIM_DRUM_IDLE) || (this->csAnimIndex == EN_JG_ANIM_PLAYING_DRUM)) &&
(this->action == EN_JG_ACTION_LULLABY_INTRO_CS)))) {
this->flags |= FLAG_DRUM_SPAWNED;
this->drum = Actor_SpawnAsChildAndCutscene(
@ -691,7 +690,7 @@ void EnJg_LullabyIntroCutsceneAction(EnJg* this, PlayState* play) {
this->actor.params, this->actor.csId, this->actor.halfDaysBits, NULL);
}
if (this->cutsceneAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) {
if (this->csAnimIndex == EN_JG_ANIM_TAKING_OUT_DRUM) {
if (Animation_OnFrame(&this->skelAnime, 23.0f)) {
Audio_PlaySfx_AtPos(&sSfxPos, NA_SE_EV_WOOD_BOUND_S);
} else if (Animation_OnFrame(&this->skelAnime, 38.0f)) {

View File

@ -35,7 +35,7 @@ typedef struct EnJg {
/* 0x3B0 */ Vec3f breathVelocity;
/* 0x3BC */ Vec3f breathAccel;
/* 0x3C8 */ s16 csId;
/* 0x3CA */ u8 cutsceneAnimIndex;
/* 0x3CA */ u8 csAnimIndex;
/* 0x3CB */ u8 cueId;
/* 0x3CC */ u16 flags;
/* 0x3CE */ u16 textId;

View File

@ -17,7 +17,7 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play);
void EnKgy_Update(Actor* thisx, PlayState* play);
void EnKgy_Draw(Actor* thisx, PlayState* play);
void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 morphFrames);
void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 animMode, f32 morphFrames);
EnKbt* EnKgy_FindZubora(PlayState* play);
ObjIcePoly* EnKgy_FindIceBlock(PlayState* play);
void func_80B40D30(PlayState* play);
@ -109,7 +109,7 @@ void EnKgy_Destroy(Actor* thisx, PlayState* play) {
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
}
void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 morphFrames) {
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,
@ -117,7 +117,7 @@ void EnKgy_ChangeAnim(EnKgy* this, s16 animIndex, u8 mode, f32 morphFrames) {
};
Animation_Change(&this->skelAnime, sAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(sAnimations[animIndex]), mode, morphFrames);
Animation_GetLastFrame(sAnimations[animIndex]), animMode, morphFrames);
this->unk_2D2 = animIndex;
}

View File

@ -147,11 +147,11 @@ TexturePtr sMonkeyFaceTextures[] = {
object_mnk_Tex_017120, object_mnk_Tex_017920, object_mnk_Tex_018120,
};
void EnMnk_MonkeyTiedUp_ChangeAnim(EnMnk* this, s32 animIndex, u8 mode, f32 morphFrames) {
void EnMnk_MonkeyTiedUp_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) {
Animation_Change(&this->skelAnime, sMonkeyTiedUpAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(&sMonkeyTiedUpAnimations[animIndex]->common), mode, morphFrames);
Animation_GetLastFrame(&sMonkeyTiedUpAnimations[animIndex]->common), animMode, morphFrames);
Animation_Change(&this->propSkelAnime, sMonkeyTiedUpPoleAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(&sMonkeyTiedUpPoleAnimations[animIndex]->common), mode, morphFrames);
Animation_GetLastFrame(&sMonkeyTiedUpPoleAnimations[animIndex]->common), animMode, morphFrames);
switch (animIndex) {
case MONKEY_TIEDUP_ANIM_KICKAROUND:
@ -184,11 +184,11 @@ void EnMnk_MonkeyTiedUp_SetNewAnim(EnMnk* this, s32 animIndex) {
}
}
void EnMnk_MonkeyHanging_ChangeAnim(EnMnk* this, s32 animIndex, u8 mode, f32 morphFrames) {
void EnMnk_MonkeyHanging_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) {
Animation_Change(&this->skelAnime, sMonkeyHangingAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(&sMonkeyHangingAnimations[animIndex]->common), mode, morphFrames);
Animation_GetLastFrame(&sMonkeyHangingAnimations[animIndex]->common), animMode, morphFrames);
Animation_Change(&this->propSkelAnime, sMonkeyHangingRopeAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(&sMonkeyHangingRopeAnimations[animIndex]->common), mode, morphFrames);
Animation_GetLastFrame(&sMonkeyHangingRopeAnimations[animIndex]->common), animMode, morphFrames);
this->animIndex = animIndex;
}
@ -196,7 +196,7 @@ void EnMnk_MonkeyHanging_SetAnim(EnMnk* this, s32 animIndex) {
EnMnk_MonkeyHanging_ChangeAnim(this, animIndex, ANIMMODE_LOOP, -5.0f);
}
void EnMnk_Monkey_ChangeAnim(EnMnk* this, s32 animIndex, u8 mode, f32 morphFrames) {
void EnMnk_Monkey_ChangeAnim(EnMnk* this, s32 animIndex, u8 animMode, f32 morphFrames) {
s32 pad;
if (animIndex == 100) {
@ -204,10 +204,10 @@ void EnMnk_Monkey_ChangeAnim(EnMnk* this, s32 animIndex, u8 mode, f32 morphFrame
}
if ((animIndex == 4) || (animIndex == 6)) {
Animation_Change(&this->skelAnime, sMonkeyAnimations[animIndex], -1.0f,
Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), 0.0f, mode, morphFrames);
Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), 0.0f, animMode, morphFrames);
} else {
Animation_Change(&this->skelAnime, sMonkeyAnimations[animIndex], 1.0f, 0.0f,
Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), mode, morphFrames);
Animation_GetLastFrame(&sMonkeyAnimations[animIndex]->common), animMode, morphFrames);
}
this->unk_3E0 = 0;
this->animIndex = animIndex;

View File

@ -1182,37 +1182,40 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) {
this->cueId = play->csCtx.actorCues[cueChannel]->id;
switch (play->csCtx.actorCues[cueChannel]->id) {
case 1:
this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_IDLE;
this->csAnimIndex = EN_RAILGIBUD_ANIM_IDLE;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_IDLE);
break;
case 2:
this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_START;
this->csAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_START;
Actor_PlaySfx(&this->actor, NA_SE_EN_REDEAD_WEAKENED2);
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_SLUMP_START);
break;
case 3:
this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_CONVULSION;
this->csAnimIndex = EN_RAILGIBUD_ANIM_CONVULSION;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_CONVULSION);
break;
case 4:
this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_START;
this->csAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_START;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_ARMS_UP_START);
break;
case 5:
this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_WALK;
this->csAnimIndex = EN_RAILGIBUD_ANIM_WALK;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_WALK);
break;
default:
break;
}
} else if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
if (this->cutsceneAnimIndex == EN_RAILGIBUD_ANIM_SLUMP_START) {
this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_LOOP;
if (this->csAnimIndex == EN_RAILGIBUD_ANIM_SLUMP_START) {
this->csAnimIndex = EN_RAILGIBUD_ANIM_SLUMP_LOOP;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_SLUMP_LOOP);
} else if (this->cutsceneAnimIndex == EN_RAILGIBUD_ANIM_ARMS_UP_START) {
this->cutsceneAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_LOOP;
} else if (this->csAnimIndex == EN_RAILGIBUD_ANIM_ARMS_UP_START) {
this->csAnimIndex = EN_RAILGIBUD_ANIM_ARMS_UP_LOOP;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_RAILGIBUD_ANIM_ARMS_UP_LOOP);
EnRailgibud_SetupSinkIntoGround(this);
}

View File

@ -52,7 +52,7 @@ typedef struct EnRailgibud {
/* 0x3EE */ s16 shouldWalkForwardNextFrame; // Only used by the "main" Gibdo
/* 0x3F0 */ union {
s16 grabState;
s16 cutsceneAnimIndex;
s16 csAnimIndex;
};
/* 0x3F2 */ union {
s16 playerStunWaitTimer; // Cannot stun the player if this is non-zero

View File

@ -7580,8 +7580,8 @@
0x80949BD4:("EnClearTag_DrawEffects",),
0x8094DEE0:("func_8094DEE0",),
0x8094DF90:("func_8094DF90",),
0x8094DFF8:("func_8094DFF8",),
0x8094E054:("func_8094E054",),
0x8094DFF8:("EnGm_UpdateSkelAnime",),
0x8094E054:("EnGm_ChangeAnim",),
0x8094E0F8:("func_8094E0F8",),
0x8094E1DC:("func_8094E1DC",),
0x8094E278:("func_8094E278",),
@ -9696,7 +9696,7 @@
0x80A12774:("EnGo_UpdateTalking",),
0x80A12868:("EnGo_DetectCollisions",),
0x80A12954:("EnGo_UpdateSpringArrivalCutscene",),
0x80A12A64:("EnGo_UpdateAnimationToCurrent",),
0x80A12A64:("EnGo_UpdateSkelAnime",),
0x80A12B78:("EnGo_UpdateSfx",),
0x80A12C48:("EnGo_ChangeAnim",),
0x80A12D6C:("EnGo_UpdateEyes",),
@ -15302,8 +15302,8 @@
0x80BB1C8C:("func_80BB1C8C",),
0x80BB1D04:("func_80BB1D04",),
0x80BB1D64:("func_80BB1D64",),
0x80BB1FCC:("func_80BB1FCC",),
0x80BB2020:("func_80BB2020",),
0x80BB1FCC:("EnGeg_UpdateSkelAnime",),
0x80BB2020:("EnGeg_ChangeAnim",),
0x80BB2088:("func_80BB2088",),
0x80BB217C:("func_80BB217C",),
0x80BB221C:("func_80BB221C",),

View File

@ -14139,7 +14139,7 @@
0x80B3A9E4:("D_80B3A9E4","f32","",0x4),
0x80B3A9E8:("D_80B3A9E8","f32","",0x4),
0x80B3BEE0:("En_Gg2_InitVars","UNK_TYPE1","",0x1),
0x80B3BF00:("D_80B3BF00","UNK_TYPE4","",0x4),
0x80B3BF00:("sAnimationInfo","UNK_TYPE4","",0x4),
0x80B3C080:("D_80B3C080","UNK_TYPE4","",0x4),
0x80B3C084:("D_80B3C084","UNK_TYPE4","",0x4),
0x80B3C088:("D_80B3C088","UNK_TYPE1","",0x1),