]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/csqcmodel/cl_player.qc
Transifex autosync
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / csqcmodel / cl_player.qc
index 5b35bfa4ef2e781817a1b71a9ab11cbc4dfb8ead..a92fcc5c5b600294e8825dc037063f3eb949dace 100644 (file)
@@ -269,7 +269,11 @@ void CSQCPlayer_ApplyDeathTilt(entity this)
 {
        if(!this.csqcmodel_isdead || !autocvar_v_deathtilt)
                return;
-       view_angles.z = autocvar_v_deathtiltangle;
+       // incompatible with cl_eventchase_death 2 because tilting is applied while the corpse is
+       // in the air and immediately turned off when it touches the ground
+       if (autocvar_cl_eventchase_death == 2 && this.csqcmodel_isdead)
+               return;
+       view_angles.z += min((time - this.death_time) * 8, 1) * autocvar_v_deathtiltangle;
 }
 
 float autocvar_v_idlescale;
@@ -417,6 +421,8 @@ float autocvar_cl_rollangle;
 float autocvar_cl_rollspeed;
 float CSQCPlayer_CalcRoll(entity this)
 {
+       if (!autocvar_cl_rollangle) return 0;
+
        makevectors(view_angles);
        float side = (this.velocity * v_right);
        float sign = (side < 0) ? -1 : 1;
@@ -520,6 +526,18 @@ vector CSQCPlayer_ApplyChase(entity this, vector v)
 
 void CSQCPlayer_CalcRefdef(entity this)
 {
+       if(use_engine_refdef)
+       {
+               int refdefflags = 0;
+               if (this.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED;
+               if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING;
+               // note: these two only work in WIP2, but are harmless in WIP1
+               if (PHYS_HEALTH(NULL) <= 0 && PHYS_HEALTH(NULL) != -666 && PHYS_HEALTH(NULL) != -2342) refdefflags |= REFDEFFLAG_DEAD;
+               if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION;
+               V_CalcRefdef(this, refdefflags); // TODO? uses .health stat in the engine when this isn't called here, may be broken!
+               return;
+       }
+
        vector vieworg = this.origin;
        if(intermission)
        {
@@ -548,8 +566,6 @@ void CSQCPlayer_CalcRefdef(entity this)
        setproperty(VF_ANGLES, view_angles);
 }
 
-bool autocvar_cl_useenginerefdef = false;
-
 /** Called once per CSQC_UpdateView() */
 void CSQCPlayer_SetCamera()
 {
@@ -631,20 +647,7 @@ void CSQCPlayer_SetCamera()
                        InterpolateOrigin_Do(view);
                        view.view_ofs = '0 0 1' * vh;
                }
-               if(autocvar_cl_useenginerefdef)
-               {
-                       int refdefflags = 0;
-                       if (view.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED;
-                       if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING;
-                       // note: these two only work in WIP2, but are harmless in WIP1
-                       if (PHYS_HEALTH(NULL) <= 0 && PHYS_HEALTH(NULL) != -666 && PHYS_HEALTH(NULL) != -2342) refdefflags |= REFDEFFLAG_DEAD;
-                       if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION;
-                       V_CalcRefdef(view, refdefflags); // TODO? uses .health stat in the engine when this isn't called here, may be broken!
-               }
-               else
-               {
-                       CSQCPlayer_CalcRefdef(view);
-               }
+               CSQCPlayer_CalcRefdef(view);
        }
        else
        {