mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-12 07:34:36 +00:00
Merge branch 'master-1.4pre'
This commit is contained in:
commit
fb38fa2eea
21 changed files with 128 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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")
|
||||
|
|
1
src/gi.h
1
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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -43,6 +43,8 @@ public:
|
|||
void BindNextFB();
|
||||
void NextTexture();
|
||||
|
||||
int GetCurrentFB() const { return mPipelineFB[mCurrentPipelineTexture]; }
|
||||
|
||||
void BindOutputFB();
|
||||
|
||||
void BlitToEyeTexture(int eye);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -38,6 +38,7 @@ gameinfo
|
|||
weaponslot = 7, "LAZDevice"
|
||||
dimcolor = "ff d7 00"
|
||||
dimamount = 0.2
|
||||
bluramount = 0.5
|
||||
definventorymaxamount = 25
|
||||
defaultrespawntime = 12
|
||||
defaultdropstyle = 1
|
||||
|
|
|
@ -39,6 +39,7 @@ gameinfo
|
|||
weaponslot = 7, "BFG9000"
|
||||
dimcolor = "ff d7 00"
|
||||
dimamount = 0.2
|
||||
bluramount = 0.5
|
||||
definventorymaxamount = 25
|
||||
defaultrespawntime = 12
|
||||
defaultdropstyle = 1
|
||||
|
|
|
@ -38,6 +38,7 @@ gameinfo
|
|||
weaponslot = 7, "Mace"
|
||||
dimcolor = "00 00 ff"
|
||||
dimamount = 0.2
|
||||
bluramount = 0.5
|
||||
definventorymaxamount = 16
|
||||
defaultrespawntime = 12
|
||||
defaultdropstyle = 1
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -27,6 +27,7 @@ gameinfo
|
|||
intermissioncounter = true
|
||||
dimcolor = "6f 00 6b"
|
||||
dimamount = 0.8
|
||||
bluramount = 0.0
|
||||
definventorymaxamount = 25
|
||||
defaultrespawntime = 12
|
||||
defaultdropstyle = 1
|
||||
|
|
|
@ -38,6 +38,7 @@ gameinfo
|
|||
weaponslot = 8, "Sigil"
|
||||
dimcolor = "ff d7 00"
|
||||
dimamount = 0.2
|
||||
bluramount = 0.5
|
||||
definventorymaxamount = 25
|
||||
defaultrespawntime = 16
|
||||
defaultdropstyle = 2
|
||||
|
|
|
@ -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 " "
|
||||
|
|
Loading…
Reference in a new issue