mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-10-31 15:45:06 -04:00
Added trailColor enum
This commit is contained in:
parent
8958cdde6b
commit
34fccee0b8
@ -14,6 +14,19 @@ 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;
|
||||
@ -73,8 +86,8 @@ 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
|
||||
} EffectBlureInit1; // size = 0x1A0
|
||||
/* 0x1A0 */ TrailType trailType; // 1 is swords, 2 is boomerang, 3 is bombchu, 0 is rest
|
||||
} EffectBlureInit1; // size = 0x1A0
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s32 calcMode;
|
||||
@ -89,9 +102,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 */ u8 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 */ TrailType 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];
|
||||
@ -107,11 +120,12 @@ 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 */ 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
|
||||
/* 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
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ f32 initialSpeed;
|
||||
@ -139,7 +153,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];
|
||||
@ -160,7 +174,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;
|
||||
@ -222,12 +236,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;
|
||||
@ -258,7 +272,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;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "soh/frame_interpolation.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
|
||||
EffectBlureElement* elem;
|
||||
@ -72,7 +73,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;
|
||||
}
|
||||
@ -199,6 +200,36 @@ 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;
|
||||
@ -206,93 +237,30 @@ 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:
|
||||
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;
|
||||
}
|
||||
switch (this->trailType) { // a better way?
|
||||
case TRAIL_TYPE_BOOMERANG:
|
||||
updateTrailColor("gCosmetics.Trails_Boomerang", &color, &changed, &reset);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
case TRAIL_TYPE_BOMBCHU:
|
||||
updateTrailColor("gCosmetics.Trails_Bombchu", &color, &changed, &reset);
|
||||
updateParticleColors(&color, this->p1StartColor, this->p2StartColor, this->p1EndColor, this->p2EndColor);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
case TRAIL_TYPE_KOKIRI_SWORD:
|
||||
updateTrailColor("gCosmetics.Trails_KokiriSword", &color, &changed, &reset);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
case TRAIL_TYPE_MASTER_SWORD:
|
||||
updateTrailColor("gCosmetics.Trails_MasterSword", &color, &changed, &reset);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
case TRAIL_TYPE_BIGGORON_SWORD:
|
||||
updateTrailColor("gCosmetics.Trails_BiggoronSword", &color, &changed, &reset);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
case TRAIL_TYPE_STICK:
|
||||
updateTrailColor("gCosmetics.Trails_Stick", &color, &changed, &reset);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
case TRAIL_TYPE_HAMMER:
|
||||
updateTrailColor("gCosmetics.Trails_Hammer", &color, &changed, &reset);
|
||||
break;
|
||||
default: // don't do anything
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -316,7 +284,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("gCosmetics.Trails_Duration.Changed", 0)) {
|
||||
this->elemDuration = CVarGetInteger("gCosmetics.Trails_Duration.Value", 4);
|
||||
}
|
||||
@ -831,7 +799,6 @@ void EffectBlure_DrawSmooth(EffectBlure* this2, GraphicsContext* gfxCtx) {
|
||||
} else {
|
||||
EffectBlure_DrawElemHermiteInterpolation(this, elem, i, gfxCtx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FrameInterpolation_RecordCloseChild();
|
||||
@ -1170,7 +1137,6 @@ 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;
|
||||
}
|
||||
|
@ -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), 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]);
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 }, 1,
|
||||
0, 2, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, TRAIL_TYPE_SWORDS,
|
||||
};
|
||||
|
||||
static Vec3s D_80854730 = { -57, 3377, 0 };
|
||||
|
Loading…
Reference in New Issue
Block a user