| 276 | } |
| 277 | |
| 278 | private static void ClampPitch() { |
| 279 | |
| 280 | float pitch; |
| 281 | |
| 282 | pitch = Math3D.SHORT2ANGLE(ClientGlobals.cl.frame.playerstate.pmove.delta_angles[Defines.PITCH]); |
| 283 | if (pitch > 180) |
| 284 | pitch -= 360; |
| 285 | |
| 286 | if (ClientGlobals.cl.viewangles[Defines.PITCH] + pitch < -360) |
| 287 | ClientGlobals.cl.viewangles[Defines.PITCH] += 360; // wrapped |
| 288 | if (ClientGlobals.cl.viewangles[Defines.PITCH] + pitch > 360) |
| 289 | ClientGlobals.cl.viewangles[Defines.PITCH] -= 360; // wrapped |
| 290 | |
| 291 | if (ClientGlobals.cl.viewangles[Defines.PITCH] + pitch > 89) |
| 292 | ClientGlobals.cl.viewangles[Defines.PITCH] = 89 - pitch; |
| 293 | if (ClientGlobals.cl.viewangles[Defines.PITCH] + pitch < -89) |
| 294 | ClientGlobals.cl.viewangles[Defines.PITCH] = -89 - pitch; |
| 295 | } |
| 296 | |
| 297 | /* |
| 298 | * ============== CL_FinishMove ============== |