1
0
Fork 0
mirror of https://github.com/isledecomp/isle.git synced 2025-03-23 21:20:11 -04:00

Define cursor enum and custom cursor window message ()

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

View file

@ -13,10 +13,10 @@ class LegoROI;
class LegoEventNotificationParam : public MxNotificationParam {
public:
enum {
c_lButtonState = 0x01,
c_rButtonState = 0x02,
c_modKey1 = 0x04,
c_modKey2 = 0x08,
c_lButtonState = 1,
c_rButtonState = 2,
c_modKey1 = 4,
c_modKey2 = 8,
};
// 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>
#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 LegoEntity;
class LegoFile;
@ -28,7 +45,7 @@ void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBo
void FUN_1003eda0();
MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id);
void FUN_1003ef00(MxBool p_enable);
void SetAppCursor(WPARAM p_wparam);
void SetAppCursor(Cursor p_cursor);
MxBool FUN_1003ef60();
MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId);
MxS32 UpdateLightPosition(MxS32 p_increase);

View file

@ -449,9 +449,9 @@ void FUN_1003ef00(MxBool p_enable)
}
// 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

View file

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

View file

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

View file

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

View file

@ -401,7 +401,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
if (m_unk0x335 != 0) {
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);
MxCore* target;

View file

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

View file

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

View file

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