diff --git a/assets/xml/objects/object_dy_obj.xml b/assets/xml/objects/object_dy_obj.xml
index 42b2f6340a..dfad6acf07 100644
--- a/assets/xml/objects/object_dy_obj.xml
+++ b/assets/xml/objects/object_dy_obj.xml
@@ -105,7 +105,7 @@
-
+
diff --git a/include/save.h b/include/save.h
index 14f15f594d..0e0e4ccea4 100644
--- a/include/save.h
+++ b/include/save.h
@@ -753,10 +753,10 @@ typedef enum LinkAge {
#define ITEMGETINF_17 0x17
// ITEMGETINF 0x18-0x1A
-#define ITEMGETINF_INDEX_18_19_1A 1
-#define ITEMGETINF_18 0x18
-#define ITEMGETINF_19 0x19
-#define ITEMGETINF_1A 0x1A
+#define ITEMGETINF_INDEX_SPELLS 1
+#define ITEMGETINF_FARORES_WIND 0x18
+#define ITEMGETINF_DINS_FIRE 0x19
+#define ITEMGETINF_NAYRUS_LOVE 0x1A
#define ITEMGETINF_1B 0x1B
#define ITEMGETINF_1C 0x1C
diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c
index 44dc02ca0d..ed834a2203 100644
--- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c
+++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c
@@ -6,8 +6,10 @@
#include "z_bg_dy_yoseizo.h"
#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h"
+#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
+#include "overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h"
+#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h"
-#include "libc64/qrand.h"
#include "gfx.h"
#include "gfx_setupdl.h"
#include "one_point_cutscene.h"
@@ -17,8 +19,6 @@
#include "segmented_address.h"
#include "sfx.h"
#include "sys_matrix.h"
-#include "terminal.h"
-#include "translation.h"
#include "versions.h"
#include "z_lib.h"
#include "ocarina.h"
@@ -36,46 +36,45 @@
#define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA)
#endif
-typedef enum BgDyYoseizoRewardType {
- /* 0 */ FAIRY_UPGRADE_MAGIC,
- /* 1 */ FAIRY_UPGRADE_DOUBLE_MAGIC,
- /* 2 */ FAIRY_UPGRADE_DOUBLE_DEFENSE
-} BgDyYoseizoRewardType;
-
-typedef enum BgDyYoseizoSpellType {
- /* 0 */ FAIRY_SPELL_FARORES_WIND,
- /* 1 */ FAIRY_SPELL_DINS_FIRE,
- /* 2 */ FAIRY_SPELL_NAYRUS_LOVE
-} BgDyYoseizoSpellType;
-
void BgDyYoseizo_Init(Actor* thisx, PlayState* play2);
void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play);
void BgDyYoseizo_Update(Actor* thisx, PlayState* play2);
+
+void BgDyYoseizo_WaitSong(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_SetupCutscene(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Revisit_SetupAppear(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Revisit_Appear(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Revisit_FinishAppear(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Revisit_SetupTalk(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Revisit_Talk(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Revisit_SetupRefillPlayerEnergy(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Revisit_RefillPlayerEnergy(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Revisit_WaitTalkEnd(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_SetupDisappear(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Disappear(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Kill(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Reward_WaitCutscene(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Reward_Appear(BgDyYoseizo* this, PlayState* play);
+void BgDyYoseizo_Reward_GiveReward(BgDyYoseizo* this, PlayState* play);
void BgDyYoseizo_Draw(Actor* thisx, PlayState* play);
-
-void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_Vanish(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, PlayState* play);
-void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play);
-
-void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel,
- Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type);
+void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f*, Vec3f*, Vec3f*, Color_RGB8*, Color_RGB8*, f32, s16, s16);
void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play);
void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play);
-static s32 sUnusedGetItemIds[] = { GI_FARORES_WIND, GI_NAYRUS_LOVE, GI_DINS_FIRE };
+typedef enum BgDyYoseizoRewardSpell {
+ BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND,
+ BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE,
+ BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE
+} BgDyYoseizoRewardSpell;
+
+typedef enum BgDyYoseizoRewardMagic {
+ BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC,
+ BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_MAGIC,
+ BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE
+} BgDyYoseizoRewardMagic;
+
+// This unused data is probably { GI_FARORES_WIND, GI_NAYRUS_LOVE, GI_DINS_FIRE }
+static s32 D_80875440[3] = { 0x5D, 0x5E, 0x5C };
ActorProfile Bg_Dy_Yoseizo_Profile = {
/**/ ACTOR_BG_DY_YOSEIZO,
@@ -90,33 +89,28 @@ ActorProfile Bg_Dy_Yoseizo_Profile = {
};
void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) {
- PlayState* play = play2;
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
+ PlayState* play = play2;
- this->fountainType = play->spawn;
-
- if (this->fountainType < 0) {
- this->fountainType = 0;
+ this->reward = play->spawn;
+ if (this->reward < 0) {
+ this->reward = 0;
}
-
- this->vanishHeight = this->actor.world.pos.y;
- this->grownHeight = this->vanishHeight + 40.0f;
+ this->homePosY = this->actor.world.pos.y;
+ this->aboveFountainY = this->actor.world.pos.y + 40.0f;
this->actor.focus.pos = this->actor.world.pos;
-
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Great Fairy Fountain ☆☆☆☆☆ %d\n") VT_RST,
- play->spawn);
+ PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->spawn);
SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim,
this->jointTable, this->morphTable, 28);
#if OOT_VERSION < NTSC_1_1
- if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->fountainType != FAIRY_UPGRADE_MAGIC)) {
+ if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->reward != BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC)) {
Actor_Kill(&this->actor);
return;
}
#endif
} else {
- PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Stone Fairy Fountain ☆☆☆☆☆ %d\n") VT_RST,
- play->spawn);
+ PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->spawn);
SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim,
this->jointTable, this->morphTable, 28);
#if OOT_VERSION < NTSC_1_1
@@ -126,103 +120,127 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) {
}
#endif
}
-
#if OOT_VERSION < NTSC_1_1
- this->actionFunc = BgDyYoseizo_ChooseType;
+ this->actionFunc = BgDyYoseizo_SetupCutscene;
#else
- this->actionFunc = BgDyYoseizo_CheckMagicAcquired;
+ this->actionFunc = BgDyYoseizo_WaitSong;
#endif
}
void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play) {
}
-static Color_RGB8 sEffectPrimColors[] = {
+static Color_RGB8 sInnerColors[9] = {
{ 255, 255, 255 }, { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 255, 170 },
{ 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 255, 170 },
};
-
-static Color_RGB8 sEffectEnvColors[] = {
+static Color_RGB8 sOuterColors[9] = {
{ 155, 255, 255 }, { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 100, 255 },
{ 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 100, 255, 255 },
};
-void BgDyYoseizo_SpawnEffects(BgDyYoseizo* this, PlayState* play, s16 type) {
+void BgDyYoseizo_SpawnEffectsType(BgDyYoseizo* this, PlayState* play, s16 effType) {
Vec3f vel = { 0.0f, 0.0f, 0.0f };
Vec3f accel;
Vec3f pos;
- Color_RGB8 primColor;
- Color_RGB8 envColor;
- f32 spawnPosVariation;
- s32 effectType;
+ Color_RGB8 innerColor;
+ Color_RGB8 outerColor;
+ f32 yOffset;
f32 scale;
+ s32 type;
+ s32 life;
s32 i;
- s16 life;
if (!(this->scale < 0.01f)) {
- spawnPosVariation = this->scale * 3500.0f;
+ yOffset = this->scale * 3500.0f;
accel.x = Rand_ZeroOne() - 0.5f;
accel.y = Rand_ZeroOne() - 0.5f;
accel.z = Rand_ZeroOne() - 0.5f;
for (i = 0; i < 2; i++) {
- if (type == 0) {
- effectType = 0;
+ if (effType == 0) {
+ type = 0;
scale = 0.4f;
life = 90;
pos.x = this->actor.world.pos.x;
- pos.y = this->actor.world.pos.y + spawnPosVariation +
- ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.5f));
+ pos.y = this->actor.world.pos.y + yOffset + (yOffset * 0.5f * (Rand_ZeroOne() - 0.5f));
pos.z = this->actor.world.pos.z + 30.0f;
} else {
- life = 50;
- effectType = type;
scale = 0.2f;
- pos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f);
-
+ life = 50;
+ type = effType;
+ pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x;
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- pos.y = this->actor.world.pos.y + spawnPosVariation + 50.0f +
- ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f));
+ pos.y = this->actor.world.pos.y + yOffset + 50.0f + (yOffset * 0.1f * (Rand_ZeroOne() - 0.5f));
pos.z = this->actor.world.pos.z + 30.0f;
} else {
- pos.y = this->actor.world.pos.y + spawnPosVariation - 30.0f +
- ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f));
+ pos.y = this->actor.world.pos.y + yOffset - 30.0f + (yOffset * 0.1f * (Rand_ZeroOne() - 0.5f));
pos.z = this->actor.world.pos.z + 60.0f;
}
-
if (LINK_IS_ADULT) {
pos.y += 20.0f;
}
}
-
- primColor.r = sEffectPrimColors[effectType].r;
- primColor.g = sEffectPrimColors[effectType].g;
- primColor.b = sEffectPrimColors[effectType].b;
- envColor.r = sEffectEnvColors[effectType].r;
- envColor.g = sEffectEnvColors[effectType].g;
- envColor.b = sEffectEnvColors[effectType].b;
- BgDyYoseizo_SpawnEffect(this, &pos, &vel, &accel, &primColor, &envColor, scale, life, effectType);
+ innerColor.r = sInnerColors[type].r;
+ innerColor.g = sInnerColors[type].g;
+ innerColor.b = sInnerColors[type].b;
+ outerColor.r = sOuterColors[type].r;
+ outerColor.g = sOuterColors[type].g;
+ outerColor.b = sOuterColors[type].b;
+ BgDyYoseizo_SpawnEffect(this, &pos, &vel, &accel, &innerColor, &outerColor, scale, life, type);
}
}
}
-void BgDyYoseizo_Bob(BgDyYoseizo* this, PlayState* play) {
- this->targetHeight = this->grownHeight + this->bobOffset;
- Math_ApproachF(&this->actor.world.pos.y, this->targetHeight, 0.1f, 10.0f);
- Math_ApproachF(&this->bobOffset, 10.0f, 0.1f, 0.5f);
+static s16 sSpellRewardsDemoEffectLightColor[3] = {
+ DEMO_EFFECT_LIGHT_GREEN, // BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND
+ DEMO_EFFECT_LIGHT_RED, // BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE
+ DEMO_EFFECT_LIGHT_BLUE, // BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE
+};
+static s16 sSpellRewardsEnExItemParams[3] = {
+ EXITEM_MAGIC_WIND, // BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND
+ EXITEM_MAGIC_FIRE, // BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE
+ EXITEM_MAGIC_DARK, // BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE
+};
+static s16 sSpellRewardsItemGetInfMask[3] = {
+ ITEMGETINF_MASK(ITEMGETINF_FARORES_WIND), // BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND
+ ITEMGETINF_MASK(ITEMGETINF_DINS_FIRE), // BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE
+ ITEMGETINF_MASK(ITEMGETINF_NAYRUS_LOVE), // BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE
+};
+static u8 sSpellRewardsItem[3] = {
+ ITEM_FARORES_WIND, // BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND
+ ITEM_DINS_FIRE, // BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE
+ ITEM_NAYRUS_LOVE, // BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE
+};
+static void* sEyeTextures[] = {
+ gGreatFairyEyeOpenTex,
+ gGreatFairyEyeHalfTex,
+ gGreatFairyEyeClosedTex,
+};
+
+static void* sMouthTextures[] = {
+ gGreatFairyMouthClosedTex,
+ gGreatFairyMouthOpenTex,
+};
+
+void BgDyYoseizo_UpdatePosY(BgDyYoseizo* this, PlayState* play) {
+ this->targetPosY = this->aboveFountainY + this->offsetY;
+ Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f);
+ Math_ApproachF(&this->offsetY, 10.0f, 0.1f, 0.5f);
if (play->csCtx.state == CS_STATE_IDLE) {
- this->actor.velocity.y = Math_SinS(this->bobTimer);
+ this->actor.velocity.y = Math_SinS(TRUNCF_BINANG(this->yVelocityPhase));
} else {
- this->actor.velocity.y = Math_SinS(this->bobTimer) * 0.4f;
+ this->actor.velocity.y = Math_SinS(TRUNCF_BINANG(this->yVelocityPhase)) * 0.4f;
}
}
#if OOT_VERSION >= NTSC_1_1
-void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_WaitSong(BgDyYoseizo* this, PlayState* play) {
if (Flags_GetSwitch(play, 0x38)) {
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->fountainType != FAIRY_UPGRADE_MAGIC)) {
+ if (!gSaveContext.save.info.playerData.isMagicAcquired &&
+ (this->reward != BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC)) {
Actor_Kill(&this->actor);
return;
}
@@ -233,13 +251,13 @@ void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play) {
}
}
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
- this->actionFunc = BgDyYoseizo_ChooseType;
+ this->actionFunc = BgDyYoseizo_SetupCutscene;
}
}
#endif
-void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) {
- s32 givingReward;
+void BgDyYoseizo_SetupCutscene(BgDyYoseizo* this, PlayState* play) {
+ s32 isNewAcquire;
#if OOT_VERSION < NTSC_1_1
if (!Flags_GetSwitch(play, 0x38)) {
@@ -253,634 +271,587 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) {
#endif
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
- PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Mode ☆☆☆☆☆ %d\n") VT_RST, play->msgCtx.ocarinaMode);
- givingReward = false;
-
+ PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode);
+ isNewAcquire = false;
if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- switch (this->fountainType) {
- case FAIRY_SPELL_FARORES_WIND:
- if (!GET_ITEMGETINF(ITEMGETINF_18)) {
- givingReward = true;
+ switch (this->reward) {
+ case BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND:
+ if (!GET_ITEMGETINF(ITEMGETINF_FARORES_WIND)) {
+ isNewAcquire = true;
}
break;
- case FAIRY_SPELL_DINS_FIRE:
- if (!GET_ITEMGETINF(ITEMGETINF_19)) {
- givingReward = true;
+
+ case BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE:
+ if (!GET_ITEMGETINF(ITEMGETINF_DINS_FIRE)) {
+ isNewAcquire = true;
}
break;
- case FAIRY_SPELL_NAYRUS_LOVE:
- if (!GET_ITEMGETINF(ITEMGETINF_1A)) {
- givingReward = true;
+
+ case BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE:
+ if (!GET_ITEMGETINF(ITEMGETINF_NAYRUS_LOVE)) {
+ isNewAcquire = true;
}
break;
}
} else {
- switch (this->fountainType) {
- case FAIRY_UPGRADE_MAGIC:
- if (!gSaveContext.save.info.playerData.isMagicAcquired || BREG(2)) {
- PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ 回転切り速度UP ☆☆☆☆☆ \n", " ☆☆☆☆☆ Turning speed UP ☆☆☆☆☆ \n")
- VT_RST);
- this->givingSpell = true;
- givingReward = true;
+ switch (this->reward) {
+ case BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC:
+ if (!gSaveContext.save.info.playerData.isMagicAcquired || (BREG(2) != 0)) {
+ PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ 回転切り速度UP ☆☆☆☆☆ \n" VT_RST);
+ isNewAcquire = true;
+ this->isNewAcquireMagic = true;
}
break;
- case FAIRY_UPGRADE_DOUBLE_MAGIC:
+
+ case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_MAGIC:
if (!gSaveContext.save.info.playerData.isDoubleMagicAcquired) {
- PRINTF(VT_FGCOL(YELLOW) T(" ☆☆☆☆☆ 魔法ゲージメーター倍増 ☆☆☆☆☆ \n",
- " ☆☆☆☆☆ Magic Gauge Meter Doubled ☆☆☆☆☆ \n") VT_RST);
- this->givingSpell = true;
- givingReward = true;
+ PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 魔法ゲージメーター倍増 ☆☆☆☆☆ \n" VT_RST);
+ this->isNewAcquireMagic = true;
+ isNewAcquire = true;
}
break;
- case FAIRY_UPGRADE_DOUBLE_DEFENSE:
+
+ case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE:
if (!gSaveContext.save.info.playerData.isDoubleDefenseAcquired) {
- PRINTF(VT_FGCOL(MAGENTA) T(" ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n", " ☆☆☆☆☆ Damage halved ☆☆☆☆☆ \n") VT_RST);
- this->givingSpell = true;
- givingReward = true;
+ PRINTF(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n" VT_RST);
+ this->isNewAcquireMagic = true;
+ isNewAcquire = true;
}
break;
}
}
-
- if (givingReward) {
+ if (isNewAcquire) {
if (!IS_CUTSCENE_LAYER || !DEBUG_FEATURES) {
if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- switch (this->fountainType) {
- case FAIRY_SPELL_FARORES_WIND:
+ switch (this->reward) {
+ case BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND:
play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyFaroresWindCs);
gSaveContext.cutsceneTrigger = 1;
break;
- case FAIRY_SPELL_DINS_FIRE:
+
+ case BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE:
play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDinsFireCs);
gSaveContext.cutsceneTrigger = 1;
break;
- case FAIRY_SPELL_NAYRUS_LOVE:
+
+ case BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE:
play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyNayrusLoveCs);
gSaveContext.cutsceneTrigger = 1;
break;
}
} else {
- switch (this->fountainType) {
- case FAIRY_UPGRADE_MAGIC:
+ switch (this->reward) {
+ case BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC:
play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyMagicCs);
gSaveContext.cutsceneTrigger = 1;
break;
- case FAIRY_UPGRADE_DOUBLE_MAGIC:
+
+ case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_MAGIC:
play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleMagicCs);
gSaveContext.cutsceneTrigger = 1;
break;
- case FAIRY_UPGRADE_DOUBLE_DEFENSE:
+
+ case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE:
play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleDefenseCs);
gSaveContext.cutsceneTrigger = 1;
break;
}
}
}
- this->actionFunc = BgDyYoseizo_SetupSpinGrow_Reward;
- return;
- }
-
- play->envCtx.lightSettingOverride = 2;
-
- if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- OnePointCutscene_Init(play, 8603, -99, NULL, CAM_ID_MAIN);
+ this->actionFunc = BgDyYoseizo_Reward_WaitCutscene;
} else {
- OnePointCutscene_Init(play, 8604, -99, NULL, CAM_ID_MAIN);
- };
-
- Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR);
- this->actor.draw = BgDyYoseizo_Draw;
- this->actionFunc = BgDyYoseizo_SetupSpinGrow_NoReward;
+ play->envCtx.lightSettingOverride = 2;
+ if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
+ OnePointCutscene_Init(play, 8603, -99, NULL, CAM_ID_MAIN);
+ } else {
+ OnePointCutscene_Init(play, 8604, -99, NULL, CAM_ID_MAIN);
+ }
+ Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR);
+ this->actor.draw = BgDyYoseizo_Draw;
+ this->actionFunc = BgDyYoseizo_Revisit_SetupAppear;
+ }
}
-// Sets animations for spingrow
-void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_Revisit_SetupAppear(BgDyYoseizo* this, PlayState* play) {
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim);
- Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->frameCount,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->curAnimLastFrame,
ANIMMODE_ONCE, -10.0f);
} else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->frameCount,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->curAnimLastFrame,
ANIMMODE_ONCE, -10.0f);
}
-
Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0);
#if OOT_VERSION >= NTSC_1_1
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
#endif
- this->actionFunc = BgDyYoseizo_SpinGrow_NoReward;
+ this->actionFunc = BgDyYoseizo_Revisit_Appear;
}
-void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_Revisit_Appear(BgDyYoseizo* this, PlayState* play) {
#if OOT_VERSION >= NTSC_1_1
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
#endif
- Math_ApproachF(&this->actor.world.pos.y, this->grownHeight, this->heightFraction, 100.0f);
- Math_ApproachF(&this->scale, 0.035f, this->scaleFraction, 0.005f);
- Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f);
- Math_ApproachF(&this->scaleFraction, 0.2f, 0.03f, 0.05f);
- // Finished growing
+ Math_ApproachF(&this->actor.world.pos.y, this->aboveFountainY, this->yApproachFraction, 100.0f);
+ Math_ApproachF(&this->scale, 0.035f, this->scaleApproachFraction, 0.005f);
+ Math_ApproachF(&this->yApproachFraction, 0.8f, 0.1f, 0.02f);
+ Math_ApproachF(&this->scaleApproachFraction, 0.2f, 0.03f, 0.05f);
if (this->scale >= 0.034f) {
- if ((this->actor.shape.rot.y > -8000) && (this->actor.shape.rot.y < 1000)) {
+ if ((this->actor.shape.rot.y > -0x1F40) && (this->actor.shape.rot.y < 0x3E8)) {
SkelAnime_Update(&this->skelAnime);
- // Turn to front
- Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 5, 1000, 0);
+ Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 5, 0x3E8, 0);
if (fabsf(this->actor.shape.rot.y) < 50.0f) {
- this->actionFunc = BgDyYoseizo_CompleteSpinGrow_NoReward;
+ this->actionFunc = BgDyYoseizo_Revisit_FinishAppear;
}
} else {
- this->actor.shape.rot.y += 3000;
+ this->actor.shape.rot.y += 0xBB8;
}
} else {
- this->actor.shape.rot.y += 3000;
+ this->actor.shape.rot.y += 0xBB8;
}
- BgDyYoseizo_SpawnEffects(this, play, 0);
+ BgDyYoseizo_SpawnEffectsType(this, play, 0);
}
-void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) {
- f32 curFrame = this->skelAnime.curFrame;
+void BgDyYoseizo_Revisit_FinishAppear(BgDyYoseizo* this, PlayState* play) {
+ f32 animPrevFrame = this->skelAnime.curFrame;
#if OOT_VERSION >= NTSC_1_1
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
#endif
-
- if ((this->frameCount * 1273.0f) <= this->bobTimer) {
- this->bobTimer = 0.0f;
+ if ((this->curAnimLastFrame * 1273.0f) <= this->yVelocityPhase) {
+ this->yVelocityPhase = 0.0f;
}
-
SkelAnime_Update(&this->skelAnime);
-
- if ((this->frameCount <= curFrame) && !this->animationChanged) {
- this->actionFunc = BgDyYoseizo_SetupGreetPlayer_NoReward;
+ if ((this->curAnimLastFrame <= animPrevFrame) && !this->hasSwitchedAnim) {
+ this->actionFunc = BgDyYoseizo_Revisit_SetupTalk;
}
}
-void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_Revisit_SetupTalk(BgDyYoseizo* this, PlayState* play) {
#if OOT_VERSION >= NTSC_1_1
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
#endif
-
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim);
- Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySittingAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_LOOP,
-10.0f);
} else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP,
- -10.0f);
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_LOOP, -10.0f);
}
-
this->actor.textId = 0xDB;
- this->dialogState = TEXT_STATE_EVENT;
+ this->waitMessageState = TEXT_STATE_EVENT;
Message_StartTextbox(play, this->actor.textId, NULL);
- BgDyYoseizo_SpawnEffects(this, play, 0);
- this->actionFunc = BgDyYoseizo_GreetPlayer_NoReward;
+ BgDyYoseizo_SpawnEffectsType(this, play, 0);
+ this->actionFunc = BgDyYoseizo_Revisit_Talk;
}
-void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_Revisit_Talk(BgDyYoseizo* this, PlayState* play) {
#if OOT_VERSION >= NTSC_1_1
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
#endif
- this->bobTimer = this->skelAnime.curFrame * 1273.0f;
-
- if ((this->frameCount * 1273.0f) <= this->bobTimer) {
- this->bobTimer = 0.0f;
+ this->yVelocityPhase = this->skelAnime.curFrame * 1273.0f;
+ if (this->yVelocityPhase >= (this->curAnimLastFrame * 1273.0f)) {
+ this->yVelocityPhase = 0.0f;
}
-
SkelAnime_Update(&this->skelAnime);
-
- if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) {
+ if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE);
- this->actionFunc = BgDyYoseizo_SetupHealPlayer_NoReward;
+ this->actionFunc = BgDyYoseizo_Revisit_SetupRefillPlayerEnergy;
}
-
- BgDyYoseizo_Bob(this, play);
- BgDyYoseizo_SpawnEffects(this, play, 0);
+ BgDyYoseizo_UpdatePosY(this, play);
+ BgDyYoseizo_SpawnEffectsType(this, play, 0);
}
-void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_Revisit_SetupRefillPlayerEnergy(BgDyYoseizo* this, PlayState* play) {
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE,
- -10.0f);
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_ONCE, -10.0f);
} else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyAnim_005810);
- Animation_Change(&this->skelAnime, &gGreatFairyAnim_005810, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE,
- -10.0f);
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyGivingSpellAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyGivingSpellAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_ONCE, -10.0f);
}
-
Actor_PlaySfx(&this->actor, NA_SE_VO_FR_SMILE_0);
- this->mouthState = 1;
- this->actionFunc = BgDyYoseizo_HealPlayer_NoReward;
+ this->mouthTexIndex = 1;
+ this->actionFunc = BgDyYoseizo_Revisit_RefillPlayerEnergy;
}
-void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_Revisit_RefillPlayerEnergy(BgDyYoseizo* this, PlayState* play) {
Player* player = GET_PLAYER(play);
- f32 curFrame = this->skelAnime.curFrame;
+ f32 animPrevFrame = this->skelAnime.curFrame;
+ s16 beamType;
Vec3f beamPos;
- s16 beamParams;
- if (this->animationChanged) {
- this->bobTimer = this->skelAnime.curFrame * 1300.0f;
- if ((this->frameCount * 1300.0f) <= this->bobTimer) {
- this->bobTimer = 0.0f;
+ if (this->hasSwitchedAnim) {
+ this->yVelocityPhase = this->skelAnime.curFrame * 1300.0f;
+ if ((this->curAnimLastFrame * 1300.0f) <= this->yVelocityPhase) {
+ this->yVelocityPhase = 0.0f;
}
}
-
SkelAnime_Update(&this->skelAnime);
- if ((this->frameCount <= curFrame) && !(this->animationChanged)) {
+ if ((this->curAnimLastFrame <= animPrevFrame) && !this->hasSwitchedAnim) {
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->frameCount,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->curAnimLastFrame,
ANIMMODE_LOOP, -10.0f);
} else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP,
- -10.0f);
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_LOOP, -10.0f);
}
- this->healingTimer = 150;
- this->animationChanged = true;
- if (!this->givingSpell) {
+ this->refillTimer = 150;
+ this->hasSwitchedAnim = true;
+ if (!this->isNewAcquireMagic) {
beamPos.x = player->actor.world.pos.x;
beamPos.y = player->actor.world.pos.y + 200.0f;
beamPos.z = player->actor.world.pos.z;
-
- beamParams = ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) ? 0 : 1);
-
- this->beam = (EnDyExtra*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DY_EXTRA,
- beamPos.x, beamPos.y, beamPos.z, 0, 0, 0, beamParams);
+ if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
+ beamType = 0;
+ } else {
+ beamType = 1;
+ }
+ this->refillBeam = (EnDyExtra*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DY_EXTRA,
+ beamPos.x, beamPos.y, beamPos.z, 0, 0, 0, beamType);
}
}
- if (this->refillTimer > 1) {
+ if (this->refillTimeoutTimer > 1) {
+ this->refillTimeoutTimer--;
+ }
+ if (this->refillTimer >= 110) {
this->refillTimer--;
}
-
- if (this->healingTimer >= 110) {
- this->healingTimer--;
- }
-
- if (this->healingTimer == 110) {
+ if (this->refillTimer == 110) {
gSaveContext.healthAccumulator = 0x140;
Magic_Fill(play);
- this->refillTimer = 200;
+ this->refillTimeoutTimer = 200;
}
-
if (((gSaveContext.save.info.playerData.healthCapacity == gSaveContext.save.info.playerData.health) &&
(gSaveContext.save.info.playerData.magic == gSaveContext.magicCapacity)) ||
- (this->refillTimer == 1)) {
- this->healingTimer--;
- if (this->healingTimer == 90) {
- if (!this->givingSpell) {
- this->beam->trigger = 1;
+ (this->refillTimeoutTimer == 1)) {
+ this->refillTimer--;
+ if (this->refillTimer == 90) {
+ if (!this->isNewAcquireMagic) {
+ this->refillBeam->startDisappearing = true;
}
- this->givingSpell = false;
+ this->isNewAcquireMagic = false;
}
}
-
- if (this->healingTimer == 1) {
+ if (this->refillTimer == 1) {
this->actor.textId = 0xDA;
- this->dialogState = TEXT_STATE_EVENT;
+ this->waitMessageState = TEXT_STATE_EVENT;
Message_ContinueTextbox(play, this->actor.textId);
- this->actionFunc = BgDyYoseizo_SayFarewell_NoReward;
- return;
+ this->actionFunc = BgDyYoseizo_Revisit_WaitTalkEnd;
+ } else {
+ BgDyYoseizo_UpdatePosY(this, play);
}
- BgDyYoseizo_Bob(this, play);
}
-void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, PlayState* play) {
- this->bobTimer = this->skelAnime.curFrame * 1400.0f;
-
- if (this->bobTimer >= (this->frameCount * 1400.0f)) {
- this->bobTimer = 0.0f;
+void BgDyYoseizo_Revisit_WaitTalkEnd(BgDyYoseizo* this, PlayState* play) {
+ this->yVelocityPhase = this->skelAnime.curFrame * 1400.0f;
+ if (this->yVelocityPhase >= (this->curAnimLastFrame * 1400.0f)) {
+ this->yVelocityPhase = 0.0f;
}
-
SkelAnime_Update(&this->skelAnime);
-
- if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) {
+ if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
- this->mouthState = 0;
- this->actionFunc = BgDyYoseizo_SetupSpinShrink;
- Camera_SetFinishedFlag(GET_ACTIVE_CAM(play));
+ this->mouthTexIndex = 0;
+ this->actionFunc = BgDyYoseizo_SetupDisappear;
+ Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]);
}
-
- BgDyYoseizo_Bob(this, play);
- BgDyYoseizo_SpawnEffects(this, play, 0);
+ BgDyYoseizo_UpdatePosY(this, play);
+ BgDyYoseizo_SpawnEffectsType(this, play, 0);
}
-void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_SetupDisappear(BgDyYoseizo* this, PlayState* play) {
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyJewelFountainSpinShrinkAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyJewelFountainSpinShrinkAnim, 1.0f, 0.0f, this->frameCount,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyJewelFountainSpinShrinkAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyJewelFountainSpinShrinkAnim, 1.0f, 0.0f, this->curAnimLastFrame,
ANIMMODE_ONCE, -10.0f);
} else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairySpellFountainSpinShrinkAnim);
- Animation_Change(&this->skelAnime, &gGreatFairySpellFountainSpinShrinkAnim, 1.0f, 0.0f, this->frameCount,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySpellFountainSpinShrinkAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairySpellFountainSpinShrinkAnim, 1.0f, 0.0f, this->curAnimLastFrame,
ANIMMODE_ONCE, -10.0f);
}
-
- this->vanishTimer = 5;
- this->scaleFraction = 0.0f;
- this->heightFraction = 0.0f;
+ this->disappearTimer = 5;
+ this->scaleApproachFraction = 0.0f;
+ this->yApproachFraction = 0.0f;
Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0);
Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_VANISH);
- this->actionFunc = BgDyYoseizo_SpinShrink;
+ this->actionFunc = BgDyYoseizo_Disappear;
}
-void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, PlayState* play) {
+void BgDyYoseizo_Disappear(BgDyYoseizo* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
- if (this->vanishTimer == 0) {
+ if (this->disappearTimer == 0) {
if (this->scale < 0.003f) {
- this->vanishTimer = 30;
- this->actionFunc = BgDyYoseizo_Vanish;
+ this->disappearTimer = 30;
+ this->actionFunc = BgDyYoseizo_Kill;
} else {
- Math_ApproachF(&this->actor.world.pos.y, this->vanishHeight, this->heightFraction, 100.0f);
- Math_ApproachZeroF(&this->scale, this->scaleFraction, 0.005f);
- Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f);
- Math_ApproachF(&this->scaleFraction, 0.2f, 0.03f, 0.05f);
- this->actor.shape.rot.y += 3000;
- BgDyYoseizo_SpawnEffects(this, play, 0);
+ Math_ApproachF(&this->actor.world.pos.y, this->homePosY, this->yApproachFraction, 100.0f);
+ Math_ApproachZeroF(&this->scale, this->scaleApproachFraction, 0.005f);
+ Math_ApproachF(&this->yApproachFraction, 0.8f, 0.1f, 0.02f);
+ Math_ApproachF(&this->scaleApproachFraction, 0.2f, 0.03f, 0.05f);
+ this->actor.shape.rot.y += 0xBB8;
+ BgDyYoseizo_SpawnEffectsType(this, play, 0);
}
}
}
-void BgDyYoseizo_Vanish(BgDyYoseizo* this, PlayState* play) {
- Actor* findOcarinaSpot;
+void BgDyYoseizo_Kill(BgDyYoseizo* this, PlayState* play) {
+ Actor* actor;
- if (this->vanishTimer == 0) {
+ if (this->disappearTimer == 0) {
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7);
play->envCtx.lightSettingOverride = 0;
- findOcarinaSpot = play->actorCtx.actorLists[ACTORCAT_PROP].head;
-
- while (findOcarinaSpot != NULL) {
- if (findOcarinaSpot->id != ACTOR_EN_OKARINA_TAG) {
- findOcarinaSpot = findOcarinaSpot->next;
- continue;
+ actor = play->actorCtx.actorLists[ACTORCAT_PROP].head;
+ while (actor != NULL) {
+ if (actor->id != ACTOR_EN_OKARINA_TAG) {
+ actor = actor->next;
+ } else {
+ Actor_Kill(actor);
+ break;
}
- Actor_Kill(findOcarinaSpot);
- break;
}
-
Flags_UnsetSwitch(play, 0x38);
Actor_Kill(&this->actor);
}
}
-void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, PlayState* play) {
- if (play->csCtx.state != CS_STATE_IDLE) {
- if ((play->csCtx.actorCues[0] != NULL) && (play->csCtx.actorCues[0]->id == 2)) {
- this->actor.draw = BgDyYoseizo_Draw;
- Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
- this->finishedSpinGrow = false;
-
- if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim);
- Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->frameCount,
- ANIMMODE_ONCE, -10.0f);
- } else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->frameCount,
- ANIMMODE_ONCE, -10.0f);
- }
-
- Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR);
- this->actionFunc = BgDyYoseizo_SpinGrowSetupGive_Reward;
+void BgDyYoseizo_Reward_WaitCutscene(BgDyYoseizo* this, PlayState* play) {
+ if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[0] != NULL) &&
+ (play->csCtx.actorCues[0]->id == 2)) {
+ this->actor.draw = BgDyYoseizo_Draw;
+ Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1);
+ this->isDoneAppearing = false;
+ if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_ONCE, -10.0f);
+ } else {
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_ONCE, -10.0f);
}
+ Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR);
+ this->actionFunc = BgDyYoseizo_Reward_Appear;
}
}
-void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, PlayState* play) {
- f32 curFrame = this->skelAnime.curFrame;
+void BgDyYoseizo_Reward_Appear(BgDyYoseizo* this, PlayState* play) {
+ f32 animPrevFrame = this->skelAnime.curFrame;
- if (!this->finishedSpinGrow) {
- Math_ApproachF(&this->actor.world.pos.y, this->grownHeight, this->heightFraction, 100.0f);
- Math_ApproachF(&this->scale, 0.035f, this->scaleFraction, 0.005f);
- Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f);
- Math_ApproachF(&this->scaleFraction, 0.2f, 0.03f, 0.05f);
- // Finished growing
+ if (!this->isDoneAppearing) {
+ Math_ApproachF(&this->actor.world.pos.y, this->aboveFountainY, this->yApproachFraction, 100.0f);
+ Math_ApproachF(&this->scale, 0.035f, this->scaleApproachFraction, 0.005f);
+ Math_ApproachF(&this->yApproachFraction, 0.8f, 0.1f, 0.02f);
+ Math_ApproachF(&this->scaleApproachFraction, 0.2f, 0.03f, 0.05f);
if (this->scale >= 0.034f) {
- if ((this->actor.shape.rot.y > -8000) && (this->actor.shape.rot.y < 1000)) {
+ if ((this->actor.shape.rot.y >= -0x1F3F) && (this->actor.shape.rot.y < 0x3E8)) {
SkelAnime_Update(&this->skelAnime);
- // Spin until facing front
- Math_ApproachS(&this->actor.shape.rot.y, 0, 5, 1000);
+ Math_ApproachS(&this->actor.shape.rot.y, 0, 5, 0x3E8);
if (fabsf(this->actor.shape.rot.y) < 50.0f) {
- this->finishedSpinGrow = true;
+ this->isDoneAppearing = true;
}
} else {
- this->actor.shape.rot.y += 3000;
+ this->actor.shape.rot.y += 0xBB8;
}
} else {
- this->actor.shape.rot.y += 3000;
+ this->actor.shape.rot.y += 0xBB8;
}
} else {
SkelAnime_Update(&this->skelAnime);
-
- if ((this->frameCount <= curFrame) && !this->animationChanged) {
+ if ((this->curAnimLastFrame <= animPrevFrame) && !this->hasSwitchedAnim) {
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim);
- Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP,
- -10.0f);
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySittingAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_LOOP, -10.0f);
} else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->frameCount,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->curAnimLastFrame,
ANIMMODE_LOOP, -10.0f);
}
- this->animationChanged = true;
+ this->hasSwitchedAnim = true;
}
-
- if ((play->csCtx.state != CS_STATE_IDLE) &&
- ((play->csCtx.actorCues[0] != NULL) && (play->csCtx.actorCues[0]->id == 3))) {
- this->finishedSpinGrow = this->animationChanged = false;
+ if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[0] != NULL) &&
+ (play->csCtx.actorCues[0]->id == 3)) {
+ this->isDoneAppearing = this->hasSwitchedAnim = false;
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->frameCount,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->curAnimLastFrame,
ANIMMODE_ONCE, -10.0f);
} else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyAnim_005810);
- Animation_Change(&this->skelAnime, &gGreatFairyAnim_005810, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE,
- -10.0f);
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyGivingSpellAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyGivingSpellAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_ONCE, -10.0f);
}
- this->mouthState = 1;
- this->actionFunc = BgDyYoseizo_Give_Reward;
+ this->mouthTexIndex = 1;
+ this->actionFunc = BgDyYoseizo_Reward_GiveReward;
}
}
- BgDyYoseizo_SpawnEffects(this, play, 0);
+ BgDyYoseizo_SpawnEffectsType(this, play, 0);
}
-static s16 sDemoEffectLightColors[] = { DEMO_EFFECT_LIGHT_GREEN, DEMO_EFFECT_LIGHT_RED, DEMO_EFFECT_LIGHT_BLUE };
-
-static s16 sExItemTypes[] = { EXITEM_MAGIC_WIND, EXITEM_MAGIC_FIRE, EXITEM_MAGIC_DARK };
-
-static s16 sItemGetFlagMasks[] = { ITEMGETINF_MASK(ITEMGETINF_18), ITEMGETINF_MASK(ITEMGETINF_19),
- ITEMGETINF_MASK(ITEMGETINF_1A) };
-
-static u8 sItemIds[] = { ITEM_FARORES_WIND, ITEM_DINS_FIRE, ITEM_NAYRUS_LOVE };
-
-void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) {
- f32 curFrame = this->skelAnime.curFrame;
+void BgDyYoseizo_Reward_GiveReward(BgDyYoseizo* this, PlayState* play) {
+ f32 animPrevFrame = this->skelAnime.curFrame;
Player* player = GET_PLAYER(play);
- s16 cueIdTemp;
+ s16 n;
s16 demoEffectParams;
Vec3f itemPos;
- if (this->animationChanged) {
- this->bobTimer = this->skelAnime.curFrame * 1400.0f;
- if ((this->frameCount * 1400.0f) <= this->bobTimer) {
- this->bobTimer = 0.0f;
+ if (this->hasSwitchedAnim) {
+ this->yVelocityPhase = this->skelAnime.curFrame * 1400.0f;
+ if (this->yVelocityPhase >= (this->curAnimLastFrame * 1400.0f)) {
+ this->yVelocityPhase = 0.0f;
}
}
SkelAnime_Update(&this->skelAnime);
-
- if ((this->frameCount <= curFrame) && !this->animationChanged) {
+ if ((this->curAnimLastFrame <= animPrevFrame) && !this->hasSwitchedAnim) {
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->frameCount,
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->curAnimLastFrame,
ANIMMODE_LOOP, -10.0f);
} else {
- this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim);
- Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP,
- -10.0f);
+ this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim);
+ Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->curAnimLastFrame,
+ ANIMMODE_LOOP, -10.0f);
}
- this->animationChanged = true;
+ this->hasSwitchedAnim = true;
}
-
if (play->csCtx.actorCues[0]->id == 13) {
- this->actionFunc = BgDyYoseizo_SetupSpinShrink;
+ this->actionFunc = BgDyYoseizo_SetupDisappear;
return;
}
-
- if ((play->csCtx.actorCues[0]->id >= 4) && (play->csCtx.actorCues[0]->id < 7)) {
- cueIdTemp = play->csCtx.actorCues[0]->id - 4;
-
+ if ((play->csCtx.actorCues[0]->id >= 4) && (play->csCtx.actorCues[0]->id <= 6)) {
+ n = play->csCtx.actorCues[0]->id - 4;
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
- cueIdTemp++;
- BgDyYoseizo_SpawnEffects(this, play, cueIdTemp);
-
- } else if (!this->lightBallSpawned) {
- demoEffectParams = ((s16)(sDemoEffectLightColors[cueIdTemp] << 0xC) | DEMO_EFFECT_LIGHT);
+ n += 1;
+ BgDyYoseizo_SpawnEffectsType(this, play, n);
+ } else if (!this->hasSpawnedDemoEffect) {
+ demoEffectParams = sSpellRewardsDemoEffectLightColor[n] << 12;
+ demoEffectParams |= DEMO_EFFECT_LIGHT;
Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y,
- this->actor.world.pos.z, 0, 0, 0, (s32)demoEffectParams);
- this->lightBallSpawned = true;
+ this->actor.world.pos.z, 0, 0, 0, demoEffectParams);
+ this->hasSpawnedDemoEffect = true;
}
} else {
- BgDyYoseizo_SpawnEffects(this, play, 0);
+ BgDyYoseizo_SpawnEffectsType(this, play, 0);
}
-
- if ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id >= 10) &&
- (play->csCtx.actorCues[0]->id < 13)) {
- cueIdTemp = play->csCtx.actorCues[0]->id - 10;
-
- switch (cueIdTemp) {
- case FAIRY_UPGRADE_MAGIC:
- gSaveContext.save.info.playerData.isMagicAcquired = true;
- gSaveContext.magicFillTarget = MAGIC_NORMAL_METER;
- // magicLevel is already 0, setting isMagicAcquired to true triggers magicCapacity to grow
- Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
- break;
- case FAIRY_UPGRADE_DOUBLE_MAGIC:
- if (!gSaveContext.save.info.playerData.isMagicAcquired) {
+ if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
+ if ((play->csCtx.actorCues[0]->id >= 10) && (play->csCtx.actorCues[0]->id <= 12)) {
+ n = play->csCtx.actorCues[0]->id - 10;
+ switch (n) {
+ case BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC:
gSaveContext.save.info.playerData.isMagicAcquired = true;
- }
- gSaveContext.save.info.playerData.isDoubleMagicAcquired = true;
- gSaveContext.magicFillTarget = MAGIC_DOUBLE_METER;
- // Setting magicLevel to 0 triggers magicCapacity to grow
- gSaveContext.save.info.playerData.magicLevel = 0;
- Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
- break;
- case FAIRY_UPGRADE_DOUBLE_DEFENSE:
- gSaveContext.save.info.playerData.isDoubleDefenseAcquired = true;
- Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
- break;
- }
+ gSaveContext.magicFillTarget = 0x30;
+ Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
+ break;
- if (!this->healing) {
- gSaveContext.healthAccumulator = 0x140;
- this->healing = true;
- if (cueIdTemp == 2) {
- Magic_Fill(play);
+ case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_MAGIC:
+ if (!gSaveContext.save.info.playerData.isMagicAcquired) {
+ gSaveContext.save.info.playerData.isMagicAcquired = true;
+ }
+ gSaveContext.save.info.playerData.isDoubleMagicAcquired = true;
+ gSaveContext.magicFillTarget = 0x60;
+ gSaveContext.save.info.playerData.magicLevel = 0;
+ Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
+ break;
+
+ case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE:
+ gSaveContext.save.info.playerData.isDoubleDefenseAcquired = true;
+ Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
+ break;
}
- }
- }
-
- if ((play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id >= 14) &&
- (play->csCtx.actorCues[0]->id < 17)) {
- cueIdTemp = play->csCtx.actorCues[0]->id - 14;
-
- if (!this->itemSpawned) {
- itemPos.x = player->actor.world.pos.x;
- itemPos.y = (LINK_IS_ADULT ? player->actor.world.pos.y + 73.0f : player->actor.world.pos.y + 53.0f);
- itemPos.z = player->actor.world.pos.z;
-
- this->item = (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemPos.x,
- itemPos.y, itemPos.z, 0, 0, 0, sExItemTypes[cueIdTemp]);
-
- if (this->item != NULL) {
- if (!gSaveContext.save.info.playerData.isMagicAcquired) {
- gSaveContext.save.info.playerData.isMagicAcquired = true;
- } else {
+ if (!this->energyRefilled) {
+ gSaveContext.healthAccumulator = 0x140;
+ this->energyRefilled = true;
+ if (n == 2) {
Magic_Fill(play);
}
-
- this->itemSpawned = true;
- gSaveContext.healthAccumulator = 0x140;
- Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
- gSaveContext.save.info.itemGetInf[ITEMGETINF_INDEX_18_19_1A] |= sItemGetFlagMasks[cueIdTemp];
- Item_Give(play, sItemIds[cueIdTemp]);
}
- } else {
- this->item->actor.world.pos.x = player->actor.world.pos.x;
- this->item->actor.world.pos.y =
- (LINK_IS_ADULT ? player->actor.world.pos.y + 73.0f : player->actor.world.pos.y + 53.0f);
- this->item->actor.world.pos.z = player->actor.world.pos.z;
- this->item->scale = 0.3f;
}
}
-
- if ((play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 17) &&
- (this->item != NULL)) {
- Actor_Kill(&this->item->actor);
- this->item = NULL;
+ if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
+ if ((play->csCtx.actorCues[0]->id >= 14) && (play->csCtx.actorCues[0]->id <= 16)) {
+ n = play->csCtx.actorCues[0]->id - 14;
+ if (!this->hasSpawnedItem) {
+ itemPos.x = player->actor.world.pos.x;
+ if (LINK_IS_ADULT) {
+ itemPos.y = player->actor.world.pos.y + 73.0f;
+ } else {
+ itemPos.y = player->actor.world.pos.y + 53.0f;
+ }
+ itemPos.z = player->actor.world.pos.z;
+ this->item =
+ (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemPos.x,
+ itemPos.y, itemPos.z, 0, 0, 0, sSpellRewardsEnExItemParams[n]);
+ if (this->item != NULL) {
+ if (!gSaveContext.save.info.playerData.isMagicAcquired) {
+ gSaveContext.save.info.playerData.isMagicAcquired = true;
+ } else {
+ Magic_Fill(play);
+ }
+ this->hasSpawnedItem = true;
+ gSaveContext.healthAccumulator = 0x140;
+ Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
+ gSaveContext.save.info.itemGetInf[ITEMGETINF_INDEX_SPELLS] |= sSpellRewardsItemGetInfMask[n];
+ Item_Give(play, sSpellRewardsItem[n]);
+ }
+ } else {
+ this->item->actor.world.pos.x = player->actor.world.pos.x;
+ if (LINK_IS_ADULT) {
+ this->item->actor.world.pos.y = player->actor.world.pos.y + 73.0f;
+ } else {
+ this->item->actor.world.pos.y = player->actor.world.pos.y + 53.0f;
+ }
+ this->item->actor.world.pos.z = player->actor.world.pos.z;
+ this->item->scale = 0.3f;
+ }
+ }
+ }
+ if ((play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 17)) {
+ if (this->item != NULL) {
+ Actor_Kill(&this->item->actor);
+ this->item = NULL;
+ }
}
-
if ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 18)) {
- this->giveDefenseHearts = true;
+ this->giveDoubleDefense = true;
}
-
- if (this->giveDefenseHearts) {
+ if (this->giveDoubleDefense) {
if (gSaveContext.save.info.inventory.defenseHearts < 20) {
- gSaveContext.save.info.inventory.defenseHearts++;
+ gSaveContext.save.info.inventory.defenseHearts += 1;
}
}
-
- if ((play->csCtx.actorCues[0]->id >= 19) && (play->csCtx.actorCues[0]->id < 22) && !this->warpEffectSpawned) {
- cueIdTemp = play->csCtx.actorCues[0]->id - 11;
+ if ((play->csCtx.actorCues[0]->id >= 19) && (play->csCtx.actorCues[0]->id <= 21) && (this->unk304 == 0)) {
+ n = play->csCtx.actorCues[0]->id - (19 - WARP_ORANGE);
Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, player->actor.world.pos.x, player->actor.world.pos.y,
- player->actor.world.pos.z, 0, 0, 0, cueIdTemp);
- this->warpEffectSpawned = true;
+ player->actor.world.pos.z, 0, 0, 0, n);
+ this->unk304 = 1;
}
- BgDyYoseizo_Bob(this, play);
+ BgDyYoseizo_UpdatePosY(this, play);
}
void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) {
- PlayState* play = play2;
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
+ PlayState* play = play2;
s32 sfx;
- this->absoluteTimer++;
-
- if (this->vanishTimer != 0) {
- this->vanishTimer--;
+ this->unk_2F0++;
+ if (this->disappearTimer != 0) {
+ this->disappearTimer--;
}
- if (this->blinkTimer != 0) {
- this->blinkTimer--;
+ if (this->eyeTimer != 0) {
+ this->eyeTimer--;
}
- if (this->unusedTimer != 0) {
- this->unusedTimer--;
+ if (this->unk_2FA != 0) {
+ this->unk_2FA--;
}
-
this->actionFunc(this, play);
-
if (play->csCtx.state != CS_STATE_IDLE) {
sfx = 0;
if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
@@ -900,7 +871,6 @@ void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) {
sfx = 2;
}
}
-
if (sfx == 1) {
Actor_PlaySfx(&this->actor, NA_SE_VO_FR_SMILE_0);
}
@@ -908,20 +878,18 @@ void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) {
Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0);
}
}
-
- if ((this->blinkTimer == 0) && (this->actionFunc != BgDyYoseizo_HealPlayer_NoReward)) {
- this->eyeState++;
- this->eyeState2++;
- if (this->eyeState >= 3) {
- this->eyeState = this->eyeState2 = 0;
- this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
+ if ((this->eyeTimer == 0) && (this->actionFunc != BgDyYoseizo_Revisit_RefillPlayerEnergy)) {
+ this->eyeTexIndex += 1;
+ this->unusedEyeTexIndex += 1;
+ if (this->eyeTexIndex >= 3) {
+ this->eyeTexIndex = this->unusedEyeTexIndex = 0;
+ this->eyeTimer = (s16)Rand_ZeroFloat(60.0f) + 20;
}
}
-
Actor_MoveXZGravity(&this->actor);
- this->heightOffset = this->scale * 7500.0f;
- Actor_SetFocus(&this->actor, this->heightOffset);
- this->actor.focus.pos.y = this->heightOffset;
+ this->focusY = this->scale * 7500.0f;
+ Actor_SetFocus(&this->actor, this->focusY);
+ this->actor.focus.pos.y = this->focusY;
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos);
BgDyYoseizo_UpdateEffects(this, play);
Actor_SetScale(&this->actor, this->scale);
@@ -930,42 +898,26 @@ void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) {
s32 BgDyYoseizo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
- if (limbIndex == 8) { // Torso
+ if (limbIndex == 8) {
rot->x += this->torsoRot.y;
}
- if (limbIndex == 15) { // Head
+ if (limbIndex == 15) {
rot->x += this->headRot.y;
rot->z += this->headRot.z;
}
- return 0;
+ return false;
}
-static void* sEyeTextures[] = {
- gGreatFairyEyeOpenTex, // Open
- gGreatFairyEyeHalfTex, // Half
- gGreatFairyEyeClosedTex, // Closed
-};
-
-static void* sMouthTextures[] = {
- gGreatFairyMouthClosedTex, // Closed
- gGreatFairyMouthOpenTex, // Open
-};
-
void BgDyYoseizo_Draw(Actor* thisx, PlayState* play) {
BgDyYoseizo* this = (BgDyYoseizo*)thisx;
OPEN_DISPS(play->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1609);
- if (this->actionFunc != BgDyYoseizo_Vanish) {
+ if (this->actionFunc != BgDyYoseizo_Kill) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
-
- gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeState]));
-
- // This was probably intended to allow this actor to wink, but segment 09 is not used in the dList for the head,
- // so it can only blink
- gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeState2]));
-
- gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthState]));
-
+ gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex]));
+ // The model doesn't access segment 9
+ gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->unusedEyeTexIndex]));
+ gSPSegment(POLY_OPA_DISP++, 10, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthTexIndex]));
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
BgDyYoseizo_OverrideLimbDraw, NULL, this);
}
@@ -973,92 +925,83 @@ void BgDyYoseizo_Draw(Actor* thisx, PlayState* play) {
BgDyYoseizo_DrawEffects(this, play);
}
-void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel,
- Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type) {
+void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, Color_RGB8* innerColor,
+ Color_RGB8* outerColor, f32 scale, s16 life, s16 type) {
BgDyYoseizoEffect* effect;
s16 i;
effect = this->effects;
-
for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) {
- if (effect->alive == 0) {
- effect->alive = 1;
- effect->pos = *initPos;
- effect->velocity = *initVelocity;
+ if (effect->active == 0) {
+ effect->active = 1;
+ effect->pos = *pos;
+ effect->vel = *vel;
effect->accel = *accel;
- effect->primColor = *primColor;
+ effect->innerColor = *innerColor;
effect->alpha = 0;
- effect->envColor = *envColor;
+ effect->outerColor = *outerColor;
effect->scale = scale;
- effect->timer = life;
+ effect->life = life;
effect->type = type;
effect->pitch = 0.0f;
effect->yaw = Rand_CenteredFloat(30000.0f);
- effect->roll = 0.0f;
- return;
+ effect->rot = 0.0f;
+ break;
}
}
}
void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play) {
- BgDyYoseizoEffect* effect = this->effects;
- Player* player = GET_PLAYER(play);
- Vec3f sp94;
- Vec3f sp88;
- f32 goalPitch;
- f32 goalYaw;
- s16 i = 0;
+ s16 i;
+ Player* player;
+ Vec3f offset;
+ Vec3f vel;
+ BgDyYoseizoEffect* effect;
+ f32 targetPitch;
+ f32 targetYaw;
+ effect = this->effects;
+ player = GET_PLAYER(play);
for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) {
- if (effect->alive != 0) {
- effect->roll += 3000.0f;
-
+ if (effect->active != 0) {
+ effect->rot += 3000.0f;
if (effect->type == 0) {
- effect->pos.x += effect->velocity.x;
- effect->pos.y += effect->velocity.y;
- effect->pos.z += effect->velocity.z;
- effect->velocity.x += effect->accel.x;
- effect->velocity.y += effect->accel.y;
- effect->velocity.z += effect->accel.z;
+ effect->pos.x += effect->vel.x;
+ effect->pos.y += effect->vel.y;
+ effect->pos.z += effect->vel.z;
+ effect->vel.x += effect->accel.x;
+ effect->vel.y += effect->accel.y;
+ effect->vel.z += effect->accel.z;
} else {
Actor_PlaySfx(&this->actor, NA_SE_EV_HEALING - SFX_FLAG);
-
- sp94 = player->actor.world.pos;
- sp94.y = player->actor.world.pos.y - 150.0f;
- sp94.z = player->actor.world.pos.z - 50.0f;
-
- goalPitch = Math_Vec3f_Pitch(&effect->pos, &sp94);
- goalYaw = Math_Vec3f_Yaw(&effect->pos, &sp94);
-
- Math_ApproachF(&effect->pitch, goalPitch, 0.9f, 5000.0f);
- Math_ApproachF(&effect->yaw, goalYaw, 0.9f, 5000.0f);
+ offset = player->actor.world.pos;
+ offset.y = player->actor.world.pos.y - 150.0f;
+ offset.z = player->actor.world.pos.z - 50.0f;
+ targetPitch = Math_Vec3f_Pitch(&effect->pos, &offset);
+ targetYaw = Math_Vec3f_Yaw(&effect->pos, &offset);
+ Math_ApproachF(&effect->pitch, targetPitch, 0.9f, 5000.0f);
+ Math_ApproachF(&effect->yaw, targetYaw, 0.9f, 5000.0f);
Matrix_Push();
Matrix_RotateY(BINANG_TO_RAD_ALT(effect->yaw), MTXMODE_NEW);
Matrix_RotateX(BINANG_TO_RAD_ALT(effect->pitch), MTXMODE_APPLY);
-
- sp94.x = sp94.y = sp94.z = 3.0f;
-
- Matrix_MultVec3f(&sp94, &sp88);
+ offset.x = offset.y = offset.z = 3.0f;
+ Matrix_MultVec3f(&offset, &vel);
Matrix_Pop();
- effect->pos.x += sp88.x;
- effect->pos.y += sp88.y;
- effect->pos.z += sp88.z;
+ effect->pos.x += vel.x;
+ effect->pos.y += vel.y;
+ effect->pos.z += vel.z;
}
}
-
- // fade up, fade down, vanish and reset
- if (effect->timer != 0) {
- effect->timer--;
+ if (effect->life != 0) {
+ effect->life--;
effect->alpha += 30;
-
if (effect->alpha > 255) {
effect->alpha = 255;
}
} else {
effect->alpha -= 30;
-
if (effect->alpha <= 0) {
- effect->alpha = effect->alive = 0;
+ effect->alpha = effect->active = 0;
}
}
}
@@ -1066,35 +1009,30 @@ void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play) {
void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
- u8 materialFlag = 0;
- BgDyYoseizoEffect* effect = this->effects;
s16 i;
+ BgDyYoseizoEffect* effect;
+ u8 materialFlag = 0;
+ effect = this->effects;
OPEN_DISPS(gfxCtx, "../z_bg_dy_yoseizo.c", 1767);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
-
for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) {
- if (effect->alive == 1) {
+ if (effect->active == 1) {
if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleMaterialDL));
gDPPipeSync(POLY_XLU_DISP++);
-
materialFlag++;
}
-
- gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->primColor.r, effect->primColor.g, effect->primColor.b,
- effect->alpha);
- gDPSetEnvColor(POLY_XLU_DISP++, effect->envColor.r, effect->envColor.g, effect->envColor.b, 0);
-
+ gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, effect->innerColor.r, effect->innerColor.g,
+ effect->innerColor.b, effect->alpha);
+ gDPSetEnvColor(POLY_XLU_DISP++, effect->outerColor.r, effect->outerColor.g, effect->outerColor.b, 0);
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
- Matrix_RotateZ(effect->roll, MTXMODE_APPLY);
-
+ Matrix_RotateZ(effect->rot, MTXMODE_APPLY);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_bg_dy_yoseizo.c", 1810);
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleModelDL));
}
}
-
CLOSE_DISPS(gfxCtx, "../z_bg_dy_yoseizo.c", 1819);
}
diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h
index f3cca1b6c2..0fd44a6718 100644
--- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h
+++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h
@@ -3,72 +3,72 @@
#include "ultra64.h"
#include "actor.h"
-#include "overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h"
-#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h"
-
-struct BgDyYoseizo;
-
-typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, struct PlayState*);
#define BG_DY_YOSEIZO_EFFECT_COUNT 200
typedef struct BgDyYoseizoEffect {
- /* 0x00 */ u8 alive; // drawn if 1, respawn if 0
+ /* 0x00 */ u8 active;
+ /* 0x01 */ char pad_1[3];
/* 0x04 */ Vec3f pos;
- /* 0x10 */ Vec3f velocity;
- /* 0x1C */ Vec3f accel;
- /* 0x28 */ Color_RGB8 primColor;
- /* 0x2B */ Color_RGB8 envColor;
+ /* 0x10 */ Vec3f vel; // for type == 0
+ /* 0x1C */ Vec3f accel; // for type == 0
+ /* 0x28 */ Color_RGB8 innerColor;
+ /* 0x2B */ Color_RGB8 outerColor;
/* 0x2E */ s16 alpha;
/* 0x30 */ f32 scale;
- /* 0x34 */ s16 timer; // lifetime
- /* 0x36 */ s16 type; // 0 is general radiance, else is directed towards Player
- /* 0x38 */ f32 pitch;
- /* 0x3C */ f32 yaw;
- /* 0x40 */ f32 roll;
+ /* 0x34 */ s16 life;
+ /* 0x36 */ s16 type;
+ /* 0x38 */ f32 pitch; // for type != 0
+ /* 0x3C */ f32 yaw; // for type != 0
+ /* 0x40 */ f32 rot;
} BgDyYoseizoEffect; // size = 0x44
+struct BgDyYoseizo;
+
+typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, struct PlayState*);
+
typedef struct BgDyYoseizo {
/* 0x0000 */ Actor actor;
/* 0x014C */ BgDyYoseizoActionFunc actionFunc;
/* 0x0150 */ SkelAnime skelAnime;
/* 0x0194 */ Vec3s jointTable[28];
/* 0x023C */ Vec3s morphTable[28];
- /* 0x02E4 */ u8 lightBallSpawned;
- /* 0x02E5 */ u8 giveDefenseHearts;
- /* 0x02E6 */ u8 healing;
- /* 0x02E8 */ s16 vanishTimer;
- /* 0x02EA */ s16 givingSpell;
- /* 0x02EC */ s16 fountainType;
- /* 0x02EE */ s16 dialogState;
- /* 0x02F0 */ s16 absoluteTimer;
- /* 0x02F2 */ s16 eyeState;
- /* 0x02F4 */ s16 eyeState2; // Used, but does not actually change the actor's eyes
- /* 0x02F6 */ s16 mouthState;
- /* 0x02F8 */ s16 blinkTimer;
- /* 0x02FA */ s16 unusedTimer;
- /* 0x02FC */ s16 animationChanged;
- /* 0x02FE */ s16 finishedSpinGrow;
- /* 0x0300 */ s16 itemSpawned;
- /* 0x0302 */ s16 healingTimer;
- /* 0x0304 */ s16 warpEffectSpawned;
- /* 0x0306 */ s16 refillTimer;
+ /* 0x02E4 */ u8 hasSpawnedDemoEffect;
+ /* 0x02E5 */ u8 giveDoubleDefense;
+ /* 0x02E6 */ u8 energyRefilled;
+ /* 0x02E7 */ char pad_2E7[1];
+ /* 0x02E8 */ s16 disappearTimer;
+ /* 0x02EA */ s16 isNewAcquireMagic;
+ /* 0x02EC */ s16 reward;
+ /* 0x02EE */ s16 waitMessageState;
+ /* 0x02F0 */ s16 unk_2F0; // unused
+ /* 0x02F2 */ s16 eyeTexIndex;
+ /* 0x02F4 */ s16 unusedEyeTexIndex;
+ /* 0x02F6 */ s16 mouthTexIndex;
+ /* 0x02F8 */ s16 eyeTimer;
+ /* 0x02FA */ s16 unk_2FA; // unused
+ /* 0x02FC */ s16 hasSwitchedAnim;
+ /* 0x02FE */ s16 isDoneAppearing;
+ /* 0x0300 */ s16 hasSpawnedItem;
+ /* 0x0302 */ s16 refillTimer;
+ /* 0x0304 */ s16 unk304;
+ /* 0x0306 */ s16 refillTimeoutTimer;
/* 0x0308 */ f32 scale;
- /* 0x030C */ f32 grownHeight;
- /* 0x0310 */ f32 vanishHeight;
- /* 0x0314 */ f32 heightFraction;
- /* 0x0318 */ f32 scaleFraction;
- /* 0x031C */ f32 targetHeight;
- /* 0x0320 */ f32 bobOffset;
- /* 0x0324 */ f32 bobTimer;
- /* 0x0328 */ f32 heightOffset;
- /* 0x032C */ f32 frameCount;
- /* 0x0330 */ char unk_330[4];
+ /* 0x030C */ f32 aboveFountainY;
+ /* 0x0310 */ f32 homePosY;
+ /* 0x0314 */ f32 yApproachFraction;
+ /* 0x0318 */ f32 scaleApproachFraction;
+ /* 0x031C */ f32 targetPosY;
+ /* 0x0320 */ f32 offsetY;
+ /* 0x0324 */ f32 yVelocityPhase;
+ /* 0x0328 */ f32 focusY;
+ /* 0x032C */ f32 curAnimLastFrame;
+ /* 0x0330 */ char pad_330[4];
/* 0x0334 */ Vec3s headRot;
/* 0x033A */ Vec3s torsoRot;
- /* 0x0340 */ EnDyExtra* beam;
- /* 0x0344 */ EnExItem* item;
- /* 0x0348 */ char unk_348[0x4C];
+ /* 0x0340 */ struct EnDyExtra* refillBeam;
+ /* 0x0344 */ struct EnExItem* item;
+ /* 0x0348 */ char pad_348[0x4C];
/* 0x0394 */ BgDyYoseizoEffect effects[BG_DY_YOSEIZO_EFFECT_COUNT];
} BgDyYoseizo; // size = 0x38B4
diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c
index a3ae11bf61..b34857b270 100644
--- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c
+++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c
@@ -26,8 +26,8 @@ void EnDyExtra_Destroy(Actor* thisx, PlayState* play);
void EnDyExtra_Update(Actor* thisx, PlayState* play);
void EnDyExtra_Draw(Actor* thisx, PlayState* play);
-void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play);
-void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play);
+void EnDyExtra_Wait(EnDyExtra* this, PlayState* play);
+void EnDyExtra_Disappear(EnDyExtra* this, PlayState* play);
ActorProfile En_Dy_Extra_Profile = {
/**/ ACTOR_EN_DY_EXTRA,
@@ -54,31 +54,31 @@ void EnDyExtra_Init(Actor* thisx, PlayState* play) {
this->scale.x = 0.025f;
this->scale.y = 0.039f;
this->scale.z = 0.025f;
- this->unk_168 = this->actor.world.pos;
+ this->homePos = this->actor.world.pos;
this->actor.gravity = -0.2f;
- this->unk_158 = 1.0f;
+ this->alphaFac = 1.0f;
this->timer = 60;
- this->actionFunc = EnDyExtra_WaitForTrigger;
+ this->actionFunc = EnDyExtra_Wait;
}
-void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play) {
+void EnDyExtra_Wait(EnDyExtra* this, PlayState* play) {
Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f);
if (this->actor.world.pos.y < -55.0f) {
this->actor.velocity.y = 0.0f;
}
- if (this->timer == 0 && this->trigger != 0) {
+ if ((this->timer == 0) && this->startDisappearing) {
this->timer = 200;
- this->actionFunc = EnDyExtra_FallAndKill;
+ this->actionFunc = EnDyExtra_Disappear;
}
}
-void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play) {
+void EnDyExtra_Disappear(EnDyExtra* this, PlayState* play) {
Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f);
- if (this->timer == 0 || this->unk_158 < 0.02f) {
+ if ((this->timer == 0) || (this->alphaFac < 0.02f)) {
Actor_Kill(&this->actor);
return;
}
- Math_ApproachZeroF(&this->unk_158, 0.03f, 0.05f);
+ Math_ApproachZeroF(&this->alphaFac, 0.03f, 0.05f);
if (this->actor.world.pos.y < -55.0f) {
this->actor.velocity.y = 0.0f;
}
@@ -87,9 +87,7 @@ void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play) {
void EnDyExtra_Update(Actor* thisx, PlayState* play) {
EnDyExtra* this = (EnDyExtra*)thisx;
- if (this->timer != 0) {
- this->timer--;
- }
+ DECR(this->timer);
this->actor.scale.x = this->scale.x;
this->actor.scale.y = this->scale.y;
this->actor.scale.z = this->scale.z;
@@ -99,24 +97,30 @@ void EnDyExtra_Update(Actor* thisx, PlayState* play) {
}
void EnDyExtra_Draw(Actor* thisx, PlayState* play) {
- static Color_RGBA8 primColors[] = { { 255, 255, 170, 255 }, { 255, 255, 170, 255 } };
- static Color_RGBA8 envColors[] = { { 255, 100, 255, 255 }, { 100, 255, 255, 255 } };
- static u8 D_809FFC50[] = { 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01,
- 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02, 0x00 };
+ static Color_RGBA8 sPrimColors[] = { { 255, 255, 170, 255 }, { 255, 255, 170, 255 } };
+ static Color_RGBA8 sEnvColors[] = { { 255, 100, 255, 255 }, { 100, 255, 255, 255 } };
+ static u8 sVerticesAlphaType[] = {
+ 2, 1, 1, 2, 0, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 2, 0
+ };
EnDyExtra* this = (EnDyExtra*)thisx;
GraphicsContext* gfxCtx = play->state.gfxCtx;
s32 pad;
Vtx* vertices = SEGMENTED_TO_VIRTUAL(gGreatFairySpiralBeamVtx);
s32 i;
- u8 unk[3];
+ u8 alphaVals[3];
- unk[0] = 0.0f;
- unk[1] = (s8)(this->unk_158 * 240.0f);
- unk[2] = (s8)(this->unk_158 * 255.0f);
+ alphaVals[0] = 0.0f;
+#ifndef AVOID_UB
+ alphaVals[1] = (s8)(this->alphaFac * 240.0f);
+ alphaVals[2] = (s8)(this->alphaFac * 255.0f);
+#else
+ alphaVals[1] = (u8)(this->alphaFac * 240.0f);
+ alphaVals[2] = (u8)(this->alphaFac * 255.0f);
+#endif
for (i = 0; i < 27; i++) {
- if (D_809FFC50[i]) {
- vertices[i].v.cn[3] = unk[D_809FFC50[i]];
+ if (sVerticesAlphaType[i] != 0) {
+ vertices[i].n.a = alphaVals[sVerticesAlphaType[i]];
}
}
@@ -128,9 +132,9 @@ void EnDyExtra_Draw(Actor* thisx, PlayState* play) {
play->state.frames, play->state.frames * -8, 0x10, 0x10));
gDPPipeSync(POLY_XLU_DISP++);
MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_dy_extra.c", 307);
- gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColors[this->type].r, primColors[this->type].g,
- primColors[this->type].b, 255);
- gDPSetEnvColor(POLY_XLU_DISP++, envColors[this->type].r, envColors[this->type].g, envColors[this->type].b, 128);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, sPrimColors[this->type].r, sPrimColors[this->type].g,
+ sPrimColors[this->type].b, 255);
+ gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[this->type].r, sEnvColors[this->type].g, sEnvColors[this->type].b, 128);
gSPDisplayList(POLY_XLU_DISP++, gGreatFairySpiralBeamDL);
CLOSE_DISPS(gfxCtx, "../z_en_dy_extra.c", 325);
diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h
index a093b62b31..9c6da5bd13 100644
--- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h
+++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h
@@ -12,11 +12,11 @@ typedef struct EnDyExtra {
/* 0x0000 */ Actor actor;
/* 0x014C */ EnDyExtraActionFunc actionFunc;
/* 0x0150 */ s16 type;
- /* 0x0152 */ s16 trigger;
+ /* 0x0152 */ s16 startDisappearing;
/* 0x0154 */ s16 timer;
- /* 0x0158 */ f32 unk_158;
+ /* 0x0158 */ f32 alphaFac;
/* 0x015C */ Vec3f scale;
- /* 0x0168 */ Vec3f unk_168; // Set and not used
+ /* 0x0168 */ Vec3f homePos;
} EnDyExtra; // size = 0x0174
#endif