1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Merge branch 'master' into wip/landscape

This commit is contained in:
Mathieu Schroeter 2018-05-30 06:58:27 +02:00
commit cd7fbf1fb7
6 changed files with 41 additions and 20 deletions

View File

@ -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")

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -92,6 +92,8 @@
#define CHBACKBUILD 16
#define CHBACKBOOK 17
#define MAX_PRIVATE_MISSIONS 20
#define FOGHIDE 4
// clang-format on

View File

@ -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<SDL_Rect> 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))