From 422340f1139669e97b95ab41ed44f247e24b279c Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Tue, 13 Jun 2023 20:17:20 +0200 Subject: [PATCH 1/3] lego1: bootstrap LegoNavController implementation --- LEGO1/legonavcontroller.cpp | 66 ++++++++++++++++++++++++++++++++++++ LEGO1/legonavcontroller.h | 34 +++++++++++++++++-- isle.mak | 19 +++++++++++ isle.mdp | Bin 46080 -> 46592 bytes 4 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 LEGO1/legonavcontroller.cpp diff --git a/LEGO1/legonavcontroller.cpp b/LEGO1/legonavcontroller.cpp new file mode 100644 index 00000000..037a4fe5 --- /dev/null +++ b/LEGO1/legonavcontroller.cpp @@ -0,0 +1,66 @@ +#include "legonavcontroller.h" + +int g_mouseDeadzone = 40; +float g_zeroThreshold = 0.001f; +float g_movementMaxSpeed = 40.0f; +float g_turnMaxSpeed = 20.0f; +float g_movementMaxAccel = 15.0f; +float g_turnMaxAccel = 30.0f; +float g_movementMinAccel = 4.0f; +float g_turnMinAccel = 15.0f; +float g_movementDecel = 50.0f; +float g_turnDecel = 50.0f; +float g_rotationSensitivity = 0.4f; +MxBool g_turnUseVelocity = 0; + +void LegoNavController::GetDefaults(int *p_mouseDeadzone, float *p_movementMaxSpeed, float *p_turnMaxSpeed, + float *p_movementMaxAccel, float *p_turnMaxAccel, float *p_movementDecel, + float *p_turnDecel, float *p_movementMinAccel, float *p_turnMinAccel, + float *p_rotationSensitivity, MxBool *p_turnUseVelocity) +{ + *p_mouseDeadzone = g_mouseDeadzone; + *p_movementMaxSpeed = g_movementMaxSpeed; + *p_turnMaxSpeed = g_turnMaxSpeed; + *p_movementMaxAccel = g_movementMaxAccel; + *p_turnMaxAccel = g_turnMaxAccel; + *p_movementDecel = g_movementDecel; + *p_turnDecel = g_turnDecel; + *p_movementMinAccel = g_movementMinAccel; + *p_turnMinAccel = g_turnMinAccel; + *p_rotationSensitivity = g_rotationSensitivity; + *p_turnUseVelocity = g_turnUseVelocity; +} + +void LegoNavController::SetDefaults(int p_mouseDeadzone, float p_movementMaxSpeed, float p_turnMaxSpeed, + float p_movementMaxAccel, float p_turnMaxAccel, float p_movementDecel, + float p_turnDecel, float p_movementMinAccel, float p_turnMinAccel, + float p_rotationSensitivity, MxBool p_turnUseVelocity) +{ + g_mouseDeadzone = p_mouseDeadzone; + g_movementMaxSpeed = p_movementMaxSpeed; + g_turnMaxSpeed = p_turnMaxSpeed; + g_movementMaxAccel = p_movementMaxAccel; + g_turnMaxAccel = p_turnMaxAccel; + g_movementDecel = p_movementDecel; + g_turnDecel = p_turnDecel; + g_movementMinAccel = p_movementMinAccel; + g_turnMinAccel = p_turnMinAccel; + g_rotationSensitivity = p_rotationSensitivity; + g_turnUseVelocity = p_turnUseVelocity; +} + +void LegoNavController::ResetToDefault() +{ + this->m_mouseDeadzone = g_mouseDeadzone; + this->m_zeroThreshold = g_zeroThreshold; + this->m_turnMaxAccel = g_turnMaxAccel; + this->m_movementMaxAccel = g_movementMaxAccel; + this->m_turnMinAccel = g_turnMinAccel; + this->m_movementMinAccel = g_movementMinAccel; + this->m_turnDecel = g_turnDecel; + this->m_movementDecel = g_movementDecel; + this->m_turnMaxSpeed = g_turnMaxSpeed; + this->m_movementMaxSpeed = g_movementMaxSpeed; + this->m_turnUseVelocity = g_turnUseVelocity; + this->m_rotationSensitivity = g_rotationSensitivity; +} \ No newline at end of file diff --git a/LEGO1/legonavcontroller.h b/LEGO1/legonavcontroller.h index 33e16916..84be9b62 100644 --- a/LEGO1/legonavcontroller.h +++ b/LEGO1/legonavcontroller.h @@ -1,11 +1,39 @@ #ifndef LEGONAVCONTROLLER_H #define LEGONAVCONTROLLER_H -class LegoNavController +#include "mxcore.h" +#include "mxbool.h" + +class LegoNavController : public MxCore { public: - __declspec(dllexport) static void GetDefaults(int *,float *,float *,float *,float *,float *,float *,float *,float *,float *,unsigned char *); - __declspec(dllexport) static void SetDefaults(int,float,float,float,float,float,float,float,float,float,unsigned char); + __declspec(dllexport) static void GetDefaults(int *p_mouseDeadzone, float *p_movementMaxSpeed, float *p_turnMaxSpeed, + float *p_movementMaxAccel, float *p_turnMaxAccel, float *p_movementDecel, + float *p_turnDecel, float *p_movementMinAccel, float *p_turnMinAccel, + float *p_rotationSensitivity, MxBool *p_turnUseVelocity); + __declspec(dllexport) static void SetDefaults(int p_mouseDeadzone, float p_movementMaxSpeed, float p_turnMaxSpeed, + float p_movementMaxAccel, float p_turnMaxAccel, float p_movementDecel, + float p_turnDecel, float p_movementMinAccel, float p_turnMinAccel, + float p_rotationSensitivity, MxBool p_turnUseVelocity); + void ResetToDefault(); + +private: + int unk_08; // known to be set to window width: 640 (default) + int unk_0C; // known to be set to window height: 480 (default) + int m_mouseDeadzone; + float m_zeroThreshold; + int unk_18[4]; + float m_movementMaxSpeed; + float m_turnMaxSpeed; + int unk_30[2]; + float m_movementMaxAccel; + float m_turnMaxAccel; + float m_movementMinAccel; + float m_turnMinAccel; + float m_movementDecel; + float m_turnDecel; + float m_rotationSensitivity; + MxBool m_turnUseVelocity; }; #endif // LEGONAVCONTROLLER_H diff --git a/isle.mak b/isle.mak index c81ebe25..22a99c81 100644 --- a/isle.mak +++ b/isle.mak @@ -55,6 +55,7 @@ ALL : ".\Release\LEGO1.DLL" CLEAN : -@erase "$(INTDIR)\dllmain.obj" + -@erase "$(INTDIR)\legonavcontroller.obj" -@erase "$(INTDIR)\legoomni.obj" -@erase "$(INTDIR)\mxcore.obj" -@erase "$(INTDIR)\mxcriticalsection.obj" @@ -116,6 +117,7 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ /out:"Release/LEGO1.DLL" /implib:"Release/LEGO1.LIB" LINK32_OBJS= \ "$(INTDIR)\dllmain.obj" \ + "$(INTDIR)\legonavcontroller.obj" \ "$(INTDIR)\legoomni.obj" \ "$(INTDIR)\mxcore.obj" \ "$(INTDIR)\mxcriticalsection.obj" @@ -144,6 +146,7 @@ ALL : ".\Debug\LEGO1.DLL" CLEAN : -@erase "$(INTDIR)\dllmain.obj" + -@erase "$(INTDIR)\legonavcontroller.obj" -@erase "$(INTDIR)\legoomni.obj" -@erase "$(INTDIR)\mxcore.obj" -@erase "$(INTDIR)\mxcriticalsection.obj" @@ -209,6 +212,7 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ /out:"Debug/LEGO1.DLL" /implib:"$(OUTDIR)/LEGO1.lib" LINK32_OBJS= \ "$(INTDIR)\dllmain.obj" \ + "$(INTDIR)\legonavcontroller.obj" \ "$(INTDIR)\legoomni.obj" \ "$(INTDIR)\mxcore.obj" \ "$(INTDIR)\mxcriticalsection.obj" @@ -497,6 +501,21 @@ DEP_CPP_MXCRI=\ $(CPP) $(CPP_PROJ) $(SOURCE) +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LEGO1\legonavcontroller.cpp +DEP_CPP_LEGON=\ + ".\LEGO1\legonavcontroller.h"\ + ".\LEGO1\mxbool.h"\ + ".\LEGO1\mxcore.h"\ + + +"$(INTDIR)\legonavcontroller.obj" : $(SOURCE) $(DEP_CPP_LEGON) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + # End Source File # End Target ################################################################################ diff --git a/isle.mdp b/isle.mdp index 1d92bce9b92e4ca9a9c88f55e04f126638aacd73..e90eca4dfadfa24959285422e1a107f6a76ad0c1 100644 GIT binary patch delta 546 zcmZp8!PM}EiN`D0-GG^ag&~@OfoZcK*B8b`Oe_Kc3_1)^3`z_V4F7?Ek6|+-(+9>$ z9NdgQfUGZ!o47ax1Q-|@7>fi27!-0-nIiV4GHn!m!MI6=LkPQs0WJv_ToMs$xF;uO zYfgR;&BB|PSeBfhS5lOplapGsd0FymP8?F+xxS2(V;Z<8Pfr$^+?scH^65(T&3;Xr z87CLC6mPaEtYMn0U82V!oRgZK4>WW#Z=2d=g(|km@g=8-Q_3$0)r#aEhpJ6-0-qQe zJ{L+eGTgYH#smryU|4=&oixvd(SM`hPDVv#237_JV30AeB``BElmOWX;H>YgtvylD zTS6Ep22{cTqhU&5o;5}Z2fgHig8%;o7@R{=D@t7QlS5K-3vv=mQW=1e2LT|nCVya; rU~^?*VED@jbP^{&KbB|{3}gsm2xbUj2xSOk2xo|3h}$ z9Ndh5fUGZ!o47ax1gzN^Y+QZ{FdSf*z_1`bg=wSU3&u?{975P73~))f;F5?~!@c=U z@>0&t7jxYiCwt|e+H6pEi*fRV9^TFQJ^4(Nxhi}nbC#)3zFVR Date: Tue, 13 Jun 2023 20:45:02 +0200 Subject: [PATCH 2/3] formatting --- LEGO1/legonavcontroller.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LEGO1/legonavcontroller.cpp b/LEGO1/legonavcontroller.cpp index 037a4fe5..aaea52e6 100644 --- a/LEGO1/legonavcontroller.cpp +++ b/LEGO1/legonavcontroller.cpp @@ -32,9 +32,9 @@ void LegoNavController::GetDefaults(int *p_mouseDeadzone, float *p_movementMaxSp } void LegoNavController::SetDefaults(int p_mouseDeadzone, float p_movementMaxSpeed, float p_turnMaxSpeed, - float p_movementMaxAccel, float p_turnMaxAccel, float p_movementDecel, - float p_turnDecel, float p_movementMinAccel, float p_turnMinAccel, - float p_rotationSensitivity, MxBool p_turnUseVelocity) + float p_movementMaxAccel, float p_turnMaxAccel, float p_movementDecel, + float p_turnDecel, float p_movementMinAccel, float p_turnMinAccel, + float p_rotationSensitivity, MxBool p_turnUseVelocity) { g_mouseDeadzone = p_mouseDeadzone; g_movementMaxSpeed = p_movementMaxSpeed; From eaca69716e377aec1a676dd5d9060e3f79752cc5 Mon Sep 17 00:00:00 2001 From: MattKC <34096995+itsmattkc@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:27:35 -0700 Subject: [PATCH 3/3] add matrix link to README.md [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a5accfd..b4d73934 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # LEGO Island Decompilation -[Development Vlog](https://www.youtube.com/playlist?list=PLbpl-gZkNl2COf_bB6cfgTapD5WduAfPz) | [Forums](https://forum.mattkc.com/viewforum.php?f=1) | [Patreon](https://www.patreon.com/mattkc) +[Development Vlog](https://www.youtube.com/playlist?list=PLbpl-gZkNl2COf_bB6cfgTapD5WduAfPz) | [Matrix](https://matrix.to/#/#isledecomp:matrix.org) | [Forums](https://forum.mattkc.com/viewforum.php?f=1) | [Patreon](https://www.patreon.com/mattkc) This is a **work-in-progress** decompilation of LEGO Island version 1.1. It aims to be relatively faithful, but not byte accurate. The goal is to provide a workable codebase that can be modified, improved, and ported to other platforms later on.