wavelength 1.0.0
Loading...
Searching...
No Matches
DuelLogic Class Reference

Rules of the duel rule set. More...

#include <duellogic.h>

Inheritance diagram for DuelLogic:
Collaboration diagram for DuelLogic:

Classes

struct  BarData
 The data the duel records for each bar of the song. More...

Public Types

enum  State {
  kStateNone = 0 , kStatePlaying = 1 , kStatePaused = 2 , kStateDecided = 3 ,
  kStateEnding = 4 , kStateFinished = 5
}
 Values of mState. More...
enum  Phase { kPhasePitch = 0 , kPhaseCatch = 1 , kPhaseBreak = 2 }
 Values of mPhase and mCuePhase. More...

Public Member Functions

 DuelLogic (Song *pSong)
 Construct the rules for a song.
 ~DuelLogic () override
 Release the rules.
bool DispatchPriv (Message *pMsg) override
 Act on a message sent to the rules.
void Start () override
 Start the music, set the first roles, and schedule the commands of the duel.
void Stop () override
 End the duel.
bool IsFinished () const override
 Report whether the duel ended.
int HasQuit () const override
 Report whether a player abandoned the duel from a menu.
int IsRestartRequested () const override
 Report that no restart was requested.
bool IsFreestyling (int nPlayer) override
 Report that no player freestyles.
int GetTick () override
 Report the song position in ticks.
float GetTime () override
 Report the song position on the song clock.
void Poll () override
 Finish the duel once the song has faded out and the outro is done.
float GetProgress () override
 Report the fraction of the song played.
void HandleInput (const RotateEvent &event) override
 Ignore a rotation.
void HandleInput (const PlayNoteEvent &event) override
 Hand a gem button to the player who pressed it while the song plays.
void HandleInput (const BtnEvent< 3 > &event) override
 Pause the duel while the song plays.
void HandleInput (const BtnEvent< 4 > &event) override
 Ignore a button event of command 4.
void HandleInput (const BtnEvent< 5 > &event) override
 Ignore a button event of command 5.
void HandleInput (const ChangeSectionEvent &event) override
 Ignore a section change.
void HandleInput (const BtnEvent< 9 > &event) override
 Ignore a button event of command 9.
void HandleInput (const BtnEvent< 10 > &event) override
 Ignore a button event of command 10.
void HandleInput (const BtnEvent< 8 > &event) override
 Ignore a button event of command 8.
void HandleInput (const StickEvent< 2 > &event) override
 Ignore a stick event of command 2.
void HandleInput (const StickEvent< 6 > &event) override
 Ignore a stick event of command 6.
void SetPaused (bool bPaused, int nPad, int nReason) override
 Pause or resume the duel.
bool IsPlaying () const override
 Report whether the song plays.
int GetBarInstrument (int nBar)
 Report the instrument of the song track the duel plays in a bar.
int GetPlayerSide (int nPlayer) const
 Report the side of a player.
void StartEnding ()
 Fade the song out and schedule the end of the duel.
void OnCatchMissed (DuelTrack *pTrack, Player *pPlayer, int nBar)
 Score a missed catch for the pitcher.
void OnCatchMade (DuelTrack *pTrack, Player *pPlayer, bool bReact)
 Score a made catch for the catcher.
void RewindCatcherTrack ()
 Move the playback of the catcher's track to the current song position.
Public Member Functions inherited from WorldLogic
 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.
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.

Additional Inherited Members

Static Public Member Functions inherited from WorldLogic
static int FindDisconnectedPad ()
 Find the controller of a player on this console that is disconnected.

Detailed Description

Rules of the duel rule set.

The RTTI records the class as deriving from WorldLogic. The object is 0x13c bytes. Two players take turns. The pitcher lays down a phrase of mPhraseBars bars on a DuelTrack, and the catcher then repeats it. A miss scores a point for the pitcher and a catch scores a point for the catcher, and the roles change after every catch phase. The duel is decided once a player has nine points, unless the score stands at nine to eight. Every routine name other than those of the WorldLogic overrides is inferred.

Member Enumeration Documentation

◆ State

Values of mState.

Enumerator
kStateNone 

The constructor has not finished.

kStatePlaying 

The song plays.

kStatePaused 

The pause menu shows.

kStateDecided 

A player won, and the result shows.

kStateEnding 

The song fades out.

kStateFinished 

The duel ended.

◆ Phase

Values of mPhase and mCuePhase.

Enumerator
kPhasePitch 

The pitcher lays down a phrase.

kPhaseCatch 

The catcher repeats the phrase.

kPhaseBreak 

The song passes bars the duel skips, or no cue is due.

Constructor & Destructor Documentation

◆ DuelLogic()

DuelLogic::DuelLogic ( Song * pSong)
explicit

Construct the rules for a song.

Parameters
pSongThe song the duel plays.
Ghidra address:
NTSC-U/C: 0x00105a58
Ghidra address:
PAL: 0x00107190

◆ ~DuelLogic()

DuelLogic::~DuelLogic ( )
override

Release the rules.

Ghidra address:
NTSC-U/C: 0x00107278
Ghidra address:
PAL: 0x001089b0

Member Function Documentation

◆ DispatchPriv()

bool DuelLogic::DispatchPriv ( Message * pMsg)
overridevirtual

Act on a message sent to the rules.

The packets and messages of an online duel go to the handlers below, and every other message goes to WorldLogic::DispatchPriv().

Parameters
pMsgThe message.
Returns
The result of the handler or of WorldLogic::DispatchPriv().
Ghidra address:
NTSC-U/C: 0x0010aa00
Ghidra address:
PAL: 0x0010c138

Implements MsgSink.

◆ Start()

void DuelLogic::Start ( )
overridevirtual

Start the music, set the first roles, and schedule the commands of the duel.

Ghidra address:
NTSC-U/C: 0x00107ad8
Ghidra address:
PAL: 0x00109210

Implements WorldLogic.

◆ Stop()

void DuelLogic::Stop ( )
overridevirtual

End the duel.

Ghidra address:
NTSC-U/C: 0x00107e28
Ghidra address:
PAL: 0x00109560

Implements WorldLogic.

◆ IsFinished()

bool DuelLogic::IsFinished ( ) const
overridevirtual

Report whether the duel ended.

Returns
Whether the duel ended.
Ghidra address:
NTSC-U/C: 0x001081d8
Ghidra address:
PAL: 0x00109910

Implements WorldLogic.

◆ HasQuit()

int DuelLogic::HasQuit ( ) const
overridevirtual

Report whether a player abandoned the duel from a menu.

Returns
Non-zero when the duel was abandoned.
Ghidra address:
NTSC-U/C: 0x001082e8
Ghidra address:
PAL: 0x00109a20

Implements WorldLogic.

◆ IsRestartRequested()

int DuelLogic::IsRestartRequested ( ) const
inlineoverridevirtual

Report that no restart was requested.

The body returns zero.

Returns
Zero.
Ghidra address:
NTSC-U/C: 0x003347a0
Ghidra address:
PAL: 0x003a1d50

Implements WorldLogic.

◆ IsFreestyling()

bool DuelLogic::IsFreestyling ( int nPlayer)
inlineoverridevirtual

Report that no player freestyles.

The body returns false.

Parameters
nPlayerThe player.
Returns
False.
Ghidra address:
NTSC-U/C: 0x003347a8
Ghidra address:
PAL: 0x003a1d58

Implements WorldLogic.

◆ GetTick()

int DuelLogic::GetTick ( )
overridevirtual

Report the song position in ticks.

Returns
The tick of the song clock.
Ghidra address:
NTSC-U/C: 0x001082f0
Ghidra address:
PAL: 0x00109a28

Implements WorldLogic.

◆ GetTime()

float DuelLogic::GetTime ( )
overridevirtual

Report the song position on the song clock.

Returns
The time of the song clock.
Ghidra address:
NTSC-U/C: 0x00108310
Ghidra address:
PAL: 0x00109a48

Implements WorldLogic.

◆ Poll()

void DuelLogic::Poll ( )
overridevirtual

Finish the duel once the song has faded out and the outro is done.

Ghidra address:
NTSC-U/C: 0x00108330
Ghidra address:
PAL: 0x00109a68

Implements WorldLogic.

◆ GetProgress()

float DuelLogic::GetProgress ( )
overridevirtual

Report the fraction of the song played.

Returns
GetTick() over the length of the song in ticks.
Ghidra address:
NTSC-U/C: 0x00108c68
Ghidra address:
PAL: 0x0010a3a0

Implements WorldLogic.

◆ HandleInput() [1/11]

void DuelLogic::HandleInput ( const RotateEvent & event)
overridevirtual

Ignore a rotation.

The body is empty.

Parameters
eventThe rotation.
Ghidra address:
NTSC-U/C: 0x00108cc8
Ghidra address:
PAL: 0x0010a400

Implements WorldLogic.

◆ HandleInput() [2/11]

void DuelLogic::HandleInput ( const PlayNoteEvent & event)
overridevirtual

Hand a gem button to the player who pressed it while the song plays.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x00108cd0
Ghidra address:
PAL: 0x0010a408

Implements WorldLogic.

◆ HandleInput() [3/11]

void DuelLogic::HandleInput ( const BtnEvent< 3 > & event)
overridevirtual

Pause the duel while the song plays.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x00108d20
Ghidra address:
PAL: 0x0010a458

Implements WorldLogic.

◆ HandleInput() [4/11]

void DuelLogic::HandleInput ( const BtnEvent< 4 > & event)
overridevirtual

Ignore a button event of command 4.

The body is empty.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x00108d90
Ghidra address:
PAL: 0x0010a4c8

Implements WorldLogic.

◆ HandleInput() [5/11]

void DuelLogic::HandleInput ( const BtnEvent< 5 > & event)
overridevirtual

Ignore a button event of command 5.

The body is empty.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x00108d98
Ghidra address:
PAL: 0x0010a4d0

Implements WorldLogic.

◆ HandleInput() [6/11]

void DuelLogic::HandleInput ( const ChangeSectionEvent & event)
inlineoverridevirtual

Ignore a section change.

The body is empty.

Parameters
eventThe section change.
Ghidra address:
NTSC-U/C: 0x003347b0
Ghidra address:
PAL: 0x003a1d60

Implements WorldLogic.

◆ HandleInput() [7/11]

void DuelLogic::HandleInput ( const BtnEvent< 9 > & event)
inlineoverridevirtual

Ignore a button event of command 9.

The body is empty.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x003347b8
Ghidra address:
PAL: 0x003a1d68

Implements WorldLogic.

◆ HandleInput() [8/11]

void DuelLogic::HandleInput ( const BtnEvent< 10 > & event)
inlineoverridevirtual

Ignore a button event of command 10.

The body is empty.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x003347c8
Ghidra address:
PAL: 0x003a1d78

Implements WorldLogic.

◆ HandleInput() [9/11]

void DuelLogic::HandleInput ( const BtnEvent< 8 > & event)
inlineoverridevirtual

Ignore a button event of command 8.

The body is empty.

Parameters
eventThe button.
Ghidra address:
NTSC-U/C: 0x003347c0
Ghidra address:
PAL: 0x003a1d70

Implements WorldLogic.

◆ HandleInput() [10/11]

void DuelLogic::HandleInput ( const StickEvent< 2 > & event)
overridevirtual

Ignore a stick event of command 2.

The body is empty.

Parameters
eventThe stick position.
Ghidra address:
NTSC-U/C: 0x00108da0
Ghidra address:
PAL: 0x0010a4d8

Implements WorldLogic.

◆ HandleInput() [11/11]

void DuelLogic::HandleInput ( const StickEvent< 6 > & event)
overridevirtual

Ignore a stick event of command 6.

The body is empty.

Parameters
eventThe stick position.
Ghidra address:
NTSC-U/C: 0x00108da8
Ghidra address:
PAL: 0x0010a4e0

Implements WorldLogic.

◆ SetPaused()

void DuelLogic::SetPaused ( bool bPaused,
int nPad,
int nReason )
overridevirtual

Pause or resume the duel.

Pausing opens the pause menu, which stops the song clock unless the duel is online.

Parameters
bPausedWhether the duel pauses.
nPadThe controller that paused the duel, or -1.
nReasonNon-zero when a disconnected controller paused the duel.
Ghidra address:
NTSC-U/C: 0x00107e38
Ghidra address:
PAL: 0x00109570

Reimplemented from WorldLogic.

◆ IsPlaying()

bool DuelLogic::IsPlaying ( ) const
inlineoverridevirtual

Report whether the song plays.

Returns
Whether mState is kStatePlaying.
Ghidra address:
NTSC-U/C: 0x003347d0
Ghidra address:
PAL: 0x003a1d80

Implements WorldLogic.

◆ GetBarInstrument()

int DuelLogic::GetBarInstrument ( int nBar)

Report the instrument of the song track the duel plays in a bar.

Parameters
nBarThe bar.
Returns
The instrument.
Ghidra address:
NTSC-U/C: 0x00107a98
Ghidra address:
PAL: 0x001091d0

◆ GetPlayerSide()

int DuelLogic::GetPlayerSide ( int nPlayer) const

Report the side of a player.

Parameters
nPlayerThe player.
Returns
nPlayer.
Ghidra address:
NTSC-U/C: 0x001081d0
Ghidra address:
PAL: 0x00109908

◆ StartEnding()

void DuelLogic::StartEnding ( )

Fade the song out and schedule the end of the duel.

The outro of the display plays unless a player quit. The duel is ended at once from the pause menu.

Ghidra address:
NTSC-U/C: 0x001081e8
Ghidra address:
PAL: 0x00109920

◆ OnCatchMissed()

void DuelLogic::OnCatchMissed ( DuelTrack * pTrack,
Player * pPlayer,
int nBar )

Score a missed catch for the pitcher.

Only the first miss or catch of a phrase counts.

Parameters
pTrackThe track of the catcher.
pPlayerThe player whose console reported the miss.
nBarThe bar the catch phase started in.
Ghidra address:
NTSC-U/C: 0x00108f40
Ghidra address:
PAL: 0x0010a678

◆ OnCatchMade()

void DuelLogic::OnCatchMade ( DuelTrack * pTrack,
Player * pPlayer,
bool bReact )

Score a made catch for the catcher.

Parameters
pTrackThe track of the catcher.
pPlayerThe player whose console reported the catch.
bReactWhether the duel may play a sound that praises the catch.
Ghidra address:
NTSC-U/C: 0x00109100
Ghidra address:
PAL: 0x0010a838

◆ RewindCatcherTrack()

void DuelLogic::RewindCatcherTrack ( )

Move the playback of the catcher's track to the current song position.

Ghidra address:
NTSC-U/C: 0x00109258
Ghidra address:
PAL: 0x0010a990

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