r81 - trunk/src

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Feb 2 12:40:44 EST 2005


Author: jonas
Date: 2005-02-02 12:40:44 -0500 (Wed, 02 Feb 2005)
New Revision: 81

Modified:
   trunk/src/characters_common.h
Log:
reduce speed when changing the maximal speed

Modified: trunk/src/characters_common.h
===================================================================
--- trunk/src/characters_common.h	2005-02-01 18:55:46 UTC (rev 80)
+++ trunk/src/characters_common.h	2005-02-02 17:40:44 UTC (rev 81)
@@ -62,10 +62,16 @@
         //@}
         //@{
         Uint16 addMaxSpeed(Sint16 dmax) {
-            return maxspeedx=max(0,maxspeedx+dmax);
+            maxspeedx=max(0,maxspeedx+dmax);
+            if (hspeed>maxspeedx) hspeed=maxspeedx;
+            if (hspeed<-maxspeedx) hspeed=-maxspeedx;
+            return maxspeedx;
         }
         Uint16 setMaxSpeed(Uint16 maxs) {
-            return maxspeedx=maxs;
+            maxspeedx=maxs;
+            if (hspeed>maxspeedx) hspeed=maxspeedx;
+            if (hspeed<-maxspeedx) hspeed=-maxspeedx;
+            return maxspeedx;
         }
         //@}
         //@{




More information about the lostpenguins-commits mailing list