From 5c09afd1559b879f11f2e6c967d7fa43e378bfb8 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Mon, 11 Jul 2011 00:22:58 +0300 Subject: [PATCH] Tweak and update several things for the swallow model --- data/qcsrc/server/vore.qc | 45 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index e209b317..b99e4c17 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -202,13 +202,14 @@ void Vore_AutoDigest(entity e) .entity swallow_model; void Vore_SwallowModel_Think() { - //update the necessary angles to match our view - //self.angles_x = self.owner.angles_x; - //self.view_ofs = self.owner.view_ofs; - - 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 - - // if our swallow progress is gone, the swallow model must also go + //update the position of the swallow model to match our swallow progress + float dist; + dist = (-0.5 + self.owner.swallow_progress_prey) * cvar("g_vore_swallowmodel_range"); // the model is centered at 0.5 progress + if(cvar("g_healthsize")) + dist *= self.scale; + self.view_ofs = '1 0 0' * dist; + + // if our swallow progress is gone, the swallow model also goes if(!self.owner.swallow_progress_prey) { remove(self.owner.swallow_model); @@ -216,6 +217,8 @@ void Vore_SwallowModel_Think() return; } + // properties that should update whenever possible, but when the predator is not available + self.alpha = self.owner.cvar_cl_vore_stomachmodel; self.nextthink = time; } @@ -225,32 +228,32 @@ void Vore_SwallowModel_Update(entity prey) if(!prey.swallow_model) { prey.swallow_model = spawn(); - + prey.swallow_model.movetype = MOVETYPE_FOLLOW; prey.swallow_model.solid = SOLID_NOT; - prey.swallow_model.skin = self.skin; - //prey.swallow_model.scale = self.scale; // FIX LATER - // apply the properties of the prey - prey.swallow_model.viewmodelforclient = prey; - prey.swallow_model.effects |= EF_NOGUNBOB; - prey.swallow_model.alpha = prey.cvar_cl_vore_stomachmodel; - prey.swallow_model.colormap = prey.colormap; - prey.swallow_model.glowmod = prey.glowmod; + prey.swallow_model.viewmodelforclient = prey; // use the same system as the weapon model + //prey.swallow_model.effects |= EF_NOGUNBOB; // let it bob + prey.swallow_model.colormap = prey.colormap; // pants and shirt color + prey.swallow_model.glowmod = prey.glowmod; // glow color prey.swallow_model.owner = prey; // owned by the prey prey.swallow_model.think = Vore_SwallowModel_Think; prey.swallow_model.nextthink = time; } - // if predator has changed, update the swallow model - if(prey.swallow_model.enemy != self) - { - setmodel(prey.swallow_model, strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_swallow.md3")); // 4 is the extension length + // properties that should update whenever possible, but when the predator is available + string player_swallowmodel; + player_swallowmodel = strcat(substring(self.playermodel, 0, strlen(self.playermodel) - 4), "_swallow.md3"); // 4 is the extension length + if(prey.swallow_model.model != player_swallowmodel) // player model can be changed while the predator is active + setmodel(prey.swallow_model, player_swallowmodel); + if(prey.swallow_model.skin != self.skin) // player skin can be changed while the predator is active prey.swallow_model.skin = self.skin; + if(cvar("g_healthsize")) + prey.swallow_model.scale = self.scale / prey.scale; // player size difference + if(prey.swallow_model.enemy != self) prey.swallow_model.enemy = self; // enemy is the predator - } } .entity pusher; -- 2.39.2