mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 08:54:15 +00:00
implement SetColorString
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "legobackgroundcolor.h"
|
||||
#include "legoomni.h"
|
||||
#include "legoutil.h"
|
||||
|
||||
const char* Delimiter = "\t";
|
||||
// OFFSET: LEGO1 0x1003bfb0
|
||||
LegoBackgroundColor::LegoBackgroundColor(const char* name, const char* colorString)
|
||||
{
|
||||
@@ -16,5 +16,33 @@ void LegoBackgroundColor::SetColorString(const char* colorString)
|
||||
{
|
||||
m_colorString.operator=(colorString);
|
||||
m_colorString.ToLowerCase();
|
||||
// WIP
|
||||
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);
|
||||
}
|
||||
}
|
||||
7
LEGO1/legoutil.cpp
Normal file
7
LEGO1/legoutil.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "legoutil.h"
|
||||
|
||||
// OFFSET: LEGO1 0x1003eae0
|
||||
void ConvertColor(float r, float g, float b, float* out_r, float* out_g, float* out_b)
|
||||
{
|
||||
// todo
|
||||
}
|
||||
@@ -6,5 +6,5 @@ inline T Abs(T p_t)
|
||||
{
|
||||
return p_t < 0 ? -p_t : p_t;
|
||||
}
|
||||
|
||||
void ConvertColor(float r, float g, float b, float* out_r, float* out_g, float* out_b);
|
||||
#endif // LEGOUTIL_H
|
||||
7
LEGO1/legovideomanager.cpp
Normal file
7
LEGO1/legovideomanager.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "legovideomanager.h"
|
||||
|
||||
// OFFSET: LEGO1 0x1007c440
|
||||
void LegoVideoManager::SetSkyColor(float r, float g, float b)
|
||||
{
|
||||
//todo
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
__declspec(dllexport) void MoveCursor(int x, int y);
|
||||
|
||||
inline Lego3DManager *Get3DManager() { return this->m_3dManager; }
|
||||
void SetSkyColor(float r, float g, float b);
|
||||
|
||||
int m_unk00;
|
||||
int m_unk04;
|
||||
|
||||
@@ -12,7 +12,9 @@ public:
|
||||
protected:
|
||||
MxString m_name;
|
||||
MxString m_colorString;
|
||||
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
};
|
||||
|
||||
#endif // MXBACKGROUNDCOLOR_H
|
||||
|
||||
Reference in New Issue
Block a user