|
resonance 1.0.1
|
Player driven by a controller on this machine. More...
#include <localplayer.h>


Public Member Functions | |
| LocalPlayer (int nId, int nInputSlot, const HxStr &colorName, const FreqAppearance *pAppearance, Sch::TickClock *pClock, int nTrack) | |
| Build the player and the powerup collection and placer its play mode calls for. | |
| virtual | ~LocalPlayer () |
| Delete the placer and the collection. | |
| virtual int | GetInputSlot () const |
| virtual int | GetTrack () |
| virtual int | GetPlace () |
| virtual int | UnusedQuery () |
| virtual void | UnusedHook () |
| virtual void | SetFreestyleSpan (int nStartBar, int nEndBar) |
| virtual int | IsFreestyleBar (int nBar) |
| virtual int | IsLooping () |
| virtual void | AnnounceState () |
| Announce the player's whole state and start the per-bar command. | |
| virtual void | DeactivatePlacer () |
| Run PowerupPlacer::Deactivate() on the placer. | |
| virtual int | CountCaughtGem () |
| virtual int | CountMissedGem () |
| virtual int | GetMultiplier (int nBar) |
| Report the 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 () |
| virtual int | MarkBarScored (int nBar) |
| virtual void | SetLooping (int bLooping, const Sch::Tick &position) |
| Start or stop looping. | |
| virtual void | SetGhost (int bGhost) |
| Show or hide the player's ghost. | |
| virtual void | DispatchPriv (Message *pMsg) |
| Receive one message. | |
| virtual void | AddSink (MsgSink *pSink) |
| virtual void | RemoveSink (MsgSink *pSink) |
| void | OnBarTick (int nTick) |
| Run the update of the bar that starts at a tick, then post the next bar's. | |
| void | ToggleLoop (const Sch::Tick &position) |
| Toggle looping. | |
| 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 | IsNull () |
| Test whether this player is the stand-in for an absent one. | |
| virtual void | Print (std::ostream &stream) |
| Write a description of this player to stream. | |
| 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 () |
| void | Send (Message *pMsg) const |
| Deliver a message to every registered sink, in registration order. | |
| void | ClearSinks () |
| Unregister every sink. | |
Public Attributes | |
| PowerupCollectionI * | mCollection |
| 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. | |
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. | |
| 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 |
Player driven by a controller on this machine.
LocalPlayer in the RTTI descriptor at 0x008eeff8, with Player as its only base. Its three vtables are at 0x007d0160, 0x007d0138, and 0x007d0110, each walked to its terminator.
The primary table has 23 entries against the base's 21, so this class adds two virtuals past the end of the base table rather than overriding into it. It replaces slots 2 and 4 through 12 and 14 through 20, and inherits only slots 3 and 13. In the MsgSource table it replaces both AddSink and RemoveSink, which the base leaves inherited, and in the MsgSink table it replaces DispatchPriv.
The constructor gives the player a powerup collection and a placer that fits the play mode, and AddSink() and RemoveSink() fan registration out to both. The player also keeps the capture statistics the solo statistics read back: the streak of consecutive captures and its best, the multiplier, and the counts of captured and muffed phrases. A LocalPlayerCmd posted every bar on mClock ends a multiplier bonus and resets the multiplier when the player stops catching.
| LocalPlayer::LocalPlayer | ( | int | nId, |
| int | nInputSlot, | ||
| const HxStr & | colorName, | ||
| const FreqAppearance * | pAppearance, | ||
| Sch::TickClock * | pClock, | ||
| int | nTrack ) |
Build the player and the powerup collection and placer its play mode calls for.
In jam the player gets an unlimited PowerupCollection and a JamPowerupPlacer, a freestyle span that never ends, and starts looping. In game modes 1 through 3 it gets a SinglePowerupCollection and a SimplifiedGamePowerupPlacer. In any other mode it gets neither.
| nId | The player's identifier. |
| nInputSlot | The controller slot GetInputSlot() reports. |
| colorName | The player's colour name. |
| pAppearance | The appearance the player is drawn with. |
| pClock | The clock the per-bar command is posted on. |
| nTrack | The track GetTrack() reports. |
|
virtual |
Delete the placer and the collection.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Announce the player's whole state and start the per-bar command.
Runs Player::AnnounceState(), then sends a TrackSelectMsg for the player's track at the current song position, has the collection announce its state, and sends a PointAmountMsg, a ToggleGhostMsg, and a LoopToggleMsg. It then posts a LocalPlayerCmd at the end of the first bar under mCommand.
Reimplemented from Player.
|
virtual |
Run PowerupPlacer::Deactivate() on the placer.
That slot's body is two instructions, and the call arrives at an empty routine. Both the PowerupPlacer and JamPowerupPlacer tables record the same address for it rather than a re-emitted copy each. The shared address proves the empty body is inherited rather than a local override. This dispatch is therefore real and does nothing.
Reimplemented from Player.
|
virtual |
|
virtual |
|
virtual |
Report the multiplier a capture starting at a bar earns.
A bar after the end of the last caught run earns only the bonus plus one, and a bar inside it adds the streak multiplier.
Reimplemented from Player.
|
virtual |
Report the best streak of consecutive captures.
Reimplemented from Player.
|
virtual |
Report the proportion of captured phrases among those captured and muffed.
Returns zero when nothing was captured, so the division never runs on an empty total.
Reimplemented from Player.
|
virtual |
|
virtual |
|
virtual |
Start or stop looping.
Only in jam. Stores bLooping, invalidates the seeker of the player's track at the position's bar, and sends a LoopToggleMsg. The title is inferred.
| bLooping | Non-zero to loop. |
| position | The song position of the change. |
|
virtual |
Show or hide the player's ghost.
Slot 22, declared by this class rather than inherited. Returns at once unless the play mode is jam. Otherwise it stores its argument in mGhost and sends a ToggleGhostMsg for this player with its argument as ToggleGhostMsg::mOn. The set-ghost-mode script command is the recovered caller.
| bGhost | Non-zero to show the ghost. |
|
virtual |
Receive one message.
Acts on the controller, capture, and powerup messages that address this player, and passes every message it does not recognise to Player::DispatchPriv().
| pMsg | The message. |
Reimplemented from Player.
|
virtual |
|
virtual |
| void LocalPlayer::OnBarTick | ( | int | nTick | ) |
Run the update of the bar that starts at a tick, then post the next bar's.
Ends a multiplier bonus whose last bar has passed, resets the multiplier two bars after the last caught bar, and announces the multiplier when either changes. LocalPlayerCmd::Execute() is the caller. The title is inferred.
| nTick | The song position. |
| void LocalPlayer::ToggleLoop | ( | const Sch::Tick & | position | ) |
Toggle looping.
Only in jam. Invalidates the seeker of the player's track at the position's bar and sends a LoopToggleMsg. The title is inferred.
| position | The song position of the change. |
| PowerupCollectionI* LocalPlayer::mCollection |