From: Rudolf Polzer Date: Sun, 11 Dec 2011 19:30:33 +0000 (+0100) Subject: forcemodel: make toggling work "perfectly" even during pause X-Git-Tag: xonotic-v0.6.0~74^2~100^2~1 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=1afc2a77bcc3a7dc9a4d8bde76863bb357bc643d;p=xonotic%2Fxonotic-data.pk3dir.git forcemodel: make toggling work "perfectly" even during pause --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index fc40215a6..26299d369 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -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