From c0d06289a8ba710fc0ff927a4c366b8e82fea1e4 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Wed, 6 Aug 2008 10:32:08 +0000 Subject: [PATCH] ensure fpsfric doesn't underflow git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2285 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/physics.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 345e1631..f2781c45 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -263,7 +263,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) const float speed = curtime*pl->maxspeed/(water ? 2000.0f : 1000.0f); const float friction = water ? 20.0f : (pl->onfloor || editfly || specfly ? 6.0f : 30.0f); - const float fpsfric = friction*20.0f/curtime; + const float fpsfric = max(friction*20.0f/curtime, 1.0f); if(pl->onfloor) // apply friction { @@ -298,7 +298,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) const float speed = curtime/(water ? 2000.0f : 1000.0f)*pl->maxspeed*(pl->crouching ? 0.5f : 1.0f); const float friction = water ? 20.0f : (pl->onfloor || editfly || specfly ? 6.0f : (pl->onladder ? 1.5f : 30.0f)); - const float fpsfric = friction/curtime*20.0f; + const float fpsfric = max(friction/curtime*20.0f, 1.0f); d.x = (float)(move*cosf(RAD*(pl->yaw-90))); d.y = (float)(move*sinf(RAD*(pl->yaw-90)));