Diag: BT_AF_PERIOD=<sec> autofire cadence throttle + afc_dump.py (raw RES verify)

Closes the coolant/jam investigation. BT_AF_PERIOD pulses the trigger every <sec>s so
a slower-than-max fire rate can be tested; afc_dump.py reads the AFC100 record raw from
BTL4.RES. Both confirm the QA report is FAITHFULLY reproduced (see KB).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-14 07:26:12 -05:00
co-authored by Claude Fable 5
parent 4e72f0c4f4
commit fcaea1862a
2 changed files with 49 additions and 1 deletions
+12 -1
View File
@@ -3825,7 +3825,18 @@ void
static int s_prevBtn[4] = {0, 0, 0, 0};
static int s_afPhase = 0;
s_afPhase ^= 1;
const int autofire = (gBTDrive.fireForced && targetInArc) ? s_afPhase : 0;
// DIAG (BT_AF_PERIOD=<sec>): throttle autofire cadence -- pulse the trigger
// only briefly every <sec> seconds, to test a slower-than-max fire rate (the
// coolant/jam mechanic is fire-rate dependent: at max spam the weapon overheats
// regardless; at a realistic cadence coolant priority decides the jam).
static float s_afClock = 0.0f;
s_afClock += dt;
static const float s_afPeriod =
getenv("BT_AF_PERIOD") ? (float)atof(getenv("BT_AF_PERIOD")) : 0.0f;
int afGate = 1;
if (s_afPeriod > 0.0f)
afGate = (fmodf(s_afClock, s_afPeriod) < 0.6f) ? 1 : 0;
const int autofire = (gBTDrive.fireForced && targetInArc && afGate) ? s_afPhase : 0;
const int buttons[4] = {
LBE4ControlsManager::ButtonJoystickTrigger, // 0x40
LBE4ControlsManager::ButtonJoystickPinky, // 0x45