Fix Cosmetics Editor getting stuck on weapon trails (#3913)

* Partially fix cosmetics editor getting stuck on sword trails.

* No reason for "reset" to be static.

* bombchu
This commit is contained in:
Tina H. (sheepytina) 2024-02-16 12:47:13 +11:00 committed by GitHub
commit eeb6c7faaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -203,13 +203,17 @@ s32 EffectBlure_Update(void* thisx) {
EffectBlure* this = (EffectBlure*)thisx; EffectBlure* this = (EffectBlure*)thisx;
s32 i; s32 i;
Color_RGBA8 color; Color_RGBA8 color;
u8 changed = 0; static u8 changed = 0;
u8 reset = 0;
switch (this->trailType) { //there HAS to be a better way to do this. switch (this->trailType) { //there HAS to be a better way to do this.
case 2: case 2:
if (CVarGetInteger("gCosmetics.Trails_Boomerang.Changed", 0)) { if (CVarGetInteger("gCosmetics.Trails_Boomerang.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_Boomerang.Value", (Color_RGBA8){ 255, 255, 100, 255 }); color = CVarGetColor("gCosmetics.Trails_Boomerang.Value", (Color_RGBA8){ 255, 255, 100, 255 });
changed = 1; changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 100, 255 };
reset = 1;
} }
break; break;
case 3: case 3:
@ -227,36 +231,65 @@ s32 EffectBlure_Update(void* thisx) {
this->p2StartColor.b = color.b * 0.8f; this->p2StartColor.b = color.b * 0.8f;
this->p1EndColor.b = color.b * 0.6f; this->p1EndColor.b = color.b * 0.6f;
this->p2EndColor.b = color.b * 0.4f; 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; break;
case 4: case 4:
if (CVarGetInteger("gCosmetics.Trails_KokiriSword.Changed", 0)) { if (CVarGetInteger("gCosmetics.Trails_KokiriSword.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_KokiriSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); color = CVarGetColor("gCosmetics.Trails_KokiriSword.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1; changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
} }
break; break;
case 5: case 5:
if (CVarGetInteger("gCosmetics.Trails_MasterSword.Changed", 0)) { if (CVarGetInteger("gCosmetics.Trails_MasterSword.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_MasterSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); color = CVarGetColor("gCosmetics.Trails_MasterSword.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1; changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
} }
break; break;
case 6: case 6:
if (CVarGetInteger("gCosmetics.Trails_BiggoronSword.Changed", 0)) { if (CVarGetInteger("gCosmetics.Trails_BiggoronSword.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_BiggoronSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); color = CVarGetColor("gCosmetics.Trails_BiggoronSword.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1; changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
} }
break; break;
case 7: case 7:
if (CVarGetInteger("gCosmetics.Trails_Stick.Changed", 0)) { if (CVarGetInteger("gCosmetics.Trails_Stick.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_Stick.Value", (Color_RGBA8){ 255, 255, 255, 255 }); color = CVarGetColor("gCosmetics.Trails_Stick.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1; changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
} }
break; break;
case 8: case 8:
if (CVarGetInteger("gCosmetics.Trails_Hammer.Changed", 0)) { if (CVarGetInteger("gCosmetics.Trails_Hammer.Changed", 0)) {
color = CVarGetColor("gCosmetics.Trails_Hammer.Value", (Color_RGBA8){ 255, 255, 255, 255 }); color = CVarGetColor("gCosmetics.Trails_Hammer.Value", (Color_RGBA8){ 255, 255, 255, 255 });
changed = 1; changed = 1;
} else if (changed) {
color = (Color_RGBA8){ 255, 255, 255, 255 };
reset = 1;
} }
break; break;
default: // don't do anything default: // don't do anything
@ -278,6 +311,9 @@ s32 EffectBlure_Update(void* thisx) {
this->p1EndColor.b = color.b; this->p1EndColor.b = color.b;
this->p2EndColor.b = color.b; this->p2EndColor.b = color.b;
} }
if (reset) {
changed = 0;
}
// Don't override boomerang and bombchu trail durations // Don't override boomerang and bombchu trail durations
if (this->trailType != 2 && this->trailType != 3) { if (this->trailType != 2 && this->trailType != 3) {