mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-04-24 13:24:00 -04:00
Use SDL_KeyCode in LEGO1.dll (#51)
* 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:
parent
34bfa1b345
commit
b97aea42d2
17 changed files with 116 additions and 97 deletions
ISLE
LEGO1/lego/legoomni
|
@ -140,6 +140,10 @@ IsleApp::~IsleApp()
|
|||
if (m_savePath) {
|
||||
delete[] m_savePath;
|
||||
}
|
||||
|
||||
if (m_mediaPath) {
|
||||
delete[] m_mediaPath;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: ISLE 0x401260
|
||||
|
@ -175,18 +179,16 @@ void IsleApp::Close()
|
|||
MxS32 IsleApp::SetupLegoOmni()
|
||||
{
|
||||
MxS32 result = FALSE;
|
||||
char mediaPath[256];
|
||||
GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath));
|
||||
|
||||
#ifdef COMPAT_MODE
|
||||
MxS32 failure;
|
||||
{
|
||||
MxOmniCreateParam param(mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags());
|
||||
MxOmniCreateParam param(m_mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags());
|
||||
failure = Lego()->Create(param) == FAILURE;
|
||||
}
|
||||
#else
|
||||
MxS32 failure =
|
||||
Lego()->Create(MxOmniCreateParam(mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE;
|
||||
Lego()->Create(MxOmniCreateParam(m_mediaPath, m_windowHandle, m_videoParam, MxOmniCreateFlags())) == FAILURE;
|
||||
#endif
|
||||
|
||||
if (!failure) {
|
||||
|
@ -525,11 +527,15 @@ void IsleApp::LoadConfig()
|
|||
iniConfig = new char[strlen(m_iniPath) + 1];
|
||||
strcpy(iniConfig, m_iniPath);
|
||||
}
|
||||
else {
|
||||
else if (prefPath) {
|
||||
iniConfig = new char[strlen(prefPath) + strlen("isle.ini") + 1]();
|
||||
strcat(iniConfig, prefPath);
|
||||
strcat(iniConfig, "isle.ini");
|
||||
}
|
||||
else {
|
||||
iniConfig = new char[strlen("isle.ini") + 1];
|
||||
strcpy(iniConfig, "isle.ini");
|
||||
}
|
||||
SDL_Log("Reading configuration from \"%s\"", iniConfig);
|
||||
|
||||
dictionary* dict = iniparser_load(iniConfig);
|
||||
|
@ -544,6 +550,10 @@ void IsleApp::LoadConfig()
|
|||
strcpy(m_cdPath, 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_fullScreen = iniparser_getboolean(dict, "isle:Full Screen", m_fullScreen);
|
||||
m_wideViewAngle = iniparser_getboolean(dict, "isle:Wide View Angle", m_wideViewAngle);
|
||||
|
|
|
@ -78,6 +78,7 @@ private:
|
|||
SDL_Cursor* m_cursorBusy; // 0x80
|
||||
SDL_Cursor* m_cursorNo; // 0x84
|
||||
SDL_Cursor* m_cursorCurrent; // 0x88
|
||||
char* m_mediaPath;
|
||||
|
||||
char* m_iniPath;
|
||||
};
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "legoworld.h"
|
||||
#include "radio.h"
|
||||
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
|
||||
class MxStillPresenter;
|
||||
|
||||
// VTABLE: LEGO1 0x100d46e0
|
||||
|
@ -95,7 +97,7 @@ private:
|
|||
inline void StopAction(GarageScript::Script p_objectId);
|
||||
|
||||
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
|
||||
MxLong HandleKeyPress(MxS8 p_key);
|
||||
MxLong HandleKeyPress(SDL_Keycode p_key);
|
||||
MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param);
|
||||
|
||||
MxS16 m_currentActorId; // 0xf8
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
// Hospital::`scalar deleting destructor'
|
||||
|
||||
private:
|
||||
MxLong HandleKeyPress(MxS8 p_key);
|
||||
MxLong HandleKeyPress(SDL_Keycode p_key);
|
||||
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
|
||||
MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param);
|
||||
MxBool HandleControl(LegoControlManagerNotificationParam& p_param);
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
private:
|
||||
void InitializeBitmaps();
|
||||
|
||||
MxLong HandleKeyPress(MxS8 p_key);
|
||||
MxLong HandleKeyPress(SDL_Keycode p_key);
|
||||
MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y);
|
||||
MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y);
|
||||
MxU8 HandleControl(LegoControlManagerNotificationParam& p_param);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "mxnotificationparam.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
class LegoROI;
|
||||
|
@ -35,7 +36,7 @@ public:
|
|||
MxU8 p_modifier,
|
||||
MxS32 p_x,
|
||||
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)
|
||||
{
|
||||
|
@ -43,7 +44,7 @@ public:
|
|||
|
||||
LegoROI* GetROI() { return m_roi; }
|
||||
MxU8 GetModifier() { return m_modifier; }
|
||||
MxU8 GetKey() const { return m_key; }
|
||||
SDL_Keycode GetKey() const { return m_key; }
|
||||
|
||||
// FUNCTION: LEGO1 0x10012190
|
||||
// FUNCTION: BETA10 0x10024210
|
||||
|
@ -59,7 +60,7 @@ public:
|
|||
void SetModifier(MxU8 p_modifier) { m_modifier = p_modifier; }
|
||||
|
||||
// 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
|
||||
void SetX(MxS32 p_x) { m_x = p_x; }
|
||||
|
@ -68,11 +69,11 @@ public:
|
|||
void SetY(MxS32 p_y) { m_y = p_y; }
|
||||
|
||||
protected:
|
||||
MxU8 m_modifier; // 0x0c
|
||||
MxS32 m_x; // 0x10
|
||||
MxS32 m_y; // 0x14
|
||||
MxU8 m_key; // 0x18
|
||||
LegoROI* m_roi; // 0x1c
|
||||
MxU8 m_modifier; // 0x0c
|
||||
MxS32 m_x; // 0x10
|
||||
MxS32 m_y; // 0x14
|
||||
SDL_Keycode m_key; // 0x18
|
||||
LegoROI* m_roi; // 0x1c
|
||||
};
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10028770
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <SDL3/SDL_keyboard.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
@ -87,7 +88,7 @@ public:
|
|||
LegoInputManager();
|
||||
~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 UnRegister(MxCore*);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ private:
|
|||
LPDIRECTDRAWSURFACE m_checkboxNormal; // 0x2cc
|
||||
|
||||
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
|
||||
MxLong HandleKeyPress(MxU8 p_key);
|
||||
MxLong HandleKeyPress(SDL_Keycode p_key);
|
||||
MxLong HandleControl(LegoControlManagerNotificationParam& p_param);
|
||||
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
|
||||
void FUN_100775c0(MxS16 p_playerIndex);
|
||||
|
|
|
@ -109,10 +109,17 @@ MxU32 g_switchAct = FALSE;
|
|||
LegoAnimationManager::PlayMode g_unk0x100f66bc = LegoAnimationManager::e_unk2;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f66c0
|
||||
char g_debugPassword[] = "OGEL";
|
||||
SDL_Keycode g_debugPassword[] = {
|
||||
// "OGEL"
|
||||
SDLK_O,
|
||||
SDLK_G,
|
||||
SDLK_E,
|
||||
SDLK_L,
|
||||
0,
|
||||
};
|
||||
|
||||
// GLOBAL: LEGO1 0x100f66c8
|
||||
char* g_currentInput = g_debugPassword;
|
||||
SDL_Keycode* g_currentInput = g_debugPassword;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f66cc
|
||||
MxS32 g_nextCharacter = -1;
|
||||
|
@ -639,10 +646,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
{
|
||||
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationKeyPress) {
|
||||
m_unk0x5d = TRUE;
|
||||
MxU8 key = ((LegoEventNotificationParam&) p_param).GetKey();
|
||||
SDL_Keycode key = ((LegoEventNotificationParam&) p_param).GetKey();
|
||||
|
||||
switch (key) {
|
||||
case VK_PAUSE: // Pause game
|
||||
case SDLK_PAUSE: // Pause game
|
||||
if (Lego()->IsPaused()) {
|
||||
Lego()->Resume();
|
||||
}
|
||||
|
@ -650,7 +657,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
Lego()->Pause();
|
||||
}
|
||||
break;
|
||||
case VK_ESCAPE: { // Return to infocenter
|
||||
case SDLK_ESCAPE: { // Return to infocenter
|
||||
LegoWorld* currentWorld = CurrentWorld();
|
||||
if (currentWorld != NULL) {
|
||||
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
|
||||
|
@ -664,10 +671,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case VK_SPACE: // Interrupt/end animations or free navigation
|
||||
case SDLK_SPACE: // Interrupt/end animations or free navigation
|
||||
AnimationManager()->FUN_10061010(TRUE);
|
||||
break;
|
||||
case 'Z': { // Make nearby plants "dance"
|
||||
case SDLK_Z: { // Make nearby plants "dance"
|
||||
LegoOmni* omni = Lego();
|
||||
|
||||
if (omni->GetCurrentWorld() != NULL && omni->GetCurrentWorld()->GetWorldId() == LegoOmni::e_act1) {
|
||||
|
@ -701,15 +708,15 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case VK_ADD:
|
||||
case VK_SUBTRACT: { // Cycles through characters and puts them in front of you
|
||||
case SDLK_KP_PLUS:
|
||||
case SDLK_KP_MINUS: { // Cycles through characters and puts them in front of you
|
||||
if (g_nextCharacter == -1) {
|
||||
g_nextCharacter = 0;
|
||||
}
|
||||
else {
|
||||
CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_nextCharacter));
|
||||
|
||||
if (key == VK_ADD) {
|
||||
if (key == SDLK_KP_PLUS) {
|
||||
g_nextCharacter++;
|
||||
if (g_nextCharacter >= CharacterManager()->GetNumActors()) {
|
||||
g_nextCharacter = 0;
|
||||
|
@ -736,7 +743,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case VK_F12: { // Saves the game
|
||||
case SDLK_F12: { // Saves the game
|
||||
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
|
||||
if (state && state->HasRegistered()) {
|
||||
GameState()->Save(0);
|
||||
|
@ -748,7 +755,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
if (!*g_currentInput) {
|
||||
// password "protected" debug shortcuts
|
||||
switch (((LegoEventNotificationParam&) p_param).GetKey()) {
|
||||
case VK_TAB:
|
||||
case SDLK_TAB:
|
||||
VideoManager()->ToggleFPS(g_fpsEnabled);
|
||||
if (g_fpsEnabled) {
|
||||
g_fpsEnabled = FALSE;
|
||||
|
@ -759,16 +766,16 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
default:
|
||||
m_unk0x5d = FALSE;
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case SDLK_0:
|
||||
case SDLK_1:
|
||||
case SDLK_2:
|
||||
case SDLK_3:
|
||||
case SDLK_4:
|
||||
case SDLK_5:
|
||||
case SDLK_6:
|
||||
case SDLK_7:
|
||||
case SDLK_8:
|
||||
case SDLK_9:
|
||||
if (g_changeLight && key <= '1') {
|
||||
LegoROI* roi = VideoManager()->GetViewROI();
|
||||
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()) {
|
||||
case LegoGameState::e_act1:
|
||||
GameState()->m_currentArea = LegoGameState::e_isle;
|
||||
|
@ -835,17 +842,17 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
}
|
||||
|
||||
switch (key) {
|
||||
case '1':
|
||||
case SDLK_1:
|
||||
GameState()->SetCurrentAct(LegoGameState::e_act1);
|
||||
GameState()->SwitchArea(LegoGameState::e_isle);
|
||||
break;
|
||||
case '2':
|
||||
case SDLK_2:
|
||||
GameState()->SwitchArea(LegoGameState::e_act2main);
|
||||
break;
|
||||
case '3':
|
||||
case SDLK_3:
|
||||
GameState()->SwitchArea(LegoGameState::e_act3script);
|
||||
break;
|
||||
case '4': {
|
||||
case SDLK_4: {
|
||||
Act3State* act3State = (Act3State*) GameState()->GetState("Act3State");
|
||||
if (act3State == NULL) {
|
||||
act3State = new Act3State();
|
||||
|
@ -859,7 +866,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
GameState()->SwitchArea(LegoGameState::e_infomain);
|
||||
break;
|
||||
}
|
||||
case '5': {
|
||||
case SDLK_5: {
|
||||
Act3State* act3State = (Act3State*) GameState()->GetState("Act3State");
|
||||
if (act3State == NULL) {
|
||||
act3State = new Act3State();
|
||||
|
@ -884,7 +891,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
LegoOmni::GetInstance()->Start(&action);
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
case SDLK_A:
|
||||
if (g_animationCalcStep == 1) {
|
||||
Lego()->m_unk0x13c = TRUE;
|
||||
AnimationManager()->FUN_10060570(TRUE);
|
||||
|
@ -900,22 +907,22 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
case SDLK_C:
|
||||
g_locationCalcStep = 1;
|
||||
break;
|
||||
case 'D':
|
||||
case SDLK_D:
|
||||
m_unk0x60 = -1.0;
|
||||
break;
|
||||
case 'F':
|
||||
case SDLK_F:
|
||||
RealtimeView::SetUserMaxLOD(0.0);
|
||||
break;
|
||||
case 'G':
|
||||
case SDLK_G:
|
||||
g_switchAct = TRUE;
|
||||
break;
|
||||
case 'H':
|
||||
case SDLK_H:
|
||||
RealtimeView::SetUserMaxLOD(5.0);
|
||||
break;
|
||||
case 'I': {
|
||||
case SDLK_I: {
|
||||
LegoROI* roi = VideoManager()->GetViewROI();
|
||||
MxMatrix mat;
|
||||
mat.SetIdentity();
|
||||
|
@ -923,7 +930,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
roi->WrappedVTable0x24(mat);
|
||||
break;
|
||||
}
|
||||
case 'J': {
|
||||
case SDLK_J: {
|
||||
LegoROI* roi = VideoManager()->GetViewROI();
|
||||
MxMatrix mat;
|
||||
mat.SetIdentity();
|
||||
|
@ -931,7 +938,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
roi->WrappedVTable0x24(mat);
|
||||
break;
|
||||
}
|
||||
case 'K': {
|
||||
case SDLK_K: {
|
||||
MxMatrix mat;
|
||||
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
|
||||
mat.SetIdentity();
|
||||
|
@ -939,10 +946,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
roi->WrappedVTable0x24(mat);
|
||||
break;
|
||||
}
|
||||
case 'L':
|
||||
case SDLK_L:
|
||||
g_changeLight = TRUE;
|
||||
break;
|
||||
case 'M': {
|
||||
case SDLK_M: {
|
||||
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
|
||||
MxMatrix mat;
|
||||
mat.SetIdentity();
|
||||
|
@ -950,12 +957,12 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
roi->WrappedVTable0x24(mat);
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
case SDLK_N:
|
||||
if (VideoManager()) {
|
||||
VideoManager()->SetRender3D(!VideoManager()->GetRender3D());
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
case SDLK_P:
|
||||
if (!g_resetPlants) {
|
||||
PlantManager()->LoadWorldInfo(LegoOmni::e_act1);
|
||||
g_resetPlants = TRUE;
|
||||
|
@ -965,14 +972,14 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
g_resetPlants = FALSE;
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
case SDLK_S:
|
||||
g_enableMusic = g_enableMusic == FALSE;
|
||||
BackgroundAudioManager()->Enable(g_enableMusic);
|
||||
break;
|
||||
case 'U':
|
||||
case SDLK_U:
|
||||
m_unk0x60 = 1.0;
|
||||
break;
|
||||
case 'V':
|
||||
case SDLK_V:
|
||||
if (g_nextAnimation > 0 && g_animationCalcStep == 0) {
|
||||
AnimationManager()->FUN_10061010(FALSE);
|
||||
}
|
||||
|
@ -984,7 +991,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
g_nextAnimation = 0;
|
||||
g_animationCalcStep = 1;
|
||||
break;
|
||||
case 'W': {
|
||||
case SDLK_W: {
|
||||
MxMatrix mat;
|
||||
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
|
||||
const float* position = roi->GetWorldPosition();
|
||||
|
@ -999,10 +1006,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
);
|
||||
break;
|
||||
}
|
||||
case 'X':
|
||||
case SDLK_X:
|
||||
RealtimeView::SetUserMaxLOD(3.6);
|
||||
break;
|
||||
case VK_MULTIPLY: {
|
||||
case SDLK_KP_MULTIPLY: {
|
||||
MxU8 newActor = GameState()->GetActorId() + 1;
|
||||
|
||||
if (newActor > LegoActor::c_laura) {
|
||||
|
@ -1012,10 +1019,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
GameState()->SetActorId(newActor);
|
||||
break;
|
||||
}
|
||||
case VK_DIVIDE:
|
||||
case SDLK_KP_DIVIDE:
|
||||
GameState()->SetActorId(LegoActor::c_brickster);
|
||||
break;
|
||||
case VK_F11:
|
||||
case SDLK_F11:
|
||||
if (GameState()->m_isDirty) {
|
||||
GameState()->m_isDirty = FALSE;
|
||||
}
|
||||
|
@ -1023,7 +1030,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
|||
GameState()->m_isDirty = TRUE;
|
||||
}
|
||||
break;
|
||||
case VK_OEM_MINUS:
|
||||
case SDLK_MINUS:
|
||||
g_unk0x100f66bc = LegoAnimationManager::e_unk1;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -288,12 +288,12 @@ void LegoInputManager::ClearWorld()
|
|||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if (((!m_unk0x88) || ((m_unk0x335 && (param.GetNotification() == c_notificationButtonDown)))) ||
|
||||
((m_unk0x336 && (p_key == VK_SPACE)))) {
|
||||
((m_unk0x336 && (p_key == SDLK_SPACE)))) {
|
||||
ProcessOneEvent(param);
|
||||
}
|
||||
}
|
||||
|
@ -317,8 +317,8 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
|
|||
MxBool processRoi;
|
||||
|
||||
if (p_param.GetNotification() == c_notificationKeyPress) {
|
||||
if (!Lego()->IsPaused() || p_param.GetKey() == VK_PAUSE) {
|
||||
if (p_param.GetKey() == VK_SHIFT) {
|
||||
if (!Lego()->IsPaused() || p_param.GetKey() == SDLK_PAUSE) {
|
||||
if (p_param.GetKey() == SDLK_LSHIFT || p_param.GetKey() == SDLK_RSHIFT) {
|
||||
if (m_unk0x195) {
|
||||
m_unk0x80 = FALSE;
|
||||
p_param.SetNotification(c_notificationDragEnd);
|
||||
|
@ -348,7 +348,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
|
|||
|
||||
if (m_unk0x335 != 0) {
|
||||
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);
|
||||
MxCore* target;
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ void LegoAnimPresenter::FUN_100695c0()
|
|||
LegoU32 len = strlen(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';
|
||||
}
|
||||
|
||||
|
|
|
@ -358,9 +358,9 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
|
|||
}
|
||||
|
||||
// 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();
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -226,11 +226,11 @@ void Hospital::ReadyWorld()
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10074dd0
|
||||
MxLong Hospital::HandleKeyPress(MxS8 p_key)
|
||||
MxLong Hospital::HandleKeyPress(SDL_Keycode p_key)
|
||||
{
|
||||
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);
|
||||
result = 1;
|
||||
}
|
||||
|
|
|
@ -720,11 +720,11 @@ MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y)
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1006fda0
|
||||
MxLong Infocenter::HandleKeyPress(MxS8 p_key)
|
||||
MxLong Infocenter::HandleKeyPress(SDL_Keycode p_key)
|
||||
{
|
||||
MxLong result = 0;
|
||||
|
||||
if (p_key == VK_SPACE && m_worldStarted) {
|
||||
if (p_key == SDLK_SPACE && m_worldStarted) {
|
||||
switch (m_infocenterState->GetUnknown0x74()) {
|
||||
case 0:
|
||||
StopCutscene();
|
||||
|
|
|
@ -167,7 +167,7 @@ MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param)
|
|||
{
|
||||
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);
|
||||
m_policeState->SetUnknown0x0c(0);
|
||||
return 1;
|
||||
|
|
|
@ -169,27 +169,24 @@ MxLong RegistrationBook::HandleEndAction(MxEndActionNotificationParam& p_param)
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100772d0
|
||||
MxLong RegistrationBook::HandleKeyPress(MxU8 p_key)
|
||||
MxLong RegistrationBook::HandleKeyPress(SDL_Keycode p_key)
|
||||
{
|
||||
MxS16 key;
|
||||
if (p_key >= 'a' && p_key <= 'z') {
|
||||
key = p_key - ' ';
|
||||
}
|
||||
else {
|
||||
key = p_key;
|
||||
}
|
||||
// keycode is case-insensitive
|
||||
SDL_Keycode key = p_key;
|
||||
|
||||
if ((key < 'A' || key > 'Z') && key != VK_BACK) {
|
||||
if (key == VK_SPACE) {
|
||||
if ((key < SDLK_A || key > SDLK_Z) && key != SDLK_BACKSPACE) {
|
||||
if (key == SDLK_SPACE) {
|
||||
DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav);
|
||||
BackgroundAudioManager()->RaiseVolume();
|
||||
}
|
||||
}
|
||||
else if (key != VK_BACK && m_unk0x280.m_cursorPos < 7) {
|
||||
m_name[0][m_unk0x280.m_cursorPos] = m_alphabet[key - 'A']->Clone();
|
||||
else if (key != SDLK_BACKSPACE && m_unk0x280.m_cursorPos < 7) {
|
||||
m_name[0][m_unk0x280.m_cursorPos] = m_alphabet[key - SDLK_A]->Clone();
|
||||
|
||||
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]->SetTickleState(MxPresenter::e_repeating);
|
||||
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_unk0x280.m_letters[m_unk0x280.m_cursorPos] = key - 'A';
|
||||
m_unk0x280.m_letters[m_unk0x280.m_cursorPos] = key - SDLK_A;
|
||||
m_unk0x280.m_cursorPos++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (key == VK_BACK && m_unk0x280.m_cursorPos > 0) {
|
||||
if (key == SDLK_BACKSPACE && m_unk0x280.m_cursorPos > 0) {
|
||||
m_unk0x280.m_cursorPos--;
|
||||
|
||||
m_name[0][m_unk0x280.m_cursorPos]->Enable(FALSE);
|
||||
|
|
|
@ -96,7 +96,7 @@ MxLong Score::Notify(MxParam& p_param)
|
|||
ret = FUN_10001510((MxEndActionNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationKeyPress:
|
||||
if (((LegoEventNotificationParam&) p_param).GetKey() == VK_SPACE) {
|
||||
if (((LegoEventNotificationParam&) p_param).GetKey() == SDLK_SPACE) {
|
||||
DeleteScript();
|
||||
}
|
||||
ret = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue