2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-28 15:45:31 +03:00

Update regamedll API sdk

Update cssdk & minor refactoring
Added safe checks CGameRules/CCSEntity version interface (for future safe migrate)
This commit is contained in:
s1lent 2019-08-30 02:20:31 +07:00
parent abd47009fb
commit 80b9f6f1bc
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
12 changed files with 597 additions and 442 deletions

View File

@ -130,6 +130,9 @@
#define EF_NOINTERP 32 // Don't interpolate the next frame
#define EF_LIGHT 64 // Rocket flare glow sprite
#define EF_NODRAW 128 // Don't draw entity
#define EF_FORCEVISIBILITY 2048 // force visibility
#define EF_OWNER_VISIBILITY 4096 // visibility for owner
#define EF_OWNER_NO_VISIBILITY 8192 // no visibility for owner
/**
* Break Model Defines

View File

@ -1,17 +1,30 @@
/***
/*
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
****/
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef CONST_H
#define CONST_H
@ -24,11 +37,13 @@
// How many bits to use to encode an edict.
#define MAX_EDICT_BITS 11 // # of bits needed to represent max edicts
// Max # of edicts in a level (2048)
#define MAX_EDICTS (1<<MAX_EDICT_BITS)
#define MAX_EDICTS BIT(MAX_EDICT_BITS)
// How many data slots to use when in multiplayer (must be power of 2)
#define MULTIPLAYER_BACKUP 64
// Same for single player
#define SINGLEPLAYER_BACKUP 8
//
@ -37,51 +52,49 @@
// Most came from server.h
// edict->flags
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1<<2)
#define FL_CLIENT (1<<3)
#define FL_INWATER (1<<4)
#define FL_MONSTER (1<<5)
#define FL_GODMODE (1<<6)
#define FL_NOTARGET (1<<7)
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND (1<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
#define FL_WATERJUMP (1<<11) // player jumping out of water
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water
#define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection
#define FL_FLY BIT(0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM BIT(1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR BIT(2)
#define FL_CLIENT BIT(3)
#define FL_INWATER BIT(4)
#define FL_MONSTER BIT(5)
#define FL_GODMODE BIT(6)
#define FL_NOTARGET BIT(7)
#define FL_SKIPLOCALHOST BIT(8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND BIT(9) // At rest / on the ground
#define FL_PARTIALGROUND BIT(10) // not all corners are valid
#define FL_WATERJUMP BIT(11) // player jumping out of water
#define FL_FROZEN BIT(12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT BIT(13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING BIT(14) // Player flag -- Player is fully crouched
#define FL_FLOAT BIT(15) // Apply floating force to this entity when in water
#define FL_GRAPHED BIT(16) // worldgraph has this ent listed as something that blocks a connection
// UNDONE: Do we need these?
#define FL_IMMUNE_WATER (1<<17)
#define FL_IMMUNE_SLIME (1<<18)
#define FL_IMMUNE_LAVA (1<<19)
#define FL_IMMUNE_WATER BIT(17)
#define FL_IMMUNE_SLIME BIT(18)
#define FL_IMMUNE_LAVA BIT(19)
#define FL_PROXY (1<<20) // This is a spectator proxy
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
#define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
#define FL_PROXY BIT(20) // This is a spectator proxy
#define FL_ALWAYSTHINK BIT(21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
#define FL_BASEVELOCITY BIT(22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_MONSTERCLIP BIT(23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN BIT(24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH BIT(25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR BIT(26) // This client is a spectator, don't run touch functions, etc.
#define FL_CUSTOMENTITY BIT(29) // This is a custom entity
#define FL_KILLME BIT(30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT BIT(31) // Entity is dormant, no updates to client
// SV_EmitSound2 flags
#define SND_EMIT2_NOPAS (1<<0) // never to do check PAS
#define SND_EMIT2_INVOKER (1<<1) // do not send to the client invoker
#define SND_EMIT2_NOPAS BIT(0) // never to do check PAS
#define SND_EMIT2_INVOKER BIT(1) // do not send to the client invoker
// Engine edict->spawnflags
#define SF_NOTINDEATHMATCH 0x0800 // Do not spawn when deathmatch and loading entities from a file
#define SF_NOTINDEATHMATCH BIT(11) // Do not spawn when deathmatch and loading entities from a file
// Goes into globalvars_t.trace_flags
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
#define FTRACE_SIMPLEBOX BIT(0) // Traceline with a simple box
// walkmove modes
#define WALKMOVE_NORMAL 0 // normal walkmove
@ -117,28 +130,30 @@
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_RESPAWNABLE 3
#define DEAD_RESPAWNABLE 3 // do respawn the entity
#define DEAD_DISCARDBODY 4
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
// entity effects
#define EF_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_INVLIGHT 16 // get lighting from ceiling
#define EF_NOINTERP 32 // don't interpolate the next frame
#define EF_LIGHT 64 // rocket flare glow sprite
#define EF_NODRAW 128 // don't draw entity
#define EF_NIGHTVISION 256 // player nightvision
#define EF_SNIPERLASER 512 // sniper laser effect
#define EF_FIBERCAMERA 1024// fiber camera
// edict->effects values
#define EF_BRIGHTFIELD BIT(0) // swirling cloud of particles
#define EF_MUZZLEFLASH BIT(1) // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT BIT(2) // DLIGHT centered at entity origin
#define EF_DIMLIGHT BIT(3) // player flashlight
#define EF_INVLIGHT BIT(4) // get lighting from ceiling
#define EF_NOINTERP BIT(5) // don't interpolate the next frame
#define EF_LIGHT BIT(6) // rocket flare glow sprite
#define EF_NODRAW BIT(7) // don't draw entity
#define EF_NIGHTVISION BIT(8) // player nightvision
#define EF_SNIPERLASER BIT(9) // sniper laser effect
#define EF_FIBERCAMERA BIT(10) // fiber camera
#define EF_FORCEVISIBILITY BIT(11) // force visibility
#define EF_OWNER_VISIBILITY BIT(12) // visibility for owner
#define EF_OWNER_NO_VISIBILITY BIT(13) // no visibility for owner
// entity flags
// state->eflags values
#define EFLAG_SLERP 1 // do studio interpolation of this entity
//
@ -187,7 +202,6 @@
#define TE_EXPLFLAG_NOSOUND 4 // do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
// coord coord coord (position)
@ -365,8 +379,8 @@
// short 1.2.13 x (-1 = center)
// short 1.2.13 y (-1 = center)
// byte Effect 0 = fade in/fade out
// 1 is flickery credits
// 2 is write out (training room)
// 1 is flickery credits
// 2 is write out (training room)
// 4 bytes r,g,b,a color1 (text color)
// 4 bytes r,g,b,a color2 (effect color)
@ -376,14 +390,14 @@
// optional ushort 8.8 fxtime (time the highlight lags behing the leading text in effect 2)
// string text message (512 chars max sz string)
#define TE_LINE 30
// coord, coord, coord startpos
// coord, coord, coord endpos
// coord, coord, coord (startpos)
// coord, coord, coord (endpos)
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_BOX 31
// coord, coord, coord boxmins
// coord, coord, coord boxmaxs
// coord, coord, coord (boxmins)
// coord, coord, coord (boxmaxs)
// short life in 0.1 s
// 3 bytes r, g, b
@ -552,9 +566,9 @@
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
// byte (entity index of player)
// coord (vertical offset) ( attachment origin.z = player origin.z + vertical offset )
// coord (vertical offset) (attachment origin.z = player origin.z + vertical offset)
// short (model index)
// short (life * 10 );
// short (life * 10)
#define TE_KILLPLAYERATTACHMENTS 125 // will expire all TENTS attached to a player.
// byte (entity index of player)
@ -585,11 +599,9 @@
// coord (velocity)
// coord (velocity)
// coord (velocity)
// byte ( life * 10 )
// byte ( color ) this is an index into an array of color vectors in the engine. (0 - )
// byte ( length * 10 )
// byte (life * 10)
// byte (color) this is an index into an array of color vectors in the engine. (0 -)
// byte (length * 10)
#define MSG_BROADCAST 0 // unreliable to all
#define MSG_ONE 1 // reliable to one (msg_entity)
@ -605,22 +617,11 @@
// contents of a spot in the world
#define CONTENTS_EMPTY -1
#define CONTENTS_SOLID -2
#define CONTENTS_WATER -3
#define CONTENTS_WATER 3
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
/* These additional contents constants are defined in bspfile.h
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
#define CONTENTS_CURRENT_90 -10
#define CONTENTS_CURRENT_180 -11
#define CONTENTS_CURRENT_270 -12
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
*/
#define CONTENTS_LADDER -16
#define CONTENT_FLYFIELD -17
@ -648,9 +649,9 @@
// attenuation values
#define ATTN_NONE 0
#define ATTN_NORM (float)0.8
#define ATTN_IDLE (float)2
#define ATTN_STATIC (float)1.25
#define ATTN_NORM 0.8f
#define ATTN_IDLE 2.0f
#define ATTN_STATIC 1.25f
// pitch values
#define PITCH_NORM 100 // non-pitch shifted
@ -658,15 +659,7 @@
#define PITCH_HIGH 120
// volume values
#define VOL_NORM 1.0
// plats
#define PLAT_LOW_TRIGGER 1
// Trains
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
#define VOL_NORM 1.0f
// buttons
#ifndef IN_BUTTONS_H
@ -674,7 +667,6 @@
#endif
// Break Model Defines
#define BREAK_TYPEMASK 0x4F
#define BREAK_GLASS 0x01
#define BREAK_METAL 0x02
@ -687,7 +679,6 @@
#define BREAK_2 0x80
// Colliding temp entity sounds
#define BOUNCE_GLASS BREAK_GLASS
#define BOUNCE_METAL BREAK_METAL
#define BOUNCE_FLESH BREAK_FLESH
@ -736,31 +727,9 @@ enum
kRenderFxExplode, // Scale up really big!
kRenderFxGlowShell, // Glowing Shell
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
kRenderFxLightMultiplier, //CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier
kRenderFxLightMultiplier, // CTM !!!CZERO added to tell the studiorender that the value in iuser2 is a lightmultiplier
};
typedef unsigned int func_t;
#ifdef HAVE_STRONG_TYPEDEF
enum class string_t: unsigned int {};
#else
typedef unsigned int string_t;
#endif
typedef unsigned char byte;
typedef unsigned short word;
#define _DEF_BYTE_
#undef true
#undef false
#ifndef __cplusplus
typedef enum {false, true} qboolean;
#else
typedef int qboolean;
#endif
typedef struct
{
byte r, g, b;
@ -772,7 +741,7 @@ typedef struct
} colorVec;
#ifdef _WIN32
#pragma pack(push,2)
#pragma pack(push, 2)
#endif
typedef struct
@ -783,6 +752,7 @@ typedef struct
#ifdef _WIN32
#pragma pack(pop)
#endif
typedef struct link_s
{
struct link_s *prev, *next;
@ -804,7 +774,7 @@ typedef struct
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
plane_t plane; // surface normal at impact
edict_t * ent; // entity the surface is on
edict_t *ent; // entity the surface is on
int hitgroup; // 0 == generic, non zero is specific body part
} trace_t;

View File

@ -32,6 +32,11 @@ class CBaseEntity;
class CCSEntity
{
public:
CCSEntity() :
m_pContainingEntity(nullptr)
{
}
virtual ~CCSEntity() {}
virtual void FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker);
virtual Vector FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand);
@ -63,3 +68,5 @@ class CCSMonster: public CCSToggle
public:
};
#define CSENTITY_API_INTERFACE_VERSION "CSENTITY_API_INTERFACE_VERSION001"

View File

@ -39,7 +39,7 @@
#include "strtools.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define NOWINRES
#define NOSERVICE
#define NOMCX
@ -66,16 +66,20 @@ typedef float vec_t; // needed before including progdefs.h
// Vector class
#include "vector.h"
//#include "vector.h"
// Defining it as a (bogus) struct helps enforce type-checking
#define vec3_t Vector
// Shared engine/DLL constants
// QString class
#include "qstring.h"
// Shared engine/DLL constants
#include "const.h"
#include "edict.h"
// Shared header describing protocol between engine and DLLs
#include "eiface.h"
// Shared header between the client DLL and the game DLLs
#include "cdll_dll.h"
#include "extdef.h"

View File

@ -332,6 +332,8 @@ public:
bool m_bGameOver; // intermission or finale (deprecated name g_fGameOver)
};
#define GAMERULES_API_INTERFACE_VERSION "GAMERULES_API_INTERFACE_VERSION001"
// CHalfLifeRules - rules for the single player Half-Life game.
class CHalfLifeRules: public CGameRules {
protected:

View File

@ -0,0 +1,121 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
#define QSTRING_DEFINE
constexpr unsigned int iStringNull = {0};
// Quake string (helper class)
class QString final
{
public:
using qstring_t = unsigned int;
QString(): m_string(iStringNull) {};
QString(qstring_t string): m_string(string) {};
bool IsNull() const;
bool IsNullOrEmpty() const;
// Copy the array
QString &operator=(const QString &other);
bool operator==(qstring_t string) const;
bool operator==(const QString &s) const;
bool operator==(const char *pszString) const;
operator const char *() const;
operator unsigned int() const;
const char *str() const;
private:
qstring_t m_string;
};
#ifdef USE_QSTRING
#define string_t QString
#endif
#include "const.h"
#include "edict.h"
#include "eiface.h"
#include "enginecallback.h"
extern globalvars_t *gpGlobals;
#define STRING(offset) ((const char *)(gpGlobals->pStringBase + (unsigned int)(offset)))
#define MAKE_STRING(str) ((unsigned int)(str) - (unsigned int)(STRING(0)))
// Inlines
inline bool QString::IsNull() const
{
return m_string == iStringNull;
}
inline bool QString::IsNullOrEmpty() const
{
return IsNull() || (&gpGlobals->pStringBase[m_string])[0] == '\0';
}
inline QString &QString::operator=(const QString &other)
{
m_string = other.m_string;
return (*this);
}
inline bool QString::operator==(qstring_t string) const
{
return m_string == string;
}
inline bool QString::operator==(const QString &s) const
{
return m_string == s.m_string;
}
inline bool QString::operator==(const char *pszString) const
{
return Q_strcmp(&gpGlobals->pStringBase[m_string], pszString) == 0;
}
inline const char *QString::str() const
{
return &gpGlobals->pStringBase[m_string];
}
inline QString::operator const char *() const
{
return str();
}
inline QString::operator unsigned int() const
{
return m_string;
}

View File

@ -38,7 +38,7 @@
#include <API/CSInterfaces.h>
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 10
#define REGAMEDLL_API_VERSION_MINOR 11
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
@ -589,6 +589,8 @@ public:
virtual struct AmmoInfo *GetAmmoInfo(AmmoType ammoID) = 0;
virtual struct AmmoInfoStruct *GetAmmoInfoEx(AmmoType ammoID) = 0;
virtual struct AmmoInfoStruct *GetAmmoInfoEx(const char *ammoName) = 0;
virtual bool BGetICSEntity(const char *pchVersion) const = 0;
virtual bool BGetIGameRules(const char *pchVersion) const = 0;
};
#define VRE_GAMEDLL_API_VERSION "VRE_GAMEDLL_API_VERSION001"

View File

@ -57,6 +57,26 @@
#define BIT(n) (1<<(n))
#ifdef HAVE_STRONG_TYPEDEF
enum class string_t: unsigned int {};
#else
typedef unsigned int string_t;
#endif
typedef int EOFFSET;
typedef int BOOL;
typedef unsigned char byte;
typedef unsigned short word;
#define _DEF_BYTE_
#ifndef __cplusplus
#undef true
#undef false
typedef enum {false, true} qboolean;
#else
typedef int qboolean;
#endif // #ifndef __cplusplus
// From engine/server.h
typedef enum sv_delta_s
{

View File

@ -7,6 +7,11 @@ CAPI_Config::CAPI_Config() : m_api_rehlds(false), m_api_regame(false), m_api_vtc
}
void CAPI_Config::FailedReGameDllAPI()
{
m_api_regame = false;
}
void CAPI_Config::Init()
{
m_api_rehlds = RehldsApi_Init();

View File

@ -7,6 +7,7 @@ class CAPI_Config {
public:
CAPI_Config();
void Init();
void FailedReGameDllAPI();
bool hasReHLDS() const { return m_api_rehlds; }
bool hasReGameDLL() const { return m_api_regame; }

View File

@ -95,7 +95,20 @@ void KeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
CGameRules *InstallGameRules(IReGameHook_InstallGameRules *chain)
{
return g_pGameRules = chain->callNext();
auto gamerules = chain->callNext();
// Safe check CGameRules API interface version
if (!g_ReGameApi->BGetIGameRules(GAMERULES_API_INTERFACE_VERSION))
{
api_cfg.FailedReGameDllAPI();
UTIL_ServerPrint("[%s]: Interface CGameRules API version '%s' not found.\n", Plugin_info.logtag, GAMERULES_API_INTERFACE_VERSION);
}
else
{
g_pGameRules = gamerules;
}
return gamerules;
}
int DispatchSpawn(edict_t *pEntity)

View File

@ -58,5 +58,12 @@ bool RegamedllApi_Init()
g_ReGameFuncs = g_ReGameApi->GetFuncs();
g_ReGameHookchains = g_ReGameApi->GetHookchains();
// Safe check CCSEntity API interface version
if (!g_ReGameApi->BGetICSEntity(CSENTITY_API_INTERFACE_VERSION))
{
UTIL_ServerPrint("[%s]: Interface CCSEntity API version '%s' not found.\n", Plugin_info.logtag, CSENTITY_API_INTERFACE_VERSION);
return false;
}
return true;
}