]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
forcemodel: make toggling work "perfectly" even during pause
authorRudolf Polzer <divverent@xonotic.org>
Sun, 11 Dec 2011 19:30:33 +0000 (20:30 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 11 Dec 2011 19:30:33 +0000 (20:30 +0100)
qcsrc/client/csqcmodel_hooks.qc

index fc40215a65ccf76a78e5501f585d5004218241e8..26299d36974f0205cd7b5ff46f2acf41a6b1ae8c 100644 (file)
@@ -70,7 +70,7 @@ void CSQCPlayer_LOD_Apply(void)
        }
 }
 
-// FEATURE: forcemodel
+// FEATURE: forcemodel (MUST be called BEFORE LOD!)
 string forceplayermodels_model;
 float forceplayermodels_modelindex;
 float forceplayermodels_skin;
@@ -93,6 +93,7 @@ void CSQCPlayer_ForceModel_PostUpdate(void)
 void CSQCPlayer_ForceModel_Apply(float islocalplayer)
 {
        // first, try finding it from the server
+
        if(self.forceplayermodels_savemodelindex && self.forceplayermodels_savemodel != "null")
        {
                if(islocalplayer)
@@ -126,6 +127,12 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer)
                self.modelindex = forceplayermodels_modelindex;
                self.skin = forceplayermodels_skin;
        }
+       else
+       {
+               self.model = self.forceplayermodels_savemodel;
+               self.modelindex = self.forceplayermodels_savemodelindex;
+               self.skin = self.forceplayermodels_saveskin;
+       }
 }
 
 // FEATURE: fallback frames
@@ -186,6 +193,7 @@ void CSQCPlayer_GlowMod_Apply(void)
 
 // FEATURE: auto tag_index
 .entity tag_entity;
+.float tag_entity_lastmodelindex;
 .float tag_index;
 void CSQCModel_AutoTagIndex_Apply(void)
 {
@@ -195,10 +203,19 @@ void CSQCModel_AutoTagIndex_Apply(void)
        if(self.tag_networkentity)
        {
                // we are ATTACHED!
+               float changed = 0;
                if(self.tag_entity.entnum != self.tag_networkentity)
                {
-                       // to something NEW NEW NEW NEW!
                        self.tag_entity = findfloat(world, entnum, self.tag_networkentity);
+                       changed = 1;
+               }
+               if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex)
+               {
+                       self.tag_entity_lastmodelindex = self.tag_entity.modelindex;
+                       changed = 1;
+               }
+               if(changed)
+               {
                        if(self.tag_entity)
                        {
                                // the best part is: IT EXISTS