Put code in place for a "swallow model", which will be a model shown at the prey...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 9 Jul 2011 20:06:12 +0000 (23:06 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 9 Jul 2011 20:06:12 +0000 (23:06 +0300)
data/qcsrc/server/vore.qc

index 3017a39..5e2abef 100644 (file)
@@ -199,6 +199,49 @@ void Vore_AutoDigest(entity e)
        e.digesting = TRUE;\r
 }\r
 \r
+void Vore_SwallowModel_Think()\r
+{\r
+       //update the necessary angles to match our view\r
+       self.angles_x = self.owner.angles_x;\r
+\r
+       // if our swallow progress is gone, the swallow model must also go\r
+       if(!self.owner.swallow_progress_prey)\r
+       {\r
+               self.nextthink = 0;\r
+               remove(self);\r
+               self = world;\r
+               return;\r
+       }\r
+\r
+       self.nextthink = time;\r
+}\r
+\r
+.entity swallow_model;\r
+void Vore_SwallowModel_Spawn(entity prey)\r
+{\r
+       entity e;\r
+       e = spawn();\r
+       \r
+       e.movetype = MOVETYPE_FOLLOW;\r
+       e.solid = SOLID_NOT;\r
+       e.alpha = prey.cvar_cl_vore_stomachmodel;\r
+\r
+       // apply the properties of the predator\r
+       setmodel(e, strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_swallow.md3")); // 4 is the extension length\r
+       //e.skin = self.skin;\r
+       e.scale = self.scale;\r
+\r
+       // apply the properties of the prey\r
+       e.angles_x = prey.angles_x;\r
+       e.aiment = prey;\r
+       e.origin += prey.view_ofs;\r
+\r
+       e.owner = prey; // owned by the prey\r
+       e.enemy = self; // enemy is the predator\r
+       e.think = Vore_SwallowModel_Think;\r
+       e.nextthink = time;\r
+}\r
+\r
 .entity pusher;\r
 .float pushltime;\r
 void Vore_Swallow(entity e)\r
@@ -255,6 +298,17 @@ void Vore_SwallowStep(entity e)
                return;\r
        }\r
 \r
+       // if the predator swallowing me has changed, remove the swallow model\r
+       if(e.swallow_model && e.swallow_model.enemy != self)\r
+       {\r
+               e.swallow_model.nextthink = 0;\r
+               remove(e.swallow_model);\r
+               e.swallow_model = world;\r
+       }\r
+       //set the swallow model for the prey\r
+       if(!e.swallow_model)\r
+               Vore_SwallowModel_Spawn(e);\r
+\r
        // increase the progress value until it reaches 1, then swallow the player\r
        if(e.swallow_progress_prey < 1)\r
        {\r