|
resonance 1.0.1
|
One participant in a session, local or remote. More...
#include <player.h>


Public Member Functions | |
| 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 | GetTrack () |
| Report the track this player occupies. | |
| virtual int | GetPlace () |
| Report the player's place on its track. | |
| 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. | |
| virtual void | DispatchPriv (Message *pMsg) |
| Receive one message. | |
| 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. | |
Static Public Member Functions | |
| static void | Delete (Player *pPlayer) |
| Delete a player through its virtual destructor, doing nothing for null. | |
Public Attributes | |
| 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. | |
Protected Attributes | |
| int | mMaxJuice |
| int | mMaxScore |
| Protected Attributes inherited from IDableBase | |
| int | mId |
Additional Inherited Members | |
| Static Public Attributes inherited from IDable< Player > | |
| static std::vector< Player * > | sObjects |
| Every registered object, indexed by mId. | |
One participant in a session, local or remote.
Player in the RTTI descriptor at 0x009020c0, over three bases: IDable<Player> at offset 0, MsgSink at 8, and MsgSource at 12. Three classes derive from it, LocalPlayer, NetPlayer, and NullPlayer.
Three vtables belong to it, each walked to its all-zero terminator rather than counted from the slot titles, which understate every one of them. The primary at 0x007d2170 has 21 entries, so this class declares 19 virtuals of its own after slot 0 and the destructor. The MsgSink table at 0x007d2148 has 4 and overrides only DispatchPriv, and the MsgSource table at 0x007d2120 has 4 and overrides nothing, leaving AddSink and RemoveSink as inherited.
Almost all of the primary table is inert defaults: slots 2 and 4 return -1, six return 0, two return 1, one returns 0.0f, and five are empty. Only slots 11 and 13 have a body of any size, so this class is an interface with defaults and the three subclasses carry the behaviour.
The base subobjects account for +0x00 through +0x1f, which the destructor at 0x00132ae8 confirms by restoring a vptr at +0x04 for IDable<Player>, at +0x08 for MsgSink, and at +0x1c for MsgSource, whose own mSinks vector it tears down at +0x10. This class's own members start at +0x20, and the only one the destructor releases is the colour name at +0x24.
| Player::Player | ( | int | nId, |
| const HxStr & | colorName, | ||
| const FreqAppearance * | pAppearance ) |
Register the player under its identifier and start its tallies.
The score starts at 0 with a ceiling of 1, the juice at 0 with a ceiling of 1, and the last erase time at 0.
| nId | The identifier, also recorded in mPlayerId. |
| colorName | The player's colour name. |
| pAppearance | The appearance the player is drawn with. |
|
virtual |
|
virtual |
Report the controller slot that drives this player.
Slot 2. Returns kNoInputSlot here, and NetPlayer inherits it. LocalPlayer returns the slot its constructor received, and InputMap matches a controller reading against it.
Reimplemented in LocalPlayer.
|
virtual |
Test whether this player is the stand-in for an absent one.
Returns false here. Only NullPlayer returns true, and Print() branches on the answer to write "{player null}", which is what recovers the verb.
Reimplemented in NullPlayer.
|
virtual |
Report the track this player occupies.
Slot 4. Returns -1 here. LocalPlayer and NetPlayer return the track the last TrackSelectMsg for the player chose, and powerups deploy and riffs play on it.
Reimplemented in LocalPlayer, and NetPlayer.
|
virtual |
Report the player's place on its track.
Slot 5. Returns zero here. LocalPlayer and NetPlayer return the second word of the last TrackSelectMsg for the player, the place that TrackSelectPacket includes beside the track.
Reimplemented in LocalPlayer, and NetPlayer.
|
virtual |
Report zero.
Slot 6. LocalPlayer's override also returns zero, and the image has no caller of the slot. The title records that the slot is unused.
Reimplemented in LocalPlayer.
|
virtual |
Do nothing.
Slot 7. LocalPlayer's override is also empty, and the image has no caller of the slot. The title records that the slot is unused.
Reimplemented in LocalPlayer.
|
virtual |
Give the player a span of bars it plays freely.
Slot 8. Empty here. LocalPlayer stores both bars, and IsFreestyleBar() tests a bar against them. Gamer passes the eight-bar span of an enable-freestyle powerup and the span a solo win grants, and a jam player's constructor passes a span that never ends.
| nStartBar | The first bar of the span. |
| nEndBar | The bar after the span. |
Reimplemented in LocalPlayer.
|
virtual |
Test whether a bar lies in the player's freestyle span.
Slot 9. Returns zero here, ignoring its argument. NotePitcher plays a bar inside the span without the track's usual requirement.
| nBar | The bar. |
Reimplemented in LocalPlayer.
|
virtual |
Report whether the player is looping.
Slot 10. Returns zero here. LocalPlayer returns the flag SetLooping() and ToggleLoop() maintain.
Reimplemented in LocalPlayer.
|
virtual |
Announce the player's state.
Slot 11. Here, builds a JuiceAmountMsg on the stack for this player, with mMaxJuice clamped to a maximum of 800, and sends it through the MsgSource subobject. LocalPlayer adds its track, powerups, score ceiling, ghost, and loop state.
Reimplemented in LocalPlayer.
|
virtual |
Deactivate the powerup placer.
Slot 12. Empty here. LocalPlayer runs PowerupPlacer::Deactivate(), the counterpart of the PowerupPlacer::Activate() that AnnounceState() runs. The image has no caller of the slot but StopMF(), itself uncalled. The title is inferred from the forwarding alone.
Reimplemented in LocalPlayer.
|
virtual |
Write a description of this player to stream.
Writes the literal "{player null}" when IsNull() reports true, and otherwise "{player " followed by the identifier at +0x20. Those two literals at 0x007d2048 and 0x007d2058 are what attest both this routine and IsNull().
| stream | The stream to write to. |
|
virtual |
Count one caught gem.
Slot 14. Catcher runs it for every gem the player catches and discards the result. Does not touch the return register here. The value it yields is therefore indeterminate. LocalPlayer increments its count and returns the new value. A base whose default yields an indeterminate value is faithful to the image rather than a reconstruction error.
Reimplemented in LocalPlayer.
|
virtual |
Count one missed gem.
Slot 15. Catcher runs it when a gem passes uncaught. Does not touch the return register here, as with CountCaughtGem(). LocalPlayer increments its count and returns the new value.
Reimplemented in LocalPlayer.
|
virtual |
Report the score multiplier a capture starting at a bar earns.
Slot 16. Returns 1 here, ignoring its argument. Catcher and Scratcher pass the result in a BeginPhraseCatchMsg.
| nBar | The bar. |
Reimplemented in LocalPlayer.
|
virtual |
Report the best streak of consecutive captures.
Slot 17. Returns zero here. Gamer records it as the solo tally.
Reimplemented in LocalPlayer.
|
virtual |
Report the proportion of captured phrases among those captured and muffed.
Slot 18. Returns 0.0f here. Gamer records it as the solo ratio.
Reimplemented in LocalPlayer.
|
virtual |
Report the game mode the player was built in.
Slot 19. Returns zero here.
Reimplemented in LocalPlayer.
|
virtual |
Record that a bar scored, reporting whether it had not scored before.
Slot 20. Returns 1 here, ignoring its argument. Scratcher does not award points for a bar the slot reports zero for.
| nBar | The bar. |
Reimplemented in LocalPlayer.
|
virtual |
Receive one message.
The only MsgSink virtual this class overrides, at slot 3 of its MsgSink table. An UpdateScorePacket for this player adds its delta without notifying, and a PhraseCapturedMsg is awarded through OnMsg() whichever player it identifies. Every other message is discarded.
| pMsg | The message. |
Implements MsgSink.
Reimplemented in LocalPlayer, NetPlayer, and NullPlayer.
| int Player::GetJuice | ( | ) |
Report the juice the player has banked.
The routine at 0x0012f970 clamps the value to 0 through mMaxJuice, the maximum JuiceAmountMsg announces, and the message accessor at 0x003e4198 divides it by that announced maximum.
| int Player::GetScore | ( | ) |
Report the player's score.
The routine at 0x0012f808 clamps the value to 0 through mMaxScore. Renderer compares the scores of every world player through this accessor to find the leader.
| void Player::SetScore | ( | int | nScore, |
| int | nMaxScore ) |
Set the score and the ceiling it is clamped to.
Gamer's constructor sets every player to 0 with a ceiling of 100000. The title is inferred.
| nScore | The score. |
| nMaxScore | The ceiling. |
| void Player::SetJuice | ( | int | nJuice, |
| int | nMaxJuice ) |
Set the juice and the ceiling it is clamped to.
Gamer's constructor passes two configuration values in kGameModeSolo and zeros otherwise. The title is inferred.
| nJuice | The juice. |
| nMaxJuice | The ceiling. |
| void Player::AddJuice | ( | int | nAmount, |
| int | bNotify ) |
Add juice, clamped to 0 through the ceiling, and announce a change.
A change sends a JuiceAmountMsg through the MsgSource subobject and, when bNotify is set, an UpdateScorePacket with the amount. The script command that adds juice is the recovered caller. The title is inferred.
| nAmount | The juice to add, which may be negative. |
| bNotify | Non-zero to also send the UpdateScorePacket. |
| void Player::AddScore | ( | int | nDelta, |
| int | bNotify ) |
Add to the score, clamped to 0 through the ceiling, and announce a change.
The score counterpart of AddJuice(). A change sends a PointAmountMsg with the ceiling capped at 800 and, when bNotify is set, an UpdateScorePacket with the delta. PhraseNeutralizer is a recovered caller. The title is inferred.
| nDelta | The points to add, which may be negative. |
| bNotify | Non-zero to also send the UpdateScorePacket. |
| void Player::OnMsg | ( | const PhraseCapturedMsg & | msg | ) |
Add a captured phrase's score and juice, announcing both.
LocalPlayer::DispatchPriv() and the routine at 0x00122be8 are the callers.
| msg | The capture. |
|
inline |
Report whether the player has an input slot.
Inline, and TrackSelector::DispatchPriv() expands it. The address is its uncalled out-of-line copy.
|
inlinestatic |
Delete a player through its virtual destructor, doing nothing for null.
Inline. GrooveWorld::DeletePlayers() passes it to std::for_each, which is what gives it the out-of-line copy at this address. The title is inferred.
| pPlayer | The player to delete, or null. |
| HxStr Player::GetColorName | ( | ) |
Copy the player's colour name.
Inline. The address is its uncalled out-of-line copy. The title is inferred.
| HxStr Player::GetUsername | ( | ) |
Copy the username of the player's appearance.
Inline. The address is its uncalled out-of-line copy. The title is inferred.
| int Player::StartMF | ( | ) |
Run AnnounceState() and report zero.
Inline. The address is its uncalled out-of-line copy.
| int Player::StopMF | ( | ) |
Run DeactivatePlacer() and report zero.
Inline. The address is its uncalled out-of-line copy.
| int Player::mPlayerId |
Identifier a message addresses this player by.
Print() writes it after the "{player " literal and DispatchPriv compares it against a field of an incoming message. Gem reads it directly at 0x001a2608 and 0x001a2d84 from outside the hierarchy, and the image exposes no accessor. The member is therefore public here. A friend declaration for Gem fits the image equally well.
+0x20
| HxStr Player::mColorName |
The player's colour name, such as green or red.
+0x24
~Player releases its buffer at +0x28 with the inlined HxStr destructor. HudScore, HudFreq, and HudScorePulse copy-construct it directly at 0x00419848, 0x00419b40, and 0x0041c2d0 from outside the hierarchy, and the image has no accessor for it.
|
protected |
|
protected |
| long long Player::mLastEraseTime |
Scheduler time of this player's last erase press, in nanoseconds.
The constructor at 0x0012f5c0 zeroes it. InputMap::OnControllerReading() reads and writes it directly at 0x00119a6c and 0x00119adc to detect a double tap, and the image has no accessor for it. +0x40