diff --git a/src/am_map.cpp b/src/am_map.cpp index 02edc6142..f121f92bb 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -48,6 +48,7 @@ #include "g_game.h" #include "v_video.h" #include "d_main.h" +#include "v_draw.h" #include "m_cheat.h" #include "c_dispatch.h" diff --git a/src/common/2d/v_2ddrawer.cpp b/src/common/2d/v_2ddrawer.cpp index 704d2e1cf..08560c35c 100644 --- a/src/common/2d/v_2ddrawer.cpp +++ b/src/common/2d/v_2ddrawer.cpp @@ -39,7 +39,8 @@ #include "v_draw.h" #include "fcolormap.h" -F2DDrawer* twod; +static F2DDrawer drawer; +F2DDrawer* twod = &drawer; EXTERN_CVAR(Float, transsouls) diff --git a/src/common/2d/v_2ddrawer.h b/src/common/2d/v_2ddrawer.h index 07115f0f9..93712a8f8 100644 --- a/src/common/2d/v_2ddrawer.h +++ b/src/common/2d/v_2ddrawer.h @@ -198,7 +198,7 @@ public: int GetWidth() const { return Width; } int GetHeight() const { return Height; } void SetSize(int w, int h) { Width = w; Height = h; } - void Begin() { isIn2D = true; } + void Begin(int w, int h) { isIn2D = true; Width = w; Height = h; } void End() { isIn2D = false; } bool HasBegun2D() { return isIn2D; } diff --git a/src/common/2d/v_draw.cpp b/src/common/2d/v_draw.cpp index bf33d6f6a..bc04333e0 100644 --- a/src/common/2d/v_draw.cpp +++ b/src/common/2d/v_draw.cpp @@ -1222,7 +1222,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Screen, DrawThickLine, DrawThickLine) //========================================================================== // -// DCanvas :: Clear +// ClearRect // // Set an area to a specified color. // @@ -1281,7 +1281,7 @@ DEFINE_ACTION_FUNCTION(_Screen, Clear) //========================================================================== // -// DCanvas :: Dim +// DoDim // // Applies a colored overlay to an area of the screen. // diff --git a/src/common/2d/v_draw.h b/src/common/2d/v_draw.h index fe76272f5..2322232e7 100644 --- a/src/common/2d/v_draw.h +++ b/src/common/2d/v_draw.h @@ -219,7 +219,6 @@ void DoDim(F2DDrawer* drawer, PalEntry color, float amount, int x1, int y1, int void Dim(F2DDrawer* drawer, PalEntry color, float damount, int x1, int y1, int w, int h, FRenderStyle* style = nullptr); void FillBorder(F2DDrawer *drawer, FGameTexture* img); // Fills the border around a 4:3 part of the screen on non-4:3 displays -void DrawFrame(F2DDrawer* drawer, int left, int top, int width, int height); void DrawBorder(F2DDrawer* drawer, FTextureID, int x1, int y1, int x2, int y2); void DrawFrame(F2DDrawer* twod, PalEntry color, int left, int top, int width, int height, int thickness); diff --git a/src/common/engine/i_interface.h b/src/common/engine/i_interface.h index cd6a46e67..594d5ab2b 100644 --- a/src/common/engine/i_interface.h +++ b/src/common/engine/i_interface.h @@ -1,6 +1,7 @@ #pragma once #include "zstring.h" +#include "intrect.h" struct SystemCallbacks { @@ -13,6 +14,8 @@ struct SystemCallbacks void (*PlayStartupSound)(const char* name); bool (*IsSpecialUI)(); bool (*DisableTextureFilter)(); + void (*OnScreenSizeChanged)(); + IntRect(*GetSceneRect)(); }; extern SystemCallbacks *sysCallbacks; diff --git a/src/common/fonts/v_font.h b/src/common/fonts/v_font.h index 4e78da08f..779137b61 100644 --- a/src/common/fonts/v_font.h +++ b/src/common/fonts/v_font.h @@ -38,7 +38,6 @@ #include "palentry.h" #include "name.h" -class DCanvas; class FGameTexture; struct FRemapTable; diff --git a/src/common/models/model.cpp b/src/common/models/model.cpp index bd5d9ced9..90dedc272 100644 --- a/src/common/models/model.cpp +++ b/src/common/models/model.cpp @@ -31,13 +31,13 @@ #include "sc_man.h" #include "m_crc32.h" #include "printf.h" -#include "models.h" #include "model_ue1.h" #include "model_obj.h" #include "model_md2.h" #include "model_md3.h" #include "model_kvx.h" #include "i_time.h" +#include "voxels.h" #include "texturemanager.h" #include "modelrenderer.h" diff --git a/src/common/models/model.h b/src/common/models/model.h index a8e14d2e2..5fdec020c 100644 --- a/src/common/models/model.h +++ b/src/common/models/model.h @@ -2,6 +2,7 @@ #include #include "textureid.h" +#include "i_modelvertexbuffer.h" class FModelRenderer; class FGameTexture; diff --git a/src/common/models/modelrenderer.h b/src/common/models/modelrenderer.h index 96c8f2a71..1018d7ebb 100644 --- a/src/common/models/modelrenderer.h +++ b/src/common/models/modelrenderer.h @@ -1,5 +1,7 @@ -#include "models.h" +#include "renderstyle.h" +#include "matrix.h" +#include "model.h" class FModelRenderer { diff --git a/src/common/models/models_md2.cpp b/src/common/models/models_md2.cpp index 6e255cf40..c3439faea 100644 --- a/src/common/models/models_md2.cpp +++ b/src/common/models/models_md2.cpp @@ -30,6 +30,7 @@ #include "model_md2.h" #include "texturemanager.h" #include "modelrenderer.h" +#include "printf.h" #ifdef _MSC_VER #pragma warning(disable:4244) // warning C4244: conversion from 'double' to 'float', possible loss of data diff --git a/src/common/models/models_obj.cpp b/src/common/models/models_obj.cpp index 54c237c65..264ffd6ac 100644 --- a/src/common/models/models_obj.cpp +++ b/src/common/models/models_obj.cpp @@ -23,6 +23,8 @@ #include "model_obj.h" #include "texturemanager.h" #include "modelrenderer.h" +#include "printf.h" +#include "textureid.h" /** * Load an OBJ model diff --git a/src/common/models/models_voxel.cpp b/src/common/models/models_voxel.cpp index 42c21e1d0..cfac12372 100644 --- a/src/common/models/models_voxel.cpp +++ b/src/common/models/models_voxel.cpp @@ -33,6 +33,10 @@ #include "image.h" #include "texturemanager.h" #include "modelrenderer.h" +#include "voxels.h" +#include "texturemanager.h" +#include "palettecontainer.h" +#include "textures.h" #ifdef _MSC_VER #pragma warning(disable:4244) // warning C4244: conversion from 'double' to 'float', possible loss of data diff --git a/src/common/models/voxels.cpp b/src/common/models/voxels.cpp index 74c6cac38..75acb8dda 100644 --- a/src/common/models/voxels.cpp +++ b/src/common/models/voxels.cpp @@ -43,7 +43,6 @@ #include "v_video.h" #include "sc_man.h" #include "voxels.h" -#include "info.h" #include "printf.h" void VOX_AddVoxel(int sprnum, int frame, FVoxelDef *def); diff --git a/src/common/models/voxels.h b/src/common/models/voxels.h index ea71d2b0c..b4a1cdfcd 100644 --- a/src/common/models/voxels.h +++ b/src/common/models/voxels.h @@ -1,8 +1,7 @@ #ifndef __RES_VOXEL_H #define __RES_VOXEL_H -#include "doomdef.h" - +#include // [RH] Voxels from Build #define MAXVOXMIPS 5 diff --git a/src/common/rendering/gl/gl_postprocess.cpp b/src/common/rendering/gl/gl_postprocess.cpp index 8b97f51e0..8af1a2272 100644 --- a/src/common/rendering/gl/gl_postprocess.cpp +++ b/src/common/rendering/gl/gl_postprocess.cpp @@ -35,6 +35,7 @@ #include "v_video.h" #include "templates.h" #include "hw_vrmodes.h" +#include "v_draw.h" extern bool vid_hdr_active; @@ -123,7 +124,7 @@ void FGLRenderer::Flush() if (eyeCount - eye_ix > 1) mBuffers->NextEye(eyeCount); } - screen->Clear2D(); + twod->Clear(); FGLPostProcessState savedState; FGLDebug::PushGroup("PresentEyes"); @@ -143,7 +144,7 @@ void FGLRenderer::Flush() void FGLRenderer::CopyToBackbuffer(const IntRect *bounds, bool applyGamma) { screen->Draw2D(); // draw all pending 2D stuff before copying the buffer - screen->Clear2D(); + twod->Clear(); GLPPRenderState renderstate(mBuffers); hw_postprocess.customShaders.Run(&renderstate, "screen"); diff --git a/src/common/rendering/gl/gl_renderstate.cpp b/src/common/rendering/gl/gl_renderstate.cpp index 555dbba91..ac9e47025 100644 --- a/src/common/rendering/gl/gl_renderstate.cpp +++ b/src/common/rendering/gl/gl_renderstate.cpp @@ -26,13 +26,10 @@ */ #include "templates.h" -#include "doomstat.h" -#include "r_data/colormaps.h" #include "gl_system.h" #include "gl_interface.h" #include "hw_cvars.h" #include "flatvertices.h" -#include "hwrenderer/scene/hw_skydome.h" #include "gl_shader.h" #include "gl/renderer/gl_renderer.h" #include "hw_lightbuffer.h" diff --git a/src/common/rendering/r_videoscale.cpp b/src/common/rendering/r_videoscale.cpp index 236493fb1..dee86723e 100644 --- a/src/common/rendering/r_videoscale.cpp +++ b/src/common/rendering/r_videoscale.cpp @@ -40,12 +40,11 @@ #include "v_draw.h" #include "i_interface.h" #include "printf.h" +#include "version.h" #define NUMSCALEMODES countof(vScaleTable) extern bool setsizeneeded; -EXTERN_CVAR(Int, vid_aspect) - CUSTOM_CVAR(Int, vid_scale_customwidth, VID_MIN_WIDTH, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (self < VID_MIN_WIDTH) diff --git a/src/common/textures/textureid.h b/src/common/textures/textureid.h index 5d2b7d726..c7a6355cc 100644 --- a/src/common/textures/textureid.h +++ b/src/common/textures/textureid.h @@ -50,6 +50,12 @@ private: int texnum; }; +class FNullTextureID : public FTextureID +{ +public: + FNullTextureID() : FTextureID(0) {} +}; + // This is for the script interface which needs to do casts from int to texture. class FSetTextureID : public FTextureID { diff --git a/src/common/textures/textures.h b/src/common/textures/textures.h index bd9c79ed9..f0b5b4dfc 100644 --- a/src/common/textures/textures.h +++ b/src/common/textures/textures.h @@ -124,12 +124,6 @@ class FMultipatchTextureBuilder; extern int r_spriteadjustSW, r_spriteadjustHW; -class FNullTextureID : public FTextureID -{ -public: - FNullTextureID() : FTextureID(0) {} -}; - enum FTextureFormat : uint32_t { TEX_Pal, diff --git a/src/console/c_cmds.cpp b/src/console/c_cmds.cpp index 8718b820d..a4b868963 100644 --- a/src/console/c_cmds.cpp +++ b/src/console/c_cmds.cpp @@ -68,6 +68,7 @@ #include "i_music.h" #include "s_music.h" #include "texturemanager.h" +#include "v_draw.h" extern FILE *Logfile; extern bool insave; diff --git a/src/console/c_console.cpp b/src/console/c_console.cpp index 1204b2c7a..ad4fb0820 100644 --- a/src/console/c_console.cpp +++ b/src/console/c_console.cpp @@ -67,6 +67,7 @@ #include "s_music.h" #include "i_time.h" #include "texturemanager.h" +#include "v_draw.h" #include "gi.h" @@ -1000,7 +1001,7 @@ void C_AdjustBottom () void C_NewModeAdjust () { - C_InitConsole (twod->GetWidth(), twod->GetHeight(), true); + C_InitConsole (screen->GetWidth(), screen->GetHeight(), true); C_FlushDisplay (); C_AdjustBottom (); } diff --git a/src/ct_chat.cpp b/src/ct_chat.cpp index 9f2260049..73c77e6d1 100644 --- a/src/ct_chat.cpp +++ b/src/ct_chat.cpp @@ -44,6 +44,7 @@ #include "vm.h" #include "c_buttons.h" #include "d_buttons.h" +#include "v_draw.h" enum { diff --git a/src/d_main.cpp b/src/d_main.cpp index 0609b9d60..5b9dbcd6f 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -89,6 +89,7 @@ #include "d_netinf.h" #include "m_cheat.h" #include "m_joy.h" +#include "v_draw.h" #include "po_man.h" #include "p_local.h" #include "autosegs.h" @@ -113,6 +114,7 @@ #include "scriptutil.h" #include "v_palette.h" #include "texturemanager.h" +#include "hwrenderer/utility/hw_clock.h" #include "hwrenderer/scene/hw_drawinfo.h" #ifdef __unix__ @@ -216,6 +218,27 @@ CUSTOM_CVAR(Float, i_timescale, 1.0f, CVAR_NOINITCALL) // PUBLIC DATA DEFINITIONS ------------------------------------------------- +CUSTOM_CVAR(Int, vid_rendermode, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +{ + if (self < 0 || self > 4) + { + self = 4; + } + else if (self == 2 || self == 3) + { + self = self - 2; // softpoly to software + } + + if (usergame) + { + // [SP] Update pitch limits to the netgame/gamesim. + players[consoleplayer].SendPitchLimits(); + } + screen->SetTextureFilterMode(); + + // No further checks needed. All this changes now is which scene drawer the render backend calls. +} + CUSTOM_CVAR (Int, fraglimit, 0, CVAR_SERVERINFO) { // Check for the fraglimit being hit because the fraglimit is being @@ -937,6 +960,7 @@ static void End2DAndUpdate() { DrawRateStuff(); twod->End(); + CheckBench(); screen->Update(); } @@ -1070,7 +1094,7 @@ void D_Display () viewsec = RenderView(&players[consoleplayer]); }, true); - screen->Begin2D(); + twod->Begin(screen->GetWidth(), screen->GetHeight()); if (!hud_toggled) { V_DrawBlend(viewsec); @@ -1117,11 +1141,10 @@ void D_Display () } else { - screen->Begin2D(); + twod->Begin(screen->GetWidth(), screen->GetHeight()); switch (gamestate) { case GS_FULLCONSOLE: - screen->Begin2D(); C_DrawConsole (); M_Drawer (); End2DAndUpdate (); @@ -1207,7 +1230,7 @@ void D_Display () GSnd->SetSfxPaused(true, 1); I_FreezeTime(true); - screen->End2D(); + twod->End(); auto wipend = MakeGameTexture(screen->WipeEndScreen(), nullptr, ETextureType::SWCanvas); auto wiper = Wiper::Create(wipe_type); wiper->SetTextures(wipe, wipend); @@ -1224,7 +1247,7 @@ void D_Display () diff = (nowtime - wipestart) * 40 / 1000; // Using 35 here feels too slow. } while (diff < 1); wipestart = nowtime; - screen->Begin2D(); + twod->Begin(screen->GetWidth(), screen->GetHeight()); done = wiper->Run(1); C_DrawConsole (); // console and M_Drawer (); // menu are drawn even on top of wipes @@ -2798,6 +2821,40 @@ static bool System_DisableTextureFilter() return !V_IsHardwareRenderer(); } +static void System_OnScreenSizeChanged() +{ + if (StatusBar != NULL) + { + StatusBar->CallScreenSizeChanged(); + } + // Reload crosshair if transitioned to a different size + ST_LoadCrosshair(true); + if (primaryLevel && primaryLevel->automap) + primaryLevel->automap->NewResolution(); +} + +IntRect System_GetSceneRect() +{ + IntRect mSceneViewport; + // Special handling so the view with a visible status bar displays properly + int height, width; + if (screenblocks >= 10) + { + height = screen->GetHeight(); + width = screen->GetWidth(); + } + else + { + height = (screenblocks * screen->GetHeight() / 10) & ~7; + width = (screenblocks * screen->GetWidth() / 10); + } + + mSceneViewport.left = viewwindowx; + mSceneViewport.top = screen->GetHeight() - (height + viewwindowy - ((height - viewheight) / 2)); + mSceneViewport.width = viewwidth; + mSceneViewport.height = height; + return mSceneViewport; +} //========================================================================== // // DoomSpecificInfo @@ -3004,6 +3061,8 @@ static int D_DoomMain_Internal (void) System_PlayStartupSound, System_IsSpecialUI, System_DisableTextureFilter, + System_OnScreenSizeChanged, + System_GetSceneRect, }; sysCallbacks = &syscb; diff --git a/src/d_net.cpp b/src/d_net.cpp index f186538f8..0962cec0e 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -71,6 +71,7 @@ EXTERN_CVAR (Int, disableautosave) EXTERN_CVAR (Int, autosavecount) +EXTERN_CVAR(Bool, cl_capfps) //#define SIMULATEERRORS (RAND_MAX/3) #define SIMULATEERRORS 0 @@ -146,8 +147,6 @@ static int oldentertics; extern bool advancedemo; -CVAR (Bool, cl_capfps, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) - CVAR(Bool, net_ticbalance, false, CVAR_SERVERINFO | CVAR_NOSAVE) CUSTOM_CVAR(Int, net_extratic, 0, CVAR_SERVERINFO | CVAR_NOSAVE) { diff --git a/src/g_statusbar/hudmessages.cpp b/src/g_statusbar/hudmessages.cpp index 33c6a7b28..21321ab19 100644 --- a/src/g_statusbar/hudmessages.cpp +++ b/src/g_statusbar/hudmessages.cpp @@ -42,6 +42,7 @@ #include "serialize_obj.h" #include "doomstat.h" #include "vm.h" +#include "v_draw.h" EXTERN_CVAR(Int, con_scaletext) diff --git a/src/g_statusbar/sbarinfo.cpp b/src/g_statusbar/sbarinfo.cpp index 06427abd6..7efaff641 100644 --- a/src/g_statusbar/sbarinfo.cpp +++ b/src/g_statusbar/sbarinfo.cpp @@ -51,6 +51,7 @@ #include "utf8.h" #include "texturemanager.h" #include "v_palette.h" +#include "v_draw.h" #define ARTIFLASH_OFFSET (statusBar->invBarOffset+6) enum diff --git a/src/g_statusbar/shared_hud.cpp b/src/g_statusbar/shared_hud.cpp index 32ee78251..c209e21cd 100644 --- a/src/g_statusbar/shared_hud.cpp +++ b/src/g_statusbar/shared_hud.cpp @@ -48,6 +48,7 @@ #include "cmdlib.h" #include "g_levellocals.h" #include "vm.h" +#include "v_draw.h" #include diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 20d1148db..b639e6731 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -62,6 +62,7 @@ #include "utf8.h" #include "texturemanager.h" #include "v_palette.h" +#include "v_draw.h" #include "../version.h" @@ -141,6 +142,57 @@ CUSTOM_CVAR(Int, am_showmaplabel, 2, CVAR_ARCHIVE) CVAR (Bool, idmypos, false, 0); +//========================================================================== +// +// V_DrawFrame +// +// Draw a frame around the specified area using the view border +// frame graphics. The border is drawn outside the area, not in it. +// +//========================================================================== + +void V_DrawFrame(F2DDrawer* drawer, int left, int top, int width, int height) +{ + FGameTexture* p; + const gameborder_t* border = &gameinfo.Border; + // Sanity check for incomplete gameinfo + if (border == NULL) + return; + int offset = border->offset; + int right = left + width; + int bottom = top + height; + + // Draw top and bottom sides. + p = TexMan.GetGameTextureByName(border->t); + drawer->AddFlatFill(left, top - (int)p->GetDisplayHeight(), right, top, p, true); + p = TexMan.GetGameTextureByName(border->b); + drawer->AddFlatFill(left, bottom, right, bottom + (int)p->GetDisplayHeight(), p, true); + + // Draw left and right sides. + p = TexMan.GetGameTextureByName(border->l); + drawer->AddFlatFill(left - (int)p->GetDisplayWidth(), top, left, bottom, p, true); + p = TexMan.GetGameTextureByName(border->r); + drawer->AddFlatFill(right, top, right + (int)p->GetDisplayWidth(), bottom, p, true); + + // Draw beveled corners. + DrawTexture(drawer, TexMan.GetGameTextureByName(border->tl), left - offset, top - offset, TAG_DONE); + DrawTexture(drawer, TexMan.GetGameTextureByName(border->tr), left + width, top - offset, TAG_DONE); + DrawTexture(drawer, TexMan.GetGameTextureByName(border->bl), left - offset, top + height, TAG_DONE); + DrawTexture(drawer, TexMan.GetGameTextureByName(border->br), left + width, top + height, TAG_DONE); +} + +DEFINE_ACTION_FUNCTION(_Screen, DrawFrame) +{ + PARAM_PROLOGUE; + PARAM_INT(x); + PARAM_INT(y); + PARAM_INT(w); + PARAM_INT(h); + if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); + V_DrawFrame(twod, x, y, w, h); + return 0; +} + //--------------------------------------------------------------------------- // // Load crosshair definitions @@ -964,7 +1016,7 @@ void DBaseStatusBar::RefreshViewBorder () DrawBorder(twod, tex, viewwindowx + viewwidth, viewwindowy, Width, viewheight + viewwindowy); DrawBorder(twod, tex, 0, viewwindowy + viewheight, Width, StatusBar->GetTopOfStatusbar()); - DrawFrame(twod, viewwindowx, viewwindowy, viewwidth, viewheight); + V_DrawFrame(twod, viewwindowx, viewwindowy, viewwidth, viewheight); } } diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 7ea9734ae..7f7e55a21 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -569,6 +569,12 @@ void FGameConfigFile::DoGlobalSetup () UCVarValue v = var->GetGenericRep(CVAR_Float); vid_gamma = v.Float; } + var = FindCVar("fullscreen", NULL); + if (var != NULL) + { + UCVarValue v = var->GetGenericRep(CVAR_Bool); + vid_fullscreen = v.Float; + } } } diff --git a/src/hu_scores.cpp b/src/hu_scores.cpp index 5305440ef..6e662ab6b 100644 --- a/src/hu_scores.cpp +++ b/src/hu_scores.cpp @@ -52,6 +52,7 @@ #include "g_game.h" #include "sbar.h" #include "texturemanager.h" +#include "v_draw.h" // MACROS ------------------------------------------------------------------ diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index e8b578b19..9291190b1 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -53,6 +53,7 @@ #include "templates.h" #include "s_music.h" #include "texturemanager.h" +#include "v_draw.h" FIntermissionDescriptorList IntermissionDescriptors; @@ -941,7 +942,7 @@ void DIntermissionController::OnDestroy () void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, uint8_t state) { - ScaleOverrider s(&screen->m2DDrawer); + ScaleOverrider s(twod); if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->Destroy(); @@ -987,7 +988,7 @@ void F_StartIntermission(FName seq, uint8_t state) bool F_Responder (event_t* ev) { - ScaleOverrider s(&screen->m2DDrawer); + ScaleOverrider s(twod); if (DIntermissionController::CurrentIntermission != NULL) { return DIntermissionController::CurrentIntermission->Responder(ev); @@ -1003,7 +1004,7 @@ bool F_Responder (event_t* ev) void F_Ticker () { - ScaleOverrider s(&screen->m2DDrawer); + ScaleOverrider s(twod); if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->Ticker(); @@ -1018,7 +1019,7 @@ void F_Ticker () void F_Drawer () { - ScaleOverrider s(&screen->m2DDrawer); + ScaleOverrider s(twod); if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->Drawer(); @@ -1034,7 +1035,6 @@ void F_Drawer () void F_EndFinale () { - ScaleOverrider s(&screen->m2DDrawer); if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->Destroy(); @@ -1050,7 +1050,7 @@ void F_EndFinale () void F_AdvanceIntermission() { - ScaleOverrider s(&screen->m2DDrawer); + ScaleOverrider s(twod); if (DIntermissionController::CurrentIntermission != NULL) { DIntermissionController::CurrentIntermission->mAdvance = true; diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 25bc4b16b..668c6b706 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -45,6 +45,7 @@ #include "i_system.h" #include "v_video.h" #include "findfile.h" +#include "v_draw.h" // Save name length limit for old binary formats. #define OLDSAVESTRINGSIZE 24 diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 5700e6ccb..c9cacb718 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -56,6 +56,7 @@ #include "c_buttons.h" #include "types.h" #include "texturemanager.h" +#include "v_draw.h" int DMenu::InMenu; static ScaleOverrider *CurrentScaleOverrider; @@ -381,7 +382,7 @@ void M_StartControlPanel (bool makeSound, bool scaleoverride) } BackbuttonTime = 0; BackbuttonAlpha = 0; - if (scaleoverride && !CurrentScaleOverrider) CurrentScaleOverrider = new ScaleOverrider(&screen->m2DDrawer); + if (scaleoverride && !CurrentScaleOverrider) CurrentScaleOverrider = new ScaleOverrider(twod); else if (!scaleoverride && CurrentScaleOverrider) { delete CurrentScaleOverrider; diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 390c1de4a..d270af0d4 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -57,6 +57,7 @@ #include "vm.h" #include "v_video.h" #include "actorinlines.h" +#include "v_draw.h" static FRandom pr_randomspeech("RandomSpeech"); diff --git a/src/rendering/2d/f_wipe.cpp b/src/rendering/2d/f_wipe.cpp index 79905fd74..6109cb3d6 100644 --- a/src/rendering/2d/f_wipe.cpp +++ b/src/rendering/2d/f_wipe.cpp @@ -29,6 +29,7 @@ #include "templates.h" #include "bitmap.h" #include "hw_material.h" +#include "v_draw.h" class FBurnTexture : public FTexture { diff --git a/src/rendering/2d/v_blend.cpp b/src/rendering/2d/v_blend.cpp index 9a0f7404c..1a0a5af86 100644 --- a/src/rendering/2d/v_blend.cpp +++ b/src/rendering/2d/v_blend.cpp @@ -48,6 +48,7 @@ #include "r_utility.h" #include "hw_cvars.h" #include "d_main.h" +#include "v_draw.h" CVAR(Float, underwater_fade_scalar, 1.0f, CVAR_ARCHIVE) // [Nash] user-settable underwater blend intensity CVAR( Float, blood_fade_scalar, 1.0f, CVAR_ARCHIVE ) // [SP] Pulled from Skulltag - changed default from 0.5 to 1.0 diff --git a/src/rendering/gl/system/gl_framebuffer.cpp b/src/rendering/gl/system/gl_framebuffer.cpp index f435058b1..f995867bb 100644 --- a/src/rendering/gl/system/gl_framebuffer.cpp +++ b/src/rendering/gl/system/gl_framebuffer.cpp @@ -57,6 +57,7 @@ #include "gl_buffers.h" #include "swrenderer/r_swscene.h" #include "gl_postprocessstate.h" +#include "v_draw.h" #include "flatvertices.h" #include "hw_cvars.h" @@ -522,7 +523,7 @@ void OpenGLFrameBuffer::Draw2D() if (GLRenderer != nullptr) { GLRenderer->mBuffers->BindCurrentFB(); - ::Draw2D(&m2DDrawer, gl_RenderState); + ::Draw2D(twod, gl_RenderState); } } diff --git a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp index dd239bb25..8365eeb34 100644 --- a/src/rendering/hwrenderer/scene/hw_drawinfo.cpp +++ b/src/rendering/hwrenderer/scene/hw_drawinfo.cpp @@ -43,6 +43,7 @@ #include "hw_lightbuffer.h" #include "hw_vrmodes.h" #include "hw_clipper.h" +#include "v_draw.h" EXTERN_CVAR(Float, r_visibility) CVAR(Bool, gl_bandedswlight, false, CVAR_ARCHIVE) diff --git a/src/rendering/hwrenderer/utility/hw_draw2d.cpp b/src/rendering/hwrenderer/utility/hw_draw2d.cpp index 8d4df1696..2ea531fa9 100644 --- a/src/rendering/hwrenderer/utility/hw_draw2d.cpp +++ b/src/rendering/hwrenderer/utility/hw_draw2d.cpp @@ -36,6 +36,7 @@ #include "hw_cvars.h" #include "hw_renderstate.h" #include "r_videoscale.h" +#include "v_draw.h" //=========================================================================== diff --git a/src/rendering/polyrenderer/backend/poly_framebuffer.cpp b/src/rendering/polyrenderer/backend/poly_framebuffer.cpp index 71c7866e9..6712ac407 100644 --- a/src/rendering/polyrenderer/backend/poly_framebuffer.cpp +++ b/src/rendering/polyrenderer/backend/poly_framebuffer.cpp @@ -28,6 +28,7 @@ #include "g_game.h" #include "v_text.h" #include "i_video.h" +#include "v_draw.h" #include "hwrenderer/utility/hw_clock.h" #include "hw_vrmodes.h" @@ -171,7 +172,7 @@ void PolyFrameBuffer::Update() Flush3D.Clock(); Draw2D(); - Clear2D(); + twod->Clear(); Flush3D.Unclock(); @@ -375,7 +376,7 @@ FTexture *PolyFrameBuffer::WipeStartScreen() FTexture *PolyFrameBuffer::WipeEndScreen() { Draw2D(); - Clear2D(); + twod->Clear(); auto tex = new FWrapperTexture(mScreenViewport.width, mScreenViewport.height, 1); auto systex = static_cast(tex->GetSystemTexture()); @@ -430,7 +431,7 @@ void PolyFrameBuffer::BeginFrame() void PolyFrameBuffer::Draw2D() { - ::Draw2D(&m2DDrawer, *mRenderState); + ::Draw2D(twod, *mRenderState); } unsigned int PolyFrameBuffer::GetLightBufferBlockSize() const diff --git a/src/rendering/r_utility.cpp b/src/rendering/r_utility.cpp index 3445c7ac3..76ecc5e68 100644 --- a/src/rendering/r_utility.cpp +++ b/src/rendering/r_utility.cpp @@ -64,6 +64,7 @@ #include "actorinlines.h" #include "g_game.h" #include "i_system.h" +#include "v_draw.h" // EXTERNAL DATA DECLARATIONS ---------------------------------------------- @@ -140,7 +141,6 @@ int LocalViewPitch; bool LocalKeyboardTurner; int setblocks; -bool setsizeneeded; unsigned int R_OldBlend = ~0; int validcount = 1; // increment every time a check is made @@ -368,7 +368,7 @@ CUSTOM_CVAR (Int, screenblocks, 10, CVAR_ARCHIVE) //========================================================================== FRenderer *CreateSWRenderer(); - +FRenderer* SWRenderer; //========================================================================== // @@ -1031,30 +1031,6 @@ void R_SetupFrame (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, AActor } -//========================================================================== -// -// CVAR transsouls -// -// How translucent things drawn with STYLE_SoulTrans are. Normally, only -// Lost Souls have this render style. -// Values less than 0.25 will automatically be set to -// 0.25 to ensure some degree of visibility. Likewise, values above 1.0 will -// be set to 1.0, because anything higher doesn't make sense. -// -//========================================================================== - -CUSTOM_CVAR(Float, transsouls, 0.75f, CVAR_ARCHIVE) -{ - if (self < 0.25f) - { - self = 0.25f; - } - else if (self > 1.f) - { - self = 1.f; - } -} - CUSTOM_CVAR(Float, maxviewpitch, 90.f, CVAR_ARCHIVE | CVAR_SERVERINFO) { if (self>90.f) self = 90.f; diff --git a/src/rendering/swrenderer/r_swscene.cpp b/src/rendering/swrenderer/r_swscene.cpp index 7a2fc9cb9..d163df8f2 100644 --- a/src/rendering/swrenderer/r_swscene.cpp +++ b/src/rendering/swrenderer/r_swscene.cpp @@ -37,6 +37,7 @@ #include "engineerrors.h" #include "texturemanager.h" #include "d_main.h" +#include "v_draw.h" // [RH] Base blending values (for e.g. underwater) int BaseBlendR, BaseBlendG, BaseBlendB; @@ -122,11 +123,11 @@ sector_t *SWSceneDrawer::RenderView(player_t *player) auto map = swrenderer::CameraLight::Instance()->ShaderColormap(); DrawTexture(twod, fbtex.get(), 0, 0, DTA_SpecialColormap, map, TAG_DONE); screen->Draw2D(); - screen->Clear2D(); + twod->Clear(); screen->PostProcessScene(true, CM_DEFAULT, [&]() { SWRenderer->DrawRemainingPlayerSprites(); screen->Draw2D(); - screen->Clear2D(); + twod->Clear(); }); } else @@ -143,7 +144,7 @@ sector_t *SWSceneDrawer::RenderView(player_t *player) SWRenderer->DrawRemainingPlayerSprites(); screen->Draw2D(); - screen->Clear2D(); + twod->Clear(); } return r_viewpoint.sector; diff --git a/src/rendering/swrenderer/scene/r_light.cpp b/src/rendering/swrenderer/scene/r_light.cpp index dea748350..5b8a689b2 100644 --- a/src/rendering/swrenderer/scene/r_light.cpp +++ b/src/rendering/swrenderer/scene/r_light.cpp @@ -36,6 +36,7 @@ #include "c_dispatch.h" #include "cmdlib.h" #include "d_net.h" +#include "v_draw.h" #include "g_level.h" #include "r_utility.h" #include "d_player.h" diff --git a/src/rendering/swrenderer/scene/r_scene.cpp b/src/rendering/swrenderer/scene/r_scene.cpp index 2cae785ed..e987ad509 100644 --- a/src/rendering/swrenderer/scene/r_scene.cpp +++ b/src/rendering/swrenderer/scene/r_scene.cpp @@ -23,7 +23,7 @@ #include #include "templates.h" - +#include "v_draw.h" #include "filesystem.h" #include "doomdef.h" #include "doomstat.h" diff --git a/src/rendering/swrenderer/things/r_playersprite.cpp b/src/rendering/swrenderer/things/r_playersprite.cpp index 0c6fd0823..2b0825fb2 100644 --- a/src/rendering/swrenderer/things/r_playersprite.cpp +++ b/src/rendering/swrenderer/things/r_playersprite.cpp @@ -66,6 +66,7 @@ #include "swrenderer/r_memory.h" #include "swrenderer/r_renderthread.h" #include "g_levellocals.h" +#include "v_draw.h" EXTERN_CVAR(Bool, r_drawplayersprites) EXTERN_CVAR(Bool, r_deathcamera) diff --git a/src/rendering/swrenderer/viewport/r_viewport.cpp b/src/rendering/swrenderer/viewport/r_viewport.cpp index 57c2f49c9..3fdbe558e 100644 --- a/src/rendering/swrenderer/viewport/r_viewport.cpp +++ b/src/rendering/swrenderer/viewport/r_viewport.cpp @@ -43,6 +43,7 @@ #include "swrenderer/plane/r_flatplane.h" #include "swrenderer/drawers/r_draw_pal.h" #include "swrenderer/drawers/r_draw_rgba.h" +#include "v_draw.h" CVAR(String, r_viewsize, "", CVAR_NOSET) diff --git a/src/rendering/v_framebuffer.cpp b/src/rendering/v_framebuffer.cpp index c7f120a9c..4d55989c3 100644 --- a/src/rendering/v_framebuffer.cpp +++ b/src/rendering/v_framebuffer.cpp @@ -35,23 +35,21 @@ #include -#include "x86.h" -#include "actor.h" - #include "v_video.h" #include "c_dispatch.h" -#include "sbar.h" #include "hardware.h" -#include "r_utility.h" -#include "swrenderer/r_renderer.h" -#include "vm.h" #include "r_videoscale.h" #include "i_time.h" -#include "hwrenderer/scene/hw_portal.h" -#include "hwrenderer/utility/hw_clock.h" +#include "v_font.h" +#include "v_draw.h" +#include "i_time.h" +#include "v_2ddrawer.h" +#include "vm.h" +#include "i_interface.h" #include "flatvertices.h" -#include "swrenderer/r_swscene.h" +#include "version.h" +#include "hw_material.h" #include #include @@ -60,7 +58,7 @@ CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE); EXTERN_CVAR(Int, vid_maxfps) -EXTERN_CVAR(Bool, cl_capfps) +CVAR(Bool, cl_capfps, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) EXTERN_CVAR(Int, screenblocks) //========================================================================== @@ -75,21 +73,16 @@ EXTERN_CVAR(Int, screenblocks) DFrameBuffer::DFrameBuffer (int width, int height) { SetSize(width, height); - mPortalState = new FPortalSceneState; - twod = &m2DDrawer; } DFrameBuffer::~DFrameBuffer() { - if (twod == &m2DDrawer) twod = nullptr; - delete mPortalState; } void DFrameBuffer::SetSize(int width, int height) { Width = ViewportScaledWidth(width, height); Height = ViewportScaledHeight(width, height); - m2DDrawer.SetSize(width, height); } //========================================================================== @@ -100,8 +93,6 @@ void DFrameBuffer::SetSize(int width, int height) void DFrameBuffer::Update() { - CheckBench(); - int initialWidth = GetClientWidth(); int initialHeight = GetClientHeight(); int clientWidth = ViewportScaledWidth(initialWidth, initialHeight); @@ -182,19 +173,6 @@ void DFrameBuffer::SetViewportRects(IntRect *bounds) return; } - // Special handling so the view with a visible status bar displays properly - int height, width; - if (screenblocks >= 10) - { - height = GetHeight(); - width = GetWidth(); - } - else - { - height = (screenblocks*GetHeight() / 10) & ~7; - width = (screenblocks*GetWidth() / 10); - } - // Back buffer letterbox for the final output int clientWidth = GetClientWidth(); int clientHeight = GetClientHeight(); @@ -222,10 +200,8 @@ void DFrameBuffer::SetViewportRects(IntRect *bounds) mScreenViewport.height = screenHeight; // Viewport for the 3D scene - mSceneViewport.left = viewwindowx; - mSceneViewport.top = screenHeight - (height + viewwindowy - ((height - viewheight) / 2)); - mSceneViewport.width = viewwidth; - mSceneViewport.height = height; + if (sysCallbacks && sysCallbacks->GetSceneRect) mSceneViewport = sysCallbacks->GetSceneRect(); + else mSceneViewport = mScreenViewport; // Scale viewports to fit letterbox bool notScaled = ((mScreenViewport.width == ViewportScaledWidth(mScreenViewport.width, mScreenViewport.height)) && diff --git a/src/rendering/v_video.cpp b/src/rendering/v_video.cpp index ff6564629..49a843414 100644 --- a/src/rendering/v_video.cpp +++ b/src/rendering/v_video.cpp @@ -39,13 +39,8 @@ #include "c_cvars.h" #include "x86.h" #include "i_video.h" -#include "r_state.h" -#include "am_map.h" - -#include "doomstat.h" #include "c_console.h" -#include "hu_stuff.h" #include "m_argv.h" @@ -54,23 +49,19 @@ #include "sc_man.h" #include "filesystem.h" - #include "c_dispatch.h" #include "cmdlib.h" -#include "sbar.h" #include "hardware.h" #include "m_png.h" -#include "r_utility.h" -#include "swrenderer/r_renderer.h" #include "menu/menu.h" #include "vm.h" #include "r_videoscale.h" #include "i_time.h" #include "version.h" -#include "g_levellocals.h" -#include "am_map.h" #include "texturemanager.h" -#include "v_palette.h" +#include "i_interface.h" +#include "v_draw.h" +#include "templates.h" EXTERN_CVAR(Int, menu_resolution_custom_width) EXTERN_CVAR(Int, menu_resolution_custom_height) @@ -83,37 +74,16 @@ CVAR(Bool, win_maximized, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITC CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { - if (vid_maxfps < TICRATE && vid_maxfps != 0) + if (self < GameTicRate && self != 0) { - vid_maxfps = TICRATE; + self = GameTicRate; } else if (vid_maxfps > 1000) { - vid_maxfps = 1000; + self = 1000; } } -CUSTOM_CVAR(Int, vid_rendermode, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) -{ - if (self < 0 || self > 4) - { - self = 4; - } - else if (self == 2 || self == 3) - { - self = self - 2; // softpoly to software - } - - if (usergame) - { - // [SP] Update pitch limits to the netgame/gamesim. - players[consoleplayer].SendPitchLimits(); - } - screen->SetTextureFilterMode(); - - // No further checks needed. All this changes now is which scene drawer the render backend calls. -} - CUSTOM_CVAR(Int, vid_preferbackend, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { // [SP] This may seem pointless - but I don't want to implement live switching just @@ -146,10 +116,8 @@ CUSTOM_CVAR(Int, uiscale, 0, CVAR_ARCHIVE | CVAR_NOINITCALL) self = 0; return; } - if (StatusBar != NULL) - { - StatusBar->CallScreenSizeChanged(); - } + if (sysCallbacks && sysCallbacks->OnScreenSizeChanged) + sysCallbacks->OnScreenSizeChanged(); setsizeneeded = true; } @@ -159,8 +127,6 @@ EXTERN_CVAR(Bool, r_blendmethod) int active_con_scale(); -FRenderer *SWRenderer; - #define DBGBREAK assert(0) class DDummyFrameBuffer : public DFrameBuffer @@ -201,7 +167,8 @@ CUSTOM_CVAR (Bool, vid_vsync, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) } // [RH] Set true when vid_setmode command has been executed -bool setmodeneeded = false; +bool setmodeneeded = false; +bool setsizeneeded = false; //========================================================================== // @@ -317,23 +284,15 @@ void V_UpdateModeSize (int width, int height) DisplayWidth = width; DisplayHeight = height; - - R_OldBlend = ~0; } void V_OutputResized (int width, int height) { V_UpdateModeSize(width, height); setsizeneeded = true; - if (StatusBar != NULL) - { - StatusBar->CallScreenSizeChanged(); - } C_NewModeAdjust(); - // Reload crosshair if transitioned to a different size - ST_LoadCrosshair(true); - if (primaryLevel && primaryLevel->automap) - primaryLevel->automap->NewResolution(); + if (sysCallbacks && sysCallbacks->OnScreenSizeChanged) + sysCallbacks->OnScreenSizeChanged(); } bool IVideo::SetResolution () @@ -430,10 +389,8 @@ void V_Init2() CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) { setsizeneeded = true; - if (StatusBar != NULL) - { - StatusBar->CallScreenSizeChanged(); - } + if (sysCallbacks && sysCallbacks->OnScreenSizeChanged) + sysCallbacks->OnScreenSizeChanged(); } DEFINE_ACTION_FUNCTION(_Screen, GetAspectRatio) @@ -460,7 +417,7 @@ void IVideo::DumpAdapters () Printf("Multi-monitor support unavailable.\n"); } -CUSTOM_CVAR_NAMED(Bool, vid_fullscreen, fullscreen, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR(Bool, vid_fullscreen, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { setmodeneeded = true; } @@ -496,7 +453,6 @@ DEFINE_GLOBAL(CleanXfac_1) DEFINE_GLOBAL(CleanYfac_1) DEFINE_GLOBAL(CleanWidth_1) DEFINE_GLOBAL(CleanHeight_1) -DEFINE_GLOBAL(generic_ui) IHardwareTexture* CreateHardwareTexture() { @@ -505,51 +461,25 @@ IHardwareTexture* CreateHardwareTexture() //========================================================================== // -// V_DrawFrame +// CVAR transsouls // -// Draw a frame around the specified area using the view border -// frame graphics. The border is drawn outside the area, not in it. +// How translucent things drawn with STYLE_SoulTrans are. Normally, only +// Lost Souls have this render style. +// Values less than 0.25 will automatically be set to +// 0.25 to ensure some degree of visibility. Likewise, values above 1.0 will +// be set to 1.0, because anything higher doesn't make sense. // //========================================================================== -void DrawFrame(F2DDrawer* drawer, int left, int top, int width, int height) +CUSTOM_CVAR(Float, transsouls, 0.75f, CVAR_ARCHIVE) { - FGameTexture* p; - const gameborder_t* border = &gameinfo.Border; - // Sanity check for incomplete gameinfo - if (border == NULL) - return; - int offset = border->offset; - int right = left + width; - int bottom = top + height; - - // Draw top and bottom sides. - p = TexMan.GetGameTextureByName(border->t); - drawer->AddFlatFill(left, top - (int)p->GetDisplayHeight(), right, top, p, true); - p = TexMan.GetGameTextureByName(border->b); - drawer->AddFlatFill(left, bottom, right, bottom + (int)p->GetDisplayHeight(), p, true); - - // Draw left and right sides. - p = TexMan.GetGameTextureByName(border->l); - drawer->AddFlatFill(left - (int)p->GetDisplayWidth(), top, left, bottom, p, true); - p = TexMan.GetGameTextureByName(border->r); - drawer->AddFlatFill(right, top, right + (int)p->GetDisplayWidth(), bottom, p, true); - - // Draw beveled corners. - DrawTexture(drawer, TexMan.GetGameTextureByName(border->tl), left - offset, top - offset, TAG_DONE); - DrawTexture(drawer, TexMan.GetGameTextureByName(border->tr), left + width, top - offset, TAG_DONE); - DrawTexture(drawer, TexMan.GetGameTextureByName(border->bl), left - offset, top + height, TAG_DONE); - DrawTexture(drawer, TexMan.GetGameTextureByName(border->br), left + width, top + height, TAG_DONE); + if (self < 0.25f) + { + self = 0.25f; + } + else if (self > 1.f) + { + self = 1.f; + } } -DEFINE_ACTION_FUNCTION(_Screen, DrawFrame) -{ - PARAM_PROLOGUE; - PARAM_INT(x); - PARAM_INT(y); - PARAM_INT(w); - PARAM_INT(h); - if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); - DrawFrame(twod, x, y, w, h); - return 0; -} diff --git a/src/rendering/v_video.h b/src/rendering/v_video.h index fd10970e6..72a89bc30 100644 --- a/src/rendering/v_video.h +++ b/src/rendering/v_video.h @@ -35,8 +35,8 @@ #define __V_VIDEO_H__ #include +#include "basics.h" #include "vectors.h" - #include "m_png.h" #include "renderstyle.h" #include "c_cvars.h" @@ -44,10 +44,7 @@ #include "intrect.h" #include "hw_shadowmap.h" -static const int VID_MIN_WIDTH = 320; -static const int VID_MIN_HEIGHT = 200; -class player_t; struct sector_t; struct FPortalSceneState; class FSkyVertexBuffer; @@ -128,9 +125,6 @@ class FTexture; class DFrameBuffer { -public: - - F2DDrawer m2DDrawer; private: int Width = 0; int Height = 0; @@ -144,7 +138,6 @@ public: unsigned int uniformblockalignment = 256; // Hardware dependent uniform buffer alignment. unsigned int maxuniformblock = 65536; const char *vendorstring; // We have to account for some issues with particular vendors. - FPortalSceneState *mPortalState; // global portal state. FSkyVertexBuffer *mSkyData = nullptr; // the sky vertex buffer FFlatVertexBuffer *mVertexData = nullptr; // Global vertex data HWViewpointBuffer *mViewpoints = nullptr; // Viewpoint render data. @@ -224,14 +217,6 @@ public: virtual IDataBuffer *CreateDataBuffer(int bindingpoint, bool ssbo, bool needsresize) { return nullptr; } bool BuffersArePersistent() { return !!(hwcaps & RFL_BUFFER_STORAGE); } - // Begin/End 2D drawing operations. - void Begin2D() - { - m2DDrawer.Begin(); - m2DDrawer.SetSize(Width, Height); - } - void End2D() { m2DDrawer.End(); } - // This is overridable in case Vulkan does it differently. virtual bool RenderTextureIsFlipped() const { @@ -255,7 +240,6 @@ public: virtual void RenderTextureView(FCanvasTexture* tex, std::function renderFunc) {} virtual void SetActiveRenderTarget() {} - // Screen wiping virtual FTexture *WipeStartScreen(); virtual FTexture *WipeEndScreen(); @@ -265,7 +249,6 @@ public: void ScaleCoordsFromWindow(int16_t &x, int16_t &y); virtual void Draw2D() {} - void Clear2D() { m2DDrawer.Clear(); } virtual void SetViewportRects(IntRect *bounds); int ScreenToWindowX(int x); @@ -310,14 +293,8 @@ void V_Init2 (); void V_Shutdown (); -class FScanner; -struct FScriptPosition; - inline bool IsRatioWidescreen(int ratio) { return (ratio & 3) != 0; } - - -#include "v_draw.h" - +extern bool setsizeneeded, setmodeneeded; #endif // __V_VIDEO_H__ diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index edd5b6b95..ec0d42954 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -31,6 +31,7 @@ #include "g_game.h" #include "v_text.h" #include "version.h" +#include "v_draw.h" #include "hwrenderer/utility/hw_clock.h" #include "hw_vrmodes.h" @@ -192,7 +193,7 @@ void VulkanFrameBuffer::Update() GetPostprocess()->SetActiveRenderTarget(); Draw2D(); - Clear2D(); + twod->Clear(); mRenderState->EndRenderPass(); mRenderState->EndFrame(); @@ -480,7 +481,7 @@ FTexture *VulkanFrameBuffer::WipeEndScreen() { GetPostprocess()->SetActiveRenderTarget(); Draw2D(); - Clear2D(); + twod->Clear(); auto tex = new FWrapperTexture(mScreenViewport.width, mScreenViewport.height, 1); auto systex = static_cast(tex->GetSystemTexture()); @@ -643,7 +644,7 @@ void VulkanFrameBuffer::UpdateGpuStats() void VulkanFrameBuffer::Draw2D() { - ::Draw2D(&m2DDrawer, *mRenderState); + ::Draw2D(twod, *mRenderState); } VulkanCommandBuffer *VulkanFrameBuffer::GetTransferCommands() diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index d95a0c157..5fb7f2a08 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -58,6 +58,7 @@ #include "c_dispatch.h" #include "s_music.h" #include "texturemanager.h" +#include "v_draw.h" DVector2 AM_GetPosition(); int Net_GetLatency(int *ld, int *ad); @@ -3498,3 +3499,4 @@ DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, name); DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, baseorder); DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, loop); +DEFINE_GLOBAL(generic_ui) diff --git a/src/sound/s_doomsound.cpp b/src/sound/s_doomsound.cpp index 4887f8e5c..fccd817e4 100644 --- a/src/sound/s_doomsound.cpp +++ b/src/sound/s_doomsound.cpp @@ -65,6 +65,7 @@ #include "vm.h" #include "g_game.h" #include "s_music.h" +#include "v_draw.h" // PUBLIC DATA DEFINITIONS ------------------------------------------------- diff --git a/src/version.h b/src/version.h index 213e3f517..b2a6ba1fc 100644 --- a/src/version.h +++ b/src/version.h @@ -112,6 +112,8 @@ const char *GetVersionString(); const int SAVEPICWIDTH = 216; const int SAVEPICHEIGHT = 162; +const int VID_MIN_WIDTH = 320; +const int VID_MIN_HEIGHT = 200; #endif //__VERSION_H__ diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index 2050683e4..1796b309c 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -55,6 +55,7 @@ #include "g_levellocals.h" #include "vm.h" #include "texturemanager.h" +#include "v_draw.h" CVAR(Bool, wi_percents, true, CVAR_ARCHIVE) CVAR(Bool, wi_showtotaltime, true, CVAR_ARCHIVE) @@ -701,7 +702,7 @@ void WI_Ticker() { if (WI_Screen) { - ScaleOverrider s(&screen->m2DDrawer); + ScaleOverrider s(twod); IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Ticker) { VMValue self = WI_Screen; @@ -721,7 +722,7 @@ void WI_Drawer() { if (WI_Screen) { - ScaleOverrider s(&screen->m2DDrawer); + ScaleOverrider s(twod); IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Drawer) { FillBorder(twod, nullptr); @@ -765,7 +766,7 @@ void WI_Start(wbstartstruct_t *wbstartstruct) } WI_Screen = cls->CreateNew(); - ScaleOverrider s(&screen->m2DDrawer); + ScaleOverrider s(twod); IFVIRTUALPTRNAME(WI_Screen, "StatusScreen", Start) { VMValue val[2] = { WI_Screen, wbstartstruct }; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 1b390c469..f68533bfa 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -2216,7 +2216,7 @@ OptionMenu VideoModeMenu protected Option "$VIDMNU_PREFERBACKEND", "vid_preferbackend", "PreferBackend" StaticText " " Option "$VIDMNU_RENDERMODE", "vid_rendermode", "RenderMode" - Option "$VIDMNU_FULLSCREEN", "fullscreen", "YesNo" + Option "$VIDMNU_FULLSCREEN", "vid_fullscreen", "YesNo" IfOption(Mac) {