2023-06-24 13:38:10 -04:00
|
|
|
#include "legobackgroundcolor.h"
|
|
|
|
#include "legoomni.h"
|
|
|
|
#include "legoutil.h"
|
2023-06-24 14:47:05 -04:00
|
|
|
const char* Delimiter = "\t";
|
2023-06-24 13:38:10 -04:00
|
|
|
// OFFSET: LEGO1 0x1003bfb0
|
|
|
|
LegoBackgroundColor::LegoBackgroundColor(const char* name, const char* colorString)
|
|
|
|
{
|
|
|
|
this->m_name.operator=(name);
|
|
|
|
this->m_name.ToUpperCase();
|
|
|
|
SetColorString(colorString);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-06-24 13:47:03 -04:00
|
|
|
// OFFSET: LEGO1 0x1003c070
|
2023-06-24 13:38:10 -04:00
|
|
|
void LegoBackgroundColor::SetColorString(const char* colorString)
|
|
|
|
{
|
2023-06-24 13:47:03 -04:00
|
|
|
m_colorString.operator=(colorString);
|
|
|
|
m_colorString.ToLowerCase();
|
2023-06-24 14:47:05 -04:00
|
|
|
if (colorString == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
char* colorStringCopy = (char*)malloc(strlen(colorString) + 1);
|
|
|
|
strcpy(colorStringCopy, colorString);
|
|
|
|
char* colorStringSplit = strtok(colorStringCopy, Delimiter);
|
|
|
|
if(!strcmp(colorStringSplit, "set"))
|
|
|
|
{
|
|
|
|
//set it
|
|
|
|
char* red = strtok(0, Delimiter);
|
|
|
|
if(red)
|
|
|
|
r = (double)atoi(red)*0.01;
|
|
|
|
char* blue = strtok(0, Delimiter);
|
|
|
|
if(blue)
|
|
|
|
b = (double)atoi(blue)*0.01;
|
|
|
|
char* green = strtok(0, Delimiter);
|
|
|
|
if(green)
|
|
|
|
g = (double)atoi(green)*0.01;
|
|
|
|
}
|
|
|
|
else if(!strcmp(colorStringSplit, "reset"))
|
|
|
|
{
|
|
|
|
//reset it
|
|
|
|
float converted_b;
|
|
|
|
float converted_g;
|
|
|
|
float converted_r;
|
|
|
|
ConvertColor(this->r,this->g,this->b,&converted_r,&converted_g,&converted_b);
|
|
|
|
VideoManager()->SetSkyColor(converted_r,converted_g,converted_b);
|
|
|
|
}
|
2023-06-24 13:38:10 -04:00
|
|
|
}
|