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

Rules of one World, the base of the game, remix, and duel logic. More...

#include <worldlogic.h>

Inheritance diagram for WorldLogic:
Collaboration diagram for WorldLogic:

Public Member Functions

 WorldLogic ()
 Construct the logic and give the input of every controller to the world.
 ~WorldLogic () override
 Release the logic.
bool DispatchPriv (Message *pMsg) override
 Pass a JoypadConnectionMsg to OnJoypadConnection() and ignore any other message.
virtual void Start ()=0
 Start the song.
virtual void Stop ()=0
 Stop the song.
virtual bool IsFinished () const =0
 Report whether the song is over.
virtual int HasQuit () const =0
 Report whether a player quit the song.
virtual int IsRestartRequested () const =0
 Report whether the song is to start again once it ends.
virtual bool IsFreestyling (int nPlayer)=0
 Report whether a player plays the freestyle track.
virtual int GetTick ()=0
 Report the song position.
virtual float GetTime ()=0
 Report the song time.
virtual void Poll ()=0
 Advance the logic once per frame.
virtual float GetProgress ()=0
 Report how much of the song has been played.
virtual void HandleInput (const RotateEvent &event)=0
 Act on a rotation.
virtual void HandleInput (const PlayNoteEvent &event)=0
 Act on a played note.
virtual void HandleInput (const BtnEvent< 3 > &event)=0
 Act on a button event.
virtual void HandleInput (const BtnEvent< 4 > &event)=0
 Act on a button event.
virtual void HandleInput (const BtnEvent< 5 > &event)=0
 Act on a button event.
virtual void HandleInput (const ChangeSectionEvent &event)=0
 Act on a section change.
virtual void HandleInput (const BtnEvent< 9 > &event)=0
 Act on a button event.
virtual void HandleInput (const BtnEvent< 10 > &event)=0
 Act on a button event.
virtual void HandleInput (const BtnEvent< 8 > &event)=0
 Act on a button event.
virtual void HandleInput (const StickEvent< 2 > &event)=0
 Act on a stick event.
virtual void HandleInput (const StickEvent< 6 > &event)=0
 Act on a stick event.
virtual void SetPaused (bool bPaused, int nPad, int nReason)
 Pause or resume the song.
virtual bool IsPlaying () const =0
 Report whether the song is playing.
void AllNotesOff ()
 Silence every synthesiser channel.
void ScheduleControllerCheck ()
 Pause the song again one tick from now when a controller is disconnected.
int OnJoypadConnection (JoypadConnectionMsg *pMsg)
 Pause the playing song when the controller of a player is disconnected.
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.

Static Public Member Functions

static int FindDisconnectedPad ()
 Find the controller of a player on this console that is disconnected.

Detailed Description

Rules of one World, the base of the game, remix, and duel logic.

The RTTI records the class as deriving from MsgSink. Every handler from Start() through IsPlaying() is pure in this class except SetPaused(). The world's input commands pass each controller event to the HandleInput() overload for its type. Only the members the derived logics here use are declared.

Constructor & Destructor Documentation

◆ WorldLogic()

WorldLogic::WorldLogic ( )

Construct the logic and give the input of every controller to the world.

Ghidra address:
NTSC-U/C: 0x00146a18
Ghidra address:
PAL: 0x001483a8

◆ ~WorldLogic()

WorldLogic::~WorldLogic ( )
override

Release the logic.

Ghidra address:
NTSC-U/C: 0x00146a90
Ghidra address:
PAL: 0x00148430

Member Function Documentation

◆ DispatchPriv()

bool WorldLogic::DispatchPriv ( Message * pMsg)
overridevirtual

Pass a JoypadConnectionMsg to OnJoypadConnection() and ignore any other message.

The PAL build also passes a KeyboardKeyMsg to OnKeyboardKey().

Parameters
pMsgThe message.
Returns
The result of the handler of the message, otherwise false.
Ghidra address:
NTSC-U/C: 0x00146db0
Ghidra address:
PAL: 0x00148768

Implements MsgSink.

◆ Start()

virtual void WorldLogic::Start ( )
pure virtual

Start the song.

Implemented in DuelLogic, GameLogic, and RemixLogic.

◆ Stop()

virtual void WorldLogic::Stop ( )
pure virtual

Stop the song.

Implemented in DuelLogic, GameLogic, and RemixLogic.

◆ IsFinished()

virtual bool WorldLogic::IsFinished ( ) const
pure virtual

Report whether the song is over.

Returns
True once the song is over.

Implemented in DuelLogic, GameLogic, and RemixLogic.

◆ HasQuit()

virtual int WorldLogic::HasQuit ( ) const
pure virtual

Report whether a player quit the song.

Returns
Non-zero when a player quit.

Implemented in DuelLogic, GameLogic, and RemixLogic.

◆ IsRestartRequested()

virtual int WorldLogic::IsRestartRequested ( ) const
pure virtual

Report whether the song is to start again once it ends.

World::IsRestartRequested() returns the value.

Returns
Non-zero when the song restarts.

Implemented in DuelLogic, GameLogic, and RemixLogic.

◆ IsFreestyling()

virtual bool WorldLogic::IsFreestyling ( int nPlayer)
pure virtual

Report whether a player plays the freestyle track.

Parameters
nPlayerThe player index.
Returns
True while the player plays the freestyle track.

Implemented in DuelLogic, GameLogic, and RemixLogic.

◆ GetTick()

virtual int WorldLogic::GetTick ( )
pure virtual

Report the song position.

Returns
The song position, in ticks.

Implemented in DuelLogic, MultiGameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ GetTime()

virtual float WorldLogic::GetTime ( )
pure virtual

Report the song time.

Returns
The song time, in milliseconds.

Implemented in DuelLogic, MultiGameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ Poll()

virtual void WorldLogic::Poll ( )
pure virtual

Advance the logic once per frame.

Implemented in DuelLogic, GameLogic, RemixLogic, and TutorialGameLogic.

◆ GetProgress()

virtual float WorldLogic::GetProgress ( )
pure virtual

Report how much of the song has been played.

Returns
The fraction played.

Implemented in DuelLogic, GameLogic, RemixLogic, and TutorialGameLogic.

◆ HandleInput() [1/11]

virtual void WorldLogic::HandleInput ( const RotateEvent & event)
pure virtual

Act on a rotation.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, MultiGameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [2/11]

virtual void WorldLogic::HandleInput ( const PlayNoteEvent & event)
pure virtual

Act on a played note.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [3/11]

virtual void WorldLogic::HandleInput ( const BtnEvent< 3 > & event)
pure virtual

Act on a button event.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [4/11]

virtual void WorldLogic::HandleInput ( const BtnEvent< 4 > & event)
pure virtual

Act on a button event.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [5/11]

virtual void WorldLogic::HandleInput ( const BtnEvent< 5 > & event)
pure virtual

Act on a button event.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [6/11]

virtual void WorldLogic::HandleInput ( const ChangeSectionEvent & event)
pure virtual

Act on a section change.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [7/11]

virtual void WorldLogic::HandleInput ( const BtnEvent< 9 > & event)
pure virtual

Act on a button event.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [8/11]

virtual void WorldLogic::HandleInput ( const BtnEvent< 10 > & event)
pure virtual

Act on a button event.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [9/11]

virtual void WorldLogic::HandleInput ( const BtnEvent< 8 > & event)
pure virtual

Act on a button event.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [10/11]

virtual void WorldLogic::HandleInput ( const StickEvent< 2 > & event)
pure virtual

Act on a stick event.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [11/11]

virtual void WorldLogic::HandleInput ( const StickEvent< 6 > & event)
pure virtual

Act on a stick event.

Parameters
eventThe event.

Implemented in DuelLogic, GameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ SetPaused()

virtual void WorldLogic::SetPaused ( bool bPaused,
int nPad,
int nReason )
virtual

Pause or resume the song.

The base body acts only on a resume, which calls ScheduleControllerCheck().

Parameters
bPausedPause the song.
nPadThe controller that paused the song, or -1.
nReasonNon-zero when a disconnected controller paused the song.
Ghidra address:
NTSC-U/C: 0x00146bc0
Ghidra address:
PAL: 0x00148570

Reimplemented in DuelLogic, GameLogic, MultiGameLogic, RemixLogic, SoloGameLogic, and TutorialGameLogic.

◆ IsPlaying()

virtual bool WorldLogic::IsPlaying ( ) const
pure virtual

Report whether the song is playing.

Returns
True while the song plays.

Implemented in DuelLogic, GameLogic, and RemixLogic.

◆ AllNotesOff()

void WorldLogic::AllNotesOff ( )

Silence every synthesiser channel.

Ghidra address:
NTSC-U/C: 0x00146b30
Ghidra address:
PAL: 0x001484e0

◆ ScheduleControllerCheck()

void WorldLogic::ScheduleControllerCheck ( )

Pause the song again one tick from now when a controller is disconnected.

The pause passes the controller FindDisconnectedPad() found and a non-zero reason to SetPaused(). The name is inferred.

Ghidra address:
NTSC-U/C: 0x00146be0
Ghidra address:
PAL: 0x00148590

◆ FindDisconnectedPad()

int WorldLogic::FindDisconnectedPad ( )
static

Find the controller of a player on this console that is disconnected.

A demo has none. The name is inferred.

Returns
The controller, or -1 when every controller is connected.
Ghidra address:
NTSC-U/C: 0x00146c48
Ghidra address:
PAL: 0x001485f8

◆ OnJoypadConnection()

int WorldLogic::OnJoypadConnection ( JoypadConnectionMsg * pMsg)

Pause the playing song when the controller of a player is disconnected.

A demo does not pause. The name is inferred.

Parameters
pMsgThe message.
Returns
0.
Ghidra address:
NTSC-U/C: 0x00146d00
Ghidra address:
PAL: 0x001486b0

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