mirror of
https://github.com/isledecomp/isle.git
synced 2024-12-01 11:57:33 -05:00
improve accuracy + add editorconfig
This commit is contained in:
parent
288f861428
commit
2208573eb2
3 changed files with 38 additions and 32 deletions
3
.editorconfig
Normal file
3
.editorconfig
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[*.{cpp,h}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
|
@ -1,7 +1,10 @@
|
||||||
#include "legobackgroundcolor.h"
|
#include "legobackgroundcolor.h"
|
||||||
#include "legoomni.h"
|
#include "legoomni.h"
|
||||||
#include "legoutil.h"
|
#include "legoutil.h"
|
||||||
|
#include "legovideomanager.h"
|
||||||
const char *Delimiter = "\t";
|
const char *Delimiter = "\t";
|
||||||
|
const char *set = "set";
|
||||||
|
const char *reset = "reset";
|
||||||
// OFFSET: LEGO1 0x1003bfb0
|
// OFFSET: LEGO1 0x1003bfb0
|
||||||
LegoBackgroundColor::LegoBackgroundColor(const char *name, const char *colorString)
|
LegoBackgroundColor::LegoBackgroundColor(const char *name, const char *colorString)
|
||||||
{
|
{
|
||||||
|
@ -10,39 +13,39 @@ LegoBackgroundColor::LegoBackgroundColor(const char* name, const char* colorStri
|
||||||
SetColorString(colorString);
|
SetColorString(colorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// OFFSET: LEGO1 0x1003c070
|
// OFFSET: LEGO1 0x1003c070
|
||||||
void LegoBackgroundColor::SetColorString(const char *colorString)
|
void LegoBackgroundColor::SetColorString(const char *colorString)
|
||||||
{
|
{
|
||||||
m_colorString.operator=(colorString);
|
m_colorString.operator=(colorString);
|
||||||
m_colorString.ToLowerCase();
|
m_colorString.ToLowerCase();
|
||||||
if (colorString == NULL)
|
LegoVideoManager *videomanager = VideoManager();
|
||||||
|
if (videomanager && colorString)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}
|
|
||||||
char *colorStringCopy = (char *)malloc(strlen(colorString) + 1);
|
char *colorStringCopy = (char *)malloc(strlen(colorString) + 1);
|
||||||
strcpy(colorStringCopy, colorString);
|
strcpy(colorStringCopy, colorString);
|
||||||
char *colorStringSplit = strtok(colorStringCopy, Delimiter);
|
char *colorStringSplit = strtok(colorStringCopy, Delimiter);
|
||||||
if(!strcmp(colorStringSplit, "set"))
|
if (!strcmp(colorStringSplit, set))
|
||||||
{
|
{
|
||||||
// set it
|
// set it
|
||||||
char *red = strtok(0, Delimiter);
|
char *red = strtok(0, Delimiter);
|
||||||
if (red)
|
if (red)
|
||||||
r = (double)atoi(red)*0.01;
|
r = atoi(red) * 0.01;
|
||||||
char *blue = strtok(0, Delimiter);
|
char *blue = strtok(0, Delimiter);
|
||||||
if (blue)
|
if (blue)
|
||||||
b = (double)atoi(blue)*0.01;
|
b = atoi(blue) * 0.01;
|
||||||
char *green = strtok(0, Delimiter);
|
char *green = strtok(0, Delimiter);
|
||||||
if (green)
|
if (green)
|
||||||
g = (double)atoi(green)*0.01;
|
g = atoi(green) * 0.01;
|
||||||
}
|
}
|
||||||
else if(!strcmp(colorStringSplit, "reset"))
|
else if (!strcmp(colorStringSplit, reset))
|
||||||
{
|
{
|
||||||
// reset it
|
// reset it
|
||||||
|
float converted_r;
|
||||||
float converted_b;
|
float converted_b;
|
||||||
float converted_g;
|
float converted_g;
|
||||||
float converted_r;
|
|
||||||
ConvertColor(this->r, this->g, this->b, &converted_r, &converted_g, &converted_b);
|
ConvertColor(this->r, this->g, this->b, &converted_r, &converted_g, &converted_b);
|
||||||
VideoManager()->SetSkyColor(converted_r,converted_g,converted_b);
|
videomanager->SetSkyColor(converted_r, converted_g, converted_b);
|
||||||
|
}
|
||||||
|
free(colorStringCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,5 +11,5 @@ MxString* MxBackgroundColor::GetColorString()
|
||||||
// OFFSET: LEGO1 0x1003beb0
|
// OFFSET: LEGO1 0x1003beb0
|
||||||
void MxBackgroundColor::SetColorString(const char* colorString)
|
void MxBackgroundColor::SetColorString(const char* colorString)
|
||||||
{
|
{
|
||||||
this->m_colorString.operator=(colorString);
|
m_colorString.operator=(colorString);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue