2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CFRONTENDUI_HPP__
|
|
|
|
#define __URDE_CFRONTENDUI_HPP__
|
2015-08-27 00:23:46 +00:00
|
|
|
|
|
|
|
#include "CIOWin.hpp"
|
|
|
|
#include "CGameDebug.hpp"
|
2016-09-16 20:18:03 +00:00
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "CToken.hpp"
|
2016-12-14 22:56:59 +00:00
|
|
|
#include "Audio/CStaticAudioPlayer.hpp"
|
|
|
|
#include "CGBASupport.hpp"
|
|
|
|
#include "zeus/CVector3f.hpp"
|
|
|
|
#include "Input/CRumbleGenerator.hpp"
|
|
|
|
#include "GuiSys/CGuiTextSupport.hpp"
|
2016-12-18 04:16:04 +00:00
|
|
|
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
|
|
|
|
#include "Graphics/Shaders/CColoredQuadFilter.hpp"
|
2015-08-27 00:23:46 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
|
|
|
class CGuiSliderGroup;
|
|
|
|
class CGuiTableGroup;
|
2016-08-05 23:48:53 +00:00
|
|
|
class CMoviePlayer;
|
2015-08-31 03:44:42 +00:00
|
|
|
struct SObjectTag;
|
2016-09-16 20:18:03 +00:00
|
|
|
class CDependencyGroup;
|
|
|
|
class CTexture;
|
|
|
|
class CAudioGroupSet;
|
2016-12-13 05:22:30 +00:00
|
|
|
class CSaveWorld;
|
|
|
|
class CStringTable;
|
|
|
|
class CGuiFrame;
|
2016-12-14 22:56:59 +00:00
|
|
|
class CGuiTextPane;
|
|
|
|
class CGuiWidget;
|
|
|
|
class CGuiTableGroup;
|
2016-12-15 22:37:34 +00:00
|
|
|
class CGuiModel;
|
2015-08-27 00:23:46 +00:00
|
|
|
|
|
|
|
namespace MP1
|
|
|
|
{
|
2016-12-14 22:56:59 +00:00
|
|
|
class CNESEmulator;
|
2016-12-19 19:20:30 +00:00
|
|
|
class CSaveUI;
|
2015-08-27 00:23:46 +00:00
|
|
|
|
|
|
|
class CFrontEndUI : public CIOWin
|
|
|
|
{
|
2016-09-16 20:18:03 +00:00
|
|
|
public:
|
2016-12-15 22:37:34 +00:00
|
|
|
enum class EPhase
|
|
|
|
{
|
|
|
|
Zero,
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
Three,
|
|
|
|
Four,
|
|
|
|
Five,
|
|
|
|
Six
|
|
|
|
};
|
2016-12-13 05:22:30 +00:00
|
|
|
enum class EScreen
|
2016-09-16 20:18:03 +00:00
|
|
|
{
|
|
|
|
Zero,
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
Three,
|
|
|
|
Four,
|
|
|
|
Five,
|
|
|
|
Six
|
|
|
|
};
|
2016-12-13 05:22:30 +00:00
|
|
|
enum class EMenuMovie
|
|
|
|
{
|
|
|
|
Stopped = -1,
|
|
|
|
FirstStart = 0,
|
|
|
|
StartLoop,
|
|
|
|
StartFileSelectA,
|
|
|
|
FileSelectLoop,
|
|
|
|
FileSelectPlayGameA,
|
|
|
|
FileSelectGBA,
|
|
|
|
GBALoop,
|
|
|
|
GBAFileSelectA,
|
|
|
|
GBAFileSelectB
|
|
|
|
};
|
|
|
|
|
2016-12-16 23:05:29 +00:00
|
|
|
static void PlayAdvanceSfx();
|
|
|
|
|
2016-12-14 22:56:59 +00:00
|
|
|
struct SGuiTextPair
|
|
|
|
{
|
|
|
|
CGuiTextPane* x0_panes[2] = {};
|
|
|
|
void SetPairText(const std::wstring& str);
|
|
|
|
};
|
2016-12-15 22:37:34 +00:00
|
|
|
static SGuiTextPair FindTextPanePair(CGuiFrame* frame, const char* name);
|
|
|
|
static void FindAndSetPairText(CGuiFrame* frame, const char* name, const std::wstring& str);
|
|
|
|
|
2016-12-18 04:16:04 +00:00
|
|
|
struct SFileMenuOption
|
2016-12-15 22:37:34 +00:00
|
|
|
{
|
|
|
|
CGuiWidget* x0_base;
|
|
|
|
|
|
|
|
/* filename, world, playtime, date */
|
|
|
|
SGuiTextPair x4_textpanes[4];
|
2016-12-16 04:35:49 +00:00
|
|
|
|
|
|
|
u32 x28_ = 0;
|
|
|
|
float x2c_ = ComputeRandom();
|
|
|
|
|
|
|
|
static float ComputeRandom()
|
|
|
|
{
|
|
|
|
return rand() / float(RAND_MAX) * 30.f + 30.f;
|
|
|
|
}
|
2016-12-15 22:37:34 +00:00
|
|
|
};
|
2016-12-14 22:56:59 +00:00
|
|
|
|
|
|
|
struct SNewFileSelectFrame
|
|
|
|
{
|
2016-12-18 04:16:04 +00:00
|
|
|
enum class ESubMenu
|
|
|
|
{
|
|
|
|
Zero,
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
Three
|
|
|
|
};
|
|
|
|
|
2016-12-16 04:35:49 +00:00
|
|
|
enum class EPhase
|
|
|
|
{
|
|
|
|
Zero,
|
|
|
|
One,
|
|
|
|
Two
|
|
|
|
};
|
|
|
|
|
2016-12-14 22:56:59 +00:00
|
|
|
u32 x0_rnd;
|
|
|
|
CSaveUI* x4_saveUI;
|
2016-12-18 04:16:04 +00:00
|
|
|
ESubMenu x8_subMenu = ESubMenu::Zero;
|
2016-12-16 04:35:49 +00:00
|
|
|
EPhase xc_phase = EPhase::Zero;
|
2016-12-14 22:56:59 +00:00
|
|
|
TLockedToken<CGuiFrame> x10_frme;
|
2016-12-15 22:37:34 +00:00
|
|
|
CGuiFrame* x1c_loadedFrame = nullptr;
|
|
|
|
CGuiTableGroup* x20_tablegroup_fileselect = nullptr;
|
|
|
|
CGuiModel* x24_model_erase = nullptr;
|
|
|
|
SGuiTextPair x28_textpane_erase;
|
2016-12-16 23:05:29 +00:00
|
|
|
SGuiTextPair x30_textpane_cheats;
|
|
|
|
SGuiTextPair x38_textpane_gba;
|
2016-12-15 22:37:34 +00:00
|
|
|
CGuiTableGroup* x40_tablegroup_popup = nullptr;
|
|
|
|
CGuiModel* x44_model_dash7 = nullptr;
|
2016-12-16 23:05:29 +00:00
|
|
|
SGuiTextPair x48_textpane_popupadvance;
|
|
|
|
SGuiTextPair x50_textpane_popupcancel;
|
2016-12-15 22:37:34 +00:00
|
|
|
SGuiTextPair x58_textpane_popupextra;
|
|
|
|
CGuiTextPane* x60_textpane_cancel = nullptr;
|
2016-12-18 04:16:04 +00:00
|
|
|
SFileMenuOption x64_fileSelections[3];
|
2016-12-15 22:37:34 +00:00
|
|
|
zeus::CVector3f xf8_model_erase_position;
|
|
|
|
float x104_rowPitch = 0.f;
|
2016-12-16 04:35:49 +00:00
|
|
|
float x108_curTime = 0.f;
|
|
|
|
bool x10c_inputEnable = false;
|
2016-12-16 23:05:29 +00:00
|
|
|
bool x10d_needsExistingToggle = false;
|
|
|
|
bool x10e_needsNewToggle = false;
|
2016-12-16 04:35:49 +00:00
|
|
|
|
2016-12-14 22:56:59 +00:00
|
|
|
SNewFileSelectFrame(CSaveUI* sui, u32 rnd);
|
2016-12-15 22:37:34 +00:00
|
|
|
void FinishedLoading();
|
|
|
|
bool PumpLoad();
|
2016-12-16 04:35:49 +00:00
|
|
|
bool IsTextDoneAnimating() const;
|
|
|
|
EPhase ProcessUserInput(const CFinalInput& input);
|
2016-12-18 04:16:04 +00:00
|
|
|
void Draw() const;
|
2016-12-16 04:35:49 +00:00
|
|
|
|
|
|
|
void HandleActiveChange(CGuiTableGroup* active);
|
2016-12-16 23:05:29 +00:00
|
|
|
void DeactivateExistingGamePopup();
|
|
|
|
void ActivateExistingGamePopup();
|
|
|
|
void DeactivateNewGamePopup();
|
|
|
|
void ActivateNewGamePopup();
|
|
|
|
|
|
|
|
void ResetFrame();
|
|
|
|
void ClearFrameContents();
|
|
|
|
void SetupFrameContents();
|
|
|
|
|
|
|
|
void DoPopupCancel(CGuiTableGroup* caller);
|
|
|
|
void DoPopupAdvance(CGuiTableGroup* caller);
|
2016-12-18 04:16:04 +00:00
|
|
|
void DoFileMenuCancel(CGuiTableGroup* caller);
|
2016-12-16 23:05:29 +00:00
|
|
|
void DoSelectionChange(CGuiTableGroup* caller);
|
2016-12-18 04:16:04 +00:00
|
|
|
void DoFileMenuAdvance(CGuiTableGroup* caller);
|
2016-12-16 23:05:29 +00:00
|
|
|
|
2016-12-18 04:16:04 +00:00
|
|
|
static SFileMenuOption FindFileSelectOption(CGuiFrame* frame, int idx);
|
2016-12-16 23:05:29 +00:00
|
|
|
static void StartTextAnimating(CGuiTextPane* text, const std::wstring& str, float chRate);
|
2016-12-15 22:37:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SGBASupportFrame
|
|
|
|
{
|
|
|
|
u32 x0_ = 0;
|
|
|
|
std::unique_ptr<CGBASupport> x4_gbaSupport;
|
|
|
|
TLockedToken<CGuiFrame> xc_gbaScreen;
|
|
|
|
TLockedToken<CGuiFrame> x18_gbaLink;
|
|
|
|
CGuiFrame* x24_loadedFrame = nullptr;
|
2016-12-16 04:35:49 +00:00
|
|
|
CGuiTableGroup* x28_tablegroup_options = nullptr;
|
|
|
|
CGuiTableGroup* x2c_tablegroup_fusionsuit = nullptr;
|
|
|
|
SGuiTextPair x30_textpane_instructions;
|
2016-12-15 22:37:34 +00:00
|
|
|
bool x38_ = false;
|
|
|
|
bool x39_ = false;
|
|
|
|
bool x3a_ = false;
|
|
|
|
|
|
|
|
SGBASupportFrame();
|
|
|
|
void FinishedLoading();
|
2016-12-14 22:56:59 +00:00
|
|
|
bool PumpLoad();
|
2016-12-16 04:35:49 +00:00
|
|
|
void SetTableColors(CGuiTableGroup* tbgp) const;
|
|
|
|
void ProcessUserInput(const CFinalInput& input, CSaveUI* sui);
|
2016-12-18 04:16:04 +00:00
|
|
|
void Draw() const;
|
2016-12-16 04:35:49 +00:00
|
|
|
|
2016-12-16 23:05:29 +00:00
|
|
|
void DoOptionsCancel(CGuiTableGroup* caller);
|
|
|
|
void DoSelectionChange(CGuiTableGroup* caller);
|
|
|
|
void DoOptionsAdvance(CGuiTableGroup* caller);
|
2016-12-14 22:56:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SFrontEndFrame
|
|
|
|
{
|
|
|
|
u32 x0_rnd;
|
|
|
|
TLockedToken<CGuiFrame> x8_frme;
|
|
|
|
CGuiFrame* x14_loadedFrme = nullptr;
|
|
|
|
CGuiTableGroup* x18_tablegroup_mainmenu = nullptr;
|
|
|
|
SGuiTextPair x1c_gbaPair;
|
|
|
|
SGuiTextPair x24_cheatPair;
|
|
|
|
SFrontEndFrame(u32 rnd);
|
|
|
|
void FinishedLoading();
|
|
|
|
bool PumpLoad();
|
2016-12-16 04:35:49 +00:00
|
|
|
void ProcessUserInput(const CFinalInput& input);
|
2016-12-18 04:16:04 +00:00
|
|
|
void Draw() const;
|
2016-12-14 22:56:59 +00:00
|
|
|
|
2016-12-16 23:05:29 +00:00
|
|
|
void DoCancel(CGuiTableGroup* caller);
|
|
|
|
void DoSelectionChange(CGuiTableGroup* caller);
|
|
|
|
void DoAdvance(CGuiTableGroup* caller);
|
2016-12-14 22:56:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SFusionBonusFrame
|
|
|
|
{
|
|
|
|
u32 x0_ = 0;
|
|
|
|
std::unique_ptr<CNESEmulator> x4_nesEmu;
|
|
|
|
std::unique_ptr<CGuiTextSupport> xc_textSupport;
|
2016-12-15 22:37:34 +00:00
|
|
|
float x10_remTime = 8.f;
|
2016-12-14 22:56:59 +00:00
|
|
|
bool x14_ = false;
|
|
|
|
bool x15_ = true;
|
|
|
|
|
|
|
|
SFusionBonusFrame();
|
2016-12-16 04:35:49 +00:00
|
|
|
void ProcessUserInput(const CFinalInput& input, CSaveUI* sui);
|
2016-12-15 22:37:34 +00:00
|
|
|
bool DoUpdateWithSaveUI(float dt, CSaveUI* saveUi);
|
2016-12-18 04:16:04 +00:00
|
|
|
void Draw(CSaveUI* saveUi) const;
|
2016-12-14 22:56:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct SOptionsFrontEndFrame
|
|
|
|
{
|
|
|
|
float x0_ = 0.f;
|
|
|
|
TLockedToken<CGuiFrame> x4_frme;
|
|
|
|
TLockedToken<CStringTable> x10_pauseScreen;
|
|
|
|
u32 x1c_ = 0;
|
|
|
|
u32 x20_ = 0;
|
|
|
|
u32 x24_ = 0;
|
|
|
|
u32 x28_ = 0;
|
|
|
|
u32 x2c_ = 0;
|
|
|
|
u32 x30_ = 0;
|
|
|
|
u32 x34_ = 0;
|
|
|
|
float x38_ = 0.f;
|
|
|
|
u32 x3c_ = 0;
|
|
|
|
CRumbleGenerator x40_rumbleGen;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
u8 _dummy = 0;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool x134_24_;
|
|
|
|
bool x134_25_;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
SOptionsFrontEndFrame();
|
2016-12-16 04:35:49 +00:00
|
|
|
void ProcessUserInput(const CFinalInput& input, CSaveUI* sui);
|
2016-12-18 04:16:04 +00:00
|
|
|
void Draw() const;
|
2016-12-14 22:56:59 +00:00
|
|
|
};
|
|
|
|
|
2016-12-18 04:16:04 +00:00
|
|
|
bool IsSaveUIConditional() const
|
|
|
|
{
|
|
|
|
if (x50_curScreen != EScreen::Three && x50_curScreen != EScreen::Four)
|
|
|
|
return false;
|
|
|
|
if (x54_nextScreen != EScreen::Three && x54_nextScreen != EScreen::Four)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-09-16 20:18:03 +00:00
|
|
|
private:
|
2016-12-15 22:37:34 +00:00
|
|
|
EPhase x14_phase = EPhase::Zero;
|
2016-09-16 20:18:03 +00:00
|
|
|
u32 x18_rndA;
|
|
|
|
u32 x1c_rndB;
|
|
|
|
TLockedToken<CDependencyGroup> x20_depsGroup;
|
2016-12-18 04:16:04 +00:00
|
|
|
std::vector<CToken> x2c_deps;
|
2016-09-16 20:18:03 +00:00
|
|
|
TLockedToken<CTexture> x38_pressStart;
|
|
|
|
TLockedToken<CAudioGroupSet> x44_frontendAudioGrp;
|
2016-12-13 05:22:30 +00:00
|
|
|
EScreen x50_curScreen = EScreen::Zero;
|
|
|
|
EScreen x54_nextScreen = EScreen::Zero;
|
|
|
|
float x58_movieSeconds = 0.f;
|
|
|
|
bool x5c_movieSecondsNeeded = false;
|
2016-09-16 20:18:03 +00:00
|
|
|
float x60_ = 0.f;
|
2016-12-18 04:16:04 +00:00
|
|
|
float x64_pressStartAlpha = 0.f;
|
2016-12-14 22:56:59 +00:00
|
|
|
float x68_musicVol = 1.f;
|
2016-12-13 05:22:30 +00:00
|
|
|
u32 x6c_;
|
|
|
|
std::unique_ptr<CMoviePlayer> x70_menuMovies[9];
|
|
|
|
EMenuMovie xb8_curMovie = EMenuMovie::Stopped;
|
2016-09-16 20:18:03 +00:00
|
|
|
int xbc_nextAttract = 0;
|
|
|
|
int xc0_attractCount = 0;
|
2016-12-13 05:22:30 +00:00
|
|
|
std::unique_ptr<CMoviePlayer> xc4_attractMovie;
|
|
|
|
CMoviePlayer* xcc_curMoviePtr = nullptr;
|
|
|
|
bool xd0_ = false;
|
|
|
|
bool xd1_moviesLoaded = false;
|
|
|
|
bool xd2_ = false;
|
2016-12-14 22:56:59 +00:00
|
|
|
std::unique_ptr<CStaticAudioPlayer> xd4_audio1;
|
|
|
|
std::unique_ptr<CStaticAudioPlayer> xd8_audio2;
|
2016-12-13 05:22:30 +00:00
|
|
|
std::unique_ptr<CSaveUI> xdc_saveUI;
|
2016-12-14 22:56:59 +00:00
|
|
|
std::unique_ptr<SNewFileSelectFrame> xe0_newFileSel;
|
2016-12-15 22:37:34 +00:00
|
|
|
std::unique_ptr<SGBASupportFrame> xe4_gbaSupportFrme;
|
2016-12-14 22:56:59 +00:00
|
|
|
std::unique_ptr<SFrontEndFrame> xe8_frontendFrme;
|
2016-12-15 22:37:34 +00:00
|
|
|
std::unique_ptr<SFusionBonusFrame> xec_fusionFrme;
|
|
|
|
std::unique_ptr<SOptionsFrontEndFrame> xf0_optionsFrme;
|
2016-12-14 22:56:59 +00:00
|
|
|
CStaticAudioPlayer* xf4_curAudio = nullptr;
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2016-12-18 04:16:04 +00:00
|
|
|
CColoredQuadFilter m_fadeToBlack = {CCameraFilterPass::EFilterType::Blend};
|
|
|
|
std::experimental::optional<CTexturedQuadFilterAlpha> m_pressStartQuad;
|
|
|
|
|
2016-12-13 05:22:30 +00:00
|
|
|
void SetMovieSecondsDeferred()
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2016-12-13 05:22:30 +00:00
|
|
|
x58_movieSeconds = 1000000.f;
|
|
|
|
x5c_movieSecondsNeeded = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetMovieSeconds(float seconds)
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2016-12-13 05:22:30 +00:00
|
|
|
x58_movieSeconds = seconds;
|
|
|
|
x5c_movieSecondsNeeded = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TransitionToFive();
|
2016-12-14 22:56:59 +00:00
|
|
|
void UpdateMusicVolume();
|
|
|
|
void FinishedLoadingDepsGroup();
|
|
|
|
bool PumpLoad();
|
2016-12-13 05:22:30 +00:00
|
|
|
public:
|
2015-08-27 00:23:46 +00:00
|
|
|
|
2016-09-16 20:18:03 +00:00
|
|
|
CFrontEndUI(CArchitectureQueue& queue);
|
2015-08-27 00:23:46 +00:00
|
|
|
void OnSliderSelectionChange(CGuiSliderGroup* grp, float);
|
|
|
|
void OnCheckBoxSelectionChange(CGuiTableGroup* grp);
|
|
|
|
void OnOptionSubMenuCancel(CGuiTableGroup* grp);
|
|
|
|
void OnOptionsMenuCancel(CGuiTableGroup* grp);
|
|
|
|
void OnNewGameMenuCancel(CGuiTableGroup* grp);
|
|
|
|
void OnFileMenuCancel(CGuiTableGroup* grp);
|
|
|
|
void OnGenericMenuSelectionChange(CGuiTableGroup* grp, int, int);
|
|
|
|
void OnOptionsMenuAdvance(CGuiTableGroup* grp);
|
|
|
|
void OnNewGameMenuAdvance(CGuiTableGroup* grp);
|
|
|
|
void OnFileMenuAdvance(CGuiTableGroup* grp);
|
|
|
|
void OnMainMenuAdvance(CGuiTableGroup* grp);
|
2016-09-16 20:18:03 +00:00
|
|
|
void StartSlideShow(CArchitectureQueue& queue);
|
|
|
|
std::string GetAttractMovieFileName(int idx);
|
|
|
|
std::string GetNextAttractMovieFileName();
|
2015-08-27 00:23:46 +00:00
|
|
|
void SetCurrentMovie(EMenuMovie movie);
|
|
|
|
void StopAttractMovie();
|
2016-12-13 05:22:30 +00:00
|
|
|
void StartAttractMovie();
|
2015-08-27 00:23:46 +00:00
|
|
|
void UpdateMenuHighlights(CGuiTableGroup* grp);
|
|
|
|
void CompleteStateTransition();
|
|
|
|
bool CanBuild(const SObjectTag& tag);
|
|
|
|
void StartStateTransition(EScreen screen);
|
|
|
|
void HandleDebugMenuReturnValue(CGameDebug::EReturnValue val, CArchitectureQueue& queue);
|
|
|
|
void Draw() const;
|
|
|
|
void UpdateMovies(float dt);
|
2016-12-13 05:22:30 +00:00
|
|
|
bool PumpMovieLoad();
|
2016-09-16 20:18:03 +00:00
|
|
|
void ProcessUserInput(const CFinalInput& input, CArchitectureQueue& queue);
|
|
|
|
EMessageReturn Update(float dt, CArchitectureQueue& queue);
|
2015-08-27 00:23:46 +00:00
|
|
|
EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
|
|
|
|
void StartGame();
|
|
|
|
void InitializeFrame();
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CFRONTENDUI_HPP__
|