Merge commit 'refs/pull/340/head' of https://github.com/coelckers/gzdoom

# Conflicts:
#	src/gl/scene/gl_sprite.cpp
#	src/polyrenderer/scene/poly_sprite.cpp
#	src/swrenderer/things/r_sprite.cpp
#	wadsrc/static/language.enu
#	wadsrc/static/menudef.txt
This commit is contained in:
Rachael Alexanderson 2017-06-03 20:06:28 -04:00
commit deb62ee156
10 changed files with 89 additions and 41 deletions

View file

@ -1124,6 +1124,7 @@ set (PCH_SOURCES
r_data/voxels.cpp
r_data/renderstyle.cpp
r_data/r_interpolate.cpp
r_data/r_vanillatrans.cpp
scripting/symbols.cpp
scripting/types.cpp
scripting/thingdef.cpp

View file

@ -116,6 +116,7 @@
#include "r_utility.h"
#include "vm.h"
#include "types.h"
#include "r_data/r_vanillatrans.h"
EXTERN_CVAR(Bool, hud_althud)
void DrawHUD();
@ -2606,6 +2607,9 @@ void D_DoomMain (void)
D_CheckNetGame ();
}
// [SP] Force vanilla transparency auto-detection to re-detect our game lumps now
UpdateVanillaTransparency();
// [RH] Lock any cvars that should be locked now that we're
// about to begin the game.
FBaseCVar::EnableNoSet ();

View file

@ -39,6 +39,7 @@
#include "g_levellocals.h"
#include "events.h"
#include "actorinlines.h"
#include "r_data/r_vanillatrans.h"
#include "gl/system/gl_interface.h"
#include "gl/system/gl_framebuffer.h"
@ -993,7 +994,7 @@ void GLSprite::Process(AActor* thing, sector_t * sector, int thruportal)
{
trans = 1.f;
}
if (r_vanillatrans)
if (UseVanillaTransparency())
{
// [SP] "canonical transparency" - with the flip of a CVar, disable transparency for Doom objects,
// and disable 'additive' translucency for certain objects from other games.

View file

@ -28,6 +28,7 @@
#include "poly_sprite.h"
#include "polyrenderer/poly_renderer.h"
#include "polyrenderer/scene/poly_light.h"
#include "r_data/r_vanillatrans.h"
EXTERN_CVAR(Float, transsouls)
EXTERN_CVAR(Int, r_drawfuzz)
@ -146,7 +147,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, const PolyClipPlane
args.SetStencilTestValue(stencilValue);
args.SetWriteStencil(true, stencilValue);
args.SetClipPlane(clipPlane);
if ((thing->renderflags & RF_ZDOOMTRANS) && r_vanillatrans)
if ((thing->renderflags & RF_ZDOOMTRANS) && UseVanillaTransparency())
args.SetStyle(LegacyRenderStyles[STYLE_Normal], 1.0f, thing->fillcolor, thing->Translation, tex, fullbrightSprite);
else
args.SetStyle(thing->RenderStyle, thing->Alpha, thing->fillcolor, thing->Translation, tex, fullbrightSprite);

View file

@ -0,0 +1,67 @@
#include "templates.h"
#include "c_cvars.h"
#include "w_wad.h"
#ifdef _DEBUG
#include "c_dispatch.h"
#endif
CVAR (Int, r_vanillatrans, 2, CVAR_ARCHIVE)
namespace
{
bool firstTime = true;
bool foundDehacked = false;
bool foundDecorate = false;
bool foundZScript = false;
}
#ifdef _DEBUG
CCMD (debug_checklumps)
{
Printf("firstTime: %d\n", firstTime);
Printf("foundDehacked: %d\n", foundDehacked);
Printf("foundDecorate: %d\n", foundDecorate);
Printf("foundZScript: %d\n", foundZScript);
}
#endif
void UpdateVanillaTransparency()
{
firstTime = true;
}
bool UseVanillaTransparency()
{
if (firstTime)
{
int lastlump = 0;
Wads.FindLump("ZSCRIPT", &lastlump); // ignore first ZScript
if (Wads.FindLump("ZSCRIPT", &lastlump) == -1) // no loaded ZScript
{
lastlump = 0;
foundDehacked = Wads.FindLump("DEHACKED", &lastlump) != -1;
lastlump = 0;
foundDecorate = Wads.FindLump("DECORATE", &lastlump) != -1;
foundZScript = false;
}
else
{
foundZScript = true;
foundDehacked = false;
foundDecorate = false;
}
firstTime = false;
}
switch (r_vanillatrans)
{
case 0: return false;
case 1: return true;
default:
if (foundDehacked)
return true;
if (foundDecorate)
return false;
return r_vanillatrans == 3;
}
}

View file

@ -0,0 +1,3 @@
void UpdateVanillaTransparency();
bool UseVanillaTransparency();

View file

@ -65,6 +65,7 @@
#include "swrenderer/r_memory.h"
#include "swrenderer/r_renderthread.h"
#include "a_dynlight.h"
#include "r_data/r_vanillatrans.h"
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
EXTERN_CVAR(Bool, gl_light_sprites)
@ -213,7 +214,7 @@ namespace swrenderer
if (thing->flags5 & MF5_BRIGHT)
vis->renderflags |= RF_FULLBRIGHT; // kg3D
vis->RenderStyle = thing->RenderStyle;
if (r_vanillatrans)
if (UseVanillaTransparency())
{
if (thing->renderflags & RF_ZDOOMTRANS)
vis->RenderStyle = LegacyRenderStyles[STYLE_Normal];