summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWillian Henrique <wsimanbrazil@yahoo.com.br>2022-11-15 21:19:47 -0300
committerMichael Smith <mikesmiffy128@gmail.com>2023-05-04 23:49:27 +0100
commit245f63c4a58b36dc46731758063c03aba2d3ec06 (patch)
treeb93dd8bffa00e1f1208bc05be1aa429022f7807a
parentab485b730f6407c668fc26e5e9c665d03650960a (diff)
Improve L4D2 and Portal gametype detection
Adds tags for L4D2 2147 and Portal 3420. Committer's note: really the gamedata system might benefit from improvement in the future to support things like numerical ranges, but this will do for now.
-rw-r--r--LICENCE2
-rw-r--r--dist/LICENCE.linux2
-rw-r--r--dist/LICENCE.windows2
-rw-r--r--src/engineapi.c21
-rw-r--r--src/gametype.h6
5 files changed, 19 insertions, 14 deletions
diff --git a/LICENCE b/LICENCE
index 95f63fa..e4421ee 100644
--- a/LICENCE
+++ b/LICENCE
@@ -1,7 +1,7 @@
Except where otherwise noted, the following terms apply:
════════════════════════════════════════════════════════════════════════════════
Copyright © 2023 Michael Smith <mikesmiffy128@gmail.com>
-Copyright © 2022 Willian Henrique <wsimanbrazil@yahoo.com.br>
+Copyright © 2023 Willian Henrique <wsimanbrazil@yahoo.com.br>
Copyright © 2023 Hayden K <imaciidz@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose
diff --git a/dist/LICENCE.linux b/dist/LICENCE.linux
index 72edf01..4476573 100644
--- a/dist/LICENCE.linux
+++ b/dist/LICENCE.linux
@@ -1,7 +1,7 @@
Source Speedrun Tools is released under the following copyright licence:
════════════════════════════════════════════════════════════════════════════════
Copyright © 2023 Michael Smith <mikesmiffy128@gmail.com>
-Copyright © 2022 Willian Henrique <wsimanbrazil@yahoo.com.br>
+Copyright © 2023 Willian Henrique <wsimanbrazil@yahoo.com.br>
Copyright © 2023 Hayden K <imaciidz@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose
diff --git a/dist/LICENCE.windows b/dist/LICENCE.windows
index 29b9648..0482e91 100644
--- a/dist/LICENCE.windows
+++ b/dist/LICENCE.windows
@@ -1,7 +1,7 @@
Source Speedrun Tools is released under the following copyright licence:
════════════════════════════════════════════════════════════════════════════════
Copyright © 2023 Michael Smith <mikesmiffy128@gmail.com>
-Copyright © 2022 Willian Henrique <wsimanbrazil@yahoo.com.br>
+Copyright © 2023 Willian Henrique <wsimanbrazil@yahoo.com.br>
Copyright © 2023 Hayden K <imaciidz@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any purpose
diff --git a/src/engineapi.c b/src/engineapi.c
index 0511c7d..d4ee742 100644
--- a/src/engineapi.c
+++ b/src/engineapi.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2022 Michael Smith <mikesmiffy128@gmail.com>
+ * Copyright © 2023 Willian Henrique <wsimanbrazil@yahoo.com.br>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -44,8 +45,6 @@ void *inputsystem, *vgui;
DECL_VFUNC_DYN(void *, GetAllServerClasses)
-DECL_VFUNC(int, GetEngineBuildNumber_newl4d2, 99) // duping gamedata entry, yuck
-
#include <entpropsinit.gen.h>
bool engineapi_init(int pluginver) {
@@ -88,16 +87,18 @@ bool engineapi_init(int pluginver) {
// detect p1 for the benefit of specific features
if (!GAMETYPE_MATCHES(Portal2) && con_findcmd("upgrade_portalgun")) {
_gametype_tag |= _gametype_tag_Portal1;
+ if (!con_findvar("tf_arena_max_streak")) {
+ _gametype_tag |= _gametype_tag_Portal1_3420;
+ }
}
- // Ugly HACK: we want to call GetEngineBuildNumber to find out if we're on a
- // Last Stand version (because they changed entity vtables for some reason),
- // but that function also got moved in 2.0.4.1 which means we can't call it
- // till gamedata is set up, so we have to have a bit of redundant logic here
- // to bootstrap things.
- if (GAMETYPE_MATCHES(L4D2) && GAMETYPE_MATCHES(Client013) &&
- GetEngineBuildNumber_newl4d2(engclient) >= 2200) {
- _gametype_tag |= _gametype_tag_TheLastStand;
+ if (GAMETYPE_MATCHES(L4D2)) {
+ if (con_findvar("director_cs_weapon_spawn_chance")) {
+ _gametype_tag |= _gametype_tag_TheLastStand;
+ }
+ else if (con_findvar("sv_zombie_touch_trigger_delay")) {
+ _gametype_tag |= _gametype_tag_L4D2_2147;
+ }
}
// need to do this now; ServerClass network table iteration requires
diff --git a/src/gametype.h b/src/gametype.h
index 2464000..ad6d67d 100644
--- a/src/gametype.h
+++ b/src/gametype.h
@@ -1,5 +1,6 @@
/*
* Copyright © 2022 Michael Smith <mikesmiffy128@gmail.com>
+ * Copyright © 2023 Willian Henrique <wsimanbrazil@yahoo.com.br>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -49,7 +50,10 @@ extern u64 _gametype_tag;
#define _gametype_tag_SrvDLL009 (1 << 14) // 2013-ish
#define _gametype_tag_SrvDLL005 (1 << 15) // mostly everything else, it seems
-#define _gametype_tag_TheLastStand (1 << 16) /* The JAiZ update */
+/* games needing version-specific stuff */
+#define _gametype_tag_Portal1_3420 (1 << 16)
+#define _gametype_tag_L4D2_2147 (1 << 17)
+#define _gametype_tag_TheLastStand (1 << 18) /* The JAiZ update */
/* Matches for any multiple possible tags */
#define _gametype_tag_L4D (_gametype_tag_L4D1 | _gametype_tag_L4D2)