summaryrefslogtreecommitdiffhomepage
path: root/src/engineapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/engineapi.c')
-rw-r--r--src/engineapi.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/engineapi.c b/src/engineapi.c
index 24a2d6b..6cb67d2 100644
--- a/src/engineapi.c
+++ b/src/engineapi.c
@@ -47,6 +47,8 @@ DECL_VFUNC_DYN(void *, GetAllServerClasses)
#include <entpropsinit.gen.h> // generated by build/mkentprops.c
+static void *srvdll;
+
bool engineapi_init(int pluginver) {
if (!con_detect(pluginver)) return false;
pluginhandler = factory_engine("ISERVERPLUGINHELPERS001", 0);
@@ -75,7 +77,6 @@ bool engineapi_init(int pluginver) {
vgui = factory_engine("VEngineVGui001", 0);
- void *srvdll;
// TODO(compat): add this back when there's gamedata for 009 (no point atm)
/*if (srvdll = factory_engine("ServerGameDLL009", 0)) {
_gametype_tag |= _gametype_tag_SrvDLL009;
@@ -104,11 +105,18 @@ bool engineapi_init(int pluginver) {
gamedata_init();
con_init();
if (!gameinfo_init()) { con_disconnect(); return false; }
- if (has_vtidx_GetAllServerClasses && has_sz_SendProp &&
+ return true;
+}
+
+void engineapi_lateinit(void) {
+ // from AM L4D2 SDK headers:
+ // > SENDPROP_VECTORELEM makes [the offset] negative to start with so we
+ // > can detect that and set the SPROP_IS_VECTOR_ELEM flag.
+ // by doing this at the deferred stage, we avoid having to abs() everything
+ if (srvdll && has_vtidx_GetAllServerClasses && has_sz_SendProp &&
has_off_SP_varname && has_off_SP_offset) {
initentprops(GetAllServerClasses(srvdll));
}
- return true;
}
// vi: sw=4 ts=4 noet tw=80 cc=80