mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-25 17:18:16 -05:00
90% match
This commit is contained in:
parent
2208573eb2
commit
3d16867a90
4 changed files with 29 additions and 13 deletions
|
@ -16,35 +16,42 @@ LegoBackgroundColor::LegoBackgroundColor(const char *name, const char *colorStri
|
|||
// OFFSET: LEGO1 0x1003c070
|
||||
void LegoBackgroundColor::SetColorString(const char *colorString)
|
||||
{
|
||||
|
||||
m_colorString.operator=(colorString);
|
||||
m_colorString.ToLowerCase();
|
||||
|
||||
float converted_b;
|
||||
float converted_g;
|
||||
float converted_r;
|
||||
LegoVideoManager *videomanager = VideoManager();
|
||||
|
||||
if (videomanager && colorString)
|
||||
{
|
||||
char *colorStringCopy = (char *)malloc(strlen(colorString) + 1);
|
||||
int length = strlen(colorString) + 1;
|
||||
char *colorStringCopy = (char *)malloc(length);
|
||||
strcpy(colorStringCopy, colorString);
|
||||
char *colorStringSplit = strtok(colorStringCopy, Delimiter);
|
||||
if (!strcmp(colorStringSplit, set))
|
||||
{
|
||||
// set it
|
||||
char *red = strtok(0, Delimiter);
|
||||
if (red)
|
||||
r = atoi(red) * 0.01;
|
||||
|
||||
//TODO: I think this is in BGR because of the order of local variables
|
||||
char *blue = strtok(0, Delimiter);
|
||||
if (blue)
|
||||
b = atoi(blue) * 0.01;
|
||||
char *green = strtok(0, Delimiter);
|
||||
if (green)
|
||||
g = atoi(green) * 0.01;
|
||||
char *red = strtok(0, Delimiter);
|
||||
if (red)
|
||||
r = atoi(red) * 0.01;
|
||||
}
|
||||
else if (!strcmp(colorStringSplit, reset))
|
||||
{
|
||||
// reset it
|
||||
float converted_r;
|
||||
float converted_b;
|
||||
float converted_g;
|
||||
ConvertColor(this->r, this->g, this->b, &converted_r, &converted_g, &converted_b);
|
||||
videomanager->SetSkyColor(converted_r, converted_g, converted_b);
|
||||
|
||||
ConvertColor(this->b, this->g, this->r, &converted_b, &converted_g, &converted_r);
|
||||
videomanager->SetSkyColor(converted_b, converted_g, converted_r);
|
||||
}
|
||||
free(colorStringCopy);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,12 @@ class LegoBackgroundColor : public MxBackgroundColor
|
|||
{
|
||||
public:
|
||||
__declspec(dllexport) LegoBackgroundColor(const char *, const char *);
|
||||
void SetColorString(const char* colorString);
|
||||
void SetColorString(const char *colorString);
|
||||
|
||||
protected:
|
||||
float b;
|
||||
float g;
|
||||
float r;
|
||||
};
|
||||
|
||||
#endif // LEGOBACKGROUNDCOLOR_H
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#include "mxbackgroundcolor.h"
|
||||
#include "mxstring.h"
|
||||
|
||||
// OFFSET: LEGO1 0x1003bec0
|
||||
MxBackgroundColor::~MxBackgroundColor()
|
||||
{
|
||||
m_colorString.~MxString();
|
||||
m_name.~MxString();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x1003bea0
|
||||
MxString* MxBackgroundColor::GetColorString()
|
||||
|
|
|
@ -9,12 +9,10 @@ class MxBackgroundColor
|
|||
MxBackgroundColor(){}
|
||||
virtual MxString* GetColorString();
|
||||
virtual void SetColorString(const char* colorString);
|
||||
virtual ~MxBackgroundColor();
|
||||
protected:
|
||||
MxString m_name;
|
||||
MxString m_colorString;
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
};
|
||||
|
||||
#endif // MXBACKGROUNDCOLOR_H
|
||||
|
|
Loading…
Reference in a new issue