commit 19894715b1c6379adfcd8d0f0a307a312b035fc5 Author: FutureRave Date: Sat Feb 18 19:52:29 2023 +0000 init diff --git a/README.md b/README.md new file mode 100644 index 0000000..16a3853 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Reusable preprocessor directives for GSC + +## What is this? + +This is a collection of useful preprocessor directives that can be used by gsc-tool, Plutonium clients and XLabs clients. +It is also possible to use gsc-tool to expand these macros and produce a gsc file that is readable by older GSC compilers that do not have a preprocessor. \ No newline at end of file diff --git a/_utility.gsh b/_utility.gsh new file mode 100644 index 0000000..71a608d --- /dev/null +++ b/_utility.gsh @@ -0,0 +1,40 @@ +#define TRUE 1 +#define FALSE 0 + +#define ZERO_VEC3 (0, 0, 0) + +#define GENERIC_INIT \ + init() \ + { \ + thread onPlayerConnect(); \ + } + +#define WAIT_CNT(ent) level waittill ( "connected", ent ) + +#define WAIT_ANY_RET(ent, ...) \ + ent common_scripts\utility::waittill_any_return( __VA_ARGS__ ) + +#define PLAYER_NOTIFY_CMD(ent, str, action) ent notifyOnPlayerCommand( str, action ) + +/* Tweak as necessary. Can be return, continue or break */ +#define CHK_ACTION continue + +#ifdef IW4 +#define BOT_CHK(ent) \ + if ( ent isBot() ) \ + { \ + CHK_ACTION; \ + } +#else /* Valid for Plutinium IW5 with bot warfare */ +#define BOT_CHK(ent) \ + if ( isDefined( ent.pers["isBot"] ) && ent.pers["isBot"] ) \ + { \ + CHK_ACTION; \ + } +#endif + +#define DEFINE_CHK(x) \ + if ( !isDefined( (x) ) ) \ + { \ + CHK_ACTION; \ + }