mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 17:04:17 +00:00
address review
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
22
LEGO1/mxstringvariable.cpp
Normal file
22
LEGO1/mxstringvariable.cpp
Normal 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
20
LEGO1/mxstringvariable.h
Normal 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
|
||||
Reference in New Issue
Block a user