wavelength 1.0.0
Loading...
Searching...
No Matches
World Class Referenceabstract

One game in progress under one rule set. More...

#include <world.h>

Inheritance diagram for World:
Collaboration diagram for World:

Public Types

enum  State {
  kStateIdle = 0 , kStateLoading = 1 , kStateLoaded = 2 , kStatePlaying = 3 ,
  kStateEnding = 4 , kStateRestarting = 5
}
 Values of mState. More...
enum  LoadStep {
  kLoadStepDemo = 0 , kLoadStepSong = 1 , kLoadStepTracks = 2 , kLoadStepMusic = 3 ,
  kLoadStepAssets = 4 , kLoadStepSession = 5 , kLoadStepComplete = 6
}
 Values of mLoadStep. More...

Public Member Functions

 World ()
 Construct a world with no game state.
 ~World () override
 Release the world.
bool DispatchPriv (Message *pMsg) override
 Act on a message sent to the world.
virtual int GetRuleSet () const =0
 Report the rule set the world plays under.
virtual bool IsFinished ()=0
 Report whether the running world has ended.
virtual float GetDisplayTime ()
 Report how far the running world has played, from WorldLogic::GetProgress().
virtual void Handle (const RotateEvent &event)=0
 Act on a rotation from the input router.
virtual void Handle (const PlayNoteEvent &event)=0
 Act on a gem button from the input router.
virtual void Handle (const BtnEvent< 8 > &event)=0
 Act on a button event of command 8 from the input router.
virtual void Handle (const StickEvent< 2 > &event)=0
 Act on a stick event of command 2 from the input router.
virtual void Handle (const StickEvent< 6 > &event)=0
 Act on a stick event of command 6 from the input router.
virtual void Handle (const BtnEvent< 3 > &event)=0
 Act on a button event of command 3 from the input router.
virtual void Handle (const BtnEvent< 4 > &event)=0
 Act on a button event of command 4 from the input router.
virtual void Handle (const BtnEvent< 5 > &event)=0
 Act on a button event of command 5 from the input router.
virtual void Handle (const ChangeSectionEvent &event)=0
 Act on a section change from the input router.
virtual void Handle (const BtnEvent< 9 > &event)=0
 Act on a button event of command 9 from the input router.
virtual void Handle (const BtnEvent< 10 > &event)=0
 Act on a button event of command 10 from the input router.
virtual void BeginAssetLoad ()=0
 Start loading the assets of the second loading stage.
virtual void PollAssetLoad ()=0
 Advance the second loading stage by one frame.
virtual bool IsAssetLoadDone ()=0
 Report whether the second loading stage finished.
virtual void BeginSongLoad ()=0
 Start loading the song, the first loading stage.
virtual void PollSongLoad ()=0
 Advance the first loading stage by one frame.
virtual bool IsSongLoadDone ()=0
 Report whether the first loading stage finished.
virtual void BeginEnding ()
 Start the sequence that follows the end of the game.
virtual void PollEnding ()
 Advance the sequence that follows the end of the game by one frame.
virtual bool IsEndingDone ()
 Report whether the sequence that follows the end of the game finished.
virtual void CreateLogic ()=0
 Build the WorldLogic of the rule set and install it with SetLogic().
virtual void Record (const RotateEvent &event)
 Record a rotation as a serializable input command.
virtual void Record (const PlayNoteEvent &event)
 Record a gem button as a serializable input command.
virtual void Record (const BtnEvent< 8 > &event)
 Record a button event of command 8.
virtual void Record (const StickEvent< 2 > &event)
 Record a stick event of command 2.
virtual void Record (const StickEvent< 6 > &event)
 Record a stick event of command 6.
virtual void Record (const BtnEvent< 3 > &event)
 Record a button event of command 3.
virtual void Record (const BtnEvent< 4 > &event)
 Record a button event of command 4.
virtual void Record (const BtnEvent< 5 > &event)
 Record a button event of command 5.
virtual void Record (const ChangeSectionEvent &event)
 Record a section change.
virtual void Record (const BtnEvent< 9 > &event)
 Record a button event of command 9.
virtual void Record (const BtnEvent< 10 > &event)
 Record a button event of command 10.
virtual void OnStart ()
 Finish starting the song, after Start() created the logic.
virtual void BuildTracks (int nStartTick)=0
 Build the track display for the song.
void Start ()
 Start the song of a world that finished loading.
void Stop ()
 Stop the song and release what Start() and LoadAssets() created.
int IsRestartRequested ()
 Report whether the world that ended requested a restart.
bool IsFreestyling (int nPlayer)
 Report whether a player is in a freestyle while the song plays.
void Poll ()
 Advance the world by one frame.
bool IsLoaded () const
 Report whether the assets LoadAssets() started are loaded.
void LoadAssets ()
 Start loading the song and the assets of the world.
int GetTick ()
 Report the song position in ticks.
float GetTime ()
 Report the song position on the song clock.
void SetLogic (WorldLogic *pLogic)
 Destroy the installed logic and install another.
Public Member Functions inherited from MsgSink
void * operator new (size_t nSize)
 Allocate a sink from the pool heaps under the tag "MsgSink".
void operator delete (void *pBlock)
 Return a sink to the pool heaps.
virtual ~MsgSink ()
virtual bool Dispatch (Message *pMsg)
 Accept a message.
void * operator new (size_t size)
 Allocate from the main heap under the name MsgSink.
void operator delete (void *mem)
 Return memory to its heap.
virtual ~MsgSink ()
 Destroy the sink.
virtual bool Dispatch (Message *msg)
 Handle a message.

Protected Attributes

std::unique_ptr< Song > mSong
DataArray * mSongConfig
int mSeed

Detailed Description

One game in progress under one rule set.

The RTTI records the class as deriving from MsgSink. Game, Remix, and Duel derive from it, one for each rule set WorldMgr::Load() can build. LoadAssets() builds the Song, and Poll() steps the load through mLoadStep. Start() starts the song clock and installs the logic, which TheWorldLogic addresses. A logic that ends because the player quit plays the ending and starts the song again. An online world holds the session messages that arrive before the song starts and passes them to the logic once it starts.

Member Enumeration Documentation

◆ State

Values of mState.

Enumerator
kStateIdle 

Nothing was loaded.

kStateLoading 

LoadAssets() runs the load steps.

kStateLoaded 

The load finished, and the world can start.

kStatePlaying 

The song plays.

kStateEnding 

The ending of a quit song plays.

kStateRestarting 

The song starts again on the next poll.

◆ LoadStep

Values of mLoadStep.

Enumerator
kLoadStepDemo 

The demo recording is read.

kLoadStepSong 

The song loads.

kLoadStepTracks 

The first loading stage runs.

kLoadStepMusic 

The front-end music fades out.

kLoadStepAssets 

The second loading stage runs.

kLoadStepSession 

The online session's start message is awaited.

kLoadStepComplete 

Every step finished.

Constructor & Destructor Documentation

◆ World()

World::World ( )

Construct a world with no game state.

Ghidra address:
NTSC-U/C: 0x00144330
Ghidra address:
PAL: 0x00145cc0

◆ ~World()

World::~World ( )
override

Release the world.

Ghidra address:
NTSC-U/C: 0x001443f0
Ghidra address:
PAL: 0x00145d80

Member Function Documentation

◆ DispatchPriv()

bool World::DispatchPriv ( Message * pMsg)
overridevirtual

Act on a message sent to the world.

Parameters
pMsgThe message.
Returns
False, for every message.
Ghidra address:
NTSC-U/C: 0x00145778
Ghidra address:
PAL: 0x00147108

Implements MsgSink.

◆ GetRuleSet()

virtual int World::GetRuleSet ( ) const
pure virtual

Report the rule set the world plays under.

The member is pure in this class.

Returns
One of GameDb::RuleSet.

Implemented in Duel, Game, and Remix.

◆ IsFinished()

virtual bool World::IsFinished ( )
pure virtual

Report whether the running world has ended.

The member is pure in this class. The name is inferred.

Returns
Whether the world has ended.

Implemented in Duel, Game, and Remix.

◆ GetDisplayTime()

virtual float World::GetDisplayTime ( )
virtual

Report how far the running world has played, from WorldLogic::GetProgress().

The name is inferred.

Returns
The fraction, or 0 when the world is not running.
Ghidra address:
NTSC-U/C: 0x001451f8
Ghidra address:
PAL: 0x00146b88

◆ Handle() [1/11]

virtual void World::Handle ( const RotateEvent & event)
pure virtual

Act on a rotation from the input router.

The member is pure in this class.

Parameters
eventThe rotation.

Implemented in Duel, Game, and Remix.

◆ Handle() [2/11]

virtual void World::Handle ( const PlayNoteEvent & event)
pure virtual

Act on a gem button from the input router.

The member is pure in this class.

Parameters
eventThe button.

Implemented in Duel, Game, and Remix.

◆ Handle() [3/11]

virtual void World::Handle ( const BtnEvent< 8 > & event)
pure virtual

Act on a button event of command 8 from the input router.

The member is pure in this class.

Parameters
eventThe button.

Implemented in Duel, Game, and Remix.

◆ Handle() [4/11]

virtual void World::Handle ( const StickEvent< 2 > & event)
pure virtual

Act on a stick event of command 2 from the input router.

The member is pure in this class.

Parameters
eventThe stick position.

Implemented in Duel, Game, and Remix.

◆ Handle() [5/11]

virtual void World::Handle ( const StickEvent< 6 > & event)
pure virtual

Act on a stick event of command 6 from the input router.

The member is pure in this class.

Parameters
eventThe stick position.

Implemented in Duel, Game, and Remix.

◆ Handle() [6/11]

virtual void World::Handle ( const BtnEvent< 3 > & event)
pure virtual

Act on a button event of command 3 from the input router.

The member is pure in this class.

Parameters
eventThe button.

Implemented in Duel, Game, and Remix.

◆ Handle() [7/11]

virtual void World::Handle ( const BtnEvent< 4 > & event)
pure virtual

Act on a button event of command 4 from the input router.

The member is pure in this class.

Parameters
eventThe button.

Implemented in Duel, Game, and Remix.

◆ Handle() [8/11]

virtual void World::Handle ( const BtnEvent< 5 > & event)
pure virtual

Act on a button event of command 5 from the input router.

The member is pure in this class.

Parameters
eventThe button.

Implemented in Duel, Game, and Remix.

◆ Handle() [9/11]

virtual void World::Handle ( const ChangeSectionEvent & event)
pure virtual

Act on a section change from the input router.

The member is pure in this class.

Parameters
eventThe section change.

Implemented in Duel, Game, and Remix.

◆ Handle() [10/11]

virtual void World::Handle ( const BtnEvent< 9 > & event)
pure virtual

Act on a button event of command 9 from the input router.

The member is pure in this class.

Parameters
eventThe button.

Implemented in Duel, Game, and Remix.

◆ Handle() [11/11]

virtual void World::Handle ( const BtnEvent< 10 > & event)
pure virtual

Act on a button event of command 10 from the input router.

The member is pure in this class.

Parameters
eventThe button.

Implemented in Duel, Game, and Remix.

◆ BeginAssetLoad()

virtual void World::BeginAssetLoad ( )
pure virtual

Start loading the assets of the second loading stage.

The member is pure in this class. The name is inferred.

Implemented in Duel, Game, and Remix.

◆ PollAssetLoad()

virtual void World::PollAssetLoad ( )
pure virtual

Advance the second loading stage by one frame.

The member is pure in this class. The name is inferred.

Implemented in Duel, Game, and Remix.

◆ IsAssetLoadDone()

virtual bool World::IsAssetLoadDone ( )
pure virtual

Report whether the second loading stage finished.

The member is pure in this class. The name is inferred.

Returns
Whether the assets are loaded.

Implemented in Duel, Game, and Remix.

◆ BeginSongLoad()

virtual void World::BeginSongLoad ( )
pure virtual

Start loading the song, the first loading stage.

The member is pure in this class. The name is inferred.

Implemented in Duel, Game, and Remix.

◆ PollSongLoad()

virtual void World::PollSongLoad ( )
pure virtual

Advance the first loading stage by one frame.

The member is pure in this class. The name is inferred.

Implemented in Duel, Game, and Remix.

◆ IsSongLoadDone()

virtual bool World::IsSongLoadDone ( )
pure virtual

Report whether the first loading stage finished.

The member is pure in this class. The name is inferred.

Returns
Whether the song is loaded.

Implemented in Duel, Game, and Remix.

◆ BeginEnding()

virtual void World::BeginEnding ( )
inlinevirtual

Start the sequence that follows the end of the game.

The base body is empty. The name is inferred.

Ghidra address:
NTSC-U/C: 0x003455c0
Ghidra address:
PAL: 0x003b2af8

Reimplemented in Duel, and Game.

◆ PollEnding()

virtual void World::PollEnding ( )
inlinevirtual

Advance the sequence that follows the end of the game by one frame.

The base body is empty. The name is inferred.

Ghidra address:
NTSC-U/C: 0x003455c8
Ghidra address:
PAL: 0x003b2b00

Reimplemented in Duel, and Game.

◆ IsEndingDone()

virtual bool World::IsEndingDone ( )
inlinevirtual

Report whether the sequence that follows the end of the game finished.

The name is inferred.

Returns
True in this class.
Ghidra address:
NTSC-U/C: 0x003455d0
Ghidra address:
PAL: 0x003b2b08

Reimplemented in Duel, and Game.

◆ CreateLogic()

virtual void World::CreateLogic ( )
pure virtual

Build the WorldLogic of the rule set and install it with SetLogic().

The member is pure in this class. The name is inferred.

Implemented in Duel, Game, and Remix.

◆ Record() [1/11]

virtual void World::Record ( const RotateEvent & event)
virtual

Record a rotation as a serializable input command.

Parameters
eventThe rotation.
Ghidra address:
NTSC-U/C: 0x001441d0
Ghidra address:
PAL: 0x00145b60

◆ Record() [2/11]

virtual void World::Record ( const PlayNoteEvent & event)
virtual

Record a gem button as a serializable input command.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x001441f0
Ghidra address:
PAL: 0x00145b80

◆ Record() [3/11]

virtual void World::Record ( const BtnEvent< 8 > & event)
virtual

Record a button event of command 8.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x00144210
Ghidra address:
PAL: 0x00145ba0

◆ Record() [4/11]

virtual void World::Record ( const StickEvent< 2 > & event)
virtual

Record a stick event of command 2.

Parameters
eventThe stick position.
Ghidra address:
NTSC-U/C: 0x00144230
Ghidra address:
PAL: 0x00145bc0

◆ Record() [5/11]

virtual void World::Record ( const StickEvent< 6 > & event)
virtual

Record a stick event of command 6.

Parameters
eventThe stick position.
Ghidra address:
NTSC-U/C: 0x00144250
Ghidra address:
PAL: 0x00145be0

◆ Record() [6/11]

virtual void World::Record ( const BtnEvent< 3 > & event)
virtual

Record a button event of command 3.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x00144270
Ghidra address:
PAL: 0x00145c00

◆ Record() [7/11]

virtual void World::Record ( const BtnEvent< 4 > & event)
virtual

Record a button event of command 4.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x00144290
Ghidra address:
PAL: 0x00145c20

◆ Record() [8/11]

virtual void World::Record ( const BtnEvent< 5 > & event)
virtual

Record a button event of command 5.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x001442b0
Ghidra address:
PAL: 0x00145c40

◆ Record() [9/11]

virtual void World::Record ( const ChangeSectionEvent & event)
virtual

Record a section change.

Parameters
eventThe section change.
Ghidra address:
NTSC-U/C: 0x001442d0
Ghidra address:
PAL: 0x00145c60

◆ Record() [10/11]

virtual void World::Record ( const BtnEvent< 9 > & event)
virtual

Record a button event of command 9.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x001442f0
Ghidra address:
PAL: 0x00145c80

◆ Record() [11/11]

virtual void World::Record ( const BtnEvent< 10 > & event)
virtual

Record a button event of command 10.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x00144310
Ghidra address:
PAL: 0x00145ca0

◆ OnStart()

virtual void World::OnStart ( )
inlinevirtual

Finish starting the song, after Start() created the logic.

The base body is empty. The name is inferred.

Ghidra address:
NTSC-U/C: 0x003455d8
Ghidra address:
PAL: 0x003b2b10

Reimplemented in Duel, and Game.

◆ BuildTracks()

virtual void World::BuildTracks ( int nStartTick)
pure virtual

Build the track display for the song.

The member is pure in this class. The name is inferred.

Parameters
nStartTickThe tick the song starts at, before its first bar.

Implemented in Duel, Game, and Remix.

◆ Start()

void World::Start ( )

Start the song of a world that finished loading.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x001445c0
Ghidra address:
PAL: 0x00145f50

◆ Stop()

void World::Stop ( )

Stop the song and release what Start() and LoadAssets() created.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x001446c0
Ghidra address:
PAL: 0x00146050

◆ IsRestartRequested()

int World::IsRestartRequested ( )

Report whether the world that ended requested a restart.

The name is inferred.

Returns
The value of WorldLogic::IsRestartRequested() while the song plays, and 0 otherwise.
Ghidra address:
NTSC-U/C: 0x00144908
Ghidra address:
PAL: 0x00146298

◆ IsFreestyling()

bool World::IsFreestyling ( int nPlayer)

Report whether a player is in a freestyle while the song plays.

Parameters
nPlayerThe player.
Returns
Whether the player is in a freestyle, and false while the song does not play.
Ghidra address:
NTSC-U/C: 0x00144948
Ghidra address:
PAL: 0x001462d8

◆ Poll()

void World::Poll ( )

Advance the world by one frame.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00144988
Ghidra address:
PAL: 0x00146318

◆ IsLoaded()

bool World::IsLoaded ( ) const

Report whether the assets LoadAssets() started are loaded.

The name is inferred.

Returns
Whether the world is ready to start.
Ghidra address:
NTSC-U/C: 0x00144f80
Ghidra address:
PAL: 0x00146910

◆ LoadAssets()

void World::LoadAssets ( )

Start loading the song and the assets of the world.

The name is inferred.

Ghidra address:
NTSC-U/C: 0x00144f90
Ghidra address:
PAL: 0x00146920

◆ GetTick()

int World::GetTick ( )

Report the song position in ticks.

The name is inferred.

Returns
The position.
Ghidra address:
NTSC-U/C: 0x00145130
Ghidra address:
PAL: 0x00146ac0

◆ GetTime()

float World::GetTime ( )

Report the song position on the song clock.

The name is inferred.

Returns
The position.
Ghidra address:
NTSC-U/C: 0x001451a8
Ghidra address:
PAL: 0x00146b38

◆ SetLogic()

void World::SetLogic ( WorldLogic * pLogic)

Destroy the installed logic and install another.

The name is inferred.

Parameters
pLogicThe logic to install.
Ghidra address:
NTSC-U/C: 0x00144550
Ghidra address:
PAL: 0x00145ee0

Member Data Documentation

◆ mSong

std::unique_ptr<Song> World::mSong
protected

The song LoadAssets() built.

◆ mSongConfig

DataArray* World::mSongConfig
protected

The entry of the song in "songs". Borrowed.

◆ mSeed

int World::mSeed
protected

The seed of the logic's random numbers.


The documentation for this class was generated from the following file: