]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Precache: defer
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 1 Nov 2015 05:59:38 +0000 (16:59 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 1 Nov 2015 05:59:38 +0000 (16:59 +1100)
qcsrc/client/main.qc
qcsrc/common/models/all.qh
qcsrc/common/sounds/all.qh
qcsrc/lib/static.qh
qcsrc/menu/menu.qc
qcsrc/server/g_world.qc

index ac3d8f2aedf194f77b334cc4e15dbc3f19947739..20f949bf3fc70b68f6e513c1412503a20531bc6d 100644 (file)
@@ -131,6 +131,7 @@ void CSQC_Init(void)
        // needs to be done so early because of the constants they create
        static_init();
        static_init_late();
+       static_init_precache();
 
        // precaches
 
index f38b23fff9f63508aac9e60a955fd2cf5d1a8d7a..b81567427767f030fb5742c87be7089f4c56afe6 100644 (file)
@@ -11,7 +11,7 @@ REGISTER_REGISTRY(RegisterModels)
     string MDL_##name##_get() { return path; } \
     REGISTER(RegisterModels, MDL, Models, name, m_id, NEW(Model, MDL_##name##_get))
 
-STATIC_INIT(RegisterModels_precache) {
+PRECACHE(Models) {
     FOREACH(Models, true, LAMBDA({
         it.model_precache(it);
     }));
index fd56eeca37f89a865a4f64e0af758f3491014282..1bf8ba170e506af00b2198746eebfbaa7fcf7644 100644 (file)
@@ -14,7 +14,7 @@ REGISTER_REGISTRY(RegisterSounds)
 // Used in places where a string is required
 #define SND(id) (SND_##id.sound_str())
 
-STATIC_INIT(RegisterSounds_precache) {
+PRECACHE(Sounds) {
     FOREACH(Sounds, true, LAMBDA({
         it.sound_precache(it);
     }));
index 49ce802e90f0bb376366e522c0139be3f51600b6..a9f7f53d678dddc5cbb5ffe1dfbc5eefa62aed3e 100644 (file)
@@ -5,6 +5,8 @@ void __static_init() {}
 #define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
 void __static_init_late() {}
 #define static_init_late() CALL_ACCUMULATED_FUNCTION(__static_init_late)
+void __static_init_precache() {}
+#define static_init_precache() CALL_ACCUMULATED_FUNCTION(__static_init_precache)
 
 #define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init, func)
 
@@ -13,7 +15,8 @@ void __static_init_late() {}
        ACCUMULATE_FUNCTION(where, _static_##func) \
        void _static_##func()
 
-#define STATIC_INIT(func) _STATIC_INIT(__static_init,         func)
-#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init_late,    func##_late)
+#define STATIC_INIT(func) _STATIC_INIT(__static_init,           func)
+#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init_late, func##_late)
+#define PRECACHE(func) _STATIC_INIT(__static_init_precache,     func##_precache)
 
 #endif
index 13d8fcd49ef2d1b154b544ad02c0d09f344b29f8..bd5a24fee05e2af34c05f9a2bd0a8611ef7e6de4 100644 (file)
@@ -83,6 +83,7 @@ void m_init()
        // needs to be done so early because of the constants they create
        static_init();
        static_init_late();
+       static_init_precache();
 
        RegisterSLCategories();
 
index 01e69f4be3eaa69fbf6be1872d2932aa5502222b..e6641947c28204415136b484150964db85c28bca 100644 (file)
@@ -559,6 +559,7 @@ spawnfunc(__init_dedicated_server)
        // needs to be done so early because of the constants they create
        static_init();
        static_init_late();
+       static_init_precache();
 
        MapInfo_Enumerate();
        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
@@ -658,6 +659,7 @@ spawnfunc(worldspawn)
 
        InitGameplayMode();
        static_init_late();
+       static_init_precache();
        readlevelcvars();
        GrappleHookInit();