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];

View file

@ -649,50 +649,14 @@ B68EB7CFB4CC481796E2919B9C16DFBD // Moc11.wad e1m6
}
1ED329858AB154C55878DA1C11A4F100 // unloved.pk3:unlovedmaps.wad map01
{
clipmidtex
}
FA23E72FA955E66EC68609F72C0BA71E // unloved.pk3:unlovedmaps.wad map02
{
clipmidtex
}
41BEC1F643CFEEC997AF98276A05EC88 // unloved.pk3:unlovedmaps.wad map03
{
clipmidtex
}
AF9A6370BE562584BC11165ECF364713 // unloved.pk3:unlovedmaps.wad map04
{
clipmidtex
}
DC96228097DD004C40CCB1DB14A91EAA // unloved.pk3:unlovedmaps.wad map05
{
clipmidtex
}
261E64897A572C8DB8DC041E64BE27AD // unloved2beta1.pk3:u2_new2maps2.wad map06
{
clipmidtex
}
04800B1F35E8C036EBABC8C616402927 // unloved2beta1.pk3:u2_new2maps2.wad map07
{
clipmidtex
}
9E54F70648A77BBD090FF78A3AA05367 // unloved2beta1.pk3:u2_new2maps2.wad map08
{
clipmidtex
}
72E9E0F41F691B7F956E62F35B4A617F // unloved2beta1.pk3:u2_new2maps2.wad map09
{
clipmidtex
}
3D3FE412E87AD8B2316DAEC9E25F2E5D // unloved2beta1.pk3:u2_new2maps2.wad map10
{
clipmidtex

View file

@ -2369,6 +2369,10 @@ OPTVAL_SWDOOM = "Doom Software Renderer";
OPTVAL_DEDICATED = "High-Performance";
OPTVAL_INTEGRATED = "Power-Saving";
OPTVAL_VANILLA = "Vanilla";
OPTVAL_VTFZDOOM = "ZDoom (Forced)";
OPTVAL_VTFVANILLA = "Vanilla (Forced)";
OPTVAL_VTAZDOOM = "Auto (Vanilla Preferred)";
OPTVAL_VTAVANILLA = "Auto (ZDoom Preferred)";
// Colors
C_BRICK = "\cabrick";

View file

@ -692,8 +692,10 @@ OptionValue Fuzziness
OptionValue VanillaTrans
{
0.0, "$OPTVAL_ZDOOM"
1.0, "$OPTVAL_VANILLA"
0.0, "$OPTVAL_VTFZDOOM"
1.0, "$OPTVAL_VTFVANILLA"
0.0, "$OPTVAL_VTAZDOOM"
1.0, "$OPTVAL_VTAVANILLA"
}
OptionValue GPUSwitch