#include "classes.h" // 00407170 Color::Color() { this->_tint[0] = 1.0; this->_tint[1] = 1.0; this->_tint[2] = 1.0; this->_tint[3] = 1.0; this->_colorize[0] = 0.0; this->_colorize[1] = 0.0; this->_colorize[2] = 0.0; this->_colorize[3] = 0.0; this->_offset[0] = 0.0; this->_offset[1] = 0.0; this->_offset[2] = 0.0; return; } // 004071c0 ColorMod * Color::operator_assign(ColorMod *other) { float fVar1; float fVar2; float fVar3; fVar1 = other->_tint[1]; fVar2 = other->_tint[2]; fVar3 = other->_tint[3]; this->_tint[0] = other->_tint[0]; this->_tint[1] = fVar1; this->_tint[2] = fVar2; this->_tint[3] = fVar3; fVar1 = other->_colorize[1]; fVar2 = other->_colorize[2]; fVar3 = other->_colorize[3]; this->_colorize[0] = other->_colorize[0]; this->_colorize[1] = fVar1; this->_colorize[2] = fVar2; this->_colorize[3] = fVar3; *GHIDRA_CAST(this->_offset) = *GHIDRA_CAST(other->_offset); this->_offset[2] = other->_offset[2]; return GHIDRA_CAST(this); } // 00407240 float Color::R() { return this->_tint[0]; } // 00407250 long double Color::G() { int in_ECX; return (long double)*GHIDRA_CAST((in_ECX + 4)); } // 00407260 float Color::B() { return this->_tint[2]; } // 00407270 float Color::A() { return this->_tint[3]; } // 004072b0 long double Color::RO() { int in_ECX; return (long double)*GHIDRA_CAST((in_ECX + 0x20)); } // 004072c0 float Color::GO() { return this->_offset[1]; } // 004072d0 long double Color::BO() { int in_ECX; return (long double)*GHIDRA_CAST((in_ECX + 0x28)); } // 0040d0e0 Color::Color(uint32_t param_1, uint32_t param_2, uint32_t param_3, uint32_t param_4) { uint32_t *in_ECX; uint32_t in_XMM1_Da; uint32_t in_XMM2_Da; uint32_t in_XMM3_Da; in_ECX[4] = 0; in_ECX[5] = 0; in_ECX[6] = 0; in_ECX[7] = 0; in_ECX[3] = param_1; in_ECX[8] = param_2; in_ECX[9] = param_3; *in_ECX = in_XMM1_Da; in_ECX[1] = in_XMM2_Da; in_ECX[2] = in_XMM3_Da; in_ECX[10] = param_4; return; } // 004238f0 Color::Color(float r, float g, float b, float a) { this->_colorize[0] = 0.0; this->_colorize[1] = 0.0; this->_colorize[2] = 0.0; this->_colorize[3] = 0.0; this->_offset[0] = 0.0; this->_offset[1] = 0.0; this->_offset[2] = 0.0; this->_tint[0] = r; this->_tint[1] = g; this->_tint[2] = b; this->_tint[3] = a; return; } // 0042cfd0 Color::Color(float r, float g, float b, float redOffset, float greenOffset, float blueOffset) { this->_colorize[0] = 0.0; this->_colorize[1] = 0.0; this->_colorize[2] = 0.0; this->_colorize[3] = 0.0; this->_offset[0] = redOffset; this->_offset[1] = greenOffset; this->_tint[0] = r; this->_tint[1] = g; this->_tint[2] = b; this->_tint[3] = 1.0; this->_offset[2] = blueOffset; return GHIDRA_CAST(this); } // 00435ad0 Color::Color(uint32_t param_1, int param_2, int param_3, int param_4) { uint32_t *in_ECX; uint32_t in_XMM1_Da; uint32_t in_XMM2_Da; uint32_t in_XMM3_Da; in_ECX[4] = 0; in_ECX[5] = 0; in_ECX[6] = 0; in_ECX[7] = 0; in_ECX[3] = param_1; *in_ECX = in_XMM1_Da; in_ECX[1] = in_XMM2_Da; in_ECX[2] = in_XMM3_Da; in_ECX[8] = (float)param_2 * 0.003921569; in_ECX[9] = (float)param_3 * 0.003921569; in_ECX[10] = (float)param_4 * 0.003921569; return; } // 00435b50 Color::Color(uint32_t param_1, uint32_t param_2, uint32_t param_3, uint32_t param_4, uint32_t param_5, uint32_t param_6, uint32_t param_7, uint32_t param_8) { uint32_t *in_ECX; uint32_t in_XMM1_Da; uint32_t in_XMM2_Da; uint32_t in_XMM3_Da; in_ECX[3] = param_1; in_ECX[4] = param_2; in_ECX[5] = param_3; in_ECX[6] = param_4; in_ECX[7] = param_5; in_ECX[8] = param_6; in_ECX[9] = param_7; *in_ECX = in_XMM1_Da; in_ECX[1] = in_XMM2_Da; in_ECX[2] = in_XMM3_Da; in_ECX[10] = param_8; return; } // 00456380 void Color::assign(uint32_t *param_1) { uint32_t uVar1; uint32_t uVar2; uint32_t uVar3; int in_ECX; if (GHIDRA_CAST((in_ECX + 0x1e4)) != param_1) { uVar1 = param_1[1]; uVar2 = param_1[2]; uVar3 = param_1[3]; *GHIDRA_CAST((in_ECX + 0x1e4)) = *param_1; *GHIDRA_CAST((in_ECX + 0x1e8)) = uVar1; *GHIDRA_CAST((in_ECX + 0x1ec)) = uVar2; *GHIDRA_CAST((in_ECX + 0x1f0)) = uVar3; uVar1 = param_1[5]; uVar2 = param_1[6]; uVar3 = param_1[7]; *GHIDRA_CAST((in_ECX + 500)) = param_1[4]; *GHIDRA_CAST((in_ECX + 0x1f8)) = uVar1; *GHIDRA_CAST((in_ECX + 0x1fc)) = uVar2; *GHIDRA_CAST((in_ECX + 0x200)) = uVar3; *GHIDRA_CAST((in_ECX + 0x204)) = *GHIDRA_CAST((param_1 + 8)); *GHIDRA_CAST((in_ECX + 0x20c)) = param_1[10]; } return; } // 004e46d0 void Color::apply_to_kcolor(KColor *outColor, ColorMod *color, KColor *input) { float fVar1; float tintAlpha; float blue; float green; float red; float inputAlpha; float offsetRed; float tintAlpha; fVar1 = color->_colorize[3]; tintAlpha = color->_tint[3]; red = color->_tint[0] * input->_red; green = color->_tint[1] * input->_green; blue = color->_tint[2] * input->_blue; inputAlpha = input->_alpha; if (fVar1 != 0.0) { tintAlpha = green * 0.71516 + red * 0.212671 + blue * 0.072169; red = red + (tintAlpha * color->_colorize[0] - red) * fVar1; green = green + (tintAlpha * color->_colorize[1] - green) * fVar1; blue = blue + (tintAlpha * color->_colorize[2] - blue) * fVar1; } fVar1 = color->_offset[2]; tintAlpha = color->_offset[1]; offsetRed = color->_offset[0]; outColor->_unk = 0; outColor->_alpha = tintAlpha * inputAlpha; outColor->_blue = blue + fVar1; outColor->_green = green + tintAlpha; outColor->_red = red + offsetRed; return; } // 00682ed0 void Color::Reset() { this->_tint[0] = 1.0; this->_tint[1] = 1.0; this->_tint[2] = 1.0; this->_tint[3] = 1.0; this->_colorize[0] = 0.0; this->_colorize[1] = 0.0; this->_colorize[2] = 0.0; this->_colorize[3] = 0.0; this->_offset[0] = 0.0; this->_offset[1] = 0.0; this->_offset[2] = 0.0; return; } // 00682f20 void Color::SetTint(float r, float g, float b, float a) { this->_tint[0] = r; this->_tint[1] = g; this->_tint[2] = b; this->_tint[3] = a; return; } // 00682fb0 void Color::SetColorize(float red, float green, float blue, float amount) { this->_colorize[0] = red; this->_colorize[1] = green; this->_colorize[2] = blue; this->_colorize[3] = amount; return; } // 00682fe0 void Color::SetOffset(float redOffset, float greenOffset, float blueOffset) { this->_offset[0] = redOffset; this->_offset[1] = greenOffset; this->_offset[2] = blueOffset; return; } // 006831c0 void Color::__mul(ColorMod *other) { float colorizeB; float colorizeG; float otherColorizeR; this->_tint[0] = other->_tint[0] * this->_tint[0]; this->_tint[1] = other->_tint[1] * this->_tint[1]; this->_tint[2] = other->_tint[2] * this->_tint[2]; this->_tint[3] = other->_tint[3] * this->_tint[3]; otherColorizeR = other->_colorize[0]; if (otherColorizeR + other->_colorize[1] + other->_colorize[2] != 0.0) { colorizeG = this->_colorize[1]; colorizeB = this->_colorize[2]; if (this->_colorize[0] + colorizeG + colorizeB == 0.0) { this->_colorize[0] = otherColorizeR; this->_colorize[1] = other->_colorize[1]; this->_colorize[2] = other->_colorize[2]; this->_colorize[3] = other->_colorize[3]; } else { this->_colorize[0] = (this->_colorize[0] + otherColorizeR) * 0.5; this->_colorize[1] = (colorizeG + other->_colorize[1]) * 0.5; this->_colorize[2] = (colorizeB + other->_colorize[2]) * 0.5; this->_colorize[3] = (this->_colorize[3] + other->_colorize[3]) * 0.5; } } this->_offset[0] = other->_offset[0] + this->_offset[0]; this->_offset[1] = other->_offset[1] + this->_offset[1]; this->_offset[2] = other->_offset[2] + this->_offset[2]; return; } // 006832e0 ColorMod * Color::Lerp(ColorMod *out, ColorMod *from, ColorMod *to, float t) { float invT; float fromColorizeA; float fromColorizeB; float fromColorizeG; float fromColorizeR; float fromOffsetB; float fromOffsetG; float fromOffsetR; float fromTintA; float fromTintB; float fromTintG; float toColorizeA; float toColorizeB; float toColorizeG; float toColorizeR; float toOffsetB; float toOffsetG; float toOffsetR; float toTintA; float toTintB; float toTintG; invT = 1.0 - t; toTintG = to->_tint[1]; toTintB = to->_tint[2]; toTintA = to->_tint[3]; fromTintG = from->_tint[1]; fromTintB = from->_tint[2]; fromTintA = from->_tint[3]; fromColorizeR = from->_colorize[0]; fromColorizeG = from->_colorize[1]; toColorizeR = to->_colorize[0]; fromColorizeB = from->_colorize[2]; fromColorizeA = from->_colorize[3]; toColorizeG = to->_colorize[1]; fromOffsetG = from->_offset[1]; toColorizeB = to->_colorize[2]; fromOffsetR = from->_offset[0]; toColorizeA = to->_colorize[3]; toOffsetR = to->_offset[0]; toOffsetG = to->_offset[1]; toOffsetB = to->_offset[2]; fromOffsetB = from->_offset[2]; out->_tint[0] = t * to->_tint[0] + invT * from->_tint[0]; out->_tint[1] = t * toTintG + invT * fromTintG; out->_tint[2] = t * toTintB + invT * fromTintB; out->_tint[3] = t * toTintA + invT * fromTintA; out->_offset[1] = invT * fromOffsetG + t * toOffsetG; out->_offset[0] = invT * fromOffsetR + t * toOffsetR; out->_offset[2] = invT * fromOffsetB + t * toOffsetB; out->_colorize[0] = invT * fromColorizeR + t * toColorizeR; out->_colorize[1] = invT * fromColorizeG + t * toColorizeG; out->_colorize[2] = invT * fromColorizeB + t * toColorizeB; out->_colorize[3] = invT * fromColorizeA + t * toColorizeA; return out; }