2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-25 03:09:24 +01:00

server: export physic interface init function to properly detect Xash3D engine (#440)

This commit is contained in:
Alibek Omarov 2024-02-23 22:15:37 +03:00 committed by GitHub
parent 7e21ac2889
commit 3a5b8e7b9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 8 deletions

View File

@ -22,6 +22,8 @@
#include "gamerules.h" #include "gamerules.h"
#include "game.h" #include "game.h"
bool g_fIsXash3D = false;
void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd ); void EntvarsKeyvalue( entvars_t *pev, KeyValueData *pkvd );
extern "C" void PM_Move ( struct playermove_s *ppmove, int server ); extern "C" void PM_Move ( struct playermove_s *ppmove, int server );
@ -125,6 +127,11 @@ int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion )
return TRUE; 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 #if !XASH_WIN32
} }
#endif #endif

View File

@ -58,6 +58,11 @@ CBaseEntity
extern "C" EXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); extern "C" EXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
extern "C" EXPORT int GetEntityAPI2( 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 int DispatchSpawn( edict_t *pent );
extern void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd ); extern void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd );

View File

@ -27,8 +27,6 @@
#define BOLT_AIR_VELOCITY 2000 #define BOLT_AIR_VELOCITY 2000
#define BOLT_WATER_VELOCITY 1000 #define BOLT_WATER_VELOCITY 1000
extern BOOL g_fIsXash3D;
// UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS() // UNDONE: Save/restore this? Don't forget to set classname and LINK_ENTITY_TO_CLASS()
// //
// OVERLOADS SOME ENTVARS: // OVERLOADS SOME ENTVARS:

View File

@ -17,8 +17,6 @@
#include "util.h" #include "util.h"
#include "game.h" #include "game.h"
BOOL g_fIsXash3D;
cvar_t displaysoundlist = {"displaysoundlist","0"}; cvar_t displaysoundlist = {"displaysoundlist","0"};
// multiplayer server rules // multiplayer server rules
@ -464,10 +462,6 @@ cvar_t sv_busters = { "sv_busters", "0" };
// This gets called one time when the game is initialied // This gets called one time when the game is initialied
void GameDLLInit( void ) 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_gravity = CVAR_GET_POINTER( "sv_gravity" );
g_psv_aim = CVAR_GET_POINTER( "sv_aim" ); g_psv_aim = CVAR_GET_POINTER( "sv_aim" );
g_footsteps = CVAR_GET_POINTER( "mp_footsteps" ); g_footsteps = CVAR_GET_POINTER( "mp_footsteps" );