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

Player driven by a remote machine. More...

#include <netplayer.h>

Inheritance diagram for NetPlayer:
Collaboration diagram for NetPlayer:

Public Member Functions

 NetPlayer (int nId, int nTrack, const HxStr &name, const FreqAppearance *pAppearance)
 Construct a player that a remote machine drives.
virtual ~NetPlayer ()
virtual int GetTrack ()
 Report the track the last selection chose.
virtual int GetPlace ()
 Report the place the last selection chose.
virtual void DispatchPriv (Message *message)
 Receive one message.
Public Member Functions inherited from Player
 Player (int nId, const HxStr &colorName, const FreqAppearance *pAppearance)
 Register the player under its identifier and start its tallies.
virtual ~Player ()
virtual int GetInputSlot () const
 Report the controller slot that drives this player.
virtual int IsNull ()
 Test whether this player is the stand-in for an absent one.
virtual int UnusedQuery ()
 Report zero.
virtual void UnusedHook ()
 Do nothing.
virtual void SetFreestyleSpan (int nStartBar, int nEndBar)
 Give the player a span of bars it plays freely.
virtual int IsFreestyleBar (int nBar)
 Test whether a bar lies in the player's freestyle span.
virtual int IsLooping ()
 Report whether the player is looping.
virtual void AnnounceState ()
 Announce the player's state.
virtual void DeactivatePlacer ()
 Deactivate the powerup placer.
virtual void Print (std::ostream &stream)
 Write a description of this player to stream.
virtual int CountCaughtGem ()
 Count one caught gem.
virtual int CountMissedGem ()
 Count one missed gem.
virtual int GetMultiplier (int nBar)
 Report the score multiplier a capture starting at a bar earns.
virtual int GetBestStreak ()
 Report the best streak of consecutive captures.
virtual float GetCaptureRatio ()
 Report the proportion of captured phrases among those captured and muffed.
virtual int GetGameMode ()
 Report the game mode the player was built in.
virtual int MarkBarScored (int nBar)
 Record that a bar scored, reporting whether it had not scored before.
int GetJuice ()
 Report the juice the player has banked.
int GetScore ()
 Report the player's score.
void SetScore (int nScore, int nMaxScore)
 Set the score and the ceiling it is clamped to.
void SetJuice (int nJuice, int nMaxJuice)
 Set the juice and the ceiling it is clamped to.
void AddJuice (int nAmount, int bNotify)
 Add juice, clamped to 0 through the ceiling, and announce a change.
void AddScore (int nDelta, int bNotify)
 Add to the score, clamped to 0 through the ceiling, and announce a change.
void OnMsg (const PhraseCapturedMsg &msg)
 Add a captured phrase's score and juice, announcing both.
int IsLocal () const
 Report whether the player has an input slot.
HxStr GetColorName ()
 Copy the player's colour name.
HxStr GetUsername ()
 Copy the username of the player's appearance.
int StartMF ()
 Run AnnounceState() and report zero.
int StopMF ()
 Run DeactivatePlacer() and report zero.
Public Member Functions inherited from IDable< Player >
 IDable (int nId)
 Register the object in sObjects under an identifier.
virtual ~IDable ()
 Release the table slot this object occupies.
Public Member Functions inherited from IDableBase
virtual ~IDableBase ()
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.

Additional Inherited Members

Static Public Member Functions inherited from Player
static void Delete (Player *pPlayer)
 Delete a player through its virtual destructor, doing nothing for null.
Public Attributes inherited from Player
int mPlayerId
 Identifier a message addresses this player by.
HxStr mColorName
 The player's colour name, such as green or red.
long long mLastEraseTime
 Scheduler time of this player's last erase press, in nanoseconds.
Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.
Static Public Attributes inherited from IDable< Player >
static std::vector< Player * > sObjects
 Every registered object, indexed by mId.
Protected Attributes inherited from Player
int mMaxJuice
int mMaxScore
Protected Attributes inherited from IDableBase
int mId

Detailed Description

Player driven by a remote machine.

NetPlayer in the RTTI descriptor at 0x008eef18, with Player as its only base. Its three vtables are at 0x007d0ab0, 0x007d0a88, and 0x007d0a60, each walked to its terminator.

The primary table has 21 entries, the same as the base, so this class adds no virtual and only replaces. It replaces exactly two of the base's slots, 4 and 5, where the base returns -1 and 0, and it replaces DispatchPriv in its MsgSink table. It inherits both MsgSource virtuals and every other primary slot, which makes it a thin specialisation rather than a parallel implementation.

Two members are recovered, the track and place slots 4 and 5 return, where the base returns -1 and 0 instead. The bytes from +0x2c to +0x47 are unrecovered. Its destructor restores the base tables and releases the pointer the base declares at +0x28. That work is the inlined base destructor, and the destructor body is empty.

Constructor & Destructor Documentation

◆ NetPlayer()

NetPlayer::NetPlayer ( int nId,
int nTrack,
const HxStr & name,
const FreqAppearance * pAppearance )

Construct a player that a remote machine drives.

Runs Player's constructor with nId, name, and pAppearance, then stores nTrack in mTrack and clears mPlace. GrooveWorld::AddNetPlayer() is the recovered caller, and it passes its own identifier as both nId and nTrack.

Parameters
nIdThe player's identifier.
nTrackThe track GetTrack() reports until a message replaces it.
nameThe player's name.
pAppearanceThe appearance the player is drawn with.
Ghidra address:
NTSC-U/C: 0x00122f10
Ghidra address:
PAL: 0x00123540

◆ ~NetPlayer()

virtual NetPlayer::~NetPlayer ( )
virtual
Ghidra address:
NTSC-U/C: 0x00125a98
Ghidra address:
PAL: 0x00126110

Member Function Documentation

◆ GetTrack()

virtual int NetPlayer::GetTrack ( )
virtual

Report the track the last selection chose.

The base implementation returns -1 instead.

Ghidra address:
NTSC-U/C: 0x00125c48
Ghidra address:
PAL: 0x001262d0

Reimplemented from Player.

◆ GetPlace()

virtual int NetPlayer::GetPlace ( )
virtual

Report the place the last selection chose.

The base implementation returns zero instead.

Ghidra address:
NTSC-U/C: 0x00125c50
Ghidra address:
PAL: 0x001262d8

Reimplemented from Player.

◆ DispatchPriv()

virtual void NetPlayer::DispatchPriv ( Message * message)
virtual

Receive one message.

Dispatches on Message::Type() against two identities, TrackSelectPacket and TrackSelectMsg, so one handler covers track selection arriving locally and over the network. A packet goes to OnTrackSelectPacket(). A TrackSelectMsg whose +0x10 names this player updates the two cached words, and anything else falls through to the base.

Parameters
messageThe message.
Ghidra address:
NTSC-U/C: 0x00125f70
Ghidra address:
PAL: 0x00126608

Reimplemented from Player.


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