Animation Cleanup: En_M* (#1496)

* brackets

* more M cleanup

* small cleanup

* PR Review
This commit is contained in:
engineer124 2023-11-18 00:49:23 +11:00 committed by GitHub
parent 8ab62788b2
commit dbb6410ba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 181 additions and 129 deletions

View File

@ -358,9 +358,9 @@ s32 Player_GetCurMaskItemId(PlayState* play) {
void func_80122F28(Player* player) { void func_80122F28(Player* player) {
if ((player->actor.category == ACTORCAT_PLAYER) && if ((player->actor.category == ACTORCAT_PLAYER) &&
(!(player->stateFlags1 & (PLAYER_STATE1_400 | PLAYER_STATE1_800 | PLAYER_STATE1_200000 | PLAYER_STATE1_800000 | !(player->stateFlags1 & (PLAYER_STATE1_400 | PLAYER_STATE1_800 | PLAYER_STATE1_200000 | PLAYER_STATE1_800000 |
PLAYER_STATE1_20000000))) && PLAYER_STATE1_20000000)) &&
(!(player->stateFlags2 & PLAYER_STATE2_1))) { !(player->stateFlags2 & PLAYER_STATE2_1)) {
if (player->doorType <= PLAYER_DOORTYPE_TALKING) { if (player->doorType <= PLAYER_DOORTYPE_TALKING) {
CutsceneManager_Queue(CS_ID_GLOBAL_TALK); CutsceneManager_Queue(CS_ID_GLOBAL_TALK);
} else { } else {
@ -2272,7 +2272,7 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx**
} }
} }
} else if ((player->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (player->actor.speed > 2.0f) && } else if ((player->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (player->actor.speed > 2.0f) &&
(!(player->stateFlags1 & PLAYER_STATE1_8000000))) { !(player->stateFlags1 & PLAYER_STATE1_8000000)) {
rightHandDLists = &gPlayerRightHandClosedDLs[D_801F59E0]; rightHandDLists = &gPlayerRightHandClosedDLs[D_801F59E0];
sPlayerRightHandType = PLAYER_MODELTYPE_RH_CLOSED; sPlayerRightHandType = PLAYER_MODELTYPE_RH_CLOSED;
} else { } else {
@ -2562,7 +2562,7 @@ void func_8012669C(PlayState* play, Player* player, Vec3f* arg2, Vec3f* arg3) {
if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) { if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) {
if (func_80126440(play, NULL, &player->meleeWeaponInfo[0], &sp3C, &sp30) && if (func_80126440(play, NULL, &player->meleeWeaponInfo[0], &sp3C, &sp30) &&
(player->transformation != PLAYER_FORM_GORON) && (!(player->stateFlags1 & PLAYER_STATE1_400000))) { (player->transformation != PLAYER_FORM_GORON) && !(player->stateFlags1 & PLAYER_STATE1_400000)) {
EffectBlure_AddVertex(Effect_GetByIndex(player->meleeWeaponEffectIndex[0]), &player->meleeWeaponInfo[0].tip, EffectBlure_AddVertex(Effect_GetByIndex(player->meleeWeaponEffectIndex[0]), &player->meleeWeaponInfo[0].tip,
&player->meleeWeaponInfo[0].base); &player->meleeWeaponInfo[0].base);
} }

View File

@ -573,7 +573,7 @@ void EnBal_GroundIdle(EnBal* this, PlayState* play) {
} else { } else {
this->idleAnimStage++; this->idleAnimStage++;
} }
} else if ((this->idleAnimStage == TINGLE_IDLESTAGE_WAIT) && (Animation_OnFrame(&this->skelAnime, 20.0f))) { } else if ((this->idleAnimStage == TINGLE_IDLESTAGE_WAIT) && Animation_OnFrame(&this->skelAnime, 20.0f)) {
this->forceEyesShut = true; this->forceEyesShut = true;
} }
} }

View File

@ -333,7 +333,8 @@ void EnBubble_Init(Actor* thisx, PlayState* play) {
Collider_InitJntSph(play, &this->colliderSphere); Collider_InitJntSph(play, &this->colliderSphere);
Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderElements); Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderElements);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(9), &sColChkInfoInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(9), &sColChkInfoInit);
this->actor.hintId = 0x16; //! @bug: hint Id not correctly migrated from OoT `NAVI_ENEMY_SHABOM`
this->actor.hintId = TATL_HINT_ID_IGOS_DU_IKANA;
this->bounceDirection.x = Rand_ZeroOne(); this->bounceDirection.x = Rand_ZeroOne();
this->bounceDirection.y = Rand_ZeroOne(); this->bounceDirection.y = Rand_ZeroOne();
this->bounceDirection.z = Rand_ZeroOne(); this->bounceDirection.z = Rand_ZeroOne();

View File

@ -1085,7 +1085,7 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, PlayState* play) {
if ((i != ARRAY_COUNT(this->colliderElements)) && if ((i != ARRAY_COUNT(this->colliderElements)) &&
((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) ||
(!(sphElement->info.acHitInfo->toucher.dmgFlags & 0xDB0B3)))) { !(sphElement->info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) {
EnDekubaba_SpawnIceEffects(this, play); EnDekubaba_SpawnIceEffects(this, play);
newHealth = this->actor.colChkInfo.health - this->actor.colChkInfo.damage; newHealth = this->actor.colChkInfo.health - this->actor.colChkInfo.damage;

View File

@ -619,7 +619,7 @@ void EnDragon_Attack(EnDragon* this, PlayState* play) {
} }
if (((this->state != DEEP_PYTHON_ATTACK_STATE_START) && (curFrame >= this->animEndFrame)) || if (((this->state != DEEP_PYTHON_ATTACK_STATE_START) && (curFrame >= this->animEndFrame)) ||
(!(player->stateFlags2 & PLAYER_STATE2_80)) || ((this->collider.elements[0].info.bumperFlags & BUMP_HIT)) || !(player->stateFlags2 & PLAYER_STATE2_80) || (this->collider.elements[0].info.bumperFlags & BUMP_HIT) ||
(this->collider.elements[1].info.bumperFlags & BUMP_HIT) || (this->collider.elements[1].info.bumperFlags & BUMP_HIT) ||
(this->collider.elements[2].info.bumperFlags & BUMP_HIT)) { (this->collider.elements[2].info.bumperFlags & BUMP_HIT)) {
player->actor.parent = NULL; player->actor.parent = NULL;

View File

@ -62,6 +62,7 @@ void EnElfbub_Init(Actor* thisx, PlayState* play) {
} }
ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f); ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f);
//! @bug: hint Id not correctly migrated from OoT `NAVI_ENEMY_SHABOM`
this->actor.hintId = TATL_HINT_ID_IGOS_DU_IKANA; this->actor.hintId = TATL_HINT_ID_IGOS_DU_IKANA;
Actor_SetScale(&this->actor, 1.25f); Actor_SetScale(&this->actor, 1.25f);

View File

@ -775,7 +775,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) {
this->colliderCylinder.base.acFlags &= ~AC_HIT; this->colliderCylinder.base.acFlags &= ~AC_HIT;
if ((this->actor.colChkInfo.damageEffect != DMG_EFF_IMMUNE) && if ((this->actor.colChkInfo.damageEffect != DMG_EFF_IMMUNE) &&
((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) || ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) ||
(!(this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0xDB0B3)))) { !(this->colliderCylinder.info.acHitInfo->toucher.dmgFlags & 0xDB0B3))) {
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 12); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 12);
this->invincibilityFrames = 12; this->invincibilityFrames = 12;
EnIk_Thaw(this, play); EnIk_Thaw(this, play);

View File

@ -86,7 +86,7 @@ static ColliderCylinderInit sCylinderInit = {
{ 18, 46, 0, { 0, 0, 0 } }, { 18, 46, 0, { 0, 0, 0 } },
}; };
static CollisionCheckInfoInit2 D_80AC00DC = { 0, 0, 0, 0, MASS_IMMOVABLE }; static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
static TexturePtr sEyeTextures[] = { static TexturePtr sEyeTextures[] = {
gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex, gRomaniEyeOpenTex, gRomaniEyeHalfTex, gRomaniEyeClosedTex, gRomaniEyeHappyTex, gRomaniEyeSadTex,
@ -213,7 +213,7 @@ void EnMa4_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider); Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &D_80AC00DC); CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4);
Actor_SetScale(&this->actor, 0.01f); Actor_SetScale(&this->actor, 0.01f);

View File

@ -423,6 +423,9 @@ void EnMag_Update(Actor* thisx, PlayState* play) {
this->state = MAG_STATE_POST_DISPLAY; this->state = MAG_STATE_POST_DISPLAY;
} }
break; break;
default:
break;
} }
// Appear fully immediately if called during fade-in states. // Appear fully immediately if called during fade-in states.
@ -676,7 +679,7 @@ void EnMag_DrawCharTexture(Gfx** gfxp, TexturePtr texture, s32 rectLeft, s32 rec
* POLY_OPA_DISP, but is used by OVERLAY_DISP. * POLY_OPA_DISP, but is used by OVERLAY_DISP.
*/ */
void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) {
static u8 pressStartFontIndices[] = { static u8 sPressStartFontIndices[] = {
0x19, 0x1B, 0x0E, 0x1C, 0x1C, 0x1C, 0x1D, 0x0A, 0x1B, 0x1D, 0x19, 0x1B, 0x0E, 0x1C, 0x1C, 0x1C, 0x1D, 0x0A, 0x1B, 0x1D,
}; // Indices into this->font.fontBuf }; // Indices into this->font.fontBuf
static TexturePtr sAppearEffectMaskTextures[] = { static TexturePtr sAppearEffectMaskTextures[] = {
@ -910,8 +913,8 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) {
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, sTextAlpha); gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, sTextAlpha);
rectLeft = PRESS_START_LEFT + 1; rectLeft = PRESS_START_LEFT + 1;
for (i = 0; i < ARRAY_COUNT(pressStartFontIndices); i++) { for (i = 0; i < ARRAY_COUNT(sPressStartFontIndices); i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, EnMag_DrawCharTexture(&gfx, font->fontBuf + sPressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft,
PRESS_START_TOP + 1); PRESS_START_TOP + 1);
rectLeft += PRESS_START_CHAR_SPACING; rectLeft += PRESS_START_CHAR_SPACING;
@ -925,8 +928,8 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) {
gDPSetPrimColor(gfx++, 0, 0, 255, 30, 30, sTextAlpha); gDPSetPrimColor(gfx++, 0, 0, 255, 30, 30, sTextAlpha);
rectLeft = PRESS_START_LEFT; rectLeft = PRESS_START_LEFT;
for (i = 0; i < ARRAY_COUNT(pressStartFontIndices); i++) { for (i = 0; i < ARRAY_COUNT(sPressStartFontIndices); i++) {
EnMag_DrawCharTexture(&gfx, font->fontBuf + pressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft, EnMag_DrawCharTexture(&gfx, font->fontBuf + sPressStartFontIndices[i] * FONT_CHAR_TEX_SIZE, rectLeft,
PRESS_START_TOP); PRESS_START_TOP);
rectLeft += PRESS_START_CHAR_SPACING; rectLeft += PRESS_START_CHAR_SPACING;
if (i == 4) { if (i == 4) {

View File

@ -80,7 +80,7 @@ static InitChainEntry sInitChain[] = {
void EnMinifrog_Init(Actor* thisx, PlayState* play) { void EnMinifrog_Init(Actor* thisx, PlayState* play) {
EnMinifrog* this = THIS; EnMinifrog* this = THIS;
int i; s32 i;
Actor_ProcessInitChain(&this->actor, sInitChain); Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f);
@ -107,6 +107,7 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) {
this->flags = 0; this->flags = 0;
this->timer = 0; this->timer = 0;
//! FAKE:
if (1) {} if (1) {}
if (!EN_FROG_IS_RETURNED(&this->actor)) { if (!EN_FROG_IS_RETURNED(&this->actor)) {

View File

@ -429,12 +429,10 @@ void EnMinislime_Idle(EnMinislime* this, PlayState* play) {
if (this->idleTimer == 0) { if (this->idleTimer == 0) {
if (this->actor.xzDistToPlayer < 300.0f) { if (this->actor.xzDistToPlayer < 300.0f) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer;
} else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 200.0f) {
this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos);
} else { } else {
if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) < 200.0f) { this->actor.world.rot.y += (s16)((s32)Rand_Next() >> 0x13);
this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos);
} else {
this->actor.world.rot.y += (s16)((s32)Rand_Next() >> 0x13);
}
} }
this->idleTimer = 20; this->idleTimer = 20;
} }

View File

@ -55,22 +55,35 @@ static ColliderCylinderInit sCylinderInit = {
{ 30, 40, 0, { 0, 0, 0 } }, { 30, 40, 0, { 0, 0, 0 } },
}; };
s32 func_809592E0(EnMk* this, s16 index) { typedef enum MarineResearcherAnimation {
AnimationHeader* sAnimations[] = { /* -1 */ MARINE_RESEARCHER_ANIM_NONE = -1,
&gMarineResearcherIdleAnim, &gMarineResearcherHeadWaggleAnim, &gMarineResearcherYellAnim, /* 0 */ MARINE_RESEARCHER_ANIM_IDLE,
&gMarineResearcherShakeInFearAnim, &gMarineResearcherStrokeChinAnim, /* 1 */ MARINE_RESEARCHER_ANIM_HEAD_WAGGLE,
/* 2 */ MARINE_RESEARCHER_ANIM_YELL,
/* 3 */ MARINE_RESEARCHER_ANIM_SHAKE_IN_FEAR,
/* 4 */ MARINE_RESEARCHER_ANIM_STROKE_CHIN,
/* 5 */ MARINE_RESEARCHER_ANIM_MAX
} MarineResearcherAnimation;
s32 EnMk_ChangeAnim(EnMk* this, s16 animIndex) {
AnimationHeader* sAnimations[MARINE_RESEARCHER_ANIM_MAX] = {
&gMarineResearcherIdleAnim, // MARINE_RESEARCHER_ANIM_IDLE
&gMarineResearcherHeadWaggleAnim, // MARINE_RESEARCHER_ANIM_HEAD_WAGGLE
&gMarineResearcherYellAnim, // MARINE_RESEARCHER_ANIM_YELL
&gMarineResearcherShakeInFearAnim, // MARINE_RESEARCHER_ANIM_SHAKE_IN_FEAR
&gMarineResearcherStrokeChinAnim, // MARINE_RESEARCHER_ANIM_STROKE_CHIN
}; };
if (index == this->unk_27C) { if (animIndex == this->animIndex) {
return false; return false;
} }
if ((index < 0) || (index >= 5)) { if ((animIndex <= MARINE_RESEARCHER_ANIM_NONE) || (animIndex >= MARINE_RESEARCHER_ANIM_MAX)) {
return false; return false;
} }
Animation_PlayLoop(&this->skelAnime, sAnimations[index]); Animation_PlayLoop(&this->skelAnime, sAnimations[animIndex]);
this->unk_27C = index; this->animIndex = animIndex;
return true; return true;
} }
@ -85,8 +98,8 @@ void EnMk_Init(Actor* thisx, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gMarineResearcherSkel, &gMarineResearcherIdleAnim, this->jointTable, SkelAnime_InitFlex(play, &this->skelAnime, &gMarineResearcherSkel, &gMarineResearcherIdleAnim, this->jointTable,
this->morphTable, MARINE_RESEARCHER_LIMB_MAX); this->morphTable, MARINE_RESEARCHER_LIMB_MAX);
this->unk_27C = -1; this->animIndex = MARINE_RESEARCHER_ANIM_NONE;
func_809592E0(this, 0); EnMk_ChangeAnim(this, MARINE_RESEARCHER_ANIM_IDLE);
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.mass = MASS_IMMOVABLE;
@ -133,14 +146,15 @@ void func_8095954C(EnMk* this, PlayState* play) {
case 3: case 3:
case 4: case 4:
case 5: case 5:
func_809592E0(this, play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_127)]->id - 1); EnMk_ChangeAnim(this,
play->csCtx.actorCues[Cutscene_GetCueChannel(play, CS_CMD_ACTOR_CUE_127)]->id - 1);
break; break;
default: default:
break; break;
} }
} else { } else {
func_809592E0(this, 0); EnMk_ChangeAnim(this, MARINE_RESEARCHER_ANIM_IDLE);
} }
} }

View File

@ -17,7 +17,7 @@ typedef struct EnMk {
/* 0x270 */ Vec3s unk_270; /* 0x270 */ Vec3s unk_270;
/* 0x276 */ s16 csIdList[2]; /* 0x276 */ s16 csIdList[2];
/* 0x27A */ u16 unk_27A; /* 0x27A */ u16 unk_27A;
/* 0x27C */ s16 unk_27C; /* 0x27C */ s16 animIndex;
/* 0x280 */ EnMkActionFunc actionFunc; /* 0x280 */ EnMkActionFunc actionFunc;
} EnMk; // size = 0x284 } EnMk; // size = 0x284

View File

@ -168,9 +168,9 @@ void EnMkk_Init(Actor* thisx, PlayState* play) {
this->actor.params &= 1; this->actor.params &= 1;
if (this->actor.params == 1) { if (this->actor.params == 1) {
this->actor.hintId = 0x3C; this->actor.hintId = TATL_HINT_ID_WHITE_BOE;
} else { } else {
this->actor.hintId = 0x2C; this->actor.hintId = TATL_HINT_ID_BLACK_BOE;
} }
if ((paramsFF00 == 0) || (paramsFF00 == 255)) { if ((paramsFF00 == 0) || (paramsFF00 == 255)) {
@ -279,7 +279,7 @@ void func_80A4E2E8(EnMkk* this, PlayState* play) {
if (sp20) { if (sp20) {
this->unk_14B &= ~2; this->unk_14B &= ~2;
func_80A4E190(this); func_80A4E190(this);
} else if ((this->unk_149 == 0) && (!(player->stateFlags3 & PLAYER_STATE3_100)) && } else if ((this->unk_149 == 0) && !(player->stateFlags3 & PLAYER_STATE3_100) &&
(Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
Actor_IsFacingPlayer(&this->actor, 0x1800) && (this->actor.xzDistToPlayer < 120.0f) && Actor_IsFacingPlayer(&this->actor, 0x1800) && (this->actor.xzDistToPlayer < 120.0f) &&
(fabsf(this->actor.playerHeightRel) < 100.0f)) { (fabsf(this->actor.playerHeightRel) < 100.0f)) {

View File

@ -87,7 +87,7 @@ void EnMm_Init(Actor* thisx, PlayState* play) {
func_80965BBC(this); func_80965BBC(this);
return; return;
} }
if (this->actor.csId >= 0) { if (this->actor.csId > CS_ID_NONE) {
action = func_80965D3C; action = func_80965D3C;
} else { } else {
action = func_80965DB4; action = func_80965DB4;

View File

@ -57,6 +57,9 @@ void EnMm2_Reading(EnMm2* this, PlayState* play) {
case TEXT_STATE_CLOSING: case TEXT_STATE_CLOSING:
this->actionFunc = EnMm2_WaitForRead; this->actionFunc = EnMm2_WaitForRead;
break; break;
default:
break;
} }
} }

View File

@ -5,7 +5,6 @@
*/ */
#include "z_en_mm3.h" #include "z_en_mm3.h"
#include "objects/object_mm/object_mm.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10) #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10)
@ -63,15 +62,27 @@ static ColliderCylinderInit sCylinderInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
static AnimationInfo sAnimationInfo[] = { typedef enum EnMm3Animation {
{ &object_mm_Anim_002238, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, /* 0 */ ENMM3_ANIM_0,
{ &object_mm_Anim_00A4E0, -1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, /* 1 */ ENMM3_ANIM_1,
{ &object_mm_Anim_00C640, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, /* 2 */ ENMM3_ANIM_2,
{ &object_mm_Anim_00A4E0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, /* 3 */ ENMM3_ANIM_3,
{ &object_mm_Anim_000468, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, /* 4 */ ENMM3_ANIM_4,
{ &object_mm_Anim_00CD90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, /* 5 */ ENMM3_ANIM_5,
{ &object_mm_Anim_00DA50, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, /* 6 */ ENMM3_ANIM_6,
{ &object_mm_Anim_00DA50, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f }, /* 7 */ ENMM3_ANIM_7,
/* 8 */ ENMM3_ANIM_MAX
} EnMm3Animation;
static AnimationInfo sAnimationInfo[ENMM3_ANIM_MAX] = {
{ &object_mm_Anim_002238, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, // ENMM3_ANIM_0
{ &object_mm_Anim_00A4E0, -1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, // ENMM3_ANIM_1
{ &object_mm_Anim_00C640, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, // ENMM3_ANIM_2
{ &object_mm_Anim_00A4E0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -7.0f }, // ENMM3_ANIM_3
{ &object_mm_Anim_000468, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -7.0f }, // ENMM3_ANIM_4
{ &object_mm_Anim_00CD90, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, // ENMM3_ANIM_5
{ &object_mm_Anim_00DA50, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -12.0f }, // ENMM3_ANIM_6
{ &object_mm_Anim_00DA50, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f }, // ENMM3_ANIM_7
}; };
#include "overlays/ovl_En_Mm3/ovl_En_Mm3.c" #include "overlays/ovl_En_Mm3/ovl_En_Mm3.c"
@ -86,7 +97,7 @@ void EnMm3_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &object_mm_Skel_0096E8, &object_mm_Anim_00A4E0, this->jointTable, SkelAnime_InitFlex(play, &this->skelAnime, &object_mm_Skel_0096E8, &object_mm_Anim_00A4E0, this->jointTable,
this->morphTable, 16); this->morphTable, OBJECT_MM_LIMB_MAX);
Animation_Change(&this->skelAnime, &object_mm_Anim_00A4E0, -1.0f, Animation_GetLastFrame(&object_mm_Anim_00A4E0), Animation_Change(&this->skelAnime, &object_mm_Anim_00A4E0, -1.0f, Animation_GetLastFrame(&object_mm_Anim_00A4E0),
0.0f, ANIMMODE_ONCE, 0.0f); 0.0f, ANIMMODE_ONCE, 0.0f);
Collider_InitCylinder(play, &this->collider); Collider_InitCylinder(play, &this->collider);
@ -123,7 +134,7 @@ s32 func_80A6F22C(EnMm3* this) {
void func_80A6F270(EnMm3* this) { void func_80A6F270(EnMm3* this) {
this->unk_1DC = 1; this->unk_1DC = 1;
this->unk_2B0 &= ~1; this->unk_2B0 &= ~1;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENMM3_ANIM_5);
this->actionFunc = func_80A6F2C8; this->actionFunc = func_80A6F2C8;
} }
@ -192,6 +203,9 @@ void func_80A6F3B4(EnMm3* this, PlayState* play) {
Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_POSTMAN); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_POSTMAN);
} }
break; break;
default:
break;
} }
} }
} }
@ -215,7 +229,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) {
} }
this->unk_1DC = 0; this->unk_1DC = 0;
this->unk_2B0 |= 1; this->unk_2B0 |= 1;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 7); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENMM3_ANIM_7);
break; break;
case 0x278B: case 0x278B:
@ -298,6 +312,9 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) {
Message_StartTextbox(play, 0x279A, &this->actor); Message_StartTextbox(play, 0x279A, &this->actor);
this->unk_2B4 = 0x279A; this->unk_2B4 = 0x279A;
break; break;
default:
break;
} }
} else if ((this->unk_2AC > 0) && (this->unk_2B4 == 0x2791)) { } else if ((this->unk_2AC > 0) && (this->unk_2B4 == 0x2791)) {
this->unk_2AC--; this->unk_2AC--;
@ -357,10 +374,13 @@ void func_80A6F9DC(EnMm3* this, PlayState* play) {
} }
} }
break; break;
default:
break;
} }
if ((this->skelAnime.mode == 2) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if ((this->skelAnime.mode == ANIMMODE_ONCE) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENMM3_ANIM_2);
} }
if (((this->unk_2B4 == 0x279D) || (this->unk_2B4 == 0x27A0) || (this->unk_2B4 == 0x278B)) && if (((this->unk_2B4 == 0x279D) || (this->unk_2B4 == 0x27A0) || (this->unk_2B4 == 0x278B)) &&
@ -541,10 +561,10 @@ void EnMm3_Update(Actor* thisx, PlayState* play) {
s32 EnMm3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 EnMm3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnMm3* this = THIS; EnMm3* this = THIS;
if (limbIndex == 8) { if (limbIndex == OBJECT_MM_LIMB_08) {
rot->x += this->unk_2A6.y; rot->x += this->unk_2A6.y;
rot->y -= this->unk_2A6.x; rot->y -= this->unk_2A6.x;
} else if (limbIndex == 15) { } else if (limbIndex == OBJECT_MM_LIMB_0F) {
rot->x += this->unk_2A0.y; rot->x += this->unk_2A0.y;
rot->z += this->unk_2A0.x; rot->z += this->unk_2A0.x;
if ((this->unk_2B0 & 2) && ((play->gameplayFrames % 3) == 0)) { if ((this->unk_2B0 & 2) && ((play->gameplayFrames % 3) == 0)) {
@ -557,7 +577,7 @@ s32 EnMm3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
void EnMm3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { void EnMm3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
EnMm3* this = THIS; EnMm3* this = THIS;
if (limbIndex == 15) { if (limbIndex == OBJECT_MM_LIMB_0F) {
Matrix_MultVec3f(&D_80A704F0, &this->actor.focus.pos); Matrix_MultVec3f(&D_80A704F0, &this->actor.focus.pos);
} }
} }

View File

@ -2,6 +2,7 @@
#define Z_EN_MM3_H #define Z_EN_MM3_H
#include "global.h" #include "global.h"
#include "objects/object_mm/object_mm.h"
struct EnMm3; struct EnMm3;
@ -19,8 +20,8 @@ typedef struct EnMm3 {
/* 0x1D4 */ EnMm3ActionFunc actionFunc; /* 0x1D4 */ EnMm3ActionFunc actionFunc;
/* 0x1D8 */ UNK_TYPE1 unk1D8[4]; /* 0x1D8 */ UNK_TYPE1 unk1D8[4];
/* 0x1DC */ s32 unk_1DC; /* 0x1DC */ s32 unk_1DC;
/* 0x1E0 */ Vec3s jointTable[16]; /* 0x1E0 */ Vec3s jointTable[OBJECT_MM_LIMB_MAX];
/* 0x240 */ Vec3s morphTable[16]; /* 0x240 */ Vec3s morphTable[OBJECT_MM_LIMB_MAX];
/* 0x2A0 */ Vec3s unk_2A0; /* 0x2A0 */ Vec3s unk_2A0;
/* 0x2A6 */ Vec3s unk_2A6; /* 0x2A6 */ Vec3s unk_2A6;
/* 0x2AC */ s16 unk_2AC; /* 0x2AC */ s16 unk_2AC;

View File

@ -5,7 +5,6 @@
*/ */
#include "z_en_ms.h" #include "z_en_ms.h"
#include "objects/object_ms/object_ms.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@ -62,7 +61,7 @@ void EnMs_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
SkelAnime_InitFlex(play, &this->skelAnime, &gBeanSalesmanSkel, &gBeanSalesmanEatingAnim, this->jointTable, SkelAnime_InitFlex(play, &this->skelAnime, &gBeanSalesmanSkel, &gBeanSalesmanEatingAnim, this->jointTable,
this->morphTable, 9); this->morphTable, BEAN_SALESMAN_LIMB_MAX);
Collider_InitCylinder(play, &this->collider); Collider_InitCylinder(play, &this->collider);
Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
@ -84,9 +83,9 @@ void EnMs_Wait(EnMs* this, PlayState* play) {
s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (gSaveContext.save.saveInfo.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) { if (gSaveContext.save.saveInfo.inventory.items[SLOT_MAGIC_BEANS] == ITEM_NONE) {
this->actor.textId = 0x92E; // "[...] You're the first customer [...]" this->actor.textId = 0x92E;
} else { } else {
this->actor.textId = 0x932; // "[...] So you liked my Magic Beans [...]" this->actor.textId = 0x932;
} }
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
@ -120,10 +119,10 @@ void EnMs_Talk(EnMs* this, PlayState* play) {
Message_CloseTextbox(play); Message_CloseTextbox(play);
if (gSaveContext.save.saveInfo.playerData.rupees < 10) { if (gSaveContext.save.saveInfo.playerData.rupees < 10) {
Audio_PlaySfx(NA_SE_SY_ERROR); Audio_PlaySfx(NA_SE_SY_ERROR);
Message_ContinueTextbox(play, 0x935); // "[...] You don't have enough Rupees." Message_ContinueTextbox(play, 0x935);
} else if (AMMO(ITEM_MAGIC_BEANS) >= 20) { } else if (AMMO(ITEM_MAGIC_BEANS) >= 20) {
Audio_PlaySfx(NA_SE_SY_ERROR); Audio_PlaySfx(NA_SE_SY_ERROR);
Message_ContinueTextbox(play, 0x937); // "[...] You can't carry anymore." Message_ContinueTextbox(play, 0x937);
} else { } else {
Audio_PlaySfx_MessageDecide(); Audio_PlaySfx_MessageDecide();
Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEANS, 90.0f, 10.0f); Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEANS, 90.0f, 10.0f);
@ -135,7 +134,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) {
case 1: // no case 1: // no
default: default:
Audio_PlaySfx_MessageCancel(); Audio_PlaySfx_MessageCancel();
Message_ContinueTextbox(play, 0x934); // "[...] Well, if your mood changes [...]" Message_ContinueTextbox(play, 0x934);
break; break;
} }
} }
@ -159,7 +158,7 @@ void EnMs_Sell(EnMs* this, PlayState* play) {
void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
Message_ContinueTextbox(play, 0x936); // "You can plant 'em whenever you want [...]" Message_ContinueTextbox(play, 0x936);
this->actionFunc = EnMs_Talk; this->actionFunc = EnMs_Talk;
} else { } else {
Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel, Actor_OfferTalkExchange(&this->actor, play, this->actor.xzDistToPlayer, this->actor.playerHeightRel,

View File

@ -2,6 +2,7 @@
#define Z_EN_MS_H #define Z_EN_MS_H
#include "global.h" #include "global.h"
#include "objects/object_ms/object_ms.h"
struct EnMs; struct EnMs;
@ -10,8 +11,8 @@ typedef void (*EnMsActionFunc)(struct EnMs*, PlayState*);
typedef struct EnMs { typedef struct EnMs {
/* 0x000 */ Actor actor; /* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime; /* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[9]; /* 0x188 */ Vec3s jointTable[BEAN_SALESMAN_LIMB_MAX];
/* 0x1BE */ Vec3s morphTable[9]; /* 0x1BE */ Vec3s morphTable[BEAN_SALESMAN_LIMB_MAX];
/* 0x1F4 */ EnMsActionFunc actionFunc; /* 0x1F4 */ EnMsActionFunc actionFunc;
/* 0x1F8 */ ColliderCylinder collider; /* 0x1F8 */ ColliderCylinder collider;
} EnMs; // size = 0x244 } EnMs; // size = 0x244

View File

@ -154,11 +154,11 @@ s32 EnMttag_GetCurrentCheckpoint(Actor* actor, PlayState* play, s32* upcomingChe
// Iterates through all possible checkpoints that are associated with this sceneExitIndex. // Iterates through all possible checkpoints that are associated with this sceneExitIndex.
do { do {
if ((Math3D_PointDistToLine2D( if (Math3D_PointDistToLine2D(
actor->world.pos.x, actor->world.pos.z, (&sCheckpointPositions[checkpointIterator])[-1].x, actor->world.pos.x, actor->world.pos.z, (&sCheckpointPositions[checkpointIterator])[-1].x,
(&sCheckpointPositions[checkpointIterator])[-1].z, (&sCheckpointPositions[checkpointIterator])[1].x, (&sCheckpointPositions[checkpointIterator])[-1].z, (&sCheckpointPositions[checkpointIterator])[1].x,
(&sCheckpointPositions[checkpointIterator])[1].z, &perpendicularPointX, &perpendicularPointZ, (&sCheckpointPositions[checkpointIterator])[1].z, &perpendicularPointX, &perpendicularPointZ,
&lineLenSq)) && &lineLenSq) &&
(!hasSetCurrentCheckpointOnce || ((curentCheckpoint + 1) == checkpointIterator) || (!hasSetCurrentCheckpointOnce || ((curentCheckpoint + 1) == checkpointIterator) ||
(lineLenSq < minLineLengthSq))) { (lineLenSq < minLineLengthSq))) {
minLineLengthSq = lineLenSq; minLineLengthSq = lineLenSq;
@ -313,23 +313,19 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) {
EnMttag_ShowFalseStartMessage(this, play); EnMttag_ShowFalseStartMessage(this, play);
SET_EVENTINF(EVENTINF_13); SET_EVENTINF(EVENTINF_13);
} else { } else if (DECR(this->timer) == 60) {
if (DECR(this->timer) == 60) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 0);
Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3;
play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_RACE | SEQ_FLAG_ASYNC);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_GORON_RACE | SEQ_FLAG_ASYNC); play->envCtx.timeSeqState = TIMESEQ_REQUEST;
play->envCtx.timeSeqState = TIMESEQ_REQUEST; player->stateFlags1 &= ~PLAYER_STATE1_20;
player->stateFlags1 &= ~PLAYER_STATE1_20; } else if ((this->timer < 60) && (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO)) {
} else if ((this->timer < 60) && (play->interfaceCtx.minigameState == MINIGAME_STATE_COUNTDOWN_GO)) { this->timer = 0;
this->timer = 0; SET_EVENTINF(EVENTINF_10);
SET_EVENTINF(EVENTINF_10); this->actionFunc = EnMttag_Race;
this->actionFunc = EnMttag_Race;
}
}
} else {
if (EnMttag_AreFourRaceGoronsPresent(this, play)) {
this->raceInitialized = true;
} }
} else if (EnMttag_AreFourRaceGoronsPresent(this, play)) {
this->raceInitialized = true;
} }
} }
@ -341,7 +337,7 @@ s32 EnMttag_IsAnyRaceGoronOverFinishLine(EnMttag* this) {
s32 i; s32 i;
for (i = 0; i < ARRAY_COUNT(this->raceGorons); i++) { for (i = 0; i < ARRAY_COUNT(this->raceGorons); i++) {
if ((EnMttag_IsInFinishLine(&this->raceGorons[i]->actor.world.pos)) && if (EnMttag_IsInFinishLine(&this->raceGorons[i]->actor.world.pos) &&
(this->raceGorons[i]->actor.update != NULL)) { (this->raceGorons[i]->actor.update != NULL)) {
isAnyRaceGoronOverFinishLine = true; isAnyRaceGoronOverFinishLine = true;
break; break;
@ -417,7 +413,7 @@ void EnMttag_RaceFinish(EnMttag* this, PlayState* play) {
void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) { void EnMttag_PotentiallyRestartRace(EnMttag* this, PlayState* play) {
u8 talkState = Message_GetState(&play->msgCtx); u8 talkState = Message_GetState(&play->msgCtx);
if (((talkState == TEXT_STATE_5 && Message_ShouldAdvance(play)) || talkState == TEXT_STATE_CLOSING)) { if (((talkState == TEXT_STATE_5) && Message_ShouldAdvance(play)) || (talkState == TEXT_STATE_CLOSING)) {
if (this->shouldRestartRace) { if (this->shouldRestartRace) {
play->nextEntrance = ENTRANCE(GORON_RACETRACK, 1); play->nextEntrance = ENTRANCE(GORON_RACETRACK, 1);

View File

@ -6,7 +6,6 @@
#include "overlays/actors/ovl_Obj_Bean/z_obj_bean.h" #include "overlays/actors/ovl_Obj_Bean/z_obj_bean.h"
#include "z_en_mushi2.h" #include "z_en_mushi2.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_10) #define FLAGS (ACTOR_FLAG_10)
@ -755,7 +754,7 @@ void EnMushi2_Init(Actor* thisx, PlayState* play) {
this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y;
func_80A68F24(this); func_80A68F24(this);
SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, this->jointTable, SkelAnime_Init(play, &this->skelAnime, &gameplay_keep_Skel_0527A0, &gameplay_keep_Anim_05140C, this->jointTable,
this->morphTable, 24); this->morphTable, BUG_LIMB_MAX);
Animation_Change(&this->skelAnime, &gameplay_keep_Anim_05140C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f); Animation_Change(&this->skelAnime, &gameplay_keep_Anim_05140C, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, 0.0f);
Collider_InitJntSph(play, &this->collider); Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements);

View File

@ -2,6 +2,7 @@
#define Z_EN_MUSHI2_H #define Z_EN_MUSHI2_H
#include "global.h" #include "global.h"
#include "objects/gameplay_keep/gameplay_keep.h"
struct EnMushi2; struct EnMushi2;
@ -25,8 +26,8 @@ typedef struct {
typedef struct EnMushi2 { typedef struct EnMushi2 {
/* 0x000 */ Actor actor; /* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime; /* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[24]; /* 0x188 */ Vec3s jointTable[BUG_LIMB_MAX];
/* 0x218 */ Vec3s morphTable[24]; /* 0x218 */ Vec3s morphTable[BUG_LIMB_MAX];
/* 0x2A8 */ ColliderJntSph collider; /* 0x2A8 */ ColliderJntSph collider;
/* 0x2C8 */ ColliderJntSphElement colliderElements[1]; /* 0x2C8 */ ColliderJntSphElement colliderElements[1];
/* 0x308 */ EnMushi2ActionFunc actionFunc; /* 0x308 */ EnMushi2ActionFunc actionFunc;

View File

@ -5,7 +5,6 @@
*/ */
#include "z_en_muto.h" #include "z_en_muto.h"
#include "objects/object_toryo/object_toryo.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY) #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY)
@ -16,13 +15,10 @@ void EnMuto_Destroy(Actor* thisx, PlayState* play);
void EnMuto_Update(Actor* thisx, PlayState* play2); void EnMuto_Update(Actor* thisx, PlayState* play2);
void EnMuto_Draw(Actor* thisx, PlayState* play); void EnMuto_Draw(Actor* thisx, PlayState* play);
void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex);
void EnMuto_SetHeadRotation(EnMuto* this);
void EnMuto_SetupIdle(EnMuto* this); void EnMuto_SetupIdle(EnMuto* this);
void EnMuto_Idle(EnMuto* this, PlayState* play); void EnMuto_Idle(EnMuto* this, PlayState* play);
void EnMuto_SetupDialogue(EnMuto* this, PlayState* play); void EnMuto_SetupDialogue(EnMuto* this, PlayState* play);
void EnMuto_InDialogue(EnMuto* this, PlayState* play); void EnMuto_InDialogue(EnMuto* this, PlayState* play);
s32 EnMuto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
ActorInit En_Muto_InitVars = { ActorInit En_Muto_InitVars = {
/**/ ACTOR_EN_MUTO, /**/ ACTOR_EN_MUTO,
@ -64,7 +60,7 @@ void EnMuto_Init(Actor* thisx, PlayState* play) {
this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.colChkInfo.mass = MASS_IMMOVABLE;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &object_toryo_Skel_007150, &object_toryo_Anim_000E50, this->jointTable, SkelAnime_InitFlex(play, &this->skelAnime, &object_toryo_Skel_007150, &object_toryo_Anim_000E50, this->jointTable,
this->morphTable, 17); this->morphTable, OBJECT_TORYO_LIMB_MAX);
this->isInMayorsRoom = this->actor.params; this->isInMayorsRoom = this->actor.params;
if (!this->isInMayorsRoom) { if (!this->isInMayorsRoom) {
@ -99,13 +95,28 @@ void EnMuto_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider); Collider_DestroyCylinder(play, &this->collider);
} }
void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex) { typedef enum EnMutoAnimation {
static AnimationHeader* sAnimations[] = { &object_toryo_Anim_000E50, &object_toryo_Anim_000E50 }; /* -1 */ ENMUTO_ANIM_NONE = -1,
static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_ONCE }; /* 0 */ ENMUTO_ANIM_0,
/* 1 */ ENMUTO_ANIM_1,
/* 2 */ ENMUTO_ANIM_MAX
} EnMutoAnimation;
static AnimationHeader* sAnimations[ENMUTO_ANIM_MAX] = {
&object_toryo_Anim_000E50, // ENMUTO_ANIM_0
&object_toryo_Anim_000E50, // ENMUTO_ANIM_1
};
static u8 sAnimationModes[ENMUTO_ANIM_MAX] = {
ANIMMODE_LOOP, // ENMUTO_ANIM_0
ANIMMODE_ONCE, // ENMUTO_ANIM_1
};
void EnMuto_ChangeAnim(EnMuto* this, s32 animIndex) {
this->animIndex = animIndex; this->animIndex = animIndex;
this->frameIndex = Animation_GetLastFrame(&sAnimations[animIndex]->common); this->animEndFrame = Animation_GetLastFrame(&sAnimations[animIndex]->common);
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameIndex,
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame,
sAnimationModes[this->animIndex], -4.0f); sAnimationModes[this->animIndex], -4.0f);
} }
@ -144,7 +155,8 @@ void EnMuto_Idle(EnMuto* this, PlayState* play) {
} }
} }
if (1) {} // Needed to match //! FAKE:
if (1) {}
if (!this->isInMayorsRoom && (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK)) { if (!this->isInMayorsRoom && (Player_GetMask(play) == PLAYER_MASK_KAFEIS_MASK)) {
this->actor.textId = 0x2363; this->actor.textId = 0x2363;
@ -221,10 +233,10 @@ void EnMuto_InDialogue(EnMuto* this, PlayState* play) {
this->skelAnime.playSpeed = 1.0f; this->skelAnime.playSpeed = 1.0f;
} }
} else { } else {
f32 frameIndex = this->skelAnime.curFrame; f32 curFrame = this->skelAnime.curFrame;
this->yawTowardsTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->targetActor->world.pos); this->yawTowardsTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->targetActor->world.pos);
if (this->frameIndex <= frameIndex) { if (curFrame >= this->animEndFrame) {
this->skelAnime.playSpeed = 0.0f; this->skelAnime.playSpeed = 0.0f;
} }
} }
@ -285,11 +297,11 @@ void EnMuto_Update(Actor* thisx, PlayState* play2) {
s32 EnMuto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { s32 EnMuto_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnMuto* this = THIS; EnMuto* this = THIS;
if (limbIndex == 1) { if (limbIndex == OBJECT_TORYO_LIMB_01) {
rot->x += this->waistRot.y; rot->x += this->waistRot.y;
} }
if (limbIndex == 15) { if (limbIndex == OBJECT_TORYO_LIMB_0F) {
rot->x += this->headRot.y; rot->x += this->headRot.y;
rot->z += this->headRot.x; rot->z += this->headRot.x;
} }

View File

@ -2,6 +2,7 @@
#define Z_EN_MUTO_H #define Z_EN_MUTO_H
#include "global.h" #include "global.h"
#include "objects/object_toryo/object_toryo.h"
struct EnMuto; struct EnMuto;
@ -10,15 +11,15 @@ typedef void (*EnMutoActionFunc)(struct EnMuto*, PlayState*);
typedef struct EnMuto { typedef struct EnMuto {
/* 0x000 */ Actor actor; /* 0x000 */ Actor actor;
/* 0x144 */ SkelAnime skelAnime; /* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s jointTable[17]; /* 0x188 */ Vec3s jointTable[OBJECT_TORYO_LIMB_MAX];
/* 0x1EE */ Vec3s morphTable[17]; /* 0x1EE */ Vec3s morphTable[OBJECT_TORYO_LIMB_MAX];
/* 0x254 */ EnMutoActionFunc actionFunc; /* 0x254 */ EnMutoActionFunc actionFunc;
/* 0x258 */ Vec3s headRot; /* 0x258 */ Vec3s headRot;
/* 0x25E */ Vec3s headRotTarget; /* 0x25E */ Vec3s headRotTarget;
/* 0x262 */ Vec3s waistRot; /* 0x262 */ Vec3s waistRot;
/* 0x26A */ Vec3s waistRotTarget; /* 0x26A */ Vec3s waistRotTarget;
/* 0x270 */ s16 unusedCounter; /* 0x270 */ s16 unusedCounter;
/* 0x274 */ f32 frameIndex; /* 0x274 */ f32 animEndFrame;
/* 0x278 */ s16 isInDialogue; /* 0x278 */ s16 isInDialogue;
/* 0x27A */ s16 textIdIndex; /* 0x27A */ s16 textIdIndex;
/* 0x27C */ s16 yawTowardsTarget; /* 0x27C */ s16 yawTowardsTarget;

View File

@ -272,7 +272,7 @@ void EnPp_Init(Actor* thisx, PlayState* play) {
this->bodyCollider.elements[0].dim.scale = 1.0f; this->bodyCollider.elements[0].dim.scale = 1.0f;
if (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED) { if (EN_PP_GET_TYPE(&this->actor) > EN_PP_TYPE_MASKED) {
this->actor.hintId = 0x25; this->actor.hintId = TATL_HINT_ID_HIPLOOP;
this->maskColliderElements[0].info.toucherFlags &= ~TOUCH_ON; this->maskColliderElements[0].info.toucherFlags &= ~TOUCH_ON;
this->maskColliderElements[0].info.bumperFlags &= ~BUMP_ON; this->maskColliderElements[0].info.bumperFlags &= ~BUMP_ON;
this->maskColliderElements[0].info.ocElemFlags &= ~OCELEM_ON; this->maskColliderElements[0].info.ocElemFlags &= ~OCELEM_ON;
@ -286,7 +286,7 @@ void EnPp_Init(Actor* thisx, PlayState* play) {
this->bodyCollider.elements[0].dim.modelSphere.center.x = 400; this->bodyCollider.elements[0].dim.modelSphere.center.x = 400;
this->bodyCollider.elements[0].dim.modelSphere.center.y = -400; this->bodyCollider.elements[0].dim.modelSphere.center.y = -400;
} else { } else {
this->actor.hintId = 0x26; this->actor.hintId = TATL_HINT_ID_MASKED_HIPLOOP;
this->maskCollider.elements[0].dim.modelSphere.radius = 10; this->maskCollider.elements[0].dim.modelSphere.radius = 10;
this->maskCollider.elements[0].dim.scale = 1.0f; this->maskCollider.elements[0].dim.scale = 1.0f;
this->maskCollider.elements[0].dim.modelSphere.center.x = 1000; this->maskCollider.elements[0].dim.modelSphere.center.x = 1000;
@ -647,7 +647,7 @@ void EnPp_Charge(EnPp* this, PlayState* play) {
return; return;
} }
if (!(this->maskCollider.base.atFlags & AT_BOUNCED) && (!(this->bodyCollider.base.atFlags & AT_BOUNCED))) { if (!(this->maskCollider.base.atFlags & AT_BOUNCED) && !(this->bodyCollider.base.atFlags & AT_BOUNCED)) {
if ((this->maskCollider.base.atFlags & AT_HIT) || (this->bodyCollider.base.atFlags & AT_HIT)) { if ((this->maskCollider.base.atFlags & AT_HIT) || (this->bodyCollider.base.atFlags & AT_HIT)) {
EnPp_SetupAttack(this); EnPp_SetupAttack(this);
return; return;

View File

@ -618,7 +618,7 @@ void EnSnowman_Melt(EnSnowman* this, PlayState* play) {
Vec3f smokePos; Vec3f smokePos;
this->work.timer--; this->work.timer--;
if ((this->work.timer >= 38) && (!(this->work.timer & 1))) { if ((this->work.timer >= 38) && !(this->work.timer & 1)) {
smokeVelocity.y = (this->work.timer - 38) * (1.0f / 12.0f); smokeVelocity.y = (this->work.timer - 38) * (1.0f / 12.0f);
smokeVelocity.x = Rand_CenteredFloat(1.5f) * smokeVelocity.y; smokeVelocity.x = Rand_CenteredFloat(1.5f) * smokeVelocity.y;
smokeVelocity.z = Rand_CenteredFloat(1.5f) * smokeVelocity.y; smokeVelocity.z = Rand_CenteredFloat(1.5f) * smokeVelocity.y;

View File

@ -102,8 +102,8 @@ void EnSyatekiOkuta_Init(Actor* thisx, PlayState* play) {
this->actor.floorHeight = this->actor.floorHeight =
BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); BgCheck_EntityRaycastFloor5(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos);
if (!(WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface, if (!WaterBox_GetSurface1_2(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &ySurface,
&waterbox)) || &waterbox) ||
(ySurface <= this->actor.floorHeight)) { (ySurface <= this->actor.floorHeight)) {
Actor_Kill(&this->actor); Actor_Kill(&this->actor);
} else { } else {

View File

@ -528,7 +528,7 @@ void ObjComb_Update(Actor* thisx, PlayState* play) {
if (this->unk_1B5 == 1) { if (this->unk_1B5 == 1) {
if (CutsceneManager_IsNext(this->actor.csId)) { if (CutsceneManager_IsNext(this->actor.csId)) {
CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor); CutsceneManager_StartWithPlayerCs(this->actor.csId, &this->actor);
if (this->actor.csId >= 0) { if (this->actor.csId > CS_ID_NONE) {
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
} }

View File

@ -77,7 +77,7 @@ static InitChainEntry sInitChain[] = {
}; };
void func_80A4CA90(ObjFireshield* this) { void func_80A4CA90(ObjFireshield* this) {
if (this->actor.csId >= 0) { if (this->actor.csId > CS_ID_NONE) {
this->actionFunc = func_80A4CABC; this->actionFunc = func_80A4CABC;
} else { } else {
this->actionFunc = func_80A4CC54; this->actionFunc = func_80A4CC54;

View File

@ -113,7 +113,7 @@ void func_80C06CD8(ObjMuPict* this, PlayState* play) {
case TEXT_STATE_DONE: case TEXT_STATE_DONE:
if (Message_ShouldAdvance(play)) { if (Message_ShouldAdvance(play)) {
func_80C06B5C(this); func_80C06B5C(this);
if (this->actor.csId >= 0) { if (this->actor.csId > CS_ID_NONE) {
CutsceneManager_Stop(this->actor.csId); CutsceneManager_Stop(this->actor.csId);
} }
} }

View File

@ -13924,7 +13924,7 @@ void Player_Action_5(Player* this, PlayState* play) {
s32 var_v1; s32 var_v1;
f32 var_fv1; f32 var_fv1;
this->skelAnime.mode = 0; this->skelAnime.mode = ANIMMODE_LOOP;
PlayerAnimation_SetUpdateFunction(&this->skelAnime); PlayerAnimation_SetUpdateFunction(&this->skelAnime);
this->skelAnime.animation = func_8082EFE4(this); this->skelAnime.animation = func_8082EFE4(this);
@ -16848,9 +16848,10 @@ void func_808525C4(PlayState* play, Player* this) {
} }
void Player_Action_63(Player* this, PlayState* play) { void Player_Action_63(Player* this, PlayState* play) {
if ((this->unk_AA5 != PLAYER_UNKAA5_4) && ((PlayerAnimation_Update(play, &this->skelAnime) && if ((this->unk_AA5 != PLAYER_UNKAA5_4) &&
(this->skelAnime.animation == D_8085D17C[this->transformation])) || ((PlayerAnimation_Update(play, &this->skelAnime) &&
((this->skelAnime.mode == 0) && (this->av2.actionVar2 == 0)))) { (this->skelAnime.animation == D_8085D17C[this->transformation])) ||
((this->skelAnime.mode == ANIMMODE_LOOP) && (this->av2.actionVar2 == 0)))) {
func_808525C4(play, this); func_808525C4(play, this);
if (!(this->actor.flags & ACTOR_FLAG_20000000) || (this->unk_A90->id == ACTOR_EN_ZOT)) { if (!(this->actor.flags & ACTOR_FLAG_20000000) || (this->unk_A90->id == ACTOR_EN_ZOT)) {
Message_DisplayOcarinaStaff(play, OCARINA_ACTION_FREE_PLAY); Message_DisplayOcarinaStaff(play, OCARINA_ACTION_FREE_PLAY);

View File

@ -130,7 +130,7 @@ void EffectSsEnIce_UpdateFlying(PlayState* play, u32 index, EffectSs* this) {
s16 rand; s16 rand;
if ((this->actor != NULL) && (this->actor->update != NULL)) { if ((this->actor != NULL) && (this->actor->update != NULL)) {
if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && (!(this->actor->colorFilterParams & 0xC000))) { if ((this->life >= 9) && (this->actor->colorFilterTimer != 0) && !(this->actor->colorFilterParams & 0xC000)) {
Math_Vec3f_Sum(&this->actor->world.pos, &this->vec, &this->pos); Math_Vec3f_Sum(&this->actor->world.pos, &this->vec, &this->pos);
this->life++; this->life++;
} else if (this->life == 9) { } else if (this->life == 9) {

View File

@ -7688,7 +7688,7 @@
0x80958CA8:("EnAttackNiw_Update",), 0x80958CA8:("EnAttackNiw_Update",),
0x80958F6C:("EnAttackNiw_OverrideLimbDraw",), 0x80958F6C:("EnAttackNiw_OverrideLimbDraw",),
0x8095909C:("EnAttackNiw_Draw",), 0x8095909C:("EnAttackNiw_Draw",),
0x809592E0:("func_809592E0",), 0x809592E0:("EnMk_ChangeAnim",),
0x80959390:("EnMk_Init",), 0x80959390:("EnMk_Init",),
0x809594F8:("EnMk_Destroy",), 0x809594F8:("EnMk_Destroy",),
0x80959524:("func_80959524",), 0x80959524:("func_80959524",),

View File

@ -8643,7 +8643,7 @@
0x8096E958:("sAppearEffectPrimGreenTargets","s16","[2]",0x4), 0x8096E958:("sAppearEffectPrimGreenTargets","s16","[2]",0x4),
0x8096E95C:("sAppearEffectEnvRedTargets","s16","[2]",0x4), 0x8096E95C:("sAppearEffectEnvRedTargets","s16","[2]",0x4),
0x8096E960:("sAppearEffectEnvBlueTargets","s16","[2]",0x4), 0x8096E960:("sAppearEffectEnvBlueTargets","s16","[2]",0x4),
0x8096E964:("pressStartFontIndices","u8","[10]",0x1), 0x8096E964:("sPressStartFontIndices","u8","[10]",0x1),
0x8096E970:("sAppearEffectMaskTextures","TexturePtr","[6]",0x18), 0x8096E970:("sAppearEffectMaskTextures","TexturePtr","[6]",0x18),
0x8096E988:("sDisplayEffectMaskTextures","TexturePtr","[6]",0x18), 0x8096E988:("sDisplayEffectMaskTextures","TexturePtr","[6]",0x18),
0x8096E9A0:("sEffectTextures","TexturePtr","[6]",0x18), 0x8096E9A0:("sEffectTextures","TexturePtr","[6]",0x18),
@ -12634,7 +12634,7 @@
0x80ABDC50:("Bg_Hakugin_Elvpole_InitVars","UNK_TYPE1","",0x1), 0x80ABDC50:("Bg_Hakugin_Elvpole_InitVars","UNK_TYPE1","",0x1),
0x80AC0090:("En_Ma4_InitVars","UNK_TYPE1","",0x1), 0x80AC0090:("En_Ma4_InitVars","UNK_TYPE1","",0x1),
0x80AC00B0:("D_80AC00B0","UNK_TYPE1","",0x1), 0x80AC00B0:("D_80AC00B0","UNK_TYPE1","",0x1),
0x80AC00DC:("D_80AC00DC","UNK_TYPE1","",0x1), 0x80AC00DC:("sColChkInfoInit","UNK_TYPE1","",0x1),
0x80AC00E8:("D_80AC00E8","UNK_TYPE1","",0x1), 0x80AC00E8:("D_80AC00E8","UNK_TYPE1","",0x1),
0x80AC00FC:("D_80AC00FC","UNK_TYPE1","",0x1), 0x80AC00FC:("D_80AC00FC","UNK_TYPE1","",0x1),
0x80AC010C:("D_80AC010C","UNK_TYPE1","",0x1), 0x80AC010C:("D_80AC010C","UNK_TYPE1","",0x1),