This commit is contained in:
6arelyFuture 2023-02-18 19:52:29 +00:00
commit 19894715b1
No known key found for this signature in database
GPG Key ID: 22F9079C86CFAB31
2 changed files with 46 additions and 0 deletions

6
README.md Normal file
View File

@ -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.

40
_utility.gsh Normal file
View File

@ -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; \
}