]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Tweak and update several things for the swallow model
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 10 Jul 2011 21:22:58 +0000 (00:22 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 10 Jul 2011 21:22:58 +0000 (00:22 +0300)
data/qcsrc/server/vore.qc

index e209b317ba69a22fb2946d0e2d154ec8e58e3a65..b99e4c1785244f3ba20434175b62beb65d2c0a69 100644 (file)
@@ -202,13 +202,14 @@ void Vore_AutoDigest(entity e)
 .entity swallow_model;\r
 void Vore_SwallowModel_Think()\r
 {\r
-       //update the necessary angles to match our view\r
-       //self.angles_x = self.owner.angles_x;\r
-       //self.view_ofs = self.owner.view_ofs;\r
-\r
-       self.view_ofs = '-1 0 0' * (0.5 - self.owner.swallow_progress_prey) * cvar("g_vore_swallowmodel_range"); // the model is centered at 0.5 progress\r
-\r
-       // if our swallow progress is gone, the swallow model must also go\r
+       //update the position of the swallow model to match our swallow progress\r
+       float dist;\r
+       dist = (-0.5 + self.owner.swallow_progress_prey) * cvar("g_vore_swallowmodel_range"); // the model is centered at 0.5 progress\r
+       if(cvar("g_healthsize"))\r
+               dist *= self.scale;\r
+       self.view_ofs = '1 0 0' * dist;\r
+\r
+       // if our swallow progress is gone, the swallow model also goes\r
        if(!self.owner.swallow_progress_prey)\r
        {\r
                remove(self.owner.swallow_model);\r
@@ -216,6 +217,8 @@ void Vore_SwallowModel_Think()
                return;\r
        }\r
 \r
+       // properties that should update whenever possible, but when the predator is not available\r
+       self.alpha = self.owner.cvar_cl_vore_stomachmodel;\r
        self.nextthink = time;\r
 }\r
 \r
@@ -225,32 +228,32 @@ void Vore_SwallowModel_Update(entity prey)
        if(!prey.swallow_model)\r
        {\r
                prey.swallow_model = spawn();\r
-               \r
+\r
                prey.swallow_model.movetype = MOVETYPE_FOLLOW;\r
                prey.swallow_model.solid = SOLID_NOT;\r
 \r
-               prey.swallow_model.skin = self.skin;\r
-               //prey.swallow_model.scale = self.scale; // FIX LATER\r
-\r
                // apply the properties of the prey\r
-               prey.swallow_model.viewmodelforclient = prey;\r
-               prey.swallow_model.effects |= EF_NOGUNBOB;\r
-               prey.swallow_model.alpha = prey.cvar_cl_vore_stomachmodel;\r
-               prey.swallow_model.colormap = prey.colormap;\r
-               prey.swallow_model.glowmod = prey.glowmod;\r
+               prey.swallow_model.viewmodelforclient = prey; // use the same system as the weapon model\r
+               //prey.swallow_model.effects |= EF_NOGUNBOB; // let it bob\r
+               prey.swallow_model.colormap = prey.colormap; // pants and shirt color\r
+               prey.swallow_model.glowmod = prey.glowmod; // glow color\r
 \r
                prey.swallow_model.owner = prey; // owned by the prey\r
                prey.swallow_model.think = Vore_SwallowModel_Think;\r
                prey.swallow_model.nextthink = time;\r
        }\r
 \r
-       // if predator has changed, update the swallow model\r
-       if(prey.swallow_model.enemy != self)\r
-       {\r
-               setmodel(prey.swallow_model, strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_swallow.md3")); // 4 is the extension length\r
+       // properties that should update whenever possible, but when the predator is available\r
+       string player_swallowmodel;\r
+       player_swallowmodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_swallow.md3"); // 4 is the extension length\r
+       if(prey.swallow_model.model != player_swallowmodel) // player model can be changed while the predator is active\r
+               setmodel(prey.swallow_model, player_swallowmodel);\r
+       if(prey.swallow_model.skin != self.skin) // player skin can be changed while the predator is active\r
                prey.swallow_model.skin = self.skin;\r
+       if(cvar("g_healthsize"))\r
+               prey.swallow_model.scale = self.scale / prey.scale; // player size difference\r
+       if(prey.swallow_model.enemy != self)\r
                prey.swallow_model.enemy = self; // enemy is the predator\r
-       }\r
 }\r
 \r
 .entity pusher;\r