MCPcopy Index your code
hub / github.com/assaultcube/AC / loopi

Function loopi

source/src/physics.cpp:365–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

moveplayerFunction · 0.70
entinmapFunction · 0.70

Calls 2

collideFunction · 0.85
isspectatingMethod · 0.80

Tested by

no test coverage detected