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

Rules of the main game, shared by the solo, multiplayer, and tutorial logic. More...

#include <gamelogic.h>

Inheritance diagram for GameLogic:
Collaboration diagram for GameLogic:

Classes

class  SpeedRamp
 Change of the song speed while a slowdown runs. More...
class  PlayerData
 Per-player record of the phrase each player should play next. More...

Public Types

enum  State {
  kStateIdle = 0 , kStatePlaying = 1 , kStatePaused = 2 , kStateSuspended = 3 ,
  kStateWon = 4 , kStateRunning = 5 , kStateEnding = 6 , kStateFinished = 7
}
 Values of mState. More...
enum  Powerup {
  kPowerupNone = 0 , kPowerupAutocatcher = 1 , kPowerupMultiplier = 2 , kPowerupSlowdown = 3 ,
  kPowerupFreestyle = 4 , kPowerupBumper = 5 , kPowerupCrippler = 6 , kPowerupCount = 7
}
 Kinds of power-up a player can hold. More...

Public Member Functions

 GameLogic (Song *pSong, DataArray *pConfig, int nSeed)
 Construct the logic of a song.
 ~GameLogic () override
 Stop the song and release the players and the tracks.
void Start () override
 Start the song, the tracks, the players, and the bar counting.
void Stop () override
 Stop the song, the tracks, and the players.
bool IsFinished () const override
 Report whether Stop() ran.
int HasQuit () const override
 Report mQuit.
int IsRestartRequested () const override
 Report whether the song is to start again once it ends.
bool IsFreestyling (int nPlayer) override
 Report whether a player is on the freestyle track.
void Poll () override
 Stop the song once the ending finished.
float GetProgress () override
 Report how far the song has played.
void HandleInput (const RotateEvent &event) override
 Move a playing player to the next or previous catch track.
void HandleInput (const PlayNoteEvent &event) override
 Pass a note to the player.
void HandleInput (const BtnEvent< 3 > &event) override
 Pause the song from the controller of the player.
void HandleInput (const BtnEvent< 4 > &event) override
 Toggle the display option of a single controller and save it in the profile.
void HandleInput (const BtnEvent< 5 > &event) override
 Deploy the power-up of a player and log it.
void HandleInput (const ChangeSectionEvent &event) override
 Ignore the event.
void HandleInput (const BtnEvent< 9 > &event) override
 Ignore the event.
void HandleInput (const BtnEvent< 10 > &event) override
 Pass the button to the player.
void HandleInput (const BtnEvent< 8 > &event) override
 Ignore the event.
void HandleInput (const StickEvent< 2 > &event) override
 Pass the stick event to the player.
void HandleInput (const StickEvent< 6 > &event) override
 Pass the stick event to the player.
void SetPaused (bool bPaused, int nPad, int nReason) override
 Pause or resume the song, the force feedback, and the controllers.
bool IsPlaying () const override
 Report whether the song is playing.
virtual bool DeploySlowdown (Player *pPlayer)
 Slow the song down for a player.
virtual bool DeployFreestyle (Player *pPlayer)
 Move a player to the freestyle track for the configured number of bars.
virtual bool DeployBumper (Player *pPlayer)
 Refuse a bumper.
virtual bool DeployCrippler (Player *pPlayer)
 Refuse a crippler.
virtual void EndFreestyle (Player *pPlayer)
 Move a player from the freestyle track back to a catch track.
virtual void OnStart ()=0
 Act once Start() finished.
virtual void OnFinish (bool bWon)=0
 Act once Finish() stopped the players.
virtual void OnBar (int nBar)=0
 Act at the start of every bar.
virtual void OnSection ()=0
 Act at the start of every section.
virtual void OnPhraseCaptured (CatchTrack *pTrack, Player *pPlayer, int nBar, bool bStreak)=0
 Act once CapturePhrase() found the next phrases.
virtual void OnPhraseEnded (Track *pTrack)=0
 Act once a phrase of a track ended.
virtual void OnPhraseMissed (Track *pTrack)=0
 Act once a player missed a phrase.
bool IsFreestyleTrackActive () const
 Report whether a player is on the freestyle track while the song plays.
bool HasPhraseThisBar () const
 Report whether a catch track has a phrase in the current bar.
void EndSong ()
 Start the ending of the song.
void Finish (bool bWon)
 Stop the players at the end of the song.
void CapturePhrase (CatchTrack *pTrack, Player *pPlayer, int nBar, bool bStreak)
 Record the capture of a phrase and find the next phrase of each local player.
void ContinueStreak (Track *pTrack, int nBar, int nFromBar)
 Lengthen or reset the streak of the player of a track and find the next phrase.
void EndPhrase (Track *pTrack)
 Report the end of a phrase to the triggers and to OnPhraseEnded().
void MissPhrase (Track *pTrack)
 Record a missed phrase and report it to the triggers and to OnPhraseMissed().
void EnableNextTracks (int nBar)
 Enable the catch tracks of the next step of the song's enable order.
void EnterFreestyle (Player *pPlayer, bool bVictory)
 Move a player to the freestyle track.
void LeaveFreestyle (Player *pPlayer, int nTrack)
 Move a player from the freestyle track to a catch track and find the next phrase.
void StartSlowdown ()
 Slow the song down.
void StopSlowdown ()
 Return the song to its speed after StartSlowdown().
bool DeployAutocatcher (Player *pPlayer)
 Capture a phrase of the track of a player and pulse the controllers of every player on it.
bool DeployMultiplier (Player *pPlayer)
 Raise the multiplier of a player.
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.
virtual int GetTick ()=0
 Report the song position.
virtual float GetTime ()=0
 Report the song time.
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.

Protected Member Functions

void AssignTracks ()
 Assign each player to a random catch track.
void ApplyFreestyleEffect (int nSet)
 Apply one effect set of the song.
void ShowPowerupText (const char *pszToken, int nPlayer)
 Show the localised text of a power-up.
void CreateTracks (int *pFreestyleType, int *pFreestyleInstrument)
 Create the catch tracks and the freestyle track of the song.
void TickBar ()
 Count one bar, starting the next section when it begins.
void AdvanceSection ()
 Start the next section.
void ClearNextPhrase (int nPlayer)
 Forget the next phrase of a player.
void FindNextPhrase (int nPlayer, int nTrack, int nFromBar)
 Find the first phrase on another catch track at or after a bar, and point the player at it.
void PlaceRandomPowerups ()
 Place a random power-up in every bar of every catch track.
void PlacePowerups ()
 Place the power-ups of every section in the busiest bars of the catch tracks.

Static Protected Member Functions

static int GetControllerArgument (DataArray *pCommand)
 Report the controller argument of a script command.
static void OnAutocatcherCommand (DataArray *pCommand, void *pUserData)
 Deploy the autocatcher for a controller on the autocatcher script command.
static void OnMultiplierCommand (DataArray *pCommand, void *pUserData)
 Deploy the multiplier for a controller on the multiplier script command.
static void OnSlowCommand (DataArray *pCommand, void *pUserData)
 Turn the slowdown on or off outside an online game on the slow script command.
static void OnFreestyleCommand (DataArray *pCommand, void *pUserData)
 Deploy the freestyle for a controller on the freestyle script command.
static void OnFreestyleToggleCommand (DataArray *pCommand, void *pUserData)
 Move the player of a controller onto or off the freestyle track on the freestyle_toggle script command.
static void OnBumperCommand (DataArray *pCommand, void *pUserData)
 Deploy the bumper for a controller on the bumper script command.
static void OnCripplerCommand (DataArray *pCommand, void *pUserData)
 Deploy the crippler for a controller on the crippler script command.
static void OnPowerupCommand (DataArray *pCommand, void *pUserData)
 Give a power-up to the player of a controller on the powerup script command while the power-up cheat is on.

Protected Attributes

Song * mSong
int mState
int mPaused
int mTicksPerBar
int mNumBars
PlayMap * mPlayMap
std::vector< std::unique_ptr< Player > > mPlayers
std::vector< LocalPlayer * > mLocalPlayers
std::vector< std::unique_ptr< CatchTrack > > mCatchTracks
std::unique_ptr< FreestyleTrack > mFreestyleTrack
std::unique_ptr< GameTrackSelector > mTrackSelector
std::unique_ptr< SpeedRamp > mSpeedRamp
int mPhraseThisBar
int mQuit
int mReserved60
int mSectionStartBar
int mNextSectionBar
int mSection
WorldBeat mWorldBeat
int mSavedState
int mReserved8c
int mSlowdown
int mNextEnableStep
std::vector< PlayerData > mPlayerData
Ptr< Command > mBarCmd
Ptr< Command > mStopSlowdownCmd
Rand mRand
int mEndTick

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 main game, shared by the solo, multiplayer, and tutorial logic.

The RTTI records the class as deriving from WorldLogic. The logic creates the players, one catch track for each catch track of the song, and the freestyle track. It counts the bars and the sections of the song, places the power-ups, moves the players between the tracks, and finds the phrase each player should play next.

The derived classes supply GetTick(), GetTime(), and the hooks from OnStart() on.

Member Enumeration Documentation

◆ State

Values of mState.

Enumerator
kStateIdle 

The song has not started.

kStatePlaying 

The song is playing.

kStatePaused 

The song is paused, and mSavedState records the state to resume.

kStateSuspended 

The derived logic stopped the song without pausing it.

kStateWon 

The song was won and the victory lap plays.

kStateRunning 

The derived logic runs the song without the player input.

kStateEnding 

The song ended, and the logic waits for the display to finish.

kStateFinished 

Stop() ran.

◆ Powerup

Kinds of power-up a player can hold.

Enumerator
kPowerupNone 

No power-up.

kPowerupAutocatcher 

Captures a phrase of the current track.

kPowerupMultiplier 

Raises the score multiplier.

kPowerupSlowdown 

Slows the song down for a while.

kPowerupFreestyle 

Moves the player to the freestyle track.

kPowerupBumper 

Pushes another player off a track.

kPowerupCrippler 

Hinders another player.

kPowerupCount 

Number of kinds, including kPowerupNone.

Constructor & Destructor Documentation

◆ GameLogic()

GameLogic::GameLogic ( Song * pSong,
DataArray * pConfig,
int nSeed )

Construct the logic of a song.

Creates one player for each player in the game database, the catch tracks and the freestyle track of the song, assigns the players to the tracks, places the power-ups, and registers the script commands that deploy a power-up.

Parameters
pSongThe song.
pConfigThe configuration of the logic.
nSeedThe seed of the random numbers the logic draws.
Ghidra address:
NTSC-U/C: 0x00110480
Ghidra address:
PAL: 0x00111c18

◆ ~GameLogic()

GameLogic::~GameLogic ( )
override

Stop the song and release the players and the tracks.

Ghidra address:
NTSC-U/C: 0x00111838
Ghidra address:
PAL: 0x00112fd0

Member Function Documentation

◆ Start()

void GameLogic::Start ( )
overridevirtual

Start the song, the tracks, the players, and the bar counting.

Ghidra address:
NTSC-U/C: 0x00111c90
Ghidra address:
PAL: 0x00113428

Implements WorldLogic.

◆ Stop()

void GameLogic::Stop ( )
overridevirtual

Stop the song, the tracks, and the players.

Ghidra address:
NTSC-U/C: 0x00112248
Ghidra address:
PAL: 0x001139e0

Implements WorldLogic.

◆ IsFinished()

bool GameLogic::IsFinished ( ) const
overridevirtual

Report whether Stop() ran.

Returns
Whether mState is kStateFinished.
Ghidra address:
NTSC-U/C: 0x00112968
Ghidra address:
PAL: 0x00114100

Implements WorldLogic.

◆ HasQuit()

int GameLogic::HasQuit ( ) const
overridevirtual

Report mQuit.

Returns
mQuit.
Ghidra address:
NTSC-U/C: 0x00112978
Ghidra address:
PAL: 0x00114110

Implements WorldLogic.

◆ IsRestartRequested()

int GameLogic::IsRestartRequested ( ) const
overridevirtual

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

Returns
mReserved60.
Ghidra address:
NTSC-U/C: 0x00112980
Ghidra address:
PAL: 0x00114118

Implements WorldLogic.

◆ IsFreestyling()

bool GameLogic::IsFreestyling ( int nPlayer)
overridevirtual

Report whether a player is on the freestyle track.

Parameters
nPlayerThe player.
Returns
Whether the track of the player is mFreestyleTrack.
Ghidra address:
NTSC-U/C: 0x00112988
Ghidra address:
PAL: 0x00114120

Implements WorldLogic.

◆ Poll()

void GameLogic::Poll ( )
overridevirtual

Stop the song once the ending finished.

Only a logic in kStateEnding acts. The song stops once the camera move of the ending is done and either the scheduler stopped or it arrived at mEndTick.

Ghidra address:
NTSC-U/C: 0x001126a0
Ghidra address:
PAL: 0x00113e38

Implements WorldLogic.

Reimplemented in TutorialGameLogic.

◆ GetProgress()

float GameLogic::GetProgress ( )
overridevirtual

Report how far the song has played.

Returns
GetTick() over the length of the song in ticks, limited to the range 0 to 1.
Ghidra address:
NTSC-U/C: 0x00111bf8
Ghidra address:
PAL: 0x00113390

Implements WorldLogic.

Reimplemented in TutorialGameLogic.

◆ HandleInput() [1/11]

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

Move a playing player to the next or previous catch track.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00114c28
Ghidra address:
PAL: 0x001163c0

Implements WorldLogic.

Reimplemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [2/11]

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

Pass a note to the player.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00114cb8
Ghidra address:
PAL: 0x00116450

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [3/11]

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

Pause the song from the controller of the player.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00114dd8
Ghidra address:
PAL: 0x00116570

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [4/11]

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

Toggle the display option of a single controller and save it in the profile.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00114e48
Ghidra address:
PAL: 0x001165e0

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [5/11]

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

Deploy the power-up of a player and log it.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00114f30
Ghidra address:
PAL: 0x001166c8

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [6/11]

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

Ignore the event.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00337ca8
Ghidra address:
PAL: 0x003a5258

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [7/11]

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

Ignore the event.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00337cb0
Ghidra address:
PAL: 0x003a5260

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [8/11]

void GameLogic::HandleInput ( const BtnEvent< 10 > & event)
overridevirtual

Pass the button to the player.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00114d00
Ghidra address:
PAL: 0x00116498

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [9/11]

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

Ignore the event.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00337ca0
Ghidra address:
PAL: 0x003a5250

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [10/11]

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

Pass the stick event to the player.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00114d48
Ghidra address:
PAL: 0x001164e0

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ HandleInput() [11/11]

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

Pass the stick event to the player.

Parameters
eventThe event.
Ghidra address:
NTSC-U/C: 0x00114d90
Ghidra address:
PAL: 0x00116528

Implements WorldLogic.

Reimplemented in SoloGameLogic, and TutorialGameLogic.

◆ SetPaused()

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

Pause or resume the song, the force feedback, and the controllers.

Parameters
bPausedWhether to pause.
nPadThe controller that requested the change.
nReasonThe reason the change was requested.
Ghidra address:
NTSC-U/C: 0x00112558
Ghidra address:
PAL: 0x00113cf0

Reimplemented from WorldLogic.

Reimplemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ IsPlaying()

bool GameLogic::IsPlaying ( ) const
inlineoverridevirtual

Report whether the song is playing.

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

Implements WorldLogic.

◆ DeploySlowdown()

virtual bool GameLogic::DeploySlowdown ( Player * pPlayer)
virtual

Slow the song down for a player.

Parameters
pPlayerThe player.
Returns
Whether the power-up was deployed.
Ghidra address:
NTSC-U/C: 0x00115700
Ghidra address:
PAL: 0x00116e98

Reimplemented in MultiGameLogic.

◆ DeployFreestyle()

virtual bool GameLogic::DeployFreestyle ( Player * pPlayer)
virtual

Move a player to the freestyle track for the configured number of bars.

Parameters
pPlayerThe player.
Returns
Whether the power-up was deployed.
Ghidra address:
NTSC-U/C: 0x001159d8
Ghidra address:
PAL: 0x00117170

Reimplemented in MultiGameLogic, and SoloGameLogic.

◆ DeployBumper()

virtual bool GameLogic::DeployBumper ( Player * pPlayer)
inlinevirtual

Refuse a bumper.

The solo game has no bumper.

Parameters
pPlayerThe player.
Returns
False.
Ghidra address:
NTSC-U/C: 0x00337cb8
Ghidra address:
PAL: 0x003a5268

Reimplemented in MultiGameLogic.

◆ DeployCrippler()

virtual bool GameLogic::DeployCrippler ( Player * pPlayer)
inlinevirtual

Refuse a crippler.

The solo game has no crippler.

Parameters
pPlayerThe player.
Returns
False.
Ghidra address:
NTSC-U/C: 0x00337cc0
Ghidra address:
PAL: 0x003a5270

Reimplemented in MultiGameLogic.

◆ EndFreestyle()

virtual void GameLogic::EndFreestyle ( Player * pPlayer)
virtual

Move a player from the freestyle track back to a catch track.

Parameters
pPlayerThe player.
Ghidra address:
NTSC-U/C: 0x00115b98
Ghidra address:
PAL: 0x00117330

Reimplemented in MultiGameLogic.

◆ OnStart()

virtual void GameLogic::OnStart ( )
pure virtual

Act once Start() finished.

Implemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ OnFinish()

virtual void GameLogic::OnFinish ( bool bWon)
pure virtual

Act once Finish() stopped the players.

Parameters
bWonWhether the song was won.

Implemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ OnBar()

virtual void GameLogic::OnBar ( int nBar)
pure virtual

Act at the start of every bar.

Parameters
nBarThe bar.

Implemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ OnSection()

virtual void GameLogic::OnSection ( )
pure virtual

Act at the start of every section.

Implemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ OnPhraseCaptured()

virtual void GameLogic::OnPhraseCaptured ( CatchTrack * pTrack,
Player * pPlayer,
int nBar,
bool bStreak )
pure virtual

Act once CapturePhrase() found the next phrases.

Parameters
pTrackThe track the phrase was captured on.
pPlayerThe player that captured it.
nBarThe first bar the capture clears.
bStreakWhether the capture continues the streak of the player.

Implemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ OnPhraseEnded()

virtual void GameLogic::OnPhraseEnded ( Track * pTrack)
pure virtual

Act once a phrase of a track ended.

Parameters
pTrackThe track.

Implemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ OnPhraseMissed()

virtual void GameLogic::OnPhraseMissed ( Track * pTrack)
pure virtual

Act once a player missed a phrase.

Parameters
pTrackThe track the phrase was missed on.

Implemented in MultiGameLogic, SoloGameLogic, and TutorialGameLogic.

◆ IsFreestyleTrackActive()

bool GameLogic::IsFreestyleTrackActive ( ) const

Report whether a player is on the freestyle track while the song plays.

Returns
Whether the freestyle track has a player and mState is kStatePlaying or kStateRunning.
Ghidra address:
NTSC-U/C: 0x001129c8
Ghidra address:
PAL: 0x00114160

◆ HasPhraseThisBar()

bool GameLogic::HasPhraseThisBar ( ) const

Report whether a catch track has a phrase in the current bar.

Returns
mPhraseThisBar.
Ghidra address:
NTSC-U/C: 0x00112a00
Ghidra address:
PAL: 0x00114198

◆ EndSong()

void GameLogic::EndSong ( )

Start the ending of the song.

Fades the mixer out over at least one second and schedules WorldLogic::AllNotesOff() at the end of the fade, unless the song is paused. The logic enters kStateEnding either way.

Ghidra address:
NTSC-U/C: 0x00112728
Ghidra address:
PAL: 0x00113ec0

◆ Finish()

void GameLogic::Finish ( bool bWon)

Stop the players at the end of the song.

A won song gives the first player the freestyle track and checks for an unlocked song. A demo starts the ending at once, and any other game passes the result to OnFinish().

Parameters
bWonWhether the song was won.
Ghidra address:
NTSC-U/C: 0x00112de0
Ghidra address:
PAL: 0x00114578

◆ CapturePhrase()

void GameLogic::CapturePhrase ( CatchTrack * pTrack,
Player * pPlayer,
int nBar,
bool bStreak )

Record the capture of a phrase and find the next phrase of each local player.

Parameters
pTrackThe track the phrase was captured on.
pPlayerThe player that captured it.
nBarThe first bar the capture clears.
bStreakWhether the capture continues the streak of the player.
Ghidra address:
NTSC-U/C: 0x00113360
Ghidra address:
PAL: 0x00114af8

◆ ContinueStreak()

void GameLogic::ContinueStreak ( Track * pTrack,
int nBar,
int nFromBar )

Lengthen or reset the streak of the player of a track and find the next phrase.

Parameters
pTrackThe track.
nBarThe bar the phrase ended in.
nFromBarThe first bar to search for the next phrase from.
Ghidra address:
NTSC-U/C: 0x001135b0
Ghidra address:
PAL: 0x00114d48

◆ EndPhrase()

void GameLogic::EndPhrase ( Track * pTrack)

Report the end of a phrase to the triggers and to OnPhraseEnded().

Parameters
pTrackThe track.
Ghidra address:
NTSC-U/C: 0x00114ac0
Ghidra address:
PAL: 0x00116258

◆ MissPhrase()

void GameLogic::MissPhrase ( Track * pTrack)

Record a missed phrase and report it to the triggers and to OnPhraseMissed().

Parameters
pTrackThe track the phrase was missed on.
Ghidra address:
NTSC-U/C: 0x00114b18
Ghidra address:
PAL: 0x001162b0

◆ EnableNextTracks()

void GameLogic::EnableNextTracks ( int nBar)

Enable the catch tracks of the next step of the song's enable order.

Parameters
nBarThe bar the tracks start at.
Ghidra address:
NTSC-U/C: 0x001150b0
Ghidra address:
PAL: 0x00116848

◆ EnterFreestyle()

void GameLogic::EnterFreestyle ( Player * pPlayer,
bool bVictory )

Move a player to the freestyle track.

Parameters
pPlayerThe player.
bVictoryWhether the freestyle rewards a won song.
Ghidra address:
NTSC-U/C: 0x00115180
Ghidra address:
PAL: 0x00116918

◆ LeaveFreestyle()

void GameLogic::LeaveFreestyle ( Player * pPlayer,
int nTrack )

Move a player from the freestyle track to a catch track and find the next phrase.

Parameters
pPlayerThe player.
nTrackThe catch track, or -1 for the track the camera of the player shows.
Ghidra address:
NTSC-U/C: 0x001151a0
Ghidra address:
PAL: 0x00116938

◆ StartSlowdown()

void GameLogic::StartSlowdown ( )

Slow the song down.

Ghidra address:
NTSC-U/C: 0x00115288
Ghidra address:
PAL: 0x00116a20

◆ StopSlowdown()

void GameLogic::StopSlowdown ( )

Return the song to its speed after StartSlowdown().

Ghidra address:
NTSC-U/C: 0x001152f0
Ghidra address:
PAL: 0x00116a88

◆ DeployAutocatcher()

bool GameLogic::DeployAutocatcher ( Player * pPlayer)

Capture a phrase of the track of a player and pulse the controllers of every player on it.

Parameters
pPlayerThe player.
Returns
Whether the power-up was deployed.
Ghidra address:
NTSC-U/C: 0x001157f8
Ghidra address:
PAL: 0x00116f90

◆ DeployMultiplier()

bool GameLogic::DeployMultiplier ( Player * pPlayer)

Raise the multiplier of a player.

Parameters
pPlayerThe player.
Returns
Whether the power-up was deployed.
Ghidra address:
NTSC-U/C: 0x00115990
Ghidra address:
PAL: 0x00117128

◆ AssignTracks()

void GameLogic::AssignTracks ( )
protected

Assign each player to a random catch track.

Ghidra address:
NTSC-U/C: 0x001111c8
Ghidra address:
PAL: 0x00112960

◆ ApplyFreestyleEffect()

void GameLogic::ApplyFreestyleEffect ( int nSet)
protected

Apply one effect set of the song.

Parameters
nSetThe effect set.
Ghidra address:
NTSC-U/C: 0x00111800
Ghidra address:
PAL: 0x00112f98

◆ ShowPowerupText()

void GameLogic::ShowPowerupText ( const char * pszToken,
int nPlayer )
protected

Show the localised text of a power-up.

Only the solo game shows the text.

Parameters
pszTokenThe token of the text.
nPlayerThe player. The body does not read it.
Ghidra address:
NTSC-U/C: 0x001128f0
Ghidra address:
PAL: 0x00114088

◆ CreateTracks()

void GameLogic::CreateTracks ( int * pFreestyleType,
int * pFreestyleInstrument )
protected

Create the catch tracks and the freestyle track of the song.

Parameters
pFreestyleTypeReceives the track type of the freestyle track.
pFreestyleInstrumentReceives the instrument of the freestyle track.
Ghidra address:
NTSC-U/C: 0x00112a08
Ghidra address:
PAL: 0x001141a0

◆ TickBar()

void GameLogic::TickBar ( )
protected

Count one bar, starting the next section when it begins.

The command in mBarCmd runs the routine at the start of every bar.

Ghidra address:
NTSC-U/C: 0x00113190
Ghidra address:
PAL: 0x00114928

◆ AdvanceSection()

void GameLogic::AdvanceSection ( )
protected

Start the next section.

Ghidra address:
NTSC-U/C: 0x001132b0
Ghidra address:
PAL: 0x00114a48

◆ ClearNextPhrase()

void GameLogic::ClearNextPhrase ( int nPlayer)
protected

Forget the next phrase of a player.

Parameters
nPlayerThe player.
Ghidra address:
NTSC-U/C: 0x00113650
Ghidra address:
PAL: 0x00114de8

◆ FindNextPhrase()

void GameLogic::FindNextPhrase ( int nPlayer,
int nTrack,
int nFromBar )
protected

Find the first phrase on another catch track at or after a bar, and point the player at it.

Parameters
nPlayerThe player.
nTrackThe catch track to skip.
nFromBarThe first bar to search.
Ghidra address:
NTSC-U/C: 0x001136d8
Ghidra address:
PAL: 0x00114e70

◆ PlaceRandomPowerups()

void GameLogic::PlaceRandomPowerups ( )
protected

Place a random power-up in every bar of every catch track.

Ghidra address:
NTSC-U/C: 0x001138c0
Ghidra address:
PAL: 0x00115058

◆ PlacePowerups()

void GameLogic::PlacePowerups ( )
protected

Place the power-ups of every section in the busiest bars of the catch tracks.

Ghidra address:
NTSC-U/C: 0x001139b8
Ghidra address:
PAL: 0x00115150

◆ GetControllerArgument()

int GameLogic::GetControllerArgument ( DataArray * pCommand)
staticprotected

Report the controller argument of a script command.

Parameters
pCommandThe command.
Returns
The controller, or -1 when the command does not list one.
Ghidra address:
NTSC-U/C: 0x00115348
Ghidra address:
PAL: 0x00116ae0

◆ OnAutocatcherCommand()

void GameLogic::OnAutocatcherCommand ( DataArray * pCommand,
void * pUserData )
staticprotected

Deploy the autocatcher for a controller on the autocatcher script command.

Parameters
pCommandThe command.
pUserDataThe logic.
Ghidra address:
NTSC-U/C: 0x00115380
Ghidra address:
PAL: 0x00116b18

◆ OnMultiplierCommand()

void GameLogic::OnMultiplierCommand ( DataArray * pCommand,
void * pUserData )
staticprotected

Deploy the multiplier for a controller on the multiplier script command.

Parameters
pCommandThe command.
pUserDataThe logic.
Ghidra address:
NTSC-U/C: 0x001153d0
Ghidra address:
PAL: 0x00116b68

◆ OnSlowCommand()

void GameLogic::OnSlowCommand ( DataArray * pCommand,
void * pUserData )
staticprotected

Turn the slowdown on or off outside an online game on the slow script command.

Parameters
pCommandThe command.
pUserDataThe logic.
Ghidra address:
NTSC-U/C: 0x00115420
Ghidra address:
PAL: 0x00116bb8

◆ OnFreestyleCommand()

void GameLogic::OnFreestyleCommand ( DataArray * pCommand,
void * pUserData )
staticprotected

Deploy the freestyle for a controller on the freestyle script command.

Parameters
pCommandThe command.
pUserDataThe logic.
Ghidra address:
NTSC-U/C: 0x00115480
Ghidra address:
PAL: 0x00116c18

◆ OnFreestyleToggleCommand()

void GameLogic::OnFreestyleToggleCommand ( DataArray * pCommand,
void * pUserData )
staticprotected

Move the player of a controller onto or off the freestyle track on the freestyle_toggle script command.

Parameters
pCommandThe command.
pUserDataThe logic.
Ghidra address:
NTSC-U/C: 0x001154f0
Ghidra address:
PAL: 0x00116c88

◆ OnBumperCommand()

void GameLogic::OnBumperCommand ( DataArray * pCommand,
void * pUserData )
staticprotected

Deploy the bumper for a controller on the bumper script command.

Parameters
pCommandThe command.
pUserDataThe logic.
Ghidra address:
NTSC-U/C: 0x00115560
Ghidra address:
PAL: 0x00116cf8

◆ OnCripplerCommand()

void GameLogic::OnCripplerCommand ( DataArray * pCommand,
void * pUserData )
staticprotected

Deploy the crippler for a controller on the crippler script command.

Parameters
pCommandThe command.
pUserDataThe logic.
Ghidra address:
NTSC-U/C: 0x001155d0
Ghidra address:
PAL: 0x00116d68

◆ OnPowerupCommand()

void GameLogic::OnPowerupCommand ( DataArray * pCommand,
void * pUserData )
staticprotected

Give a power-up to the player of a controller on the powerup script command while the power-up cheat is on.

Parameters
pCommandThe command.
pUserDataThe logic.
Ghidra address:
NTSC-U/C: 0x00115640
Ghidra address:
PAL: 0x00116dd8

Member Data Documentation

◆ mSong

Song* GameLogic::mSong
protected

The song. Borrowed.

◆ mState

int GameLogic::mState
protected

One of State.

◆ mPaused

int GameLogic::mPaused
protected

Whether SetPaused() paused the song.

◆ mTicksPerBar

int GameLogic::mTicksPerBar
protected

Length of a bar, in ticks.

◆ mNumBars

int GameLogic::mNumBars
protected

Length of the song, in bars.

◆ mPlayMap

PlayMap* GameLogic::mPlayMap
protected

The map of the song positions. Borrowed.

◆ mPlayers

std::vector<std::unique_ptr<Player> > GameLogic::mPlayers
protected

Every player, by index.

◆ mLocalPlayers

std::vector<LocalPlayer *> GameLogic::mLocalPlayers
protected

The players on this console. Borrowed.

◆ mCatchTracks

std::vector<std::unique_ptr<CatchTrack> > GameLogic::mCatchTracks
protected

The catch tracks, by index.

◆ mFreestyleTrack

std::unique_ptr<FreestyleTrack> GameLogic::mFreestyleTrack
protected

The freestyle track, or null.

◆ mTrackSelector

std::unique_ptr<GameTrackSelector> GameLogic::mTrackSelector
protected

The assignment of the players.

◆ mSpeedRamp

std::unique_ptr<SpeedRamp> GameLogic::mSpeedRamp
protected

The speed of the song.

◆ mPhraseThisBar

int GameLogic::mPhraseThisBar
protected

Whether a catch track has a phrase this bar.

◆ mQuit

int GameLogic::mQuit
protected

Set by the derived logic when a player quit.

◆ mReserved60

int GameLogic::mReserved60
protected

◆ mSectionStartBar

int GameLogic::mSectionStartBar
protected

First bar of the current section.

◆ mNextSectionBar

int GameLogic::mNextSectionBar
protected

First bar of the next section.

◆ mSection

int GameLogic::mSection
protected

Index of the current section.

◆ mWorldBeat

WorldBeat GameLogic::mWorldBeat
protected

The events of the track named "WORLD".

◆ mSavedState

int GameLogic::mSavedState
protected

The state SetPaused() restores.

◆ mReserved8c

int GameLogic::mReserved8c
protected

◆ mSlowdown

int GameLogic::mSlowdown
protected

Whether StartSlowdown() slowed the song.

◆ mNextEnableStep

int GameLogic::mNextEnableStep
protected

The step EnableNextTracks() enables next.

◆ mPlayerData

std::vector<PlayerData> GameLogic::mPlayerData
protected

The record of each player.

◆ mBarCmd

Ptr<Command> GameLogic::mBarCmd
protected

Runs TickBar().

◆ mStopSlowdownCmd

Ptr<Command> GameLogic::mStopSlowdownCmd
protected

◆ mRand

Rand GameLogic::mRand
protected

The random numbers of the logic.

◆ mEndTick

int GameLogic::mEndTick
protected

The tick the song stops at.


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