aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gamedata/engine.txt15
-rw-r--r--src/build/mkgamedata.c12
-rw-r--r--src/fixes.c2
-rw-r--r--src/gametype.h6
4 files changed, 16 insertions, 19 deletions
diff --git a/gamedata/engine.txt b/gamedata/engine.txt
index 6646565..67cf47e 100644
--- a/gamedata/engine.txt
+++ b/gamedata/engine.txt
@@ -2,23 +2,22 @@
# XXX: const and non-const entries might be flipped here on Windows, not 100%
# sure. kind of just choosing not to care thusfar, as it still works the same!
vtidx_AllocateDLLIdentifier
- NE 5
+ !OE 5
Portal2 8
-vtidx_RegisterConCommand
+vtidx_RegisterConCommand 6
OE 5 # named RegisterConCommandBase here, but same thing
- NE 6
- Portal2 9
+ Portal2 9
vtidx_UnregisterConCommands
- NE 8
+ !OE 8
Portal2 11
vtidx_FindVar 12
OE 7
Portal2 15
vtidx_FindCommand
- NE 14
+ !OE 14
Portal2 17
vtidx_CallGlobalChangeCallbacks
- NE 20
+ !OE 20
L4Dx 18
Portal2 21
vtidx_CallGlobalChangeCallbacks_OE # different function signature, no float arg
@@ -154,7 +153,7 @@ vtidx_VGuiConnect 3 + NVDTOR
L4Dbased 4 + NVDTOR # ActivateGameUI added
L4DS 5 + NVDTOR # some other crap added, god knows
vtidx_VGuiIsInitialized # this is also just called IsInitialized()
- NE 6 + NVDTOR
+ !OE 6 + NVDTOR
L4Dbased 7 + NVDTOR
L4DS 8 + NVDTOR
diff --git a/src/build/mkgamedata.c b/src/build/mkgamedata.c
index d3b9c9c..de70c0b 100644
--- a/src/build/mkgamedata.c
+++ b/src/build/mkgamedata.c
@@ -182,8 +182,10 @@ F( "#line %d \"%" fS "\"", srclines[i], srcnames[srcfiles[i]])
// don't attempt to optimise for nested conditionals because that's
// way more complicated and also basically defeats the purpose.
if (indents[j] != 1) continue;
- if_cold (fprintf(out, "%s \\\n\t _gametype_tag_%s", pipe,
- sbase + tags[j]) < 0) {
+ bool neg = sbase[tags[j]] == '!';
+ const char *tilde = (const char *)"~" + !neg; // cast away warning
+ if_cold (fprintf(out, "%s \\\n\t %s_gametype_tag_%s", pipe, tilde,
+ sbase + tags[j] + neg) < 0) {
diewrite();
}
pipe = " |";
@@ -247,14 +249,16 @@ _i("}")
continue;
}
F( "#line %d \"%" fS "\"", srclines[i], srcnames[srcfiles[i]])
+ bool neg = sbase[tags[i]] == '!';
+ const char *excl = (const char *)"!" + !neg; // cast away warning
if (indents[i] > indents[i - 1]) {
-Fi(" if (GAMETYPE_MATCHES(%s)) {", sbase + tags[i])
+Fi(" if (%sGAMETYPE_MATCHES(%s)) {", excl, sbase + tags[i] + neg);
++indent;
}
else {
_i("}")
F( "#line %d \"%" fS "\"", srclines[i], srcnames[srcfiles[i]])
-Fi("else if (GAMETYPE_MATCHES(%s)) {", sbase + tags[i])
+Fi("else if (%sGAMETYPE_MATCHES(%s)) {", excl, sbase + tags[i] + neg);
}
if (exprs[i]) {
F( "#line %d \"%" fS "\"", srclines[i], srcnames[srcfiles[i]])
diff --git a/src/fixes.c b/src/fixes.c
index d4b5330..733616b 100644
--- a/src/fixes.c
+++ b/src/fixes.c
@@ -91,8 +91,8 @@ static void generalfixes() {
// fps_max policy varies a bit between speedgames and their communities!
// in theory we might wanna remove CON_NOTCONN on Portal 1 in a future
// release, but for now people haven't fully talked themselves into it.
- struct con_var *v = con_findvar("fps_max");
if (GAMETYPE_MATCHES(L4Dx)) {
+ struct con_var *v = con_findvar("fps_max");
// for L4D games, generally changing anything above normal limits is
// disallowed, but externally capping FPS will always be possible so we
// might as well allow lowering it ingame for convenience.
diff --git a/src/gametype.h b/src/gametype.h
index 6f6a712..5b9336b 100644
--- a/src/gametype.h
+++ b/src/gametype.h
@@ -95,12 +95,6 @@ GAMETYPE_BASETAGS(_GAMETYPE_DISCARD, _GAMETYPE_ZERO)
(_gametype_tag_OrangeBox | _gametype_tag_2013)
#define _gametype_tag_Portal (_gametype_tag_Portal1 | _gametype_tag_Portal2)
-/* Match for stuff that's specifically NOT OE. */
-// TODO(compat): maybe we should add a specific !Tag syntax to mkgamedata,
-// which would make this redundant. as of now this is just a low-effort way to
-// keep some cvar things undefined under OE to avoid confusion
-#define _gametype_tag_NE (~_gametype_tag_OE)
-
#define GAMETYPE_MATCHES(x) !!(_gametype_tag & (_gametype_tag_##x))
#endif