Use SDL_KeyCode in LEGO1.dll ()

* Pass SDL_Keycode in LEGO1.dll

* ISLE.EXE: use iniparser for getting isle.mediaPath

* Use SDL_isdigit instead of isdigit

* clang-format

* hdPath is a better default for mediaPath

* Replaced a stray 'A' with SDLK_A

* Use SDL_Keycode to store the ogel cheat code
This commit is contained in:
Anonymous Maarten 2024-12-29 18:56:47 +01:00 committed by GitHub
parent 34bfa1b345
commit b97aea42d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 116 additions and 97 deletions

View file

@ -140,6 +140,10 @@ IsleApp::~IsleApp()
if (m_savePath) { if (m_savePath) {
delete[] m_savePath; delete[] m_savePath;
} }
if (m_mediaPath) {
delete[] m_mediaPath;
}
} }
// FUNCTION: ISLE 0x401260 // FUNCTION: ISLE 0x401260
@ -175,18 +179,16 @@ void IsleApp::Close()
MxS32 IsleApp::SetupLegoOmni() MxS32 IsleApp::SetupLegoOmni()
{ {
MxS32 result = FALSE; MxS32 result = FALSE;
char mediaPath[256];
GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath));
#ifdef COMPAT_MODE #ifdef COMPAT_MODE
MxS32 failure; MxS32 failure;
{ {
MxOmniCreateParam param(mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags()); MxOmniCreateParam param(m_mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags());
failure = Lego()->Create(param) == FAILURE; failure = Lego()->Create(param) == FAILURE;
} }
#else #else
MxS32 failure = MxS32 failure =
Lego()->Create(MxOmniCreateParam(mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE; Lego()->Create(MxOmniCreateParam(m_mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE;
#endif #endif
if (!failure) { if (!failure) {
@ -525,11 +527,15 @@ void IsleApp::LoadConfig()
iniConfig = new char[strlen(m_iniPath) + 1]; iniConfig = new char[strlen(m_iniPath) + 1];
strcpy(iniConfig, m_iniPath); strcpy(iniConfig, m_iniPath);
} }
else { else if (prefPath) {
iniConfig = new char[strlen(prefPath) + strlen("isle.ini") + 1](); iniConfig = new char[strlen(prefPath) + strlen("isle.ini") + 1]();
strcat(iniConfig, prefPath); strcat(iniConfig, prefPath);
strcat(iniConfig, "isle.ini"); strcat(iniConfig, "isle.ini");
} }
else {
iniConfig = new char[strlen("isle.ini") + 1];
strcpy(iniConfig, "isle.ini");
}
SDL_Log("Reading configuration from \"%s\"", iniConfig); SDL_Log("Reading configuration from \"%s\"", iniConfig);
dictionary* dict = iniparser_load(iniConfig); dictionary* dict = iniparser_load(iniConfig);
@ -544,6 +550,10 @@ void IsleApp::LoadConfig()
strcpy(m_cdPath, cdPath); strcpy(m_cdPath, cdPath);
MxOmni::SetCD(m_cdPath); MxOmni::SetCD(m_cdPath);
const char* mediaPath = iniparser_getstring(dict, "isle:mediapath", hdPath);
m_mediaPath = new char[strlen(mediaPath) + 1];
strcpy(m_mediaPath, mediaPath);
m_flipSurfaces = iniparser_getboolean(dict, "isle:Flip Surfaces", m_flipSurfaces); m_flipSurfaces = iniparser_getboolean(dict, "isle:Flip Surfaces", m_flipSurfaces);
m_fullScreen = iniparser_getboolean(dict, "isle:Full Screen", m_fullScreen); m_fullScreen = iniparser_getboolean(dict, "isle:Full Screen", m_fullScreen);
m_wideViewAngle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wideViewAngle); m_wideViewAngle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wideViewAngle);

View file

@ -78,6 +78,7 @@ private:
SDL_Cursor* m_cursorBusy; // 0x80 SDL_Cursor* m_cursorBusy; // 0x80
SDL_Cursor* m_cursorNo; // 0x84 SDL_Cursor* m_cursorNo; // 0x84
SDL_Cursor* m_cursorCurrent; // 0x88 SDL_Cursor* m_cursorCurrent; // 0x88
char* m_mediaPath;
char* m_iniPath; char* m_iniPath;
}; };

View file

@ -7,6 +7,8 @@
#include "legoworld.h" #include "legoworld.h"
#include "radio.h" #include "radio.h"
#include <SDL3/SDL_keycode.h>
class MxStillPresenter; class MxStillPresenter;
// VTABLE: LEGO1 0x100d46e0 // VTABLE: LEGO1 0x100d46e0
@ -95,7 +97,7 @@ private:
inline void StopAction(GarageScript::Script p_objectId); inline void StopAction(GarageScript::Script p_objectId);
MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleKeyPress(MxS8 p_key); MxLong HandleKeyPress(SDL_Keycode p_key);
MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param); MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param);
MxS16 m_currentActorId; // 0xf8 MxS16 m_currentActorId; // 0xf8

View file

@ -91,7 +91,7 @@ public:
// Hospital::`scalar deleting destructor' // Hospital::`scalar deleting destructor'
private: private:
MxLong HandleKeyPress(MxS8 p_key); MxLong HandleKeyPress(SDL_Keycode p_key);
MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param); MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param);
MxBool HandleControl(LegoControlManagerNotificationParam& p_param); MxBool HandleControl(LegoControlManagerNotificationParam& p_param);

View file

@ -130,7 +130,7 @@ public:
private: private:
void InitializeBitmaps(); void InitializeBitmaps();
MxLong HandleKeyPress(MxS8 p_key); MxLong HandleKeyPress(SDL_Keycode p_key);
MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y); MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y);
MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y); MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y);
MxU8 HandleControl(LegoControlManagerNotificationParam& p_param); MxU8 HandleControl(LegoControlManagerNotificationParam& p_param);

View file

@ -4,6 +4,7 @@
#include "mxnotificationparam.h" #include "mxnotificationparam.h"
#include "mxtypes.h" #include "mxtypes.h"
#include <SDL3/SDL_keycode.h>
#include <stdlib.h> #include <stdlib.h>
class LegoROI; class LegoROI;
@ -35,7 +36,7 @@ public:
MxU8 p_modifier, MxU8 p_modifier,
MxS32 p_x, MxS32 p_x,
MxS32 p_y, MxS32 p_y,
MxU8 p_key SDL_Keycode p_key
) )
: MxNotificationParam(p_type, p_sender), m_modifier(p_modifier), m_x(p_x), m_y(p_y), m_key(p_key), m_roi(NULL) : MxNotificationParam(p_type, p_sender), m_modifier(p_modifier), m_x(p_x), m_y(p_y), m_key(p_key), m_roi(NULL)
{ {
@ -43,7 +44,7 @@ public:
LegoROI* GetROI() { return m_roi; } LegoROI* GetROI() { return m_roi; }
MxU8 GetModifier() { return m_modifier; } MxU8 GetModifier() { return m_modifier; }
MxU8 GetKey() const { return m_key; } SDL_Keycode GetKey() const { return m_key; }
// FUNCTION: LEGO1 0x10012190 // FUNCTION: LEGO1 0x10012190
// FUNCTION: BETA10 0x10024210 // FUNCTION: BETA10 0x10024210
@ -59,7 +60,7 @@ public:
void SetModifier(MxU8 p_modifier) { m_modifier = p_modifier; } void SetModifier(MxU8 p_modifier) { m_modifier = p_modifier; }
// FUNCTION: BETA10 0x1007d6b0 // FUNCTION: BETA10 0x1007d6b0
void SetKey(MxU8 p_key) { m_key = p_key; } void SetKey(SDL_Keycode p_key) { m_key = p_key; }
// FUNCTION: BETA10 0x1007d650 // FUNCTION: BETA10 0x1007d650
void SetX(MxS32 p_x) { m_x = p_x; } void SetX(MxS32 p_x) { m_x = p_x; }
@ -68,11 +69,11 @@ public:
void SetY(MxS32 p_y) { m_y = p_y; } void SetY(MxS32 p_y) { m_y = p_y; }
protected: protected:
MxU8 m_modifier; // 0x0c MxU8 m_modifier; // 0x0c
MxS32 m_x; // 0x10 MxS32 m_x; // 0x10
MxS32 m_y; // 0x14 MxS32 m_y; // 0x14
MxU8 m_key; // 0x18 SDL_Keycode m_key; // 0x18
LegoROI* m_roi; // 0x1c LegoROI* m_roi; // 0x1c
}; };
// SYNTHETIC: LEGO1 0x10028770 // SYNTHETIC: LEGO1 0x10028770

View file

@ -10,6 +10,7 @@
#include <SDL3/SDL_joystick.h> #include <SDL3/SDL_joystick.h>
#include <SDL3/SDL_keyboard.h> #include <SDL3/SDL_keyboard.h>
#include <SDL3/SDL_keycode.h>
#include <SDL3/SDL_timer.h> #include <SDL3/SDL_timer.h>
#include <windows.h> #include <windows.h>
@ -87,7 +88,7 @@ public:
LegoInputManager(); LegoInputManager();
~LegoInputManager() override; ~LegoInputManager() override;
LEGO1_EXPORT void QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key); LEGO1_EXPORT void QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, SDL_Keycode p_key);
void Register(MxCore*); void Register(MxCore*);
void UnRegister(MxCore*); void UnRegister(MxCore*);

View file

@ -66,7 +66,7 @@ private:
LPDIRECTDRAWSURFACE m_checkboxNormal; // 0x2cc LPDIRECTDRAWSURFACE m_checkboxNormal; // 0x2cc
MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleKeyPress(MxU8 p_key); MxLong HandleKeyPress(SDL_Keycode p_key);
MxLong HandleControl(LegoControlManagerNotificationParam& p_param); MxLong HandleControl(LegoControlManagerNotificationParam& p_param);
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void FUN_100775c0(MxS16 p_playerIndex); void FUN_100775c0(MxS16 p_playerIndex);

View file

@ -109,10 +109,17 @@ MxU32 g_switchAct = FALSE;
LegoAnimationManager::PlayMode g_unk0x100f66bc = LegoAnimationManager::e_unk2; LegoAnimationManager::PlayMode g_unk0x100f66bc = LegoAnimationManager::e_unk2;
// GLOBAL: LEGO1 0x100f66c0 // GLOBAL: LEGO1 0x100f66c0
char g_debugPassword[] = "OGEL"; SDL_Keycode g_debugPassword[] = {
// "OGEL"
SDLK_O,
SDLK_G,
SDLK_E,
SDLK_L,
0,
};
// GLOBAL: LEGO1 0x100f66c8 // GLOBAL: LEGO1 0x100f66c8
char* g_currentInput = g_debugPassword; SDL_Keycode* g_currentInput = g_debugPassword;
// GLOBAL: LEGO1 0x100f66cc // GLOBAL: LEGO1 0x100f66cc
MxS32 g_nextCharacter = -1; MxS32 g_nextCharacter = -1;
@ -639,10 +646,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
{ {
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationKeyPress) { if (((MxNotificationParam&) p_param).GetNotification() == c_notificationKeyPress) {
m_unk0x5d = TRUE; m_unk0x5d = TRUE;
MxU8 key = ((LegoEventNotificationParam&) p_param).GetKey(); SDL_Keycode key = ((LegoEventNotificationParam&) p_param).GetKey();
switch (key) { switch (key) {
case VK_PAUSE: // Pause game case SDLK_PAUSE: // Pause game
if (Lego()->IsPaused()) { if (Lego()->IsPaused()) {
Lego()->Resume(); Lego()->Resume();
} }
@ -650,7 +657,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
Lego()->Pause(); Lego()->Pause();
} }
break; break;
case VK_ESCAPE: { // Return to infocenter case SDLK_ESCAPE: { // Return to infocenter
LegoWorld* currentWorld = CurrentWorld(); LegoWorld* currentWorld = CurrentWorld();
if (currentWorld != NULL) { if (currentWorld != NULL) {
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
@ -664,10 +671,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
} }
break; break;
} }
case VK_SPACE: // Interrupt/end animations or free navigation case SDLK_SPACE: // Interrupt/end animations or free navigation
AnimationManager()->FUN_10061010(TRUE); AnimationManager()->FUN_10061010(TRUE);
break; break;
case 'Z': { // Make nearby plants "dance" case SDLK_Z: { // Make nearby plants "dance"
LegoOmni* omni = Lego(); LegoOmni* omni = Lego();
if (omni->GetCurrentWorld() != NULL && omni->GetCurrentWorld()->GetWorldId() == LegoOmni::e_act1) { if (omni->GetCurrentWorld() != NULL && omni->GetCurrentWorld()->GetWorldId() == LegoOmni::e_act1) {
@ -701,15 +708,15 @@ MxLong LegoNavController::Notify(MxParam& p_param)
} }
break; break;
} }
case VK_ADD: case SDLK_KP_PLUS:
case VK_SUBTRACT: { // Cycles through characters and puts them in front of you case SDLK_KP_MINUS: { // Cycles through characters and puts them in front of you
if (g_nextCharacter == -1) { if (g_nextCharacter == -1) {
g_nextCharacter = 0; g_nextCharacter = 0;
} }
else { else {
CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_nextCharacter)); CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_nextCharacter));
if (key == VK_ADD) { if (key == SDLK_KP_PLUS) {
g_nextCharacter++; g_nextCharacter++;
if (g_nextCharacter >= CharacterManager()->GetNumActors()) { if (g_nextCharacter >= CharacterManager()->GetNumActors()) {
g_nextCharacter = 0; g_nextCharacter = 0;
@ -736,7 +743,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
} }
break; break;
} }
case VK_F12: { // Saves the game case SDLK_F12: { // Saves the game
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state && state->HasRegistered()) { if (state && state->HasRegistered()) {
GameState()->Save(0); GameState()->Save(0);
@ -748,7 +755,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
if (!*g_currentInput) { if (!*g_currentInput) {
// password "protected" debug shortcuts // password "protected" debug shortcuts
switch (((LegoEventNotificationParam&) p_param).GetKey()) { switch (((LegoEventNotificationParam&) p_param).GetKey()) {
case VK_TAB: case SDLK_TAB:
VideoManager()->ToggleFPS(g_fpsEnabled); VideoManager()->ToggleFPS(g_fpsEnabled);
if (g_fpsEnabled) { if (g_fpsEnabled) {
g_fpsEnabled = FALSE; g_fpsEnabled = FALSE;
@ -759,16 +766,16 @@ MxLong LegoNavController::Notify(MxParam& p_param)
default: default:
m_unk0x5d = FALSE; m_unk0x5d = FALSE;
break; break;
case '0': case SDLK_0:
case '1': case SDLK_1:
case '2': case SDLK_2:
case '3': case SDLK_3:
case '4': case SDLK_4:
case '5': case SDLK_5:
case '6': case SDLK_6:
case '7': case SDLK_7:
case '8': case SDLK_8:
case '9': case SDLK_9:
if (g_changeLight && key <= '1') { if (g_changeLight && key <= '1') {
LegoROI* roi = VideoManager()->GetViewROI(); LegoROI* roi = VideoManager()->GetViewROI();
Tgl::FloatMatrix4 matrix; Tgl::FloatMatrix4 matrix;
@ -821,7 +828,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
} }
} }
if (g_switchAct && key >= '1' && key <= '5') { if (g_switchAct && key >= SDLK_1 && key <= SDLK_5) {
switch (GameState()->GetCurrentAct()) { switch (GameState()->GetCurrentAct()) {
case LegoGameState::e_act1: case LegoGameState::e_act1:
GameState()->m_currentArea = LegoGameState::e_isle; GameState()->m_currentArea = LegoGameState::e_isle;
@ -835,17 +842,17 @@ MxLong LegoNavController::Notify(MxParam& p_param)
} }
switch (key) { switch (key) {
case '1': case SDLK_1:
GameState()->SetCurrentAct(LegoGameState::e_act1); GameState()->SetCurrentAct(LegoGameState::e_act1);
GameState()->SwitchArea(LegoGameState::e_isle); GameState()->SwitchArea(LegoGameState::e_isle);
break; break;
case '2': case SDLK_2:
GameState()->SwitchArea(LegoGameState::e_act2main); GameState()->SwitchArea(LegoGameState::e_act2main);
break; break;
case '3': case SDLK_3:
GameState()->SwitchArea(LegoGameState::e_act3script); GameState()->SwitchArea(LegoGameState::e_act3script);
break; break;
case '4': { case SDLK_4: {
Act3State* act3State = (Act3State*) GameState()->GetState("Act3State"); Act3State* act3State = (Act3State*) GameState()->GetState("Act3State");
if (act3State == NULL) { if (act3State == NULL) {
act3State = new Act3State(); act3State = new Act3State();
@ -859,7 +866,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
GameState()->SwitchArea(LegoGameState::e_infomain); GameState()->SwitchArea(LegoGameState::e_infomain);
break; break;
} }
case '5': { case SDLK_5: {
Act3State* act3State = (Act3State*) GameState()->GetState("Act3State"); Act3State* act3State = (Act3State*) GameState()->GetState("Act3State");
if (act3State == NULL) { if (act3State == NULL) {
act3State = new Act3State(); act3State = new Act3State();
@ -884,7 +891,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
LegoOmni::GetInstance()->Start(&action); LegoOmni::GetInstance()->Start(&action);
} }
break; break;
case 'A': case SDLK_A:
if (g_animationCalcStep == 1) { if (g_animationCalcStep == 1) {
Lego()->m_unk0x13c = TRUE; Lego()->m_unk0x13c = TRUE;
AnimationManager()->FUN_10060570(TRUE); AnimationManager()->FUN_10060570(TRUE);
@ -900,22 +907,22 @@ MxLong LegoNavController::Notify(MxParam& p_param)
} }
} }
break; break;
case 'C': case SDLK_C:
g_locationCalcStep = 1; g_locationCalcStep = 1;
break; break;
case 'D': case SDLK_D:
m_unk0x60 = -1.0; m_unk0x60 = -1.0;
break; break;
case 'F': case SDLK_F:
RealtimeView::SetUserMaxLOD(0.0); RealtimeView::SetUserMaxLOD(0.0);
break; break;
case 'G': case SDLK_G:
g_switchAct = TRUE; g_switchAct = TRUE;
break; break;
case 'H': case SDLK_H:
RealtimeView::SetUserMaxLOD(5.0); RealtimeView::SetUserMaxLOD(5.0);
break; break;
case 'I': { case SDLK_I: {
LegoROI* roi = VideoManager()->GetViewROI(); LegoROI* roi = VideoManager()->GetViewROI();
MxMatrix mat; MxMatrix mat;
mat.SetIdentity(); mat.SetIdentity();
@ -923,7 +930,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
roi->WrappedVTable0x24(mat); roi->WrappedVTable0x24(mat);
break; break;
} }
case 'J': { case SDLK_J: {
LegoROI* roi = VideoManager()->GetViewROI(); LegoROI* roi = VideoManager()->GetViewROI();
MxMatrix mat; MxMatrix mat;
mat.SetIdentity(); mat.SetIdentity();
@ -931,7 +938,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
roi->WrappedVTable0x24(mat); roi->WrappedVTable0x24(mat);
break; break;
} }
case 'K': { case SDLK_K: {
MxMatrix mat; MxMatrix mat;
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
mat.SetIdentity(); mat.SetIdentity();
@ -939,10 +946,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
roi->WrappedVTable0x24(mat); roi->WrappedVTable0x24(mat);
break; break;
} }
case 'L': case SDLK_L:
g_changeLight = TRUE; g_changeLight = TRUE;
break; break;
case 'M': { case SDLK_M: {
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
MxMatrix mat; MxMatrix mat;
mat.SetIdentity(); mat.SetIdentity();
@ -950,12 +957,12 @@ MxLong LegoNavController::Notify(MxParam& p_param)
roi->WrappedVTable0x24(mat); roi->WrappedVTable0x24(mat);
break; break;
} }
case 'N': case SDLK_N:
if (VideoManager()) { if (VideoManager()) {
VideoManager()->SetRender3D(!VideoManager()->GetRender3D()); VideoManager()->SetRender3D(!VideoManager()->GetRender3D());
} }
break; break;
case 'P': case SDLK_P:
if (!g_resetPlants) { if (!g_resetPlants) {
PlantManager()->LoadWorldInfo(LegoOmni::e_act1); PlantManager()->LoadWorldInfo(LegoOmni::e_act1);
g_resetPlants = TRUE; g_resetPlants = TRUE;
@ -965,14 +972,14 @@ MxLong LegoNavController::Notify(MxParam& p_param)
g_resetPlants = FALSE; g_resetPlants = FALSE;
} }
break; break;
case 'S': case SDLK_S:
g_enableMusic = g_enableMusic == FALSE; g_enableMusic = g_enableMusic == FALSE;
BackgroundAudioManager()->Enable(g_enableMusic); BackgroundAudioManager()->Enable(g_enableMusic);
break; break;
case 'U': case SDLK_U:
m_unk0x60 = 1.0; m_unk0x60 = 1.0;
break; break;
case 'V': case SDLK_V:
if (g_nextAnimation > 0 && g_animationCalcStep == 0) { if (g_nextAnimation > 0 && g_animationCalcStep == 0) {
AnimationManager()->FUN_10061010(FALSE); AnimationManager()->FUN_10061010(FALSE);
} }
@ -984,7 +991,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
g_nextAnimation = 0; g_nextAnimation = 0;
g_animationCalcStep = 1; g_animationCalcStep = 1;
break; break;
case 'W': { case SDLK_W: {
MxMatrix mat; MxMatrix mat;
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI(); LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
const float* position = roi->GetWorldPosition(); const float* position = roi->GetWorldPosition();
@ -999,10 +1006,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
); );
break; break;
} }
case 'X': case SDLK_X:
RealtimeView::SetUserMaxLOD(3.6); RealtimeView::SetUserMaxLOD(3.6);
break; break;
case VK_MULTIPLY: { case SDLK_KP_MULTIPLY: {
MxU8 newActor = GameState()->GetActorId() + 1; MxU8 newActor = GameState()->GetActorId() + 1;
if (newActor > LegoActor::c_laura) { if (newActor > LegoActor::c_laura) {
@ -1012,10 +1019,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
GameState()->SetActorId(newActor); GameState()->SetActorId(newActor);
break; break;
} }
case VK_DIVIDE: case SDLK_KP_DIVIDE:
GameState()->SetActorId(LegoActor::c_brickster); GameState()->SetActorId(LegoActor::c_brickster);
break; break;
case VK_F11: case SDLK_F11:
if (GameState()->m_isDirty) { if (GameState()->m_isDirty) {
GameState()->m_isDirty = FALSE; GameState()->m_isDirty = FALSE;
} }
@ -1023,7 +1030,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
GameState()->m_isDirty = TRUE; GameState()->m_isDirty = TRUE;
} }
break; break;
case VK_OEM_MINUS: case SDLK_MINUS:
g_unk0x100f66bc = LegoAnimationManager::e_unk1; g_unk0x100f66bc = LegoAnimationManager::e_unk1;
break; break;
} }

View file

@ -288,12 +288,12 @@ void LegoInputManager::ClearWorld()
} }
// FUNCTION: LEGO1 0x1005c740 // FUNCTION: LEGO1 0x1005c740
void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key) void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, SDL_Keycode p_key)
{ {
LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key); LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key);
if (((!m_unk0x88) || ((m_unk0x335 && (param.GetNotification() == c_notificationButtonDown)))) || if (((!m_unk0x88) || ((m_unk0x335 && (param.GetNotification() == c_notificationButtonDown)))) ||
((m_unk0x336 && (p_key == VK_SPACE)))) { ((m_unk0x336 && (p_key == SDLK_SPACE)))) {
ProcessOneEvent(param); ProcessOneEvent(param);
} }
} }
@ -317,8 +317,8 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
MxBool processRoi; MxBool processRoi;
if (p_param.GetNotification() == c_notificationKeyPress) { if (p_param.GetNotification() == c_notificationKeyPress) {
if (!Lego()->IsPaused() || p_param.GetKey() == VK_PAUSE) { if (!Lego()->IsPaused() || p_param.GetKey() == SDLK_PAUSE) {
if (p_param.GetKey() == VK_SHIFT) { if (p_param.GetKey() == SDLK_LSHIFT || p_param.GetKey() == SDLK_RSHIFT) {
if (m_unk0x195) { if (m_unk0x195) {
m_unk0x80 = FALSE; m_unk0x80 = FALSE;
p_param.SetNotification(c_notificationDragEnd); p_param.SetNotification(c_notificationDragEnd);
@ -348,7 +348,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
if (m_unk0x335 != 0) { if (m_unk0x335 != 0) {
if (p_param.GetNotification() == c_notificationButtonDown) { if (p_param.GetNotification() == c_notificationButtonDown) {
LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, VK_SPACE); LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, SDLK_SPACE);
LegoNotifyListCursor cursor(m_keyboardNotifyList); LegoNotifyListCursor cursor(m_keyboardNotifyList);
MxCore* target; MxCore* target;

View file

@ -312,7 +312,7 @@ void LegoAnimPresenter::FUN_100695c0()
LegoU32 len = strlen(actorName); LegoU32 len = strlen(actorName);
strcpy(lodName, actorName); strcpy(lodName, actorName);
for (LegoChar* i = &lodName[len - 1]; isdigit(*i) || *i == '_'; i--) { for (LegoChar* i = &lodName[len - 1]; SDL_isdigit(*i) || *i == '_'; i--) {
*i = '\0'; *i = '\0';
} }

View file

@ -358,9 +358,9 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
// FUNCTION: LEGO1 0x10005920 // FUNCTION: LEGO1 0x10005920
MxLong GasStation::HandleKeyPress(MxS8 p_key) MxLong GasStation::HandleKeyPress(SDL_Keycode p_key)
{ {
if (p_key == VK_SPACE && g_unk0x100f0160 == 0 && m_unk0x106 != 0) { if (p_key == SDLK_SPACE && g_unk0x100f0160 == 0 && m_unk0x106 != 0) {
m_state->StopActions(); m_state->StopActions();
return 1; return 1;
} }

View file

@ -226,11 +226,11 @@ void Hospital::ReadyWorld()
} }
// FUNCTION: LEGO1 0x10074dd0 // FUNCTION: LEGO1 0x10074dd0
MxLong Hospital::HandleKeyPress(MxS8 p_key) MxLong Hospital::HandleKeyPress(SDL_Keycode p_key)
{ {
MxLong result = 0; MxLong result = 0;
if (p_key == VK_SPACE && g_unk0x100f7918 == 0) { if (p_key == SDLK_SPACE && g_unk0x100f7918 == 0) {
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
result = 1; result = 1;
} }

View file

@ -720,11 +720,11 @@ MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y)
} }
// FUNCTION: LEGO1 0x1006fda0 // FUNCTION: LEGO1 0x1006fda0
MxLong Infocenter::HandleKeyPress(MxS8 p_key) MxLong Infocenter::HandleKeyPress(SDL_Keycode p_key)
{ {
MxLong result = 0; MxLong result = 0;
if (p_key == VK_SPACE && m_worldStarted) { if (p_key == SDLK_SPACE && m_worldStarted) {
switch (m_infocenterState->GetUnknown0x74()) { switch (m_infocenterState->GetUnknown0x74()) {
case 0: case 0:
StopCutscene(); StopCutscene();

View file

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

View file

@ -169,27 +169,24 @@ MxLong RegistrationBook::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
// FUNCTION: LEGO1 0x100772d0 // FUNCTION: LEGO1 0x100772d0
MxLong RegistrationBook::HandleKeyPress(MxU8 p_key) MxLong RegistrationBook::HandleKeyPress(SDL_Keycode p_key)
{ {
MxS16 key; // keycode is case-insensitive
if (p_key >= 'a' && p_key <= 'z') { SDL_Keycode key = p_key;
key = p_key - ' ';
}
else {
key = p_key;
}
if ((key < 'A' || key > 'Z') && key != VK_BACK) { if ((key < SDLK_A || key > SDLK_Z) && key != SDLK_BACKSPACE) {
if (key == VK_SPACE) { if (key == SDLK_SPACE) {
DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav);
BackgroundAudioManager()->RaiseVolume(); BackgroundAudioManager()->RaiseVolume();
} }
} }
else if (key != VK_BACK && m_unk0x280.m_cursorPos < 7) { else if (key != SDLK_BACKSPACE && m_unk0x280.m_cursorPos < 7) {
m_name[0][m_unk0x280.m_cursorPos] = m_alphabet[key - 'A']->Clone(); m_name[0][m_unk0x280.m_cursorPos] = m_alphabet[key - SDLK_A]->Clone();
if (m_name[0][m_unk0x280.m_cursorPos] != NULL) { if (m_name[0][m_unk0x280.m_cursorPos] != NULL) {
m_alphabet[key - 'A']->GetAction()->SetUnknown24(m_alphabet[key - 'A']->GetAction()->GetUnknown24() + 1); m_alphabet[key - SDLK_A]->GetAction()->SetUnknown24(
m_alphabet[key - SDLK_A]->GetAction()->GetUnknown24() + 1
);
m_name[0][m_unk0x280.m_cursorPos]->Enable(TRUE); m_name[0][m_unk0x280.m_cursorPos]->Enable(TRUE);
m_name[0][m_unk0x280.m_cursorPos]->SetTickleState(MxPresenter::e_repeating); m_name[0][m_unk0x280.m_cursorPos]->SetTickleState(MxPresenter::e_repeating);
m_name[0][m_unk0x280.m_cursorPos]->SetPosition(m_unk0x280.m_cursorPos * 23 + 343, 121); m_name[0][m_unk0x280.m_cursorPos]->SetPosition(m_unk0x280.m_cursorPos * 23 + 343, 121);
@ -198,12 +195,12 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key)
m_checkmark[0]->Enable(TRUE); m_checkmark[0]->Enable(TRUE);
} }
m_unk0x280.m_letters[m_unk0x280.m_cursorPos] = key - 'A'; m_unk0x280.m_letters[m_unk0x280.m_cursorPos] = key - SDLK_A;
m_unk0x280.m_cursorPos++; m_unk0x280.m_cursorPos++;
} }
} }
else { else {
if (key == VK_BACK && m_unk0x280.m_cursorPos > 0) { if (key == SDLK_BACKSPACE && m_unk0x280.m_cursorPos > 0) {
m_unk0x280.m_cursorPos--; m_unk0x280.m_cursorPos--;
m_name[0][m_unk0x280.m_cursorPos]->Enable(FALSE); m_name[0][m_unk0x280.m_cursorPos]->Enable(FALSE);

View file

@ -96,7 +96,7 @@ MxLong Score::Notify(MxParam& p_param)
ret = FUN_10001510((MxEndActionNotificationParam&) p_param); ret = FUN_10001510((MxEndActionNotificationParam&) p_param);
break; break;
case c_notificationKeyPress: case c_notificationKeyPress:
if (((LegoEventNotificationParam&) p_param).GetKey() == VK_SPACE) { if (((LegoEventNotificationParam&) p_param).GetKey() == SDLK_SPACE) {
DeleteScript(); DeleteScript();
} }
ret = 1; ret = 1;