resonance 1.0.1
Loading...
Searching...
No Matches
grooveworld.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "app/msgsink.h"
7#include "os/hxstr.h"
8
9class Application;
10class BGTrackGraph;
11class Delayer;
13class FreqAppearance;
14class GameStats;
15class Gamer;
16class IBStream;
18class InputMap;
19class LevelBuilder;
20class LevelData;
21class Message;
22class MetPersonaData;
23class MsgJoiner;
24class MsgSource;
25class MuseSynth;
26class OBStream;
27class PlayMap;
28class Player;
29class Renderer;
30class RendererBase;
31class ScoreTrackGraph;
32class TrackSelector;
34
35namespace Sch {
36class TickClock;
37} // namespace Sch
38
66class GrooveWorld : public MsgSink, public RawController {
67 // InputPoller::ReadControllers() at 0x001dfab0 reads mState directly.
68 friend class InputPoller;
69
70public:
84
89 virtual ~GrooveWorld();
90
102 virtual void DispatchPriv(Message *pMsg);
103
123 virtual void OnControllerReading(int nTag, int nPadIndex, int nButton, float flValue);
124
137
152 void PostExit(int nMode, int bContinueJukebox, int bRestart);
153
172 void Exit(int nMode, int bContinueJukebox, int bRestart);
173
185
196
208 void SetNetIO(MsgSink *pSink, MsgSource *pSource);
209
219 void StartLoad(const HxStr &path);
220
231
241
257
274 void StartPlay();
275
286 void AddNetPlayer(int nId, int nUnused, const HxStr &name, const FreqAppearance *pAppearance);
287
304 int nId, int nInputSlot, int nUnused, const HxStr &colorName, MetPersonaData *pPersona);
305
313 void RemovePlayer(int nId);
314
322
330 void SavePhrases(OBStream &stream);
331
340 void LoadPhrases(IBStream &stream, int bClearOwners);
341
349
360
369 void PostQuit();
370
380
392 void Shutdown();
393
404
415
422
434
442
443private:
454 void ConnectPlayers();
455
465 void DisconnectPlayers();
466
475 void DeletePlayers();
476
487 void CreateRenderer();
488
501 void BuildGraphs();
502
511 void DestroyGraphs();
512
522 void StartSequencers();
523
535 void FinishSong();
536
548 void EndLevel();
549
560 void StopLevel();
561
562public:
573 void DisplayText(const HxStr &text);
574
585
586private:
587 Application *mApp; // +0x08
588
589public:
597
598private:
599 TrackSelector *mTrackSelector; // +0x10
600 MsgJoiner *mJoiner; // +0x14
601 // The MIDI level. BuildGraphs() halts with `MIDI level file has not been loaded.` while it is
602 // null.
603 LevelBuilder *mLevel; // +0x18
604 // The network packet source the players and the world listen to. Registered with in game mode
605 // 3 only.
606 MsgSource *mNetSource; // +0x1c
607 // The network packet sink the players and, in game mode 3, the gamer send to.
608 MsgSink *mNetSink; // +0x20
609 Delayer *mDelayer; // +0x24
610 // The in-game renderer. CreateRenderer() creates it.
611 Renderer *mRenderer; // +0x28
612
613public:
621
622private:
623 GameStats *mStats; // +0x30
624
625public:
634
635public:
636 // The score graphs, indexed by track. Public because the volume script command reads one
637 // with no accessor in the image.
638 std::vector<ScoreTrackGraph *> mTrackGraphs; // +0x38
639
640private:
641 // One graph per backing track. The gamer receives the vector through SetBackGraphs().
642 std::vector<BGTrackGraph *> mBackingGraphs; // +0x44
643 // One graph per intro track. The element type is fixed by DestroyGraphs() and
644 // StartSequencers(). Both run one std::for_each instantiation over this vector and
645 // mBackingGraphs.
646 std::vector<BGTrackGraph *> mIntroGraphs; // +0x50
647 // The graph of the level's own track, when the level has one.
648 BGTrackGraph *mOwnTrackGraph; // +0x5c
649 MuseSynth *mMuseSynth; // +0x60
650 Sch::TickClock *mSongClock; // +0x64
651
652public:
658 std::vector<Player *> mPlayers;
659
668 std::vector<Player *> mLocalPlayers;
669
670private:
671 InputCheatDetectorGS *mCheatDetector; // +0x80
672 // Non-zero to drop controller readings outside a playback instead of queueing them. Only the
673 // constructor writes it, with zero.
674 int mIgnoreReadings; // +0x84
675 // Non-zero when the exit restarts the game. EndLevel() passes it in the EndGameMsg.
676 int mRestart; // +0x88
677
678public:
688
696
697private:
698 int mExitMode; // +0x94
699 int mState; // +0x98
700 HxStr mLevelPath; // +0x9c
701 void *mLoadBuffer; // +0xa4, the raw MIDI file
702 int mLoadSize; // +0xa8
703 int mLoadHandle; // +0xac
704
705public:
714
724};
The FreQuency application.
Definition application.h:23
Audio graph of one background track.
Definition bgtrackgraph.h:24
Sink that forwards the messages it receives to its own sinks.
Definition delayer.h:27
Driver of the controllers' vibration motors during a song.
Definition forcefeedbackmgr.h:29
Appearance of a player's avatar.
Definition freqappearance.h:39
Running tally a game session accumulates.
Definition gamestats.h:27
One participant's view of a session, driven by messages.
Definition gamer.h:47
std::vector< Player * > mPlayers
Every player in the world, in slot order.
Definition grooveworld.h:658
LevelData * GetLevel()
void KillRenderer()
Detach the renderer from every source that feeds it and delete it.
void SetNetIO(MsgSink *pSink, MsgSource *pSource)
Install the sink and the source the gamer is wired to.
void PrepareLevel()
Prepare the loaded level for play.
RendererBase * GetRendererSink()
Report the renderer's RendererBase half.
HxStr GetSongName() const
Report the jukebox song title.
void PostFinish()
Queue the finish exit, mode 1, with the current mContinueJukebox.
InputMap * mInputMap
The input map of the world's players.
Definition grooveworld.h:596
void PostQuit()
Queue the quit exit, mode 2.
void PostExit(int nMode, int bContinueJukebox, int bRestart)
Queue an ExitCmd built from three values.
virtual void DispatchPriv(Message *pMsg)
Route a CripplePacket to the delayer and a BumpPacket to the track selector.
std::vector< ScoreTrackGraph * > mTrackGraphs
Definition grooveworld.h:638
std::vector< Player * > mLocalPlayers
The players this console drives.
Definition grooveworld.h:668
friend class InputPoller
Definition grooveworld.h:68
void OnBumpPacket(Message *pMsg)
Hand a BumpPacket to the track selector.
void Shutdown()
Tear the world down ahead of destruction.
void Exit(int nMode, int bContinueJukebox, int bRestart)
Leave the game in one of three modes.
void MarkStatsFlag()
Set the statistics word at +0x14 of mStats to 1.
void AddLocalPlayer(int nId, int nInputSlot, int nUnused, const HxStr &colorName, MetPersonaData *pPersona)
Create a player this console drives and append it to mPlayers and mLocalPlayers.
void LoadPhrases(IBStream &stream, int bClearOwners)
Read the phrase database of every score track graph back.
int mContinueJukebox
Non-zero while a jukebox session goes on to its next song.
Definition grooveworld.h:723
int IsLoadDone()
Report whether the MIDI file read has completed.
int mIsPlayback
Non-zero while the world plays back a recording.
Definition grooveworld.h:687
ForceFeedbackMgr * mForceFeedback
Vibration driver of the controllers.
Definition grooveworld.h:633
void StartLoad(const HxStr &path)
Create the level and begin reading its MIDI file asynchronously.
Gamer * mGamer
The scoring state.
Definition grooveworld.h:620
virtual void OnControllerReading(int nTag, int nPadIndex, int nButton, float flValue)
Report a controller reading.
GrooveWorld(Application *pApp, GameStats *pStats)
Construct an empty world.
void SavePhrases(OBStream &stream)
Write the phrase database of every score track graph.
void PostRestart()
Queue the restart exit, mode 3, with mRestart set.
void EnableInput()
Enable every entry of the input map.
void RemovePlayer(int nId)
Remove the first player with an identifier from mPlayers, without destroying it.
void FinishLoad()
Convert the MIDI file into the level and adopt the level's tempo map.
void StartPlay()
Starts play on a prepared level.
void OnCripplePacket(Message *pMsg)
Hand a CripplePacket to the delayer.
int mIsTutorial
Non-zero in a tutorial level, from the tutorial configuration flag 0x3a1.
Definition grooveworld.h:695
Sch::TickClock * GetSongClock()
Report the world's song clock.
void DisplayText(const HxStr &text)
Show a line of text on the track displays.
void ReplayControllerReading(const MetControllerReading *pReading)
Hand one recorded controller reading to the input map.
PlayMap * GetPlayMap()
Report the level's play map.
virtual ~GrooveWorld()
HxStr mSongName
Song title shown in jukebox mode.
Definition grooveworld.h:713
void AddNetPlayer(int nId, int nUnused, const HxStr &name, const FreqAppearance *pAppearance)
Create a remote player and append it to mPlayers.
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Input half of the byte stream interface.
Definition ibstream.h:36
Cheat detector for a game session.
Definition inputcheatdetectorgs.h:22
Translator from controller readings to the players of one game world.
Definition inputmap.h:30
Accumulator a MIDI conversion fills, and the one implementation of LevelData.
Definition levelbuilder.h:51
Read-only interface the game reads one converted level through.
Definition leveldata.h:27
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:41
One controller reading, as RawControllerMsg carries it.
Definition metcontrollerreading.h:24
Saved record of one player persona.
Definition metpersonadata.h:39
Sink that sends every message it receives on to its own sinks.
Definition msgjoiner.h:22
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
Owner of the players that are sounding, and the sink that starts them.
Definition musesynth.h:36
Output half of the byte stream interface.
Definition obstream.h:25
Traversal order over one playable sequence.
Definition playmap.h:47
One participant in a session, local or remote.
Definition player.h:39
Base of every object that reads a controller directly.
Definition rawcontroller.h:19
Base of every renderer, with a message queue and a router of its own.
Definition rendererbase.h:27
In-game renderer that drives the tunnel, the overlay, and the arena for one game.
Definition renderer.h:56
Pausable view of scheduler time, together with the tempo that maps it to a song position.
Definition tickclock.h:40
Shared base of the four per-instrument gameplay stages.
Definition scoretrackgraph.h:51
Grid of which players occupy which track channel.
Definition trackselector.h:61
Scheduling of timed commands.
Definition activefilter.h:9