[cc0 oot] BgDyYoseizo (#2796)

* [cc0 oot] BgDyYoseizo

* BgDyYoseizo small cleanup

* bgdyyoseizo comment on D_80875440
This commit is contained in:
Dragorn421
2026-08-31 17:21:31 +02:00
committed by GitHub
parent 6809439703
commit e9b8786fcb
6 changed files with 606 additions and 664 deletions
+1 -1
View File
@@ -105,7 +105,7 @@
<Animation Name="gGreatFairyLayingSidewaysAnim" Offset="0x1DF0"/>
<Animation Name="gGreatFairyLayingDownTransitionAnim" Offset="0x31C0"/>
<Animation Name="gGreatFairyAfterSpellAnim" Offset="0x4344"/>
<Animation Name="gGreatFairyAnim_005810" Offset="0x5810"/>
<Animation Name="gGreatFairyGivingSpellAnim" Offset="0x5810"/>
<Animation Name="gGreatFairyJewelFountainSpinShrinkAnim" Offset="0x5E60"/>
<Animation Name="gGreatFairyGivingUpgradeAnim" Offset="0x69E8"/>
<Animation Name="gGreatFairyAfterUpgradeAnim" Offset="0x7CA8"/>
+4 -4
View File
@@ -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
File diff suppressed because it is too large Load Diff
@@ -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
@@ -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);
@@ -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