|
resonance 1.0.1
|
Owner of the gem phrases on one track, and the seam between the network and the gems. More...
#include <phrasemgr.h>


Public Member Functions | |
| PhraseMgr (Sch::TickClock *pClock, int nBarTicks, PlayMap *pMap, int nConfig, const TrackData *pTrackData) | |
| Construct the manager of one track and its phrase database. | |
| virtual | ~PhraseMgr () |
| Withdraw both commands through WithdrawCommands(), then delete both owned objects. | |
| void | CreatePowerbarMgr () |
| Replace the powerbar source with the one the play mode and the track kind call for. | |
| int | GetPowerbar (int nBar) |
| void | PostPhraseMsg (int nPhrase) |
| Post a PhraseMsg for one phrase. | |
| void | PostGemMsg (Message *pMsg) |
| Add the gem a GemPacket for this track carries to the phrase at its step and every step chained to it, and post the gem for the first window bar mapped to each step. | |
| void | PostGemMsgSecond (int nBar) |
| Post each gem of the phrase at a bar as a GemMsg, in the phrase owner's name. | |
| void | PostGemMsgThird (int nBar, int bGhost) |
| Post each gem the track description lists for a bar as a GemMsg, when the bar is enabled. | |
| void | PostDurGemMsg (int nBar) |
| Post the gems of the phrase at a bar as DurGemMsg objects, with a GemMsg at the head of each run. | |
| void | RefreshBar (int nBar, int bClear) |
| Post one bar again when it lies in the window from mWindowStart up to mWindowEnd. | |
| void | PostBarStatusMsg (int nBar) |
| Post a BarStatusMsg for one bar with every field set. | |
| void | OnCommand (int nBar) |
| Play one bar through mPhrasePlayer and schedule the file-local Cmd for the next bar. | |
| void | OnExportCommand (int nBar) |
| Move the window to start before a bar, post the bar entering it, and schedule the file-local ExportCmd for the next bar, mExportLead ticks after that bar starts. | |
| Phrase * | GetPhraseAt (int nBar) |
| long long * | GetStepValue (int nBar) |
| unsigned char | GetPhraseByte (int nBar) |
| void | SetPhraseByte (int nBar, char cValue) |
| Set the byte at +0x28 of the phrase at a bar and at every bar slot 7 of mMap chains it to for this track. | |
| void | ResetOwners (Player *pPlayer) |
| Return every phrase to one owner and clear and post every bar of the window again. | |
| void | RefreshAllBars () |
| Widen the window to the first mConfig + 1 bars and post each of them again. | |
| int | TickToBar (int nTick) |
| int | BarToTick (int nBar) |
| int | PhrasesMatch (int nFirstBar, int nSecondBar) |
| Report whether the phrases at two bars carry the same gems. | |
| void | ReplayBar (int nBar, int nOffset) |
| Have mPhrasePlayer play a bar again from an offset, at the song position it has reached. | |
| void | InstallPhrase (Phrase *pPhrase, int nBar, int bRefresh) |
| Install a phrase at a bar, report the owner change, and optionally post the bar again. | |
| void | ClearPhrase (int nBar, int bAll) |
| Clear the phrase at a bar and at every bar slot 7 of mMap chains it to, and post the affected window bars again. | |
| void | OnCaughtPhrasePacket (Message *pMsg) |
| Give the phrase of a CaughtPhrasePacket for this track to the player the packet identifies, or clear it, and post the chained window bars again. | |
| void | StartCommands () |
| Schedule the file-local Cmd for bar 0 at position 0 and the file-local ExportCmd for bar 1, mExportLead ticks after that bar starts. | |
| void | AddGem (int nGem, int nTrans, int nBar, int nTick, Player *pOwner, int bPost) |
| Add a gem to the phrase at a bar, creating the phrase for an owner when the bar has none. | |
| void | WithdrawCommands () |
| Withdraw both scheduled commands. | |
| void | OnPhrasePacket (PhrasePacket *pPacket) |
| Install the phrase a PhrasePacket for this track carries at its step, or clear the step when the packet has none, and post the window bar mapped to that step again. | |
| void | OnInvalidateTrack (InvalidateTrackMsg *pMsg) |
| Clear and post again every window bar whose mapped bar lies in the range an InvalidateTrackMsg for this track names. | |
| void | OnRefreshNet (Message *pMsg) |
| Send mNetSink a CaughtPhrasePacket for the step of each bar a RefreshNetMsg for this track names. | |
| Player * | GetOwner (int nBar) const |
| Report the player who owns the phrase at a bar. | |
| void | SetPhraseOwner (Player *pPlayer, int nBar) |
| Give the phrase at a bar a new owner. | |
| 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 | |
| PhrasePlayer * | mPhrasePlayer |
| Player of this track's phrases. | |
| MsgSink * | mNetSink |
| Sink the phrase changes go to as packets, installed by the stage classes' slot 8. | |
| Public Attributes inherited from MsgSource | |
| int | mGraphBuilt |
| A word no member of this class reads. | |
Protected Member Functions | |
| virtual void | DispatchPriv (Message *pMsg) |
| Act on a message. | |
Friends | |
| class | Catcher |
| class | CatchingSTG |
| class | NotePitcher |
| class | PhraseEraser |
| class | PhrasePlayer |
| class | ScoreTrackGraph |
| class | Scratcher |
| class | Voxer |
Owner of the gem phrases on one track, and the seam between the network and the gems.
Its RTTI descriptor is at 0x00901fd0. It has MsgSink at offset 0 and MsgSource at offset 4, and it is named after GsPhraseMgr.cpp, the translation unit its two file-local classes record. Those two are Cmd at 0x008f0960 and ExportCmd at 0x009021f0, both deriving from Sch::Command. Its primary table is at 0x007e28d0 and its MsgSource table at 0x007e28a8, and each runs four entries. ScoreTrackGraph's tagged allocation measures the object at 0x60 bytes. The signature of Catcher::Catcher() also records the class name, and every stage passes the manager it retains to the catcher it builds.
Every member below posts one message through its own MsgSource half, which is what the titles describe. PostPhraseMsg() looks the phrase up through PhraseDatabase::GetPhraseAt() on mDatabase, and when that lookup reports a phrase it builds a PhraseMsg with the argument at +0x04, mTrack at +0x08, and the phrase at +0x0c, and delivers it through MsgSource::Send().
DispatchPriv() dispatches six identities, three of them packets rather than messages. A PhrasePacket, a CaughtPhrasePacket, and a GemPacket arrive from the network, and an InvalidateTrackMsg, a RefreshNetMsg, and a GameBeginMsg arrive locally. The PhrasePacket and the InvalidateTrackMsg paths both loop, clearing and posting bars through RefreshBar(), and the PhrasePacket path is guarded on the packet's +0x14 matching mTrack.
The constructor fixes the member map from +0x18 to the end. The MsgSource subobject occupies +0x04 through +0x17, so the region at +0x10 the destructor tears down is that subobject's vector rather than a member of this class. The destructor deletes mDatabase and mPowerbarMgr through slot 1 of each table, which is the destructor slot.
| PhraseMgr::PhraseMgr | ( | Sch::TickClock * | pClock, |
| int | nBarTicks, | ||
| PlayMap * | pMap, | ||
| int | nConfig, | ||
| const TrackData * | pTrackData ) |
Construct the manager of one track and its phrase database.
The fifth argument arrives in t1. ScoreTrackGraph passes the song clock, 1920, the play map Globals reports, a configuration value, and its track description. The constructor ends by creating the powerbar source through CreatePowerbarMgr().
| pClock | The song clock. |
| nBarTicks | The length of one bar in MIDI ticks. |
| pMap | The play map the phrase database is sized from. |
| nConfig | The configuration value ScoreTrackGraph reads from the query at 0x00509110 with the identifier 0x2be. |
| pTrackData | The track description. |
|
virtual |
Withdraw both commands through WithdrawCommands(), then delete both owned objects.
| void PhraseMgr::CreatePowerbarMgr | ( | ) |
Replace the powerbar source with the one the play mode and the track kind call for.
kPlayModeGame on a riff or catch track, with configuration flag 0x3a1 clear, gets a SoloPowerbarMgr in kGameModeSolo and a MultiPowerbarMgr in any other game mode. Every other combination gets a JamPowerbarMgr. The constructor and CatchingSTG::CreatePowerbarMgr() call it.
| int PhraseMgr::GetPowerbar | ( | int | nBar | ) |
| nBar | The bar, mapped through slot 5 of mMap. |
| void PhraseMgr::PostPhraseMsg | ( | int | nPhrase | ) |
Post a PhraseMsg for one phrase.
Performs no work when the lookup at 0x001b8e50 reports nothing.
| nPhrase | The value the message's +0x04 receives. |
| void PhraseMgr::PostGemMsg | ( | Message * | pMsg | ) |
Add the gem a GemPacket for this track carries to the phrase at its step and every step chained to it, and post the gem for the first window bar mapped to each step.
A step with no phrase is first given to the packet's player, and TrackData::SetOwner() receives NullPlayer::sInstance as the previous owner. The GemPacket path of DispatchPriv() is the one recovered caller.
| pMsg | The packet the gem is read out of. |
| void PhraseMgr::PostGemMsgSecond | ( | int | nBar | ) |
Post each gem of the phrase at a bar as a GemMsg, in the phrase owner's name.
RefreshBar() calls it for a riff track.
| nBar | The bar. |
| void PhraseMgr::PostGemMsgThird | ( | int | nBar, |
| int | bGhost ) |
Post each gem the track description lists for a bar as a GemMsg, when the bar is enabled.
A ghost gem is posted in NullPlayer::sInstance's name, and any other in the name of the phrase owner at the bar. RefreshBar() posts ghosts on a riff track outside jukebox mode and plain gems on a catch track.
| nBar | The bar. |
| bGhost | Non-zero to post ghost gems. |
| void PhraseMgr::PostDurGemMsg | ( | int | nBar | ) |
Post the gems of the phrase at a bar as DurGemMsg objects, with a GemMsg at the head of each run.
A gem is joined to the next when the next lies within 480 ticks and its transposition has the opposite sign. A gem with a transposition of 0 posts no DurGemMsg. RefreshBar() calls it for a scratch track.
| nBar | The bar. |
| void PhraseMgr::RefreshBar | ( | int | nBar, |
| int | bClear ) |
Post one bar again when it lies in the window from mWindowStart up to mWindowEnd.
A ClearGemsMsg goes first when bClear is non-zero. The bar's status then goes through PostBarStatusMsg(), and the bar's gems through the routine mTrackKind selects from the jump table at 0x007e2670. An axe track posts a PhraseMsg, a riff track posts ghosts and gems, a scratch track posts DurGemMsg runs, a vocal track posts a PhraseMsg through a byte-identical copy of PostPhraseMsg() at 0x001bc4f8, and a catch track posts gems.
| nBar | The bar. |
| bClear | Non-zero to clear the bar's gems first. |
| void PhraseMgr::PostBarStatusMsg | ( | int | nBar | ) |
Post a BarStatusMsg for one bar with every field set.
The powerup is -1 for a bar the track description does not enable, and the manager's mRefreshing goes out in the message's +0x14. RefreshBar() is the recovered caller.
| nBar | The bar. |
| void PhraseMgr::OnCommand | ( | int | nBar | ) |
Play one bar through mPhrasePlayer and schedule the file-local Cmd for the next bar.
The file-local Cmd runs it.
| nBar | The bar to play. |
| void PhraseMgr::OnExportCommand | ( | int | nBar | ) |
Move the window to start before a bar, post the bar entering it, and schedule the file-local ExportCmd for the next bar, mExportLead ticks after that bar starts.
The file-local ExportCmd runs it.
| nBar | The bar. |
| Phrase * PhraseMgr::GetPhraseAt | ( | int | nBar | ) |
| nBar | The bar. PhrasePlayer passes the bar it plays. |
| long long * PhraseMgr::GetStepValue | ( | int | nBar | ) |
| nBar | The bar. PhrasePlayer passes the bar it plays. |
| unsigned char PhraseMgr::GetPhraseByte | ( | int | nBar | ) |
| nBar | The bar, mapped through slot 5 of mMap. |
| void PhraseMgr::SetPhraseByte | ( | int | nBar, |
| char | cValue ) |
Set the byte at +0x28 of the phrase at a bar and at every bar slot 7 of mMap chains it to for this track.
| nBar | The bar, mapped through slot 5 of mMap. |
| cValue | The byte. |
| void PhraseMgr::ResetOwners | ( | Player * | pPlayer | ) |
Return every phrase to one owner and clear and post every bar of the window again.
| pPlayer | The owner. |
| void PhraseMgr::RefreshAllBars | ( | ) |
Widen the window to the first mConfig + 1 bars and post each of them again.
mRefreshing is set while the bars are posted.
| int PhraseMgr::TickToBar | ( | int | nTick | ) |
| nTick | The song position, in MIDI ticks. |
| int PhraseMgr::BarToTick | ( | int | nBar | ) |
| nBar | The bar. |
| int PhraseMgr::PhrasesMatch | ( | int | nFirstBar, |
| int | nSecondBar ) |
Report whether the phrases at two bars carry the same gems.
Two equal bars match at once. Otherwise both bars are mapped through slot 5 of mMap, two missing phrases match, one missing phrase does not, and two phrases match when their gem lists are equal element by element. NotePitcher::PostPhraseCapturedMsg() is the recovered caller.
| nFirstBar | The first bar. |
| nSecondBar | The second bar. |
| void PhraseMgr::ReplayBar | ( | int | nBar, |
| int | nOffset ) |
Have mPhrasePlayer play a bar again from an offset, at the song position it has reached.
Catcher::OnAutoCatch() and NotePitcher::PostPhraseCapturedMsg() are the recovered callers.
| nBar | The bar. |
| nOffset | The offset within the bar, in MIDI ticks. |
| void PhraseMgr::InstallPhrase | ( | Phrase * | pPhrase, |
| int | nBar, | ||
| int | bRefresh ) |
Install a phrase at a bar, report the owner change, and optionally post the bar again.
It first marks the world's statistics through GrooveWorld::MarkStatsFlag(). A CaughtPhrasePacket for the step goes to mNetSink when one is installed. AxePhraseMaker and Voxer are the recovered callers.
| pPhrase | The phrase. |
| nBar | The bar, mapped through slot 5 of mMap. |
| bRefresh | Non-zero to post the bar through RefreshBar() afterwards. |
| void PhraseMgr::ClearPhrase | ( | int | nBar, |
| int | bAll ) |
Clear the phrase at a bar and at every bar slot 7 of mMap chains it to, and post the affected window bars again.
It first marks the world's statistics through GrooveWorld::MarkStatsFlag(). A CaughtPhrasePacket naming NullPlayer::sInstance goes to mNetSink for each cleared step when one is installed. The chain is followed only in kPlayModeGame with bAll set. AxePhraseMaker, NotePitcher, and PhraseNeutralizer are the recovered callers.
| nBar | The bar, mapped through slot 5 of mMap. |
| bAll | Non-zero to clear every chained bar as well. |
| void PhraseMgr::OnCaughtPhrasePacket | ( | Message * | pMsg | ) |
Give the phrase of a CaughtPhrasePacket for this track to the player the packet identifies, or clear it, and post the chained window bars again.
The phrase is cleared rather than given when the packet's player is a stand-in, and the first window bar mapped to each step is posted again. DispatchPriv() is the recovered caller.
| pMsg | The packet. |
| void PhraseMgr::StartCommands | ( | ) |
Schedule the file-local Cmd for bar 0 at position 0 and the file-local ExportCmd for bar 1, mExportLead ticks after that bar starts.
ScoreTrackGraph's slot 2 is the recovered caller.
| void PhraseMgr::AddGem | ( | int | nGem, |
| int | nTrans, | ||
| int | nBar, | ||
| int | nTick, | ||
| Player * | pOwner, | ||
| int | bPost ) |
Add a gem to the phrase at a bar, creating the phrase for an owner when the bar has none.
It first marks the world's statistics through GrooveWorld::MarkStatsFlag(), gives a bar without a phrase to pOwner through SetPhraseOwner(), and adds the gem through Phrase::AddGem(). A GemPacket goes to mNetSink when one is installed, with its transposition left unset. When bPost is non-zero, each window bar slot 6 of mMap reports for the step gets a ClearGemMsg for the gem the addition replaced, if any, and then a GemMsg for the new gem. On a riff track a replaced gem also reposts, as a ghost, the first other gem the track description lists at the same position. NotePitcher and Scratcher are the recovered callers.
| nGem | The gem. |
| nTrans | The transposition. |
| nBar | The bar, mapped through slot 5 of mMap. |
| nTick | The song position within the phrase, in MIDI ticks. |
| pOwner | The player a new phrase is given to. |
| bPost | Non-zero to post the gem to the window bars. Both NotePitcher calls pass a member. |
| void PhraseMgr::WithdrawCommands | ( | ) |
Withdraw both scheduled commands.
The destructor calls it first.
| void PhraseMgr::OnPhrasePacket | ( | PhrasePacket * | pPacket | ) |
Install the phrase a PhrasePacket for this track carries at its step, or clear the step when the packet has none, and post the window bar mapped to that step again.
When the owner changes, TrackData::SetOwner() receives the owner PhraseDatabase::GetOwner() reported before the change, which is what the binary passes. DispatchPriv() expands the body inline, and the out-of-line copy has no caller.
| pPacket | The packet. |
| void PhraseMgr::OnInvalidateTrack | ( | InvalidateTrackMsg * | pMsg | ) |
Clear and post again every window bar whose mapped bar lies in the range an InvalidateTrackMsg for this track names.
DispatchPriv() expands the body inline, and the out-of-line copy has no caller.
| pMsg | The message. |
| void PhraseMgr::OnRefreshNet | ( | Message * | pMsg | ) |
Send mNetSink a CaughtPhrasePacket for the step of each bar a RefreshNetMsg for this track names.
Each packet names the owner of the phrase at its step, or NullPlayer::sInstance. Nothing is sent while no sink is installed. The RefreshNetMsg path of DispatchPriv() is the one recovered caller.
| pMsg | The RefreshNetMsg. |
| Player * PhraseMgr::GetOwner | ( | int | nBar | ) | const |
Report the player who owns the phrase at a bar.
| nBar | The bar, passed to PhraseDatabase::GetPhraseAt(). |
| void PhraseMgr::SetPhraseOwner | ( | Player * | pPlayer, |
| int | nBar ) |
Give the phrase at a bar a new owner.
The bar is mapped through slot 5 of mMap. For that step, and in kPlayModeGame for every step slot 7 chains it to, the owner is exchanged in mDatabase, TrackData::SetOwner() receives the previous owner when it changed, a CaughtPhrasePacket goes to mNetSink when one is installed, and the window bars slot 6 reports for the step are posted again. The Catcher subclasses' slot 9, Catcher::SetPhraseOwners(), and NotePitcher::PostPhraseCapturedMsg() are the recovered callers.
| pPlayer | The new owner. |
| nBar | The bar. |
|
protectedvirtual |
Act on a message.
Primary table slot 3. A PhrasePacket runs OnPhrasePacket(), a CaughtPhrasePacket runs OnCaughtPhrasePacket(), a GemPacket runs PostGemMsg(), an InvalidateTrackMsg runs OnInvalidateTrack(), a RefreshNetMsg runs OnRefreshNet(), and a GameBeginMsg runs RefreshAllBars(). The two On routines and RefreshAllBars() are expanded inline.
| pMsg | The message or packet. |
Implements MsgSink.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
| PhrasePlayer* PhraseMgr::mPhrasePlayer |
Player of this track's phrases.
The constructor clears it and ScoreTrackGraph's constructor stores its own PhrasePlayer here at 0x001cefec from outside the class. OnCommand() plays each bar through it.
+0x18
| MsgSink* PhraseMgr::mNetSink |
Sink the phrase changes go to as packets, installed by the stage classes' slot 8.
The constructor clears it and every one of the four stages writes it from outside the class, which is what records the member public. InstallPhrase(), ClearPhrase(), AddGem(), and SetPhraseOwner() send it GemPacket and CaughtPhrasePacket objects through MsgSink::Dispatch() when it is set.
+0x1c