- Added auto-detection scheme for r_vanillatrans
It now works the following way: (0) - Force off (ZDoom defaults) (1) - Force on (Doom defaults) (2) - Auto off (Prefer ZDoom defaults - if DEHACKED is detected with no ZSCRIPT it will turn on) (default) (3) - Auto on (Prefer Doom defaults - if DECORATE is detected with no ZSCRIPT it will turn off)
This commit is contained in:
parent
28821e5eca
commit
9af370f51e
10 changed files with 89 additions and 9 deletions
67
src/r_data/r_vanillatrans.cpp
Normal file
67
src/r_data/r_vanillatrans.cpp
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue