Define cursor enum and custom cursor window message (#980)

* Define cursor enum and custom cursor window message

* Fix param name

* Remove unused header
This commit is contained in:
Christian Semmler 2024-06-01 10:07:58 -04:00 committed by GitHub
parent b67af71f33
commit df20b05510
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 54 additions and 48 deletions

View File

@ -9,6 +9,7 @@
#include "legomain.h" #include "legomain.h"
#include "legomodelpresenter.h" #include "legomodelpresenter.h"
#include "legopartpresenter.h" #include "legopartpresenter.h"
#include "legoutils.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "legoworldpresenter.h" #include "legoworldpresenter.h"
#include "misc.h" #include "misc.h"
@ -506,7 +507,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
g_mousedown = 0; g_mousedown = 0;
type = c_notificationButtonUp; type = c_notificationButtonUp;
break; break;
case 0x5400: case WM_ISLE_SETCURSOR:
if (g_isle) { if (g_isle) {
g_isle->SetupCursor(wParam); g_isle->SetupCursor(wParam);
return 0; return 0;
@ -893,25 +894,25 @@ inline void IsleApp::Tick(BOOL sleepIfNotNextFrame)
void IsleApp::SetupCursor(WPARAM wParam) void IsleApp::SetupCursor(WPARAM wParam)
{ {
switch (wParam) { switch (wParam) {
case 0: case e_cursorArrow:
m_cursorCurrent = m_cursorArrow; m_cursorCurrent = m_cursorArrow;
break; break;
case 1: case e_cursorBusy:
m_cursorCurrent = m_cursorBusy; m_cursorCurrent = m_cursorBusy;
break; break;
case 2: case e_cursorNo:
m_cursorCurrent = m_cursorNo; m_cursorCurrent = m_cursorNo;
break; break;
case 0xB: case e_cursorNone:
m_cursorCurrent = NULL; m_cursorCurrent = NULL;
case 3: case e_cursorUnused3:
case 4: case e_cursorUnused4:
case 5: case e_cursorUnused5:
case 6: case e_cursorUnused6:
case 7: case e_cursorUnused7:
case 8: case e_cursorUnused8:
case 9: case e_cursorUnused9:
case 0xA: case e_cursorUnused10:
break; break;
} }

View File

@ -13,10 +13,10 @@ class LegoROI;
class LegoEventNotificationParam : public MxNotificationParam { class LegoEventNotificationParam : public MxNotificationParam {
public: public:
enum { enum {
c_lButtonState = 0x01, c_lButtonState = 1,
c_rButtonState = 0x02, c_rButtonState = 2,
c_modKey1 = 0x04, c_modKey1 = 4,
c_modKey2 = 0x08, c_modKey2 = 8,
}; };
// FUNCTION: LEGO1 0x10028690 // FUNCTION: LEGO1 0x10028690

View File

@ -1,11 +0,0 @@
#ifndef LEGONOTIFY_H
#define LEGONOTIFY_H
enum LegoEventNotificationParamType {
c_lButtonState = 1,
c_rButtonState = 2,
c_modKey1 = 4,
c_modKey2 = 8,
};
#endif // LEGONOTIFY_H

View File

@ -7,6 +7,23 @@
#include <windows.h> #include <windows.h>
#define WM_ISLE_SETCURSOR 0x5400
enum Cursor {
e_cursorArrow = 0,
e_cursorBusy,
e_cursorNo,
e_cursorUnused3,
e_cursorUnused4,
e_cursorUnused5,
e_cursorUnused6,
e_cursorUnused7,
e_cursorUnused8,
e_cursorUnused9,
e_cursorUnused10,
e_cursorNone
};
class MxAtomId; class MxAtomId;
class LegoEntity; class LegoEntity;
class LegoFile; class LegoFile;
@ -28,7 +45,7 @@ void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBo
void FUN_1003eda0(); void FUN_1003eda0();
MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id); MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id);
void FUN_1003ef00(MxBool p_enable); void FUN_1003ef00(MxBool p_enable);
void SetAppCursor(WPARAM p_wparam); void SetAppCursor(Cursor p_cursor);
MxBool FUN_1003ef60(); MxBool FUN_1003ef60();
MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId); MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId);
MxS32 UpdateLightPosition(MxS32 p_increase); MxS32 UpdateLightPosition(MxS32 p_increase);

View File

@ -449,9 +449,9 @@ void FUN_1003ef00(MxBool p_enable)
} }
// FUNCTION: LEGO1 0x1003ef40 // FUNCTION: LEGO1 0x1003ef40
void SetAppCursor(WPARAM p_wparam) void SetAppCursor(Cursor p_cursor)
{ {
PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), 0x5400, p_wparam, 0); PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), WM_ISLE_SETCURSOR, p_cursor, 0);
} }
// FUNCTION: LEGO1 0x1003ef60 // FUNCTION: LEGO1 0x1003ef60

View File

@ -124,7 +124,7 @@ MxResult MxTransitionManager::StartTransition(
LegoVideoManager* videoManager = VideoManager(); LegoVideoManager* videoManager = VideoManager();
videoManager->SetRender3D(FALSE); videoManager->SetRender3D(FALSE);
SetAppCursor(1); SetAppCursor(e_cursorBusy);
return SUCCESS; return SUCCESS;
} }
return FAILURE; return FAILURE;

View File

@ -2,7 +2,6 @@
#include "3dmanager/lego3dmanager.h" #include "3dmanager/lego3dmanager.h"
#include "legoinputmanager.h" #include "legoinputmanager.h"
#include "legonotify.h"
#include "legosoundmanager.h" #include "legosoundmanager.h"
#include "legovideomanager.h" #include "legovideomanager.h"
#include "misc.h" #include "misc.h"
@ -109,10 +108,10 @@ void LegoCameraController::OnRButtonUp(MxPoint32 p_point)
// FUNCTION: LEGO1 0x10012230 // FUNCTION: LEGO1 0x10012230
void LegoCameraController::OnMouseMove(MxU8 p_modifier, MxPoint32 p_point) void LegoCameraController::OnMouseMove(MxU8 p_modifier, MxPoint32 p_point)
{ {
if (p_modifier & c_lButtonState) { if (p_modifier & LegoEventNotificationParam::c_lButtonState) {
LeftDrag(p_point.GetX(), p_point.GetY()); LeftDrag(p_point.GetX(), p_point.GetY());
} }
else if (p_modifier & c_rButtonState) { else if (p_modifier & LegoEventNotificationParam::c_rButtonState) {
RightDrag(p_point.GetX(), p_point.GetY()); RightDrag(p_point.GetX(), p_point.GetY());
} }
} }

View File

@ -766,7 +766,7 @@ MxResult LegoWorld::Tickle()
switch (m_startupTicks) { switch (m_startupTicks) {
case e_start: case e_start:
m_worldStarted = TRUE; m_worldStarted = TRUE;
SetAppCursor(0); SetAppCursor(e_cursorArrow);
ReadyWorld(); ReadyWorld();
return TRUE; return TRUE;
case e_two: case e_two:

View File

@ -401,7 +401,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
if (m_unk0x335 != 0) { if (m_unk0x335 != 0) {
if (p_param.GetType() == c_notificationButtonDown) { if (p_param.GetType() == c_notificationButtonDown) {
LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, ' '); LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, VK_SPACE);
LegoNotifyListCursor cursor(m_keyboardNotifyList); LegoNotifyListCursor cursor(m_keyboardNotifyList);
MxCore* target; MxCore* target;

View File

@ -254,7 +254,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
} }
m_notificationManager->Register(this); m_notificationManager->Register(this);
SetAppCursor(1); SetAppCursor(e_cursorBusy);
m_gameState->SetCurrentAct(LegoGameState::e_act1); m_gameState->SetCurrentAct(LegoGameState::e_act1);
result = SUCCESS; result = SUCCESS;
@ -582,12 +582,12 @@ MxLong LegoOmni::Notify(MxParam& p_param)
void LegoOmni::StartTimer() void LegoOmni::StartTimer()
{ {
MxOmni::StartTimer(); MxOmni::StartTimer();
SetAppCursor(2); SetAppCursor(e_cursorNo);
} }
// FUNCTION: LEGO1 0x1005b650 // FUNCTION: LEGO1 0x1005b650
void LegoOmni::StopTimer() void LegoOmni::StopTimer()
{ {
MxOmni::StopTimer(); MxOmni::StopTimer();
SetAppCursor(0); SetAppCursor(e_cursorArrow);
} }

View File

@ -57,7 +57,7 @@ Infocenter::Infocenter()
memset(&m_mapAreas, 0, sizeof(m_mapAreas)); memset(&m_mapAreas, 0, sizeof(m_mapAreas));
m_unk0x1c8 = -1; m_unk0x1c8 = -1;
SetAppCursor(1); SetAppCursor(e_cursorBusy);
NotificationManager()->Register(this); NotificationManager()->Register(this);
m_infoManDialogueTimer = 0; m_infoManDialogueTimer = 0;
@ -1183,7 +1183,7 @@ void Infocenter::PlayCutscene(Cutscene p_entityId, MxBool p_scale)
VideoManager()->EnableFullScreenMovie(TRUE, p_scale); VideoManager()->EnableFullScreenMovie(TRUE, p_scale);
InputManager()->SetUnknown336(TRUE); InputManager()->SetUnknown336(TRUE);
InputManager()->SetUnknown335(TRUE); InputManager()->SetUnknown335(TRUE);
SetAppCursor(0xb); // Hide cursor SetAppCursor(e_cursorNone);
VideoManager()->GetDisplaySurface()->ClearScreen(); VideoManager()->GetDisplaySurface()->ClearScreen();
if (m_currentCutscene != e_noIntro) { if (m_currentCutscene != e_noIntro) {
@ -1205,7 +1205,7 @@ void Infocenter::StopCutscene()
VideoManager()->EnableFullScreenMovie(FALSE); VideoManager()->EnableFullScreenMovie(FALSE);
InputManager()->SetUnknown335(FALSE); InputManager()->SetUnknown335(FALSE);
SetAppCursor(0); // Restore cursor to arrow SetAppCursor(e_cursorArrow);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
} }
@ -1405,7 +1405,7 @@ void Infocenter::StartCredits()
GetViewManager()->RemoveAll(NULL); GetViewManager()->RemoveAll(NULL);
InvokeAction(Extra::e_opendisk, *g_creditsScript, CreditsScript::c_LegoCredits, NULL); InvokeAction(Extra::e_opendisk, *g_creditsScript, CreditsScript::c_LegoCredits, NULL);
SetAppCursor(0); SetAppCursor(e_cursorArrow);
} }
// FUNCTION: LEGO1 0x10071250 // FUNCTION: LEGO1 0x10071250

View File

@ -816,7 +816,7 @@ void Isle::Enable(MxBool p_enable)
break; break;
} }
SetAppCursor(0); SetAppCursor(e_cursorArrow);
if (m_act1state->m_unk0x018 != 8 && if (m_act1state->m_unk0x018 != 8 &&
(m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_elevride) && (m_act1state->m_unk0x018 != 0 || GameState()->m_currentArea != LegoGameState::e_elevride) &&
@ -952,7 +952,7 @@ MxLong Isle::HandleTransitionEnd()
VariableTable()->SetVariable("VISIBILITY", "Show Gas"); VariableTable()->SetVariable("VISIBILITY", "Show Gas");
AnimationManager()->Resume(); AnimationManager()->Resume();
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
SetAppCursor(0); SetAppCursor(e_cursorArrow);
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
break; break;
case LegoGameState::e_unk33: case LegoGameState::e_unk33:
@ -962,7 +962,7 @@ MxLong Isle::HandleTransitionEnd()
VariableTable()->SetVariable("VISIBILITY", "Show Policsta"); VariableTable()->SetVariable("VISIBILITY", "Show Policsta");
AnimationManager()->Resume(); AnimationManager()->Resume();
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
SetAppCursor(0); SetAppCursor(e_cursorArrow);
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
break; break;
case LegoGameState::e_polidoor: case LegoGameState::e_polidoor:
@ -1073,7 +1073,7 @@ void Isle::FUN_10032d30(
} }
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
SetAppCursor(0); SetAppCursor(e_cursorArrow);
m_destLocation = LegoGameState::e_undefined; m_destLocation = LegoGameState::e_undefined;
m_act1state->m_unk0x01f = FALSE; m_act1state->m_unk0x01f = FALSE;
} }