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

Improve naming, use virtual key constants ()

This commit is contained in:
Christian Semmler 2024-05-31 22:46:05 -04:00 committed by GitHub
parent 77af1a5483
commit b67af71f33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 36 additions and 36 deletions

View file

@ -153,7 +153,7 @@ void IsleApp::Close()
if (Lego()) {
GameState()->Save(0);
if (InputManager()) {
InputManager()->QueueEvent(c_notificationKeyPress, 0, 0, 0, 0x20);
InputManager()->QueueEvent(c_notificationKeyPress, 0, 0, 0, VK_SPACE);
}
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL);

View file

@ -125,8 +125,8 @@ public:
void ProcessEvents();
MxBool ProcessOneEvent(LegoEventNotificationParam& p_param);
MxBool FUN_1005cdf0(LegoEventNotificationParam& p_param);
void FUN_1005c0f0();
MxResult FUN_1005c160(MxU32& p_keyFlags);
void GetKeyboardState();
MxResult GetNavigationKeyStates(MxU32& p_keyFlags);
// SYNTHETIC: LEGO1 0x1005b8d0
// LegoInputManager::`scalar deleting destructor'
@ -148,8 +148,8 @@ private:
MxBool m_unk0x88; // 0x88
IDirectInput* m_directInput; // 0x8c
IDirectInputDevice* m_directInputDevice; // 0x90
MxBool m_unk0x94; // 0x94
MxU8 m_unk0x95[256]; // 0x95
MxBool m_kbStateSuccess; // 0x94
MxU8 m_keyboardState[256]; // 0x95
MxBool m_unk0x195; // 0x195
MxS32 m_joyid; // 0x198
MxS32 m_joystickIndex; // 0x19c

View file

@ -537,7 +537,7 @@ MxResult LegoNavController::ProcessKeyboardInput()
LegoInputManager* inputManager = LegoOmni::GetInstance()->GetInputManager();
MxU32 keyFlags;
if (inputManager == NULL || inputManager->FUN_1005c160(keyFlags) == FAILURE) {
if (inputManager == NULL || inputManager->GetNavigationKeyStates(keyFlags) == FAILURE) {
return FAILURE;
}

View file

@ -40,7 +40,7 @@ LegoInputManager::LegoInputManager()
m_unk0x88 = FALSE;
m_directInput = NULL;
m_directInputDevice = NULL;
m_unk0x94 = FALSE;
m_kbStateSuccess = FALSE;
m_unk0x195 = 0;
m_joyid = -1;
m_joystickIndex = -1;
@ -142,63 +142,63 @@ void LegoInputManager::ReleaseDX()
}
// FUNCTION: LEGO1 0x1005c0f0
void LegoInputManager::FUN_1005c0f0()
void LegoInputManager::GetKeyboardState()
{
m_unk0x94 = FALSE;
m_kbStateSuccess = FALSE;
if (m_directInputDevice) {
HRESULT hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_unk0x95), &m_unk0x95);
HRESULT hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_keyboardState), &m_keyboardState);
if (hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED) {
if (m_directInputDevice->Acquire() == S_OK) {
hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_unk0x95), &m_unk0x95);
hr = m_directInputDevice->GetDeviceState(sizeOfArray(m_keyboardState), &m_keyboardState);
}
}
if (hr == S_OK) {
m_unk0x94 = TRUE;
m_kbStateSuccess = TRUE;
}
}
}
// FUNCTION: LEGO1 0x1005c160
MxResult LegoInputManager::FUN_1005c160(MxU32& p_keyFlags)
MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags)
{
FUN_1005c0f0();
GetKeyboardState();
if (!m_unk0x94) {
if (!m_kbStateSuccess) {
return FAILURE;
}
if (g_unk0x100f67b8) {
if (m_unk0x95[DIK_LEFT] & 0x80 && GetAsyncKeyState(VK_LEFT) == 0) {
m_unk0x95[DIK_LEFT] = 0;
if (m_keyboardState[DIK_LEFT] & 0x80 && GetAsyncKeyState(VK_LEFT) == 0) {
m_keyboardState[DIK_LEFT] = 0;
}
if (m_unk0x95[DIK_RIGHT] & 0x80 && GetAsyncKeyState(VK_RIGHT) == 0) {
m_unk0x95[DIK_RIGHT] = 0;
if (m_keyboardState[DIK_RIGHT] & 0x80 && GetAsyncKeyState(VK_RIGHT) == 0) {
m_keyboardState[DIK_RIGHT] = 0;
}
}
MxU32 keyFlags = 0;
if ((m_unk0x95[DIK_NUMPAD8] | m_unk0x95[DIK_UP]) & 0x80) {
if ((m_keyboardState[DIK_NUMPAD8] | m_keyboardState[DIK_UP]) & 0x80) {
keyFlags |= c_up;
}
if ((m_unk0x95[DIK_NUMPAD2] | m_unk0x95[DIK_DOWN]) & 0x80) {
if ((m_keyboardState[DIK_NUMPAD2] | m_keyboardState[DIK_DOWN]) & 0x80) {
keyFlags |= c_down;
}
if ((m_unk0x95[DIK_NUMPAD4] | m_unk0x95[DIK_LEFT]) & 0x80) {
if ((m_keyboardState[DIK_NUMPAD4] | m_keyboardState[DIK_LEFT]) & 0x80) {
keyFlags |= c_left;
}
if ((m_unk0x95[DIK_NUMPAD6] | m_unk0x95[DIK_RIGHT]) & 0x80) {
if ((m_keyboardState[DIK_NUMPAD6] | m_keyboardState[DIK_RIGHT]) & 0x80) {
keyFlags |= c_right;
}
if ((m_unk0x95[DIK_LCONTROL] | m_unk0x95[DIK_RCONTROL]) & 0x80) {
if ((m_keyboardState[DIK_LCONTROL] | m_keyboardState[DIK_RCONTROL]) & 0x80) {
keyFlags |= c_bit5;
}
@ -290,6 +290,7 @@ MxResult LegoInputManager::GetJoystickState(
}
}
}
return FAILURE;
}
@ -345,7 +346,7 @@ void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p
LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key);
if (((!m_unk0x88) || ((m_unk0x335 && (param.GetType() == c_notificationButtonDown)))) ||
((m_unk0x336 && (p_key == ' ')))) {
((m_unk0x336 && (p_key == VK_SPACE)))) {
ProcessOneEvent(param);
}
}
@ -369,8 +370,8 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
MxBool processRoi;
if (p_param.GetType() == c_notificationKeyPress) {
if (!Lego()->IsTimerRunning() || p_param.GetKey() == 0x13) {
if (p_param.GetKey() == 0x10) {
if (!Lego()->IsTimerRunning() || p_param.GetKey() == VK_PAUSE) {
if (p_param.GetKey() == VK_SHIFT) {
if (m_unk0x195) {
m_unk0x80 = FALSE;
p_param.SetType(c_notificationDrag);

View file

@ -297,7 +297,7 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
// FUNCTION: LEGO1 0x10005920
MxLong GasStation::HandleKeyPress(MxS8 p_key)
{
if (p_key == ' ' && g_unk0x100f0160 == 0 && this->m_unk0x106 != 0) {
if (p_key == VK_SPACE && g_unk0x100f0160 == 0 && m_unk0x106 != 0) {
m_state->FUN_10006490();
return 1;
}

View file

@ -226,7 +226,7 @@ MxLong Hospital::HandleKeyPress(MxS8 p_key)
{
MxLong result = 0;
if (p_key == ' ' && g_unk0x100f7918 == 0) {
if (p_key == VK_SPACE && g_unk0x100f7918 == 0) {
DeleteObjects(&m_atom, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
result = 1;
}

View file

@ -612,7 +612,6 @@ MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y)
VideoManager()->SortPresenterList();
m_unk0x11c->Enable(TRUE);
m_unk0x11c->SetPosition(p_x, p_y);
m_unk0x11c->SetDisplayZ(oldDisplayZ);
}
else {
@ -631,7 +630,7 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key)
{
MxLong result = 0;
if (p_key == ' ' && m_worldStarted) {
if (p_key == VK_SPACE && m_worldStarted) {
switch (m_infocenterState->GetUnknown0x74()) {
case 0:
StopCutscene();

View file

@ -164,7 +164,7 @@ MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param)
{
MxLong result = 0;
if (p_param.GetKey() == ' ' && m_policeState->GetUnknown0x0c() == 1) {
if (p_param.GetKey() == VK_SPACE && m_policeState->GetUnknown0x0c() == 1) {
DeleteObjects(&m_atom, PoliceScript::c_nps001ni_RunAnim, PoliceScript::c_nps002la_RunAnim);
m_policeState->SetUnknown0x0c(0);
return 1;

View file

@ -166,13 +166,13 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key)
key = p_key;
}
if ((key < 'A' || key > 'Z') && key != '\b') {
if (key == ' ') {
if ((key < 'A' || key > 'Z') && key != VK_BACK) {
if (key == VK_SPACE) {
DeleteObjects(&m_atom, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav);
BackgroundAudioManager()->RaiseVolume();
}
}
else if (key != '\b' && m_unk0x280.m_cursorPos < 7) {
else if (key != VK_BACK && m_unk0x280.m_cursorPos < 7) {
m_name[0][m_unk0x280.m_cursorPos] = m_alphabet[key - 'A']->Clone();
if (m_name[0][m_unk0x280.m_cursorPos] != NULL) {
@ -190,7 +190,7 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key)
}
}
else {
if (key == '\b' && m_unk0x280.m_cursorPos > 0) {
if (key == VK_BACK && m_unk0x280.m_cursorPos > 0) {
m_unk0x280.m_cursorPos--;
m_name[0][m_unk0x280.m_cursorPos]->Enable(FALSE);