summaryrefslogtreecommitdiffhomepage
path: root/src/engineapi.c
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 /src/engineapi.c
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.
Diffstat (limited to 'src/engineapi.c')
-rw-r--r--src/engineapi.c21
1 files changed, 11 insertions, 10 deletions
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