resonance 1.0.1
Loading...
Searching...
No Matches
TrackSelector Class Reference

Grid of which players occupy which track channel. More...

#include <trackselector.h>

Inheritance diagram for TrackSelector:
Collaboration diagram for TrackSelector:

Public Member Functions

 TrackSelector (const std::vector< Player * > &players)
 Build the grid over a roster of players.
virtual ~TrackSelector ()
virtual void DispatchPriv (Message *pMsg)
 Act on a message.
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the tagged heap under the tag "MsgSink".
void operator delete (void *pBlock)
 Release a sink to the tagged heap.
virtual ~MsgSink ()
virtual void Dispatch (Message *pMsg)
 Accept a message.
Public Member Functions inherited from MsgSource
virtual ~MsgSource ()
virtual void AddSink (MsgSink *pSink)
 Register a sink, ignoring a sink that is already registered.
virtual void RemoveSink (MsgSink *pSink)
 Unregister the first occurrence of a sink.
void Send (Message *pMsg) const
 Deliver a message to every registered sink, in registration order.
void ClearSinks ()
 Unregister every sink.

Static Public Member Functions

static int SelfTest ()
 Exercise the grid against four stand-in players.
static int RunSelfTest ()
 Run SelfTest() in the shape TestRegistry::TestFunc requires.

Additional Inherited Members

Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.

Detailed Description

Grid of which players occupy which track channel.

Its RTTI descriptor is at 0x008ef688. It is built over MsgSink at offset 0 and MsgSource at offset 4. Two tables belong to it, the primary at 0x007d37d8 with four entries and the MsgSource subobject table at 0x007d37b0 with four and a -4 adjustment on every entry. Both run to the same length as their bases, so the class introduces no virtual of its own and overrides only the destructor and DispatchPriv().

The grid is kTrackSelectorChannelCount columns of kTrackSelectorSlotCount player pointers at +0x20, which makes the object 0xa0 bytes. An unoccupied slot stores the address of the file-scope NullPlayer at 0x0066f930 rather than a null pointer, which is why every comparison here is against that object rather than against zero. The Player translation unit's static initialiser at 0x00132618 builds it, alongside the IDable<Player> table at 0x0066f920.

A player's channel comes from Player::GetTrack(), primary table slot 4, and the constructor skips a player whose answer is -1. Player::GetInputSlot() reports the payload word the message paths check before acting, and Player::GetPlace() drives the walk RebuildChannelGrid() performs.

The accessor at 0x0013f0f0 guards on the descriptor at 0x008ef688, and the descriptor settles the class name.

RemoveLightFromColumn(), InsertLightForDrawable(), and RebuildChannelGrid() each build a message field by field on the stack and send it, so the message classes carry public fields rather than a constructor.

The unit registers SelfTest() with TestRegistry under the name TrackSelector.

Every data member is private. The five message paths and the three rebinding helpers are the only code in the image that reads one, and each is a member of this class.

Constructor & Destructor Documentation

◆ TrackSelector()

TrackSelector::TrackSelector ( const std::vector< Player * > & players)

Build the grid over a roster of players.

Every slot of every column starts as the NullPlayer, and each player whose Player::GetTrack() reports a channel other than -1 is then inserted into that channel with a zero payload.

Parameters
playersThe roster. Only its size and its elements are read.
Ghidra address:
NTSC-U/C: 0x0013b250
Ghidra address:
PAL: 0x0013bb98

◆ ~TrackSelector()

virtual TrackSelector::~TrackSelector ( )
virtual
Ghidra address:
NTSC-U/C: 0x0013f020
Ghidra address:
PAL: 0x0013f9d8

Member Function Documentation

◆ DispatchPriv()

virtual void TrackSelector::DispatchPriv ( Message * pMsg)
virtual

Act on a message.

Slot 3 of the MsgSink table. A RotLeftMsg rotates the addressed player one channel down and a RotRightMsg one channel up, both only when Player::GetInputSlot() reports a value other than -1. A BumpPacket rebuilds a column, a RemoteTrackSelectMsg rebinds one channel, and a PhraseMuffedMsg is forwarded to the sink the addressed player provides. Every other message is discarded.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x0013b868
Ghidra address:
PAL: 0x0013c1b0

Implements MsgSink.

◆ SelfTest()

int TrackSelector::SelfTest ( )
static

Exercise the grid against four stand-in players.

The routine builds four LocalPlayer objects with the colour name null, constructs a grid over them, registers the selector with each, and then runs a fixed sequence of rebinds and channel queries whose results it discards. It destroys the grid and the roster vector but not the players. Nothing in the shipped game calls it apart from the test registry.

Returns
Always 1.
Ghidra address:
NTSC-U/C: 0x0013ba08
Ghidra address:
PAL: 0x0013c350

◆ RunSelfTest()

int TrackSelector::RunSelfTest ( )
static

Run SelfTest() in the shape TestRegistry::TestFunc requires.

The unit's static initialiser registers it. The integer result reaches the hx.test command through the return register, which decides its ok report.

Ghidra address:
NTSC-U/C: 0x0013f8e8
Ghidra address:
PAL: 0x001402b0

The documentation for this class was generated from the following file: