From e2f2ef6152d8e2aaf0452d37eab558420911233d Mon Sep 17 00:00:00 2001
From: Joshua Peisach <itzswirlz2020@outlook.com>
Date: Fri, 10 Nov 2023 13:27:10 -0500
Subject: [PATCH] MxControlPresenter: destructor and ReadyTickle (#279)

---
 LEGO1/mxcontrolpresenter.cpp | 21 +++++++++++++++++++++
 LEGO1/mxcontrolpresenter.h   |  5 ++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/LEGO1/mxcontrolpresenter.cpp b/LEGO1/mxcontrolpresenter.cpp
index 158e7460..443fe0dc 100644
--- a/LEGO1/mxcontrolpresenter.cpp
+++ b/LEGO1/mxcontrolpresenter.cpp
@@ -1,5 +1,8 @@
 #include "mxcontrolpresenter.h"
 
+#include "legoomni.h"
+#include "mxticklemanager.h"
+
 DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
 
 // OFFSET: LEGO1 0x10043f50
@@ -12,3 +15,21 @@ MxControlPresenter::MxControlPresenter()
 	this->m_unk58 = 0;
 	this->m_unk54 = 0;
 }
+
+// OFFSET: LEGO1 0x10044110
+MxControlPresenter::~MxControlPresenter()
+{
+	if (this->m_unk58) {
+		delete this->m_unk58;
+	}
+}
+
+// OFFSET: LEGO1 0x10044610
+void MxControlPresenter::ReadyTickle()
+{
+	MxPresenter::ParseExtra();
+	TickleManager()->UnregisterClient(this);
+
+	m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
+	m_currentTickleState = TickleState_Repeating;
+}
diff --git a/LEGO1/mxcontrolpresenter.h b/LEGO1/mxcontrolpresenter.h
index 29a7121a..489451be 100644
--- a/LEGO1/mxcontrolpresenter.h
+++ b/LEGO1/mxcontrolpresenter.h
@@ -9,6 +9,7 @@
 class MxControlPresenter : public MxCompositePresenter {
 public:
 	MxControlPresenter();
+	virtual ~MxControlPresenter() override;
 
 	// OFFSET: LEGO1 0x10044000
 	inline virtual const char* ClassName() const override // vtable+0x0c
@@ -23,13 +24,15 @@ public:
 		return !strcmp(name, MxControlPresenter::ClassName()) || MxCompositePresenter::IsA(name);
 	}
 
+	virtual void ReadyTickle() override; // vtable+0x18
+
 private:
 	undefined2 m_unk4c;
 	MxS16 m_unk4e;
 	undefined m_unk50;
 	undefined2 m_unk52;
 	undefined2 m_unk54;
-	undefined4 m_unk58;
+	undefined4* m_unk58;
 };
 
 #endif // MXCONTROLPRESENTER_H