summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-01-17 14:27:59 +0000
committerMichael Smith <mikesmiffy128@gmail.com>2022-01-17 14:29:22 +0000
commitec365b49d7c352b0c1aad97496c915da1f0393a8 (patch)
tree453447338e50bd866ffec570476671c07b84ad35
parentc0a87338a4d688517b78d26cb852c0a895a4f5b0 (diff)
Fix Left 4 Dead 2 Survivors crashing
-rw-r--r--src/con_.c17
-rw-r--r--src/fixes.c2
-rw-r--r--src/gametype.h14
3 files changed, 24 insertions, 9 deletions
diff --git a/src/con_.c b/src/con_.c
index be3f20c..357430b 100644
--- a/src/con_.c
+++ b/src/con_.c
@@ -371,7 +371,7 @@ static void fillvts(void) {
*pv++ = (void *)&InternalSetValue;
*pv++ = (void *)&InternalSetFloatValue;
*pv++ = (void *)&InternalSetIntValue;
- if (GAMETYPE_MATCHES(L4D2) || GAMETYPE_MATCHES(Portal2)) { // ugh, annoying
+ if (GAMETYPE_MATCHES(L4D2x) || GAMETYPE_MATCHES(Portal2)) { // ugh, annoying
// This is InternalSetColorValue, but that's basically the same thing,
// when you think about it.
*pv++ = (void *)&InternalSetIntValue;
@@ -379,7 +379,7 @@ static void fillvts(void) {
*pv++ = (void *)&ClampValue;;
*pv++ = (void *)&ChangeStringValue;
*pv++ = (void *)&Create_var;
- if (GAMETYPE_MATCHES(L4D2) || GAMETYPE_MATCHES(Portal2)) {
+ if (GAMETYPE_MATCHES(L4D2x) || GAMETYPE_MATCHES(Portal2)) {
*pi++ = (void *)&SetValue_colour_thunk;
}
#ifdef _WIN32
@@ -416,7 +416,18 @@ bool con_init(void *(*f)(const char *, int *), int plugin_ver) {
if (VCALL(_con_iface, FindCommand, "l4d2_snd_adrenaline")) {
_con_colourmsgf = VFUNC(_con_iface, ConsoleColorPrintf_l4d);
dllid = VCALL0(_con_iface, AllocateDLLIdentifier);
- _gametype_tag |= _gametype_tag_L4D2;
+ // while we're here, also distinguish Survivors, the stupid Japanese
+ // arcade game a few people seem to care about for some reason
+ // (which for some other reason also has some vtable changes)
+ if (VCALL(_con_iface, FindVar, "avatarbasemodel")) {
+ _gametype_tag |= _gametype_tag_L4DS;
+ // stupid hack: gameinfo.txt still just says Left 4 Dead 2 but
+ // this is _not_ Left 4 Dead 2, dammit
+ gameinfo_title = "Left 4 Dead: Survivors";
+ }
+ else {
+ _gametype_tag |= _gametype_tag_L4D2;
+ }
fillvts();
regcmds(VFUNC(_con_iface, RegisterConCommand));
return true;
diff --git a/src/fixes.c b/src/fixes.c
index 8fb65c2..f4ef3c2 100644
--- a/src/fixes.c
+++ b/src/fixes.c
@@ -81,7 +81,7 @@ void fixes_apply(void) {
// constrain it so we don't enable a configuration that isn't already
// possible on these earlier versions (who knows if that breaks
// something...).
- if (GAMETYPE_MATCHES(L4D2)) {
+ if (GAMETYPE_MATCHES(L4D2x)) {
struct con_var *v = con_findvar("mat_queue_mode");
if (v && (v->parent->base.flags & CON_ARCHIVE)) {
v->parent->base.flags = v->parent->base.flags
diff --git a/src/gametype.h b/src/gametype.h
index 8a823f8..9f9445e 100644
--- a/src/gametype.h
+++ b/src/gametype.h
@@ -25,11 +25,15 @@ extern u32 _gametype_tag;
#define _gametype_tag_OrangeBox 2
#define _gametype_tag_L4D1 4
#define _gametype_tag_L4D2 8
-#define _gametype_tag_Portal2 16
-#define _gametype_tag_2013 32
-
-#define _gametype_tag_L4D (_gametype_tag_L4D1 | _gametype_tag_L4D2)
-#define _gametype_tag_L4Dbased (_gametype_tag_L4D | _gametype_tag_Portal2)
+#define _gametype_tag_L4DS 16
+#define _gametype_tag_Portal2 32
+#define _gametype_tag_2013 64
+
+#define _gametype_tag_L4D (_gametype_tag_L4D1 | _gametype_tag_L4D2)
+// XXX: *stupid* naming, refactor later (damn Survivors ruining everything)
+#define _gametype_tag_L4D2x (_gametype_tag_L4D2 | _gametype_tag_L4DS)
+#define _gametype_tag_L4Dbased \
+ (_gametype_tag_L4D1 | _gametype_tag_L4D2x | _gametype_tag_Portal2)
#define GAMETYPE_MATCHES(x) !!(_gametype_tag & (_gametype_tag_##x))