diff --git a/src/g_game.cpp b/src/g_game.cpp index 17cd67a7a..e70935cf4 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1764,6 +1764,8 @@ void G_DoReborn (int playernum, bool freshbot) } else { + bool isUnfriendly = players[playernum].mo && !(players[playernum].mo->flags & MF_FRIENDLY); + // respawn at the start // first disassociate the corpse if (players[playernum].mo) @@ -1773,7 +1775,7 @@ void G_DoReborn (int playernum, bool freshbot) } // spawn at random spot if in deathmatch - if (deathmatch) + if (deathmatch || isUnfriendly) { G_DeathMatchSpawnPlayer (playernum); return; diff --git a/src/gi.cpp b/src/gi.cpp index ac4f5117c..467847092 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -378,6 +378,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_BOOL(nightmarefast, "nightmarefast") GAMEINFOKEY_COLOR(dimcolor, "dimcolor") GAMEINFOKEY_FLOAT(dimamount, "dimamount") + GAMEINFOKEY_FLOAT(bluramount, "bluramount") GAMEINFOKEY_INT(definventorymaxamount, "definventorymaxamount") GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") GAMEINFOKEY_INT(defaultrespawntime, "defaultrespawntime") diff --git a/src/gi.h b/src/gi.h index d656e80bf..52fdaf49c 100644 --- a/src/gi.h +++ b/src/gi.h @@ -158,6 +158,7 @@ struct gameinfo_t FString CursorPic; uint32_t dimcolor; float dimamount; + float bluramount; int definventorymaxamount; int defaultrespawntime; int defaultdropstyle; diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 2f9b31bbb..827dd7da2 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -145,6 +145,7 @@ CUSTOM_CVAR(Bool, gl_paltonemap_reverselookup, true, CVAR_ARCHIVE | CVAR_NOINITC GLRenderer->ClearTonemapPalette(); } +CVAR(Float, gl_menu_blur, -1.0f, CVAR_ARCHIVE) EXTERN_CVAR(Float, vid_brightness) EXTERN_CVAR(Float, vid_contrast) @@ -467,6 +468,86 @@ void FGLRenderer::BloomScene(int fixedcm) FGLDebug::PopGroup(); } +//----------------------------------------------------------------------------- +// +// Blur the scene +// +//----------------------------------------------------------------------------- + +void FGLRenderer::BlurScene(float gameinfobluramount) +{ + // first, respect the CVar + float blurAmount = gl_menu_blur; + + // if CVar is negative, use the gameinfo entry + if (gl_menu_blur < 0) + blurAmount = gameinfobluramount; + + // if blurAmount == 0 or somehow still returns negative, exit to prevent a crash, clearly we don't want this + if ((blurAmount <= 0.0) || !FGLRenderBuffers::IsEnabled()) + return; + + FGLDebug::PushGroup("BlurScene"); + + FGLPostProcessState savedState; + savedState.SaveTextureBindings(2); + + int sampleCount = 9; + int numLevels = 3; // Must be 4 or less (since FGLRenderBuffers::NumBloomLevels is 4 and we are using its buffers). + assert(numLevels <= FGLRenderBuffers::NumBloomLevels); + + const auto &viewport = mScreenViewport; // The area we want to blur. Could also be mSceneViewport if only the scene area is to be blured + + const auto &level0 = mBuffers->BloomLevels[0]; + + // Grab the area we want to bloom: + glBindFramebuffer(GL_READ_FRAMEBUFFER, mBuffers->GetCurrentFB()); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, level0.VFramebuffer); + glBlitFramebuffer(viewport.left, viewport.top, viewport.width, viewport.height, 0, 0, level0.Width, level0.Height, GL_COLOR_BUFFER_BIT, GL_LINEAR); + + // Blur and downscale: + for (int i = 0; i < numLevels - 1; i++) + { + const auto &level = mBuffers->BloomLevels[i]; + const auto &next = mBuffers->BloomLevels[i + 1]; + mBlurShader->BlurHorizontal(this, blurAmount, sampleCount, level.VTexture, level.HFramebuffer, level.Width, level.Height); + mBlurShader->BlurVertical(this, blurAmount, sampleCount, level.HTexture, next.VFramebuffer, next.Width, next.Height); + } + + // Blur and upscale: + for (int i = numLevels - 1; i > 0; i--) + { + const auto &level = mBuffers->BloomLevels[i]; + const auto &next = mBuffers->BloomLevels[i - 1]; + + mBlurShader->BlurHorizontal(this, blurAmount, sampleCount, level.VTexture, level.HFramebuffer, level.Width, level.Height); + mBlurShader->BlurVertical(this, blurAmount, sampleCount, level.HTexture, level.VFramebuffer, level.Width, level.Height); + + // Linear upscale: + glBindFramebuffer(GL_FRAMEBUFFER, next.VFramebuffer); + glViewport(0, 0, next.Width, next.Height); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, level.VTexture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + mBloomCombineShader->Bind(); + mBloomCombineShader->BloomTexture.Set(0); + RenderScreenQuad(); + } + + mBlurShader->BlurHorizontal(this, blurAmount, sampleCount, level0.VTexture, level0.HFramebuffer, level0.Width, level0.Height); + mBlurShader->BlurVertical(this, blurAmount, sampleCount, level0.HTexture, level0.VFramebuffer, level0.Width, level0.Height); + + // Copy blur back to scene texture: + glBindFramebuffer(GL_READ_FRAMEBUFFER, level0.VFramebuffer); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mBuffers->GetCurrentFB()); + glBlitFramebuffer(0, 0, level0.Width, level0.Height, viewport.left, viewport.top, viewport.width, viewport.height, GL_COLOR_BUFFER_BIT, GL_LINEAR); + + glViewport(mScreenViewport.left, mScreenViewport.top, mScreenViewport.width, mScreenViewport.height); + + FGLDebug::PopGroup(); +} + //----------------------------------------------------------------------------- // // Tonemap scene texture and place the result in the HUD/2D texture diff --git a/src/gl/renderer/gl_renderbuffers.h b/src/gl/renderer/gl_renderbuffers.h index 5df3bcca0..41202b499 100644 --- a/src/gl/renderer/gl_renderbuffers.h +++ b/src/gl/renderer/gl_renderbuffers.h @@ -43,6 +43,8 @@ public: void BindNextFB(); void NextTexture(); + int GetCurrentFB() const { return mPipelineFB[mCurrentPipelineTexture]; } + void BindOutputFB(); void BlitToEyeTexture(int eye); diff --git a/src/gl/renderer/gl_renderer.h b/src/gl/renderer/gl_renderer.h index 63168ff24..ce59a032c 100644 --- a/src/gl/renderer/gl_renderer.h +++ b/src/gl/renderer/gl_renderer.h @@ -180,6 +180,7 @@ public: void ClearTonemapPalette(); void LensDistortScene(); void ApplyFXAA(); + void BlurScene(float gameinfobluramount); void CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma); void DrawPresentTexture(const GL_IRECT &box, bool applyGamma); void Flush(); diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index be14b2f09..89503c42a 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -57,6 +57,7 @@ #include "textures/textures.h" #include "virtual.h" #include "events.h" +#include "gl/renderer/gl_renderer.h" // for menu blur // // Todo: Move these elsewhere @@ -784,6 +785,8 @@ void M_Drawer (void) if (CurrentMenu != nullptr && menuactive != MENU_Off) { + if (GLRenderer) + GLRenderer->BlurScene(gameinfo.bluramount); if (!CurrentMenu->DontDim) { screen->Dim(fade); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 8aed0370e..aca2d8bb0 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1883,6 +1883,9 @@ bool P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params) if (!(player->mo->flags & MF_SHOOTABLE)) continue; // not shootable (observer or dead) + if (!((actor->flags ^ player->mo->flags) & MF_FRIENDLY)) + continue; // same +MF_FRIENDLY, ignore + if (player->cheats & CF_NOTARGET) continue; // no target @@ -1982,7 +1985,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look) targ = NULL; } - if (targ && targ->player && (targ->player->cheats & CF_NOTARGET)) + if (targ && targ->player && ((targ->player->cheats & CF_NOTARGET) || !(targ->flags & MF_FRIENDLY))) { return 0; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 6a543f091..23b079426 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -7279,7 +7279,7 @@ bool AActor::IsTeammate (AActor *other) } else if (!deathmatch && player && other->player) { - return true; + return (!((flags ^ other->flags) & MF_FRIENDLY)); } else if (teamplay) { @@ -7360,6 +7360,9 @@ bool AActor::IsFriend (AActor *other) other->FriendPlayer == 0 || players[FriendPlayer-1].mo->IsTeammate(players[other->FriendPlayer-1].mo); } + // [SP] If friendly flags match, then they are on the same team. + /*if (!((flags ^ other->flags) & MF_FRIENDLY)) + return true;*/ return false; } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index eccad199e..064a92a1f 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -4080,6 +4080,22 @@ void P_SetupLevel (const char *lumpname, int position) } } + // [SP] move unfriendly players around + // horribly hacky - yes, this needs rewritten. + for (i = 0; i < MAXPLAYERS; ++i) + { + if (playeringame[i] && players[i].mo != NULL) + { + if (!(players[i].mo->flags & MF_FRIENDLY)) + { + AActor * oldSpawn = players[i].mo; + G_DeathMatchSpawnPlayer (i); + oldSpawn->Destroy(); + } + } + } + + // Don't count monsters in end-of-level sectors if option is on if (dmflags2 & DF2_NOCOUNTENDMONST) { diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index 00b39639f..fd09c88f8 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -148,7 +148,7 @@ CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_ static int s_currentRenderer; -CUSTOM_CVAR(Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR(Int, vid_renderer, 0, 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 e512adb73..88870cb52 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, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR (Int, vid_renderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { // 0: Software renderer // 1: OpenGL renderer diff --git a/src/win32/hardware.cpp b/src/win32/hardware.cpp index b083f4fe9..70e622b39 100644 --- a/src/win32/hardware.cpp +++ b/src/win32/hardware.cpp @@ -106,7 +106,7 @@ CUSTOM_CVAR(Bool, vid_used3d, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOIN } // [ZDoomGL] -CUSTOM_CVAR (Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) +CUSTOM_CVAR (Int, vid_renderer, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) { // 0: Software renderer // 1: OpenGL renderer diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 550a94634..2a97c991c 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -2706,6 +2706,7 @@ GLPREFMNU_SPRBILLFACECAMERA = "Sprites face camera"; GLPREFMNU_PARTICLESTYLE = "Particle style"; GLPREFMNU_AMBLIGHT = "Ambient light level"; GLPREFMNU_RENDERQUALITY = "Rendering quality"; +GLPREFMNU_MENUBLUR = "Menu Blur"; GLPREFMNU_VRMODE = "Stereo 3D VR"; GLPREFMNU_VRQUADSTEREO = "Enable Quad Stereo"; GLPREFMNU_MULTISAMPLE = "Multisample"; diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 4bff1283e..f35a5f2cd 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -38,6 +38,7 @@ gameinfo weaponslot = 7, "LAZDevice" dimcolor = "ff d7 00" dimamount = 0.2 + bluramount = 0.5 definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index c033ce09c..8dd21dbad 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -39,6 +39,7 @@ gameinfo weaponslot = 7, "BFG9000" dimcolor = "ff d7 00" dimamount = 0.2 + bluramount = 0.5 definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index af0295ef3..241853793 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -38,6 +38,7 @@ gameinfo weaponslot = 7, "Mace" dimcolor = "00 00 ff" dimamount = 0.2 + bluramount = 0.5 definventorymaxamount = 16 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 37afe7336..09d325464 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -37,6 +37,7 @@ gameinfo weaponslot = 4, "FWeapQuietus", "CWeapWraithverge", "MWeapBloodscourge" dimcolor = "00 00 ff" dimamount = 0.2 + bluramount = 0.5 definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/mindefaults.txt b/wadsrc/static/mapinfo/mindefaults.txt index 885587281..f02ff78d0 100644 --- a/wadsrc/static/mapinfo/mindefaults.txt +++ b/wadsrc/static/mapinfo/mindefaults.txt @@ -27,6 +27,7 @@ gameinfo intermissioncounter = true dimcolor = "6f 00 6b" dimamount = 0.8 + bluramount = 0.0 definventorymaxamount = 25 defaultrespawntime = 12 defaultdropstyle = 1 diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index 419c8c13f..73f7c4572 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -38,6 +38,7 @@ gameinfo weaponslot = 8, "Sigil" dimcolor = "ff d7 00" dimamount = 0.2 + bluramount = 0.5 definventorymaxamount = 25 defaultrespawntime = 16 defaultdropstyle = 2 diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 3c9c88759..8e6db82f2 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -2152,6 +2152,8 @@ OptionMenu "OpenGLOptions" Option "$GLPREFMNU_PARTICLESTYLE", gl_particles_style, "Particles" Option "$GLPREFMNU_RENDERQUALITY", gl_render_precise, "Precision" StaticText " " + Slider "$GLPREFMNU_MENUBLUR", gl_menu_blur, 0, 5.0, 0.5, 2 + StaticText " " Option "$GLPREFMNU_VRMODE", vr_mode, "VRMode" Option "$GLPREFMNU_VRQUADSTEREO", vr_enable_quadbuffered, "OnOff" StaticText " "