mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-10-31 15:45:06 -04:00
Reset back to master and implemented trailType enum
This commit is contained in:
parent
bcbe4cb1c3
commit
d8e88ab477
@ -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,7 +86,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; // 1 is swords, 2 is boomerang, 3 is bombchu, 0 is rest
|
||||
} EffectBlureInit1; // size = 0x1A0
|
||||
|
||||
typedef struct {
|
||||
@ -90,7 +103,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; // 1 is swords, 2 is boomerang, 3 is bombchu, 4 is stick, 0 is rest
|
||||
} EffectBlureInit2; // size = 0x24
|
||||
|
||||
typedef struct {
|
||||
@ -110,7 +123,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; // 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 {
|
||||
|
@ -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