wavelength 1.0.0
Loading...
Searching...
No Matches
metagame.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <memory>
5#include <vector>
6
7#include "app/msgsink.h"
9#include "met/gizmo.h"
10#include "met/helppanel.h"
11#include "met/metagamearena.h"
12#include "met/metamusicsong.h"
13#include "met/mix.h"
15#include "msg/joypadinputmsg.h"
18#include "msg/message.h"
21#include "os/string.h"
22#include "rnd/rndcam.h"
23#include "rnd/rndenviron.h"
24#include "rnd/rndloader.h"
25#include "synth/syntheffects.h"
31
46class Metagame : public MsgSink {
47public:
56
65
78
88
99
109
116 typedef void (*DialogCallback)(DialogAction action, void *pUserData);
117
125
132 ~Metagame() override;
133
144
154 void Init();
155
162 void Terminate();
163
171 int GetState() const;
172
180 const char *SelectedArenaName();
181
190 const char *ArenaName(const char *pszArena);
191
199
207
215
223
231
241 int Update();
242
252
260 void SetHelpText(const char *pszText);
261
269 void SetActionText(const char *pszText);
270
277 void Draw();
278
289
297
307
315
326 void ShowDialog(DialogType type, DialogCallback pfnCallback, void *pUserData, int nPad);
327
338 void ShowDialogToAll(DialogType type, DialogCallback pfnCallback, void *pUserData) {
339 ShowDialog(type, pfnCallback, pUserData, -1);
340 }
341
350
358
367 void SetSongScreenMix(bool bIdle);
368
377 bool DispatchPriv(Message *pMsg) override;
378
384 void SetEvent(int nEvent) {
385 mEvent = nEvent;
386 }
387
389 Mix *GetMusic() const {
390 return mMusic.get();
391 }
392
394 float GetTickMs() const {
395 return *mTickMs;
396 }
397
399 float GetSpeed() const {
400 return mSpeed;
401 }
402
404 Gizmo *GetGizmo() const {
405 return mGizmo.get();
406 }
407
409 const char *GetSelectedArena() const {
410 return mSelectedArena.c_str();
411 }
412
418 void SetSelectedArena(const char *pszArena) {
419 mSelectedArena = pszArena;
420 }
421
424 return mChatroom;
425 }
426
432 void SetChatroom(const NetChatroomInfo &chatroom) {
433 mChatroom = chatroom;
434 }
435
437 int GetFreqsOnCard() const {
438 return mFreqsOnCard;
439 }
440
446 void SetFreqsOnCard(int bFreqsOnCard) {
447 mFreqsOnCard = bFreqsOnCard;
448 }
449
452 return mNetScreenPending;
453 }
454
456 const char *GetNetScreen() const {
457 return mNetScreen.c_str();
458 }
459
466 mDialogAction = action;
467 }
468
474 void SetReserved144(int nValue) {
475 mReserved144 = nValue;
476 }
477
478private:
479 int mState;
480 int mLoadStage;
481 std::unique_ptr<RndLoader> mLoadingScreenLoader;
482 int mReloadFrontEnd;
483 int mEvent;
484 std::unique_ptr<MetagameArena> mArena;
485 HelpPanel *mHelpPanel;
486 int mLastSelectButton;
487 float mTime;
488 float mTick;
489 float mLastSchedulerTime;
490 const char *mNextScreen;
491 float mLeaveTime;
492 int mLeaveScreenShown;
493 int mFirstBoot;
494 int mDialogShowing;
495 DialogCallback mDialogCallback;
496 void *mDialogUserData;
497 DialogAction mDialogAction;
498 std::unique_ptr<Mix> mMusic;
499 std::unique_ptr<MetaMusicSong> mMusicSong;
500 SynthEffects mEffects;
501 std::unique_ptr<float> mTickMs;
502 int mSharedMusicFadedIn;
503 int mGameFxBankSlot;
504 int mMetaFxBankSlot;
505 int mMusicSharedBankSlot;
506 int mMusicSwapBankSlot;
507 NetChatroomInfo mChatroom;
508 String mSelectedArena;
509 int mFreqsOnCard;
510 std::list<UnlockEvent> mUnlockScreens;
511 std::vector<UnlockableItem> mUnlocks;
512 std::unique_ptr<Gizmo> mGizmo;
513 RndCam *mUiCamera;
514 RndEnviron *mUiEnviron;
515 int mSpeedingUp;
516 float mSpeed;
517 int mNetScreenPending;
518 int mReserved144; // +0x144, set to 1 by the constructor and not yet identified.
519 String mNetScreen;
520
528 static void RegisterScreenClasses();
529
536 void CreateGizmo();
537
545 void StartIntro();
546
553 void PollLoad();
554
561 void ShowFrontEnd();
562
569 void ExitFrontEnd();
570
577 void StartLoading();
578
585 void ExitLoading();
586
593 void StartPlaying();
594
601 void ExitPlaying();
602
609 void StartLeaving();
610
617 void ExitLeaving();
618
625 void StartRestarting();
626
633 void ExitRestarting();
634
642 void ExitState(int nNextState);
643
650 void RecordPracticeResult();
651
659 void FinishDialog();
660
671 bool IsSpeedUp(const char *pszFrom, const char *pszTo);
672
683 bool IsStopSpeedUp(const char *pszFrom, const char *pszTo);
684
694 bool OnJoypadInput(JoypadInputMsg *pMsg);
695
704 bool OnTransitionComplete(UITransitionCompleteMsg *pMsg);
705
714 bool OnComponentSelect(UIComponentSelectMsg *pMsg);
715
724 bool OnComponentSelectStart(UIComponentSelectStartMsg *pMsg);
725
734 bool OnComponentFocusChange(UIComponentFocusChangeMsg *pMsg);
735
745 bool OnScreenChange(UIScreenChangeMsg *pMsg);
746
757 bool OnLaunchpadAborted(LaunchpadAbortedMsg *pMsg);
758
768 bool OnLostInternet(LobbyConnectionLostMsg *pMsg);
769
779 bool OnGameParamsUpdate(GameParamsUpdateMsg *pMsg);
780
794 bool OnLoadGame(Message *pMsg);
795
805 bool OnShareRemixBegin(Message *pMsg);
806
816 bool OnShareRemixProgress(ShareRemixProgressMsg *pMsg);
817
825 void LoadFxBanks();
826
834 bool IsGameFxBankLoaded();
835
843 void LoadMusicBanks();
844
852 bool AreBanksLoaded();
853
860 void UnloadBanks();
861
869 void CreateMusic();
870};
871
877extern Metagame TheMetagame;
Message that reports the settings of the online game the host published.
Definition gameparamsupdatemsg.h:14
The projector the front end moves between the menu screens.
Definition gizmo.h:25
The panel at the bottom of the front end that explains the focused control and the buttons.
Definition helppanel.h:29
Message the controller poll sends when a button is pressed or released.
Definition joypadinputmsg.h:23
Message that reports that the online launchpad of this console ended before the game started.
Definition launchpadabortedmsg.h:14
Message that reports that the connection to the online lobby was lost.
Definition lobbyconnectionlostmsg.h:14
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Front end and flow of the whole game, from the start-up screens through a song and back.
Definition metagame.h:46
int GetState() const
Report mState.
void ShowBlankScreen()
Show the blank screen unless a dialog is showing.
Gizmo * GetGizmo() const
Definition metagame.h:404
Mix * GetMusic() const
Definition metagame.h:389
int Update()
Advance the front end by one frame and report the request it made.
void ShowDialogToAll(DialogType type, DialogCallback pfnCallback, void *pUserData)
Show a dialog over the song that listens to every controller.
Definition metagame.h:338
~Metagame() override
Destroy the metagame.
int GetFreqsOnCard() const
Definition metagame.h:437
void SetHelpText(const char *pszText)
Show a help text on the help panel.
void SetDialogAction(DialogAction action)
Record the choice made in the dialog.
Definition metagame.h:465
void SetChatroom(const NetChatroomInfo &chatroom)
Record the chat room this console joined.
Definition metagame.h:432
DialogAction
Choices a dialog reports to its callback.
Definition metagame.h:101
@ kDialogActionResume
Definition metagame.h:105
@ kDialogActionContinue
Definition metagame.h:107
@ kDialogActionPractice
Definition metagame.h:104
@ kDialogActionQuit
Definition metagame.h:103
@ kDialogActionNone
Definition metagame.h:102
@ kDialogActionEnd
Definition metagame.h:106
void(* DialogCallback)(DialogAction action, void *pUserData)
Routine a dialog reports the player's choice to.
Definition metagame.h:116
State
Values of mState.
Definition metagame.h:49
@ kStateFrontEnd
Definition metagame.h:50
@ kStateRestarting
Definition metagame.h:54
@ kStatePlaying
Definition metagame.h:52
@ kStateLoading
Definition metagame.h:51
@ kStateLeaving
Definition metagame.h:53
Event
Values Update() reports.
Definition metagame.h:58
@ kEventLeaveGame
Definition metagame.h:62
@ kEventStartGame
Definition metagame.h:60
@ kEventQuit
Definition metagame.h:63
@ kEventNone
Definition metagame.h:59
@ kEventReturnToFrontEnd
Definition metagame.h:61
LoadStage
Values of mLoadStage, the progress of the front end through its loads.
Definition metagame.h:67
@ kLoadStageIntro
Definition metagame.h:69
@ kLoadStageArena
Definition metagame.h:73
@ kLoadStageMusicBanks
Definition metagame.h:75
@ kLoadStageIntroAndFrontEnd
Definition metagame.h:70
@ kLoadStageDone
Definition metagame.h:76
@ kLoadStageFxBanks
Definition metagame.h:72
@ kLoadStageMusic
Definition metagame.h:74
@ kLoadStageStartFxBanks
Definition metagame.h:71
@ kLoadStageAlways
Definition metagame.h:68
const char * ArenaName(const char *pszArena)
Report the display name of an arena.
void EnterLeaving()
Enter kStateLeaving.
void RecordCampaignResult()
Record the result of a campaign song in the profile of the first player.
void EnterPlaying()
Enter kStatePlaying.
const char * GetNetScreen() const
Definition metagame.h:456
void ShowUnlockedArenas()
Show the arenas the player has unlocked on the arena scene.
void SetActionText(const char *pszText)
Show a text of the buttons on the help panel.
const char * GetSelectedArena() const
Definition metagame.h:409
void SetSongScreenMix(bool bIdle)
Switch the menu music of the song screen to mix 7 over 1920 ticks while no song clip plays,...
void DrawOverlay()
Draw the part of the front end that goes over the world.
UnlockEvent
The screens that follow a song, in the order QueueUnlocks() queues them.
Definition metagame.h:90
@ kUnlockEventBoss
Definition metagame.h:92
@ kUnlockEventSaveSettings
Definition metagame.h:96
@ kUnlockEventParts
Definition metagame.h:93
@ kUnlockEventSaveFreq
Definition metagame.h:95
@ kUnlockEventSong
Definition metagame.h:94
@ kUnlockEventNone
Definition metagame.h:91
@ kUnlockEventFreestyleTip
Definition metagame.h:97
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 Draw()
Draw the part of the front end that goes under the world, the arena scene.
float GetSpeed() const
Definition metagame.h:399
void EnterLoading()
Enter kStateLoading.
void SetEvent(int nEvent)
Set the Event that Update() reports next.
Definition metagame.h:384
const NetChatroomInfo & GetChatroom() const
Definition metagame.h:423
void QueueUnlocks()
Queue the unlock screens of the items the last song unlocked.
void Terminate()
Unregister the script commands and release what Init() and the loads created.
int GetNetScreenPending() const
Definition metagame.h:451
Metagame()
Construct the metagame in kStateFrontEnd with nothing loaded.
void AdvanceUnlocks()
Show the next queued unlock screen, or finish the dialog once the queue is empty.
bool DispatchPriv(Message *pMsg) override
Handle a message sent to the metagame.
const char * SelectedArenaName()
Report the display name of the arena chosen last.
void ShowEndGameScreens(DialogAction action)
Show the screens that follow a song, from its result to the queued unlocks.
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 SetFreqsOnCard(int bFreqsOnCard)
Record whether the memory card check found saved Freqs.
Definition metagame.h:446
void EnterRestarting()
Enter kStateRestarting.
void EnterFrontEnd()
Enter kStateFrontEnd.
void SetSelectedArena(const char *pszArena)
Choose an arena.
Definition metagame.h:418
void SetReserved144(int nValue)
Set the field at +0x144, which is not yet identified.
Definition metagame.h:474
DialogType
Kinds of dialog ShowDialog() shows over a song.
Definition metagame.h:80
@ kDialogNoController
Definition metagame.h:85
@ kDialogTutorialEnd
Definition metagame.h:86
@ kDialogEndGame
Definition metagame.h:83
@ kDialogSoloWon
Definition metagame.h:81
@ kDialogSoloLost
Definition metagame.h:82
@ kDialogPause
Definition metagame.h:84
float GetTickMs() const
Definition metagame.h:394
The front-end music: the tracks of the current menu song and the mixes that switch them on and off on...
Definition mix.h:22
Receiver of engine messages.
Definition msgsink.h:21
Camera.
Definition rndcam.h:23
Lighting and fog environment, made current for the drawables after it when it is drawn.
Definition rndenviron.h:18
Message that reports how much of the remix of an online game the consoles have exchanged.
Definition shareremixprogressmsg.h:13
Growable text buffer that is also a PrnStream.
Definition string.h:19
Settings of the two effect buses and the software effect of the sound output, read from an effects en...
Definition syntheffects.h:17
Message a panel sends before it moves its focus to another component.
Definition uicomponentfocuschangemsg.h:26
Message a component sends when the player chooses it.
Definition uicomponentselectmsg.h:28
Message a component sends when the player presses the button that chooses it.
Definition uicomponentselectstartmsg.h:27
Message UIManager sends before it leaves the current screen for another.
Definition uiscreenchangemsg.h:24
Message a screen sends itself once its panels have finished their entry animations.
Definition uitransitioncompletemsg.h:23
Metagame TheMetagame
The metagame.
The description of one chat room of the online lobby.
Definition netchatroominfo.h:11