Skip to content

Commit

Permalink
Define cursor enum and custom cursor window message (#980) (isledecom…
Browse files Browse the repository at this point in the history
…p#15)

* Define cursor enum and custom cursor window message

* Fix param name

* Remove unused header
  • Loading branch information
foxtacles authored and madebr committed Jun 25, 2024
1 parent f87c1a0 commit 8a2bbca
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 35 deletions.
8 changes: 4 additions & 4 deletions LEGO1/lego/legoomni/include/legoeventnotificationparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 0 additions & 11 deletions LEGO1/lego/legoomni/include/legonotify.h

This file was deleted.

19 changes: 18 additions & 1 deletion LEGO1/lego/legoomni/include/legoutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions LEGO1/lego/legoomni/src/common/legoutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ MxResult MxTransitionManager::StartTransition(
LegoVideoManager* videoManager = VideoManager();
videoManager->SetRender3D(FALSE);

SetAppCursor(1);
SetAppCursor(e_cursorBusy);
return SUCCESS;
}
return FAILURE;
Expand Down
5 changes: 2 additions & 3 deletions LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "3dmanager/lego3dmanager.h"
#include "legoinputmanager.h"
#include "legonotify.h"
#include "legosoundmanager.h"
#include "legovideomanager.h"
#include "misc.h"
Expand Down Expand Up @@ -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());
}
}
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/entity/legoworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/src/input/legoinputmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,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;

Expand Down
6 changes: 3 additions & 3 deletions LEGO1/lego/legoomni/src/main/legomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
8 changes: 4 additions & 4 deletions LEGO1/lego/legoomni/src/worlds/infocenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions LEGO1/lego/legoomni/src/worlds/isle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 8a2bbca

Please sign in to comment.