]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
Merge branch 'master' into TimePath/unified_weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index 17a3fce1c27dbcd9a394b0081aac0a1980044b8c..8ba551d9c3c2011c00a551a06fbb1211869d028f 100644 (file)
@@ -2,7 +2,6 @@
 #include "_all.qh"
 
 #include "controlpoint.qh"
-#include "csqcmodel_hooks.qh"
 #include "damage.qh"
 #include "effects.qh"
 #include "generator.qh"
@@ -28,7 +27,7 @@
 
 #include "../common/buffs.qh"
 #include "../common/deathtypes.qh"
-#include "../common/effects.qh"
+#include "../common/effects/effects.qh"
 #include "../common/mapinfo.qh"
 #include "../common/monsters/all.qh"
 #include "../common/nades.qh"
@@ -49,7 +48,6 @@
 #include "../common/triggers/include.qh"
 
 #include "../common/turrets/cl_turrets.qh"
-#include "../common/turrets/turrets.qh"
 
 #include "../warpzonelib/client.qh"
 
@@ -148,24 +146,14 @@ void CSQC_Init(void)
 
        // needs to be done so early because of the constants they create
        static_init();
-       CALL_ACCUMULATED_FUNCTION(RegisterTurrets);
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
        CALL_ACCUMULATED_FUNCTION(RegisterHUD_Panels);
 
-       initialize_minigames();
-
        // precaches
-       precache_model("null");
-       precache_sound("misc/hit.wav");
-       precache_sound("misc/typehit.wav");
 
-       generator_precache();
        Projectile_Precache();
-       Hook_Precache();
-       GibSplash_Precache();
        Tuba_Precache();
-       CSQCPlayer_Precache();
 
        if(autocvar_cl_reticle)
        {
@@ -779,7 +767,7 @@ void Ent_ReadSpawnEvent(float is_new)
                        }
                        if(autocvar_cl_spawn_event_sound)
                        {
-                               sound(self, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTEN_NORM);
+                               sound(self, CH_TRIGGER, SND_SPAWN, VOL_BASE, ATTEN_NORM);
                        }
                }
        }
@@ -807,15 +795,13 @@ void Ent_Init();
 void Ent_ScoresInfo();
 void CSQC_Ent_Update(float bIsNewEntity)
 {SELFPARAM();
-       float t;
-       float savetime;
-       t = ReadByte();
+       int t = ReadByte();
 
        if(autocvar_developer_csqcentities)
                LOG_INFOF("CSQC_Ent_Update(%d) with self=%i self.entnum=%d self.enttype=%d t=%d\n", bIsNewEntity, self, self.entnum, self.enttype, t);
 
        // set up the "time" global for received entities to be correct for interpolation purposes
-       savetime = time;
+       float savetime = time;
        if(servertime)
        {
                time = servertime;
@@ -832,7 +818,6 @@ void CSQC_Ent_Update(float bIsNewEntity)
        {
                if(t != self.enttype || bIsNewEntity)
                {
-                       //print("A CSQC entity changed its type!\n");
                        LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(self), self.entnum, self.enttype, t);
                        Ent_Remove();
                        clearentity(self);
@@ -849,6 +834,13 @@ void CSQC_Ent_Update(float bIsNewEntity)
        }
 #endif
        self.enttype = t;
+       bool done = false;
+       FOREACH(Linked, it.m_id == t, LAMBDA(
+               it.m_read(self, bIsNewEntity);
+               done = true;
+               break;
+       ));
+       if (!done)
        switch(t)
        {
                case ENT_CLIENT_MUTATOR: {
@@ -895,7 +887,6 @@ void CSQC_Ent_Update(float bIsNewEntity)
                case ENT_CLIENT_SPAWNPOINT: Ent_ReadSpawnPoint(bIsNewEntity); break;
                case ENT_CLIENT_SPAWNEVENT: Ent_ReadSpawnEvent(bIsNewEntity); break;
                case ENT_CLIENT_NOTIFICATION: Read_Notification(bIsNewEntity); break;
-               case ENT_CLIENT_HEALING_ORB: ent_healer(); break;
                case ENT_CLIENT_MINIGAME: ent_read_minigame(); break;
                case ENT_CLIENT_VIEWLOC: ent_viewloc(); break;
                case ENT_CLIENT_VIEWLOC_TRIGGER: ent_viewloc_trigger(); break;
@@ -936,7 +927,7 @@ void Ent_Remove()
 
        if(self.snd_looping > 0)
        {
-               sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
+               sound(self, self.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation);
                self.snd_looping = 0;
        }