Isle
Loading...
Searching...
No Matches
legoinputmanager.h
Go to the documentation of this file.
1#ifndef LEGOINPUTMANAGER_H
2#define LEGOINPUTMANAGER_H
3
4#include "decomp.h"
6#include "mxlist.h"
7#include "mxpresenter.h"
8#include "mxqueue.h"
9
10#include <dinput.h>
11
14class LegoWorld;
15
17extern const char* g_unk0x100f31b4;
18
21class LegoEventQueue : public MxQueue<LegoEventNotificationParam> {};
22
24class LegoNotifyList : public MxPtrList<MxCore> {
25protected:
30 MxS8 Compare(MxCore* p_element1, MxCore* p_element2) override
31 {
32 return p_element1 == p_element2 ? 0 : p_element1 < p_element2 ? -1 : 1;
33 } // vtable+0x14
34
35public:
37 LegoNotifyList(MxBool p_ownership = FALSE) : MxPtrList<MxCore>(p_ownership) {}
38};
39
41class LegoNotifyListCursor : public MxPtrListCursor<MxCore> {
42public:
46};
47
48
58public:
59
61 enum Keys {
62 c_left = 0x01,
63 c_right = 0x02,
64 c_up = 0x04,
65 c_down = 0x08,
66 c_ctrl = 0x10,
69 };
70
73
75 ~LegoInputManager() override;
76
83 void QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key);
84
87 void Register(MxCore*);
88
91 void UnRegister(MxCore*);
92
95 MxResult Tickle() override;
96
98 MxResult PutData() override { return SUCCESS; } // vtable+0x4c
99
103 MxResult Create(HWND p_hwnd);
104
106 void Destroy() override;
107
110 void CreateAndAcquireKeyboard(HWND p_hwnd);
111
113 void ReleaseDX();
114
118
125 MxResult GetJoystickState(MxU32* p_joystickX, MxU32* p_joystickY, DWORD* p_buttonsState, MxU32* p_povPosition);
126
128 void StartAutoDragTimer();
129
131 void StopAutoDragTimer();
132
135
138 void SetCamera(LegoCameraController* p_camera);
139
141 void ClearCamera();
142
145 void SetWorld(LegoWorld* p_world);
146
148 void ClearWorld();
149
152 void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; }
153
156 void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; }
157
160 void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; }
161
164 void SetUseJoystick(MxBool p_useJoystick) { m_useJoystick = p_useJoystick; }
165
168 void SetJoystickIndex(MxS32 p_joystickIndex) { m_joystickIndex = p_joystickIndex; }
169
172 {
173 m_unk0x88 = TRUE;
174 m_unk0x336 = FALSE;
175 }
176
179 LegoControlManager* GetControlManager() { return m_controlManager; }
180
183 LegoWorld* GetWorld() { return m_world; }
184
187 LegoCameraController* GetCamera() { return m_camera; }
188
190 void ProcessEvents();
191
197
202
204 void GetKeyboardState();
205
210
211private:
212 MxCriticalSection m_criticalSection;
213 LegoNotifyList* m_keyboardNotifyList;
214 LegoCameraController* m_camera;
215 LegoWorld* m_world;
216 LegoEventQueue* m_eventQueue;
217 MxS32 m_x;
218 MxS32 m_y;
219 MxS32 m_unk0x74;
220 UINT m_autoDragTimerID;
221 UINT m_autoDragTime;
222 MxBool m_unk0x80;
223 MxBool m_unk0x81;
224 LegoControlManager* m_controlManager;
225 MxBool m_unk0x88;
226 IDirectInput* m_directInput;
227 IDirectInputDevice* m_directInputDevice;
228 MxBool m_kbStateSuccess;
229 MxU8 m_keyboardState[256];
230 MxBool m_unk0x195;
231 MxS32 m_joyid;
232 MxS32 m_joystickIndex;
233 JOYCAPS m_joyCaps;
234 MxBool m_useJoystick;
235 MxBool m_unk0x335;
236 MxBool m_unk0x336;
237};
238
239#endif // LEGOINPUTMANAGER_H
Camera controller for 3D scenes, handles interactive camera manipulation and view transformation.
[AI] Manages control presenters and dispatches notifications for control/input events within the LEGO...
Notification parameter class for LEGO event notifications such as mouse events and modifier keys.
[AI] Event queue for processing Lego input (mouse/keyboard/joystick) events.[AI] Queue of input event...
[AI] Handles keyboard, mouse, and joystick input for the game.
void ClearCamera()
[AI] Remove any assigned camera controller, disabling camera navigation responses....
void GetKeyboardState()
[AI] Polls DirectInput for current keyboard state. Updates m_keyboardState and success flag....
MxBool FUN_1005cdf0(LegoEventNotificationParam &p_param)
[AI] Complex drag/click/timer event filter.
~LegoInputManager() override
[AI] Clean up and release all acquired input devices, notification lists, control managers,...
MxResult GetNavigationKeyStates(MxU32 &p_keyFlags)
[AI] Retrieves current navigation (arrow) key status from the keyboard, combining keypad and arrow ke...
MxResult Tickle() override
[AI] Updates input and processes the event queue.
void QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key)
[AI] Add an input event (for mouse, keyboard, or joystick) to the processing queue,...
void SetUnknown335(MxBool p_unk0x335)
[AI] Typically used to allow button-down event processing during partial-blocked states.
MxResult Create(HWND p_hwnd)
[AI] Set up DirectInput and joystick state, instantiate controller and notification list.
void EnableInputProcessing()
[AI] Enable event queue and input event processing. Resets relevant state. [AI]
void SetUnknown88(MxBool p_unk0x88)
[AI] Set general-purpose input block flag (purpose: temporary input disable during drag or transition...
void UnRegister(MxCore *)
[AI] Unregister a previously registered recipient so it will no longer receive input notifications.
void ClearWorld()
[AI] Remove any world assignment (used to clear targeting/scene changes). [AI]
LegoCameraController * GetCamera()
[AI] Returns the current camera controller.
MxBool ProcessOneEvent(LegoEventNotificationParam &p_param)
[AI] Processes a single input event (key, mouse click, drag, etc.), sending it to appropriate targets...
void StopAutoDragTimer()
[AI] Stop the running auto drag timer if any. [AI]
void StartAutoDragTimer()
[AI] Start the Windows timer used for distinguishing auto drag events during mouse interaction....
void SetJoystickIndex(MxS32 p_joystickIndex)
[AI] Set user-preferred joystick device index (overrides auto-detection).
MxResult GetJoystickState(MxU32 *p_joystickX, MxU32 *p_joystickY, DWORD *p_buttonsState, MxU32 *p_povPosition)
[AI] Retrieve state of the currently assigned joystick device and normalized position/button state.
Keys
[AI] Key flags for common navigation keys and bitwise combinations used for state queries.
@ c_up
[AI] Up arrow key or equivalent key [AI]
@ c_left
[AI] Left arrow key or equivalent key [AI]
@ c_right
[AI] Right arrow key or equivalent key [AI]
@ c_ctrl
[AI] Control key [AI]
@ c_down
[AI] Down arrow key or equivalent key [AI]
@ c_upOrDown
[AI] Combo: up or down arrow [AI]
@ c_leftOrRight
[AI] Combo: left or right arrow [AI]
MxResult PutData() override
[AI] No-op, always returns SUCCESS. Place-holder for presenter put-data protocol.
LegoControlManager * GetControlManager()
[AI] Retrieve the active control manager, responsible for UI and main action mapping.
void SetCamera(LegoCameraController *p_camera)
[AI] Assigns a new camera controller for mouse/look operations.
LegoWorld * GetWorld()
[AI] Retrieve the currently assigned LegoWorld for scene and actor event notifications.
void SetUnknown336(MxBool p_unk0x336)
[AI] Enables accepting input only for space-bar events (used in special UI states).
MxResult GetJoystickId()
[AI] Scan for valid joystick ID based on preferred index or check all available joysticks.
void ReleaseDX()
[AI] Unacquire and release all DirectInput device interfaces (keyboard). [AI]
void ProcessEvents()
[AI] Dispatch processing of all queued input events until the queue is empty or processing requests e...
LegoInputManager()
[AI] Initialize default state: input device handles, notification lists, and member flags....
void CreateAndAcquireKeyboard(HWND p_hwnd)
[AI] Create keyboard input device and acquire focus for the given window handle.
void SetWorld(LegoWorld *p_world)
[AI] Assigns the current world to receive mouse/click/pick notifications.
void Register(MxCore *)
[AI] Register a core object as a recipient for keyboard events; safe for concurrent multi-threading.
void DisableInputProcessing()
[AI] Block most input processing, allowing only button-down and space events (UI modal input blocking...
void SetUseJoystick(MxBool p_useJoystick)
[AI] Enable or disable joystick support in input processing.
void Destroy() override
[AI] Release all allocated DirectInput devices, notification lists, event queues, and control manager...
[AI] Cursor (iterator) for traversing a LegoNotifyList. Used to find or detach notification targets....
LegoNotifyListCursor(LegoNotifyList *p_list)
[AI] Construct given a LegoNotifyList.
[AI] A list of notification targets (MxCore*) interested in input events (primarily keyboard).
LegoNotifyList(MxBool p_ownership=FALSE)
[AI] Construct with ownership flag determining if contained pointers should be deleted on destruction...
MxS8 Compare(MxCore *p_element1, MxCore *p_element2) override
[AI] Compare two notification MxCore* elements for list ordering (by pointer value).
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
Definition: legoworld.h:49
[AI] Base virtual class for all Mindscape engine (Mx) objects.
Definition: mxcore.h:15
[AI] Provides a critical section object for mutual exclusion with optional use of OS mutex.
[AI] Abstract base class for all presenter types in the LEGO Island engine, responsible for managing ...
Definition: mxpresenter.h:20
[AI]
Definition: mxlist.h:148
Template class implementing a queue, derived from MxList.
Definition: mxqueue.h:11
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
typedef DWORD(FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper
#define IDirectInputDevice
Definition: dinput.h:761
#define IDirectInput
Definition: dinput.h:1378
MxS32 g_unk0x100f31b0
[AI] Global variable used for tracking drag state, -1 if inactive. [AI]
const char * g_unk0x100f31b4
[AI] Global pointer for additional drag state/context (purpose unclear). [AI]
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
NotificationId
Several of those should be defined in LegoOmni.
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
signed char MxS8
[AI]
Definition: mxtypes.h:14