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

Front end and flow of the whole game, from the start-up screens through a song and back. More...

#include <metagame.h>

Inheritance diagram for Metagame:
Collaboration diagram for Metagame:

Public Types

enum  State {
  kStateFrontEnd = 0 , kStateLoading = 1 , kStatePlaying = 2 , kStateLeaving = 3 ,
  kStateRestarting = 4
}
 Values of mState. More...
enum  Event {
  kEventNone = 0 , kEventStartGame = 1 , kEventReturnToFrontEnd = 2 , kEventLeaveGame = 3 ,
  kEventQuit = 4
}
 Values Update() reports. More...
enum  LoadStage {
  kLoadStageAlways = 0 , kLoadStageIntro = 1 , kLoadStageIntroAndFrontEnd = 2 , kLoadStageStartFxBanks = 3 ,
  kLoadStageFxBanks = 4 , kLoadStageArena = 5 , kLoadStageMusic = 6 , kLoadStageMusicBanks = 7 ,
  kLoadStageDone = 8
}
 Values of mLoadStage, the progress of the front end through its loads. More...
enum  DialogType {
  kDialogSoloWon = 0 , kDialogSoloLost = 1 , kDialogEndGame = 2 , kDialogPause = 5 ,
  kDialogNoController = 6 , kDialogTutorialEnd = 7
}
 Kinds of dialog ShowDialog() shows over a song. More...
enum  UnlockEvent {
  kUnlockEventNone = 0 , kUnlockEventBoss = 1 , kUnlockEventParts = 2 , kUnlockEventSong = 3 ,
  kUnlockEventSaveFreq = 5 , kUnlockEventSaveSettings = 6 , kUnlockEventFreestyleTip = 7
}
 The screens that follow a song, in the order QueueUnlocks() queues them. More...
enum  DialogAction {
  kDialogActionNone = 0 , kDialogActionQuit = 1 , kDialogActionPractice = 2 , kDialogActionResume = 3 ,
  kDialogActionEnd = 4 , kDialogActionContinue = 5
}
 Choices a dialog reports to its callback. More...
typedef void(* DialogCallback) (DialogAction action, void *pUserData)
 Routine a dialog reports the player's choice to.

Public Member Functions

 Metagame ()
 Construct the metagame in kStateFrontEnd with nothing loaded.
 ~Metagame () override
 Destroy the metagame.
void ShowLoadingScreen ()
 Load one of the four loading screens at random from metagame\loadingd.rnd and draw it.
void Init ()
 Read the metagame configuration, start the front end, and register the script commands.
void Terminate ()
 Unregister the script commands and release what Init() and the loads created.
int GetState () const
 Report mState.
const char * SelectedArenaName ()
 Report the display name of the arena chosen last.
const char * ArenaName (const char *pszArena)
 Report the display name of an arena.
void EnterFrontEnd ()
 Enter kStateFrontEnd.
void EnterLoading ()
 Enter kStateLoading.
void EnterPlaying ()
 Enter kStatePlaying.
void EnterLeaving ()
 Enter kStateLeaving.
void EnterRestarting ()
 Enter kStateRestarting.
int Update ()
 Advance the front end by one frame and report the request it made.
void ShowBlankScreen ()
 Show the blank screen unless a dialog is showing.
void SetHelpText (const char *pszText)
 Show a help text on the help panel.
void SetActionText (const char *pszText)
 Show a text of the buttons on the help panel.
void Draw ()
 Draw the part of the front end that goes under the world, the arena scene.
void DrawOverlay ()
 Draw the part of the front end that goes over the world.
void ShowUnlockedArenas ()
 Show the arenas the player has unlocked on the arena scene.
void RecordCampaignResult ()
 Record the result of a campaign song in the profile of the first player.
void QueueUnlocks ()
 Queue the unlock screens of the items the last song unlocked.
void ShowDialog (DialogType type, DialogCallback pfnCallback, void *pUserData, int nPad)
 Show a dialog over the song and report the player's choice to a callback.
void ShowDialogToAll (DialogType type, DialogCallback pfnCallback, void *pUserData)
 Show a dialog over the song that listens to every controller.
void ShowEndGameScreens (DialogAction action)
 Show the screens that follow a song, from its result to the queued unlocks.
void AdvanceUnlocks ()
 Show the next queued unlock screen, or finish the dialog once the queue is empty.
void SetSongScreenMix (bool bIdle)
 Switch the menu music of the song screen to mix 7 over 1920 ticks while no song clip plays, or to mix 9 over 500 ticks before a clip starts.
bool DispatchPriv (Message *pMsg) override
 Handle a message sent to the metagame.
void SetEvent (int nEvent)
 Set the Event that Update() reports next.
Mix * GetMusic () const
float GetTickMs () const
float GetSpeed () const
Gizmo * GetGizmo () const
const char * GetSelectedArena () const
void SetSelectedArena (const char *pszArena)
 Choose an arena.
const NetChatroomInfo & GetChatroom () const
void SetChatroom (const NetChatroomInfo &chatroom)
 Record the chat room this console joined.
int GetFreqsOnCard () const
void SetFreqsOnCard (int bFreqsOnCard)
 Record whether the memory card check found saved Freqs.
int GetNetScreenPending () const
const char * GetNetScreen () const
void SetDialogAction (DialogAction action)
 Record the choice made in the dialog.
void SetReserved144 (int nValue)
 Set the field at +0x144, which is not yet identified.
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.

Detailed Description

Front end and flow of the whole game, from the start-up screens through a song and back.

The RTTI includes the name and records MsgSink as the one base. The vptr sits at offset 0. The one instance is TheMetagame.

The main loop drives it together with WorldMgr. Update() reports what the front end requested, and the main loop answers by moving WorldMgr and calling the matching Enter routine here.

At start-up the metagame walks through the stages of LoadStage. It loads the screen groups, shows the memory card check and the presented-by screen, loads the sound banks, the arena scene, and the menu music, plays the intro movie once the screens reach blank, and then moves the front end to pre_logo, which leads to the title.

Member Typedef Documentation

◆ DialogCallback

typedef void(* Metagame::DialogCallback) (DialogAction action, void *pUserData)

Routine a dialog reports the player's choice to.

Parameters
actionThe choice.
pUserDataThe value given to ShowDialog().

Member Enumeration Documentation

◆ State

Values of mState.

Enumerator
kStateFrontEnd 

The front end screens are showing.

kStateLoading 

A world is loading for a song.

kStatePlaying 

The world is running.

kStateLeaving 

The world ended, and the screens after a song are showing.

kStateRestarting 

The world is being unloaded to load again.

◆ Event

Values Update() reports.

Enumerator
kEventNone 

Nothing was requested.

kEventStartGame 

Load a world for the chosen song.

kEventReturnToFrontEnd 

Return from the screens after a song to the front end.

kEventLeaveGame 

Abandon the running world.

kEventQuit 

End the program.

◆ LoadStage

Values of mLoadStage, the progress of the front end through its loads.

Enumerator
kLoadStageAlways 

The always screen group loads.

kLoadStageIntro 

The intro screen group loads.

kLoadStageIntroAndFrontEnd 

The intro and front_end groups load together.

kLoadStageStartFxBanks 

The sound effect banks are about to load.

kLoadStageFxBanks 

The sound effect banks load.

kLoadStageArena 

The arena scene loads.

kLoadStageMusic 

The menu song is read.

kLoadStageMusicBanks 

The music banks load, and the intro movie waits.

kLoadStageDone 

Every load has finished.

◆ DialogType

Kinds of dialog ShowDialog() shows over a song.

Enumerator
kDialogSoloWon 

The result of a won solo song, or of a practice song.

kDialogSoloLost 

The result of a lost solo song.

kDialogEndGame 

The results at the end of a multiplayer song.

kDialogPause 

The pause menu.

kDialogNoController 

The pause menu of a disconnected controller.

kDialogTutorialEnd 

The menu at the end of the tutorial. The name is inferred.

◆ UnlockEvent

The screens that follow a song, in the order QueueUnlocks() queues them.

Enumerator
kUnlockEventNone 

No screen.

kUnlockEventBoss 

unlock_boss, a boss song unlocked.

kUnlockEventParts 

unlock_parts, avatar parts and emblems unlocked.

kUnlockEventSong 

song_decrypt, a song unlocked.

kUnlockEventSaveFreq 

auto_save_freq, the Freq changed.

kUnlockEventSaveSettings 

auto_save_settings, the settings changed.

kUnlockEventFreestyleTip 

freestyle_lap_tip, the first freestyle lap.

◆ DialogAction

Choices a dialog reports to its callback.

Enumerator
kDialogActionNone 

No choice made yet.

kDialogActionQuit 

Quit the song.

kDialogActionPractice 

Play the song again in practice mode.

kDialogActionResume 

Return to the song.

kDialogActionEnd 

End the song.

kDialogActionContinue 

Continue to the victory lap.

Constructor & Destructor Documentation

◆ Metagame()

Metagame::Metagame ( )

Construct the metagame in kStateFrontEnd with nothing loaded.

Ghidra address:
NTSC-U/C: 0x00163328
Ghidra address:
PAL: 0x001660a0

◆ ~Metagame()

Metagame::~Metagame ( )
override

Destroy the metagame.

Ghidra address:
NTSC-U/C: 0x00354d70
Ghidra address:
PAL: 0x003c1fc0

Member Function Documentation

◆ ShowLoadingScreen()

void Metagame::ShowLoadingScreen ( )

Load one of the four loading screens at random from metagame\loadingd.rnd and draw it.

The main loop calls the routine before the other subsystems start, and the screen therefore shows while they load. The screen is drawn into both frame buffers.

Ghidra address:
NTSC-U/C: 0x00164500
Ghidra address:
PAL: 0x00167350

◆ Init()

void Metagame::Init ( )

Read the metagame configuration, start the front end, and register the script commands.

The screen classes are registered, the screen file is read, and the always group starts loading. The metagame listens to the front end, the controllers, and the keyboard.

Ghidra address:
NTSC-U/C: 0x00164650
Ghidra address:
PAL: 0x001674f0

◆ Terminate()

void Metagame::Terminate ( )

Unregister the script commands and release what Init() and the loads created.

Ghidra address:
NTSC-U/C: 0x00164a10
Ghidra address:
PAL: 0x001678c8

◆ GetState()

int Metagame::GetState ( ) const

Report mState.

Returns
One of State.
Ghidra address:
NTSC-U/C: 0x00164b40
Ghidra address:
PAL: 0x00167a00

◆ SelectedArenaName()

const char * Metagame::SelectedArenaName ( )

Report the display name of the arena chosen last.

Returns
The localized name.
Ghidra address:
NTSC-U/C: 0x00164b48
Ghidra address:
PAL: 0x00167a08

◆ ArenaName()

const char * Metagame::ArenaName ( const char * pszArena)

Report the display name of an arena.

Parameters
pszArenaThe arena token.
Returns
The localized name.
Ghidra address:
NTSC-U/C: 0x00164b68
Ghidra address:
PAL: 0x00167a28

◆ EnterFrontEnd()

void Metagame::EnterFrontEnd ( )

Enter kStateFrontEnd.

Ghidra address:
NTSC-U/C: 0x00164b90
Ghidra address:
PAL: 0x00167a50

◆ EnterLoading()

void Metagame::EnterLoading ( )

Enter kStateLoading.

Ghidra address:
NTSC-U/C: 0x00164c18
Ghidra address:
PAL: 0x00167ad8

◆ EnterPlaying()

void Metagame::EnterPlaying ( )

Enter kStatePlaying.

Ghidra address:
NTSC-U/C: 0x00164c98
Ghidra address:
PAL: 0x00167b58

◆ EnterLeaving()

void Metagame::EnterLeaving ( )

Enter kStateLeaving.

Ghidra address:
NTSC-U/C: 0x00164cd0
Ghidra address:
PAL: 0x00167b90

◆ EnterRestarting()

void Metagame::EnterRestarting ( )

Enter kStateRestarting.

Ghidra address:
NTSC-U/C: 0x00164d10
Ghidra address:
PAL: 0x00167bd0

◆ Update()

int Metagame::Update ( )

Advance the front end by one frame and report the request it made.

The pending event is cleared as it is reported.

Returns
One of Event.
Ghidra address:
NTSC-U/C: 0x00164d48
Ghidra address:
PAL: 0x00167c08

◆ ShowBlankScreen()

void Metagame::ShowBlankScreen ( )

Show the blank screen unless a dialog is showing.

GameLogic::Start() schedules the routine shortly before the first bar. The name is inferred.

Ghidra address:
NTSC-U/C: 0x00165048
Ghidra address:
PAL: 0x00167f08

◆ SetHelpText()

void Metagame::SetHelpText ( const char * pszText)

Show a help text on the help panel.

Parameters
pszTextThe text.
Ghidra address:
NTSC-U/C: 0x00165080
Ghidra address:
PAL: 0x00167f40

◆ SetActionText()

void Metagame::SetActionText ( const char * pszText)

Show a text of the buttons on the help panel.

Parameters
pszTextThe text.
Ghidra address:
NTSC-U/C: 0x001650a0
Ghidra address:
PAL: 0x00167f60

◆ Draw()

void Metagame::Draw ( )

Draw the part of the front end that goes under the world, the arena scene.

Ghidra address:
NTSC-U/C: 0x001655e8
Ghidra address:
PAL: 0x001684f8

◆ DrawOverlay()

void Metagame::DrawOverlay ( )

Draw the part of the front end that goes over the world.

While the screen groups load, the loading screen fades out. Afterwards the front end camera, the gizmo, the front end lights, and the screens are drawn.

Ghidra address:
NTSC-U/C: 0x00165618
Ghidra address:
PAL: 0x00168528

◆ ShowUnlockedArenas()

void Metagame::ShowUnlockedArenas ( )

Show the arenas the player has unlocked on the arena scene.

Ghidra address:
NTSC-U/C: 0x00164630
Ghidra address:
PAL: 0x001674d0

◆ RecordCampaignResult()

void Metagame::RecordCampaignResult ( )

Record the result of a campaign song in the profile of the first player.

A remix, a practice song, and a demo record nothing.

Ghidra address:
NTSC-U/C: 0x00165fb8
Ghidra address:
PAL: 0x00168f80

◆ QueueUnlocks()

void Metagame::QueueUnlocks ( )

Queue the unlock screens of the items the last song unlocked.

Ghidra address:
NTSC-U/C: 0x001660c8
Ghidra address:
PAL: 0x00169090

◆ ShowDialog()

void Metagame::ShowDialog ( DialogType type,
DialogCallback pfnCallback,
void * pUserData,
int nPad )

Show a dialog over the song and report the player's choice to a callback.

Parameters
typeThe dialog.
pfnCallbackThe routine the choice is reported to.
pUserDataA value passed back to the callback unchanged.
nPadThe controller the dialog listens to, or -1 for every controller.
Ghidra address:
NTSC-U/C: 0x00166840
Ghidra address:
PAL: 0x00169808

◆ ShowDialogToAll()

void Metagame::ShowDialogToAll ( DialogType type,
DialogCallback pfnCallback,
void * pUserData )
inline

Show a dialog over the song that listens to every controller.

A scheduled dialog command calls the routine through this form, which passes -1 for the controller.

Parameters
typeThe dialog.
pfnCallbackThe routine the choice is reported to.
pUserDataA value passed back to the callback unchanged.

◆ ShowEndGameScreens()

void Metagame::ShowEndGameScreens ( DialogAction action)

Show the screens that follow a song, from its result to the queued unlocks.

Parameters
actionThe choice the result dialog reported.
Ghidra address:
NTSC-U/C: 0x00166cb8
Ghidra address:
PAL: 0x00169ca8

◆ AdvanceUnlocks()

void Metagame::AdvanceUnlocks ( )

Show the next queued unlock screen, or finish the dialog once the queue is empty.

Ghidra address:
NTSC-U/C: 0x00166e08
Ghidra address:
PAL: 0x00169df8

◆ SetSongScreenMix()

void Metagame::SetSongScreenMix ( bool bIdle)

Switch the menu music of the song screen to mix 7 over 1920 ticks while no song clip plays, or to mix 9 over 500 ticks before a clip starts.

Parameters
bIdleWhether no song clip plays.
Ghidra address:
NTSC-U/C: 0x001692c0
Ghidra address:
PAL: 0x0016c448

◆ DispatchPriv()

bool Metagame::DispatchPriv ( Message * pMsg)
overridevirtual

Handle a message sent to the metagame.

Parameters
pMsgThe message.
Returns
The result of the handler of the message's type, or false for any other message.
Ghidra address:
NTSC-U/C: 0x00168038
Ghidra address:
PAL: 0x0016b0c8

Implements MsgSink.

◆ SetEvent()

void Metagame::SetEvent ( int nEvent)
inline

Set the Event that Update() reports next.

Parameters
nEventOne of Event.

◆ GetMusic()

Mix * Metagame::GetMusic ( ) const
inline
Returns
The menu music, or null while the front end does not show.

◆ GetTickMs()

float Metagame::GetTickMs ( ) const
inline
Returns
The milliseconds of one tick of the front end clock.

◆ GetSpeed()

float Metagame::GetSpeed ( ) const
inline
Returns
The rate of the front end clock against the scheduler.

◆ GetGizmo()

Gizmo * Metagame::GetGizmo ( ) const
inline
Returns
The projector of the menu screens.

◆ GetSelectedArena()

const char * Metagame::GetSelectedArena ( ) const
inline
Returns
The identifier of the arena chosen last. SelectedArenaName() localises it.

◆ SetSelectedArena()

void Metagame::SetSelectedArena ( const char * pszArena)
inline

Choose an arena.

Parameters
pszArenaThe identifier of the arena.

◆ GetChatroom()

const NetChatroomInfo & Metagame::GetChatroom ( ) const
inline
Returns
The chat room this console joined last.

◆ SetChatroom()

void Metagame::SetChatroom ( const NetChatroomInfo & chatroom)
inline

Record the chat room this console joined.

Parameters
chatroomThe chat room.

◆ GetFreqsOnCard()

int Metagame::GetFreqsOnCard ( ) const
inline
Returns
Non-zero when the memory card check found saved Freqs.

◆ SetFreqsOnCard()

void Metagame::SetFreqsOnCard ( int bFreqsOnCard)
inline

Record whether the memory card check found saved Freqs.

Parameters
bFreqsOnCardNon-zero when it found some.

◆ GetNetScreenPending()

int Metagame::GetNetScreenPending ( ) const
inline
Returns
Whether the network screen waits to be shown.

◆ GetNetScreen()

const char * Metagame::GetNetScreen ( ) const
inline
Returns
The network screen to show once a launchpad screen shows.

◆ SetDialogAction()

void Metagame::SetDialogAction ( DialogAction action)
inline

Record the choice made in the dialog.

Parameters
actionThe choice.

◆ SetReserved144()

void Metagame::SetReserved144 ( int nValue)
inline

Set the field at +0x144, which is not yet identified.

Parameters
nValueThe value.

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