|
resonance 1.0.1
|
Owner of the world a game session runs in. More...
#include <grooveworld.h>


Public Member Functions | |
| GrooveWorld (Application *pApp, GameStats *pStats) | |
| Construct an empty world. | |
| virtual | ~GrooveWorld () |
| virtual void | DispatchPriv (Message *pMsg) |
| Route a CripplePacket to the delayer and a BumpPacket to the track selector. | |
| virtual void | OnControllerReading (int nTag, int nPadIndex, int nButton, float flValue) |
| Report a controller reading. | |
| void | ReplayControllerReading (const MetControllerReading *pReading) |
| Hand one recorded controller reading to the input map. | |
| void | PostExit (int nMode, int bContinueJukebox, int bRestart) |
| Queue an ExitCmd built from three values. | |
| void | Exit (int nMode, int bContinueJukebox, int bRestart) |
| Leave the game in one of three modes. | |
| void | OnCripplePacket (Message *pMsg) |
| Hand a CripplePacket to the delayer. | |
| void | OnBumpPacket (Message *pMsg) |
| Hand a BumpPacket to the track selector. | |
| void | SetNetIO (MsgSink *pSink, MsgSource *pSource) |
| Install the sink and the source the gamer is wired to. | |
| void | StartLoad (const HxStr &path) |
| Create the level and begin reading its MIDI file asynchronously. | |
| int | IsLoadDone () |
| Report whether the MIDI file read has completed. | |
| void | FinishLoad () |
| Convert the MIDI file into the level and adopt the level's tempo map. | |
| void | PrepareLevel () |
| Prepare the loaded level for play. | |
| void | StartPlay () |
| Starts play on a prepared level. | |
| void | AddNetPlayer (int nId, int nUnused, const HxStr &name, const FreqAppearance *pAppearance) |
| Create a remote player and append it to mPlayers. | |
| 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 | RemovePlayer (int nId) |
| Remove the first player with an identifier from mPlayers, without destroying it. | |
| void | KillRenderer () |
| Detach the renderer from every source that feeds it and delete it. | |
| void | SavePhrases (OBStream &stream) |
| Write the phrase database of every score track graph. | |
| void | LoadPhrases (IBStream &stream, int bClearOwners) |
| Read the phrase database of every score track graph back. | |
| void | EnableInput () |
| Enable every entry of the input map. | |
| void | PostFinish () |
| Queue the finish exit, mode 1, with the current mContinueJukebox. | |
| void | PostQuit () |
| Queue the quit exit, mode 2. | |
| void | PostRestart () |
| Queue the restart exit, mode 3, with mRestart set. | |
| void | Shutdown () |
| Tear the world down ahead of destruction. | |
| Sch::TickClock * | GetSongClock () |
| Report the world's song clock. | |
| PlayMap * | GetPlayMap () |
| Report the level's play map. | |
| LevelData * | GetLevel () |
| RendererBase * | GetRendererSink () |
| Report the renderer's RendererBase half. | |
| void | MarkStatsFlag () |
| Set the statistics word at +0x14 of mStats to 1. | |
| void | DisplayText (const HxStr &text) |
| Show a line of text on the track displays. | |
| HxStr | GetSongName () const |
| Report the jukebox song title. | |
| 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 RawController | |
| virtual | ~RawController () |
Public Attributes | |
| InputMap * | mInputMap |
| The input map of the world's players. | |
| Gamer * | mGamer |
| The scoring state. | |
| ForceFeedbackMgr * | mForceFeedback |
| Vibration driver of the controllers. | |
| std::vector< ScoreTrackGraph * > | mTrackGraphs |
| std::vector< Player * > | mPlayers |
| Every player in the world, in slot order. | |
| std::vector< Player * > | mLocalPlayers |
| The players this console drives. | |
| int | mIsPlayback |
| Non-zero while the world plays back a recording. | |
| int | mIsTutorial |
| Non-zero in a tutorial level, from the tutorial configuration flag 0x3a1. | |
| HxStr | mSongName |
| Song title shown in jukebox mode. | |
| int | mContinueJukebox |
| Non-zero while a jukebox session goes on to its next song. | |
Friends | |
| class | InputPoller |
Owner of the world a game session runs in.
Its RTTI descriptor is at 0x008eff70. It has MsgSink as a public base at offset 0 and RawController as a public base at +0x04. The allocation in GameManagerImpl::CreateWorld() fixes the object at 0xbc bytes. The tagged release at 0x00194d5c records the translation unit as GrooveWorld.cpp with line 302. ControllerCmd and the file-local FuncCmd and ExitCmd share the unit.
Two vtables belong to the class, and the secondary one precedes the primary one in memory. The RawController subobject addresses 0x007dc628, whose three entries each adjust this by -4, and the MsgSink subobject addresses 0x007dc648 with no adjustment. The primary table has four entries and a zero terminator at index 4, the type function at 0x001936f8, the destructor at 0x0018c368, the inherited MsgSink::Dispatch() at 0x00105158, and the DispatchPriv() override below. The secondary table has three entries and a zero terminator at index 3, the same type function and destructor followed by the RawController override below.
The member map comes from the constructor, the destructor, and BuildGraphs(). BuildGraphs() creates the input map, the track selector, the message joiner, the delayer, the gamer, the synthesiser, and the score track graphs, and each type is resolved through the table its constructor installs. mState steps through 1 while the level file loads, 2 once it is converted, 4 while the world accepts controller readings, and 6 on one shutdown path.
GameManagerImpl reads mInputMap from three of its handlers, writes mIsPlayback from its load path and its begin-game handler, and reads mIsTutorial from its unpause handler. 0x0018dc88 and 0x0018de38 both run once the world is ready.
| GrooveWorld::GrooveWorld | ( | Application * | pApp, |
| GameStats * | pStats ) |
Construct an empty world.
It clears every member except the three load-buffer words, sets mContinueJukebox to 1, and creates the song clock on the application's Sch::Scheduler with no tempo map, the cheat detector over g_gameCheatSequences, and the force-feedback manager.
| pApp | The application. |
| pStats | The game manager's statistics. |
|
virtual |
|
virtual |
Route a CripplePacket to the delayer and a BumpPacket to the track selector.
Slot 3 of the primary table. Each identity is confirmed by the Type() slot that returns it, CripplePacket::Type() at 0x003f0cd8 and BumpPacket::Type() at 0x003f0ef8. A message matching neither is discarded. The two forwarders below are expanded inline here.
| pMsg | The message to route. |
Implements MsgSink.
|
virtual |
Report a controller reading.
Slot 2 of the secondary table.
The body returns at once unless mState is 4, and passes the reading to the cheat detector unless mIsTutorial is set. In jukebox mode a joystick press of button 10 clears mContinueJukebox and posts the finish exit, and every other reading is dropped. While a playback runs, a joystick press of any button below 100 posts the finish exit. Otherwise a joystick press of button 10 from a local pad posts the finish exit once a solo game song is complete, and queues a PauseGameSystemMsg and stops the riffs in any other case. Every remaining reading is queued as a ControllerCmd for replay, unless mIgnoreReadings is set outside a playback.
| nTag | The device tag, a four-character code. |
| nPadIndex | The controller that produced the reading, from 1. |
| nButton | The button or axis control number. |
| flValue | The reading's value. |
Implements RawController.
| void GrooveWorld::ReplayControllerReading | ( | const MetControllerReading * | pReading | ) |
Hand one recorded controller reading to the input map.
It returns at once unless the input map exists and mState is 4, and otherwise builds a RawControllerMsg from the reading and the song clock's position on the stack and passes it to InputMap's MsgSink half. ControllerCmd::Execute() is the recovered caller.
| pReading | The reading. |
| void GrooveWorld::PostExit | ( | int | nMode, |
| int | bContinueJukebox, | ||
| int | bRestart ) |
Queue an ExitCmd built from three values.
Does nothing unless mState is 4, and otherwise sets mState to 5. While a playback runs, or when bRestart is set, it runs Exit() at once. Otherwise it queues the ExitCmd on the application's watchdog timer with no delay, as a recordable command. PostFinish(), PostQuit(), and PostRestart() are the recovered callers.
| nMode | The value Exit() stores in mExitMode. |
| bContinueJukebox | The value Exit() stores in mContinueJukebox. |
| bRestart | The value Exit() stores in mRestart. |
| void GrooveWorld::Exit | ( | int | nMode, |
| int | bContinueJukebox, | ||
| int | bRestart ) |
Leave the game in one of three modes.
It stores nMode in mExitMode, bContinueJukebox in mContinueJukebox, and bRestart in mRestart, stops the riffs and disables the input map, and sends a GameOverMsg to the delayer. The fade is 5000 milliseconds in jukebox mode, 3000 for the finish exit or a running playback, and 1000 otherwise, and the screen fade sent to the delayer runs 500 longer. The synthesiser fades out over the same length for the finish exit or a playback. Otherwise the notes stop at once, the watchdog takes a snapshot, and the song clock pauses. It then stops the force feedback and queues FinishSong() 600 milliseconds after the fade. ExitCmd::Execute() is the recovered caller.
| nMode | The exit mode. |
| bContinueJukebox | Stored in mContinueJukebox. |
| bRestart | Stored in mRestart. |
| void GrooveWorld::OnCripplePacket | ( | Message * | pMsg | ) |
Hand a CripplePacket to the delayer.
DispatchPriv() expands this body inline, and a second out-of-line copy sits at 0x00194b20.
| pMsg | The packet. |
| void GrooveWorld::OnBumpPacket | ( | Message * | pMsg | ) |
Hand a BumpPacket to the track selector.
DispatchPriv() expands this body inline.
| pMsg | The packet. |
Install the sink and the source the gamer is wired to.
The source is retained only in game mode 3, and a null pointer is stored otherwise. The image has no caller, and the network role of both is inferred from that game mode.
| pSink | The sink stored in mNetSink. |
| pSource | The source stored in mNetSource in game mode 3. |
| void GrooveWorld::StartLoad | ( | const HxStr & | path | ) |
Create the level and begin reading its MIDI file asynchronously.
The read is submitted with no zone current, and mState becomes 1.
| path | The file to read. An empty path reads g_szEmptyString. |
| int GrooveWorld::IsLoadDone | ( | ) |
Report whether the MIDI file read has completed.
A failed read is reported through Fatal().
| void GrooveWorld::FinishLoad | ( | ) |
Convert the MIDI file into the level and adopt the level's tempo map.
The buffer the read filled is released, and mState becomes 2.
| void GrooveWorld::PrepareLevel | ( | ) |
Prepare the loaded level for play.
Resets the synthesiser through its slots 5 and 6, sets its jam flag from the play mode, runs BuildGraphs(), CreateRenderer(), and ConnectPlayers(), starts the streamed audio named by configuration code 0x3a5 when code 0x3a4 is set, and reads the start offset from code 0x38d as the negated song start clamped to the finite range. It then stores the tutorial flag, configuration code 0x3a1, in mIsTutorial and sets mState to 3. GameManagerImpl's FinishWorldLoad() and Load() call it after FinishLoad(). The title is inferred.
| void GrooveWorld::StartPlay | ( | ) |
Starts play on a prepared level.
Disables the input map entries, flushes the watchdog, resumes mSongClock, starts the note destroyer, and sets mState to 4. It runs synthesiser slot 10 and builds the mIntroGraphs sequencers. Unless mIsTutorial is set, it posts EnableInput() half a quantum of the first track ahead of the song start, and it always posts StartSequencers() at the start. It sends a GameBeginMsg to the delayer and the joiner and a one-second FadeGameMsg that fades in to the delayer, resets the statistics for the player count, runs Player slot 11 on every player, and configures the force feedback manager (jukebox mode, mIsPlayback, the settings flag, the local player count, and a metronome 3200 ticks ahead). GameManagerImpl::StartPlay() is the only caller. The title is inferred.
| void GrooveWorld::AddNetPlayer | ( | int | nId, |
| int | nUnused, | ||
| const HxStr & | name, | ||
| const FreqAppearance * | pAppearance ) |
Create a remote player and append it to mPlayers.
| nId | The player's identifier, passed to NetPlayer twice. |
| nUnused | Not read. |
| name | The player's name. |
| pAppearance | The appearance the player is drawn with. |
| void GrooveWorld::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.
The track is nId, except in solo mode, where it is configuration code 0x3a6 minus 1. The player receives the persona's appearance (MetPersonaData::mAppearance). The title is inferred.
| nId | The player's identifier. |
| nInputSlot | The controller slot. |
| nUnused | Not read. GameManagerImpl::AddPersonaPlayers() passes the shuffled index. |
| colorName | The player's colour name. |
| pPersona | The persona the player plays as. |
| void GrooveWorld::RemovePlayer | ( | int | nId | ) |
Remove the first player with an identifier from mPlayers, without destroying it.
| nId | The identifier to match against Player::mPlayerId. |
| void GrooveWorld::KillRenderer | ( | ) |
Detach the renderer from every source that feeds it and delete it.
| void GrooveWorld::SavePhrases | ( | OBStream & | stream | ) |
Write the phrase database of every score track graph.
| stream | The stream to write to. |
| void GrooveWorld::LoadPhrases | ( | IBStream & | stream, |
| int | bClearOwners ) |
Read the phrase database of every score track graph back.
| stream | The stream to read from. |
| bClearOwners | Non-zero to return every loaded phrase to the stand-in player. |
| void GrooveWorld::EnableInput | ( | ) |
Enable every entry of the input map.
| void GrooveWorld::PostFinish | ( | ) |
Queue the finish exit, mode 1, with the current mContinueJukebox.
Gamer posts it at the end of a song, the stop-game script command posts it, and GameManagerImpl posts it when a press interrupts a playback.
| void GrooveWorld::PostQuit | ( | ) |
Queue the quit exit, mode 2.
The pause menu's quit item posts it.
| void GrooveWorld::PostRestart | ( | ) |
Queue the restart exit, mode 3, with mRestart set.
The pause menu's restart item posts it.
| void GrooveWorld::Shutdown | ( | ) |
Tear the world down ahead of destruction.
It runs StopLevel() when mState is 6 and DeletePlayers() always, deletes the level, the song clock, the cheat detector, and mForceFeedback, and then stops and destroys the note destroyer through StopNoteDestroyer() and DestroyNoteDestroyer(). The destructor is the recovered caller.
| Sch::TickClock * GrooveWorld::GetSongClock | ( | ) |
Report the world's song clock.
Globals::GetSongClock() is the out-of-line caller, and the constructor creates the clock.
| PlayMap * GrooveWorld::GetPlayMap | ( | ) |
Report the level's play map.
Globals' accessor at 0x00118da0 is the recovered caller.
| LevelData * GrooveWorld::GetLevel | ( | ) |
| RendererBase * GrooveWorld::GetRendererSink | ( | ) |
Report the renderer's RendererBase half.
GameManagerImpl::DrawFrame() runs RendererBase slots 6, 7, and 8 through it, and skips the world when it is null.
| void GrooveWorld::MarkStatsFlag | ( | ) |
Set the statistics word at +0x14 of mStats to 1.
| void GrooveWorld::DisplayText | ( | const HxStr & | text | ) |
Show a line of text on the track displays.
Sends a TextMsg through mDelayer, and does nothing before mDelayer exists. The script binding at 0x00153464 is the caller.
| text | The text. |
| HxStr GrooveWorld::GetSongName | ( | ) | const |
Report the jukebox song title.
The image has no caller. Overlay copies mSongName directly instead. The name is inferred.
|
friend |
| InputMap* GrooveWorld::mInputMap |
The input map of the world's players.
+0x0c
Public because GameManagerImpl::OnUnpauseGameSystem() rebuilds it directly at 0x00106b74, and the image has no accessor for it.
| Gamer* GrooveWorld::mGamer |
The scoring state.
+0x2c
Public because the juice, section, and track cheats reach it through Globals::GetWorld() with no accessor in the image.
| ForceFeedbackMgr* GrooveWorld::mForceFeedback |
Vibration driver of the controllers.
+0x34
Built by the constructor at 0x0016dae0 and deleted by Shutdown(). Public because TnlCrippleFX's frame routine at 0x0043e500 reads it through Globals::GetWorld() with no accessor in the image.
| std::vector<ScoreTrackGraph *> GrooveWorld::mTrackGraphs |
| std::vector<Player *> GrooveWorld::mPlayers |
| std::vector<Player *> GrooveWorld::mLocalPlayers |
The players this console drives.
+0x74
The element type is proven by the routine at 0x00102790, which reads the identifier at +0x20 of the first element. The role is inferred from Renderer, which resolves one tnl locald.view per element. Public because Renderer and AppTunnel read it directly, and the image has no accessor for it.
| int GrooveWorld::mIsPlayback |
Non-zero while the world plays back a recording.
+0x8c
GameManagerImpl::OnBeginGameLocal() clears it at 0x001067c4, and GameManagerImpl::Load() (run by GamePlaybacker) sets it at 0x001074b8. StartPlay() passes it to the force feedback manager. Public because both GameManagerImpl routines write it directly, and the image has no accessor for it.
| int GrooveWorld::mIsTutorial |
Non-zero in a tutorial level, from the tutorial configuration flag 0x3a1.
+0x90
GameManagerImpl::OnUnpauseGameSystem() reads it directly at 0x00106b54 and rebuilds mInputMap only while it is zero. The image has no accessor for it.
| HxStr GrooveWorld::mSongName |
| int GrooveWorld::mContinueJukebox |
Non-zero while a jukebox session goes on to its next song.
Starts at 1. +0xb8
A pause press in jukebox mode clears it, PostFinish() posts it with the exit, and EndLevel() skips the synthesiser's LoadBankSet4() while it is set in jukebox mode. Public because GameManagerImpl::EndGame() reads it directly at 0x00106c30 and announces MetFreqEndedMsg(1) only while it is zero. The image has no accessor for it.