Added and implemented TrailType enum (#5059)

* added TrailType enum

* fixed build, moved declaration

* added enhancement comment

* Apply suggestions from code review

---------

Co-authored-by: link5669 <acqmiles@gmail.com>
This commit is contained in:
Miles Acquaviva 2025-02-17 20:03:55 -05:00 committed by GitHub
parent 489cd84faa
commit cc25c96385
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 33 additions and 21 deletions

View File

@ -14,6 +14,18 @@ struct PlayState;
#define TOTAL_EFFECT_COUNT SPARK_COUNT + BLURE_COUNT + SHIELD_PARTICLE_COUNT
typedef enum {
TRAIL_TYPE_REST,
TRAIL_TYPE_SWORDS,
TRAIL_TYPE_BOOMERANG,
TRAIL_TYPE_BOMBCHU,
TRAIL_TYPE_KOKIRI_SWORD,
TRAIL_TYPE_MASTER_SWORD,
TRAIL_TYPE_BIGGORON_SWORD,
TRAIL_TYPE_STICK,
TRAIL_TYPE_HAMMER
} TrailType; //SOH [Enhancements]
typedef struct {
/* 0x00 */ u8 active;
/* 0x01 */ u8 unk_01;
@ -73,7 +85,7 @@ typedef struct {
/* 0x194 */ s32 elemDuration;
/* 0x198 */ s32 unkFlag;
/* 0x19C */ s32 calcMode;
/* 0x1A0 */ u8 trailType; // 1 is swords, 2 is boomerang, 3 is bombchu, 0 is rest
/* 0x1A0 */ TrailType trailType; //SOH [Enhancements]
} EffectBlureInit1; // size = 0x1A0
typedef struct {
@ -90,7 +102,7 @@ typedef struct {
/* 0x1B */ u8 mode4Param;
/* 0x1C */ Color_RGBA8 altPrimColor; // used with drawMode 1
/* 0x20 */ Color_RGBA8 altEnvColor; // used with drawMode 1
/* 0x1A0 */ u8 trailType; // 1 is swords, 2 is boomerang, 3 is bombchu, 4 is stick, 0 is rest
/* 0x1A0 */ TrailType trailType; //SOH [Enhancements]
} EffectBlureInit2; // size = 0x24
typedef struct {
@ -110,7 +122,7 @@ typedef struct {
/* 0x1A1 */ u8 drawMode; // 0: simple; 1: simple with alt colors; 2+: smooth
/* 0x1A2 */ Color_RGBA8 altPrimColor; // used with drawMode 1
/* 0x1A6 */ Color_RGBA8 altEnvColor; // used with drawMode 1
/* 0x1A0 */ u8 trailType; // 1 is default swords, 2 is boomerang, 3 is bombchu, 0 is rest. 4 is Kokiri, 5 is Master, 6 is BGS, 7 is Stick, 8 is Hammer.
/* 0x1A0 */ TrailType trailType; //SOH [Enhancements]
} EffectBlure; // size = 0x1AC
typedef struct {

View File

@ -206,8 +206,8 @@ s32 EffectBlure_Update(void* thisx) {
static u8 changed = 0;
u8 reset = 0;
switch (this->trailType) { //there HAS to be a better way to do this.
case 2:
switch (this->trailType) {
case TRAIL_TYPE_BOOMERANG:
if (CVarGetInteger(CVAR_COSMETIC("Trails.Boomerang.Changed"), 0)) {
color = CVarGetColor(CVAR_COSMETIC("Trails.Boomerang.Value"), (Color_RGBA8){ 255, 255, 100, 255 });
changed = 1;
@ -216,7 +216,7 @@ s32 EffectBlure_Update(void* thisx) {
reset = 1;
}
break;
case 3:
case TRAIL_TYPE_BOMBCHU:
if (CVarGetInteger(CVAR_COSMETIC("Trails.Bombchu.Changed"), 0)) {
color = CVarGetColor(CVAR_COSMETIC("Trails.Bombchu.Value"), (Color_RGBA8){ 250, 0, 0, 255 });
this->p1StartColor.r = color.r;
@ -247,7 +247,7 @@ s32 EffectBlure_Update(void* thisx) {
this->p2EndColor.b = color.b * 0.4f;
}
break;
case 4:
case TRAIL_TYPE_KOKIRI_SWORD:
if (CVarGetInteger(CVAR_COSMETIC("Trails.KokiriSword.Changed"), 0)) {
color = CVarGetColor(CVAR_COSMETIC("Trails.KokiriSword.Value"), (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
@ -256,7 +256,7 @@ s32 EffectBlure_Update(void* thisx) {
reset = 1;
}
break;
case 5:
case TRAIL_TYPE_MASTER_SWORD:
if (CVarGetInteger(CVAR_COSMETIC("Trails.MasterSword.Changed"), 0)) {
color = CVarGetColor(CVAR_COSMETIC("Trails.MasterSword.Value"), (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
@ -265,7 +265,7 @@ s32 EffectBlure_Update(void* thisx) {
reset = 1;
}
break;
case 6:
case TRAIL_TYPE_BIGGORON_SWORD:
if (CVarGetInteger(CVAR_COSMETIC("Trails.BiggoronSword.Changed"), 0)) {
color = CVarGetColor(CVAR_COSMETIC("Trails.BiggoronSword.Value"), (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
@ -274,7 +274,7 @@ s32 EffectBlure_Update(void* thisx) {
reset = 1;
}
break;
case 7:
case TRAIL_TYPE_STICK:
if (CVarGetInteger(CVAR_COSMETIC("Trails.Stick.Changed"), 0)) {
color = CVarGetColor(CVAR_COSMETIC("Trails.Stick.Value"), (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
@ -283,7 +283,7 @@ s32 EffectBlure_Update(void* thisx) {
reset = 1;
}
break;
case 8:
case TRAIL_TYPE_HAMMER:
if (CVarGetInteger(CVAR_COSMETIC("Trails.Hammer.Changed"), 0)) {
color = CVarGetColor(CVAR_COSMETIC("Trails.Hammer.Value"), (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
@ -316,7 +316,7 @@ s32 EffectBlure_Update(void* thisx) {
}
// Don't override boomerang and bombchu trail durations
if (this->trailType != 2 && this->trailType != 3) {
if (this->trailType != TRAIL_TYPE_BOOMERANG && this->trailType != TRAIL_TYPE_BOMBCHU) {
if (CVarGetInteger(CVAR_COSMETIC("Trails.Duration.Changed"), 0)) {
this->elemDuration = CVarGetInteger(CVAR_COSMETIC("Trails.Duration.Value"), 4);
}

View File

@ -1748,7 +1748,7 @@ f32 sMeleeWeaponLengths[] = {
};
f32 sSwordTypes[] = {
0, 5, 4, 6, 0, 8,
TRAIL_TYPE_REST, TRAIL_TYPE_MASTER_SWORD, TRAIL_TYPE_KOKIRI_SWORD, TRAIL_TYPE_BIGGORON_SWORD, TRAIL_TYPE_REST, TRAIL_TYPE_HAMMER,
};
Gfx* sBottleDLists[] = { gLinkAdultBottleDL, gLinkChildBottleDL };
@ -1821,7 +1821,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
D_80126080.x = this->unk_85C * 5000.0f;
func_80090A28(this, sp124);
if (this->meleeWeaponState != 0) {
EffectBlure_ChangeType(Effect_GetByIndex(this->meleeWeaponEffectIndex), 7); // stick sword type
EffectBlure_ChangeType(Effect_GetByIndex(this->meleeWeaponEffectIndex), TRAIL_TYPE_STICK);
func_800906D4(play, this, sp124);
} else {
Math_Vec3f_Copy(&this->meleeWeaponInfo[0].tip, &sp124[0]);

View File

@ -64,19 +64,19 @@ void EnArrow_SetupAction(EnArrow* this, EnArrowActionFunc actionFunc) {
void EnArrow_Init(Actor* thisx, PlayState* play) {
static EffectBlureInit2 blureNormal = {
0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16,
0, 1, 0, { 255, 255, 170, 255 }, { 0, 150, 0, 0 }, 0,
0, 1, 0, { 255, 255, 170, 255 }, { 0, 150, 0, 0 }, TRAIL_TYPE_REST,
};
static EffectBlureInit2 blureFire = {
0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16,
0, 1, 0, { 255, 200, 0, 255 }, { 255, 0, 0, 0 }, 0,
0, 1, 0, { 255, 200, 0, 255 }, { 255, 0, 0, 0 }, TRAIL_TYPE_REST,
};
static EffectBlureInit2 blureIce = {
0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16,
0, 1, 0, { 170, 255, 255, 255 }, { 0, 100, 255, 0 }, 0,
0, 1, 0, { 170, 255, 255, 255 }, { 0, 100, 255, 0 }, TRAIL_TYPE_REST,
};
static EffectBlureInit2 blureLight = {
0, 4, 0, { 0, 255, 200, 255 }, { 0, 255, 255, 255 }, { 0, 255, 200, 0 }, { 0, 255, 255, 0 }, 16,
0, 1, 0, { 255, 255, 170, 255 }, { 255, 255, 0, 0 }, 0,
0, 1, 0, { 255, 255, 170, 255 }, { 255, 255, 0, 0 }, TRAIL_TYPE_REST,
};
static u32 dmgFlags[] = {
0x00000800, 0x00000020, 0x00000020, 0x00000800, 0x00001000,

View File

@ -85,7 +85,7 @@ void EnBomChu_Init(Actor* thisx, PlayState* play) {
blureInit.elemDuration = 16;
blureInit.unkFlag = 0;
blureInit.calcMode = 0;
blureInit.trailType = 3;
blureInit.trailType = TRAIL_TYPE_BOMBCHU;
Effect_Add(play, &this->blure1Index, EFFECT_BLURE1, 0, 0, &blureInit);
Effect_Add(play, &this->blure2Index, EFFECT_BLURE1, 0, 0, &blureInit);

View File

@ -89,7 +89,7 @@ void EnBoom_Init(Actor* thisx, PlayState* play) {
blure.elemDuration = 8;
blure.unkFlag = 0;
blure.calcMode = 0;
blure.trailType = 2;
blure.trailType = TRAIL_TYPE_BOOMERANG;
Effect_Add(play, &this->effectIndex, EFFECT_BLURE1, 0, 0, &blure);

View File

@ -10696,7 +10696,7 @@ static InitChainEntry sInitChain[] = {
static EffectBlureInit2 blureSword = {
0, 8, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, { 255, 255, 255, 0 }, { 255, 255, 255, 0 }, 4,
0, 2, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, 1,
0, 2, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, TRAIL_TYPE_SWORDS,
};
static Vec3s sSkeletonBaseTransl = { -57, 3377, 0 };