| 363 | float h = pl->eyeheightvel * speed / moveres; |
| 364 | |
| 365 | loopi(moveres) |
| 366 | { |
| 367 | pl->eyeheight += h; |
| 368 | pl->o.z += h; |
| 369 | if(collide(pl) && !(pl != player1 && player1->isspectating() && player1->spectatemode < SM_FLY)) |
| 370 | { |
| 371 | pl->eyeheight -= h; // collided, revert mini-step |
| 372 | pl->o.z -= h; |
| 373 | break; |
| 374 | } |
| 375 | if(pl->eyeheight<min) // clamp to min |
| 376 | { |
| 377 | pl->o.z += min - pl->eyeheight; |
| 378 | pl->eyeheight = min; |
| 379 | pl->eyeheightvel = 0.0f; |
| 380 | break; |
| 381 | } |
| 382 | if(pl->eyeheight>max) |
| 383 | { |
| 384 | pl->o.z -= pl->eyeheight - max; |
| 385 | pl->eyeheight = max; |
| 386 | pl->eyeheightvel = 0.0f; |
| 387 | break; |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | // main physics routine, moves a player/monster for a curtime step |
no test coverage detected