address review

This commit is contained in:
Misha
2023-06-28 18:15:42 +03:00
parent a919eeb7f4
commit a883f37b9d
9 changed files with 65 additions and 61 deletions

View File

@@ -16,8 +16,7 @@ LegoBackgroundColor::LegoBackgroundColor(const char *name, const char *colorStri
// OFFSET: LEGO1 0x1003c070
void LegoBackgroundColor::SetColorString(const char *colorString)
{
m_colorString.operator=(colorString);
m_name = colorString;
m_colorString.ToLowerCase();
float converted_r;
@@ -28,7 +27,7 @@ void LegoBackgroundColor::SetColorString(const char *colorString)
if (videomanager && colorString)
{
int length = strlen(colorString) + 1;
char *colorStringCopy = (char *)malloc(length);
char *colorStringCopy = new char[length];
strcpy(colorStringCopy, colorString);
char *colorStringSplit = strtok(colorStringCopy, Delimiter);
if (!strcmp(colorStringSplit, set))
@@ -49,6 +48,6 @@ void LegoBackgroundColor::SetColorString(const char *colorString)
ConvertHSVToRGB(this->h, this->s, this->v, &converted_r, &converted_g, &converted_b);
videomanager->SetSkyColor(converted_r, converted_g, converted_b);
}
free(colorStringCopy);
delete[] colorStringCopy;
}
}
}

View File

@@ -2,12 +2,16 @@
#define LEGOBACKGROUNDCOLOR_H
#include "mxstring.h"
#include "mxcore.h"
#include "mxbackgroundcolor.h"
class LegoBackgroundColor : public MxBackgroundColor
#include "MxStringVariable.h"
class LegoBackgroundColor : public MxStringVariable
{
public:
__declspec(dllexport) LegoBackgroundColor(const char *, const char *);
void SetColorString(const char *colorString);
protected:
float h;
float s;
float v;
};
#endif // LEGOBACKGROUNDCOLOR_H

View File

@@ -10,7 +10,7 @@ void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, floa
double v12;
double v13;
if (s > 0.5f)
calc = ((1.0f - v) * s + v); //
calc = (1.0f - v) * s + v;
else
calc = (v + 1.0) * s;
if (calc <= 0.0)

View File

@@ -1,22 +0,0 @@
#include "mxbackgroundcolor.h"
#include "mxstring.h"
// OFFSET: LEGO1 0x1003bec0
MxBackgroundColor::~MxBackgroundColor()
{
delete &m_colorString;
delete &m_name;
}
// OFFSET: LEGO1 0x1003bea0
MxString *MxBackgroundColor::GetColorString()
{
return &m_colorString;
}
// OFFSET: LEGO1 0x1003beb0
void MxBackgroundColor::SetColorString(const char *colorString)
{
m_colorString.operator=(colorString);
}

View File

@@ -1,22 +0,0 @@
#ifndef MXBACKGROUNDCOLOR_H
#define MXACKGROUNDCOLOR_H
#include "mxstring.h"
#include "mxcore.h"
class MxBackgroundColor
{
public:
__declspec(dllexport) MxBackgroundColor(const char *, const char *);
MxBackgroundColor() {}
virtual MxString *GetColorString();
virtual void SetColorString(const char *colorString);
virtual ~MxBackgroundColor();
protected:
MxString m_name;
MxString m_colorString;
float h;
float s;
float v;
};
#endif // MXBACKGROUNDCOLOR_H

View File

@@ -0,0 +1,22 @@
#include "MxStringVariable.h"
#include "mxstring.h"
// OFFSET: LEGO1 0x1003bec0
MxStringVariable::~MxStringVariable()
{
delete &m_colorString;
delete &m_name;
}
// OFFSET: LEGO1 0x1003bea0
MxString *MxStringVariable::GetColorString()
{
return &m_colorString;
}
// OFFSET: LEGO1 0x1003beb0
void MxStringVariable::SetColorString(const char *colorString)
{
m_colorString = colorString;
}

20
LEGO1/mxstringvariable.h Normal file
View File

@@ -0,0 +1,20 @@
#ifndef MXSTRINGVARIABLE_H
#define MXSTRINGVARIABLE_H
#include "mxstring.h"
#include "mxcore.h"
//VTABLE: 0x100d74a8
class MxStringVariable
{
public:
__declspec(dllexport) MxStringVariable(const char *, const char *);
MxStringVariable() {}
virtual MxString *GetColorString();
virtual void SetColorString(const char *colorString);
virtual ~MxStringVariable();
protected:
MxString m_name;
MxString m_colorString;
};
#endif // MXSTRINGVARIABLE_H