From 1f6d15c741c59488f1717187066f2a4cd0a3878d Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 19 Jul 2017 06:11:29 -0400 Subject: [PATCH 01/77] - Rename QZDoom back to GZDoom again for merge. --- CMakeLists.txt | 4 ++-- src/posix/cocoa/i_video.mm | 2 +- src/posix/sdl/hardware.cpp | 2 +- src/version.h | 20 ++++++++++---------- src/win32/hardware.cpp | 2 +- src/win32/zdoom.rc | 20 ++++++++++---------- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 277fec59c..d4b402326 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required( VERSION 2.8.7 ) -project(QZDoom) +project(GZDoom) if( COMMAND cmake_policy ) if( POLICY CMP0011 ) @@ -122,7 +122,7 @@ IF( NOT CMAKE_BUILD_TYPE ) ENDIF() set( ZDOOM_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created." ) -set( ZDOOM_EXE_NAME "qzdoom" CACHE FILEPATH "Name of the executable to create" ) +set( ZDOOM_EXE_NAME "gzdoom" CACHE FILEPATH "Name of the executable to create" ) if( MSVC ) # Allow the user to use ZDOOM_OUTPUT_DIR as a single release point. # Use zdoom, zdoomd, zdoom64, and zdoomd64 for the binary names diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index fe0912057..d15a20737 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -162,7 +162,7 @@ CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_ Printf("You must restart " GAMENAME " to apply graphics switching mode\n"); } -CUSTOM_CVAR(Int, vid_renderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR(Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { // 0: Software renderer // 1: OpenGL renderer diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 3fb408c1c..20ff59325 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -65,7 +65,7 @@ void I_RestartRenderer(); int currentrenderer; // [ZDoomGL] -CUSTOM_CVAR (Int, vid_renderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR (Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { // 0: Software renderer // 1: OpenGL renderer diff --git a/src/version.h b/src/version.h index 461b821ab..11158099d 100644 --- a/src/version.h +++ b/src/version.h @@ -48,14 +48,14 @@ const char *GetVersionString(); #ifdef GIT_DESCRIPTION #define VERSIONSTR GIT_DESCRIPTION #else -#define VERSIONSTR "2.1pre" +#define VERSIONSTR "3.2pre" #endif // The version as seen in the Windows resource -#define RC_FILEVERSION 2,1,9999,0 -#define RC_PRODUCTVERSION 2,1,9999,0 +#define RC_FILEVERSION 3,1,9999,0 +#define RC_PRODUCTVERSION 3,1,9999,0 #define RC_PRODUCTVERSION2 VERSIONSTR -// These are for content versioning. The current state is '3.2'. +// These are for content versioning. The current state is '2.4'. #define VER_MAJOR 3 #define VER_MINOR 2 #define VER_REVISION 0 @@ -94,15 +94,15 @@ const char *GetVersionString(); #define SAVEVER 4552 // This is so that derivates can use the same savegame versions without worrying about engine compatibility -#define GAMESIG "QZDOOM" -#define BASEWAD "qzdoom.pk3" +#define GAMESIG "GZDOOM" +#define BASEWAD "gzdoom.pk3" #define BASESF "gzdoom.sf2" // More stuff that needs to be different for derivatives. -#define GAMENAME "QZDoom" -#define GAMENAMELOWERCASE "qzdoom" -#define FORUM_URL "http://forum.drdteam.org/viewforum.php?f=196" -#define BUGS_FORUM_URL "http://forum.drdteam.org/viewforum.php?f=197" +#define GAMENAME "GZDoom" +#define GAMENAMELOWERCASE "gzdoom" +#define FORUM_URL "http://forum.drdteam.org" +#define BUGS_FORUM_URL "http://forum.drdteam.org/viewforum.php?f=24" #if defined(__APPLE__) || defined(_WIN32) #define GAME_DIR GAMENAME diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index 2c5987726..599fe00a5 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -107,7 +107,7 @@ CUSTOM_CVAR(Bool, vid_glswfb, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOI } // [ZDoomGL] -CUSTOM_CVAR (Int, vid_renderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR (Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { // 0: Software renderer // 1: OpenGL renderer diff --git a/src/win32/zdoom.rc b/src/win32/zdoom.rc index cede1e894..0d21faae5 100644 --- a/src/win32/zdoom.rc +++ b/src/win32/zdoom.rc @@ -72,13 +72,13 @@ BEGIN " BEGIN\r\n" " VALUE ""Comments"", ""Thanks to id Software for creating DOOM and then releasing the source code. Thanks also to TeamTNT for creating BOOM, which ZDoom is partially based on. Includes code based on the Cajun Bot 0.97 by Martin Collberg.""\r\n" " VALUE ""CompanyName"", "" ""\r\n" - " VALUE ""FileDescription"", ""QZDoom""\r\n" + " VALUE ""FileDescription"", ""GZDoom""\r\n" " VALUE ""FileVersion"", RC_FILEVERSION2\r\n" - " VALUE ""InternalName"", ""QZDoom""\r\n" + " VALUE ""InternalName"", ""GZDoom""\r\n" " VALUE ""LegalCopyright"", ""Copyright \\u00A9 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al.""\r\n" " VALUE ""LegalTrademarks"", ""DoomR is a Registered Trademark of id Software, Inc.""\r\n" - " VALUE ""OriginalFilename"", ""qzdoom.exe""\r\n" - " VALUE ""ProductName"", ""QZDoom""\r\n" + " VALUE ""OriginalFilename"", ""gzdoom.exe""\r\n" + " VALUE ""ProductName"", ""GZDoom""\r\n" " VALUE ""ProductVersion"", RC_PRODUCTVERSION2\r\n" " END\r\n" " END\r\n" @@ -228,7 +228,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US FONT 8, "MS Shell Dlg" { CONTROL 101, IDC_STATIC, STATIC, SS_ICON | WS_CHILD | WS_VISIBLE, 7, 7, 21, 20 - CONTROL "Welcome to QZDoom!", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 42, 8, 180, 8 + CONTROL "Welcome to GZDoom!", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 42, 8, 180, 8 CONTROL "", IDC_WELCOME_VERSION, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 42, 18, 180, 8 CONTROL "IWAD selection", IDC_STATIC, BUTTON, BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 8, 32, 208, 117 CONTROL "Select which game file (IWAD) to run.", IDC_STATIC, STATIC, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 12, 44, 190, 8 @@ -242,7 +242,7 @@ FONT 8, "MS Shell Dlg" CONTROL "Load lights", IDC_WELCOME_LIGHTS, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 130, 180, 51, 10 CONTROL "Load brightmaps", IDC_WELCOME_BRIGHTMAPS, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 130, 190, 65, 10 CONTROL "Don't ask me this again", IDC_DONTASKIWAD, BUTTON, BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 73, 211, 87, 10 - CONTROL "Play QZDoom", IDOK, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 8, 228, 90, 14 + CONTROL "Play GZDoom", IDOK, BUTTON, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 8, 228, 90, 14 CONTROL "Exit", IDCANCEL, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 166, 228, 50, 14 } @@ -504,13 +504,13 @@ BEGIN BEGIN VALUE "Comments", "Thanks to id Software for creating DOOM and then releasing the source code. Thanks also to TeamTNT for creating BOOM, which ZDoom is partially based on. Includes code based on the Cajun Bot 0.97 by Martin Collberg." VALUE "CompanyName", " " - VALUE "FileDescription", "QZDoom" + VALUE "FileDescription", "GZDoom" VALUE "FileVersion", RC_FILEVERSION2 - VALUE "InternalName", "QZDoom" + VALUE "InternalName", "GZDoom" VALUE "LegalCopyright", "Copyright \u00A9 1993-1996 id Software, 1998-2010 Randy Heit, 2002-2010 Christoph Oelckers, et al." VALUE "LegalTrademarks", "DoomR is a Registered Trademark of id Software, Inc." - VALUE "OriginalFilename", "qzdoom.exe" - VALUE "ProductName", "QZDoom" + VALUE "OriginalFilename", "gzdoom.exe" + VALUE "ProductName", "GZDoom" VALUE "ProductVersion", RC_PRODUCTVERSION2 END END From f4672d67bcac01f103f2dd3275d4ef2a65cb5f11 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 19 Jul 2017 13:24:19 +0300 Subject: [PATCH 02/77] Fixed crash when drawing untranslated font https://forum.zdoom.org/viewtopic.php?t=57268 --- src/v_font.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/v_font.cpp b/src/v_font.cpp index f133b1be4..1f5c12c9c 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -381,6 +381,7 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count, Next = FirstFont; FirstFont = this; Cursor = '_'; + ActiveColors = 0; maxyoffs = 0; From bbb8374b061a5adda494d43e1e4b2374b7dd9bf6 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 19 Jul 2017 15:00:55 +0300 Subject: [PATCH 03/77] Fixed applying of color to untranslated fonts in hardware renderer https://forum.zdoom.org/viewtopic.php?t=57268 --- src/gl/renderer/gl_2ddrawer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gl/renderer/gl_2ddrawer.cpp b/src/gl/renderer/gl_2ddrawer.cpp index 0e08073cc..130b6931a 100644 --- a/src/gl/renderer/gl_2ddrawer.cpp +++ b/src/gl/renderer/gl_2ddrawer.cpp @@ -133,14 +133,14 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms) if (parms.style.Flags & STYLEF_ColorIsFixed) { color = parms.fillcolor; - std::swap(color.r, color.b); } else { color = PalEntry(light, light, light); } color.a = (uint8_t)(parms.Alpha * 255); - color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255); + // red and blue channels are swapped to use value as vertex color + color = PalEntry((color.a * parms.color.a) / 255, (color.b * parms.color.b) / 255, (color.g * parms.color.g) / 255, (color.r * parms.color.r) / 255); // scissor test doesn't use the current viewport for the coordinates, so use real screen coordinates dg.mScissor[0] = GLRenderer->ScreenToWindowX(parms.lclip); From 62a4eb6b6d15fce3bc537db75e6d236428b60a90 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 19 Jul 2017 11:04:53 -0400 Subject: [PATCH 04/77] - fixed a comment in version.h about the current ZScript version (it was out of date) --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 11158099d..080385839 100644 --- a/src/version.h +++ b/src/version.h @@ -55,7 +55,7 @@ const char *GetVersionString(); #define RC_FILEVERSION 3,1,9999,0 #define RC_PRODUCTVERSION 3,1,9999,0 #define RC_PRODUCTVERSION2 VERSIONSTR -// These are for content versioning. The current state is '2.4'. +// These are for content versioning. The current state is '3.2'. #define VER_MAJOR 3 #define VER_MINOR 2 #define VER_REVISION 0 From 5918167fb355423ecd3530009477a31d9d5e0aaa Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 19 Jul 2017 15:02:46 -0400 Subject: [PATCH 05/77] - added 'kill baddies' cheat - does the same thing as 'kill monsters' only it ignores friendly monsters --- src/d_protocol.h | 3 ++- src/m_cheat.cpp | 3 ++- src/p_enemy.cpp | 4 ++-- src/p_enemy.h | 2 +- src/p_interaction.cpp | 9 +++++++++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/d_protocol.h b/src/d_protocol.h index a05cef29e..f5bcf10fb 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -219,7 +219,8 @@ enum ECheatCommand CHT_BUDDHA, CHT_NOCLIP2, CHT_BUDDHA2, - CHT_GOD2 + CHT_GOD2, + CHT_MASSACRE2 }; void StartChunk (int id, uint8_t **stream); diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index d1dd91e65..aa7038fb1 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -321,8 +321,9 @@ void cht_DoCheat (player_t *player, int cheat) break; case CHT_MASSACRE: + case CHT_MASSACRE2: { - int killcount = P_Massacre (); + int killcount = P_Massacre (cheat == CHT_MASSACRE2); // killough 3/22/98: make more intelligent about plural // Ty 03/27/98 - string(s) *not* externalized mysnprintf (msgbuild, countof(msgbuild), "%d Monster%s Killed", killcount, killcount==1 ? "" : "s"); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 076e5772a..047b59924 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -3592,7 +3592,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BossDeath) // //---------------------------------------------------------------------------- -int P_Massacre () +int P_Massacre (bool baddies) { // jff 02/01/98 'em' cheat - kill all monsters // partially taken from Chi's .46 port @@ -3606,7 +3606,7 @@ int P_Massacre () while ( (actor = iterator.Next ()) ) { - if (!(actor->flags2 & MF2_DORMANT) && (actor->flags3 & MF3_ISMONSTER)) + if (!(actor->flags2 & MF2_DORMANT) && (actor->flags3 & MF3_ISMONSTER) && (!baddies || !(actor->flags & MF_FRIENDLY))) { killcount += actor->Massacre(); } diff --git a/src/p_enemy.h b/src/p_enemy.h index a0e829c71..bdc044c5c 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -68,7 +68,7 @@ void A_FaceTarget(AActor *actor); void A_Face(AActor *self, AActor *other, DAngle max_turn = 0., DAngle max_pitch = 270., DAngle ang_offset = 0., DAngle pitch_offset = 0., int flags = 0, double z_add = 0); bool CheckBossDeath (AActor *); -int P_Massacre (); +int P_Massacre (bool baddies = false); bool P_CheckMissileRange (AActor *actor); #define SKULLSPEED (20.) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index f9c027c35..a241647d9 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1966,6 +1966,15 @@ CCMD (kill) Net_WriteByte (DEM_GENERICCHEAT); Net_WriteByte (CHT_MASSACRE); } + else if (!stricmp (argv[1], "baddies")) + { + // Kill all the unfriendly monsters + if (CheckCheatmode ()) + return; + + Net_WriteByte (DEM_GENERICCHEAT); + Net_WriteByte (CHT_MASSACRE2); + } else { Net_WriteByte (DEM_KILLCLASSCHEAT); From bc38f7f7766e67957562130e8d60eba62130a64a Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 20 Jul 2017 06:41:34 -0400 Subject: [PATCH 06/77] - changed gl_ssao_portals default to 1 --- src/gl/renderer/gl_postprocess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 06ae5d86b..ad096a121 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -113,7 +113,7 @@ CUSTOM_CVAR(Int, gl_ssao, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) self = 0; } -CUSTOM_CVAR(Int, gl_ssao_portals, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Int, gl_ssao_portals, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (self < 0) self = 0; From f4e0690c414742f5184246b5e3b8aa71a993ee58 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 20 Jul 2017 06:45:08 -0400 Subject: [PATCH 07/77] - missed one qzdoom reference --- wadsrc/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/CMakeLists.txt b/wadsrc/CMakeLists.txt index 5a85840e0..80189a328 100644 --- a/wadsrc/CMakeLists.txt +++ b/wadsrc/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required( VERSION 2.8.7 ) -add_pk3(qzdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static) +add_pk3(gzdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static) From 03ed0656e1e8177c5a65b58c969dbc4fc6e0284b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 20 Jul 2017 14:20:50 +0200 Subject: [PATCH 08/77] - fixed: The frame timer for interpolating the renderer should always take its time from the actual beginning of the frame instead of checking the system timer in real time when rendering starts. This fixes two issues: * timer related texture animations are not being recreated multiple times if a scene renders multiple viewpoints (e.g. camera textures or portals.) * interpolation is smoother when maps have a high think time of multiple milliseconds. A good map to see the difference would be ZDCMP2 which has a think time of 4-5 milliseconds. With the timer taken in real time after the thinkers have run and VSync on this resulted in alternating time slices of 11 and 21 ms between frame interpolations instead of an even 16 as should be done for smooth 60 fps because roughly every second frame was offset by those 5 ms. --- src/d_main.cpp | 3 ++- src/d_net.cpp | 1 + src/posix/cocoa/i_timer.cpp | 10 +++++++++- src/posix/i_system.h | 1 + src/posix/sdl/i_timer.cpp | 10 +++++++++- src/win32/i_system.cpp | 14 +++++++++++++- src/win32/i_system.h | 1 + 7 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index a918ddbb5..6bffbce1b 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1017,7 +1017,8 @@ void D_DoomLoop () lasttic = gametic; I_StartFrame (); } - + I_SetFrameTime(); + // process one or more tics if (singletics) { diff --git a/src/d_net.cpp b/src/d_net.cpp index 0e5e82c07..77a560e60 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -1948,6 +1948,7 @@ void TryRunTics (void) C_Ticker (); M_Ticker (); I_GetTime (true); + I_SetFrameTime(); G_Ticker(); gametic++; diff --git a/src/posix/cocoa/i_timer.cpp b/src/posix/cocoa/i_timer.cpp index ac5c49d3e..dbeca1270 100644 --- a/src/posix/cocoa/i_timer.cpp +++ b/src/posix/cocoa/i_timer.cpp @@ -178,9 +178,17 @@ unsigned int I_FPSTime() } +static uint32_t FrameTime; + +void I_SetFrameTime() +{ + FrameTime = I_MSTime(); +} + + double I_GetTimeFrac(uint32_t* ms) { - const uint32_t now = I_MSTime(); + const uint32_t now = FrameTime; if (NULL != ms) { diff --git a/src/posix/i_system.h b/src/posix/i_system.h index c9b90fcb5..4d0577467 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -67,6 +67,7 @@ extern int (*I_WaitForTic) (int); extern void (*I_FreezeTime) (bool frozen); double I_GetTimeFrac (uint32_t *ms); +void I_SetFrameTime(); // Return a seed value for the RNG. unsigned int I_MakeRNGSeed(); diff --git a/src/posix/sdl/i_timer.cpp b/src/posix/sdl/i_timer.cpp index 04f0ed3dc..a779852c7 100644 --- a/src/posix/sdl/i_timer.cpp +++ b/src/posix/sdl/i_timer.cpp @@ -208,10 +208,18 @@ void I_SelectTimer() } } + +static uint32_t FrameTime; + +void I_SetFrameTime() +{ + FrameTime = SDL_GetTicks(); +} + // Returns the fractional amount of a tic passed since the most recent tic double I_GetTimeFrac (uint32_t *ms) { - uint32_t now = SDL_GetTicks (); + uint32_t now = FrameTime; if (ms) *ms = TicStart + (1000 / TICRATE); if (TicStart == 0) { diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index a43492abf..08c4646c1 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -484,10 +484,22 @@ static void CALLBACK TimerTicked(UINT id, UINT msg, DWORD_PTR user, DWORD_PTR dw // saved tic. // //========================================================================== +static uint32_t FrameTime; + +void I_SetFrameTime() +{ + FrameTime = timeGetTime(); +} double I_GetTimeFrac(uint32_t *ms) { - DWORD now = timeGetTime(); + //DWORD now = MAX(FrameTime, TicStart); + DWORD now = FrameTime; + if (FrameTime < TicStart) + { + // Preliminary kept in to see if this can happen. Should be removed once confirmed ok. + Printf("Timer underflow!\n"); + } if (ms != NULL) { *ms = TicNext; diff --git a/src/win32/i_system.h b/src/win32/i_system.h index c83d3a2cc..2ddb7dff4 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -63,6 +63,7 @@ extern int (*I_WaitForTic) (int); extern void (*I_FreezeTime) (bool frozen); double I_GetTimeFrac (uint32_t *ms); +void I_SetFrameTime(); // Return a seed value for the RNG. unsigned int I_MakeRNGSeed(); From ffc529d100e22ff281050b940ce8796306d927d2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 20 Jul 2017 14:23:45 +0200 Subject: [PATCH 09/77] - let r_*_cull variables default to 0. --- src/swrenderer/scene/r_opaque_pass.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 478b5e759..b772d62a4 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -79,7 +79,7 @@ namespace double line_distance_cull = 1e16; } -CUSTOM_CVAR(Float, r_sprite_distance_cull, 5000.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Float, r_sprite_distance_cull, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (r_sprite_distance_cull > 0.0) { @@ -91,7 +91,7 @@ CUSTOM_CVAR(Float, r_sprite_distance_cull, 5000.0, CVAR_ARCHIVE | CVAR_GLOBALCON } } -CUSTOM_CVAR(Float, r_line_distance_cull, 8000.0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Float, r_line_distance_cull, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { if (r_line_distance_cull > 0.0) { From e8e940d22137ec03293ee04b7f18852380d084ba Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 20 Jul 2017 18:32:54 +0200 Subject: [PATCH 10/77] - fixed portal handling for P_CheckMissileSpawn to obey commonly established rules about portal types. --- src/p_mobj.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3f82c7190..e2646ade8 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -6718,7 +6718,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist) th->tics = 1; } - DVector3 newpos = th->Pos(); + DVector3 newpos = { 0,0,0 }; if (maxdist > 0) { @@ -6736,6 +6736,9 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist) newpos += advance; } + newpos = th->Vec3Offset(newpos); + th->SetXYZ(newpos); + FCheckPosition tm(!!(th->flags2 & MF2_RIP)); // killough 8/12/98: for non-missile objects (e.g. grenades) From b1d1ac13b6d721242df0e426c1067d33bb81c0b1 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 21 Jul 2017 11:17:50 +0300 Subject: [PATCH 11/77] Fixed serpent staff's alternate attack against shielding centaur https://forum.zdoom.org/viewtopic.php?t=57305 --- wadsrc/static/zscript/hexen/clericstaff.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/hexen/clericstaff.txt b/wadsrc/static/zscript/hexen/clericstaff.txt index 20efb0960..aa00cd3c9 100644 --- a/wadsrc/static/zscript/hexen/clericstaff.txt +++ b/wadsrc/static/zscript/hexen/clericstaff.txt @@ -82,7 +82,7 @@ class CWeapStaff : ClericWeapon { angle = t.angleFromSource; if (((t.linetarget.player && (!t.linetarget.IsTeammate(self) || level.teamdamage != 0)) || t.linetarget.bIsMonster) - && (!t.linetarget.bDormant && !bInvulnerable)) + && (!t.linetarget.bDormant && !t.linetarget.bInvulnerable)) { int newLife = player.health + (damage >> 3); newLife = newLife > max ? max : newLife; From 5be74890b7dcfdb8baba29487f81dbe199c2278f Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 21 Jul 2017 22:48:44 +0200 Subject: [PATCH 12/77] - Fix missing pixels on walls in palette mode for npot2 textures --- src/swrenderer/line/r_walldraw.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/swrenderer/line/r_walldraw.cpp b/src/swrenderer/line/r_walldraw.cpp index 8a639fec5..5a8a4f465 100644 --- a/src/swrenderer/line/r_walldraw.cpp +++ b/src/swrenderer/line/r_walldraw.cpp @@ -75,7 +75,7 @@ namespace swrenderer v *= height; v *= (1 << uv_fracbits); - uv_pos = (uint32_t)v; + uv_pos = (uint32_t)(int64_t)v; uv_step = xs_ToFixed(uv_fracbits, uv_stepd); if (uv_step == 0) // To prevent divide by zero elsewhere uv_step = 1; @@ -117,8 +117,8 @@ namespace swrenderer } // Convert to uint32_t: - uv_pos = (uint32_t)(v * 0x100000000LL); - uv_step = (uint32_t)(v_step * 0x100000000LL); + uv_pos = (uint32_t)(int64_t)(v * 0x100000000LL); + uv_step = (uint32_t)(int64_t)(v_step * 0x100000000LL); uv_max = 0; // Texture mipmap and filter selection: @@ -288,6 +288,7 @@ namespace swrenderer uint32_t uv_pos = sampler.uv_pos; uint32_t left = y2 - y1; + int y = y1; while (left > 0) { uint32_t available = sampler.uv_max - uv_pos; @@ -298,12 +299,13 @@ namespace swrenderer drawerargs.SetTexture(sampler.source, sampler.source2, sampler.height); drawerargs.SetTextureUPos(sampler.texturefracx); - drawerargs.SetDest(Thread->Viewport.get(), x, y1); + drawerargs.SetDest(Thread->Viewport.get(), x, y); drawerargs.SetCount(count); drawerargs.SetTextureVStep(sampler.uv_step); drawerargs.SetTextureVPos(uv_pos); drawerargs.DrawColumn(Thread); + y += count; left -= count; uv_pos += sampler.uv_step * count; if (uv_pos >= sampler.uv_max) From 8d95ee6882902bf5a5b46773f689beb6c7b4044e Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Fri, 21 Jul 2017 17:21:58 -0400 Subject: [PATCH 13/77] - 'Player' is turbo! cheat is no longer shown in single player. --- src/g_game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 183473d78..d48b40b6a 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1195,7 +1195,7 @@ void G_Ticker () } // check for turbo cheats - if (turbo > 100.f && cmd->ucmd.forwardmove > TURBOTHRESHOLD && + if (multiplayer && turbo > 100.f && cmd->ucmd.forwardmove > TURBOTHRESHOLD && !(gametic&31) && ((gametic>>5)&(MAXPLAYERS-1)) == i ) { Printf ("%s is turbo!\n", players[i].userinfo.GetName()); From 8d3d271484b42d40a9116993ac88d9ce84e130f6 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Fri, 21 Jul 2017 18:45:08 -0400 Subject: [PATCH 14/77] - tweaked the banded software lightmode shader a bit more, looks a little closer (but still not quite...) to real ZDoom in paletted mode --- wadsrc/static/shaders/glsl/main.fp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/shaders/glsl/main.fp b/wadsrc/static/shaders/glsl/main.fp index d3fd31882..2fb762bad 100644 --- a/wadsrc/static/shaders/glsl/main.fp +++ b/wadsrc/static/shaders/glsl/main.fp @@ -122,7 +122,7 @@ float R_DoomLightingEquation(float light) float shade = 2.0 - (L + 12.0) / 128.0; float lightscale; if ((uPalLightLevels & 0xff) != 0) - lightscale = float(-int(-(shade - vis) * 32.0)) / 32.0; + lightscale = float(-floor(-(shade - vis) * 31.0) - 0.5) / 31.0; else lightscale = shade - vis; From ebd20daed82113897109e3f69cfe42807a2f626c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 22 Jul 2017 01:45:06 +0200 Subject: [PATCH 15/77] - Fix wall texture sampling to be done at pixel centers --- src/swrenderer/line/r_line.cpp | 47 ++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/swrenderer/line/r_line.cpp b/src/swrenderer/line/r_line.cpp index d0eaa86d5..3f663defd 100644 --- a/src/swrenderer/line/r_line.cpp +++ b/src/swrenderer/line/r_line.cpp @@ -478,9 +478,9 @@ namespace swrenderer iend = 1 / iend; draw_segment->yscale = (float)yscale; draw_segment->iscale = (float)istart; - if (stop - start > 0) + if (stop - start > 1) { - draw_segment->iscalestep = float((iend - istart) / (stop - start)); + draw_segment->iscalestep = float((iend - istart) / (stop - start - 1)); } else { @@ -1292,45 +1292,58 @@ namespace swrenderer swapvalues(tleft.Y, tright.Y); } + float fsx1, fsz1, fsx2, fsz2; + if (tleft.X >= -tleft.Y) { if (tleft.X > tleft.Y) return true; // left edge is off the right side if (tleft.Y == 0) return true; - sx1 = xs_RoundToInt(viewport->CenterX + tleft.X * viewport->CenterX / tleft.Y); - sz1 = tleft.Y; + fsx1 = viewport->CenterX + tleft.X * viewport->CenterX / tleft.Y; + fsz1 = tleft.Y; } else { if (tright.X < -tright.Y) return true; // wall is off the left side float den = tleft.X - tright.X - tright.Y + tleft.Y; if (den == 0) return true; - sx1 = 0; - sz1 = tleft.Y + (tright.Y - tleft.Y) * (tleft.X + tleft.Y) / den; + fsx1 = 0; + fsz1 = tleft.Y + (tright.Y - tleft.Y) * (tleft.X + tleft.Y) / den; } - if (sz1 < too_close) + if (fsz1 < too_close) return true; if (tright.X <= tright.Y) { if (tright.X < -tright.Y) return true; // right edge is off the left side if (tright.Y == 0) return true; - sx2 = xs_RoundToInt(viewport->CenterX + tright.X * viewport->CenterX / tright.Y); - sz2 = tright.Y; + fsx2 = viewport->CenterX + tright.X * viewport->CenterX / tright.Y; + fsz2 = tright.Y; } else { if (tleft.X > tleft.Y) return true; // wall is off the right side float den = tright.Y - tleft.Y - tright.X + tleft.X; if (den == 0) return true; - sx2 = viewwidth; - sz2 = tleft.Y + (tright.Y - tleft.Y) * (tleft.X - tleft.Y) / den; + fsx2 = viewwidth; + fsz2 = tleft.Y + (tright.Y - tleft.Y) * (tleft.X - tleft.Y) / den; } - if (sz2 < too_close || sx2 <= sx1) + if (fsz2 < too_close) return true; - return false; + sx1 = xs_RoundToInt(fsx1); + sx2 = xs_RoundToInt(fsx2); + + float delta = fsx2 - fsx1; + float t1 = (sx1 + 0.5f - fsx1) / delta; + float t2 = (sx2 + 0.5f - fsx1) / delta; + float invZ1 = 1.0f / fsz1; + float invZ2 = 1.0f / fsz2; + sz1 = 1.0f / (invZ1 * (1.0f - t1) + invZ2 * t1); + sz2 = 1.0f / (invZ1 * (1.0f - t2) + invZ2 * t2); + + return sx2 <= sx1; } ///////////////////////////////////////////////////////////////////////// @@ -1346,9 +1359,9 @@ namespace swrenderer { swapvalues(left, right); } - UoverZorg = left->X * thread->Viewport->viewwindow.centerx; + UoverZorg = left->X * thread->Viewport->CenterX; UoverZstep = -left->Y; - InvZorg = (left->X - right->X) * thread->Viewport->viewwindow.centerx; + InvZorg = (left->X - right->X) * thread->Viewport->CenterX; InvZstep = right->Y - left->Y; } @@ -1371,9 +1384,9 @@ namespace swrenderer fullx2 = -fullx2; } - UoverZorg = float(fullx1 * viewport->viewwindow.centerx); + UoverZorg = float(fullx1 * viewport->CenterX); UoverZstep = float(-fully1); - InvZorg = float((fullx1 - fullx2) * viewport->viewwindow.centerx); + InvZorg = float((fullx1 - fullx2) * viewport->CenterX); InvZstep = float(fully2 - fully1); } } From c56cd245ac6aa35d11ec4a669b8a58c9c123a923 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 22 Jul 2017 10:54:32 +0300 Subject: [PATCH 16/77] Added IndexOf() and LastIndexOf() functions to ZScript string type https://forum.zdoom.org/viewtopic.php?t=57313 --- src/scripting/thingdef_data.cpp | 15 +++++++++++++++ wadsrc/static/zscript/base.txt | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 7cfa53504..f7b84f21b 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -1252,3 +1252,18 @@ DEFINE_ACTION_FUNCTION(FStringStruct, Filter) ACTION_RETURN_STRING(strbin1(*self)); } +DEFINE_ACTION_FUNCTION(FStringStruct, IndexOf) +{ + PARAM_SELF_STRUCT_PROLOGUE(FString); + PARAM_STRING(substr); + PARAM_INT_DEF(startIndex); + ACTION_RETURN_INT(self->IndexOf(substr, startIndex)); +} + +DEFINE_ACTION_FUNCTION(FStringStruct, LastIndexOf) +{ + PARAM_SELF_STRUCT_PROLOGUE(FString); + PARAM_STRING(substr); + ACTION_RETURN_INT(self->LastIndexOf(substr)); +} + diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index f35e39993..b2fd9c6c8 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -656,6 +656,8 @@ struct StringStruct native native String CharAt(int pos) const; native int CharCodeAt(int pos) const; native String Filter(); + native int IndexOf(String substr, int startIndex = 0) const; + native int LastIndexOf(String substr) const; } class SectorEffect : Thinker native From 3ff021608df8087253b3af1a1c8ea8d89b3189a3 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 22 Jul 2017 10:40:30 +0200 Subject: [PATCH 17/77] - Fix pixel center sampling bug in SWCanvas::DrawTexture --- src/swrenderer/r_swcanvas.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/swrenderer/r_swcanvas.cpp b/src/swrenderer/r_swcanvas.cpp index 88c0a6b29..0330d4d6e 100644 --- a/src/swrenderer/r_swcanvas.cpp +++ b/src/swrenderer/r_swcanvas.cpp @@ -128,7 +128,7 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms) // There is not enough precision in the drawing routines to keep the full // precision for y0. :( double sprtopscreen; - modf(y0, &sprtopscreen); + modf(y0 + 0.5, &sprtopscreen); double yscale = parms.destheight / img->GetHeight(); double iyscale = 1 / yscale; @@ -192,6 +192,8 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms) int x2_i = int(x2); fixed_t xiscale_i = FLOAT2FIXED(xiscale); + frac += xiscale_i / 2; + while (x < x2_i) { drawerargs.DrawMaskedColumn(&thread, x, iscale, img, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, !parms.masked); From 8311a18282a90fbc671cf3dccf40a780f4c05d03 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 22 Jul 2017 12:29:46 +0200 Subject: [PATCH 18/77] - Fix plane pixel center sampling bug --- src/swrenderer/plane/r_flatplane.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/swrenderer/plane/r_flatplane.cpp b/src/swrenderer/plane/r_flatplane.cpp index be0546d7f..513ce9ccc 100644 --- a/src/swrenderer/plane/r_flatplane.cpp +++ b/src/swrenderer/plane/r_flatplane.cpp @@ -108,7 +108,7 @@ namespace swrenderer planeang += M_PI / 2; double cosine = cos(planeang), sine = -sin(planeang); - x = pl->right - viewport->CenterX - 0.5; + x = pl->right - viewport->CenterX + 0.5; rightxfrac = _xscale * (cosine + x * xstep); rightyfrac = _yscale * (sine + x * ystep); x = pl->left - viewport->CenterX + 0.5; @@ -117,8 +117,16 @@ namespace swrenderer basexfrac = leftxfrac; baseyfrac = leftyfrac; - xstepscale = (rightxfrac - leftxfrac) / (pl->right - pl->left + 1); - ystepscale = (rightyfrac - leftyfrac) / (pl->right - pl->left + 1); + if (pl->left != pl->right) + { + xstepscale = (rightxfrac - leftxfrac) / (pl->right - pl->left); + ystepscale = (rightyfrac - leftyfrac) / (pl->right - pl->left); + } + else + { + xstepscale = 0; + ystepscale = 0; + } minx = pl->left; @@ -166,8 +174,8 @@ namespace swrenderer auto viewport = Thread->Viewport.get(); - double curxfrac = basexfrac + xstepscale * (x1 + 0.5 - minx); - double curyfrac = baseyfrac + ystepscale * (x1 + 0.5 - minx); + double curxfrac = basexfrac + xstepscale * (x1 - minx); + double curyfrac = baseyfrac + ystepscale * (x1 - minx); double distance = viewport->PlaneDepth(y, planeheight); From 04db49431081f51ef6b9bb101d4c295e0b1da6e9 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 22 Jul 2017 07:25:58 -0400 Subject: [PATCH 19/77] - 'kill baddies' cheat now describes what it is killing. This is mostly for multiplayer purposes when other players see the feedback when the cheat is used, allowing players to see if it was 'kill monsters' or 'kill baddies' --- src/m_cheat.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index aa7038fb1..ffba7a806 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -326,7 +326,8 @@ void cht_DoCheat (player_t *player, int cheat) int killcount = P_Massacre (cheat == CHT_MASSACRE2); // killough 3/22/98: make more intelligent about plural // Ty 03/27/98 - string(s) *not* externalized - mysnprintf (msgbuild, countof(msgbuild), "%d Monster%s Killed", killcount, killcount==1 ? "" : "s"); + mysnprintf (msgbuild, countof(msgbuild), "%d %s%s Killed", killcount, + cheat==CHT_MASSACRE2 ? "Baddie" : "Monster", killcount==1 ? "" : "s"); msg = msgbuild; } break; From a958d2ad723a4a2954a9fa8d439a4ab0055059df Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 22 Jul 2017 08:01:27 -0400 Subject: [PATCH 20/77] - fixed pixel centering for unaccelerated player sprites --- src/swrenderer/things/r_playersprite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/swrenderer/things/r_playersprite.cpp b/src/swrenderer/things/r_playersprite.cpp index e67f5d761..7df655743 100644 --- a/src/swrenderer/things/r_playersprite.cpp +++ b/src/swrenderer/things/r_playersprite.cpp @@ -539,7 +539,7 @@ namespace swrenderer thread->PrepareTexture(pic); for (int x = x1; x < x2; x++) { - drawerargs.DrawMaskedColumn(thread, x, iscale, pic, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false); + drawerargs.DrawMaskedColumn(thread, x, iscale, pic, frac + xiscale / 2, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false); frac += xiscale; } From 2e6c4eeab905f497a0265d48d207bfae7093469d Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 22 Jul 2017 08:25:39 -0400 Subject: [PATCH 21/77] - removed NOSAVE flags from sv_damagefactor* cvars so that they get put in a savegame --- src/p_interaction.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 1b3e0f028..4174a6aba 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -79,9 +79,9 @@ CVAR (Bool, cl_showsprees, true, CVAR_ARCHIVE) CVAR (Bool, cl_showmultikills, true, CVAR_ARCHIVE) EXTERN_CVAR (Bool, show_obituaries) -CVAR (Float, sv_damagefactormobj, 1.0, CVAR_SERVERINFO|CVAR_NOSAVE) -CVAR (Float, sv_damagefactorfriendly, 1.0, CVAR_SERVERINFO|CVAR_NOSAVE) -CVAR (Float, sv_damagefactorplayer, 1.0, CVAR_SERVERINFO|CVAR_NOSAVE) +CVAR (Float, sv_damagefactormobj, 1.0, CVAR_SERVERINFO) +CVAR (Float, sv_damagefactorfriendly, 1.0, CVAR_SERVERINFO) +CVAR (Float, sv_damagefactorplayer, 1.0, CVAR_SERVERINFO) FName MeansOfDeath; From c3702ae9e72fa7886f7eef4c3a89328487657d2e Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 9 Feb 2017 02:56:00 +0100 Subject: [PATCH 22/77] Add vid_scalemode support to GL framebuffer --- src/gl/renderer/gl_renderer.cpp | 3 ++- src/gl/system/gl_framebuffer.cpp | 22 +++++++++++----------- src/menu/videomenu.cpp | 31 +++++++++++++++++++++++++++++++ src/posix/cocoa/i_video.mm | 4 ++-- src/posix/sdl/hardware.cpp | 8 ++++---- src/win32/hardware.cpp | 8 ++++---- src/win32/win32gliface.cpp | 4 ++-- wadsrc/static/language.enu | 1 + wadsrc/static/menudef.txt | 8 ++++++++ 9 files changed, 65 insertions(+), 24 deletions(-) diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index bac55edb8..3e839ed4c 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -74,6 +74,7 @@ #include "gl/dynlights/gl_lightbuffer.h" EXTERN_CVAR(Int, screenblocks) +EXTERN_CVAR(Int, vid_scalemode) CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE); @@ -300,7 +301,7 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds) mSceneViewport.height = height; // Scale viewports to fit letterbox - if ((gl_scale_viewport && !framebuffer->IsFullscreen()) || !FGLRenderBuffers::IsEnabled()) + if ((gl_scale_viewport && !framebuffer->IsFullscreen() && vid_scalemode == 0) || !FGLRenderBuffers::IsEnabled()) { mScreenViewport.width = mOutputLetterbox.width; mScreenViewport.height = mOutputLetterbox.height; diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index a684f4c4c..ba08acaf2 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -55,6 +55,7 @@ EXTERN_CVAR (Float, vid_brightness) EXTERN_CVAR (Float, vid_contrast) EXTERN_CVAR (Bool, vid_vsync) +EXTERN_CVAR(Int, vid_scalemode) CVAR(Bool, gl_aalines, false, CVAR_ARCHIVE) @@ -63,6 +64,8 @@ FGLRenderer *GLRenderer; void gl_LoadExtensions(); void gl_PrintStartupLog(); void gl_SetupMenu(); +int ViewportScaledWidth(int width); +int ViewportScaledHeight(int height); CUSTOM_CVAR(Int, vid_hwgamma, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { @@ -180,18 +183,15 @@ void OpenGLFrameBuffer::Update() Unlock(); CheckBench(); - if (!IsFullscreen()) + int clientWidth = ViewportScaledWidth(IsFullscreen() ? VideoWidth : GetClientWidth()); + int clientHeight = ViewportScaledHeight(IsFullscreen() ? VideoHeight : GetClientHeight()); + if (clientWidth > 0 && clientHeight > 0 && (Width != clientWidth || Height != clientHeight)) { - int clientWidth = GetClientWidth(); - int clientHeight = GetClientHeight(); - if (clientWidth > 0 && clientHeight > 0 && (Width != clientWidth || Height != clientHeight)) - { - // Do not call Resize here because it's only for software canvases - Pitch = Width = clientWidth; - Height = clientHeight; - V_OutputResized(Width, Height); - GLRenderer->mVBO->OutputResized(Width, Height); - } + // Do not call Resize here because it's only for software canvases + Pitch = Width = clientWidth; + Height = clientHeight; + V_OutputResized(Width, Height); + GLRenderer->mVBO->OutputResized(Width, Height); } GLRenderer->SetOutputViewport(nullptr); diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index 5f139f0af..cc2f72fa6 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -123,6 +123,37 @@ CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) } } +CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +{ + if (self < 0 || self > 3) + { + self = 0; + } +} + +int ViewportScaledWidth(int width) +{ + switch (vid_scalemode) + { + default: + case 0: return width; + case 1: return 320; + case 2: return 640; + case 3: return (int)roundf(width * 0.5f); + } +} + +int ViewportScaledHeight(int height) +{ + switch (vid_scalemode) + { + default: + case 0: return height; + case 1: return 200; + case 2: return 400; + case 3: return (int)roundf(height * 0.5f); + } +} //============================================================================= // diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index d15a20737..ebfa45e3b 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -151,8 +151,8 @@ CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { extern int NewWidth, NewHeight, NewBits, DisplayBits; - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; setmodeneeded = true; } diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 20ff59325..8e5c44cf4 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -334,8 +334,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; setmodeneeded = true; } @@ -349,8 +349,8 @@ CUSTOM_CVAR (Float, vid_winscale, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) else if (Video) { Video->SetWindowedScale (self); - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; setmodeneeded = true; } diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index 599fe00a5..f27c318c4 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -434,8 +434,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) { - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; setmodeneeded = true; } @@ -449,8 +449,8 @@ CUSTOM_CVAR (Float, vid_winscale, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) else if (Video) { Video->SetWindowedScale (self); - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; //setmodeneeded = true; // This CVAR doesn't do anything and only causes problems! } diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 8071399db..77963a43b 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -1260,8 +1260,8 @@ void Win32GLFrameBuffer::NewRefreshRate () if (m_Fullscreen) { setmodeneeded = true; - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; } } diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 01d316c24..1edd84500 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -2191,6 +2191,7 @@ VIDMNU_HIDPI = "Retina/HiDPI support"; VIDMNU_ASPECTRATIO = "Aspect ratio"; VIDMNU_FORCEASPECT = "Force aspect ratio"; VIDMNU_5X4ASPECTRATIO = "Enable 5:4 aspect ratio"; +VIDMNU_SCALEMODE = "Resolution scale"; VIDMNU_ENTERTEXT = "Press ENTER to set mode"; VIDMNU_TESTTEXT1 = "T to test mode for 5 seconds"; VIDMNU_TESTTEXT2 = "Please wait 5 seconds..."; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 148238c9c..f0840fef1 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1849,6 +1849,13 @@ OptionValue RatiosTFT 6.0, "21:9" -1, "$OPTVAL_ALL" } +OptionValue ScaleModes +{ + 0, "$OPTVAL_OFF" + 1, "320x200" + 2, "640x400" + 3, "0.5x" +} OptionMenu VideoModeMenu protected { @@ -1862,6 +1869,7 @@ OptionMenu VideoModeMenu protected Option "$VIDMNU_ASPECTRATIO", "menu_screenratios", "Ratios" Option "$VIDMNU_FORCEASPECT", "vid_aspect", "ForceRatios" Option "$VIDMNU_5X4ASPECTRATIO", "vid_tft", "YesNo" + Option "$VIDMNU_SCALEMODE", "vid_scalemode", "ScaleModes" StaticText " " ScreenResolution "res_0" ScreenResolution "res_1" From 370e53befec4839c83807c595ca0bd925b9daf8c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 23 Jul 2017 04:23:13 +0200 Subject: [PATCH 23/77] - Replace vid_max_width and vid_max_height with vid_scalemode for the GL software framebuffer backend - Fix a crash if the window was resized before creating a game - Fix main menu scaling being wrong if the video mode didn't match the unscaled screen size --- src/gl/system/gl_swframebuffer.cpp | 26 ++++++++++++++------------ src/v_video.cpp | 7 +++++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index c0ed43211..c426e01e4 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -94,15 +94,6 @@ EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Bool, gl_legacy_mode) -CVAR(Int, vid_max_width, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) -CVAR(Int, vid_max_height, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) - -namespace -{ - int ClampWidth(int width) { return (vid_max_width == 0 || width < vid_max_width) ? width : vid_max_width; } - int ClampHeight(int height) { return (vid_max_height == 0 || height < vid_max_height) ? height : vid_max_height; } -} - #ifdef WIN32 extern cycle_t BlitCycles; #endif @@ -110,6 +101,9 @@ extern cycle_t BlitCycles; void gl_LoadExtensions(); void gl_PrintStartupLog(); +int ViewportScaledWidth(int width); +int ViewportScaledHeight(int height); + #ifndef WIN32 // This has to be in this file because system headers conflict Doom headers DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen) @@ -147,7 +141,7 @@ const char *const OpenGLSWFrameBuffer::ShaderDefines[OpenGLSWFrameBuffer::NUM_SH }; OpenGLSWFrameBuffer::OpenGLSWFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra) : - Super(hMonitor, ClampWidth(width), ClampHeight(height), bits, refreshHz, fullscreen, bgra) + Super(hMonitor, width, height, bits, refreshHz, fullscreen, bgra) { VertexBuffer = nullptr; IndexBuffer = nullptr; @@ -1174,6 +1168,14 @@ void OpenGLSWFrameBuffer::Unlock() else if (--m_Lock == 0) { Buffer = nullptr; + + if (MappedMemBuffer) + { + BindFBBuffer(); + glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + MappedMemBuffer = nullptr; + } } } @@ -1283,8 +1285,8 @@ void OpenGLSWFrameBuffer::Flip() if (!IsFullscreen()) { - int clientWidth = ClampWidth(GetClientWidth()); - int clientHeight = ClampHeight(GetClientHeight()); + int clientWidth = ViewportScaledWidth(GetClientWidth()); + int clientHeight = ViewportScaledHeight(GetClientHeight()); if (clientWidth > 0 && clientHeight > 0 && (Width != clientWidth || Height != clientHeight)) { Resize(clientWidth, clientHeight); diff --git a/src/v_video.cpp b/src/v_video.cpp index 44f634d00..028973aac 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -88,6 +88,9 @@ EXTERN_CVAR(Bool, r_blendmethod) int active_con_scale(); +int ViewportScaledWidth(int width); +int ViewportScaledHeight(int height); + FRenderer *Renderer; EXTERN_CVAR (Bool, swtruecolor) @@ -782,7 +785,7 @@ void DSimpleCanvas::Unlock () //========================================================================== DFrameBuffer::DFrameBuffer (int width, int height, bool bgra) - : DSimpleCanvas (width, height, bgra) + : DSimpleCanvas (ViewportScaledWidth(width), ViewportScaledHeight(height), bgra) { LastMS = LastSec = FrameCount = LastCount = LastTic = 0; Accel2D = false; @@ -1289,7 +1292,7 @@ bool V_DoModeSetup (int width, int height, int bits) FFont::StaticPreloadFonts(); DisplayBits = bits; - V_UpdateModeSize(width, height); + V_UpdateModeSize(screen->GetWidth(), screen->GetHeight()); M_RefreshModesList (); From 28e6477a0324319b607c55ba4e321de615531d60 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 23 Jul 2017 11:52:31 +0300 Subject: [PATCH 24/77] Made Lemon's dynamic stack size compatible with C++ --- tools/lemon/lempar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lemon/lempar.c b/tools/lemon/lempar.c index 93b612017..59708e222 100644 --- a/tools/lemon/lempar.c +++ b/tools/lemon/lempar.c @@ -296,10 +296,10 @@ static int yyGrowStack(yyParser *p){ newSize = p->yystksz*2 + 100; idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; if( p->yystack==&p->yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); + pNew = (yyStackEntry *)malloc(newSize*sizeof(pNew[0])); if( pNew ) pNew[0] = p->yystk0; }else{ - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + pNew = (yyStackEntry *)realloc(p->yystack, newSize*sizeof(pNew[0])); } if( pNew ){ p->yystack = pNew; From 7436693860786a38f4cd44431b8551b3ede5a4f4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 23 Jul 2017 11:53:44 +0300 Subject: [PATCH 25/77] Enabled dynamic stack size in ZScript parser generated by Lemon https://forum.zdoom.org/viewtopic.php?t=57322 --- src/scripting/zscript/zcc-parse.lemon | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scripting/zscript/zcc-parse.lemon b/src/scripting/zscript/zcc-parse.lemon index cd630298b..34ebd9149 100644 --- a/src/scripting/zscript/zcc-parse.lemon +++ b/src/scripting/zscript/zcc-parse.lemon @@ -34,6 +34,7 @@ */ +%stack_size 0 %include { From b30b93f40f03051aea6dd73f1da7d6bdbc287f0e Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 23 Jul 2017 06:09:20 -0400 Subject: [PATCH 26/77] - made postprocess shader parsing a little more strict, will error out more frequently with common mistakes. --- src/gl/shaders/gl_shader.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index b0b3ea32b..c508fd301 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -683,6 +683,13 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump) PostProcessShader shaderdesc; shaderdesc.Target = sc.String; + bool validTarget = false; + if (sc.Compare("beforebloom")) validTarget = true; + if (sc.Compare("scene")) validTarget = true; + if (sc.Compare("screen")) validTarget = true; + if (!validTarget) + sc.ScriptError("Invalid target '%s' for postprocess shader",sc.String); + sc.MustGetToken('{'); while (!sc.CheckToken('}')) { @@ -694,6 +701,8 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump) sc.MustGetNumber(); shaderdesc.ShaderVersion = sc.Number; + if (sc.Number > 450 || sc.Number < 330) + sc.ScriptError("Shader version must be in range 330 to 450!"); } else if (sc.Compare("name")) { @@ -719,6 +728,8 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump) parsedType = PostProcessUniformType::Vec2; else if (uniformType.Compare("vec3") == 0) parsedType = PostProcessUniformType::Vec3; + else + sc.ScriptError("Unrecognized uniform type '%s'", sc.String); if (parsedType != PostProcessUniformType::Undefined) shaderdesc.Uniforms[uniformName].Type = parsedType; @@ -727,6 +738,10 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump) { shaderdesc.Enabled = true; } + else + { + sc.ScriptError("Unknown keyword '%s'", sc.String); + } } PostProcessShaders.Push(shaderdesc); From 45a37211e478459a7735903084f9edb423157601 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 23 Jul 2017 10:49:13 -0400 Subject: [PATCH 27/77] - added special handling for vid_scalemode == [1||2] to force video aspect scaling off unless the user explicitly specified an aspect override. --- src/v_video.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/v_video.cpp b/src/v_video.cpp index 028973aac..24fbab68f 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1604,6 +1604,7 @@ CUSTOM_CVAR (Bool, vid_nowidescreen, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) } } +EXTERN_CVAR (Int, vid_scalemode) CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) { setsizeneeded = true; @@ -1630,6 +1631,10 @@ int ActiveFakeRatio(int width, int height) fakeratio = 3; } } + else if (vid_aspect == 0 && (vid_scalemode == 1 || vid_scalemode == 2)) + { + fakeratio = 0; + } if (vid_nowidescreen) { if (!vid_tft) From 449c4cb7116af5fedb0cdd222cdf81f47ec079d2 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 23 Jul 2017 17:18:25 +0200 Subject: [PATCH 28/77] - Pixel stretch 320x200 and 640x400 scale modes in the GL renderer --- src/gl/renderer/gl_renderer.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 3e839ed4c..4951d4905 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -282,9 +282,19 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds) } int screenWidth = framebuffer->GetWidth(); int screenHeight = framebuffer->GetHeight(); - float scale = MIN(clientWidth / (float)screenWidth, clientHeight / (float)screenHeight); - mOutputLetterbox.width = (int)round(screenWidth * scale); - mOutputLetterbox.height = (int)round(screenHeight * scale); + float scaleX, scaleY; + if (vid_scalemode == 1 || vid_scalemode == 2) + { + scaleX = MIN(clientWidth / (float)screenWidth, clientHeight / (screenHeight * 1.2f)); + scaleY = scaleX * 1.2f; + } + else + { + scaleX = MIN(clientWidth / (float)screenWidth, clientHeight / (float)screenHeight); + scaleY = scaleX; + } + mOutputLetterbox.width = (int)round(screenWidth * scaleX); + mOutputLetterbox.height = (int)round(screenHeight * scaleY); mOutputLetterbox.left = (clientWidth - mOutputLetterbox.width) / 2; mOutputLetterbox.top = (clientHeight - mOutputLetterbox.height) / 2; @@ -305,10 +315,10 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds) { mScreenViewport.width = mOutputLetterbox.width; mScreenViewport.height = mOutputLetterbox.height; - mSceneViewport.left = (int)round(mSceneViewport.left * scale); - mSceneViewport.top = (int)round(mSceneViewport.top * scale); - mSceneViewport.width = (int)round(mSceneViewport.width * scale); - mSceneViewport.height = (int)round(mSceneViewport.height * scale); + mSceneViewport.left = (int)round(mSceneViewport.left * scaleX); + mSceneViewport.top = (int)round(mSceneViewport.top * scaleY); + mSceneViewport.width = (int)round(mSceneViewport.width * scaleX); + mSceneViewport.height = (int)round(mSceneViewport.height * scaleY); // Without render buffers we have to render directly to the letterbox if (!FGLRenderBuffers::IsEnabled()) From 2f37c4b272f9c248e46aaefd7e9939356e4e0d96 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 23 Jul 2017 11:24:04 -0400 Subject: [PATCH 29/77] - added vid_scalemode == 4 to super-sample the screen --- src/gl/renderer/gl_postprocess.cpp | 14 ++++++++++++-- src/gl/system/gl_swframebuffer.cpp | 12 ++++++++++++ src/menu/videomenu.cpp | 9 ++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 0fff62198..6f863ec65 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -153,6 +153,8 @@ EXTERN_CVAR(Float, vid_contrast) EXTERN_CVAR(Float, vid_saturation) EXTERN_CVAR(Int, gl_satformula) +extern bool bSuperSampled; + void FGLRenderer::RenderScreenQuad() { mVBO->BindVBO(); @@ -854,8 +856,16 @@ void FGLRenderer::DrawPresentTexture(const GL_IRECT &box, bool applyGamma) glViewport(box.left, box.top, box.width, box.height); glActiveTexture(GL_TEXTURE0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + if (bSuperSampled) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } mPresentShader->Bind(); mPresentShader->InputTexture.Set(0); diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index c426e01e4..6a9a92172 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -94,6 +94,8 @@ EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Bool, gl_legacy_mode) +extern bool bSuperSampled; + #ifdef WIN32 extern cycle_t BlitCycles; #endif @@ -751,6 +753,16 @@ void OpenGLSWFrameBuffer::Present() glBindFramebuffer(GL_FRAMEBUFFER, OutputFB->Framebuffer); glViewport(0, 0, Width, Height); + if (bSuperSampled) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } } //========================================================================== diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index cc2f72fa6..4c77f83fd 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -79,6 +79,7 @@ int testingmode; // Holds time to revert to old mode int OldWidth, OldHeight, OldBits; static FIntCVar DummyDepthCvar (NULL, 0, 0); static uint8_t BitTranslate[32]; +bool bSuperSampled = false; // is this mode supersampled? CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE) { @@ -125,10 +126,14 @@ CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { - if (self < 0 || self > 3) + if (self < 0 || self > 4) { self = 0; } + if (self == 4) // [SP] hack, for now, but we might add custom modes later and special handling will be needed for that... + bSuperSampled = true; + else + bSuperSampled = false; } int ViewportScaledWidth(int width) @@ -140,6 +145,7 @@ int ViewportScaledWidth(int width) case 1: return 320; case 2: return 640; case 3: return (int)roundf(width * 0.5f); + case 4: return (int)(width * 2.0f); } } @@ -152,6 +158,7 @@ int ViewportScaledHeight(int height) case 1: return 200; case 2: return 400; case 3: return (int)roundf(height * 0.5f); + case 4: return (int)(height * 2.0f); } } From 18f0f6be4b150ce609951994142e1959e848e04e Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 23 Jul 2017 17:26:55 +0200 Subject: [PATCH 30/77] - Pixel stretch for 320x200 and 640x400 in glswfb --- src/gl/system/gl_swframebuffer.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index 6a9a92172..e80a0c7a5 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -93,6 +93,7 @@ EXTERN_CVAR(Bool, vid_vsync) EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Bool, gl_legacy_mode) +EXTERN_CVAR(Int, vid_scalemode) extern bool bSuperSampled; @@ -727,9 +728,20 @@ void OpenGLSWFrameBuffer::Present() glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport(0, 0, clientWidth, clientHeight); - float scale = MIN(clientWidth / (float)Width, clientHeight / (float)Height); - int letterboxWidth = (int)round(Width * scale); - int letterboxHeight = (int)round(Height * scale); + float scaleX, scaleY; + if (vid_scalemode == 1 || vid_scalemode == 2) + { + scaleX = MIN(clientWidth / (float)Width, clientHeight / (Height * 1.2f)); + scaleY = scaleX * 1.2f; + } + else + { + scaleX = MIN(clientWidth / (float)Width, clientHeight / (float)Height); + scaleY = scaleX; + } + + int letterboxWidth = (int)round(Width * scaleX); + int letterboxHeight = (int)round(Height * scaleY); int letterboxX = (clientWidth - letterboxWidth) / 2; int letterboxY = (clientHeight - letterboxHeight) / 2; From 6c328ec7df1fed5f84dcb4e51b89da9af74b54fd Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 23 Jul 2017 11:29:06 -0400 Subject: [PATCH 31/77] - added SSAA menu entry --- wadsrc/static/menudef.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index f0840fef1..87fd67f6b 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1855,6 +1855,7 @@ OptionValue ScaleModes 1, "320x200" 2, "640x400" 3, "0.5x" + 4, "2x SSAA" } OptionMenu VideoModeMenu protected From 1a4cf161689e721a2681124c6be7175bda72ff2c Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 23 Jul 2017 20:54:03 +0200 Subject: [PATCH 32/77] - Fix swtruecolor cvar messing up the chosen video mode --- src/posix/cocoa/i_video.mm | 4 ++-- src/posix/sdl/hardware.cpp | 4 ++-- src/win32/hardware.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index ebfa45e3b..e0f1e6c68 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -140,8 +140,8 @@ CUSTOM_CVAR(Bool, swtruecolor, TRUECOLOR_DEFAULT, CVAR_ARCHIVE | CVAR_GLOBALCONF if (currentrenderer == 0) { extern int NewWidth, NewHeight, NewBits, DisplayBits; - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; setmodeneeded = true; } diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 8e5c44cf4..775f50fde 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -325,8 +325,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC // way to force a CreateFramebuffer call without a lot of refactoring. if (currentrenderer == 0) { - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; setmodeneeded = true; } diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index f27c318c4..57abe59f9 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -425,8 +425,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC // way to force a CreateFramebuffer call without a lot of refactoring. if (currentrenderer == 0) { - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; setmodeneeded = true; } From bf4d7234e14ad543c0acaa5a1cbd51a9603d2241 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 23 Jul 2017 22:04:00 +0200 Subject: [PATCH 33/77] - Increase MAXWIDTH and MAXHEIGHT defines to support supersampled 5K monitors --- src/menu/videomenu.cpp | 4 ++-- src/r_defs.h | 4 ++-- src/swrenderer/line/r_farclip_line.cpp | 2 +- src/swrenderer/scene/r_3dfloors.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index 4c77f83fd..bb9fbd624 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -145,7 +145,7 @@ int ViewportScaledWidth(int width) case 1: return 320; case 2: return 640; case 3: return (int)roundf(width * 0.5f); - case 4: return (int)(width * 2.0f); + case 4: return width * 2; } } @@ -158,7 +158,7 @@ int ViewportScaledHeight(int height) case 1: return 200; case 2: return 400; case 3: return (int)roundf(height * 0.5f); - case 4: return (int)(height * 2.0f); + case 4: return height * 2; } } diff --git a/src/r_defs.h b/src/r_defs.h index 411a3c078..1ac282cf9 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -52,8 +52,8 @@ struct seg_t; struct sector_t; class AActor; -#define MAXWIDTH 5760 -#define MAXHEIGHT 3600 +#define MAXWIDTH 12000 +#define MAXHEIGHT 5000 const uint16_t NO_INDEX = 0xffffu; const uint32_t NO_SIDE = 0xffffffffu; diff --git a/src/swrenderer/line/r_farclip_line.cpp b/src/swrenderer/line/r_farclip_line.cpp index 95e559a24..f000744c2 100644 --- a/src/swrenderer/line/r_farclip_line.cpp +++ b/src/swrenderer/line/r_farclip_line.cpp @@ -113,7 +113,7 @@ namespace swrenderer //walltop.Project(Thread->Viewport.get(), mFrontSector->ceilingplane, &WallC, mLineSegment, Thread->Portal->MirrorFlags & RF_XFLIP); wallbottom.Project(Thread->Viewport.get(), mFrontSector->floorplane, &WallC, mLineSegment, Thread->Portal->MirrorFlags & RF_XFLIP); - memcpy(walltop.ScreenY, wallbottom.ScreenY, sizeof(short) * MAXWIDTH); + memcpy(walltop.ScreenY, wallbottom.ScreenY, sizeof(short) * Thread->Viewport->RenderTarget->GetWidth()); } ClipSegmentTopBottom(x1, x2); diff --git a/src/swrenderer/scene/r_3dfloors.cpp b/src/swrenderer/scene/r_3dfloors.cpp index 567660e9a..111cbf504 100644 --- a/src/swrenderer/scene/r_3dfloors.cpp +++ b/src/swrenderer/scene/r_3dfloors.cpp @@ -142,8 +142,8 @@ namespace swrenderer curr = (ClipStack*)M_Malloc(sizeof(ClipStack)); curr->next = 0; - memcpy(curr->floorclip, Thread->OpaquePass->floorclip, sizeof(short) * MAXWIDTH); - memcpy(curr->ceilingclip, Thread->OpaquePass->ceilingclip, sizeof(short) * MAXWIDTH); + memcpy(curr->floorclip, Thread->OpaquePass->floorclip, sizeof(short) * Thread->Viewport->RenderTarget->GetWidth()); + memcpy(curr->ceilingclip, Thread->OpaquePass->ceilingclip, sizeof(short) * Thread->Viewport->RenderTarget->GetWidth()); curr->ffloor = fakeFloor; assert(fakeFloor->floorclip == nullptr); assert(fakeFloor->ceilingclip == nullptr); From 1ce3b4c79cadc95fcc8a4cd64131d56768725d0f Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 23 Jul 2017 23:45:43 +0200 Subject: [PATCH 34/77] - Fix dynamic light clamping issue in truecolor drawers --- src/swrenderer/drawers/r_draw_span32.h | 4 ++++ src/swrenderer/drawers/r_draw_span32_sse2.h | 2 ++ src/swrenderer/drawers/r_draw_wall32.h | 4 ++++ src/swrenderer/drawers/r_draw_wall32_sse2.h | 2 ++ 4 files changed, 12 insertions(+) diff --git a/src/swrenderer/drawers/r_draw_span32.h b/src/swrenderer/drawers/r_draw_span32.h index dfbfb813e..15f24ffcf 100644 --- a/src/swrenderer/drawers/r_draw_span32.h +++ b/src/swrenderer/drawers/r_draw_span32.h @@ -355,6 +355,10 @@ namespace swrenderer lit.b += (light_color.b * attenuation) >> 8; } + lit.r = MIN(lit.r, 256); + lit.g = MIN(lit.g, 256); + lit.b = MIN(lit.b, 256); + fgcolor.r = MIN(fgcolor.r + ((material.r * lit.r) >> 8), 255); fgcolor.g = MIN(fgcolor.g + ((material.g * lit.g) >> 8), 255); fgcolor.b = MIN(fgcolor.b + ((material.b * lit.b) >> 8), 255); diff --git a/src/swrenderer/drawers/r_draw_span32_sse2.h b/src/swrenderer/drawers/r_draw_span32_sse2.h index 8d7cc28c4..92a50f0ff 100644 --- a/src/swrenderer/drawers/r_draw_span32_sse2.h +++ b/src/swrenderer/drawers/r_draw_span32_sse2.h @@ -399,6 +399,8 @@ namespace swrenderer lit = _mm_add_epi16(lit, _mm_srli_epi16(_mm_mullo_epi16(light_color, attenuation), 8)); } + lit = _mm_min_epi16(lit, _mm_set1_epi16(256)); + fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, lit), 8)); fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255)); return fgcolor; diff --git a/src/swrenderer/drawers/r_draw_wall32.h b/src/swrenderer/drawers/r_draw_wall32.h index b39379528..972d5c1da 100644 --- a/src/swrenderer/drawers/r_draw_wall32.h +++ b/src/swrenderer/drawers/r_draw_wall32.h @@ -269,6 +269,10 @@ namespace swrenderer lit.b += (light_color.b * attenuation) >> 8; } + lit.r = MIN(lit.r, 256); + lit.g = MIN(lit.g, 256); + lit.b = MIN(lit.b, 256); + fgcolor.r = MIN(fgcolor.r + ((material.r * lit.r) >> 8), 255); fgcolor.g = MIN(fgcolor.g + ((material.g * lit.g) >> 8), 255); fgcolor.b = MIN(fgcolor.b + ((material.b * lit.b) >> 8), 255); diff --git a/src/swrenderer/drawers/r_draw_wall32_sse2.h b/src/swrenderer/drawers/r_draw_wall32_sse2.h index 8ac116da4..e51c11165 100644 --- a/src/swrenderer/drawers/r_draw_wall32_sse2.h +++ b/src/swrenderer/drawers/r_draw_wall32_sse2.h @@ -315,6 +315,8 @@ namespace swrenderer lit = _mm_add_epi16(lit, _mm_srli_epi16(_mm_mullo_epi16(light_color, attenuation), 8)); } + lit = _mm_min_epi16(lit, _mm_set1_epi16(256)); + fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, lit), 8)); fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255)); return fgcolor; From e06f87cf10082e1b0df1f0e6d6a12ead2263a8e5 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 24 Jul 2017 08:35:27 +0200 Subject: [PATCH 35/77] - Added 0.75x scale mode --- src/gl/renderer/gl_postprocess.cpp | 4 ++-- src/gl/system/gl_swframebuffer.cpp | 24 +++++++++++++----------- src/menu/videomenu.cpp | 18 ++++++++++-------- wadsrc/static/menudef.txt | 3 ++- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 6f863ec65..bf054db6d 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -153,7 +153,7 @@ EXTERN_CVAR(Float, vid_contrast) EXTERN_CVAR(Float, vid_saturation) EXTERN_CVAR(Int, gl_satformula) -extern bool bSuperSampled; +bool ViewportLinearScale(); void FGLRenderer::RenderScreenQuad() { @@ -856,7 +856,7 @@ void FGLRenderer::DrawPresentTexture(const GL_IRECT &box, bool applyGamma) glViewport(box.left, box.top, box.width, box.height); glActiveTexture(GL_TEXTURE0); - if (bSuperSampled) + if (ViewportLinearScale()) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index e80a0c7a5..5d90b7725 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -95,7 +95,7 @@ EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Bool, gl_legacy_mode) EXTERN_CVAR(Int, vid_scalemode) -extern bool bSuperSampled; +bool ViewportLinearScale(); #ifdef WIN32 extern cycle_t BlitCycles; @@ -751,6 +751,18 @@ void OpenGLSWFrameBuffer::Present() FBVERTEX verts[4]; CalcFullscreenCoords(verts, false, 0, 0xFFFFFFFF); SetTexture(0, OutputFB->Texture.get()); + + if (ViewportLinearScale()) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + SetPixelShader(Shaders[SHADER_GammaCorrection].get()); SetAlphaBlend(0); EnableAlphaTest(false); @@ -765,16 +777,6 @@ void OpenGLSWFrameBuffer::Present() glBindFramebuffer(GL_FRAMEBUFFER, OutputFB->Framebuffer); glViewport(0, 0, Width, Height); - if (bSuperSampled) - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else - { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } } //========================================================================== diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index bb9fbd624..dcf594f96 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -79,7 +79,6 @@ int testingmode; // Holds time to revert to old mode int OldWidth, OldHeight, OldBits; static FIntCVar DummyDepthCvar (NULL, 0, 0); static uint8_t BitTranslate[32]; -bool bSuperSampled = false; // is this mode supersampled? CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE) { @@ -126,14 +125,15 @@ CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { - if (self < 0 || self > 4) + if (self < 0 || self > 5) { self = 0; } - if (self == 4) // [SP] hack, for now, but we might add custom modes later and special handling will be needed for that... - bSuperSampled = true; - else - bSuperSampled = false; +} + +bool ViewportLinearScale() +{ + return vid_scalemode == 4 || vid_scalemode == 5; } int ViewportScaledWidth(int width) @@ -145,7 +145,8 @@ int ViewportScaledWidth(int width) case 1: return 320; case 2: return 640; case 3: return (int)roundf(width * 0.5f); - case 4: return width * 2; + case 4: return (int)roundf(width * 0.75f); + case 5: return width * 2; } } @@ -158,7 +159,8 @@ int ViewportScaledHeight(int height) case 1: return 200; case 2: return 400; case 3: return (int)roundf(height * 0.5f); - case 4: return height * 2; + case 4: return (int)roundf(height * 0.75f); + case 5: return height * 2; } } diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 87fd67f6b..66b58c2c4 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1855,7 +1855,8 @@ OptionValue ScaleModes 1, "320x200" 2, "640x400" 3, "0.5x" - 4, "2x SSAA" + 4, "0.75x" + 5, "2x SSAA" } OptionMenu VideoModeMenu protected From cd2a349c36cd4b949297bfc2a32df4e25e008188 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 24 Jul 2017 09:20:35 +0200 Subject: [PATCH 36/77] - fixed name generation for cached nodes to not contain any ':'. A colon inside a file name will cause Windows to write the data to an alternate data stream. --- src/p_glnodes.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index 9901f8d8a..36873f4ba 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -1013,6 +1013,7 @@ static FString CreateCacheName(MapData *map, bool create) if (create) CreatePath(path); lumpname.ReplaceChars('/', '%'); + lumpname.ReplaceChars(':', '$'); path << '/' << lumpname.Right(lumpname.Len() - separator - 1) << ".gzc"; return path; } From 28af2fe66b2c17246aad18c7b2bca9543b1e3aed Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Mon, 24 Jul 2017 10:33:44 -0400 Subject: [PATCH 37/77] - maxviewpitch now affects the 2.5D software renderer --- src/swrenderer/r_swrenderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swrenderer/r_swrenderer.cpp b/src/swrenderer/r_swrenderer.cpp index 93cfcb78f..026252dc8 100644 --- a/src/swrenderer/r_swrenderer.cpp +++ b/src/swrenderer/r_swrenderer.cpp @@ -251,8 +251,8 @@ void FSoftwareRenderer::DrawRemainingPlayerSprites() int FSoftwareRenderer::GetMaxViewPitch(bool down) { - const int MAX_DN_ANGLE = 56; // Max looking down angle - const int MAX_UP_ANGLE = 32; // Max looking up angle + int MAX_DN_ANGLE = MIN(56, (int)maxviewpitch); // Max looking down angle + int MAX_UP_ANGLE = MIN(32, (int)maxviewpitch); // Max looking up angle return (r_polyrenderer) ? int(maxviewpitch) : (down ? MAX_DN_ANGLE : ((cl_oldfreelooklimit) ? MAX_UP_ANGLE : MAX_DN_ANGLE)); } From b81a23c5e53ab810083d53ea6963a4e4db981d6f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 25 Jul 2017 08:14:09 +0200 Subject: [PATCH 38/77] - fixed return type of CountsAsKill. --- src/p_mobj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e2646ade8..3fff257ad 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -8328,7 +8328,7 @@ DEFINE_ACTION_FUNCTION(AActor, AccuracyFactor) DEFINE_ACTION_FUNCTION(AActor, CountsAsKill) { PARAM_SELF_PROLOGUE(AActor); - ACTION_RETURN_FLOAT(self->CountsAsKill()); + ACTION_RETURN_BOOL(self->CountsAsKill()); } DEFINE_ACTION_FUNCTION(AActor, IsZeroDamage) From d8c6966917ad207276a402aefec847703ec8c26e Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 25 Jul 2017 11:51:15 +0200 Subject: [PATCH 39/77] - Fixed startup crash on Linux --- src/posix/sdl/hardware.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index 775f50fde..eeb5f6ec4 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -332,7 +332,7 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC } } -CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) { NewWidth = screen->VideoWidth; NewHeight = screen->VideoHeight; From 6a4925172246fde2ec4dc58e32d24693fb29b2b0 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 25 Jul 2017 06:55:20 -0400 Subject: [PATCH 40/77] - ported Linux crash fix to Mac --- src/menu/videomenu.cpp | 4 ++-- src/posix/cocoa/i_video.mm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index dcf594f96..5fa2b08ec 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -141,7 +141,7 @@ int ViewportScaledWidth(int width) switch (vid_scalemode) { default: - case 0: return width; + case 0: return (width==0)?vid_defwidth:width; case 1: return 320; case 2: return 640; case 3: return (int)roundf(width * 0.5f); @@ -155,7 +155,7 @@ int ViewportScaledHeight(int height) switch (vid_scalemode) { default: - case 0: return height; + case 0: return (height==0)?vid_defheight:height; case 1: return 200; case 2: return 400; case 3: return (int)roundf(height * 0.5f); diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index e0f1e6c68..7a9222cd3 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -147,7 +147,7 @@ CUSTOM_CVAR(Bool, swtruecolor, TRUECOLOR_DEFAULT, CVAR_ARCHIVE | CVAR_GLOBALCONF } } -CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) +CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { extern int NewWidth, NewHeight, NewBits, DisplayBits; From e42500c07a43b7c3b3ee1f62d87f3e4896c3eacd Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 25 Jul 2017 07:34:26 -0400 Subject: [PATCH 41/77] Revert "- ported Linux crash fix to Mac" This reverts commit 6a4925172246fde2ec4dc58e32d24693fb29b2b0. --- src/menu/videomenu.cpp | 4 ++-- src/posix/cocoa/i_video.mm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index 5fa2b08ec..dcf594f96 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -141,7 +141,7 @@ int ViewportScaledWidth(int width) switch (vid_scalemode) { default: - case 0: return (width==0)?vid_defwidth:width; + case 0: return width; case 1: return 320; case 2: return 640; case 3: return (int)roundf(width * 0.5f); @@ -155,7 +155,7 @@ int ViewportScaledHeight(int height) switch (vid_scalemode) { default: - case 0: return (height==0)?vid_defheight:height; + case 0: return height; case 1: return 200; case 2: return 400; case 3: return (int)roundf(height * 0.5f); diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 7a9222cd3..e0f1e6c68 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -147,7 +147,7 @@ CUSTOM_CVAR(Bool, swtruecolor, TRUECOLOR_DEFAULT, CVAR_ARCHIVE | CVAR_GLOBALCONF } } -CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR(Bool, fullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) { extern int NewWidth, NewHeight, NewBits, DisplayBits; From 64e96c5f46f12745f5883fbafe580cdd34810e55 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 25 Jul 2017 05:59:10 +0100 Subject: [PATCH 42/77] OpenBSD support --- src/gl/system/gl_system.h | 2 +- src/m_alloc.cpp | 10 ++++++---- src/posix/i_system.h | 2 ++ src/posix/sdl/crashcatcher.c | 3 +-- src/posix/sdl/hardware.cpp | 6 +++--- src/posix/sdl/sdlglvideo.cpp | 2 +- src/posix/sdl/sdlvideo.cpp | 2 +- src/sound/i_music.cpp | 1 - .../mididevices/music_timiditypp_mididevice.cpp | 14 +++++++------- src/sound/musicformats/music_mus_midiout.cpp | 2 +- 10 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/gl/system/gl_system.h b/src/gl/system/gl_system.h index db7f1f890..a8dcd129e 100644 --- a/src/gl/system/gl_system.h +++ b/src/gl/system/gl_system.h @@ -15,7 +15,7 @@ #include #include #include -#if !defined(__APPLE__) && !defined(__FreeBSD__) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #include #endif #include diff --git a/src/m_alloc.cpp b/src/m_alloc.cpp index 3b601d716..bec5581e3 100644 --- a/src/m_alloc.cpp +++ b/src/m_alloc.cpp @@ -38,6 +38,8 @@ #elif defined(__APPLE__) #include #include +#elif defined(__OpenBSD__) +#include #else #include #endif @@ -52,14 +54,14 @@ #endif #if defined(__APPLE__) #define _msize(p) malloc_size(p) -#elif defined(__sun) +#elif __solaris__ || defined(__OpenBSD__) #define _msize(p) (*((size_t*)(p)-1)) #elif !defined(_WIN32) #define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD #endif #ifndef _DEBUG -#if !defined(__sun) +#if !__solaris__ && !defined(__OpenBSD__) void *M_Malloc(size_t size) { void *block = malloc(size); @@ -129,7 +131,7 @@ void *M_Realloc(void *memblock, size_t size) #include #endif -#if !defined(__sun) +#if !__solaris__ && !defined(__OpenBSD__) void *M_Malloc_Dbg(size_t size, const char *file, int lineno) { void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno); @@ -197,7 +199,7 @@ void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno) #endif #endif -#if !defined(__sun) +#if !__solaris__ && !defined(__OpenBSD__) void M_Free (void *block) { if (block != NULL) diff --git a/src/posix/i_system.h b/src/posix/i_system.h index 4d0577467..d56d53e2d 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -30,6 +30,8 @@ #include #include +#define __solaris__ (defined(__sun) || defined(__sun__) || defined(__SRV4) || defined(__srv4__)) + #include "doomtype.h" struct ticcmd_t; diff --git a/src/posix/sdl/crashcatcher.c b/src/posix/sdl/crashcatcher.c index 70c9e7b0c..11e5d179f 100644 --- a/src/posix/sdl/crashcatcher.c +++ b/src/posix/sdl/crashcatcher.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -15,7 +14,7 @@ #ifndef PR_SET_PTRACER #define PR_SET_PTRACER 0x59616d61 #endif -#elif defined (__APPLE__) || defined (__FreeBSD__) +#elif defined (__APPLE__) || defined (__FreeBSD__) || defined(__OpenBSD__) #include #endif diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index eeb5f6ec4..b46458370 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -241,7 +241,7 @@ void I_ClosestResolution (int *width, int *height, int bits) EXTERN_CVAR(Int, vid_maxfps); EXTERN_CVAR(Bool, cl_capfps); -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__OpenBSD__) Semaphore FPSLimitSemaphore; static void FPSLimitNotify(sigval val) @@ -334,8 +334,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) { - NewWidth = screen->VideoWidth; - NewHeight = screen->VideoHeight; + NewWidth = screen->GetWidth(); + NewHeight = screen->GetHeight(); NewBits = DisplayBits; setmodeneeded = true; } diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index 6401e52cf..f09767f58 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -535,7 +535,7 @@ void SDLGLFB::NewRefreshRate () void SDLGLFB::SwapBuffers() { -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__OpenBSD__) if (vid_maxfps && !cl_capfps) { SEMAPHORE_WAIT(FPSLimitSemaphore) diff --git a/src/posix/sdl/sdlvideo.cpp b/src/posix/sdl/sdlvideo.cpp index 828a47f74..905e2de78 100644 --- a/src/posix/sdl/sdlvideo.cpp +++ b/src/posix/sdl/sdlvideo.cpp @@ -227,7 +227,7 @@ void SDLFB::Update () DrawRateStuff (); -#ifndef __APPLE__ +#if !defined(__APPLE__) && !defined(__OpenBSD__) if(vid_maxfps && !cl_capfps) { SEMAPHORE_WAIT(FPSLimitSemaphore) diff --git a/src/sound/i_music.cpp b/src/sound/i_music.cpp index 8ee359e8f..b66e5d096 100644 --- a/src/sound/i_music.cpp +++ b/src/sound/i_music.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include "mus2midi.h" extern void ChildSigHandler (int signum); #endif diff --git a/src/sound/mididevices/music_timiditypp_mididevice.cpp b/src/sound/mididevices/music_timiditypp_mididevice.cpp index b6ba6997d..39a7dcb78 100644 --- a/src/sound/mididevices/music_timiditypp_mididevice.cpp +++ b/src/sound/mididevices/music_timiditypp_mididevice.cpp @@ -46,7 +46,7 @@ #include #include -#include +#include #include int ChildQuit; @@ -523,15 +523,15 @@ bool TimidityPPMIDIDevice::LaunchTimidity () } int forkres; - wordexp_t words = {}; + glob_t glb; - switch (wordexp (CommandLine.GetChars(), &words, 0)) + switch (glob (CommandLine.GetChars(), 0, NULL, &glb)) { case 0: // all good break; - case WRDE_NOSPACE: - wordfree (&words); + case GLOB_NOSPACE: + globfree (&glb); default: return false; } @@ -546,7 +546,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity () // freopen ("/dev/null", "w", stderr); close (WavePipe[1]); - execvp (words.we_wordv[0], words.we_wordv); + execvp (glb.gl_pathv[0], glb.gl_pathv); fprintf(stderr,"execvp failed\n"); _exit (0); // if execvp succeeds, we never get here } @@ -567,7 +567,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity () }*/ } - wordfree (&words); + globfree (&glb); return ChildProcess != -1; #endif // _WIN32 } diff --git a/src/sound/musicformats/music_mus_midiout.cpp b/src/sound/musicformats/music_mus_midiout.cpp index 955c293a7..8058944a7 100644 --- a/src/sound/musicformats/music_mus_midiout.cpp +++ b/src/sound/musicformats/music_mus_midiout.cpp @@ -33,7 +33,7 @@ // HEADER FILES ------------------------------------------------------------ -#if !defined(__FreeBSD__) && !defined(__APPLE__) +#if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(__OpenBSD__) #include #else #include From e0494b6f13edb1df52d2057909e0d73d9081e2a1 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 25 Jul 2017 08:09:01 -0400 Subject: [PATCH 43/77] - fixed an issue with previous commit that undid some scaling code --- src/posix/sdl/hardware.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/posix/sdl/hardware.cpp b/src/posix/sdl/hardware.cpp index b46458370..5e7ba4f1e 100644 --- a/src/posix/sdl/hardware.cpp +++ b/src/posix/sdl/hardware.cpp @@ -334,8 +334,8 @@ CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITC CUSTOM_CVAR (Bool, fullscreen, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL) { - NewWidth = screen->GetWidth(); - NewHeight = screen->GetHeight(); + NewWidth = screen->VideoWidth; + NewHeight = screen->VideoHeight; NewBits = DisplayBits; setmodeneeded = true; } From 4e14ed4e9eaaf9d189848e2df5a76d17b95738d3 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 14 Apr 2017 01:19:44 +0200 Subject: [PATCH 44/77] - Hook up model normals --- src/gl/data/gl_vertexbuffer.h | 11 ++++------- src/gl/models/gl_models.cpp | 2 +- src/gl/renderer/gl_renderstate.cpp | 2 +- src/gl/renderer/gl_renderstate.h | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/gl/data/gl_vertexbuffer.h b/src/gl/data/gl_vertexbuffer.h index a7e1cd666..c2715b8af 100644 --- a/src/gl/data/gl_vertexbuffer.h +++ b/src/gl/data/gl_vertexbuffer.h @@ -285,13 +285,10 @@ struct FModelVertex void SetNormal(float nx, float ny, float nz) { - /* - int inx = int(nx * 512); - int iny = int(ny * 512); - int inz = int(nz * 512); - packedNormal = 0x40000000 | ((inx & 1023) << 20) | ((iny & 1023) << 10) | (inz & 1023); - */ - packedNormal = 0; // Per-pixel lighting for models isn't implemented yet so leave this at 0 for now. + int inx = clamp(int(nx * 512), -512, 511); + int iny = clamp(int(ny * 512), -512, 511); + int inz = clamp(int(nz * 512), -512, 511); + packedNormal = /*0x40000000 |*/ ((inx & 1023) << 20) | ((iny & 1023) << 10) | (inz & 1023); } }; diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index 8adee7cf0..a118e20f2 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -248,7 +248,7 @@ unsigned int FModelVertexBuffer::SetupFrame(unsigned int frame1, unsigned int fr glVertexAttribPointer(VATTR_VERTEX, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].x); glVertexAttribPointer(VATTR_TEXCOORD, 2, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame1].u); glVertexAttribPointer(VATTR_VERTEX2, 3, GL_FLOAT, false, sizeof(FModelVertex), &VMO[frame2].x); - glVertexAttribPointer(VATTR_NORMAL, 4, GL_UNSIGNED_INT_2_10_10_10_REV, false, sizeof(FModelVertex), &VMO[frame2].packedNormal); + glVertexAttribPointer(VATTR_NORMAL, 4, GL_INT_2_10_10_10_REV, true, sizeof(FModelVertex), &VMO[frame2].packedNormal); } else { diff --git a/src/gl/renderer/gl_renderstate.cpp b/src/gl/renderer/gl_renderstate.cpp index 411b7fb69..67c9c21fa 100644 --- a/src/gl/renderer/gl_renderstate.cpp +++ b/src/gl/renderer/gl_renderstate.cpp @@ -280,7 +280,7 @@ bool FRenderState::ApplyShader() mModelMatrix.matrixToGL(activeShader->modelmatrix_index); VSMatrix norm; norm.computeNormalMatrix(mModelMatrix); - mNormalModelMatrix.matrixToGL(activeShader->normalmodelmatrix_index); + norm.matrixToGL(activeShader->normalmodelmatrix_index); activeShader->currentModelMatrixState = true; } else if (activeShader->currentModelMatrixState) diff --git a/src/gl/renderer/gl_renderstate.h b/src/gl/renderer/gl_renderstate.h index 2bef2ff91..241461e13 100644 --- a/src/gl/renderer/gl_renderstate.h +++ b/src/gl/renderer/gl_renderstate.h @@ -132,7 +132,6 @@ public: VSMatrix mModelMatrix; VSMatrix mTextureMatrix; VSMatrix mNormalViewMatrix; - VSMatrix mNormalModelMatrix; FRenderState() { From 200078430747952ec94d7a2cef7a4ff411b532d4 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 14 Apr 2017 02:01:27 +0200 Subject: [PATCH 45/77] - normalize the normal vector in the vertex shader because our vertex attribute uses a low precision format (10 bits) --- wadsrc/static/shaders/glsl/main.vp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/shaders/glsl/main.vp b/wadsrc/static/shaders/glsl/main.vp index f66ee7b04..9901fba3f 100644 --- a/wadsrc/static/shaders/glsl/main.vp +++ b/wadsrc/static/shaders/glsl/main.vp @@ -62,7 +62,7 @@ void main() gl_ClipDistance[4] = worldcoord.y + ((uSplitBottomPlane.w + uSplitBottomPlane.x * worldcoord.x + uSplitBottomPlane.y * worldcoord.z) * uSplitBottomPlane.z); } - vWorldNormal = NormalModelMatrix * aNormal; + vWorldNormal = NormalModelMatrix * normalize(aNormal); vEyeNormal = NormalViewMatrix * vWorldNormal; #endif From d2e0933a81cf469c0eab496fc2abadb44bfd7b71 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Fri, 14 Apr 2017 04:14:20 +0200 Subject: [PATCH 46/77] - Fix packed normal order bug --- src/gl/data/gl_vertexbuffer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gl/data/gl_vertexbuffer.h b/src/gl/data/gl_vertexbuffer.h index c2715b8af..b1bc60f0d 100644 --- a/src/gl/data/gl_vertexbuffer.h +++ b/src/gl/data/gl_vertexbuffer.h @@ -288,7 +288,8 @@ struct FModelVertex int inx = clamp(int(nx * 512), -512, 511); int iny = clamp(int(ny * 512), -512, 511); int inz = clamp(int(nz * 512), -512, 511); - packedNormal = /*0x40000000 |*/ ((inx & 1023) << 20) | ((iny & 1023) << 10) | (inz & 1023); + int inw = 0; + packedNormal = (inw << 30) | ((inz & 1023) << 20) | ((iny & 1023) << 10) | (inx & 1023); } }; From 012496ee98c7bf0b9f4d53379da26c63f5c6c3de Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 26 Jul 2017 13:32:45 -0400 Subject: [PATCH 47/77] - added cheat protection to sv_damagefactor* --- src/p_interaction.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 4174a6aba..edfe3f8b8 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -79,9 +79,9 @@ CVAR (Bool, cl_showsprees, true, CVAR_ARCHIVE) CVAR (Bool, cl_showmultikills, true, CVAR_ARCHIVE) EXTERN_CVAR (Bool, show_obituaries) -CVAR (Float, sv_damagefactormobj, 1.0, CVAR_SERVERINFO) -CVAR (Float, sv_damagefactorfriendly, 1.0, CVAR_SERVERINFO) -CVAR (Float, sv_damagefactorplayer, 1.0, CVAR_SERVERINFO) +CVAR (Float, sv_damagefactormobj, 1.0, CVAR_SERVERINFO|CVAR_CHEAT) +CVAR (Float, sv_damagefactorfriendly, 1.0, CVAR_SERVERINFO|CVAR_CHEAT) +CVAR (Float, sv_damagefactorplayer, 1.0, CVAR_SERVERINFO|CVAR_CHEAT) FName MeansOfDeath; From f1a6ef9cc85e51a9f42b85dcbffc1eb495a41132 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Wed, 26 Jul 2017 13:34:17 -0400 Subject: [PATCH 48/77] - changed sv_singleplayerrespawn from 'latch' to 'cheat' since it was originally coded before the CVAR_CHEAT flag was implemented. --- src/p_user.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.cpp b/src/p_user.cpp index 4d9ed3af2..f9b9dd4a6 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -103,7 +103,7 @@ static FRandom pr_skullpop ("SkullPop"); // [SP] Allows respawn in single player -CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_LATCH) +CVAR(Bool, sv_singleplayerrespawn, false, CVAR_SERVERINFO | CVAR_CHEAT) // Variables for prediction CVAR (Bool, cl_noprediction, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) From 30087f7cd7d64dde75c4f6e67ece85f333eaa929 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 27 Jul 2017 03:05:01 -0400 Subject: [PATCH 49/77] - cleaned up the video scale mode code a bit, in order to increase future flexibility. --- src/CMakeLists.txt | 1 + src/gl/renderer/gl_postprocess.cpp | 3 +- src/gl/renderer/gl_renderer.cpp | 4 +- src/gl/system/gl_framebuffer.cpp | 3 +- src/gl/system/gl_swframebuffer.cpp | 9 +--- src/menu/videomenu.cpp | 41 +--------------- src/r_videoscale.cpp | 77 ++++++++++++++++++++++++++++++ src/r_videoscale.h | 31 ++++++++++++ src/v_video.cpp | 4 +- 9 files changed, 118 insertions(+), 55 deletions(-) create mode 100644 src/r_videoscale.cpp create mode 100644 src/r_videoscale.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a1861d93f..1c5192a4a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -944,6 +944,7 @@ set (PCH_SOURCES portal.cpp r_utility.cpp r_sky.cpp + r_videoscale.cpp s_advsound.cpp s_environment.cpp s_playlist.cpp diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index bf054db6d..cea7cbb3f 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -65,6 +65,7 @@ #include "gl/shaders/gl_postprocessshader.h" #include "gl/renderer/gl_2ddrawer.h" #include "gl/stereo3d/gl_stereo3d.h" +#include "r_videoscale.h" //========================================================================== // @@ -153,8 +154,6 @@ EXTERN_CVAR(Float, vid_contrast) EXTERN_CVAR(Float, vid_saturation) EXTERN_CVAR(Int, gl_satformula) -bool ViewportLinearScale(); - void FGLRenderer::RenderScreenQuad() { mVBO->BindVBO(); diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 4951d4905..6795c9864 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -78,6 +78,8 @@ EXTERN_CVAR(Int, vid_scalemode) CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE); +bool ViewportIsScaled43(); + //=========================================================================== // // Renderer interface @@ -283,7 +285,7 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds) int screenWidth = framebuffer->GetWidth(); int screenHeight = framebuffer->GetHeight(); float scaleX, scaleY; - if (vid_scalemode == 1 || vid_scalemode == 2) + if (ViewportIsScaled43()) { scaleX = MIN(clientWidth / (float)screenWidth, clientHeight / (screenHeight * 1.2f)); scaleY = scaleX * 1.2f; diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index ba08acaf2..73b81bd2c 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -51,6 +51,7 @@ #include "gl/gl_functions.h" #include "gl/renderer/gl_2ddrawer.h" #include "gl_debug.h" +#include "r_videoscale.h" EXTERN_CVAR (Float, vid_brightness) EXTERN_CVAR (Float, vid_contrast) @@ -64,8 +65,6 @@ FGLRenderer *GLRenderer; void gl_LoadExtensions(); void gl_PrintStartupLog(); void gl_SetupMenu(); -int ViewportScaledWidth(int width); -int ViewportScaledHeight(int height); CUSTOM_CVAR(Int, vid_hwgamma, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index 5d90b7725..dd552f6df 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -68,6 +68,7 @@ #include "gl/utility/gl_templates.h" #include "gl/gl_functions.h" #include "gl_debug.h" +#include "r_videoscale.h" #include "swrenderer/scene/r_light.h" @@ -93,9 +94,6 @@ EXTERN_CVAR(Bool, vid_vsync) EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Bool, gl_legacy_mode) -EXTERN_CVAR(Int, vid_scalemode) - -bool ViewportLinearScale(); #ifdef WIN32 extern cycle_t BlitCycles; @@ -104,9 +102,6 @@ extern cycle_t BlitCycles; void gl_LoadExtensions(); void gl_PrintStartupLog(); -int ViewportScaledWidth(int width); -int ViewportScaledHeight(int height); - #ifndef WIN32 // This has to be in this file because system headers conflict Doom headers DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen) @@ -729,7 +724,7 @@ void OpenGLSWFrameBuffer::Present() glViewport(0, 0, clientWidth, clientHeight); float scaleX, scaleY; - if (vid_scalemode == 1 || vid_scalemode == 2) + if (ViewportIsScaled43()) { scaleX = MIN(clientWidth / (float)Width, clientHeight / (Height * 1.2f)); scaleY = scaleX * 1.2f; diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index dcf594f96..7d434843b 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -54,6 +54,7 @@ #include "sbar.h" #include "hardware.h" #include "vm.h" +#include "r_videoscale.h" /*======================================= * @@ -123,46 +124,6 @@ CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) } } -CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -{ - if (self < 0 || self > 5) - { - self = 0; - } -} - -bool ViewportLinearScale() -{ - return vid_scalemode == 4 || vid_scalemode == 5; -} - -int ViewportScaledWidth(int width) -{ - switch (vid_scalemode) - { - default: - case 0: return width; - case 1: return 320; - case 2: return 640; - case 3: return (int)roundf(width * 0.5f); - case 4: return (int)roundf(width * 0.75f); - case 5: return width * 2; - } -} - -int ViewportScaledHeight(int height) -{ - switch (vid_scalemode) - { - default: - case 0: return height; - case 1: return 200; - case 2: return 400; - case 3: return (int)roundf(height * 0.5f); - case 4: return (int)roundf(height * 0.75f); - case 5: return height * 2; - } -} //============================================================================= // diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp new file mode 100644 index 000000000..d602062ae --- /dev/null +++ b/src/r_videoscale.cpp @@ -0,0 +1,77 @@ +// +//--------------------------------------------------------------------------- +// +// Copyright(C) 2017 Magnus Norddahl +// Copyright(C) 2017 Rachael Alexanderson +// All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see http://www.gnu.org/licenses/ +// +//-------------------------------------------------------------------------- +// + +#include "c_dispatch.h" +#include "c_cvars.h" + +CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) +{ + if (self < 0 || self > 5) + { + self = 0; + } +} + +bool ViewportLinearScale() +{ + return vid_scalemode == 4 || vid_scalemode == 5; +} + +int ViewportScaledWidth(int width) +{ + switch (vid_scalemode) + { + default: + case 0: return width; + case 1: return 320; + case 2: return 640; + case 3: return (int)roundf(width * 0.5f); + case 4: return (int)roundf(width * 0.75f); + case 5: return width * 2; + } +} + +int ViewportScaledHeight(int height) +{ + switch (vid_scalemode) + { + default: + case 0: return height; + case 1: return 200; + case 2: return 400; + case 3: return (int)roundf(height * 0.5f); + case 4: return (int)roundf(height * 0.75f); + case 5: return height * 2; + } +} + +bool ViewportIsScaled43() +{ + switch (vid_scalemode) + { + default: return false; + case 1: + case 2: return true; + } +} + diff --git a/src/r_videoscale.h b/src/r_videoscale.h new file mode 100644 index 000000000..002fc7c38 --- /dev/null +++ b/src/r_videoscale.h @@ -0,0 +1,31 @@ +// +//--------------------------------------------------------------------------- +// +// Copyright(C) 2017 Magnus Norddahl +// Copyright(C) 2017 Rachael Alexanderson +// All rights reserved. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see http://www.gnu.org/licenses/ +// +//-------------------------------------------------------------------------- +// + +#ifndef __VIDEOSCALE_H__ +#define __VIDEOSCALE_H__ +EXTERN_CVAR (Int, vid_scalemode) +bool ViewportLinearScale(); +int ViewportScaledWidth(int width); +int ViewportScaledHeight(int height); +bool ViewportIsScaled43(); +#endif //__VIDEOSCALE_H__ \ No newline at end of file diff --git a/src/v_video.cpp b/src/v_video.cpp index 24fbab68f..182abde17 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -83,14 +83,12 @@ #include "menu/menu.h" #include "r_data/voxels.h" #include "vm.h" +#include "r_videoscale.h" EXTERN_CVAR(Bool, r_blendmethod) int active_con_scale(); -int ViewportScaledWidth(int width); -int ViewportScaledHeight(int height); - FRenderer *Renderer; EXTERN_CVAR (Bool, swtruecolor) From 16e38816bab500d24acdaec6606b058d7c8ef295 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 27 Jul 2017 03:07:19 -0400 Subject: [PATCH 50/77] - oops, forgot one thing in the last commit... --- src/gl/renderer/gl_renderer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 6795c9864..056eead16 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -78,8 +78,6 @@ EXTERN_CVAR(Int, vid_scalemode) CVAR(Bool, gl_scale_viewport, true, CVAR_ARCHIVE); -bool ViewportIsScaled43(); - //=========================================================================== // // Renderer interface From 030450b6a9c1be81366d94a21127c5713fd4929a Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 27 Jul 2017 03:08:42 -0400 Subject: [PATCH 51/77] - fixed: include missing header --- src/gl/renderer/gl_renderer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index 056eead16..af910921b 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -72,6 +72,7 @@ #include "gl/utility/gl_templates.h" #include "gl/models/gl_models.h" #include "gl/dynlights/gl_lightbuffer.h" +#include "r_videoscale.h" EXTERN_CVAR(Int, screenblocks) EXTERN_CVAR(Int, vid_scalemode) From 5795e0fd3e2f8eb2aa42e9cfdbb47337cc03ab7d Mon Sep 17 00:00:00 2001 From: raa-eruanna Date: Thu, 27 Jul 2017 03:37:01 -0400 Subject: [PATCH 52/77] - included another header in order to fix an error reported by travis ci --- src/r_videoscale.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index d602062ae..55205e7b7 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -21,6 +21,7 @@ //-------------------------------------------------------------------------- // +#include #include "c_dispatch.h" #include "c_cvars.h" From 10e1600faf6282eaf5335138bc9fca792a85b773 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 27 Jul 2017 12:14:51 -0400 Subject: [PATCH 53/77] - Replaced one more vid_scalemode check with a more versatile ViewportIsScaled43 check --- src/v_video.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/v_video.cpp b/src/v_video.cpp index 182abde17..4bbe646ad 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1602,7 +1602,6 @@ CUSTOM_CVAR (Bool, vid_nowidescreen, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) } } -EXTERN_CVAR (Int, vid_scalemode) CUSTOM_CVAR (Int, vid_aspect, 0, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) { setsizeneeded = true; @@ -1629,7 +1628,7 @@ int ActiveFakeRatio(int width, int height) fakeratio = 3; } } - else if (vid_aspect == 0 && (vid_scalemode == 1 || vid_scalemode == 2)) + else if (vid_aspect == 0 && ViewportIsScaled43()) { fakeratio = 0; } From 3540440bf6910d9ff9efc86c905a392204053ccf Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 27 Jul 2017 12:17:11 -0400 Subject: [PATCH 54/77] - add 1280x800 scale mode --- src/r_videoscale.cpp | 15 ++++++++++++--- wadsrc/static/menudef.txt | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/r_videoscale.cpp b/src/r_videoscale.cpp index 55205e7b7..c666f08cc 100644 --- a/src/r_videoscale.cpp +++ b/src/r_videoscale.cpp @@ -27,7 +27,7 @@ CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { - if (self < 0 || self > 5) + if (self < 0 || self > 6) { self = 0; } @@ -35,7 +35,13 @@ CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) bool ViewportLinearScale() { - return vid_scalemode == 4 || vid_scalemode == 5; + switch(vid_scalemode) + { + default: return false; + case 4: + case 5: + case 6: return true; + } } int ViewportScaledWidth(int width) @@ -49,6 +55,7 @@ int ViewportScaledWidth(int width) case 3: return (int)roundf(width * 0.5f); case 4: return (int)roundf(width * 0.75f); case 5: return width * 2; + case 6: return 1280; } } @@ -63,6 +70,7 @@ int ViewportScaledHeight(int height) case 3: return (int)roundf(height * 0.5f); case 4: return (int)roundf(height * 0.75f); case 5: return height * 2; + case 6: return 800; } } @@ -72,7 +80,8 @@ bool ViewportIsScaled43() { default: return false; case 1: - case 2: return true; + case 2: + case 6: return true; } } diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 66b58c2c4..978774c4c 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1857,6 +1857,7 @@ OptionValue ScaleModes 3, "0.5x" 4, "0.75x" 5, "2x SSAA" + 6, "1280x800" } OptionMenu VideoModeMenu protected From 7d21fe6d754c937c0c5c1483043dd83ee263ab1f Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 29 Jul 2017 19:26:53 +0200 Subject: [PATCH 55/77] - Fix mouse position being wrong when vid_scalemode is active --- src/gl/system/gl_framebuffer.cpp | 15 ++++++++ src/gl/system/gl_framebuffer.h | 2 ++ src/gl/system/gl_swframebuffer.cpp | 55 +++++++++++++++++++++--------- src/gl/system/gl_swframebuffer.h | 4 +++ 4 files changed, 59 insertions(+), 17 deletions(-) diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 73b81bd2c..f4e68791e 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -548,3 +548,18 @@ void OpenGLFrameBuffer::GameRestart() gl_GenerateGlobalBrightmapFromColormap(); } + +void OpenGLFrameBuffer::ScaleCoordsFromWindow(int16_t &x, int16_t &y) +{ + int letterboxX = GLRenderer->mOutputLetterbox.left; + int letterboxY = GLRenderer->mOutputLetterbox.top; + int letterboxWidth = GLRenderer->mOutputLetterbox.width; + int letterboxHeight = GLRenderer->mOutputLetterbox.height; + + // Subtract the LB video mode letterboxing + if (IsFullscreen()) + y -= (GetTrueHeight() - VideoHeight) / 2; + + x = int16_t((x - letterboxX) * Width / letterboxWidth); + y = int16_t((y - letterboxY) * Height / letterboxHeight); +} diff --git a/src/gl/system/gl_framebuffer.h b/src/gl/system/gl_framebuffer.h index 0d88667ca..7d11db921 100644 --- a/src/gl/system/gl_framebuffer.h +++ b/src/gl/system/gl_framebuffer.h @@ -82,6 +82,8 @@ public: void SetVSync(bool vsync); + void ScaleCoordsFromWindow(int16_t &x, int16_t &y) override; + bool HWGammaActive = false; // Are we using hardware or software gamma? std::shared_ptr mDebug; // Debug API private: diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index dd552f6df..199dd2826 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -714,6 +714,29 @@ void OpenGLSWFrameBuffer::DrawTriangleList(int minIndex, int numVertices, int st glDrawRangeElements(GL_TRIANGLES, minIndex, minIndex + numVertices - 1, primitiveCount * 3, GL_UNSIGNED_SHORT, (const void*)(startIndex * sizeof(uint16_t))); } +void OpenGLSWFrameBuffer::GetLetterboxFrame(int &letterboxX, int &letterboxY, int &letterboxWidth, int &letterboxHeight) +{ + int clientWidth = GetClientWidth(); + int clientHeight = GetClientHeight(); + + float scaleX, scaleY; + if (ViewportIsScaled43()) + { + scaleX = MIN(clientWidth / (float)Width, clientHeight / (Height * 1.2f)); + scaleY = scaleX * 1.2f; + } + else + { + scaleX = MIN(clientWidth / (float)Width, clientHeight / (float)Height); + scaleY = scaleX; + } + + letterboxWidth = (int)round(Width * scaleX); + letterboxHeight = (int)round(Height * scaleY); + letterboxX = (clientWidth - letterboxWidth) / 2; + letterboxY = (clientHeight - letterboxHeight) / 2; +} + void OpenGLSWFrameBuffer::Present() { int clientWidth = GetClientWidth(); @@ -723,23 +746,8 @@ void OpenGLSWFrameBuffer::Present() glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport(0, 0, clientWidth, clientHeight); - float scaleX, scaleY; - if (ViewportIsScaled43()) - { - scaleX = MIN(clientWidth / (float)Width, clientHeight / (Height * 1.2f)); - scaleY = scaleX * 1.2f; - } - else - { - scaleX = MIN(clientWidth / (float)Width, clientHeight / (float)Height); - scaleY = scaleX; - } - - int letterboxWidth = (int)round(Width * scaleX); - int letterboxHeight = (int)round(Height * scaleY); - int letterboxX = (clientWidth - letterboxWidth) / 2; - int letterboxY = (clientHeight - letterboxHeight) / 2; - + int letterboxX, letterboxY, letterboxWidth, letterboxHeight; + GetLetterboxFrame(letterboxX, letterboxY, letterboxWidth, letterboxHeight); DrawLetterbox(letterboxX, letterboxY, letterboxWidth, letterboxHeight); glViewport(letterboxX, letterboxY, letterboxWidth, letterboxHeight); @@ -3830,3 +3838,16 @@ void OpenGLSWFrameBuffer::SetPaletteTexture(HWTexture *texture, int count, uint3 SetConstant(PSCONST_PaletteMod, 255 * fcount, 0.5f * fcount, 0, 0); SetTexture(1, texture); } + +void OpenGLSWFrameBuffer::ScaleCoordsFromWindow(int16_t &x, int16_t &y) +{ + int letterboxX, letterboxY, letterboxWidth, letterboxHeight; + GetLetterboxFrame(letterboxX, letterboxY, letterboxWidth, letterboxHeight); + + // Subtract the LB video mode letterboxing + if (IsFullscreen()) + y -= (GetTrueHeight() - VideoHeight) / 2; + + x = int16_t((x - letterboxX) * Width / letterboxWidth); + y = int16_t((y - letterboxY) * Height / letterboxHeight); +} diff --git a/src/gl/system/gl_swframebuffer.h b/src/gl/system/gl_swframebuffer.h index 93f7c905c..e29ff40ba 100644 --- a/src/gl/system/gl_swframebuffer.h +++ b/src/gl/system/gl_swframebuffer.h @@ -72,6 +72,8 @@ public: int GetTrueHeight() override { return TrueHeight; } #endif + void ScaleCoordsFromWindow(int16_t &x, int16_t &y) override; + private: struct FBVERTEX { @@ -194,6 +196,8 @@ private: void DrawLineList(int count); void DrawTriangleList(int minIndex, int numVertices, int startIndex, int primitiveCount); void Present(); + + void GetLetterboxFrame(int &x, int &y, int &width, int &height); static void BgraToRgba(uint32_t *dest, const uint32_t *src, int width, int height, int srcpitch); From af32edd0540bbfc1a9801ccacb251117c0935661 Mon Sep 17 00:00:00 2001 From: raa-eruanna Date: Sat, 29 Jul 2017 16:47:10 -0400 Subject: [PATCH 56/77] - fixed linux compile --- src/posix/sdl/sdlglvideo.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h index 8fcc184e6..3d6de5c73 100644 --- a/src/posix/sdl/sdlglvideo.h +++ b/src/posix/sdl/sdlglvideo.h @@ -76,6 +76,7 @@ public: SDL_Window *GetSDLWindow() override { return Screen; } + virtual int GetTrueHeight() { return GetClientHeight(); } protected: bool CanUpdate(); void SetGammaTable(uint16_t *tbl); From 0df2779004d88e6f0e578d93910444c5973bd592 Mon Sep 17 00:00:00 2001 From: raa-eruanna Date: Sat, 29 Jul 2017 17:03:18 -0400 Subject: [PATCH 57/77] - fixed mac compile(hopefully?) --- src/posix/cocoa/sdlglvideo.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/posix/cocoa/sdlglvideo.h b/src/posix/cocoa/sdlglvideo.h index 6fd5fd72a..55e08c583 100644 --- a/src/posix/cocoa/sdlglvideo.h +++ b/src/posix/cocoa/sdlglvideo.h @@ -65,6 +65,7 @@ public: int GetClientWidth(); int GetClientHeight(); + virtual int GetTrueHeight() { return GetClientHeight(); } protected: int m_Lock; bool UpdatePending; From 80bb1d908ac2e19cf7094e71fd1f31d1235405a7 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Fri, 28 Jul 2017 14:00:28 -0400 Subject: [PATCH 58/77] - basic groundwork for render feature visibility flags. I haven't gotten very far with it yet, but since I am taking a break I am going to commit what I have and continue it later. todo: * call a render class function in D_Main that enumerates the capabilities of the current renderer into a global variable to be accessed later * add a debug-specific cvar to always show all actors, regardless of these filters * put in checks in the renderer themselves that check both flagsets and reject rendering of any sprite/model that does not fit the definition's criteria --- src/actor.h | 23 +++++++++++++++++++++++ wadsrc/static/zscript/constants.txt | 21 ++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/actor.h b/src/actor.h index 2059b8309..893e9cb57 100644 --- a/src/actor.h +++ b/src/actor.h @@ -516,6 +516,25 @@ enum ActorBounceFlag }; +// this is a special flag set that is exposed directly to DECORATE/ZScript +// these flags are for filtering actor visibility based on certain conditions of the renderer's feature support. +// currently, no renderer supports every single one of these features. +enum ActorRenderFeatureFlag +{ + RFF_FLATSPRITES = 1<<0, // flat sprites + RFF_MODELS = 1<<1, // 3d models + RFF_SLOPE3DFLOORS = 1<<2, // sloped 3d floor support + RFF_TILTPITCH = 1<<3, // full free-look + RFF_ROLLSPRITES = 1<<4, // roll sprites + RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls + RFF_FRAGMENTSHADER = 1<<6, // fragment (material) shaders + RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers) + RFF_BRIGHTMAP = 1<<8, // brightmaps + RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife) + RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl) + RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor +}; + // [TP] Flagset definitions typedef TFlags ActorFlags; typedef TFlags ActorFlags2; @@ -527,6 +546,7 @@ typedef TFlags ActorFlags7; typedef TFlags ActorFlags8; typedef TFlags ActorRenderFlags; typedef TFlags ActorBounceFlags; +typedef TFlags ActorRenderFeatureFlags; DEFINE_TFLAGS_OPERATORS (ActorFlags) DEFINE_TFLAGS_OPERATORS (ActorFlags2) DEFINE_TFLAGS_OPERATORS (ActorFlags3) @@ -537,6 +557,7 @@ DEFINE_TFLAGS_OPERATORS (ActorFlags7) DEFINE_TFLAGS_OPERATORS (ActorFlags8) DEFINE_TFLAGS_OPERATORS (ActorRenderFlags) DEFINE_TFLAGS_OPERATORS (ActorBounceFlags) +DEFINE_TFLAGS_OPERATORS (ActorRenderFeatureFlags) // Used to affect the logic for thing activation through death, USESPECIAL and BUMPSPECIAL // "thing" refers to what has the flag and the special, "trigger" refers to what used or bumped it @@ -1024,6 +1045,8 @@ public: uint32_t Translation; ActorRenderFlags renderflags; // Different rendering flags + ActorRenderFeatureFlags renderrequired; // current renderer must have this feature set + ActorRenderFeatureFlags renderhidden; // current renderer must *not* have any of these features ActorFlags flags; ActorFlags2 flags2; // Heretic flags ActorFlags3 flags3; // [RH] Hexen/Heretic actor-dependant behavior made flaggable diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index b0bf1b65d..05f373f69 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -1171,4 +1171,23 @@ enum EWeaponState WF_USER2OK = 1 << 9, WF_USER3OK = 1 << 10, WF_USER4OK = 1 << 11, -}; \ No newline at end of file +}; + +// these flags are for filtering actor visibility based on certain conditions of the renderer's feature support. +// currently, no renderer supports every single one of these features. +enum ActorRenderFeatureFlag +{ + RFF_FLATSPRITES = 1<<0, // flat sprites + RFF_MODELS = 1<<1, // 3d models + RFF_SLOPE3DFLOORS = 1<<2, // sloped 3d floor support + RFF_TILTPITCH = 1<<3, // full free-look + RFF_ROLLSPRITES = 1<<4, // roll sprites + RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls + RFF_FRAGMENTSHADER = 1<<6, // fragment (material) shaders + RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers) + RFF_BRIGHTMAP = 1<<8, // brightmaps + RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife) + RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl) + RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor +}; + From 64deba45a377016a7c4690c57bffb7d424417fed Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 29 Jul 2017 09:15:53 -0400 Subject: [PATCH 59/77] - added another render filter --- src/actor.h | 1 + wadsrc/static/zscript/constants.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/src/actor.h b/src/actor.h index 893e9cb57..83c0fa37b 100644 --- a/src/actor.h +++ b/src/actor.h @@ -533,6 +533,7 @@ enum ActorRenderFeatureFlag RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife) RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl) RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor + RFF_VOXELS = 1<<12, // renderer is capable of voxels }; // [TP] Flagset definitions diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index 05f373f69..d6bc27248 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -1189,5 +1189,6 @@ enum ActorRenderFeatureFlag RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife) RFF_POLYGONAL = 1<<10, // uses polygons instead of wallscans/visplanes (i.e. softpoly and hardware opengl) RFF_TRUECOLOR = 1<<11, // renderer is currently truecolor + RFF_VOXELS = 1<<12, // renderer is capable of voxels }; From 9a9fe7c133f92263e57925275bbd6c6da39e47ae Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 29 Jul 2017 11:03:40 -0400 Subject: [PATCH 60/77] - implemented GetCaps() for OpenGL - renamed RFF_FRAGMENTSHADER to RFF_MATSHADER - D_Display now calls Renderer->GetCaps() and stores it in a global variable for later use. --- src/actor.h | 2 +- src/d_main.cpp | 4 ++++ src/d_main.h | 3 +++ src/gl/scene/gl_scene.cpp | 25 +++++++++++++++++++++++++ src/r_renderer.h | 1 + wadsrc/static/zscript/constants.txt | 2 +- 6 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/actor.h b/src/actor.h index 83c0fa37b..3343419f3 100644 --- a/src/actor.h +++ b/src/actor.h @@ -527,7 +527,7 @@ enum ActorRenderFeatureFlag RFF_TILTPITCH = 1<<3, // full free-look RFF_ROLLSPRITES = 1<<4, // roll sprites RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls - RFF_FRAGMENTSHADER = 1<<6, // fragment (material) shaders + RFF_MATSHADER = 1<<6, // material shaders RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers) RFF_BRIGHTMAP = 1<<8, // brightmaps RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife) diff --git a/src/d_main.cpp b/src/d_main.cpp index 6bffbce1b..57c5d8478 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -247,6 +247,9 @@ bool batchrun; // just run the startup and collect all error messages in a logfi cycle_t FrameCycles; +// [SP] Store the capabilities of the renderer in a global variable, to prevent excessive per-frame processing +uint32_t r_renderercaps = 0; + // PRIVATE DATA DEFINITIONS ------------------------------------------------ @@ -671,6 +674,7 @@ void D_Display () cycles.Clock(); r_UseVanillaTransparency = UseVanillaTransparency(); // [SP] Cache UseVanillaTransparency() call + r_renderercaps = Renderer->GetCaps(); // [SP] Get the current capabilities of the renderer if (players[consoleplayer].camera == NULL) { diff --git a/src/d_main.h b/src/d_main.h index ca8d40322..b7b9fabcd 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -64,6 +64,9 @@ bool D_AddFile (TArray &wadfiles, const char *file, bool check = true, // [RH] Set this to something to draw an icon during the next screen refresh. extern const char *D_DrawIcon; +// [SP] Store the capabilities of the renderer in a global variable, to prevent excessive per-frame processing +extern uint32_t r_renderercaps; + struct WadStuff { diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 2dc4953cf..ad3af273b 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -84,6 +84,7 @@ EXTERN_CVAR (Bool, cl_capfps) EXTERN_CVAR (Bool, r_deathcamera) EXTERN_CVAR (Float, underwater_fade_scalar) EXTERN_CVAR (Float, r_visibility) +EXTERN_CVAR (Bool, gl_legacy_mode) extern bool NoInterpolateView; @@ -993,6 +994,7 @@ struct FGLInterface : public FRenderer int GetMaxViewPitch(bool down) override; void SetClearColor(int color) override; void Init() override; + uint32_t GetCaps() override; }; //========================================================================== @@ -1160,6 +1162,29 @@ bool FGLInterface::RequireGLNodes() return true; } +uint32_t FGLInterface::GetCaps() +{ + // describe our basic feature set + ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS | + RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_VOXELS; + if (gl_legacy_mode) + { + // legacy mode always has truecolor because palette tonemap is not available + FlagSet |= RFF_TRUECOLOR; + } + else if (!(FGLRenderBuffers::IsEnabled())) + { + // truecolor is always available when renderbuffers are unavailable because palette tonemap is not possible + FlagSet |= RFF_TRUECOLOR | RFF_MATSHADER; + } + else + { + if (gl_tonemap != 5) // not running palette tonemap shader + FlagSet |= RFF_TRUECOLOR; + FlagSet |= RFF_MATSHADER | RFF_POSTSHADER; + } + return (uint32_t)FlagSet; +} //=========================================================================== // // diff --git a/src/r_renderer.h b/src/r_renderer.h index 01d241bb9..5d6ee856c 100644 --- a/src/r_renderer.h +++ b/src/r_renderer.h @@ -54,6 +54,7 @@ struct FRenderer virtual void CleanLevelData() {} virtual bool RequireGLNodes() { return false; } + virtual uint32_t GetCaps() { return 0; } }; diff --git a/wadsrc/static/zscript/constants.txt b/wadsrc/static/zscript/constants.txt index d6bc27248..44f2e8c91 100644 --- a/wadsrc/static/zscript/constants.txt +++ b/wadsrc/static/zscript/constants.txt @@ -1183,7 +1183,7 @@ enum ActorRenderFeatureFlag RFF_TILTPITCH = 1<<3, // full free-look RFF_ROLLSPRITES = 1<<4, // roll sprites RFF_UNCLIPPEDTEX = 1<<5, // midtex and sprite can render "into" flats and walls - RFF_FRAGMENTSHADER = 1<<6, // fragment (material) shaders + RFF_MATSHADER = 1<<6, // material shaders RFF_POSTSHADER = 1<<7, // post-process shaders (renderbuffers) RFF_BRIGHTMAP = 1<<8, // brightmaps RFF_COLORMAP = 1<<9, // custom colormaps (incl. ability to fullbright certain ranges, ala Strife) From 8bb56871591146669ebd6a7a8349119b3d26d0c3 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 29 Jul 2017 11:32:58 -0400 Subject: [PATCH 61/77] - Implemented GetCaps() for the software renderer - fixed: Forgot to describe Brightmap capability in the GL Renderer --- src/gl/scene/gl_scene.cpp | 4 ++-- src/swrenderer/r_swrenderer.cpp | 17 +++++++++++++++++ src/swrenderer/r_swrenderer.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index ad3af273b..681af98a6 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -1175,13 +1175,13 @@ uint32_t FGLInterface::GetCaps() else if (!(FGLRenderBuffers::IsEnabled())) { // truecolor is always available when renderbuffers are unavailable because palette tonemap is not possible - FlagSet |= RFF_TRUECOLOR | RFF_MATSHADER; + FlagSet |= RFF_TRUECOLOR | RFF_MATSHADER | RFF_BRIGHTMAP; } else { if (gl_tonemap != 5) // not running palette tonemap shader FlagSet |= RFF_TRUECOLOR; - FlagSet |= RFF_MATSHADER | RFF_POSTSHADER; + FlagSet |= RFF_MATSHADER | RFF_POSTSHADER | RFF_BRIGHTMAP; } return (uint32_t)FlagSet; } diff --git a/src/swrenderer/r_swrenderer.cpp b/src/swrenderer/r_swrenderer.cpp index 026252dc8..fec82c30e 100644 --- a/src/swrenderer/r_swrenderer.cpp +++ b/src/swrenderer/r_swrenderer.cpp @@ -378,3 +378,20 @@ void FSoftwareRenderer::PreprocessLevel() void FSoftwareRenderer::CleanLevelData() { } + +uint32_t FSoftwareRenderer::GetCaps() +{ + ActorRenderFeatureFlags FlagSet = RFF_UNCLIPPEDTEX; + + if (r_polyrenderer) + FlagSet |= RFF_POLYGONAL | RFF_TILTPITCH; + else + FlagSet |= RFF_VOXELS; + + if (screen && screen->IsBgra()) + FlagSet |= RFF_TRUECOLOR; + else + FlagSet |= RFF_COLORMAP; + + return (uint32_t)FlagSet; +} \ No newline at end of file diff --git a/src/swrenderer/r_swrenderer.h b/src/swrenderer/r_swrenderer.h index 91b4dcdfb..06946321f 100644 --- a/src/swrenderer/r_swrenderer.h +++ b/src/swrenderer/r_swrenderer.h @@ -35,6 +35,8 @@ struct FSoftwareRenderer : public FRenderer void PreprocessLevel() override; void CleanLevelData() override; + uint32_t GetCaps() override; + private: void PrecacheTexture(FTexture *tex, int cache); From 712d21e26ade76a06e87467681b0430e9440b5a8 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 29 Jul 2017 13:59:36 -0400 Subject: [PATCH 62/77] - implement per-renderer sprite hiding based on the actor's render feature flags - hook the thing up to zscript (does not currently compile) --- src/gl/scene/gl_sprite.cpp | 8 ++++++++ src/polyrenderer/scene/poly_sprite.cpp | 7 +++++++ src/scripting/thingdef_properties.cpp | 15 +++++++++++++++ src/swrenderer/scene/r_opaque_pass.cpp | 7 +++++++ 4 files changed, 37 insertions(+) diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index bc8275ddd..81b077222 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -79,6 +79,7 @@ EXTERN_CVAR (Float, transsouls) extern TArray sprites; extern TArray SpriteFrames; +extern uint32_t r_renderercaps; enum HWRenderStyle { @@ -677,6 +678,13 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) if (!(thing->flags & MF_STEALTH) || !mDrawer->FixedColormap || !gl_enhanced_nightvision || thing == camera) return; } + + // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, + // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. + if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) || + (!!((uint32_t)(thing->renderhidden) & r_renderercaps))) + return; + int spritenum = thing->sprite; DVector2 sprscale = thing->Scale; if (thing->player != NULL) diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index 5b4927431..ca960dd58 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -32,6 +32,7 @@ EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, r_drawfuzz) +extern uint32_t r_renderercaps; bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right) { @@ -176,6 +177,12 @@ bool RenderPolySprite::IsThingCulled(AActor *thing) return true; } + // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, + // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. + if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) || + (!!((uint32_t)(thing->renderhidden) & r_renderercaps))) + return true; + return false; } diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index d10f50517..4ac679b45 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -1837,3 +1837,18 @@ DEFINE_SCRIPTED_PROPERTY(unmorphflash, S, PowerMorph) } +//========================================================================== +// actor render feature filters - stop rendering if the renderer does/does not support certain features +//========================================================================== +DEFINE_SCRIPTED_PROPERTY(renderrequired, I, Actor) +{ + PROP_INT_PARM(f, 0); + defaults->renderrequired = f; +} + +DEFINE_SCRIPTED_PROPERTY(renderhidden, I, Actor) +{ + PROP_INT_PARM(f, 0); + defaults->renderhidden = f; +} + diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index b772d62a4..68c0abab8 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -72,6 +72,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); EXTERN_CVAR(Bool, r_drawvoxels); +extern uint32_t r_renderercaps; namespace { @@ -968,6 +969,12 @@ namespace swrenderer return false; } + // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, + // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. + if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) || + (!!((uint32_t)(thing->renderhidden) & r_renderercaps))) + return false; + // [ZZ] Or less definitely not visible (hue) // [ZZ] 10.01.2016: don't try to clip stuff inside a skybox against the current portal. RenderPortal *renderportal = Thread->Portal.get(); From 91ff447a907c11ab98195ed2a7da02815ab921b9 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 29 Jul 2017 13:59:36 -0400 Subject: [PATCH 63/77] - fixed compile from last commit - refactored the zscript hookup a bit, made it actually work --- src/actor.h | 5 +++-- src/gl/scene/gl_sprite.cpp | 4 ++-- src/p_mobj.cpp | 7 +++++-- src/polyrenderer/scene/poly_sprite.cpp | 4 ++-- src/scripting/thingdef_properties.cpp | 17 +---------------- src/swrenderer/scene/r_opaque_pass.cpp | 4 ++-- wadsrc/static/zscript/actor.txt | 6 ++++++ 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/actor.h b/src/actor.h index 3343419f3..9f1f9b5bf 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1045,9 +1045,10 @@ public: uint32_t fillcolor; // Color to draw when STYLE_Shaded uint32_t Translation; + uint32_t RenderRequired; // current renderer must have this feature set + uint32_t RenderHidden; // current renderer must *not* have any of these features + ActorRenderFlags renderflags; // Different rendering flags - ActorRenderFeatureFlags renderrequired; // current renderer must have this feature set - ActorRenderFeatureFlags renderhidden; // current renderer must *not* have any of these features ActorFlags flags; ActorFlags2 flags2; // Heretic flags ActorFlags3 flags3; // [RH] Hexen/Heretic actor-dependant behavior made flaggable diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 81b077222..845ea24a8 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -681,8 +681,8 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. - if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) || - (!!((uint32_t)(thing->renderhidden) & r_renderercaps))) + if ((!!(thing->RenderRequired & ~r_renderercaps)) || + (!!(thing->RenderHidden & r_renderercaps))) return; int spritenum = thing->sprite; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3fff257ad..c02490420 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -352,6 +352,8 @@ DEFINE_FIELD(AActor, StealthAlpha) DEFINE_FIELD(AActor, WoundHealth) DEFINE_FIELD(AActor, BloodColor) DEFINE_FIELD(AActor, BloodTranslation) +DEFINE_FIELD(AActor, RenderHidden) +DEFINE_FIELD(AActor, RenderRequired) //========================================================================== // @@ -526,8 +528,9 @@ void AActor::Serialize(FSerializer &arc) A("woundhealth", WoundHealth) A("rdfactor", RadiusDamageFactor) A("selfdamagefactor", SelfDamageFactor) - A("stealthalpha", StealthAlpha); - + A("stealthalpha", StealthAlpha) + A("renderhidden", RenderHidden) + A("renderrequired", RenderRequired); } #undef A diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index ca960dd58..a85919198 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -179,8 +179,8 @@ bool RenderPolySprite::IsThingCulled(AActor *thing) // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. - if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) || - (!!((uint32_t)(thing->renderhidden) & r_renderercaps))) + if ((!!(thing->RenderRequired & ~r_renderercaps)) || + (!!(thing->RenderHidden & r_renderercaps))) return true; return false; diff --git a/src/scripting/thingdef_properties.cpp b/src/scripting/thingdef_properties.cpp index 4ac679b45..c36058ca4 100644 --- a/src/scripting/thingdef_properties.cpp +++ b/src/scripting/thingdef_properties.cpp @@ -1090,6 +1090,7 @@ DEFINE_PROPERTY(distancecheck, S, Actor) } } + //========================================================================== // // Special inventory properties @@ -1836,19 +1837,3 @@ DEFINE_SCRIPTED_PROPERTY(unmorphflash, S, PowerMorph) defaults->PointerVar(NAME_UnMorphFlash) = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate); } - -//========================================================================== -// actor render feature filters - stop rendering if the renderer does/does not support certain features -//========================================================================== -DEFINE_SCRIPTED_PROPERTY(renderrequired, I, Actor) -{ - PROP_INT_PARM(f, 0); - defaults->renderrequired = f; -} - -DEFINE_SCRIPTED_PROPERTY(renderhidden, I, Actor) -{ - PROP_INT_PARM(f, 0); - defaults->renderhidden = f; -} - diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 68c0abab8..9325cbfcf 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -971,8 +971,8 @@ namespace swrenderer // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. - if ((!!((uint32_t)(thing->renderrequired) & ~r_renderercaps)) || - (!!((uint32_t)(thing->renderhidden) & r_renderercaps))) + if ((!!(thing->RenderRequired & ~r_renderercaps)) || + (!!(thing->RenderHidden & r_renderercaps))) return false; // [ZZ] Or less definitely not visible (hue) diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 207e101b5..048ba0759 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -199,6 +199,8 @@ class Actor : Thinker native native int WoundHealth; // Health needed to enter wound state native readonly color BloodColor; native readonly int BloodTranslation; + native int RenderHidden; + native int RenderRequired; meta String Obituary; // Player was killed by this actor meta String HitObituary; // Player was killed by this actor in melee @@ -285,6 +287,8 @@ class Actor : Thinker native property Ripperlevel: RipperLevel; property RipLevelMin: RipLevelMin; property RipLevelMax: RipLevelMax; + property RenderHidden: RenderHidden; + property RenderRequired: RenderRequired; // need some definition work first //FRenderStyle RenderStyle; @@ -362,6 +366,8 @@ class Actor : Thinker native GibHealth int.min; DeathHeight -1; BurnHeight -1; + RenderHidden 0; + RenderRequired 0; } // Functions From 1bfc2faa4959d444f5a38d6e05a6a8a6c4aa7835 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 29 Jul 2017 16:11:07 -0400 Subject: [PATCH 64/77] - added 'r_showcaps' command which serves as a documentation for available flags and shows what flags are in use by the current rendering settings --- src/c_cmds.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index f1085555a..00a3e4ebe 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -1279,3 +1279,23 @@ CCMD(angleconvtest) ang, ang1, ang2, ang3); } } + +extern uint32_t r_renderercaps; +#define PRINT_CAP(X, Y) Printf(" %-18s: %s (%s)\n", #Y, !!(r_renderercaps & Y) ? "Yes" : "No ", X); +CCMD(r_showcaps) +{ + Printf("Renderer capabilities:\n"); + PRINT_CAP("Flat Sprites", RFF_FLATSPRITES) + PRINT_CAP("3D Models", RFF_MODELS) + PRINT_CAP("Sloped 3D floors", RFF_SLOPE3DFLOORS) + PRINT_CAP("Full Freelook", RFF_TILTPITCH) + PRINT_CAP("Roll Sprites", RFF_ROLLSPRITES) + PRINT_CAP("Unclipped Sprites", RFF_UNCLIPPEDTEX) + PRINT_CAP("Material Shaders", RFF_MATSHADER) + PRINT_CAP("Post-processing Shaders", RFF_POSTSHADER) + PRINT_CAP("Brightmaps", RFF_BRIGHTMAP) + PRINT_CAP("Custom COLORMAP lumps", RFF_COLORMAP) + PRINT_CAP("Uses Polygon rendering", RFF_POLYGONAL) + PRINT_CAP("Truecolor Enabled", RFF_TRUECOLOR) + PRINT_CAP("Voxels", RFF_VOXELS) +} From b6c15b997a26f8bd99d2fc7cb42606083c4fd253 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 29 Jul 2017 16:26:16 -0400 Subject: [PATCH 65/77] - added 'r_debug_disable_vis_filter' cvar for debug purposes, to show all objects regardless of their actor filter fields. --- src/d_main.cpp | 1 + src/gl/scene/gl_sprite.cpp | 3 ++- src/polyrenderer/scene/poly_sprite.cpp | 3 ++- src/swrenderer/scene/r_opaque_pass.cpp | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index 57c5d8478..dd69b7d0d 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -218,6 +218,7 @@ CUSTOM_CVAR (String, vid_cursor, "None", CVAR_ARCHIVE | CVAR_NOINITCALL) CVAR (Bool, disableautoload, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) CVAR (Bool, autoloadbrightmaps, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) CVAR (Bool, autoloadlights, false, CVAR_ARCHIVE | CVAR_NOINITCALL | CVAR_GLOBALCONFIG) +CVAR (Bool, r_debug_disable_vis_filter, false, 0) bool wantToRestart; bool DrawFSHUD; // [RH] Draw fullscreen HUD? diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 845ea24a8..acd1d6d5d 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -76,6 +76,7 @@ CUSTOM_CVAR(Int, gl_fuzztype, 0, CVAR_ARCHIVE) } EXTERN_CVAR (Float, transsouls) +EXTERN_CVAR (Bool, r_debug_disable_vis_filter) extern TArray sprites; extern TArray SpriteFrames; @@ -681,7 +682,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal) // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. - if ((!!(thing->RenderRequired & ~r_renderercaps)) || + if (!r_debug_disable_vis_filter && (!!(thing->RenderRequired & ~r_renderercaps)) || (!!(thing->RenderHidden & r_renderercaps))) return; diff --git a/src/polyrenderer/scene/poly_sprite.cpp b/src/polyrenderer/scene/poly_sprite.cpp index a85919198..3ff88514d 100644 --- a/src/polyrenderer/scene/poly_sprite.cpp +++ b/src/polyrenderer/scene/poly_sprite.cpp @@ -32,6 +32,7 @@ EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, r_drawfuzz) +EXTERN_CVAR (Bool, r_debug_disable_vis_filter) extern uint32_t r_renderercaps; bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right) @@ -179,7 +180,7 @@ bool RenderPolySprite::IsThingCulled(AActor *thing) // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. - if ((!!(thing->RenderRequired & ~r_renderercaps)) || + if (!r_debug_disable_vis_filter && (!!(thing->RenderRequired & ~r_renderercaps)) || (!!(thing->RenderHidden & r_renderercaps))) return true; diff --git a/src/swrenderer/scene/r_opaque_pass.cpp b/src/swrenderer/scene/r_opaque_pass.cpp index 9325cbfcf..5935b1ff4 100644 --- a/src/swrenderer/scene/r_opaque_pass.cpp +++ b/src/swrenderer/scene/r_opaque_pass.cpp @@ -72,6 +72,7 @@ EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor); EXTERN_CVAR(Bool, r_drawvoxels); +EXTERN_CVAR(Bool, r_debug_disable_vis_filter); extern uint32_t r_renderercaps; namespace @@ -971,7 +972,7 @@ namespace swrenderer // check renderrequired vs ~r_rendercaps, if anything matches we don't support that feature, // check renderhidden vs r_rendercaps, if anything matches we do support that feature and should hide it. - if ((!!(thing->RenderRequired & ~r_renderercaps)) || + if (!r_debug_disable_vis_filter && (!!(thing->RenderRequired & ~r_renderercaps)) || (!!(thing->RenderHidden & r_renderercaps))) return false; From e1dddf8c3eb2120c9fd96da565cb882a5fcb255f Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 30 Jul 2017 12:24:04 +0300 Subject: [PATCH 66/77] Removed obsolete mapinfo entry from common Doom GAMEINFO definition --- wadsrc/static/mapinfo/doomcommon.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index f38d699dc..b4fea47a6 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -21,7 +21,6 @@ gameinfo defkickback = 100 skyflatname = "F_SKY1" translator = "xlat/doom.txt" - mapinfo = "mapinfo/doom2.txt" defaultbloodcolor = "68 00 00" defaultbloodparticlecolor = "ff 00 00" backpacktype = "Backpack" From 6a5bad0beb0adcd563f91242093edd999c48219d Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 30 Jul 2017 12:26:18 +0300 Subject: [PATCH 67/77] Added developer message about unknown GAMEINFO entry --- src/gi.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gi.cpp b/src/gi.cpp index ecc301624..a6efab358 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -414,6 +414,8 @@ void FMapInfoParser::ParseGameInfo() else { + DPrintf(DMSG_ERROR, "Unknown GAMEINFO key \"%s\" found in %s:%i\n", nextKey.GetChars(), sc.ScriptName.GetChars(), sc.Line); + // ignore unkown keys. sc.UnGet(); SkipToNext(); From d5733f515c52119e37e67d36e1d165f98263a38d Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 30 Jul 2017 13:59:25 +0200 Subject: [PATCH 68/77] - Support binding textures for custom PP shaders --- src/gl/shaders/gl_postprocessshader.cpp | 63 +++++++++++++++++++++++++ src/gl/shaders/gl_postprocessshader.h | 5 ++ src/gl/shaders/gl_shader.cpp | 10 ++++ 3 files changed, 78 insertions(+) diff --git a/src/gl/shaders/gl_postprocessshader.cpp b/src/gl/shaders/gl_postprocessshader.cpp index 0baf06531..b8011083a 100644 --- a/src/gl/shaders/gl_postprocessshader.cpp +++ b/src/gl/shaders/gl_postprocessshader.cpp @@ -34,6 +34,8 @@ #include "gl/renderer/gl_postprocessstate.h" #include "gl/renderer/gl_renderbuffers.h" #include "gl/shaders/gl_postprocessshader.h" +#include "textures/textures.h" +#include "textures/bitmap.h" CVAR(Bool, gl_custompost, true, 0) @@ -67,6 +69,12 @@ void FCustomPostProcessShaders::Run(FString target) ///////////////////////////////////////////////////////////////////////////// +PostProcessShaderInstance::~PostProcessShaderInstance() +{ + for (const auto &it : mTextureHandles) + glDeleteTextures(1, (GLuint*)&it.second); +} + void PostProcessShaderInstance::Run() { if (!IsShaderSupported()) @@ -80,6 +88,7 @@ void PostProcessShaderInstance::Run() FGLDebug::PushGroup(Desc->ShaderLumpName.GetChars()); FGLPostProcessState savedState; + savedState.SaveTextureBindings(1 + Desc->Textures.CountUsed()); GLRenderer->mBuffers->BindNextFB(); GLRenderer->mBuffers->BindCurrentTexture(0); @@ -89,11 +98,13 @@ void PostProcessShaderInstance::Run() mProgram.Bind(); UpdateUniforms(); + BindTextures(); mInputTexture.Set(0); GLRenderer->RenderScreenQuad(); + glActiveTexture(GL_TEXTURE0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); GLRenderer->mBuffers->NextTexture(); @@ -145,6 +156,13 @@ void PostProcessShaderInstance::CompileShader() FString uniformTextures; uniformTextures += "uniform sampler2D InputTexture;\n"; + TMap::Iterator itTextures(Desc->Textures); + TMap::Pair *pairTextures; + while (itTextures.NextPair(pairTextures)) + { + uniformTextures.AppendFormat("uniform sampler2D %s;\n", pairTextures->Key.GetChars()); + } + // Setup pipeline FString pipelineInOut; pipelineInOut += "in vec2 TexCoord;\n"; @@ -191,4 +209,49 @@ void PostProcessShaderInstance::UpdateUniforms() } } } + + glUniform1i(glGetUniformLocation(mProgram, "SillyTexture"), 1); +} + +void PostProcessShaderInstance::BindTextures() +{ + int textureUnit = 1; + TMap::Iterator it(Desc->Textures); + TMap::Pair *pair; + while (it.NextPair(pair)) + { + int location = glGetUniformLocation(mProgram, pair->Key.GetChars()); + if (location == -1) + continue; + + FString name = pair->Value; + FTexture *tex = TexMan(TexMan.CheckForTexture(name, FTexture::TEX_Any)); + if (tex && tex->UseType != FTexture::TEX_Null) + { + glUniform1i(location, textureUnit); + + glActiveTexture(GL_TEXTURE0 + 1); + auto it = mTextureHandles.find(tex); + if (it == mTextureHandles.end()) + { + FBitmap bitmap; + bitmap.Create(tex->GetWidth(), tex->GetHeight()); + tex->CopyTrueColorPixels(&bitmap, 0, 0); + + GLuint handle = 0; + glGenTextures(1, &handle); + glBindTexture(GL_TEXTURE_2D, handle); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, tex->GetWidth(), tex->GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmap.GetPixels()); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + mTextureHandles[tex] = handle; + } + else + { + glBindTexture(GL_TEXTURE_2D, it->second); + } + + textureUnit++; + } + } } diff --git a/src/gl/shaders/gl_postprocessshader.h b/src/gl/shaders/gl_postprocessshader.h index 876cb9f56..23b8c1864 100644 --- a/src/gl/shaders/gl_postprocessshader.h +++ b/src/gl/shaders/gl_postprocessshader.h @@ -1,6 +1,7 @@ #pragma once #include "gl_shaderprogram.h" +#include class PostProcessShaderInstance; @@ -29,6 +30,7 @@ struct PostProcessShader bool Enabled = false; TMap Uniforms; + TMap Textures; }; extern TArray PostProcessShaders; @@ -37,6 +39,7 @@ class PostProcessShaderInstance { public: PostProcessShaderInstance(PostProcessShader *desc) : Desc(desc) { } + ~PostProcessShaderInstance(); void Run(); @@ -46,9 +49,11 @@ private: bool IsShaderSupported(); void CompileShader(); void UpdateUniforms(); + void BindTextures(); FShaderProgram mProgram; FBufferedUniformSampler mInputTexture; + std::map mTextureHandles; }; class FCustomPostProcessShaders diff --git a/src/gl/shaders/gl_shader.cpp b/src/gl/shaders/gl_shader.cpp index c508fd301..41b6c18a1 100644 --- a/src/gl/shaders/gl_shader.cpp +++ b/src/gl/shaders/gl_shader.cpp @@ -734,6 +734,16 @@ void gl_ParseHardwareShader(FScanner &sc, int deflump) if (parsedType != PostProcessUniformType::Undefined) shaderdesc.Uniforms[uniformName].Type = parsedType; } + else if (sc.Compare("texture")) + { + sc.MustGetString(); + FString textureName = sc.String; + + sc.MustGetString(); + FString textureSource = sc.String; + + shaderdesc.Textures[textureName] = textureSource; + } else if (sc.Compare("enabled")) { shaderdesc.Enabled = true; From c07a4461a0afa0bc3c74b7aa34356a1e76d138de Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 30 Jul 2017 10:44:49 -0400 Subject: [PATCH 69/77] - fixed: GetCaps() did not account for r_drawvoxels cvar --- src/gl/scene/gl_scene.cpp | 5 ++++- src/swrenderer/r_swrenderer.cpp | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 681af98a6..9b2792d65 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -85,6 +85,7 @@ EXTERN_CVAR (Bool, r_deathcamera) EXTERN_CVAR (Float, underwater_fade_scalar) EXTERN_CVAR (Float, r_visibility) EXTERN_CVAR (Bool, gl_legacy_mode) +EXTERN_CVAR (Bool, r_drawvoxels) extern bool NoInterpolateView; @@ -1166,7 +1167,9 @@ uint32_t FGLInterface::GetCaps() { // describe our basic feature set ActorRenderFeatureFlags FlagSet = RFF_FLATSPRITES | RFF_MODELS | RFF_SLOPE3DFLOORS | - RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL | RFF_VOXELS; + RFF_TILTPITCH | RFF_ROLLSPRITES | RFF_POLYGONAL; + if (r_drawvoxels) + FlagSet |= RFF_VOXELS; if (gl_legacy_mode) { // legacy mode always has truecolor because palette tonemap is not available diff --git a/src/swrenderer/r_swrenderer.cpp b/src/swrenderer/r_swrenderer.cpp index fec82c30e..ddbc12fa1 100644 --- a/src/swrenderer/r_swrenderer.cpp +++ b/src/swrenderer/r_swrenderer.cpp @@ -60,7 +60,8 @@ CUSTOM_CVAR (Bool, cl_oldfreelooklimit, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG } EXTERN_CVAR(Bool, r_shadercolormaps) -EXTERN_CVAR(Float, maxviewpitch) // [SP] CVAR from GZDoom +EXTERN_CVAR(Float, maxviewpitch) // [SP] CVAR from OpenGL Renderer +EXTERN_CVAR(Bool, r_drawvoxels) CUSTOM_CVAR(Bool, r_polyrenderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { @@ -385,7 +386,7 @@ uint32_t FSoftwareRenderer::GetCaps() if (r_polyrenderer) FlagSet |= RFF_POLYGONAL | RFF_TILTPITCH; - else + else if (r_drawvoxels) FlagSet |= RFF_VOXELS; if (screen && screen->IsBgra()) From 49b77f3a170af58bf84703f70895f43674708ed9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 30 Jul 2017 22:49:50 +0200 Subject: [PATCH 70/77] - added per-level exit texts independent of the current cluster. This is mainly to support UMAPINFO which does not have clusters but has been extended to define separate exit texts for each target map that can be reached from a given map. Special names 'normal' and 'secret' can be used to define texts specific to the default exits. New MAPINFO properties: * exittext = mapname, "text"... * textmusic = mapname, "musicname", order * textflat = mapname, flatname * textpic = mapname, picname textflat and textpic are like 'flat' and 'pic' for clusters, one defines a tiled background, the other a fullscreen image. Setting an empty exittext will disable a cluster-based text screen that may apply to the given map. --- src/g_level.cpp | 55 +++++++++++++++++--- src/g_level.h | 24 +++++++++ src/g_mapinfo.cpp | 130 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 193 insertions(+), 16 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index ec48fd939..d5044942e 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -694,11 +694,13 @@ const char *G_GetSecretExitMap() void G_ExitLevel (int position, bool keepFacing) { + level.flags3 |= LEVEL3_EXITNORMALUSED; G_ChangeLevel(G_GetExitMap(), position, keepFacing ? CHANGELEVEL_KEEPFACING : 0); } void G_SecretExitLevel (int position) { + level.flags3 |= LEVEL3_EXITSECRETUSED; G_ChangeLevel(G_GetSecretExitMap(), position, 0); } @@ -1110,16 +1112,55 @@ void G_WorldDone (void) } } - F_StartFinale (thiscluster->MessageMusic, thiscluster->musicorder, - thiscluster->cdtrack, thiscluster->cdid, - thiscluster->FinaleFlat, thiscluster->ExitText, - thiscluster->flags & CLUSTER_EXITTEXTINLUMP, - thiscluster->flags & CLUSTER_FINALEPIC, - thiscluster->flags & CLUSTER_LOOKUPEXITTEXT, - true, endsequence); + auto ext = level.info->ExitMapTexts.CheckKey(level.flags3 & LEVEL3_EXITSECRETUSED ? NAME_Secret : NAME_Normal); + if (ext != nullptr && (ext->mDefined & FExitText::DEF_TEXT)) + { + F_StartFinale(ext->mDefined & FExitText::DEF_MUSIC ? ext->mMusic : gameinfo.finaleMusic, + ext->mDefined & FExitText::DEF_MUSIC ? ext->mOrder : gameinfo.finaleOrder, + -1, 0, + ext->mDefined & FExitText::DEF_BACKDROP ? ext->mBackdrop : gameinfo.FinaleFlat, + ext->mText, + false, + ext->mDefined & FExitText::DEF_PIC, + ext->mDefined & FExitText::DEF_LOOKUP, + true, endsequence); + } + else + { + F_StartFinale(thiscluster->MessageMusic, thiscluster->musicorder, + thiscluster->cdtrack, thiscluster->cdid, + thiscluster->FinaleFlat, thiscluster->ExitText, + thiscluster->flags & CLUSTER_EXITTEXTINLUMP, + thiscluster->flags & CLUSTER_FINALEPIC, + thiscluster->flags & CLUSTER_LOOKUPEXITTEXT, + true, endsequence); + } } else { + FExitText *ext = nullptr; + + if (level.flags3 & LEVEL3_EXITSECRETUSED) ext = level.info->ExitMapTexts.CheckKey(NAME_Secret); + else if (level.flags3 & LEVEL3_EXITNORMALUSED) ext = level.info->ExitMapTexts.CheckKey(NAME_Normal); + if (ext == nullptr) ext = level.info->ExitMapTexts.CheckKey(nextlevel); + + if (ext != nullptr) + { + if ((ext->mDefined & FExitText::DEF_TEXT)) + { + F_StartFinale(ext->mDefined & FExitText::DEF_MUSIC ? ext->mMusic : gameinfo.finaleMusic, + ext->mDefined & FExitText::DEF_MUSIC ? ext->mOrder : gameinfo.finaleOrder, + -1, 0, + ext->mDefined & FExitText::DEF_BACKDROP ? ext->mBackdrop : gameinfo.FinaleFlat, + ext->mText, + false, + ext->mDefined & FExitText::DEF_PIC, + ext->mDefined & FExitText::DEF_LOOKUP, + false); + } + return; + } + nextcluster = FindClusterInfo (FindLevelInfo (nextlevel)->cluster); if (nextcluster->cluster != level.cluster && !deathmatch) diff --git a/src/g_level.h b/src/g_level.h index d332a0093..2df5af946 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -95,6 +95,9 @@ struct FMapInfoParser void ParseMusic(FString &name, int &order); //void ParseLumpOrTextureName(char *name); void ParseLumpOrTextureName(FString &name); + void ParseExitText(FName formap, level_info_t *info); + void ParseExitMusic(FName formap, level_info_t *info); + void ParseExitBackdrop(FName formap, level_info_t *info, bool ispic); void ParseCluster(); void ParseNextMap(FString &mapname); @@ -241,6 +244,8 @@ enum ELevelFlags : unsigned int LEVEL3_ATTENUATE = 0x00000004, // attenuate lights? LEVEL3_NOLIGHTFADE = 0x00000008, // no light fading to black. LEVEL3_NOCOLOREDSPRITELIGHTING = 0x00000010, // draw sprites only with color-less light + LEVEL3_EXITNORMALUSED = 0x00000020, + LEVEL3_EXITSECRETUSED = 0x00000040, }; @@ -287,6 +292,23 @@ enum EMapType : int MAPTYPE_UDMF // This does not distinguish between namespaces. }; +struct FExitText +{ + enum EDefined + { + DEF_TEXT = 1, + DEF_MUSIC = 2, + DEF_BACKDROP = 4, + DEF_LOOKUP = 8, + DEF_PIC = 16 + }; + int16_t mDefined = 0; + int16_t mOrder = -1; + FString mText; + FString mMusic; + FString mBackdrop; +}; + struct level_info_t { int levelnum; @@ -302,6 +324,8 @@ struct level_info_t FString BorderTexture; FString MapBackground; + TMap ExitMapTexts; + int cluster; int partime; int sucktime; diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index a39508e6c..5f22b25cf 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -607,15 +607,6 @@ bool FMapInfoParser::ParseLookupName(FString &dest) // //========================================================================== -/* -void FMapInfoParser::ParseLumpOrTextureName(char *name) -{ - sc.MustGetString(); - uppercopy(name, sc.String); - name[8]=0; -} -*/ - void FMapInfoParser::ParseLumpOrTextureName(FString &name) { sc.MustGetString(); @@ -623,6 +614,91 @@ void FMapInfoParser::ParseLumpOrTextureName(FString &name) } +//========================================================================== +// +// +//========================================================================== + +void FMapInfoParser::ParseExitText(FName formap, level_info_t *info) +{ + FString nexttext; + bool nextlookup = ParseLookupName(nexttext); + + auto def = info->ExitMapTexts.CheckKey(formap); + if (def != nullptr) + { + def->mText = nexttext; + if (nextlookup) def->mDefined |= FExitText::DEF_LOOKUP; + else def->mDefined &= ~FExitText::DEF_LOOKUP; + def->mDefined |= FExitText::DEF_TEXT; + } + else + { + FExitText def; + def.mText = nexttext; + if (nextlookup) def.mDefined |= FExitText::DEF_LOOKUP; + def.mDefined |= FExitText::DEF_TEXT; + info->ExitMapTexts.Insert(formap, def); + } +} + +//========================================================================== +// +// +//========================================================================== + +void FMapInfoParser::ParseExitMusic(FName formap, level_info_t *info) +{ + FString music; + int order; + ParseMusic(music, order); + + auto def = info->ExitMapTexts.CheckKey(formap); + if (def != nullptr) + { + def->mMusic = music; + def->mOrder = order; + def->mDefined |= FExitText::DEF_MUSIC; + } + else + { + FExitText def; + def.mMusic = music; + def.mOrder = order; + def.mDefined |= FExitText::DEF_MUSIC; + info->ExitMapTexts.Insert(formap, def); + } +} + +//========================================================================== +// +// +//========================================================================== + +void FMapInfoParser::ParseExitBackdrop(FName formap, level_info_t *info, bool ispic) +{ + FString drop; + ParseLumpOrTextureName(drop); + + auto def = info->ExitMapTexts.CheckKey(formap); + if (def != nullptr) + { + def->mBackdrop = drop; + def->mDefined |= FExitText::DEF_BACKDROP; + if (ispic) def->mDefined |= FExitText::DEF_PIC; + else def->mDefined &= ~FExitText::DEF_PIC; + } + else + { + FExitText def; + def.mBackdrop = drop; + def.mDefined |= FExitText::DEF_BACKDROP; + def.mDefined |= FExitText::DEF_MUSIC; + if (ispic) def.mDefined |= FExitText::DEF_PIC; + info->ExitMapTexts.Insert(formap, def); + } +} + //========================================================================== // // @@ -1177,6 +1253,42 @@ DEFINE_MAP_OPTION(mapbackground, true) parse.ParseLumpOrTextureName(info->MapBackground); } +DEFINE_MAP_OPTION(exittext, false) +{ + parse.ParseAssign(); + parse.sc.MustGetString(); + FName nextmap = parse.sc.String; + parse.ParseComma(); + parse.ParseExitText(nextmap, info); +} + +DEFINE_MAP_OPTION(textmusic, false) +{ + parse.ParseAssign(); + parse.sc.MustGetString(); + FName nextmap = parse.sc.String; + parse.ParseComma(); + parse.ParseExitMusic(nextmap, info); +} + +DEFINE_MAP_OPTION(textflat, false) +{ + parse.ParseAssign(); + parse.sc.MustGetString(); + FName nextmap = parse.sc.String; + parse.ParseComma(); + parse.ParseExitBackdrop(nextmap, info, false); +} + +DEFINE_MAP_OPTION(textpic, false) +{ + parse.ParseAssign(); + parse.sc.MustGetString(); + FName nextmap = parse.sc.String; + parse.ParseComma(); + parse.ParseExitBackdrop(nextmap, info, true); +} + DEFINE_MAP_OPTION(defaultenvironment, false) { int id; From 233fce7ef6d92fd67b6eab57824a9e874d333070 Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Sun, 30 Jul 2017 19:34:05 -0400 Subject: [PATCH 71/77] Initial attempt to make timidity work on Linux again Add code to find the timidity executable, and split the command line into separate arguments by spaces. For some reason, this doesn't work, although reverting 64e96c5f makes timidity work again. --- .../music_timiditypp_mididevice.cpp | 77 ++++++++++++++----- 1 file changed, 59 insertions(+), 18 deletions(-) diff --git a/src/sound/mididevices/music_timiditypp_mididevice.cpp b/src/sound/mididevices/music_timiditypp_mididevice.cpp index 39a7dcb78..0628ea140 100644 --- a/src/sound/mididevices/music_timiditypp_mididevice.cpp +++ b/src/sound/mididevices/music_timiditypp_mididevice.cpp @@ -269,7 +269,7 @@ int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata) #ifdef _WIN32 static SECURITY_ATTRIBUTES inheritable = { sizeof(inheritable), NULL, true }; - + if (!Validated && !ValidateTimidity ()) { return 101; @@ -287,7 +287,7 @@ int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata) // buffer reads in FillStream() under NT. This does not seem to be an // issue under 9x. int bitmask = pipeSize & -pipeSize; - + while (bitmask < pipeSize) bitmask <<= 1; pipeSize = bitmask; @@ -321,7 +321,7 @@ int TimidityPPMIDIDevice::Open(MidiCallback callback, void *userdata) #endif } } - + if (pipeSize == 0) { Printf(PRINT_BOLD, "If your soundcard cannot play more than one\n" @@ -514,26 +514,67 @@ bool TimidityPPMIDIDevice::LaunchTimidity () // Timidity was previously launched, so the write end of the pipe // is closed, and the read end is still open. Close the pipe // completely and reopen it. - + close (WavePipe[0]); WavePipe[0] = -1; delete Stream; Stream = NULL; Open (NULL, NULL); } - + int forkres; glob_t glb; - switch (glob (CommandLine.GetChars(), 0, NULL, &glb)) - { - case 0: // all good - break; - - case GLOB_NOSPACE: - globfree (&glb); - default: - return false; + // Get timidity executable path + int spaceIdx = 0; + int spaceInExePathCount = -1; + FString TimidityExe; + do { + spaceIdx = CommandLine.IndexOf(' ', spaceIdx); + spaceInExePathCount += 1; + TimidityExe = CommandLine.Left(spaceIdx); + glob(TimidityExe.GetChars(), 0, NULL, &glb); + } while (spaceIdx != -1 && glb.gl_pathc == 0); + if (spaceIdx == -1) return false; + globfree(&glb); + + int strCount = 1; + for (spaceIdx = 0; spaceIdx < CommandLine.Len(); spaceIdx++) { + if (CommandLine[spaceIdx] == ' ') { + ++strCount; + if (CommandLine[spaceIdx+1] == ' ') { + --strCount; + } + } + } + strCount -= spaceInExePathCount; + + char** TimidityArgs = new char*[strCount]; + + spaceIdx = CommandLine.IndexOf(' '); + int curSpace = spaceIdx, i = 1; + + TimidityArgs[0] = new char[TimidityExe.Len() + 1]; + strcpy(TimidityArgs[0], TimidityExe.GetChars()); + + int argLen; + while (curSpace != -1) { + curSpace = CommandLine.IndexOf(' ', spaceIdx); + if (curSpace != spaceIdx) { + argLen = curSpace - spaceIdx + 1; + if (argLen < 0) { + argLen = CommandLine.Len() - curSpace; + } + TimidityArgs[i] = new char[argLen]; + strcpy(TimidityArgs[i], CommandLine.Mid(spaceIdx, curSpace - spaceIdx).GetChars()); + i += 1; + } + spaceIdx = curSpace + 1; + } + + DPrintf(DMSG_NOTIFY, "Timidity EXE: \x1cG%s\n", TimidityExe.GetChars()); + for (i = 0; i < strCount; i++) { + DPrintf(DMSG_NOTIFY, "arg %d: \x1cG%s\n", i, TimidityArgs[i]); } forkres = fork (); @@ -546,7 +587,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity () // freopen ("/dev/null", "w", stderr); close (WavePipe[1]); - execvp (glb.gl_pathv[0], glb.gl_pathv); + execvp (TimidityExe.GetChars(), TimidityArgs); fprintf(stderr,"execvp failed\n"); _exit (0); // if execvp succeeds, we never get here } @@ -566,7 +607,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity () fprintf(stderr,"Launching timidity failed\n"); }*/ } - + globfree (&glb); return ChildProcess != -1; #endif // _WIN32 @@ -581,7 +622,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity () bool TimidityPPMIDIDevice::FillStream(SoundStream *stream, void *buff, int len, void *userdata) { TimidityPPMIDIDevice *song = (TimidityPPMIDIDevice *)userdata; - + #ifdef _WIN32 DWORD avail, got, didget; @@ -606,7 +647,7 @@ bool TimidityPPMIDIDevice::FillStream(SoundStream *stream, void *buff, int len, memset ((uint8_t *)buff+didget, 0, len-didget); break; } - } + } } #else ssize_t got; From 18e76c978c7058656b7cf873389466580a324ae1 Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Sun, 30 Jul 2017 22:27:02 -0400 Subject: [PATCH 72/77] Fix code style, and make some minor changes Assume timidity is in the user's PATH if not the specified location Also, get the error message for the execvp failure if it does fail --- .../music_timiditypp_mididevice.cpp | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/sound/mididevices/music_timiditypp_mididevice.cpp b/src/sound/mididevices/music_timiditypp_mididevice.cpp index 0628ea140..a2da274e3 100644 --- a/src/sound/mididevices/music_timiditypp_mididevice.cpp +++ b/src/sound/mididevices/music_timiditypp_mididevice.cpp @@ -529,20 +529,27 @@ bool TimidityPPMIDIDevice::LaunchTimidity () int spaceIdx = 0; int spaceInExePathCount = -1; FString TimidityExe; - do { + do + { spaceIdx = CommandLine.IndexOf(' ', spaceIdx); spaceInExePathCount += 1; TimidityExe = CommandLine.Left(spaceIdx); glob(TimidityExe.GetChars(), 0, NULL, &glb); } while (spaceIdx != -1 && glb.gl_pathc == 0); - if (spaceIdx == -1) return false; + if (spaceIdx == -1) + { + TimidityExe = FString("timidity"); // Maybe it's in your PATH? + } globfree(&glb); int strCount = 1; - for (spaceIdx = 0; spaceIdx < CommandLine.Len(); spaceIdx++) { - if (CommandLine[spaceIdx] == ' ') { + for (spaceIdx = 0; spaceIdx < CommandLine.Len(); spaceIdx++) + { + if (CommandLine[spaceIdx] == ' ') + { ++strCount; - if (CommandLine[spaceIdx+1] == ' ') { + if (CommandLine[spaceIdx+1] == ' ') + { --strCount; } } @@ -558,11 +565,14 @@ bool TimidityPPMIDIDevice::LaunchTimidity () strcpy(TimidityArgs[0], TimidityExe.GetChars()); int argLen; - while (curSpace != -1) { + while (curSpace != -1) + { curSpace = CommandLine.IndexOf(' ', spaceIdx); - if (curSpace != spaceIdx) { + if (curSpace != spaceIdx) + { argLen = curSpace - spaceIdx + 1; - if (argLen < 0) { + if (argLen < 0) + { argLen = CommandLine.Len() - curSpace; } TimidityArgs[i] = new char[argLen]; @@ -573,7 +583,8 @@ bool TimidityPPMIDIDevice::LaunchTimidity () } DPrintf(DMSG_NOTIFY, "Timidity EXE: \x1cG%s\n", TimidityExe.GetChars()); - for (i = 0; i < strCount; i++) { + for (i = 0; i < strCount; i++) + { DPrintf(DMSG_NOTIFY, "arg %d: \x1cG%s\n", i, TimidityArgs[i]); } @@ -588,7 +599,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity () close (WavePipe[1]); execvp (TimidityExe.GetChars(), TimidityArgs); - fprintf(stderr,"execvp failed\n"); + fprintf(stderr,"execvp failed: %s\n", strerror(errno)); _exit (0); // if execvp succeeds, we never get here } else if (forkres < 0) From ff35620a09e7f5b4b1cea4e861a1aa2fea95fe55 Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Mon, 31 Jul 2017 08:15:51 -0400 Subject: [PATCH 73/77] Fix freeze when timidity_exe is not set to timidity's absolute path --- src/sound/mididevices/music_timiditypp_mididevice.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sound/mididevices/music_timiditypp_mididevice.cpp b/src/sound/mididevices/music_timiditypp_mididevice.cpp index a2da274e3..0a4b31c36 100644 --- a/src/sound/mididevices/music_timiditypp_mididevice.cpp +++ b/src/sound/mididevices/music_timiditypp_mididevice.cpp @@ -532,13 +532,15 @@ bool TimidityPPMIDIDevice::LaunchTimidity () do { spaceIdx = CommandLine.IndexOf(' ', spaceIdx); - spaceInExePathCount += 1; TimidityExe = CommandLine.Left(spaceIdx); glob(TimidityExe.GetChars(), 0, NULL, &glb); - } while (spaceIdx != -1 && glb.gl_pathc == 0); - if (spaceIdx == -1) + spaceIdx += 1; + spaceInExePathCount += 1; + } while (spaceIdx != 0 && glb.gl_pathc == 0); + if (spaceIdx == 0) { TimidityExe = FString("timidity"); // Maybe it's in your PATH? + spaceInExePathCount = 0; } globfree(&glb); From a4370a3529ff34e6a91ed56549119ec5a4eb3178 Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Mon, 31 Jul 2017 08:27:02 -0400 Subject: [PATCH 74/77] Null-terminate strings --- src/sound/mididevices/music_timiditypp_mididevice.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sound/mididevices/music_timiditypp_mididevice.cpp b/src/sound/mididevices/music_timiditypp_mididevice.cpp index 0a4b31c36..27863a25c 100644 --- a/src/sound/mididevices/music_timiditypp_mididevice.cpp +++ b/src/sound/mididevices/music_timiditypp_mididevice.cpp @@ -564,6 +564,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity () int curSpace = spaceIdx, i = 1; TimidityArgs[0] = new char[TimidityExe.Len() + 1]; + TimidityArgs[0][TimidityExe.Len()] = 0; strcpy(TimidityArgs[0], TimidityExe.GetChars()); int argLen; @@ -578,6 +579,7 @@ bool TimidityPPMIDIDevice::LaunchTimidity () argLen = CommandLine.Len() - curSpace; } TimidityArgs[i] = new char[argLen]; + TimidityArgs[i][argLen-1] = 0; strcpy(TimidityArgs[i], CommandLine.Mid(spaceIdx, curSpace - spaceIdx).GetChars()); i += 1; } From 7ff0040f3029777501ef9e0bf1f1eef7fb2ad358 Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Mon, 31 Jul 2017 10:44:23 -0400 Subject: [PATCH 75/77] Add a null pointer at the end of TimidityArgs This actually got the execvp call working consistently for me; now I can listen to MIDI music in GZDoom again. --- src/sound/mididevices/music_timiditypp_mididevice.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sound/mididevices/music_timiditypp_mididevice.cpp b/src/sound/mididevices/music_timiditypp_mididevice.cpp index 27863a25c..254b840a0 100644 --- a/src/sound/mididevices/music_timiditypp_mididevice.cpp +++ b/src/sound/mididevices/music_timiditypp_mididevice.cpp @@ -558,7 +558,8 @@ bool TimidityPPMIDIDevice::LaunchTimidity () } strCount -= spaceInExePathCount; - char** TimidityArgs = new char*[strCount]; + char** TimidityArgs = new char*[strCount + 1]; + TimidityArgs[strCount] = NULL; spaceIdx = CommandLine.IndexOf(' '); int curSpace = spaceIdx, i = 1; From 8dff91915a699ce788b8d7ad2e6f1134a7c815fc Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Mon, 31 Jul 2017 11:12:08 -0400 Subject: [PATCH 76/77] - remove vestigial version.h include from r_portal.cpp. This should stop r_all.o from compiling every single commit. --- src/swrenderer/scene/r_portal.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/swrenderer/scene/r_portal.cpp b/src/swrenderer/scene/r_portal.cpp index 6c585d13a..a22232dbf 100644 --- a/src/swrenderer/scene/r_portal.cpp +++ b/src/swrenderer/scene/r_portal.cpp @@ -51,7 +51,6 @@ #include "r_data/colormaps.h" #include "p_maputl.h" #include "p_setup.h" -#include "version.h" #include "r_utility.h" #include "r_3dfloors.h" #include "g_levellocals.h" From 04be9fe6f2d13e24fc89d643294a704ef772bc85 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 31 Jul 2017 20:09:45 +0200 Subject: [PATCH 77/77] - Remove test code committed by accident --- src/gl/shaders/gl_postprocessshader.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gl/shaders/gl_postprocessshader.cpp b/src/gl/shaders/gl_postprocessshader.cpp index b8011083a..d4ab9bbc9 100644 --- a/src/gl/shaders/gl_postprocessshader.cpp +++ b/src/gl/shaders/gl_postprocessshader.cpp @@ -209,8 +209,6 @@ void PostProcessShaderInstance::UpdateUniforms() } } } - - glUniform1i(glGetUniformLocation(mProgram, "SillyTexture"), 1); } void PostProcessShaderInstance::BindTextures()