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

One participant's view of a session, driven by messages. More...

#include <gamer.h>

Inheritance diagram for Gamer:
Collaboration diagram for Gamer:

Public Member Functions

 Gamer (int nTrackCount, int nEndBar, GameStats *pStats)
 Build the participant's view for a level.
virtual ~Gamer ()
 Withdraw the queued command and delete both enable policies.
void Withdraw ()
 Withdraw every command queued under mCommand from the song clock.
virtual void DispatchPriv (Message *pMsg)
 Receive one message.
void CreateEnableMgr (std::vector< ScoreTrackGraph * > *pGraphs)
 Record the track graphs and build the enable policy for the session mode.
void SetBarOwner (int nTrack, int nBar, Player *pPlayer)
 Record a player against one bar of one track.
int QueryBar (int nTrack, int nBar)
 Ask whether one bar of one track may be caught.
bool IsFreestyleTrack (int nTrack) const
 Report whether one track is outside catch mode.
PhraseDatabase * GetPhraseDatabase (int nTrack)
 Report the phrase database of one track's graph.
TrackData * GetTrack (int nTrack) const
 Report one track of the level.
void OnBar (int nBar)
 Run the update of one bar and schedule the next.
void Start ()
 Schedule the first bar's update.
void SetBackGraphs (std::vector< BGTrackGraph * > *pGraphs)
 Record the background tracks and build the enable policy for them.
void EnablePlayerFreestyle (int nStartBar, int nEndBar)
 Give the first player a freestyle span.
void AddJuice (int nAmount)
 Add juice to the first player and announce it.
void EndWithScore (int nScore)
 End the game at the next bar, optionally with a score for the first player.
void AdvanceAt (Sch::Tick position)
 Advance to the bar of a position, with PlayMap::ToggleLoop() of that bar as the advance.
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.

Public Attributes

int mJuiceFrozen
 Non-zero while the per-bar juice charge is suspended.
std::vector< MsgSource > mTrackSources
 One message source per track.
EnableMgr * mEnableMgr
 Per-track enable policy.
int mCheated
 Non-zero once a cheat ran during the game.
Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.

Detailed Description

One participant's view of a session, driven by messages.

Gamer in the RTTI descriptor at 0x00901cb0, over MsgSink and MsgSource. Two vtables belong to it, one per base, both walked to their terminator: the primary at 0x007ce820 with delta 0, which is the MsgSink table because MsgSink is the first base, and the MsgSource table at 0x007ce7f8 with delta -4.

Both are four entries, so the class adds no virtual of its own. It overrides only DispatchPriv, inheriting MsgSink::Dispatch and both MsgSource virtuals unchanged.

The base subobjects account for +0x00 through +0x17. The destructor at 0x00110930 restores the primary table at +0x00 and the MsgSource one at +0x14, which is where MsgSource places its own vptr over its mSinks vector, so its subobject sits at +0x04 exactly as the -4 delta states. This class's own members start at +0x18.

The object is 0x9c bytes, which GrooveWorld allocates at 0x0018cfc0. The RTTI name of the unit's file-local command embeds the constructor's mangled name, which fixes its three parameter types as two integers and a GameStats pointer. The members are declared in recovered offset order.

Constructor & Destructor Documentation

◆ Gamer()

Gamer::Gamer ( int nTrackCount,
int nEndBar,
GameStats * pStats )

Build the participant's view for a level.

Copies the world's players, gives every player a score of 0 with a ceiling of 100000 and, in kGameModeSolo, the configured juice and juice ceiling. A jukebox session starts in playback with every input binding off except the first slot's two rotations.

Parameters
nTrackCountThe level's track count.
nEndBarThe level's last bar, from LevelData::GetEndBar().
pStatsThe session statistics.
Ghidra address:
NTSC-U/C: 0x00110138
Ghidra address:
PAL: 0x00110598

◆ ~Gamer()

virtual Gamer::~Gamer ( )
virtual

Withdraw the queued command and delete both enable policies.

Ghidra address:
NTSC-U/C: 0x00110930
Ghidra address:
PAL: 0x00110d90

Member Function Documentation

◆ Withdraw()

void Gamer::Withdraw ( )

Withdraw every command queued under mCommand from the song clock.

GrooveWorld calls it at 0x0018e6f0. The title is inferred.

Ghidra address:
NTSC-U/C: 0x00116c40
Ghidra address:
PAL: 0x001170f8

◆ DispatchPriv()

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

Receive one message.

Dispatches AdvanceSectionMsg, PhraseCapturedMsg, EnableFreestyleMsg, PlaybackModeMsg, and CrippleMsg to their handlers, in that order of test, and ignores every other message. The first two handlers are expanded inline here.

Parameters
pMsgThe message.
Ghidra address:
NTSC-U/C: 0x00112978
Ghidra address:
PAL: 0x00112dd8

Implements MsgSink.

◆ CreateEnableMgr()

void Gamer::CreateEnableMgr ( std::vector< ScoreTrackGraph * > * pGraphs)

Record the track graphs and build the enable policy for the session mode.

In kPlayModeGame, kGameModeSolo builds GameEnableMgr::CreateReleasing() from configuration code 0x387 and the other modes GameEnableMgr::CreateUnrestricted(), and every track outside catch mode is then disabled. Outside kPlayModeGame, the solo and local modes build a LocalJamEnableMgr and the network mode a NetJamEnableMgr over eight owner buckets. The title is inferred.

Parameters
pGraphsThe track graphs, one per track.
Ghidra address:
NTSC-U/C: 0x00110ba0
Ghidra address:
PAL: 0x00111000

◆ SetBarOwner()

void Gamer::SetBarOwner ( int nTrack,
int nBar,
Player * pPlayer )

Record a player against one bar of one track.

Forwards to EnableMgr::SetBarOwner() on mEnableMgr. TrackData::SetOwner() is the recovered caller.

Parameters
nTrackThe track's index.
nBarThe bar.
pPlayerThe player.
Ghidra address:
NTSC-U/C: 0x00116828
Ghidra address:
PAL: 0x00116ce0

◆ QueryBar()

int Gamer::QueryBar ( int nTrack,
int nBar )

Ask whether one bar of one track may be caught.

Forwards to EnableMgr::QueryBar() on mEnableMgr. TrackData::QueryBar() is the recovered caller, and Catcher treats a zero answer as a bar that cannot be caught.

Parameters
nTrackThe track's index.
nBarThe bar.
Returns
The answer of mEnableMgr.
Ghidra address:
NTSC-U/C: 0x00116858
Ghidra address:
PAL: 0x00116d10

◆ IsFreestyleTrack()

bool Gamer::IsFreestyleTrack ( int nTrack) const

Report whether one track is outside catch mode.

Parameters
nTrackThe track's index.
Returns
Non-zero unless the track's mKind is kTrackModeCatch.
Ghidra address:
NTSC-U/C: 0x00116888
Ghidra address:
PAL: 0x00116d40

◆ GetPhraseDatabase()

PhraseDatabase * Gamer::GetPhraseDatabase ( int nTrack)

Report the phrase database of one track's graph.

Parameters
nTrackThe track's index into mGraphs.
Returns
The graph's phrase database.
Ghidra address:
NTSC-U/C: 0x001168b0
Ghidra address:
PAL: 0x00116d68

◆ GetTrack()

TrackData * Gamer::GetTrack ( int nTrack) const

Report one track of the level.

Parameters
nTrackThe track's index.
Returns
LevelData::TrackAt() of Globals::GetLevel().
Ghidra address:
NTSC-U/C: 0x001168e0
Ghidra address:
PAL: 0x00116d98

◆ OnBar()

void Gamer::OnBar ( int nBar)

Run the update of one bar and schedule the next.

Switches each background track's MIDI by mBackEnableMgr, ends a solo or multiplayer game when its conditions are met, steps jam playback, ends a jukebox song at mEndBar, moves the streamed audio, and finally schedules bar nBar + 1. GamerCmd::Execute() is the caller. The title is inferred.

Parameters
nBarThe bar.
Ghidra address:
NTSC-U/C: 0x00111fa8
Ghidra address:
PAL: 0x00112408

◆ Start()

void Gamer::Start ( )

Schedule the first bar's update.

The title is inferred.

Ghidra address:
NTSC-U/C: 0x00116c20
Ghidra address:
PAL: 0x001170d8

◆ SetBackGraphs()

void Gamer::SetBackGraphs ( std::vector< BGTrackGraph * > * pGraphs)

Record the background tracks and build the enable policy for them.

The policy is GameEnableMgr::CreateReleasing() over configuration code 0x386, one track per graph. RndWorld's draw pass is the caller. The title is inferred.

Parameters
pGraphsThe background tracks' graphs.
Ghidra address:
NTSC-U/C: 0x001167e0
Ghidra address:
PAL: 0x00116c98

◆ EnablePlayerFreestyle()

void Gamer::EnablePlayerFreestyle ( int nStartBar,
int nEndBar )

Give the first player a freestyle span.

Calls Fatal() with Only call Gamer::EnablePlayerFreestyle() from tutorial. outside the tutorial, which is what attests the title.

Parameters
nStartBarThe first bar, passed to Player::SetFreestyleSpan().
nEndBarThe end bar, passed to Player::SetFreestyleSpan().
Ghidra address:
NTSC-U/C: 0x00116a98
Ghidra address:
PAL: 0x00116f50

◆ AddJuice()

void Gamer::AddJuice ( int nAmount)

Add juice to the first player and announce it.

The add_juice script command is the caller. The title is inferred.

Parameters
nAmountThe juice to add.
Ghidra address:
NTSC-U/C: 0x00116ae8
Ghidra address:
PAL: 0x00116fa0

◆ EndWithScore()

void Gamer::EndWithScore ( int nScore)

End the game at the next bar, optionally with a score for the first player.

Sets mEndBar to 0. A non-zero score becomes the first player's score with a ceiling of

  1. The listen-mode script command and the win-with-points cheat are the callers. The title is inferred.
Parameters
nScoreThe score, or 0 to leave the score unchanged.
Ghidra address:
NTSC-U/C: 0x00116b18
Ghidra address:
PAL: 0x00116fd0

◆ AdvanceAt()

void Gamer::AdvanceAt ( Sch::Tick position)

Advance to the bar of a position, with PlayMap::ToggleLoop() of that bar as the advance.

Public because the advance-section script command calls it with no accessor in the image. The title is inferred.

Parameters
positionThe position to advance to.
Ghidra address:
NTSC-U/C: 0x00116a30
Ghidra address:
PAL: 0x00116ee8

Member Data Documentation

◆ mJuiceFrozen

int Gamer::mJuiceFrozen

Non-zero while the per-bar juice charge is suspended.

+0x1c

OnBar() charges juice only while it is zero. Public because the practice cheat and the freeze-juice script command write it through GrooveWorld::mGamer with no accessor in the image.

◆ mTrackSources

std::vector<MsgSource> Gamer::mTrackSources

One message source per track.

Public because GameEnableMgr sends InvalidateTrackMsg through an element directly at 0x00101ea0, and the image has no accessor. +0x78

◆ mEnableMgr

EnableMgr* Gamer::mEnableMgr

Per-track enable policy.

+0x90

Public because the enable-all-tracks cheat drives it through GrooveWorld::mGamer with no accessor in the image.

◆ mCheated

int Gamer::mCheated

Non-zero once a cheat ran during the game.

+0x98

RecordSoloStats() copies it into GameStats::mCheated. Public because the practice, listen-mode, and enable-all-tracks cheats write it through GrooveWorld::mGamer with no accessor in the image.


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