resonance 1.0.1
Loading...
Searching...
No Matches
trackselector.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "app/msgsink.h"
6#include "app/msgsource.h"
7#include "game/nullplayer.h"
8#include "game/player.h"
9#include "msg/bumppacket.h"
10#include "msg/message.h"
11
12class PhraseMuffedMsg;
14class RotLeftMsg;
15class RotRightMsg;
16
19
28constexpr int kTrackSelectorSlotCount = 4;
29
61class TrackSelector : public MsgSink, public MsgSource {
62public:
73 TrackSelector(const std::vector<Player *> &players);
74
79 virtual ~TrackSelector();
80
95 virtual void DispatchPriv(Message *pMsg);
96
109 static int SelfTest();
110
120 static int RunSelfTest();
121
122private:
133 void RemoveLightFromColumn(Player *pPlayer, int nChannel, int nPayload);
134
145 void InsertLightForDrawable(Player *pPlayer, int nChannel, int nPayload);
146
158 int RebuildChannelGrid(BumpPacket *pPacket);
159
160 // The four handlers below are inline, and DispatchPriv() expands each. The addresses are
161 // their uncalled out-of-line copies.
162
169 void OnMsg(const RotLeftMsg &msg);
170
177 void OnMsg(const RotRightMsg &msg);
178
185 void OnPhraseMuffed(PhraseMuffedMsg *pMsg);
186
193 void OnRemoteTrackSelect(RemoteTrackSelectMsg *pMsg);
194
201 void MovePlayer(Player *pPlayer, int nFromChannel, int nToChannel, int nPayload);
202
210 void MovePlayerToBack(Player *pPlayer, int nChannel, int nPayload);
211
218 int AddLightToChannel(Player *pPlayer, int nPayload, int nDelta);
219
220 int mChannelCount; // +0x18, always kTrackSelectorChannelCount
221 int mSlotCount; // +0x1c, the roster size the constructor measured
223};
Network packet the game sends between game systems.
Definition bumppacket.h:25
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
Sender of engine messages, which stores the list of sinks that receive them.
Definition msgsource.h:26
Event the game passes between a MsgSource and a MsgSink.
Definition phrasemuffedmsg.h:31
One participant in a session, local or remote.
Definition player.h:39
Event the game passes between a MsgSource and a MsgSink.
Definition remotetrackselectmsg.h:26
Event the game passes between a MsgSource and a MsgSink.
Definition rotleftmsg.h:23
Event the game passes between a MsgSource and a MsgSink.
Definition rotrightmsg.h:23
virtual ~TrackSelector()
virtual void DispatchPriv(Message *pMsg)
Act on a message.
TrackSelector(const std::vector< Player * > &players)
Build the grid over a roster of players.
static int RunSelfTest()
Run SelfTest() in the shape TestRegistry::TestFunc requires.
static int SelfTest()
Exercise the grid against four stand-in players.
constexpr int kTrackSelectorChannelCount
Channels the selector tracks.
Definition trackselector.h:18
constexpr int kTrackSelectorSlotCount
Slots reserved per channel.
Definition trackselector.h:28