From c08b750804b21a802626e7822e1ee682dda1c5c9 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Wed, 14 Mar 2018 17:57:53 +0100 Subject: [PATCH 01/11] Fix regression where the fire was no longer propagated It's better to keep the map as it without changing this behaviour. It's just protected with the map editor; then everything is now working again. It fixes issue https://github.com/blupi-games/planetblupi/issues/54 --- src/decor.cxx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/decor.cxx b/src/decor.cxx index ca2af57..2090904 100644 --- a/src/decor.cxx +++ b/src/decor.cxx @@ -382,11 +382,6 @@ CDecor::PutFloor (Point cel, Sint32 channel, Sint32 icon) m_decor[cel.x / 2][cel.y / 2].floorChannel = channel; m_decor[cel.x / 2][cel.y / 2].floorIcon = icon; - if ( - !g_restoreBugs && m_decor[cel.x / 2][cel.y / 2].fire && - !this->CanBurn (cel)) - m_decor[cel.x / 2][cel.y / 2].fire = 0; - m_bGroundRedraw = true; //? SubDrapeau(cel); // on pourra de nouveau planter un drapeau @@ -408,11 +403,6 @@ CDecor::PutObject (Point cel, Sint32 channel, Sint32 icon) m_decor[cel.x / 2][cel.y / 2].objectChannel = channel; m_decor[cel.x / 2][cel.y / 2].objectIcon = icon; - if ( - !g_restoreBugs && m_decor[cel.x / 2][cel.y / 2].fire && - !this->CanBurn (cel)) - m_decor[cel.x / 2][cel.y / 2].fire = 0; - SubDrapeau (cel); // on pourra de nouveau planter un drapeau return true; From 5db7fe91f6334926622b881c3b90e8bd0e1b0fe4 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Wed, 14 Mar 2018 17:59:43 +0100 Subject: [PATCH 02/11] Bump patch version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a24fdc5..ab5e09f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ link_directories (${CMAKE_INSTALL_PREFIX}/lib) project (planetblupi) set (PB_VERSION_MAJOR 1) set (PB_VERSION_MINOR 12) -set (PB_VERSION_PATCH 3) +set (PB_VERSION_PATCH 4) set (PB_VERSION_EXTRA "") set (PB_PRODUCT_NAME "Planet Blupi") set (PB_PACKAGE_NAME "planetblupi") From 537c0771469d9ecb7660e318bbac52cef9f7da70 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Fri, 16 Mar 2018 11:46:23 +0100 Subject: [PATCH 03/11] Use a define for the max private missions number --- src/def.h | 2 ++ src/event.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/def.h b/src/def.h index de9f04c..d8df274 100644 --- a/src/def.h +++ b/src/def.h @@ -86,6 +86,8 @@ #define CHBIGNUM 14 #define CHMASK2 15 +#define MAX_PRIVATE_MISSIONS 20 + #define FOGHIDE 4 // clang-format on diff --git a/src/event.cxx b/src/event.cxx index 8ad1a02..954aa9d 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -5818,7 +5818,7 @@ CEvent::TreatEventBase (const SDL_Event & event) m_pDecor->SetSuper (false); if (m_bPrivate) { - if (m_private < 20 - 1) + if (m_private < MAX_PRIVATE_MISSIONS - 1) { m_private++; if (ChangePhase (EV_PHASE_INFO)) From ef362c8b37618176edc7581b9ff743188693c18d Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Fri, 16 Mar 2018 11:46:31 +0100 Subject: [PATCH 04/11] Fix the last win screen with private missions It returns to the main screen when the last mission is finished. It fixes issue #56. --- src/event.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/event.cxx b/src/event.cxx index 954aa9d..e36439a 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -3450,9 +3450,10 @@ CEvent::ChangePhase (Uint32 phase) m_phaseAfterMovie = EV_PHASE_WIN; if ( - !m_bPrivate && - m_pDecor->FileExist (GetPhysicalWorld (), false, world, time, total) && - !m_pDecor->FileExist (GetPhysicalWorld () + 1, false, world, time, total)) + (m_bPrivate && GetPhysicalWorld () - 200 == MAX_PRIVATE_MISSIONS - 1) || + (m_pDecor->FileExist (GetPhysicalWorld (), false, world, time, total) && + !m_pDecor->FileExist ( + GetPhysicalWorld () + 1, false, world, time, total))) m_phaseAfterMovie = EV_PHASE_LASTWIN; } From e2ac1d96c537f8697237b36ee23f4435b4d81e71 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Fri, 16 Mar 2018 11:49:23 +0100 Subject: [PATCH 05/11] Does not check for world files with private missions --- src/event.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/event.cxx b/src/event.cxx index e36439a..1a36d28 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -3451,7 +3451,8 @@ CEvent::ChangePhase (Uint32 phase) if ( (m_bPrivate && GetPhysicalWorld () - 200 == MAX_PRIVATE_MISSIONS - 1) || - (m_pDecor->FileExist (GetPhysicalWorld (), false, world, time, total) && + (!m_bPrivate && + m_pDecor->FileExist (GetPhysicalWorld (), false, world, time, total) && !m_pDecor->FileExist ( GetPhysicalWorld () + 1, false, world, time, total))) m_phaseAfterMovie = EV_PHASE_LASTWIN; From 8ffec6c29fb428e11482f9ee11468a1d1c8ba027 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Mon, 28 May 2018 18:19:35 +0200 Subject: [PATCH 06/11] Fix right click on the first tree It fixes the issue #58. --- src/decblupi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/decblupi.cxx b/src/decblupi.cxx index d5261b8..e236eba 100644 --- a/src/decblupi.cxx +++ b/src/decblupi.cxx @@ -3750,7 +3750,7 @@ CDecor::GetDefButton (Point cel) if (channel == CHOBJECT) { - if (icon >= 7 && icon <= 11) + if (icon >= 6 && icon <= 11) button = BUTTON_ABAT; if (icon >= 37 && icon <= 43) button = BUTTON_ROC; From 340e7becacc2179a4a33b31aa94888b06073b500 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 29 May 2018 17:38:51 +0200 Subject: [PATCH 07/11] Center the window on the right display with zoom switching --- src/event.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/event.cxx b/src/event.cxx index 1a36d28..f2c9e09 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1725,8 +1725,11 @@ CEvent::SetWindowSize (Uint8 prevScale, Uint8 newScale) SDL_GetMouseState (&x, &y); SDL_SetWindowSize (g_window, LXIMAGE * newScale, LYIMAGE * newScale); + + int displayIndex = SDL_GetWindowDisplayIndex (g_window); SDL_SetWindowPosition ( - g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); + g_window, SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex), + SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex)); m_pPixmap->LoadCursors (newScale); m_pPixmap->ReloadTargetTextures (); From 8c2bcf62445c80b611a391d789456ce93b8cacd5 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 29 May 2018 17:41:31 +0200 Subject: [PATCH 08/11] Ignore the window position when creating --- src/blupi.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blupi.cxx b/src/blupi.cxx index b4dc147..30ec8e9 100644 --- a/src/blupi.cxx +++ b/src/blupi.cxx @@ -723,7 +723,7 @@ DoInit (int argc, char * argv[], bool & exit) // Create a window. g_window = SDL_CreateWindow ( - gettext ("Planet Blupi"), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, + gettext ("Planet Blupi"), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, LXIMAGE, LYIMAGE, 0); if (!g_window) From 96cbf541676d83733bca47be492e9e4b3624f211 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 29 May 2018 17:42:05 +0200 Subject: [PATCH 09/11] Do not move the window when switching with fullscreen mode --- src/event.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/event.cxx b/src/event.cxx index f2c9e09..50feb1d 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1669,8 +1669,6 @@ CEvent::SetFullScreen (bool bFullScreen) SDL_SetWindowFullscreen (g_window, bFullScreen ? SDL_WINDOW_FULLSCREEN : 0); SDL_SetWindowBordered (g_window, bFullScreen ? SDL_FALSE : SDL_TRUE); SDL_SetWindowGrab (g_window, bFullScreen ? SDL_TRUE : SDL_FALSE); - SDL_SetWindowPosition ( - g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); m_pPixmap->LoadCursors (g_zoom); m_pPixmap->ReloadTargetTextures (); From 43ba6df7afe6ddf7d4dc47056aa423a0f119bc76 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 29 May 2018 18:06:04 +0200 Subject: [PATCH 10/11] Fix mostly the fullscreen switching with more than 1 display It concerns the issue #59. It's not perfect but it works much better (at leats on Linux). The idea is to move the window to the top left corner of the current display. --- src/event.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/event.cxx b/src/event.cxx index 50feb1d..f464fa0 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1666,10 +1666,36 @@ CEvent::SetFullScreen (bool bFullScreen) SDL_SetWindowSize (g_window, LXIMAGE, LYIMAGE); g_bFullScreen = bFullScreen; + + int displayIndex = SDL_GetWindowDisplayIndex (g_window); + + if (g_bFullScreen) + { + int displays = SDL_GetNumVideoDisplays (); + + std::vector displayBounds; + for (int i = 0; i < displays; i++) + { + displayBounds.push_back (SDL_Rect ()); + SDL_GetDisplayBounds (i, &displayBounds.back ()); + } + + /* It seems that the fullscreen switching works better when the window + * is at the top left corner of the current display. + */ + SDL_SetWindowPosition ( + g_window, displayBounds[displayIndex].x, displayBounds[displayIndex].y); + } + SDL_SetWindowFullscreen (g_window, bFullScreen ? SDL_WINDOW_FULLSCREEN : 0); SDL_SetWindowBordered (g_window, bFullScreen ? SDL_FALSE : SDL_TRUE); SDL_SetWindowGrab (g_window, bFullScreen ? SDL_TRUE : SDL_FALSE); + if (!g_bFullScreen) + SDL_SetWindowPosition ( + g_window, SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex), + SDL_WINDOWPOS_CENTERED_DISPLAY (displayIndex)); + m_pPixmap->LoadCursors (g_zoom); m_pPixmap->ReloadTargetTextures (); From a68625dafde2dd843ec1f4734e012d283b10d094 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Tue, 29 May 2018 18:18:37 +0200 Subject: [PATCH 11/11] Bump micro version for the next stable release --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab5e09f..b148a61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ link_directories (${CMAKE_INSTALL_PREFIX}/lib) project (planetblupi) set (PB_VERSION_MAJOR 1) set (PB_VERSION_MINOR 12) -set (PB_VERSION_PATCH 4) +set (PB_VERSION_PATCH 5) set (PB_VERSION_EXTRA "") set (PB_PRODUCT_NAME "Planet Blupi") set (PB_PACKAGE_NAME "planetblupi")