22var
bool autocvar_g_logTimestamps =
false;
34#define LOGLEVEL_DEFAULT LOGLEVEL_WARNINGS
35var logLevel_t autocvar_g_logLevel = LOGLEVEL_DEFAULT;
37#define printf(...) print(sprintf(__VA_ARGS__))
47 if (autocvar_g_logTimestamps)
48 print(sprintf(
"^9%f ^7%s\n", time, msg));
50 print(sprintf(
"^7%s\n", msg));
54_NSError(
string functionName,
string msg)
56 if (autocvar_g_logTimestamps)
57 print(sprintf(
"^9%f ^1%s^7: %s\n", time, functionName, msg));
59 print(sprintf(
"^1%s^7: %s\n", functionName, msg));
63_NSWarning(
string functionName,
string msg)
65 if (autocvar_g_logTimestamps)
66 print(sprintf(
"^9%f ^3%s^7: %s\n", time, functionName, msg));
68 print(sprintf(
"^3%s^7: %s\n", functionName, msg));
72_NSAssert(
bool condition,
string function,
string descr)
75 print(strcat(
"^1Assertion failed in ", function,
", reason: ", descr,
"\n"));
86#define NSLog(...) if (autocvar_g_logLevel >= LOGLEVEL_DEBUG) _NSLog(sprintf(__VA_ARGS__))
92#define NSError(...) if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSError(__FUNC__, sprintf(__VA_ARGS__))
98#define NSWarning(...) if (autocvar_g_logLevel >= LOGLEVEL_WARNINGS) _NSWarning(__FUNC__, sprintf(__VA_ARGS__))
106#define NSAssert(condition, ...) if (autocvar_g_logLevel >= LOGLEVEL_ERRORS) _NSAssert(condition, __FUNC__, sprintf(__VA_ARGS__))
118const vector g_vec_null = [0.0f, 0.0f, 0.0f];
124InitPrint(
string functionName)
129 string sideLeft =
"";
130 string sideRight =
"";
132 if (functionName == __NULL__) {
133 NSLog(
"---------------------------------------------------");
138 chars = chars - (int)strlen(functionName) - 2i;
139 charsLeft = chars / 2i;
140 charExtra = chars % 2i;
142 for (
int i = 0i; i < charsLeft; i++)
143 sideLeft = strcat(sideLeft,
"-");
145 for (
int i = 0i; i < (charsLeft + charExtra); i++) {
146 sideRight = strcat(sideRight,
"-");
149 NSLog(
"%s %s %s", sideLeft, functionName, sideRight);
152var
string g_lastInitFunc;
154_InitStart(
string functionName)
157 error(sprintf(
"Called InitStart() without InitEnd()ing %s!", g_lastInitFunc));
159 InitPrint(functionName);
160 g_lastInitFunc = functionName;
161 g_initTime = gettime(1);
164#define InitStart() _InitStart(__FUNC__)
169 float endTime = gettime(1);
170 NSLog(
"loaded in %.1f seconds", (endTime - g_initTime));
171 NSLog(
"---------------------------------------------------");
175#define InitEnd() _InitEnd()
178#define entity_def(x, ...) const string x[] = { __VA_ARGS__ }
181#define thread(x) if (fork()) { x; abort(); }
183#define STRING_SET(x) ((x != __NULL__) && (x != ""))
186fileExists(
string filePath)
189 if not(whichpack(filePath))
201#include "materials.h"
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37