-#else
-
-extern cvar_t cl_rollspeed;
-extern cvar_t cl_rollangle;
-void SV_ClientThink(void)
-{
- int j;
- vec3_t wishvel, wishdir, v, v_forward, v_right, v_up, start, stop;
- float wishspeed, f, limit;
- trace_t trace;
-
- if (host_client->edict->v->movetype == MOVETYPE_NONE)
- return;
-
- f = DotProduct(host_client->edict->v->punchangle, host_client->edict->v->punchangle);
- if (f)
- {
- limit = sqrt(f);
- f = (limit - 10 * sv.frametime);
- f /= limit;
- f = max(0, f);
- VectorScale(host_client->edict->v->punchangle, f, host_client->edict->v->punchangle);
- }
-
- // if dead, behave differently
- if (host_client->edict->v->health <= 0)
- return;
-
- AngleVectors(host_client->edict->v->v_angle, v_forward, v_right, v_up);
- // show 1/3 the pitch angle and all the roll angle
- f = DotProduct(host_client->edict->v->velocity, v_right) * (1.0 / cl_rollspeed.value);
- host_client->edict->v->angles[2] = bound(-1, f, 1) * cl_rollangle.value * 4;
- if (!host_client->edict->v->fixangle)
- {
- host_client->edict->v->angles[0] = (host_client->edict->v->v_angle[0] + host_client->edict->v->punchangle[0]) * -0.333;
- host_client->edict->v->angles[1] = host_client->edict->v->v_angle[1] + host_client->edict->v->punchangle[1];
- }
-
- if ((int)host_client->edict->v->flags & FL_WATERJUMP)
- {
- host_client->edict->v->velocity[0] = host_client->edict->v->movedir[0];
- host_client->edict->v->velocity[1] = host_client->edict->v->movedir[1];
- if (sv.time > host_client->edict->v->teleport_time || host_client->edict->v->waterlevel == 0)
- {
- host_client->edict->v->flags = (int)host_client->edict->v->flags - ((int)host_client->edict->v->flags & FL_WATERJUMP);
- host_client->edict->v->teleport_time = 0;
- }
- return;
- }
-
- // swim
- if (host_client->edict->v->waterlevel >= 2)
- if (host_client->edict->v->movetype != MOVETYPE_NOCLIP)
- {
- if (host_client->cmd.forwardmove == 0 && host_client->cmd.sidemove == 0 && host_client->cmd.upmove == 0)
- {
- // drift towards bottom
- wishvel[0] = 0;
- wishvel[1] = 0;
- wishvel[2] = -60;
- }
- else
- {
- for (j = 0;j < 3;j++)
- wishvel[j] = v_forward[j] * host_client->cmd.forwardmove + v_right[j] * host_client->cmd.sidemove;
- wishvel[2] += host_client->cmd.upmove;
- }
-
- wishspeed = VectorLength(wishvel);
- wishspeed = min(wishspeed, sv_maxspeed.value) * 0.7;
-
- // water friction
- f = VectorLength(host_client->edict->v->velocity) * (1 - sv.frametime * sv_friction.value);
- if (f > 0)
- f /= VectorLength(host_client->edict->v->velocity);
- else
- f = 0;
- VectorScale(host_client->edict->v->velocity, f, host_client->edict->v->velocity);
-
- // water acceleration
- if (wishspeed <= f)
- return;
-
- f = wishspeed - f;
- limit = sv_accelerate.value * wishspeed * sv.frametime;
- if (f > limit)
- f = limit;
- limit = VectorLength(wishvel);
- if (limit)
- f /= limit;
- VectorMA(host_client->edict->v->velocity, f, wishvel, host_client->edict->v->velocity);
- return;
- }
-
- // if not flying, move horizontally only
- if (host_client->edict->v->movetype != MOVETYPE_FLY)
- {
- VectorClear(wishvel);
- wishvel[1] = host_client->edict->v->v_angle[1];
- AngleVectors(wishvel, v_forward, v_right, v_up);
- }
-
- // hack to not let you back into teleporter
- VectorScale(v_right, host_client->cmd.sidemove, wishvel);
- if (sv.time >= host_client->edict->v->teleport_time || host_client->cmd.forwardmove > 0)
- VectorMA(wishvel, host_client->cmd.forwardmove, v_forward, wishvel);
- if (host_client->edict->v->movetype != MOVETYPE_WALK)
- wishvel[2] += cmd.upmove;
-
- VectorCopy(wishvel, wishdir);
- VectorNormalize(wishdir);
- wishspeed = VectorLength(wishvel);
- if (wishspeed > sv_maxspeed.value)
- wishspeed = sv_maxspeed.value;
-
- if (host_client->edict->v->movetype == MOVETYPE_NOCLIP || host_client->edict->v->movetype == MOVETYPE_FLY)
- {
- VectorScale(wishdir, wishspeed, host_client->edict->v->velocity);
- return;
- }
-
- if ((int)host_client->edict->v->flags & FL_ONGROUND) // walking
- {
- // friction
- f = host_client->edict->v->velocity[0] * host_client->edict->v->velocity[0] + host_client->edict->v->velocity[1] * host_client->edict->v->velocity[1];
- if (f)
- {
- f = sqrt(f);
- VectorCopy(host_client->edict->v->velocity, v);
- v[2] = 0;
-
- // if the leading edge is over a dropoff, increase friction
- limit = 16.0f / f;
- VectorMA(host_client->edict->v->origin, limit, v, v);
- v[2] += host_client->edict->v->mins[2];
-
- VectorCopy(v, start);
- VectorCopy(v, stop);
- stop[2] -= 34;
- trace = SV_Move(start, vec3_origin, vec3_origin, stop, MOVE_NOMONSTERS, host_client->edict);
-
- // apply friction
- if (f < sv_stopspeed.value)
- f = sv_stopspeed.value / f;
- else
- f = 1;
- if (trace.fraction == 1)
- f *= sv_edgefriction.value;
- f = 1 - sv.frametime * f * sv_friction.value;
-
- if (f < 0)
- f = 0;
- VectorScale(host_client->edict->v->velocity, f, host_client->edict->v->velocity);
- }
- }
- else // airborn
- wishspeed = min(wishspeed, 30);
-
- // ground or air acceleration
- f = wishspeed - DotProduct(host_client->edict->v->velocity, wishdir);
- if (f > 0)
- {
- limit = sv_accelerate.value * sv.frametime * wishspeed;
- if (f > limit)
- f = limit;
- VectorMA(host_client->edict->v->velocity, f, wishdir, host_client->edict->v->velocity);
- }
-}
-#endif
-