diff --git a/CMakeLists.txt b/CMakeLists.txt index a24fdc5..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 3) +set (PB_VERSION_PATCH 5) set (PB_VERSION_EXTRA "") set (PB_PRODUCT_NAME "Planet Blupi") set (PB_PACKAGE_NAME "planetblupi") diff --git a/src/blupi.cxx b/src/blupi.cxx index 43d0557..e1ead86 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) 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; 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; diff --git a/src/def.h b/src/def.h index 24cdb16..52409ba 100644 --- a/src/def.h +++ b/src/def.h @@ -92,6 +92,8 @@ #define CHBACKBUILD 16 #define CHBACKBOOK 17 +#define MAX_PRIVATE_MISSIONS 20 + #define FOGHIDE 4 // clang-format on diff --git a/src/event.cxx b/src/event.cxx index aca3fd1..8ed3392 100644 --- a/src/event.cxx +++ b/src/event.cxx @@ -1726,11 +1726,35 @@ 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); - SDL_SetWindowPosition ( - g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); + + 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 (); @@ -1785,8 +1809,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 (); @@ -3525,9 +3552,11 @@ 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_bPrivate && + m_pDecor->FileExist (GetPhysicalWorld (), false, world, time, total) && + !m_pDecor->FileExist ( + GetPhysicalWorld () + 1, false, world, time, total))) m_phaseAfterMovie = EV_PHASE_LASTWIN; } @@ -5893,7 +5922,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))