Revert "Added trailType enum"

This reverts commit 34fccee0b8.
This commit is contained in:
macq 2024-02-26 15:04:13 -05:00
parent 34fccee0b8
commit 0fe4b695d9
6 changed files with 107 additions and 87 deletions

View File

@ -14,19 +14,6 @@ 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,
TRAIL_TYPE_STICK_INIT = 4, //conflict in struct definitions, one defines 4 as stick and one defines as bombchu
} TrailType;
typedef struct {
/* 0x00 */ u8 active;
/* 0x01 */ u8 unk_01;
@ -86,8 +73,8 @@ typedef struct {
/* 0x194 */ s32 elemDuration;
/* 0x198 */ s32 unkFlag;
/* 0x19C */ s32 calcMode;
/* 0x1A0 */ TrailType trailType; // 1 is swords, 2 is boomerang, 3 is bombchu, 0 is rest
} EffectBlureInit1; // size = 0x1A0
/* 0x1A0 */ u8 trailType; // 1 is swords, 2 is boomerang, 3 is bombchu, 0 is rest
} EffectBlureInit1; // size = 0x1A0
typedef struct {
/* 0x00 */ s32 calcMode;
@ -102,9 +89,9 @@ typedef struct {
/* 0x1A */ u8 drawMode; // 0: simple; 1: simple with alt colors; 2+: smooth
/* 0x1B */ u8 mode4Param;
/* 0x1C */ Color_RGBA8 altPrimColor; // used with drawMode 1
/* 0x20 */ Color_RGBA8 altEnvColor; // used with drawMode 1
/* 0x1A0 */ TrailType trailType; // 1 is swords, 2 is boomerang, 3 is bombchu, 4 is stick, 0 is rest
} EffectBlureInit2; // size = 0x24
/* 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
} EffectBlureInit2; // size = 0x24
typedef struct {
/* 0x000 */ EffectBlureElement elements[16];
@ -120,12 +107,11 @@ typedef struct {
/* 0x19E */ u8 numElements; // "now_edge_num"
/* 0x19F */ u8 elemDuration;
/* 0x1A0 */ u8 unkFlag;
/* 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 */ TrailType 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.
} EffectBlure; // size = 0x1AC
/* 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.
} EffectBlure; // size = 0x1AC
typedef struct {
/* 0x00 */ f32 initialSpeed;
@ -153,7 +139,7 @@ typedef struct {
/* 0x2C */ u8 duration;
/* 0x2E */ LightPoint lightPoint;
/* 0x3C */ s32 lightDecay; // halves light radius every frame when set to 1
} EffectShieldParticleInit; // size = 0x40
} EffectShieldParticleInit; // size = 0x40
typedef struct {
/* 0x000 */ EffectShieldParticleElement elements[16];
@ -174,7 +160,7 @@ typedef struct {
/* 0x1B2 */ LightInfo lightInfo;
/* 0x1C0 */ LightNode* lightNode;
/* 0x1C4 */ s32 lightDecay; // halves light radius every frame when set to 1
} EffectShieldParticle; // size = 0x1C8
} EffectShieldParticle; // size = 0x1C8
typedef struct {
/* 0x0000 */ struct PlayState* play;
@ -236,12 +222,12 @@ typedef struct EffectSs {
/* 0x18 */ Vec3f accel;
/* 0x24 */ EffectSsUpdateFunc update;
/* 0x28 */ EffectSsDrawFunc draw;
/* 0x2C */ Vec3f vec; // usage specific per effect
/* 0x38 */ void* gfx; // mostly used for display lists, sometimes textures
/* 0x2C */ Vec3f vec; // usage specific per effect
/* 0x38 */ void* gfx; // mostly used for display lists, sometimes textures
/* 0x3C */ Actor* actor; // interfacing actor, usually the actor that spawned the effect
/* 0x40 */ s16 regs[13]; // specific per effect
/* 0x5A */ u16 flags;
/* 0x5C */ s16 life; // -1 means this entry is free
/* 0x5C */ s16 life; // -1 means this entry is free
/* 0x5E */ u8 priority; // Lower value means higher priority
/* 0x5F */ u8 type;
u32 epoch;
@ -272,7 +258,7 @@ typedef struct {
#define DEFINE_EFFECT_SS_UNSET(enum) enum,
typedef enum {
#include "tables/effect_ss_table.h"
#include "tables/effect_ss_table.h"
/* 0x25 */ EFFECT_SS_TYPE_MAX // originally "EFFECT_SS2_TYPE_LAST_LABEL"
} EffectSsType;

View File

@ -3,7 +3,6 @@
#include "soh/frame_interpolation.h"
#include <assert.h>
#include <stdio.h>
void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
EffectBlureElement* elem;
@ -73,7 +72,7 @@ void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
}
}
// dumb doo doo command to change the type of an object's blur on the fly. Link's Swords with unique trail colors.
//dumb doo doo command to change the type of an object's blur on the fly. Link's Swords with unique trail colors.
void EffectBlure_ChangeType(EffectBlure* this, int type) {
this->trailType = type;
}
@ -200,36 +199,6 @@ void EffectBlure_Init2(void* thisx, void* initParamsx) {
void EffectBlure_Destroy(void* thisx) {
}
void updateTrailColor(const char* trailName, Color_RGBA8* color, int* changed, int* reset) {
Color_RGBA8 defaultColor = { 255, 255, 255, 255 };
char cvarName[50];
if (CVarGetInteger(snprintf(cvarName, sizeof(cvarName), "%s.Changed", trailName), 0)) {
*color = CVarGetColor(snprintf(cvarName, sizeof(cvarName), "%s.Value", trailName), defaultColor);
*changed = 1;
} else if (*changed) {
*color = defaultColor;
*reset = 1;
}
}
void updateParticleColors(Color_RGBA8* color, Color_RGBA8 p1StartColor, Color_RGBA8 p2StartColor,
Color_RGBA8 p1EndColor, Color_RGBA8 p2EndColor) {
p1StartColor.r = color->r;
p2StartColor.r = color->r * 0.8f;
p1EndColor.r = color->r * 0.6f;
p2EndColor.r = color->r * 0.4f;
p1StartColor.g = color->g;
p2StartColor.g = color->g * 0.8f;
p1EndColor.g = color->g * 0.6f;
p2EndColor.g = color->g * 0.4f;
p1StartColor.b = color->b;
p2StartColor.b = color->b * 0.8f;
p1EndColor.b = color->b * 0.6f;
p2EndColor.b = color->b * 0.4f;
}
s32 EffectBlure_Update(void* thisx) {
EffectBlure* this = (EffectBlure*)thisx;
s32 i;
@ -237,30 +206,93 @@ s32 EffectBlure_Update(void* thisx) {
static u8 changed = 0;
u8 reset = 0;
switch (this->trailType) { // a better way?
case TRAIL_TYPE_BOOMERANG:
updateTrailColor("gCosmetics.Trails_Boomerang", &color, &changed, &reset);
switch (this->trailType) { //there HAS to be a better way to do this.
case 2:
if (CVarGetInteger("gCosmetics.Trails_Boomerang.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_Boomerang.Value", (Color_RGBA8){ 255, 255, 100, 255 });
changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 100, 255 };
reset = 1;
}
break;
case TRAIL_TYPE_BOMBCHU:
updateTrailColor("gCosmetics.Trails_Bombchu", &color, &changed, &reset);
updateParticleColors(&color, this->p1StartColor, this->p2StartColor, this->p1EndColor, this->p2EndColor);
case 3:
if (CVarGetInteger("gCosmetics.Trails_Bombchu.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_Bombchu.Value", (Color_RGBA8){ 250, 0, 0, 255 });
this->p1StartColor.r = color.r;
this->p2StartColor.r = color.r * 0.8f;
this->p1EndColor.r = color.r * 0.6f;
this->p2EndColor.r = color.r * 0.4f;
this->p1StartColor.g = color.g;
this->p2StartColor.g = color.g * 0.8f;
this->p1EndColor.g = color.g * 0.6f;
this->p2EndColor.g = color.g * 0.4f;
this->p1StartColor.b = color.b;
this->p2StartColor.b = color.b * 0.8f;
this->p1EndColor.b = color.b * 0.6f;
this->p2EndColor.b = color.b * 0.4f;
} else if (changed) {
color = (Color_RGBA8){ 250, 0, 0, 255 };
this->p1StartColor.r = color.r;
this->p2StartColor.r = color.r * 0.8f;
this->p1EndColor.r = color.r * 0.6f;
this->p2EndColor.r = color.r * 0.4f;
this->p1StartColor.g = color.g;
this->p2StartColor.g = color.g * 0.8f;
this->p1EndColor.g = color.g * 0.6f;
this->p2EndColor.g = color.g * 0.4f;
this->p1StartColor.b = color.b;
this->p2StartColor.b = color.b * 0.8f;
this->p1EndColor.b = color.b * 0.6f;
this->p2EndColor.b = color.b * 0.4f;
}
break;
case TRAIL_TYPE_KOKIRI_SWORD:
updateTrailColor("gCosmetics.Trails_KokiriSword", &color, &changed, &reset);
case 4:
if (CVarGetInteger("gCosmetics.Trails_KokiriSword.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_KokiriSword.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
}
break;
case TRAIL_TYPE_MASTER_SWORD:
updateTrailColor("gCosmetics.Trails_MasterSword", &color, &changed, &reset);
case 5:
if (CVarGetInteger("gCosmetics.Trails_MasterSword.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_MasterSword.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
}
break;
case TRAIL_TYPE_BIGGORON_SWORD:
updateTrailColor("gCosmetics.Trails_BiggoronSword", &color, &changed, &reset);
case 6:
if (CVarGetInteger("gCosmetics.Trails_BiggoronSword.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_BiggoronSword.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
}
break;
case TRAIL_TYPE_STICK:
updateTrailColor("gCosmetics.Trails_Stick", &color, &changed, &reset);
case 7:
if (CVarGetInteger("gCosmetics.Trails_Stick.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_Stick.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
}
break;
case TRAIL_TYPE_HAMMER:
updateTrailColor("gCosmetics.Trails_Hammer", &color, &changed, &reset);
case 8:
if (CVarGetInteger("gCosmetics.Trails_Hammer.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_Hammer.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
}
break;
default:
default: // don't do anything
break;
}
@ -284,7 +316,7 @@ s32 EffectBlure_Update(void* thisx) {
}
// Don't override boomerang and bombchu trail durations
if (this->trailType != TRAIL_TYPE_BOOMERANG && this->trailType != TRAIL_TYPE_BOMBCHU) {
if (this->trailType != 2 && this->trailType != 3) {
if (CVarGetInteger("gCosmetics.Trails_Duration.Changed", 0)) {
this->elemDuration = CVarGetInteger("gCosmetics.Trails_Duration.Value", 4);
}
@ -799,6 +831,7 @@ void EffectBlure_DrawSmooth(EffectBlure* this2, GraphicsContext* gfxCtx) {
} else {
EffectBlure_DrawElemHermiteInterpolation(this, elem, i, gfxCtx);
}
}
FrameInterpolation_RecordCloseChild();
@ -1137,6 +1170,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
} else {
gSP1Quadrangle(POLY_XLU_DISP++, j - 2, j - 1, j + 1, j, 0);
if (this->unkFlag == 1) {
phi_t2 = 0;
}

View File

@ -1775,7 +1775,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), TRAIL_TYPE_STICK);
EffectBlure_ChangeType(Effect_GetByIndex(this->meleeWeaponEffectIndex), 7); // stick sword type
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 }, TRAIL_TYPE_REST,
0, 1, 0, { 255, 255, 170, 255 }, { 0, 150, 0, 0 }, 0,
};
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 }, TRAIL_TYPE_REST,
0, 1, 0, { 255, 200, 0, 255 }, { 255, 0, 0, 0 }, 0,
};
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 }, TRAIL_TYPE_REST,
0, 1, 0, { 170, 255, 255, 255 }, { 0, 100, 255, 0 }, 0,
};
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 }, TRAIL_TYPE_REST,
0, 1, 0, { 255, 255, 170, 255 }, { 255, 255, 0, 0 }, 0,
};
static u32 dmgFlags[] = {
0x00000800, 0x00000020, 0x00000020, 0x00000800, 0x00001000,

View File

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

View File

@ -10113,7 +10113,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 }, TRAIL_TYPE_SWORDS,
0, 2, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, 1,
};
static Vec3s D_80854730 = { -57, 3377, 0 };