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

Method ThrottleAdjust

src/SB/Game/zNPCTypeCommon.cpp:1374–1400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1372}
1373
1374F32 zNPCCommon::ThrottleAdjust(F32 dt, F32 spd_want, F32 accel)
1375{
1376 NPCConfig* cfg = this->cfg_npc;
1377 F32 acc;
1378 S32 speedup = (spd_want > this->spd_throttle);
1379
1380 acc = (accel < 0.0f) ? (dt * cfg->fac_accelMax) : (dt * accel);
1381
1382 if (xeq(spd_want, this->spd_throttle, acc))
1383 {
1384 this->spd_throttle = spd_want;
1385 return this->spd_throttle;
1386 }
1387
1388 if (speedup)
1389 {
1390 this->spd_throttle += acc;
1391 this->spd_throttle = CLAMP(this->spd_throttle, 0.0f, spd_want);
1392 }
1393 else
1394 {
1395 this->spd_throttle -= acc;
1396 this->spd_throttle = MAX(spd_want, this->spd_throttle);
1397 }
1398
1399 return this->spd_throttle;
1400}
1401
1402F32 zNPCCommon::ThrottleAccel(F32 dt, S32 speedup, F32 pct_max)
1403{

Callers 11

ProcessMethod · 0.80
FlankPlayerMethod · 0.80
GetInArenaMethod · 0.80
MoveEvadePosMethod · 0.80
MoveEvadeMethod · 0.80
SonarHomingMethod · 0.80
CirclePlayerMethod · 0.80
MoveCornerMethod · 0.80
ZoomMoveMethod · 0.80
MoveToHomeMethod · 0.80
HoundPlayerMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected