From a7f1d80a06304f089a5612fcbda3acf9dda22554 Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 13 Feb 2020 18:14:30 +0000 Subject: [PATCH 1/3] Fix compilation with modern Visual Studio --- src/Input.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Input.cpp b/src/Input.cpp index 91881e27..65eb2e6e 100644 --- a/src/Input.cpp +++ b/src/Input.cpp @@ -87,7 +87,11 @@ BOOL FindAndOpenDirectInputDevice(HWND hWnd) directinput_objects.lpDI->AddRef(); +#if defined(_MSC_VER) && _MSC_VER >= 1500 + lpDI->EnumDevices(DI8DEVTYPE_JOYSTICK, EnumDevices_Callback, &directinput_objects, DIEDFL_ATTACHEDONLY); +#else lpDI->EnumDevices(DIDEVTYPE_JOYSTICK, EnumDevices_Callback, &directinput_objects, DIEDFL_ATTACHEDONLY); +#endif if (directinput_objects.lpDI != NULL) { From ed97e374f85b78243fa711c3b695a49b284eb66a Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 20 Feb 2020 13:11:39 +0000 Subject: [PATCH 2/3] Fix screen centering in wide/tallscreen Previously, it would misbehave if the screen is slightly wider than the level (because it wasn't accounting for the fact that the game hides half of the border tiles) --- src/Frame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Frame.cpp b/src/Frame.cpp index 7d8b5339..c14d66e0 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -37,7 +37,7 @@ void MoveFrame3(void) else { // Widescreen/tallscreen-safe behaviour - if (map_w * 16 < WINDOW_WIDTH) + if ((map_w - 1) * 16 < WINDOW_WIDTH) { gFrame.x = -(((WINDOW_WIDTH - ((map_w - 1) * 16)) * 0x200) / 2); } @@ -52,7 +52,7 @@ void MoveFrame3(void) gFrame.x = (((map_w - 1) * 16) - WINDOW_WIDTH) * 0x200; } - if (map_l * 16 < WINDOW_HEIGHT) + if ((map_l - 1) * 16 < WINDOW_HEIGHT) { gFrame.y = -(((WINDOW_HEIGHT - ((map_l - 1) * 16)) * 0x200) / 2); } From e4a20a983e43757948b339adf110fc9e843009dc Mon Sep 17 00:00:00 2001 From: Clownacy Date: Thu, 20 Feb 2020 15:59:04 +0000 Subject: [PATCH 3/3] Similar fixes --- src/Frame.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Frame.cpp b/src/Frame.cpp index c14d66e0..cafd1927 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -145,7 +145,7 @@ void SetFramePosition(int fx, int fy) else { // Widescreen/tallscreen-safe behaviour - if (map_w * 16 < WINDOW_WIDTH) + if ((map_w - 1) * 16 < WINDOW_WIDTH) { gFrame.x = -(((WINDOW_WIDTH - ((map_w - 1) * 16)) * 0x200) / 2); } @@ -158,7 +158,7 @@ void SetFramePosition(int fx, int fy) gFrame.x = (((map_w - 1) * 16) - WINDOW_WIDTH) * 0x200; } - if (map_l * 16 < WINDOW_HEIGHT) + if ((map_l - 1) * 16 < WINDOW_HEIGHT) { gFrame.y = -(((WINDOW_HEIGHT - ((map_l - 1) * 16)) * 0x200) / 2); } @@ -219,7 +219,7 @@ void SetFrameMyChar(void) else { // Widescreen/tallscreen-safe behaviour - if (map_w * 16 < WINDOW_WIDTH) + if ((map_w - 1) * 16 < WINDOW_WIDTH) { gFrame.x = -(((WINDOW_WIDTH - ((map_w - 1) * 16)) * 0x200) / 2); } @@ -232,7 +232,7 @@ void SetFrameMyChar(void) gFrame.x = (((map_w - 1) * 16) - WINDOW_WIDTH) * 0x200; } - if (map_l * 16 < WINDOW_HEIGHT) + if ((map_l - 1) * 16 < WINDOW_HEIGHT) { gFrame.y = -(((WINDOW_HEIGHT - ((map_l - 1) * 16)) * 0x200) / 2); }