Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
static.qh
Go to the documentation of this file.
1#pragma once
2
3#define GETTIME_REALTIME 1
4#ifdef MENUQC
5float(int tmr) _gettime = #67;
6#else
7float(int tmr) _gettime = #519;
8#endif
9
11void profile(string s)
12{
13 static float g_starttime;
14 float rt = _gettime(GETTIME_REALTIME);
15 if (!g_starttime) g_starttime = rt;
16 LOG_TRACEF("[%f] %s", rt - g_starttime, s);
17}
18
19#define _STATIC_INIT(func, where) \
20 /* ACCUMULATE void _static_##func##profile() { profile(#func); } */ \
21 /* ACCUMULATE_FUNCTION(where, _static_##func##profile) */ \
22 ACCUMULATE void _static_##func(); \
23 ACCUMULATE_FUNCTION(where, _static_##func) \
24 void _static_##func()
25
27#define STATIC_INIT_EARLY(func) _STATIC_INIT(func##_0, __static_init_0)
28#define static_init_early() CALL_ACCUMULATED_FUNCTION(__static_init_0)
30
32#define STATIC_INIT(func) _STATIC_INIT(func##_1, __static_init_1)
33#define static_init() CALL_ACCUMULATED_FUNCTION(__static_init_1)
35
37#define STATIC_INIT_LATE(func) _STATIC_INIT(func##_2, __static_init_2)
38#define static_init_late() CALL_ACCUMULATED_FUNCTION(__static_init_2)
40
42#define PRECACHE(func) _STATIC_INIT(func##_3, __static_init_3)
43#define static_init_precache() CALL_ACCUMULATED_FUNCTION(__static_init_3)
45
46/* other map entities spawn now */
47
49#define SHUTDOWN(func) _STATIC_INIT(func##_shutdown, __shutdown)
50#define shutdownhooks() CALL_ACCUMULATED_FUNCTION( __shutdown)
51void __shutdown() {}
float() random
#define ERASEABLE
Definition _all.inc:37
#define LOG_TRACEF(...)
Definition log.qh:77
void __static_init_1()
Definition static.qh:34
ERASEABLE void profile(string s)
Definition static.qh:11
void __static_init_2()
Definition static.qh:39
#define GETTIME_REALTIME
Definition static.qh:3
void __shutdown()
Definition static.qh:51
void __static_init_0()
Definition static.qh:29
void __static_init_3()
Definition static.qh:44