From 14ea31ea8fd03f3f420959ada14b1527ee086f81 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Mon, 6 Sep 2010 01:39:30 +0300 Subject: [PATCH] Attempt to implement smooth camera lowering when we get swallowed (so we see our selves sliding down). Not finished yet. --- data/qcsrc/server/vore.qc | 40 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 74801e4c..fede02e6 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -6,7 +6,7 @@ const float button_delay = 0.5; const float steptime = 0.1; const float system_delay_time = 0.1; -.float vore_oldmovetype, vore_oldsolid, vore_oldstomachload; +.float vore_oldmovetype, vore_oldsolid, vore_oldstomachload, vore_oldview_ofs_z; entity Swallow_distance_check() { @@ -56,6 +56,31 @@ float Swallow_condition_check(entity prey) return FALSE; } +// make the camera smoothly lower itself when we get swallowed +// the target we are going for is from normal view offset to half of the view offset (because half is the best positioning of the view for the stomach model) +.float cameraeffect_current, cameraeffect_target; +void Vore_CameraEffect_Set(entity e) +{ + e.cameraeffect_current = 1; + e.cameraeffect_target = 2; +} +void Vore_CameraEffect_Apply() +{ + if(self.eater.classname != "player") + return; + + local float step; + step = 2 * frametime; // CVAR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if(self.cameraeffect_current >= self.cameraeffect_target + step) + self.cameraeffect_current -= step; + else if(self.cameraeffect_current <= self.cameraeffect_target - step) + self.cameraeffect_current += step; + +bprint(strcat(ftos(self.cameraeffect_current), "<<-----------\n")); + self.view_ofs_z = self.vore_oldview_ofs_z / self.cameraeffect_current; +} + void Vore_Weight_apply(entity e) { // apply stomach weight that makes you heavier the more you eat @@ -72,6 +97,7 @@ void Vore_Swallow(entity e) // this player is beening swallowed by another player, apply the proper changes e.vore_oldmovetype = e.movetype; e.vore_oldsolid = e.solid; + e.vore_oldview_ofs_z = e.view_ofs_z; setorigin(e, e.eater.origin); e.velocity = '0 0 0'; @@ -79,7 +105,11 @@ void Vore_Swallow(entity e) e.solid = SOLID_NOT; e.alpha = -1; // best way of hiding / showing the eaten player e.aiment = e.eater; // follow the predator. Is automatically unset - e.view_ofs_z /= 2; // best positioning for the stomach model + + /*e.cameraeffect_current = e.view_ofs_z * 2; + e.cameraeffect_target = e.view_ofs_z / 2; // best positioning for the stomach model*/ + + Vore_CameraEffect_Set(e); // drop keys (KH) and flags (CTF) when we get swallowed kh_Key_DropAll(e, FALSE); @@ -104,8 +134,10 @@ void Vore_Regurgitate(entity e) e.movetype = e.vore_oldmovetype; if(e.health > 0) // leave SOLID_NOT for dead bodies e.solid = e.vore_oldsolid; + e.view_ofs_z = e.vore_oldview_ofs_z; e.alpha = default_player_alpha; // best way of hiding / showing the eaten player - e.view_ofs_z *= 2; // best positioning for the stomach model + + //e.view_ofs_z *= 2; // best positioning for the stomach model // velocities local vector oldforward, oldright, oldup; @@ -355,4 +387,6 @@ void Vore() Vore_Teamheal(); Vore_StomachKick(); + + Vore_CameraEffect_Apply(); } \ No newline at end of file -- 2.39.2