From e5c873755b276c070f27e2eb187f7d1fbe96884a Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 9 Jul 2011 23:06:12 +0300 Subject: [PATCH] Put code in place for a "swallow model", which will be a model shown at the prey's view origin, that shows their trip to the belly. It will be mapped based on the prey's swallow progress. --- data/qcsrc/server/vore.qc | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 3017a39b..5e2abefa 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -199,6 +199,49 @@ void Vore_AutoDigest(entity e) e.digesting = TRUE; } +void Vore_SwallowModel_Think() +{ + //update the necessary angles to match our view + self.angles_x = self.owner.angles_x; + + // if our swallow progress is gone, the swallow model must also go + if(!self.owner.swallow_progress_prey) + { + self.nextthink = 0; + remove(self); + self = world; + return; + } + + self.nextthink = time; +} + +.entity swallow_model; +void Vore_SwallowModel_Spawn(entity prey) +{ + entity e; + e = spawn(); + + e.movetype = MOVETYPE_FOLLOW; + e.solid = SOLID_NOT; + e.alpha = prey.cvar_cl_vore_stomachmodel; + + // apply the properties of the predator + setmodel(e, strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_swallow.md3")); // 4 is the extension length + //e.skin = self.skin; + e.scale = self.scale; + + // apply the properties of the prey + e.angles_x = prey.angles_x; + e.aiment = prey; + e.origin += prey.view_ofs; + + e.owner = prey; // owned by the prey + e.enemy = self; // enemy is the predator + e.think = Vore_SwallowModel_Think; + e.nextthink = time; +} + .entity pusher; .float pushltime; void Vore_Swallow(entity e) @@ -255,6 +298,17 @@ void Vore_SwallowStep(entity e) return; } + // if the predator swallowing me has changed, remove the swallow model + if(e.swallow_model && e.swallow_model.enemy != self) + { + e.swallow_model.nextthink = 0; + remove(e.swallow_model); + e.swallow_model = world; + } + //set the swallow model for the prey + if(!e.swallow_model) + Vore_SwallowModel_Spawn(e); + // increase the progress value until it reaches 1, then swallow the player if(e.swallow_progress_prey < 1) { -- 2.39.2