summaryrefslogtreecommitdiffhomepage
path: root/src/l4dwarp.c
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2022-07-31 16:02:10 +0100
committerMichael Smith <mikesmiffy128@gmail.com>2022-08-10 22:40:52 +0100
commit5e921bf59373d79d27c322ff86e8b5a37b151e45 (patch)
tree4d40e39543b085ce4c8cb9b1a7b3c0108de680c0 /src/l4dwarp.c
parentc8d7588251fd4fe63ac6afe2a90ca7066c786609 (diff)
Add magical feature codegen system, at long last
Diffstat (limited to 'src/l4dwarp.c')
-rw-r--r--src/l4dwarp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/l4dwarp.c b/src/l4dwarp.c
index 76aa230..5412b64 100644
--- a/src/l4dwarp.c
+++ b/src/l4dwarp.c
@@ -16,18 +16,23 @@
#define _USE_MATH_DEFINES // ... windows.
#include <math.h>
-#include <stdbool.h>
#include "con_.h"
#include "engineapi.h"
#include "errmsg.h"
#include "ent.h"
+#include "feature.h"
#include "gamedata.h"
#include "gametype.h"
#include "intdefs.h"
#include "mem.h"
#include "vcall.h"
+FEATURE("Left 4 Dead warp testing")
+REQUIRE_GAMEDATA(off_entpos)
+REQUIRE_GAMEDATA(off_eyeang)
+REQUIRE_GAMEDATA(vtidx_Teleport)
+
DECL_VFUNC_DYN(void *, GetBaseEntity)
DECL_VFUNC_DYN(void, Teleport, const struct vec3f *pos, const struct vec3f *ang,
const struct vec3f *vel)
@@ -48,12 +53,11 @@ DEF_CCMD_HERE_UNREG(sst_l4d_testwarp, "Simulate a bot warping to you",
org->y + shift * sin(yaw), org->z}, 0, &(struct vec3f){0, 0, 0});
}
-bool l4dwarp_init(void) {
- if (!GAMETYPE_MATCHES(L4Dx)) return false;
- if (!has_off_entpos || !has_off_eyeang || !has_vtidx_Teleport) {
- errmsg_errorx("missing gamedata entries for this engine");
- return false;
- }
+PREINIT {
+ return GAMETYPE_MATCHES(L4Dx);
+}
+
+INIT {
con_reg(sst_l4d_testwarp);
return true;
}