diff --git a/game/reconstructed/mech4.cpp b/game/reconstructed/mech4.cpp index 43e2364..5f84b27 100644 --- a/game/reconstructed/mech4.cpp +++ b/game/reconstructed/mech4.cpp @@ -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=): throttle autofire cadence -- pulse the trigger + // only briefly every 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 diff --git a/scratchpad/afc_dump.py b/scratchpad/afc_dump.py new file mode 100644 index 0000000..f885be1 --- /dev/null +++ b/scratchpad/afc_dump.py @@ -0,0 +1,37 @@ +import struct +data = open(r'C:/git/bt411/content/BTL4.RES','rb').read() +n = len(data) +def f32(o): return struct.unpack_from('6} {name:20} f32={f32(p+off):<16g} i32={i32(p+off)}") + print("\n --- full float scan (offset: value) for plausible fields 0xE0..0x1E0 ---") + for off in range(0xE0, 0x1E0, 4): + v=f32(p+off) + if abs(v)>1e-3 and abs(v)<1e12: + print(f" +{hex(off):>6}: {v:g}")