Nuclide
Software Development Kit for id Tech
global.h File Reference
#include "teams.h"
#include "events.h"
#include "flags.h"

Go to the source code of this file.

Macros

#define LOGLEVEL_DEFAULT   LOGLEVEL_WARNINGS
 
#define printf(...)   print(sprintf(__VA_ARGS__))
 
#define enumflags   enum
 Doxygen doesn't know what enumflags (aka bitfields) are, used as e.g. More...
 
#define NSLog(...)   if (autocvar_g_logLevel >= LOGLEVEL_DEBUG) _NSLog(sprintf(__VA_ARGS__))
 Logs an message, with timestamp. More...
 
#define NSError(...)   if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSError(__FUNC__, sprintf(__VA_ARGS__))
 Logs an error message, with timestamp. More...
 
#define NSWarning(...)   if (autocvar_g_logLevel >= LOGLEVEL_WARNINGS) _NSWarning(__FUNC__, sprintf(__VA_ARGS__))
 Logs a warning message, with timestamp. More...
 
#define NSAssert(condition, ...)   if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSAssert(condition, __FUNC__, sprintf(__VA_ARGS__))
 Generates an assertion, if a given condition is false. More...
 
#define InitStart()   _InitStart(__FUNC__)
 
#define InitEnd()   _InitEnd()
 
#define entity_def(x, ...)   const string x[] = { __VA_ARGS__ }
 Doesn't work yet. More...
 
#define thread(x)   if (fork()) { x; abort(); }
 Calls a function (with parameters) in a new thread. More...
 
#define STRING_SET(x)   ((x != __NULL__) && (x != ""))
 

Enumerations

enum  logLevel_t { LOGLEVEL_NONE , LOGLEVEL_ERRORS , LOGLEVEL_WARNINGS , LOGLEVEL_DEBUG }
 
enum  searchFlags_t {
  SEARCH_INSENSITIVE , SEARCH_FULLPACKAGE , SEARCH_ALLOWDUPES , SEARCH_FORCESEARCH ,
  SEARCH_MULTISEARCH , SEARCH_NAMESORT
}
 

Functions

void _NSLog (string msg)
 
void _NSError (string functionName, string msg)
 
void _NSWarning (string functionName, string msg)
 
void _NSAssert (bool condition, string function, string descr)
 
void InitPrint (string functionName)
 
void _InitStart (string functionName)
 
void _InitEnd (void)
 
bool fileExists (string filePath)
 

Variables

var bool autocvar_g_logTimestamps = false
 
var logLevel_t autocvar_g_logLevel = LOGLEVEL_WARNINGS
 
const vector g_vec_null = [0.0f, 0.0f, 0.0f]
 
var float g_initTime
 
var string g_lastInitFunc
 

Macro Definition Documentation

◆ entity_def

#define entity_def (   x,
  ... 
)    const string x[] = { __VA_ARGS__ }

Doesn't work yet.

Compiler bug (!)

◆ enumflags

typedef enumflags   enum

Doxygen doesn't know what enumflags (aka bitfields) are, used as e.g.

For future use: SpawnFlags used in Source.

Monster flags, these are defined by the level designers.

AI will be enabled once seen (1) Won't talk (2) Collides against func_monsterclip (4) Reserved for entityDef (8) Only reacts to scripted sequences (16) Reserved for entityDef (32) Ignores players (64) AI waits for scripted_sequence to end (128) Reserved for entityDef (256) Corpse fades instead of staying (512) Will spawn in multiplayer NSGameRules (1024) Is falling (2048) Part of a horde (4096)

AI will be enable once seen (1) Won't talk (2) Fall to ground, instead of dropping instantly (4) Drops healthkit (8) Walks direct paths (16) Reserved for entityDef (32) Reserved for entityDef (64) AI waits for scripted_sequence to end (128) Long visibility and line of sight (256) Corpse fades instead of staying (512) Think outside the PVS (1024) Will spawn through npc_maker (2048) Alternative collision, avoiding players (4096) Don't drop weapons (8192) Ignore pushing players (16384)

◆ InitEnd

#define InitEnd ( )    _InitEnd()

◆ InitStart

#define InitStart ( )    _InitStart(__FUNC__)

◆ LOGLEVEL_DEFAULT

#define LOGLEVEL_DEFAULT   LOGLEVEL_WARNINGS

◆ NSAssert

#define NSAssert (   condition,
  ... 
)    if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSAssert(condition, __FUNC__, sprintf(__VA_ARGS__))

Generates an assertion, if a given condition is false.

The console variable g_developer has to be 1 for them to be visible.

Parameters
conditionis the expression to be evaluated.
description(...)contains a formatted string containing an error description.

◆ NSError

#define NSError (   ...)    if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSError(__FUNC__, sprintf(__VA_ARGS__))

Logs an error message, with timestamp.

The console variable g_developer has to be 1 for them to be visible.

Parameters
description(...)contains a formatted string containing a description.

◆ NSLog

#define NSLog (   ...)    if (autocvar_g_logLevel >= LOGLEVEL_DEBUG) _NSLog(sprintf(__VA_ARGS__))

Logs an message, with timestamp.

The console variable g_developer has to be 1 for them to be visible.

Parameters
description(...)contains a formatted string containing a description.

◆ NSWarning

#define NSWarning (   ...)    if (autocvar_g_logLevel >= LOGLEVEL_WARNINGS) _NSWarning(__FUNC__, sprintf(__VA_ARGS__))

Logs a warning message, with timestamp.

The console variable g_developer has to be 1 for them to be visible.

Parameters
description(...)contains a formatted string containing a description.

◆ printf

#define printf (   ...)    print(sprintf(__VA_ARGS__))

◆ STRING_SET

#define STRING_SET (   x)    ((x != __NULL__) && (x != ""))

◆ thread

#define thread (   x)    if (fork()) { x; abort(); }

Calls a function (with parameters) in a new thread.

Enumeration Type Documentation

◆ logLevel_t

enum logLevel_t
Enumerator
LOGLEVEL_NONE 
LOGLEVEL_ERRORS 
LOGLEVEL_WARNINGS 
LOGLEVEL_DEBUG 

◆ searchFlags_t

Enumerator
SEARCH_INSENSITIVE 

Attempt to do a case-insensitive search (slower)

SEARCH_FULLPACKAGE 

Package names include the game directory as a prefix.

SEARCH_ALLOWDUPES 

Do not attempt to remove duplicate results (so you can search through multiple archives)

SEARCH_FORCESEARCH 

Search a given game directory even if it's not mounted.

SEARCH_MULTISEARCH 

When set, separating search queries with : will allow for multiple queries in one string.

SEARCH_NAMESORT 

Sort the results alphabetically (slower)

Function Documentation

◆ _InitEnd()

void _InitEnd ( void  )

◆ _InitStart()

void _InitStart ( string  functionName)

◆ _NSAssert()

void _NSAssert ( bool  condition,
string  function,
string  descr 
)

◆ _NSError()

void _NSError ( string  functionName,
string  msg 
)

◆ _NSLog()

void _NSLog ( string  msg)

◆ _NSWarning()

void _NSWarning ( string  functionName,
string  msg 
)

◆ fileExists()

bool fileExists ( string  filePath)

◆ InitPrint()

void InitPrint ( string  functionName)

Variable Documentation

◆ autocvar_g_logLevel

var logLevel_t autocvar_g_logLevel = LOGLEVEL_WARNINGS

◆ autocvar_g_logTimestamps

var bool autocvar_g_logTimestamps = false

◆ g_initTime

var float g_initTime

◆ g_lastInitFunc

var string g_lastInitFunc

◆ g_vec_null

const vector g_vec_null = [0.0f, 0.0f, 0.0f]