Skip to content

Commit

Permalink
fix svc_movevars spam on listenservers
Browse files Browse the repository at this point in the history
fix viewmodel_shift 2 behaviour
  • Loading branch information
mikkokko committed Jan 13, 2024
1 parent d4d90f4 commit 6f82e35
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion csldr/view.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static void CalcCustomRefdef(ref_params_t *pparams)
vm->origin[2] += 1;

// offset the viewmodel
VectorMA(up, 1, vm->origin);
VectorMA_2(up, 1, vm->origin);
}

if ((int)cl_bobstyle->value == 2)
Expand Down Expand Up @@ -347,6 +347,11 @@ static void CalcCustomRefdef(ref_params_t *pparams)

void Hk_CalcRefdef(ref_params_t *pparams)
{
float old_rollangle, old_rollspeed;

/* temporarily override view roll settings with client dictated ones */
old_rollangle = pparams->movevars->rollangle;
old_rollspeed = pparams->movevars->rollspeed;
pparams->movevars->rollangle = cl_rollangle->value;
pparams->movevars->rollspeed = cl_rollspeed->value;

Expand All @@ -373,6 +378,10 @@ void Hk_CalcRefdef(ref_params_t *pparams)
cl_funcs.pCalcRefdef(pparams);
}

/* view roll has been applied, restore the settings */
pparams->movevars->rollangle = old_rollangle;
pparams->movevars->rollspeed = old_rollspeed;

if (!pparams->intermission && !pparams->paused)
{
CalcCustomRefdef(pparams);
Expand Down

0 comments on commit 6f82e35

Please sign in to comment.