summary |
shortlog |
changelog |
graph |
tags |
bookmarks |
branches |
files |
changeset |
raw |
help

author | unc0rr |

Thu, 26 Mar 2009 14:03:46 +0000 | |

changeset 1919 | 390d3f685a80 |

parent 1918 | 975d5061712f |

child 1920 | 302835d554d8 |

Optimize water bouncing a bit

--- a/hedgewars/GSHandlers.inc Thu Mar 26 13:59:27 2009 +0000 +++ b/hedgewars/GSHandlers.inc Thu Mar 26 14:03:46 2009 +0000 @@ -28,12 +28,12 @@ skipSpeed:= _0_25; // was 0.36 - couldn't manage baseball bat. Tiy's build is 0.36... skipAngle:= _1 + _0_9; // these should perhaps also be constants, once work out what proper values are skipDecay:= _0_87; // this could perhaps be a tiny bit higher. - if ((Gear^.dX*Gear^.dX+Gear^.dY*Gear^.dY) > skipSpeed) and - (hwAbs(Gear^.dX/Gear^.dY) > skipAngle) then + if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > skipSpeed) and + (hwAbs(Gear^.dX) > skipAngle * hwAbs(Gear^.dY) then begin Gear^.dY.isNegative:= true; - Gear^.dY:=Gear^.dY*skipDecay; - Gear^.dX:=Gear^.dX*skipDecay; + Gear^.dY:= Gear^.dY * skipDecay; + Gear^.dX:= Gear^.dX * skipDecay; CheckGearDrowning:= false end else