MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / DampenControls

Function DampenControls

src/SB/Game/zEntPlayer.cpp:394–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392 globals.player.VictoryTimer = time;
393}
394static void DampenControls(F32* angle, F32* mag, F32 x, F32 y)
395{
396 *angle = xatan2(x, y);
397
398 if (x > -globals.player.g.AnalogMin && x < globals.player.g.AnalogMin)
399 {
400 x = 0.0f;
401 }
402
403 if (y > -globals.player.g.AnalogMin && y < globals.player.g.AnalogMin)
404 {
405 y = 0.0f;
406 }
407
408 if (!x && !y)
409 {
410 *angle = 0.0f;
411 *mag = 0.0f;
412 return;
413 }
414
415 if (xabs(x) > xabs(y))
416 {
417 *mag = xabs(x);
418 }
419 else
420 {
421 *mag = xabs(y);
422 }
423 *mag = (*mag - globals.player.g.AnalogMin) /
424 (globals.player.g.AnalogMax - globals.player.g.AnalogMin);
425
426 if (*mag < 0.0f)
427 {
428 *mag = 0.0f;
429 *angle = 0.0f;
430 }
431 else if (*mag > 1.0f)
432 {
433 *mag = 1.0f;
434 }
435}
436
437static void CalcAnimSpeed(xEnt* ent, float f, float* pf)
438{

Callers 1

PlayerAbsControlFunction · 0.85

Calls 1

xatan2Function · 0.85

Tested by

no test coverage detected