25var
bool autocvar_g_logTimestamps =
false;
37#define LOGLEVEL_DEFAULT LOGLEVEL_WARNINGS
38var logLevel_t autocvar_g_logLevel = LOGLEVEL_DEFAULT;
40#define printf(...) print(sprintf(__VA_ARGS__))
50 if (autocvar_g_logTimestamps)
51 print(sprintf(
"^9%f ^7%s\n", time, msg));
53 print(sprintf(
"^7%s\n", msg));
57_NSError(
string functionName,
string msg)
59 if (autocvar_g_logTimestamps)
60 print(sprintf(
"^9%f ^1%s^7: %s\n", time, functionName, msg));
62 print(sprintf(
"^1%s^7: %s\n", functionName, msg));
66_NSWarning(
string functionName,
string msg)
68 if (autocvar_g_logTimestamps)
69 print(sprintf(
"^9%f ^3%s^7: %s\n", time, functionName, msg));
71 print(sprintf(
"^3%s^7: %s\n", functionName, msg));
75_NSAssert(
bool condition,
string function,
string descr)
78 print(strcat(
"^1Assertion failed in ", function,
", reason: ", descr,
"\n"));
89#define NSLog(...) if (autocvar_g_logLevel >= LOGLEVEL_DEBUG) _NSLog(sprintf(__VA_ARGS__))
95#define NSError(...) if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSError(__FUNC__, sprintf(__VA_ARGS__))
101#define NSWarning(...) if (autocvar_g_logLevel >= LOGLEVEL_WARNINGS) _NSWarning(__FUNC__, sprintf(__VA_ARGS__))
109#define NSAssert(condition, ...) if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSAssert(condition, __FUNC__, sprintf(__VA_ARGS__))
121const vector g_vec_null = [0.0f, 0.0f, 0.0f];
127InitPrint(
string functionName)
132 string sideLeft =
"";
133 string sideRight =
"";
135 if (functionName == __NULL__) {
136 NSLog(
"---------------------------------------------------");
141 chars = chars - (int)strlen(functionName) - 2i;
142 charsLeft = chars / 2i;
143 charExtra = chars % 2i;
145 for (
int i = 0i; i < charsLeft; i++)
146 sideLeft = strcat(sideLeft,
"-");
148 for (
int i = 0i; i < (charsLeft + charExtra); i++) {
149 sideRight = strcat(sideRight,
"-");
152 NSLog(
"%s %s %s", sideLeft, functionName, sideRight);
155var
string g_lastInitFunc;
157_InitStart(
string functionName)
160 error(sprintf(
"Called InitStart() without InitEnd()ing %s!", g_lastInitFunc));
162 InitPrint(functionName);
163 g_lastInitFunc = functionName;
164 g_initTime = gettime(1);
167#define InitStart() _InitStart(__FUNC__)
172 float endTime = gettime(1);
173 NSLog(
"loaded in %.1f seconds", (endTime - g_initTime));
174 NSLog(
"---------------------------------------------------");
178#define InitEnd() _InitEnd()
181#define entity_def(x, ...) const string x[] = { __VA_ARGS__ }
184#define thread(x) if (fork()) { x; abort(); }
186#define STRING_SET(x) ((x != __NULL__) && (x != ""))
189fileExists(
string filePath)
192 if not(whichpack(filePath))
200 int modelNameLength = strlen(inputString);
201 return substring(inputString, modelNameLength - 3, modelNameLength);
211#include "materials.h"
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37
string Util_ExtensionFromString(string inputString)
Extract the file extension from a given file name string.
Definition: defs.h:198