resonance 1.0.1
Loading...
Searching...
No Matches
localplayer.h
Go to the documentation of this file.
1#pragma once
2
3#include "app/msgsink.h"
4#include "app/msgsource.h"
5#include "game/player.h"
8#include "mid/tick.h"
9#include "sch/cmdid.h"
10
11class AxisYPowMsg;
12class ButtonPowMsg;
14class HxStr;
15class LoopToolMsg;
16class MultiplierMsg;
18class PhraseMuffedMsg;
19class ToggleGhostMsg;
20class TrackSelectMsg;
21
22namespace Sch {
23class TickClock;
24} // namespace Sch
25
44class LocalPlayer : public Player {
45public:
62 LocalPlayer(int nId,
63 int nInputSlot,
64 const HxStr &colorName,
65 const FreqAppearance *pAppearance,
66 Sch::TickClock *pClock,
67 int nTrack);
68
75 virtual ~LocalPlayer();
76
81 virtual int GetInputSlot() const;
82
87 virtual int GetTrack();
88
93 virtual int GetPlace();
94
99 virtual int UnusedQuery();
100
105 virtual void UnusedHook();
106
111 virtual void SetFreestyleSpan(int nStartBar, int nEndBar);
112
117 virtual int IsFreestyleBar(int nBar);
118
123 virtual int IsLooping();
124
136 virtual void AnnounceState();
137
149 virtual void DeactivatePlacer();
150
155 virtual int CountCaughtGem();
156
161 virtual int CountMissedGem();
162
172 virtual int GetMultiplier(int nBar);
173
180 virtual int GetBestStreak();
181
191 virtual float GetCaptureRatio();
192
197 virtual int GetGameMode();
198
203 virtual int MarkBarScored(int nBar);
204
216 virtual void SetLooping(int bLooping, const Sch::Tick &position);
217
230 virtual void SetGhost(int bGhost);
231
242 virtual void DispatchPriv(Message *pMsg);
243
248 virtual void AddSink(MsgSink *pSink);
249
254 virtual void RemoveSink(MsgSink *pSink);
255
267 void OnBarTick(int nTick);
268
279 void ToggleLoop(const Sch::Tick &position);
280
281private:
289 void OnTrackSelect(TrackSelectMsg *pMsg);
290
297 void OnToggleGhost(ToggleGhostMsg *pMsg);
298
305 void OnMultiplier(MultiplierMsg *pMsg);
306
307 // The six handlers below are inline, and DispatchPriv() expands each. The addresses are
308 // their uncalled out-of-line copies.
309
316 void OnAxisYPow(AxisYPowMsg *pMsg);
317
324 void OnLoopTool(LoopToolMsg *pMsg);
325
332 void OnPhraseCaptured(PhraseCapturedMsg *pMsg);
333
340 void OnPhraseMuffed(PhraseMuffedMsg *pMsg);
341
348 void OnButtonPow(ButtonPowMsg *pMsg);
349
356 void OnCaughtPowerbar(CaughtPowerbarMsg *pMsg);
357
358 Sch::TickClock *mClock; // +0x48
359 Sch::CmdID mCommand; // +0x4c
360 int mInputSlot; // +0x50
361 int mTrack; // +0x58
362 int mPlace; // +0x5c
363 int mLooping; // +0x60
364 int mGhost; // +0x64 the ghost display
365 int mPlayMode; // +0x68
366 int mGameMode; // +0x6c
367 int mFreestyleStartBar; // +0x70
368 int mFreestyleEndBar; // +0x74
369 int mLastScoredBar; // +0x78
370 int mRunEndBar; // +0x7c the end of the last caught run
371 int mLastCaughtBar; // +0x80
372 int mStreak; // +0x84
373 int mBestStreak; // +0x88
374 int mMultiplier; // +0x8c
375 int mBonus; // +0x90
376 int mBonusEndBar; // +0x94 not written by the constructor
377 int mLastMuffedBar; // +0x98
378 int mCaptures; // +0x9c
379 int mMisses; // +0xa0
380
381public:
382 // Public because the select-powerup script command drives it with no accessor in the image.
384
385private:
386 PowerupPlacer *mPlacer; // +0xa8
387 int mMissedGems; // +0xac
388 int mCaughtGems; // +0xb0
389};
Event the game passes between a MsgSource and a MsgSink.
Definition axisypowmsg.h:24
Event the game passes between a MsgSource and a MsgSink.
Definition buttonpowmsg.h:24
Event the game passes between a MsgSource and a MsgSink.
Definition caughtpowerbarmsg.h:22
Appearance of a player's avatar.
Definition freqappearance.h:39
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
virtual int UnusedQuery()
virtual int GetBestStreak()
Report the best streak of consecutive captures.
PowerupCollectionI * mCollection
Definition localplayer.h:383
void OnBarTick(int nTick)
Run the update of the bar that starts at a tick, then post the next bar's.
virtual int CountMissedGem()
virtual int CountCaughtGem()
virtual int GetMultiplier(int nBar)
Report the multiplier a capture starting at a bar earns.
virtual void AddSink(MsgSink *pSink)
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 GetGameMode()
virtual void SetFreestyleSpan(int nStartBar, int nEndBar)
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 int GetInputSlot() const
virtual ~LocalPlayer()
Delete the placer and the collection.
virtual int GetPlace()
virtual void SetLooping(int bLooping, const Sch::Tick &position)
Start or stop looping.
virtual int GetTrack()
virtual void DispatchPriv(Message *pMsg)
Receive one message.
virtual int IsFreestyleBar(int nBar)
virtual void SetGhost(int bGhost)
Show or hide the player's ghost.
virtual void RemoveSink(MsgSink *pSink)
virtual float GetCaptureRatio()
Report the proportion of captured phrases among those captured and muffed.
virtual void UnusedHook()
void ToggleLoop(const Sch::Tick &position)
Toggle looping.
virtual int MarkBarScored(int nBar)
virtual int IsLooping()
Event the game passes between a MsgSource and a MsgSink.
Definition looptoolmsg.h:24
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
Receiver of engine messages.
Definition msgsink.h:37
Event the game passes between a MsgSource and a MsgSink.
Definition multipliermsg.h:20
Event the game passes between a MsgSource and a MsgSink.
Definition phrasecapturedmsg.h:27
Event the game passes between a MsgSource and a MsgSink.
Definition phrasemuffedmsg.h:31
Player(int nId, const HxStr &colorName, const FreqAppearance *pAppearance)
Register the player under its identifier and start its tallies.
Interface of the store a player draws powerups from.
Definition powerupcollectioni.h:29
Base of the objects that place a powerup for a player.
Definition powerupplacer.h:24
Handle that identifies one batch of commands the scheduler has queued.
Definition cmdid.h:35
Pausable view of scheduler time, together with the tempo that maps it to a song position.
Definition tickclock.h:40
Song position in MIDI ticks, printed as measure, beat, and tick.
Definition tick.h:70
Event the game passes between a MsgSource and a MsgSink.
Definition toggleghostmsg.h:20
Event the game passes between a MsgSource and a MsgSink.
Definition trackselectmsg.h:24
Scheduling of timed commands.
Definition activefilter.h:9