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

Catcher that scores one bar at a time. More...

#include <singlecatcher.h>

Inheritance diagram for SingleCatcher:
Collaboration diagram for SingleCatcher:

Public Member Functions

 SingleCatcher (PhraseMgr *pPhraseMgr, Quantizer *pQuantizer, const TrackData *pTrackData, Sch::TickClock *pClock, Sch::Tick tick)
 Construct the base with two-bar seeker ranges and record the last step of the play map.
virtual ~SingleCatcher ()
virtual void CapturePhrase (int nBar, int nRun, int nAutoCatch)
 Capture the phrase a caught run of bars completes.
virtual void ReportCaughtPowerbar (int nBar)
 Report the caught power bar to this catcher's player.
void ResetOwners (int nTick, Player *pPlayer)
 Give every phrase of the track to one player.
Public Member Functions inherited from Catcher
 Catcher (PhraseMgr *pPhraseMgr, Quantizer *pQuantizer, const TrackData *pTrackData, Sch::TickClock *pClock, int nSeekerBarCount, Sch::Tick catchWindow)
virtual ~Catcher ()
 Withdraw both commands through Stop().
virtual void DispatchPriv (Message *pMsg)
 Act on a message.
virtual void Start ()
 Schedule the catcher's two commands on the clock.
virtual void Stop ()
 Withdraw the catcher's two commands from the clock.
virtual int IsPhraseRunEmpty ()
 Report whether the catcher has nothing outstanding.
virtual void MissGem (int nTick, int nGem)
 Record a missed gem.
virtual void CatchGem (int nTick, int nGem)
 Record a caught gem.
void ProcessGemCommand (int nTick)
 Run the post-gem command at a song position.
void SimulateRemoteGem (int nTick)
 Play the remote player's gem at a song position, then schedule the next gem command.
Public Member Functions inherited from GenericCatcher
 GenericCatcher ()
virtual ~GenericCatcher ()
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

Public Attributes inherited from MsgSource
int mGraphBuilt
 A word no member of this class reads.
Protected Member Functions inherited from Catcher
void PostPhraseMuffedMsg (int nBar, Sch::Tick position)
 Sends a PhraseMuffedMsg for a bar once, recording the bar in mLastMuffedBar.
void PostCatchMsg (PitchRiffMsg *pMsg)
 Scores a PitchRiffMsg for this track.
void PostCaughtBarMsg (int nBar, int nNextBar)
 Does nothing once a gem of the phrase was missed or muffed.
int SnapToNearestGem (int nTick)
 Returns the gem on either side of nTick nearer to it when that gem lies within mCatchWindow, and nTick otherwise.
void OnTrackSelect (TrackSelectMsg *pMsg)
 Takes the track for the player a TrackSelectMsg names.
void OnAutoCatch (AutoCatchMsg *pMsg)
 Plays a free bar for the player an AutoCatchMsg identifies through CapturePhrase(), marks the message handled through CmdMsg::mResult, and replays the bar from the current offset through PhraseMgr::ReplayBar() when the song is inside it.
void EndBar (int nBar)
 Closes the counts for a bar.
int FindNextGemTick (int nTick)
 Returns the first gem position after nTick.
void SchedulePostGemCommand (int nTick)
 Build a PostGemCmd for the gem after nTick and queue it one tick after PostGemDelay() under the handle mPostGemCommand.
void ScheduleGemCommand (int nTick)
 Build a GemCmd for the gem after nTick and queue it at that gem under the handle mGemCommand.
int PostGemDelay (int nTick)
 Returns the earlier of the midpoint between nTick and the next gem, and nTick plus mCatchWindow.
void UpdateSeeker (int nBar)
 Finds the next free bar within 32 bars of nBar (or of the bar after mLastMuffedBar) and points the seeker at the phrase starting there, or turns the seeker off.
void PostSeekerMsg ()
 Sends a SeekerMsg that turns the seeker off and clears mSeekerEnabled.
void PostSeekerRangeMsg (int nFirstBar, int nBarCount)
 Sends a SeekerMsg for nBarCount bars from nFirstBar at position 0, and records the range in mSeekerFirstBar, mSeekerEndBar, and mSeekerEnabled.
int IsBarFree (int nBar)
 Returns whether a bar is non-negative, playable according to TrackData::QueryBar(), and owned by no player.
void OnInvalidateSeeker (InvalidateSeekerMsg *pMsg)
 The out-of-line copy of the InvalidateSeekerMsg branch DispatchPriv() expands inline.
void SetPhraseOwners (int nFirstBar, int nEndBar, Player *pPlayer)
 Gives every bar from nFirstBar up to nEndBar to one player.
Protected Attributes inherited from Catcher
Quantizer * mQuantizer
PhraseMgr * mPhraseMgr
const TrackData * mTrackData
Player * mPlayer
Sch::TickClock * mClock
Sch::CmdID mPostGemCommand
Sch::CmdID mGemCommand
Sch::Tick mTicksPerBar
int mSeekerBarCount
int mCatchWindow
int mEnabled
Sch::Tick mLastCaughtPosition
Sch::Tick mLastMissedPosition
int mTrack
int mCaughtGems
int mMissedGems
int mMuffedGems
int mLastEndedBar
int mPhraseRunBars
int mLastMuffedBar
int mSeekerFirstBar
int mSeekerEndBar
int mSeekerEnabled
Player * mRemotePlayer
float mRemoteSuccess
Sch::Tick mRemotePosition

Detailed Description

Catcher that scores one bar at a time.

Its RTTI descriptor is at 0x008f0be0. It has Catcher as its only base at offset 0. Its primary table is at 0x007e0bb0 with eleven entries and its MsgSource subobject table at 0x007e0b88 with four. The table is the same length as the base's. The class introduces no virtual and overrides only the destructor and the base's two pure slots. The object is 0x84 bytes against the base's 0x80. It adds one word, mLastStep.

Constructor & Destructor Documentation

◆ SingleCatcher()

SingleCatcher::SingleCatcher ( PhraseMgr * pPhraseMgr,
Quantizer * pQuantizer,
const TrackData * pTrackData,
Sch::TickClock * pClock,
Sch::Tick tick )

Construct the base with two-bar seeker ranges and record the last step of the play map.

Parameters
pPhraseMgrThe phrase manager for the track.
pQuantizerThe quantiser for the track.
pTrackDataThe track description.
pClockThe clock the scheduled commands run on.
tickThe catch window, in MIDI ticks.
Ghidra address:
NTSC-U/C: 0x001b19b0
Ghidra address:
PAL: 0x001b7770

◆ ~SingleCatcher()

virtual SingleCatcher::~SingleCatcher ( )
virtual
Ghidra address:
NTSC-U/C: 0x001b0d30
Ghidra address:
PAL: 0x001b6ae0

Member Function Documentation

◆ CapturePhrase()

virtual void SingleCatcher::CapturePhrase ( int nBar,
int nRun,
int nAutoCatch )
virtual

Capture the phrase a caught run of bars completes.

Slot 9. The routine gives every bar of the step around nBar to mPlayer, totals the points of the nRun bars ending at nBar, and sends a PhraseCapturedMsg (score, the multiplier Player::GetMultiplier() reports for the first bar of the run, and the flag inverted) and a SectionCapturedMsg for the step.

Parameters
nBarThe last bar of the run.
nRunThe bars the run spans.
nAutoCatchNon-zero for an automatic catch. The PhraseCapturedMsg receives it inverted and the SectionCapturedMsg unchanged.
Ghidra address:
NTSC-U/C: 0x001ad630
Ghidra address:
PAL: 0x001b3398

Implements Catcher.

◆ ReportCaughtPowerbar()

virtual void SingleCatcher::ReportCaughtPowerbar ( int nBar)
virtual

Report the caught power bar to this catcher's player.

Slot 10. The routine queries PhraseMgr::GetPowerbar() for the bar and, for an answer other than -1, sends a CaughtPowerbarMsg carrying that answer and the player, then delivers the same message to the player directly through MsgSink::Dispatch().

Parameters
nBarThe caught bar.
Ghidra address:
NTSC-U/C: 0x001ad840
Ghidra address:
PAL: 0x001b35a8

Implements Catcher.

◆ ResetOwners()

void SingleCatcher::ResetOwners ( int nTick,
Player * pPlayer )

Give every phrase of the track to one player.

CatchingSTG::GivePhrases() reaches it by casting its catcher to this class with dynamic_cast. The routine forwards the player to PhraseMgr::ResetOwners() and returns nothing. The title follows that callee and is inferred.

Parameters
nTickThe song position the caller received, unread.
pPlayerThe player the phrases go to.
Ghidra address:
NTSC-U/C: 0x001b1a40
Ghidra address:
PAL: 0x001b7800

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