From 6e864e4f8f0a4d23ee19bab8bd4c7fe65d81bf75 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 10 Aug 2022 06:55:14 +0300 Subject: [PATCH] engine: introduce bug compatibility levels * for now we only have GoldSrc bug compatibility, can be used for games that require precise GoldSrc behaviour, like CSCZDS * enabled with -bugcomp command line * added text in --help --- engine/common/common.h | 13 +++++++++++++ engine/common/host.c | 15 ++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/engine/common/common.h b/engine/common/common.h index 2ce2b327..092290a8 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -307,6 +307,16 @@ typedef struct float scale; // curstate.scale } tentlist_t; +typedef enum bugcomp_e +{ + // default mode, we assume that user dlls are not relying on engine bugs + BUGCOMP_OFF, + + // GoldSrc mode, user dlls are relying on GoldSrc specific bugs + // but fixing them may break regular Xash games + BUGCOMP_GOLDSRC, +} bugcomp_t; + typedef struct host_parm_s { HINSTANCE hInst; @@ -381,6 +391,9 @@ typedef struct host_parm_s struct decallist_s *decalList; // used for keep decals, when renderer is restarted or changed int numdecals; + // bug compatibility level, for very "special" games + bugcomp_t bugcomp; + } host_parm_t; extern host_parm_t host; diff --git a/engine/common/host.c b/engine/common/host.c index f259cdca..976525f2 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -151,6 +151,8 @@ void Sys_PrintUsage( void ) O("-clientlib ","override client DLL path") #endif O("-rodir ","set read-only base directory, experimental") + O("-bugcomp ","enable precise bug compatibility. Will break games that don't require it") + O(" ","Refer to engine documentation for more info") O("-ip ","set custom ip") O("-port ","set custom host port") @@ -859,10 +861,10 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha if( !Sys_CheckParm( "-disablehelp" ) ) { - if( Sys_CheckParm( "-help" ) || Sys_CheckParm( "-h" ) || Sys_CheckParm( "--help" ) ) - { + if( Sys_CheckParm( "-help" ) || Sys_CheckParm( "-h" ) || Sys_CheckParm( "--help" ) ) + { Sys_PrintUsage(); - } + } } if( !Sys_CheckParm( "-noch" ) ) @@ -941,6 +943,13 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha // member console allowing host.allow_console_init = host.allow_console; + if( Sys_CheckParm( "-bugcomp" )) + { + // add argument check here when we add other levels + // of bugcompatibility + host.bugcomp = BUGCOMP_GOLDSRC; + } + // timeBeginPeriod( 1 ); // a1ba: Do we need this? // NOTE: this message couldn't be passed into game console but it doesn't matter