mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
733873351a
3 changed files with 58 additions and 39 deletions
|
@ -525,7 +525,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage
|
|||
}
|
||||
else if(condition == INVULNERABILITY)
|
||||
{
|
||||
if(statusBar->CPlayer->cheats&CF_GODMODE)
|
||||
if(statusBar->CPlayer->cheats&(CF_GODMODE|CF_GODMODE2))
|
||||
{
|
||||
drawAlt = 1;
|
||||
}
|
||||
|
@ -1730,7 +1730,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
|
|||
static int artiflashTick;
|
||||
static fixed_t itemflashFade;
|
||||
};
|
||||
int CommandDrawSelectedInventory::artiflashTick = 4;
|
||||
int CommandDrawSelectedInventory::artiflashTick = 0;
|
||||
int CommandDrawSelectedInventory::itemflashFade = FRACUNIT*3/4;
|
||||
|
||||
void DSBarInfo::FlashItem(const PClass *itemtype)
|
||||
|
|
|
@ -28,7 +28,7 @@ class SDLFB : public DFrameBuffer
|
|||
{
|
||||
DECLARE_CLASS(SDLFB, DFrameBuffer)
|
||||
public:
|
||||
SDLFB (int width, int height, bool fullscreen);
|
||||
SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin);
|
||||
~SDLFB ();
|
||||
|
||||
bool Lock (bool buffer);
|
||||
|
@ -67,7 +67,6 @@ private:
|
|||
SDL_Texture *Texture;
|
||||
SDL_Surface *Surface;
|
||||
};
|
||||
SDL_Rect UpdateRect;
|
||||
|
||||
bool UsingRenderer;
|
||||
bool NeedPalUpdate;
|
||||
|
@ -261,6 +260,8 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
|
|||
PalEntry flashColor;
|
||||
int flashAmount;
|
||||
|
||||
SDL_Window *oldwin = NULL;
|
||||
|
||||
if (old != NULL)
|
||||
{ // Reuse the old framebuffer if its attributes are the same
|
||||
SDLFB *fb = static_cast<SDLFB *> (old);
|
||||
|
@ -275,6 +276,10 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
|
|||
}
|
||||
return old;
|
||||
}
|
||||
|
||||
oldwin = fb->Screen;
|
||||
fb->Screen = NULL;
|
||||
|
||||
old->GetFlash (flashColor, flashAmount);
|
||||
old->ObjectFlags |= OF_YesReallyDelete;
|
||||
if (screen == old) screen = NULL;
|
||||
|
@ -286,7 +291,7 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer (int width, int height, bool fullscree
|
|||
flashAmount = 0;
|
||||
}
|
||||
|
||||
SDLFB *fb = new SDLFB (width, height, fullscreen);
|
||||
SDLFB *fb = new SDLFB (width, height, fullscreen, oldwin);
|
||||
|
||||
// If we could not create the framebuffer, try again with slightly
|
||||
// different parameters in this order:
|
||||
|
@ -340,7 +345,7 @@ void SDLVideo::SetWindowedScale (float scale)
|
|||
|
||||
// FrameBuffer implementation -----------------------------------------------
|
||||
|
||||
SDLFB::SDLFB (int width, int height, bool fullscreen)
|
||||
SDLFB::SDLFB (int width, int height, bool fullscreen, SDL_Window *oldwin)
|
||||
: DFrameBuffer (width, height)
|
||||
{
|
||||
int i;
|
||||
|
@ -351,15 +356,27 @@ SDLFB::SDLFB (int width, int height, bool fullscreen)
|
|||
NotPaletted = false;
|
||||
FlashAmount = 0;
|
||||
|
||||
FString caption;
|
||||
caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
|
||||
if (oldwin)
|
||||
{
|
||||
// In some cases (Mac OS X fullscreen) SDL2 doesn't like having multiple windows which
|
||||
// appears to inevitably happen while compositor animations are running. So lets try
|
||||
// to reuse the existing window.
|
||||
Screen = oldwin;
|
||||
SDL_SetWindowSize (Screen, width, height);
|
||||
SetFullscreen (fullscreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
FString caption;
|
||||
caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime());
|
||||
|
||||
Screen = SDL_CreateWindow (caption,
|
||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter),
|
||||
width, height, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0));
|
||||
Screen = SDL_CreateWindow (caption,
|
||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter), SDL_WINDOWPOS_UNDEFINED_DISPLAY(vid_adapter),
|
||||
width, height, (fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)|SDL_WINDOW_RESIZABLE);
|
||||
|
||||
if (Screen == NULL)
|
||||
return;
|
||||
if (Screen == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
Renderer = NULL;
|
||||
Texture = NULL;
|
||||
|
@ -381,15 +398,15 @@ SDLFB::SDLFB (int width, int height, bool fullscreen)
|
|||
|
||||
SDLFB::~SDLFB ()
|
||||
{
|
||||
if (Renderer)
|
||||
{
|
||||
if (Texture)
|
||||
SDL_DestroyTexture (Texture);
|
||||
SDL_DestroyRenderer (Renderer);
|
||||
}
|
||||
|
||||
if(Screen)
|
||||
{
|
||||
if (Renderer)
|
||||
{
|
||||
if (Texture)
|
||||
SDL_DestroyTexture (Texture);
|
||||
SDL_DestroyRenderer (Renderer);
|
||||
}
|
||||
|
||||
SDL_DestroyWindow (Screen);
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +515,8 @@ void SDLFB::Update ()
|
|||
SDL_UnlockTexture (Texture);
|
||||
|
||||
SDLFlipCycles.Clock();
|
||||
SDL_RenderCopy(Renderer, Texture, NULL, &UpdateRect);
|
||||
SDL_RenderClear(Renderer);
|
||||
SDL_RenderCopy(Renderer, Texture, NULL, NULL);
|
||||
SDL_RenderPresent(Renderer);
|
||||
SDLFlipCycles.Unclock();
|
||||
}
|
||||
|
@ -613,6 +631,9 @@ void SDLFB::GetFlashedPalette (PalEntry pal[256])
|
|||
|
||||
void SDLFB::SetFullscreen (bool fullscreen)
|
||||
{
|
||||
if (IsFullscreen() == fullscreen)
|
||||
return;
|
||||
|
||||
SDL_SetWindowFullscreen (Screen, fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
||||
if (!fullscreen)
|
||||
{
|
||||
|
@ -645,6 +666,8 @@ void SDLFB::ResetSDLRenderer ()
|
|||
if (!Renderer)
|
||||
return;
|
||||
|
||||
SDL_SetRenderDrawColor(Renderer, 0, 0, 0, 255);
|
||||
|
||||
Uint32 fmt;
|
||||
switch(vid_displaybits)
|
||||
{
|
||||
|
@ -681,24 +704,14 @@ void SDLFB::ResetSDLRenderer ()
|
|||
NotPaletted = false;
|
||||
}
|
||||
|
||||
// Calculate update rectangle
|
||||
// In fullscreen, set logical size according to animorphic ratio.
|
||||
// Windowed modes are rendered to fill the window (usually 1:1)
|
||||
if (IsFullscreen ())
|
||||
{
|
||||
int w, h;
|
||||
SDL_GetWindowSize (Screen, &w, &h);
|
||||
UpdateRect.w = w;
|
||||
UpdateRect.h = h;
|
||||
ScaleWithAspect (UpdateRect.w, UpdateRect.h, Width, Height);
|
||||
UpdateRect.x = (w - UpdateRect.w)/2;
|
||||
UpdateRect.y = (h - UpdateRect.h)/2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// In windowed mode we just update the whole window.
|
||||
UpdateRect.x = 0;
|
||||
UpdateRect.y = 0;
|
||||
UpdateRect.w = Width;
|
||||
UpdateRect.h = Height;
|
||||
ScaleWithAspect (w, h, Width, Height);
|
||||
SDL_RenderSetLogicalSize (Renderer, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -726,13 +739,14 @@ void SDLFB::SetVSync (bool vsync)
|
|||
|
||||
void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
|
||||
{
|
||||
int w, h;
|
||||
SDL_GetWindowSize (Screen, &w, &h);
|
||||
|
||||
// Detect if we're doing scaling in the Window and adjust the mouse
|
||||
// coordinates accordingly. This could be more efficent, but I
|
||||
// don't think performance is an issue in the menus.
|
||||
if(IsFullscreen())
|
||||
{
|
||||
int w, h;
|
||||
SDL_GetWindowSize (Screen, &w, &h);
|
||||
int realw = w, realh = h;
|
||||
ScaleWithAspect (realw, realh, SCREENWIDTH, SCREENHEIGHT);
|
||||
if (realw != SCREENWIDTH || realh != SCREENHEIGHT)
|
||||
|
@ -751,6 +765,11 @@ void SDLFB::ScaleCoordsFromWindow(SWORD &x, SWORD &y)
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x = (SWORD)(x*Width/w);
|
||||
y = (SWORD)(y*Height/h);
|
||||
}
|
||||
}
|
||||
|
||||
ADD_STAT (blit)
|
||||
|
|
|
@ -51,7 +51,7 @@ statusbar fullscreen, fullscreenoffsets
|
|||
|
||||
statusbar Normal
|
||||
{
|
||||
drawimage "H2BAR", 0, 135;
|
||||
drawimage "H2BAR", 0, 134;
|
||||
drawimage "STATBAR", 38, 162;
|
||||
|
||||
drawselectedinventory artiflash, INDEXFONT_RAVEN, 143, 163, 174, 184, untranslated;
|
||||
|
@ -204,7 +204,7 @@ statusbar Normal
|
|||
|
||||
statusbar Automap
|
||||
{
|
||||
drawimage "H2BAR", 0, 135;
|
||||
drawimage "H2BAR", 0, 134;
|
||||
drawimage "KEYBAR", 38, 162;
|
||||
drawkeybar 5, horizontal, 20, 46, 164;
|
||||
drawimage hexenarmor(armor, "ARMSLOT1"), 150, 164;
|
||||
|
|
Loading…
Reference in a new issue