mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
Merge branch 'master' into newrenderer2
# Conflicts: # source/build/src/defs.cpp
This commit is contained in:
commit
333581a084
11 changed files with 142 additions and 42 deletions
|
@ -628,7 +628,7 @@ int32_t md_definehud (int32_t modelid, int32_t tilex, vec3f_t add,
|
|||
int32_t md_undefinetile(int32_t tile);
|
||||
int32_t md_undefinemodel(int32_t modelid);
|
||||
|
||||
int32_t loaddefinitionsfile(const char *fn, bool loadadds = false);
|
||||
int32_t loaddefinitionsfile(const char *fn, bool loadadds = false, bool cumulative = false);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
# include "polymost.h"
|
||||
|
|
|
@ -113,12 +113,6 @@ inline void scriptfile_close(scriptfile *sf)
|
|||
delete sf;
|
||||
}
|
||||
|
||||
inline int32_t scriptfile_addsymbolvalue(scriptfile *sf, char const *name, int32_t val)
|
||||
{
|
||||
sf->AddSymbol(name, val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *text;
|
||||
|
|
|
@ -2917,7 +2917,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
break;
|
||||
|
||||
FStringf name("%s.%s", resName.GetChars(), resType.GetChars());
|
||||
fileSystem.CreatePathlessCopy(resName, resID, 0);
|
||||
fileSystem.CreatePathlessCopy(name, resID, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2930,34 +2930,44 @@ static int32_t defsparser(scriptfile *script)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int32_t loaddefinitionsfile(const char *fn, bool loadadds)
|
||||
int32_t loaddefinitionsfile(const char *fn, bool loadadds, bool cumulative)
|
||||
{
|
||||
scriptfile *script;
|
||||
|
||||
script = scriptfile_fromfile(fn);
|
||||
|
||||
if (script)
|
||||
bool done = false;
|
||||
auto parseit = [&](int lump)
|
||||
{
|
||||
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n",fn);
|
||||
FScanner sc;
|
||||
sc.OpenLumpNum(lump);
|
||||
sc.SetNoOctals(true);
|
||||
sc.SetNoFatalErrors(true);
|
||||
defsparser(&sc);
|
||||
done = true;
|
||||
Printf(PRINT_NONOTIFY, "\n");
|
||||
};
|
||||
|
||||
defsparser(script);
|
||||
if (!cumulative)
|
||||
{
|
||||
int lump = fileSystem.FindFile(fn);
|
||||
if (lump >= 0)
|
||||
{
|
||||
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fn);
|
||||
parseit(lump);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int lump, lastlump = 0;
|
||||
while ((lump = fileSystem.FindLumpFullName(fn, &lastlump)) >= 0)
|
||||
{
|
||||
Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fileSystem.GetFileFullPath(lump).GetChars());
|
||||
parseit(lump);
|
||||
}
|
||||
}
|
||||
|
||||
if (userConfig.AddDefs && loadadds) for (auto& m : *userConfig.AddDefs)
|
||||
{
|
||||
Printf("Loading module \"%s\"\n",m.GetChars());
|
||||
defsparser_include(m, NULL, NULL); // Q: should we let the external script see our symbol table?
|
||||
defsparser_include(m, nullptr, nullptr); // Q: should we let the external script see our symbol table?
|
||||
Printf(PRINT_NONOTIFY, "\n");
|
||||
}
|
||||
|
||||
if (script)
|
||||
scriptfile_close(script);
|
||||
|
||||
if (!script) return -1;
|
||||
|
||||
Printf(PRINT_NONOTIFY, "\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// vim:ts=4:
|
||||
|
|
|
@ -76,14 +76,14 @@ struct FileSystem::LumpRecord
|
|||
shortName.String[8] = 0;
|
||||
longName = "";
|
||||
Namespace = lump->GetNamespace();
|
||||
resourceId = 0;
|
||||
resourceId = -1;
|
||||
}
|
||||
else if ((lump->Flags & LUMPF_EMBEDDED) || !lump->getName() || !*lump->getName())
|
||||
{
|
||||
shortName.qword = 0;
|
||||
longName = "";
|
||||
Namespace = ns_hidden;
|
||||
resourceId = 0;
|
||||
resourceId = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -361,7 +361,7 @@ void UserConfig::ProcessOptions()
|
|||
|
||||
static const char* defs[] = { "-def", "-h", nullptr };
|
||||
Args->CollectFiles("-def", defs, ".def");
|
||||
DefaultDef = Args->CheckValue("-def");
|
||||
UserDef = Args->CheckValue("-def");
|
||||
|
||||
if (DefaultCon.IsEmpty())
|
||||
{
|
||||
|
@ -1323,27 +1323,50 @@ void DrawCrosshair(int deftile, int health, double xdelta, double ydelta, double
|
|||
|
||||
void LoadDefinitions()
|
||||
{
|
||||
loaddefinitionsfile("engine/engine.def"); // Internal stuff that is required.
|
||||
|
||||
const char* defsfile = G_DefFile();
|
||||
|
||||
cycle_t deftimer;
|
||||
deftimer.Reset();
|
||||
deftimer.Clock();
|
||||
if (!loaddefinitionsfile(defsfile, true))
|
||||
const char* loaded = nullptr;
|
||||
|
||||
const char* defsfile = G_DefFile();
|
||||
FString razedefsfile = defsfile;
|
||||
razedefsfile.Substitute(".def", "-raze.def");
|
||||
|
||||
loaddefinitionsfile("engine/engine.def", false); // Internal stuff that is required.
|
||||
|
||||
// check what we have.
|
||||
// user .defs override the default ones and are not cumulative.
|
||||
// if we fine even one Raze-specific file, all of those will be loaded cumulatively.
|
||||
// otherwise the default rules inherited from older ports apply.
|
||||
if (userConfig.UserDef.IsNotEmpty())
|
||||
{
|
||||
if (!loaddefinitionsfile(userConfig.UserDef, true, false)) loaded = userConfig.UserDef;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fileSystem.FileExists(razedefsfile))
|
||||
{
|
||||
if (!loaddefinitionsfile(razedefsfile, true, true)) loaded = razedefsfile;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!loaddefinitionsfile(defsfile, true, false)) loaded = defsfile;
|
||||
}
|
||||
}
|
||||
|
||||
if (loaded)
|
||||
{
|
||||
deftimer.Unclock();
|
||||
Printf(PRINT_NONOTIFY, "Definitions file \"%s\" loaded in %.3f ms.\n", defsfile, deftimer.TimeMS());
|
||||
DPrintf(DMSG_SPAMMY, "Definitions file \"%s\" loaded, %f ms.\n", loaded, deftimer.TimeMS());
|
||||
}
|
||||
userConfig.AddDefs.reset();
|
||||
|
||||
// load the widescreen replacements last so that they do not clobber the CRC for the original items so that mod-side replacement are picked up.
|
||||
// load the widescreen replacements last. This ensures that mods still get the correct CRCs for their own tile replacements.
|
||||
if (fileSystem.FindFile("engine/widescreen.def") >= 0 && !Args->CheckParm("-nowidescreen"))
|
||||
{
|
||||
loaddefinitionsfile("engine/widescreen.def");
|
||||
}
|
||||
|
||||
|
||||
fileSystem.InitHashChains(); // make sure that any resources that got added can be found again.
|
||||
}
|
||||
|
||||
bool M_Active()
|
||||
|
|
|
@ -65,6 +65,7 @@ struct UserConfig
|
|||
{
|
||||
FString gamegrp;
|
||||
FString CommandMap;
|
||||
FString UserDef;
|
||||
FString DefaultDef;
|
||||
FString DefaultCon;
|
||||
FString CommandDemo;
|
||||
|
|
|
@ -51,6 +51,20 @@ void parseSkip(FScanner& sc, FScriptPosition& pos)
|
|||
for (int i = 0; i < cnt; i++) if (!sc.GetNumber(true)) return;
|
||||
}
|
||||
|
||||
void parseDefine(FScanner& sc, FScriptPosition& pos)
|
||||
{
|
||||
FString name;
|
||||
if (!sc.GetString(name)) return;
|
||||
if (!sc.GetNumber()) return;
|
||||
sc.AddSymbol(name, sc.Number);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void parseDefineTexture(FScanner& sc, FScriptPosition& pos)
|
||||
{
|
||||
int tile, palette;
|
||||
|
@ -178,3 +192,54 @@ void parseAnimTileRange(FScanner& sc, FScriptPosition& pos)
|
|||
processSetAnim("animtilerange", pos, set);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void parseAlphahack(FScanner& sc, FScriptPosition& pos)
|
||||
{
|
||||
int tile;
|
||||
|
||||
if (!sc.GetNumber(tile, true)) return;
|
||||
if (!sc.GetFloat(true)) return;
|
||||
if ((unsigned)tile < MAXTILES) TileFiles.tiledata[tile].texture->alphaThreshold = (float)sc.Float;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void parseAlphahackRange(FScanner& sc, FScriptPosition& pos)
|
||||
{
|
||||
int tilestart, tileend;
|
||||
|
||||
if (!sc.GetNumber(tilestart, true)) return;
|
||||
if (!sc.GetNumber(tileend, true)) return;
|
||||
if (!sc.GetFloat(true)) return;
|
||||
if (!ValidateTileRange("alphahackrange", tilestart, tileend, pos)) return;
|
||||
|
||||
for (int i = tilestart; i <= tileend; i++)
|
||||
TileFiles.tiledata[i].texture->alphaThreshold = (float)sc.Number;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void parseDefineTint(FScanner& sc, FScriptPosition& pos)
|
||||
{
|
||||
int pal, r, g, b, f;
|
||||
|
||||
if (!sc.GetNumber(pal, true)) return;
|
||||
if (!sc.GetNumber(r)) return;
|
||||
if (!sc.GetNumber(g)) return;
|
||||
if (!sc.GetNumber(b)) return;
|
||||
if (!sc.GetNumber(f)) return;
|
||||
lookups.setPaletteTint(pal, r, g, b, 0, 0, 0, f);
|
||||
}
|
||||
|
|
|
@ -656,7 +656,7 @@ void ParseScript(int lumpnum)
|
|||
if (dword_44CE0[gParseLevel] == 0)
|
||||
{
|
||||
// In the RFS files I have seen the outermost directory is not part of what goes into the file system.
|
||||
auto inp1 = strchr(inp, '\\');
|
||||
auto inp1 = strpbrk(inp, "/\\");
|
||||
if (!inp1 || !fileSystem.CreatePathlessCopy(inp1 + 1, ID, nFlags))
|
||||
{
|
||||
// I'll activate this when I find evidence that it is needed. Otherwise the risk of picking up unwanted data is too high.
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
tilefromtexture 3463 { file "tiles/options.png" }
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB |
|
@ -1490,6 +1490,14 @@ OptionValue GPUSwitch
|
|||
2.0, "$OPTVAL_INTEGRATED"
|
||||
}
|
||||
|
||||
OptionValue PreferBackend
|
||||
{
|
||||
0, "$OPTVAL_OPENGL"
|
||||
1, "$OPTVAL_VULKAN"
|
||||
// Enable when HAVE_SOFTPOLY will be defined
|
||||
//2, "$OPTVAL_SOFTPOLY"
|
||||
}
|
||||
|
||||
OptionMenu VideoModeMenu protected
|
||||
{
|
||||
Title "$VIDMNU_TITLE"
|
||||
|
|
Loading…
Reference in a new issue