BT410 5.3.34: the weapon ammo readout goes live (0024)

BallisticWeaponCluster's two round counters pointed at UnboundIntegerSource
because ProjectileWeapon::ammoBinLink is protected -- the documented inert
gap in the ctor ledger.  ProjectileWeapon now exposes GetAmmoCount() (the
resolved bin's rounds, -1 with no bin) and the cluster copies it into a live
cell each Execute, the same pattern it already uses for jammed and
reloadSeconds.  The binary pointed its NumericDisplayInteger straight at the
resolved bin's count.

The STREAK 6 panel now reads 0024 against the shipped binary's 0024, in the
same font, stencilled into the fire-ready disc the same way.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-27 12:30:13 -05:00
co-authored by Claude Fable 5
parent 341a503641
commit 30e4b5885d
4 changed files with 62 additions and 2 deletions
+17
View File
@@ -123,6 +123,23 @@ ProjectileWeapon::~ProjectileWeapon()
{
}
//
//#############################################################################
// GetAmmoCount -- the linked bin's rounds (-1 with no bin). The cockpit's
// BallisticWeaponCluster ammo readout reads this each frame; the binary
// pointed its NumericDisplayInteger straight at the resolved bin's count.
//#############################################################################
//
int
ProjectileWeapon::GetAmmoCount()
{
Check(this);
AmmoBin
*bin = (AmmoBin *)ammoBinLink.Resolve();
return (bin != NULL) ? bin->GetAmmoCount() : -1;
}
Logical
ProjectileWeapon::TestClass(Mech &)
{
+8
View File
@@ -98,6 +98,14 @@
);
~ProjectileWeapon();
//
// The linked bin's round count, or -1 when no bin is linked. The
// cockpit's ammo readout needs this from BT_L4 and the link itself
// is protected (the binary read the resolved bin's count direct).
//
int
GetAmmoCount();
protected:
SubsystemConnection ammoBinLink;
int tracerInterval;
+30 -2
View File
@@ -90,6 +90,10 @@
# include <mechweap.hpp>
#endif
#if !defined(PROJWEAP_HPP)
# include <projweap.hpp>
#endif
#include <stdlib.h>
static const Scalar SeekVoltageXScale = 230.0f; // 0x43660000
@@ -2633,6 +2637,25 @@ EnergyWeaponCluster::~EnergyWeaponCluster()
//###########################################################################
//
//
// The linked-bin round count for the ammo readout: ProjectileWeapon
// resolves its own bin (the link is protected), so the cluster asks the
// weapon. -1 (no bin) reads as 0 rounds on the dial.
//
static int
AmmoRoundsOf(Subsystem *subsystem)
{
if (subsystem == NULL
|| !subsystem->IsDerivedFrom(ProjectileWeapon::ClassDerivations))
{
return 0;
}
int
rounds = ((ProjectileWeapon *)subsystem)->GetAmmoCount();
return (rounds > 0) ? rounds : 0;
}
// @004c9558 -- ctor: WeaponCluster base + the ammo panel: two
// NumericDisplayIntegers (ammo counts), jam/fire TwoStates, a
// NumericDisplayScalarTwoState (reload seconds), a destroyed TwoState, plus
@@ -2680,8 +2703,12 @@ BallisticWeaponCluster::BallisticWeaponCluster(
{
int
engPort = renderer_in->FindGraphicsPort(eng_port_name);
//
// LIVE: the linked bin's rounds, refreshed by Execute.
//
ammoRounds = AmmoRoundsOf(subsystem_in);
int
*ammoValue = &UnboundIntegerSource; // INERT (see ledger)
*ammoValue = &ammoRounds;
reloadStartTime = 0; // @0xF4
reloadSeconds = 0.0f; // @0xF8
@@ -2764,7 +2791,8 @@ void
void
BallisticWeaponCluster::Execute()
{
jammed = WeaponJammedOf(subsystem);
jammed = WeaponJammedOf(subsystem);
ammoRounds = AmmoRoundsOf(subsystem);
//
// INERT: reload/feed state (binary bin+0x18c) -- no recon member; the
+7
View File
@@ -533,6 +533,13 @@
void DrawWarningLamp(int on); // @004c9b50 (override: dot + ammo colour swap)
Logical TestInstance() const; // @004c9adc
protected:
//
// The live ammo cell the two round counters point at. The binary
// pointed them at the resolved AmmoBin's count; the link is
// protected, so Execute copies it here each frame -- the same
// pattern this cluster already uses for jammed / reloadSeconds.
//
int ammoRounds;
Logical jammed; // @0xE8 this[0x3A]
Logical firing; // @0xEC this[0x3B]
Logical reloading; // @0xF0 this[0x3C]