]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Some rather major changes to the model setting system. Basically, we no longer attemp...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 19 Apr 2011 14:19:53 +0000 (17:19 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 19 Apr 2011 14:19:53 +0000 (17:19 +0300)
data/qcsrc/server/cl_client.qc
data/qcsrc/server/cl_player.qc
data/qcsrc/server/cl_weaponsystem.qc

index b096334c95a8e5a2cf30b1f4ae4a42cca3b52532..49d1ea05fe7d0edce4b981d0a733414dd80e8fa1 100644 (file)
@@ -470,7 +470,7 @@ void Client_uncustomizeentityforclient()
 float Client_customizeentityforclient()\r
 {\r
        entity modelsource;\r
-       string applymodel;\r
+       string stomachmodel;\r
 \r
        if(self.modelindex == 0)\r
                return TRUE;\r
@@ -512,28 +512,30 @@ float Client_customizeentityforclient()
        // now change the predator's player model into a stomach model for the prey\r
        // in other words, when a player is swallowed by another player, the predator becomes an inward stomach model so the prey can see theirself in the stomach\r
        // this is only visible to the prey however, otherwise players would appear as a floating stomach to everyone (ewww)\r
+       stomachmodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_stomach.md3"); // 4 is the extension length\r
 \r
-       // don't do this if we have chase_active enabled, as we'd be seeing a floating stomach from third person view\r
-       if(other.cvar_chase_active > 0 || other.classname == "observer") // the classname check prevents a bug\r
-       {\r
-               Client_setmodel(setmodel_state());\r
-               if not(self.predator.classname == "player" || self.fakeprey)\r
-                       self.alpha = default_player_alpha;\r
-               return TRUE;\r
-       }\r
        if(other.spectatee_status)\r
                other = other.enemy; // also do this for the player we are spectating\r
+\r
+       // don't do this if we have chase_active enabled, as we'd be seeing a floating stomach from third person view\r
+       if not(other.cvar_chase_active || other.classname == "observer") // the observer check prevents a bug\r
        if(other.predator == self || other.fakepredator == self)\r
        {\r
-               applymodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_stomach.md3"); // 4 is the extension length\r
-               Client_setmodel(applymodel);\r
-               self.frame = 0; // don't use any animations as a stomach\r
-               self.alpha = other.cvar_cl_vore_stomachmodel;\r
+               if(self.model != stomachmodel) // don't execute each frame\r
+               {\r
+                       Client_setmodel(stomachmodel);\r
+                       self.frame = 0; // don't use any animations as a stomach\r
+                       self.alpha = other.cvar_cl_vore_stomachmodel;\r
+               }\r
                return TRUE;\r
        }\r
-       Client_setmodel(setmodel_state());\r
-       if not(self.predator.classname == "player" || self.fakeprey)\r
-               self.alpha = default_player_alpha;\r
+\r
+       if(self.model != setmodel_state())  // don't execute each frame\r
+       {\r
+               Client_setmodel(setmodel_state());\r
+               if not(self.predator.classname == "player" || self.fakeprey)\r
+                       self.alpha = default_player_alpha;\r
+       }\r
        return TRUE;\r
 }\r
 \r
index 3997e3ded0b8a479529b23a8160af1cff9454ffb..3d2cf7a3ec3946d5be98789baf138b269943d3cb 100644 (file)
@@ -218,6 +218,10 @@ float player_getspecies()
 \r
 void player_setupanimsformodel()\r
 {\r
+       // if this is the stomach model (or any model that can't be animated), don't attempt to animate\r
+       if(substring(self.model, strlen(self.model) - 3, 3) == "md3") // check model extension\r
+               return;\r
+\r
        local string animfilename;\r
        local float animfile;\r
        // defaults for legacy .zym models without animinfo files\r
@@ -281,6 +285,13 @@ void player_setupanimsformodel()
        }\r
        else\r
                dprint("File ", animfilename, " not found, assuming legacy .zym model animation timings\n");\r
+\r
+       // the line below is disabled due to issues with the stomach model, which cannot be animated.\r
+       // customizeentityforclient cannot let this part of the code know whether it's the stomach model or normal\r
+       // player model we're using. Attempting to animate the stomach model causes BIG issues, and must not be allowed.\r
+\r
+       // reset animstate now\r
+       //setanim(self, self.anim_idle, TRUE, FALSE, TRUE);\r
 };\r
 \r
 void player_anim (void)\r
index 9716e9852bfa19cb5feda45938f457b8b6e89fda..0ac640466cc183fa903a98d9c6b2a9e039925f2e 100644 (file)
@@ -255,19 +255,24 @@ float CL_ExteriorWeaponentity_CustomizeEntityForClient()
        // otherwise, the stomach model the predator is transformed in (see Client_customizeentityforclient) will have a weapon model attached to it\r
        if(self.owner.weaponname == "" || self.owner.deadflag != DEAD_NO)\r
                return TRUE;\r
-       if(other.cvar_chase_active > 0 || other.classname == "observer") // the classname check prevents a bug\r
-       {\r
-               setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3"));\r
-               return TRUE;\r
-       }\r
+\r
        if(other.spectatee_status)\r
                other = other.enemy; // also do this for the player we are spectating\r
+\r
+       if not(other.cvar_chase_active || other.classname == "observer") // the observer check prevents a bug\r
        if(other.predator == self.owner || other.fakepredator == self.owner)\r
        {\r
-               setmodel(self, "");\r
+               if(self.model != "") // don't execute each frame\r
+               {\r
+                       setmodel(self, "");\r
+               }\r
                return TRUE;\r
        }\r
-       setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3"));\r
+\r
+       if(self.model != strcat("models/weapons/v_", self.owner.weaponname, ".md3")) // don't execute each frame\r
+       {\r
+               setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3"));\r
+       }\r
        return TRUE;\r
 }\r
 \r