From 3a5b8e7b9b760bba32150a81307a162d23ca8498 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 23 Feb 2024 22:15:37 +0300 Subject: [PATCH] server: export physic interface init function to properly detect Xash3D engine (#440) --- dlls/cbase.cpp | 7 +++++++ dlls/cbase.h | 5 +++++ dlls/crossbow.cpp | 2 -- dlls/game.cpp | 6 ------ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/dlls/cbase.cpp b/dlls/cbase.cpp index b15f97c7..d1e7aadd 100644 --- a/dlls/cbase.cpp +++ b/dlls/cbase.cpp @@ -22,6 +22,8 @@ #include "gamerules.h" #include "game.h" +bool g_fIsXash3D = false; + void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd ); extern "C" void PM_Move ( struct playermove_s *ppmove, int server ); @@ -125,6 +127,11 @@ int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ) return TRUE; } +int Server_GetPhysicsInterface( int version, server_physics_api_t *api, physics_interface_t *interface ) +{ + g_fIsXash3D = true; + return FALSE; // do not tell engine to init physics interface, as we're not using it +} #if !XASH_WIN32 } #endif diff --git a/dlls/cbase.h b/dlls/cbase.h index caf301d9..1d2b2f7a 100644 --- a/dlls/cbase.h +++ b/dlls/cbase.h @@ -58,6 +58,11 @@ CBaseEntity extern "C" EXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); extern "C" EXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); +// TODO: replace this by actual definitions from physint.h +typedef void *server_physics_api_t; +typedef void *physics_interface_t; +extern "C" EXPORT int Server_GetPhysicsInterface( int version, server_physics_api_t *api, physics_interface_t *interface ); +extern bool g_fIsXash3D; extern int DispatchSpawn( edict_t *pent ); extern void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd ); diff --git a/dlls/crossbow.cpp b/dlls/crossbow.cpp index f52be735..97bc583c 100644 --- a/dlls/crossbow.cpp +++ b/dlls/crossbow.cpp @@ -27,8 +27,6 @@ #define BOLT_AIR_VELOCITY 2000 #define BOLT_WATER_VELOCITY 1000 -extern BOOL g_fIsXash3D; - // UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS() // // OVERLOADS SOME ENTVARS: diff --git a/dlls/game.cpp b/dlls/game.cpp index 93cc7eb2..a8011a37 100644 --- a/dlls/game.cpp +++ b/dlls/game.cpp @@ -17,8 +17,6 @@ #include "util.h" #include "game.h" -BOOL g_fIsXash3D; - cvar_t displaysoundlist = {"displaysoundlist","0"}; // multiplayer server rules @@ -464,10 +462,6 @@ cvar_t sv_busters = { "sv_busters", "0" }; // This gets called one time when the game is initialied void GameDLLInit( void ) { - // Register cvars here: - if( !CVAR_GET_POINTER( "sv_language" ) ) - g_fIsXash3D = TRUE; - g_psv_gravity = CVAR_GET_POINTER( "sv_gravity" ); g_psv_aim = CVAR_GET_POINTER( "sv_aim" ); g_footsteps = CVAR_GET_POINTER( "mp_footsteps" );