diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..6a2c7e44 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "legovideomanager.h": "c" + } +} \ No newline at end of file diff --git a/LEGO1.DLL.idb b/LEGO1.DLL.idb new file mode 100644 index 00000000..b7f938db Binary files /dev/null and b/LEGO1.DLL.idb differ diff --git a/LEGO1/legobackgroundcolor.cpp b/LEGO1/legobackgroundcolor.cpp index e7198a41..f913b8e9 100644 --- a/LEGO1/legobackgroundcolor.cpp +++ b/LEGO1/legobackgroundcolor.cpp @@ -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); + } } \ No newline at end of file diff --git a/LEGO1/legoutil.cpp b/LEGO1/legoutil.cpp new file mode 100644 index 00000000..8012ebc8 --- /dev/null +++ b/LEGO1/legoutil.cpp @@ -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 +} \ No newline at end of file diff --git a/LEGO1/legoutil.h b/LEGO1/legoutil.h index 440b01d0..4dc2cf5b 100644 --- a/LEGO1/legoutil.h +++ b/LEGO1/legoutil.h @@ -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 \ No newline at end of file diff --git a/LEGO1/legovideomanager.cpp b/LEGO1/legovideomanager.cpp new file mode 100644 index 00000000..9f631677 --- /dev/null +++ b/LEGO1/legovideomanager.cpp @@ -0,0 +1,7 @@ +#include "legovideomanager.h" + +// OFFSET: LEGO1 0x1007c440 +void LegoVideoManager::SetSkyColor(float r, float g, float b) +{ + //todo +} \ No newline at end of file diff --git a/LEGO1/legovideomanager.h b/LEGO1/legovideomanager.h index a221504f..acecfd72 100644 --- a/LEGO1/legovideomanager.h +++ b/LEGO1/legovideomanager.h @@ -13,6 +13,7 @@ class LegoVideoManager __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; diff --git a/LEGO1/mxbackgroundcolor.h b/LEGO1/mxbackgroundcolor.h index 1c611b55..4f7d8a6e 100644 --- a/LEGO1/mxbackgroundcolor.h +++ b/LEGO1/mxbackgroundcolor.h @@ -12,7 +12,9 @@ class MxBackgroundColor protected: MxString m_name; MxString m_colorString; - + float r; + float g; + float b; }; #endif // MXBACKGROUNDCOLOR_H diff --git a/isle.mak b/isle.mak index 92c5d82e..910d79ec 100644 --- a/isle.mak +++ b/isle.mak @@ -145,7 +145,9 @@ LINK32_OBJS= \ "$(INTDIR)\mxvideoparam.obj" \ "$(INTDIR)\mxvideoparamflags.obj" \ "$(INTDIR)\mxbackgroundcolor.obj" \ - "$(INTDIR)\legobackgroundcolor.obj" + "$(INTDIR)\legobackgroundcolor.obj" \ + "$(INTDIR)\legoutil.obj" \ + "$(INTDIR)\legovideomanager.obj" ".\Release\LEGO1.DLL" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< @@ -263,7 +265,9 @@ LINK32_OBJS= \ "$(INTDIR)\mxvideoparam.obj" \ "$(INTDIR)\mxvideoparamflags.obj" \ "$(INTDIR)\mxbackgroundcolor.obj" \ - "$(INTDIR)\legobackgroundcolor.obj" + "$(INTDIR)\legobackgroundcolor.obj" \ + "$(INTDIR)\legoutil.obj" \ + "$(INTDIR)\legovideomanager.obj" ".\Debug\LEGO1.DLL" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< @@ -847,6 +851,32 @@ DEP_CPP_MXATO=\ $(CPP) $(CPP_PROJ) $(SOURCE) +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LEGO1\legoutil.cpp +DEP_CPP_MXATO=\ + ".\LEGO1\legoutil.h"\ + + +"$(INTDIR)\legoutil.obj" : $(SOURCE) $(DEP_CPP_MXATO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LEGO1\legovideomanager.cpp +DEP_CPP_MXATO=\ + ".\LEGO1\legovideomanager.h"\ + + +"$(INTDIR)\legovideomanager.obj" : $(SOURCE) $(DEP_CPP_MXATO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + # End Source File # End Target ################################################################################