]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/csqcmodel_hooks.qc
Code cleanup: add QM_TAGs and 2 aliases
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / csqcmodel_hooks.qc
index dde4461821ee9feef7e501d25961931082a79028..80b68a6e287384480a002026329a1f8f4cba283d 100644 (file)
@@ -1,26 +1,25 @@
-#if defined(CSQC)
-       #include "gibs.qh"
-       #include "miscfunctions.qh"
-       #include "player_skeleton.qh"
-       #include "sortlist.qh"
+#include "csqcmodel_hooks.qh"
+#include "_all.qh"
 
-       #include "../client/weapons/projectile.qh"
+#include "gibs.qh"
+#include "player_skeleton.qh"
 
-       #include "../common/animdecide.qh"
-       #include "../common/csqcmodel_settings.qh"
+#include "weapons/projectile.qh"
 
-       #include "../csqcmodellib/cl_model.qh"
-       #include "../csqcmodellib/cl_player.qh"
-       #include "../csqcmodellib/interpolate.qh"
+#include "../common/animdecide.qh"
+#include "../common/csqcmodel_settings.qh"
+#include "../common/teams.qh"
+#include "../common/triggers/trigger/viewloc.qh"
 
-       #include "../warpzonelib/mathlib.qh"
+#include "mutators/events.qh"
+
+#include "../csqcmodellib/cl_model.qh"
+#include "../csqcmodellib/cl_player.qh"
+#include "../csqcmodellib/interpolate.qh"
 
-       .float death_time;
-       .int modelflags;
-#elif defined(MENUQC)
-#elif defined(SVQC)
-#endif
 
+.float death_time;
+.int modelflags;
 
 void CSQCModel_Hook_PreDraw(bool isplayer);
 
@@ -402,6 +401,14 @@ void CSQCModel_AutoTagIndex_Apply(void)
        if(self.tag_entity && wasfreed(self.tag_entity))
                self.tag_entity = world;
 
+       if(self.viewloc && wasfreed(self.viewloc))
+               self.viewloc = world;
+
+       if(self.viewloc.entnum != self.tag_networkviewloc)
+               self.viewloc = findfloat(world, entnum, self.tag_networkviewloc);
+
+       MUTATOR_CALLHOOK(TagIndex_Update, self);
+
        if(self.tag_networkentity)
        {
                // we are ATTACHED!
@@ -431,9 +438,9 @@ void CSQCModel_AutoTagIndex_Apply(void)
                        if(self.tag_entity)
                        {
                                // the best part is: IT EXISTS
-                               if(substring(self.model, 0, 17) == "models/weapons/v_")
+                               if(substring(self.model, 0, 14) == "models/weapons")
                                {
-                                       if(substring(self.tag_entity.model, 0, 17) == "models/weapons/h_")
+                                       if(substring(self.tag_entity.model, 0, 14) == "models/weapons")
                                        {
                                                self.tag_index = gettagindex(self.tag_entity, "weapon");
                                                if(!self.tag_index)
@@ -453,12 +460,14 @@ void CSQCModel_AutoTagIndex_Apply(void)
                                        }
                                }
 
-                               if(substring(self.tag_entity.model, 0, 17) == "models/weapons/v_")
+                               if(substring(self.tag_entity.model, 0, 14) == "models/weapons")
                                {
                                        self.tag_index = gettagindex(self.tag_entity, "shot");
                                        if(!self.tag_index)
                                                self.tag_index = gettagindex(self.tag_entity, "tag_shot");
                                }
+
+                               MUTATOR_CALLHOOK(TagIndex_Apply, self);
                        }
                        else
                        {
@@ -657,10 +666,10 @@ void CSQCModel_Hook_PreDraw(bool isplayer)
                        bool onground = 0;
                        if(self == csqcplayer)
                        {
-                               if(self.pmove_flags & PMF_ONGROUND)
+                               if(self.flags & FL_ONGROUND)
                                        onground = 1;
-                               self.anim_prev_pmove_flags = self.pmove_flags;
-                               if(self.pmove_flags & PMF_DUCKED)
+                               self.anim_prev_pmove_flags = self.flags;
+                               if(self.flags & FL_DUCKED)
                                        animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, false);
                                else if(self.anim_state & ANIMSTATE_DUCK)
                                        animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, false);