mirror of https://github.com/AxioDL/metaforce.git
Work on options portion of CFrontEndUI
This commit is contained in:
parent
1ed4949476
commit
f16c61cce8
|
@ -15,6 +15,13 @@ class CAudioSys
|
|||
boo::IAudioVoiceEngine* m_voiceEngine;
|
||||
amuse::Engine m_engine;
|
||||
public:
|
||||
enum class ESurroundModes
|
||||
{
|
||||
Mono,
|
||||
Stereo,
|
||||
Surround
|
||||
};
|
||||
|
||||
struct C3DEmitterParmData
|
||||
{
|
||||
zeus::CVector3f x0_pos;
|
||||
|
@ -54,6 +61,10 @@ public:
|
|||
{
|
||||
return g_SharedSys->m_engine;
|
||||
}
|
||||
static void SetSurroundMode(ESurroundModes mode)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -4,11 +4,57 @@
|
|||
#include "CSimplePool.hpp"
|
||||
#include "CSaveWorld.hpp"
|
||||
#include "CGameHintInfo.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CGameState.hpp"
|
||||
#include "Input/CFinalInput.hpp"
|
||||
#include "Audio/CSfxManager.hpp"
|
||||
//#include "Audio/CStreamedAudioManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
static const SGameOption VisorOpts[] =
|
||||
{
|
||||
{EGameOption::VisorOpacity, 21, 0.f, 255.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::HelmetOpacity, 22, 0.f, 255.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::HUDLag, 23, 0.f, 1.f, 1.f, EOptionType::Boolean},
|
||||
{EGameOption::HintSystem, 24, 0.f, 1.f, 1.f, EOptionType::Boolean},
|
||||
{EGameOption::RestoreDefaults, 35, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults}
|
||||
};
|
||||
|
||||
static const SGameOption DisplayOpts[] =
|
||||
{
|
||||
{EGameOption::ScreenBrightness, 25, 0.f, 8.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::ScreenOffsetX, 26, -30.f, 30.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::ScreenOffsetY, 27, -30.f, 30.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::ScreenStretch, 28, -10.f, 10.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::RestoreDefaults, 35, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults}
|
||||
};
|
||||
|
||||
static const SGameOption SoundOpts[] =
|
||||
{
|
||||
{EGameOption::SFXVolume, 29, 0.f, 127.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::MusicVolume, 30, 0.f, 127.f, 1.f, EOptionType::Float},
|
||||
{EGameOption::SoundMode, 31, 0.f, 1.f, 1.f, EOptionType::Enum},
|
||||
{EGameOption::RestoreDefaults, 35, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults}
|
||||
};
|
||||
|
||||
static const SGameOption ControllerOpts[] =
|
||||
{
|
||||
{EGameOption::ReverseYAxis, 32, 0.f, 1.f, 1.f, EOptionType::Boolean},
|
||||
{EGameOption::Rumble, 33, 0.f, 1.f, 1.f, EOptionType::Boolean},
|
||||
{EGameOption::SwapBeamControls, 34, 0.f, 1.f, 1.f, EOptionType::Boolean},
|
||||
{EGameOption::RestoreDefaults, 35, 0.f, 1.f, 1.f, EOptionType::RestoreDefaults}
|
||||
};
|
||||
|
||||
const std::pair<int, const SGameOption*> GameOptionsRegistry[] =
|
||||
{
|
||||
{5, VisorOpts},
|
||||
{5, DisplayOpts},
|
||||
{4, SoundOpts},
|
||||
{4, ControllerOpts}
|
||||
};
|
||||
|
||||
CPersistentOptions::CPersistentOptions(CBitStreamReader& stream)
|
||||
{
|
||||
for (int b=0 ; b<98 ; ++b)
|
||||
|
@ -116,8 +162,8 @@ CGameOptions::CGameOptions(CBitStreamReader& stream)
|
|||
for (int b=0 ; b<64 ; ++b)
|
||||
x0_[b] = stream.ReadEncoded(1);
|
||||
|
||||
x44_soundMode = ESoundMode(stream.ReadEncoded(2));
|
||||
x48_ = stream.ReadEncoded(4);
|
||||
x44_soundMode = CAudioSys::ESurroundModes(stream.ReadEncoded(2));
|
||||
x48_screenBrightness = stream.ReadEncoded(4);
|
||||
|
||||
x4c_screenXOffset = stream.ReadEncoded(6);
|
||||
x50_screenYOffset = stream.ReadEncoded(6);
|
||||
|
@ -136,13 +182,13 @@ CGameOptions::CGameOptions(CBitStreamReader& stream)
|
|||
|
||||
void CGameOptions::ResetToDefaults()
|
||||
{
|
||||
x48_ = 4;
|
||||
x48_screenBrightness = 4;
|
||||
x4c_screenXOffset = 0;
|
||||
x50_screenYOffset = 0;
|
||||
x54_screenStretch = 0;
|
||||
x58_sfxVol = 0x7f;
|
||||
x5c_musicVol = 0x7f;
|
||||
x44_soundMode = ESoundMode::Stereo;
|
||||
x44_soundMode = CAudioSys::ESurroundModes::Stereo;
|
||||
x60_helmetAlpha = 0xFF;
|
||||
x64_hudAlpha = 0xFF;
|
||||
x68_24_hudLag = true;
|
||||
|
@ -160,7 +206,7 @@ void CGameOptions::PutTo(CBitStreamWriter& writer) const
|
|||
writer.WriteEncoded(x0_[b], 1);
|
||||
|
||||
writer.WriteEncoded(u32(x44_soundMode), 2);
|
||||
writer.WriteEncoded(x48_, 4);
|
||||
writer.WriteEncoded(x48_screenBrightness, 4);
|
||||
|
||||
writer.WriteEncoded(x4c_screenXOffset, 6);
|
||||
writer.WriteEncoded(x50_screenYOffset, 6);
|
||||
|
@ -185,22 +231,22 @@ CGameOptions::CGameOptions()
|
|||
InitSoundMode();
|
||||
}
|
||||
|
||||
float CGameOptions::sub8020F054()
|
||||
float CGameOptions::TuneScreenBrightness()
|
||||
{
|
||||
return (0.375f * 1.f) + (float(x48_) * 0.25f);
|
||||
return (0.375f * 1.f) + (float(x48_screenBrightness) * 0.25f);
|
||||
}
|
||||
|
||||
void CGameOptions::InitSoundMode()
|
||||
{
|
||||
/* If system is mono, force x44 to mono, otherwise honor user preference */
|
||||
}
|
||||
static float flt805A8844 = 0.f;
|
||||
void CGameOptions::sub8020F098(int val, bool b)
|
||||
static float BrightnessCopyFilter = 0.f;
|
||||
void CGameOptions::SetScreenBrightness(s32 val, bool b)
|
||||
{
|
||||
x48_ = zeus::clamp(0, val, 8);
|
||||
x48_screenBrightness = zeus::clamp(0, val, 8);
|
||||
|
||||
if (b)
|
||||
flt805A8844 = sub8020F054();
|
||||
BrightnessCopyFilter = TuneScreenBrightness();
|
||||
}
|
||||
|
||||
void CGameOptions::SetScreenPositionX(s32 pos, bool apply)
|
||||
|
@ -286,6 +332,18 @@ bool CGameOptions::GetHUDLag() const
|
|||
return x68_24_hudLag;
|
||||
}
|
||||
|
||||
void CGameOptions::SetSurroundMode(int mode, bool apply)
|
||||
{
|
||||
x44_soundMode = CAudioSys::ESurroundModes(zeus::clamp(0, mode, 2));
|
||||
if (apply)
|
||||
CAudioSys::SetSurroundMode(x44_soundMode);
|
||||
}
|
||||
|
||||
CAudioSys::ESurroundModes CGameOptions::GetSurroundMode() const
|
||||
{
|
||||
return x44_soundMode;
|
||||
}
|
||||
|
||||
void CGameOptions::SetInvertYAxis(bool invert)
|
||||
{
|
||||
x68_25_invertY = invert;
|
||||
|
@ -341,13 +399,13 @@ void CGameOptions::ResetControllerAssets()
|
|||
|
||||
void CGameOptions::EnsureSettings()
|
||||
{
|
||||
sub8020F098(x48_, true);
|
||||
SetScreenBrightness(x48_screenBrightness, true);
|
||||
SetScreenPositionX(x4c_screenXOffset, true);
|
||||
SetScreenPositionY(x50_screenYOffset, true);
|
||||
SetScreenStretch(x54_screenStretch, true);
|
||||
SetSfxVolume(x58_sfxVol, true);
|
||||
SetMusicVolume(x5c_musicVol, true);
|
||||
//SetSurroundMode(x44_soundMode, true);
|
||||
SetSurroundMode(int(x44_soundMode), true);
|
||||
SetHUDAlpha(x64_hudAlpha);
|
||||
SetHUDLag(x68_24_hudLag);
|
||||
SetInvertYAxis(x68_25_invertY);
|
||||
|
@ -356,6 +414,113 @@ void CGameOptions::EnsureSettings()
|
|||
ToggleControls(x68_27_swapBeamsControls);
|
||||
}
|
||||
|
||||
void CGameOptions::TryRestoreDefaults(const CFinalInput& input, int category,
|
||||
int option, bool frontend)
|
||||
{
|
||||
const std::pair<int, const SGameOption*>& options = GameOptionsRegistry[category];
|
||||
if (!options.first)
|
||||
return;
|
||||
|
||||
if (options.second[option].option != EGameOption::RestoreDefaults)
|
||||
return;
|
||||
|
||||
if (!input.PA())
|
||||
return;
|
||||
|
||||
if (frontend)
|
||||
{
|
||||
CSfxManager::SfxStart(1096, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
CSfxManager::SfxStart(1091, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
}
|
||||
else
|
||||
{
|
||||
CSfxManager::SfxStart(1432, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
}
|
||||
|
||||
CGameOptions& gameOptions = g_GameState->GameOptions();
|
||||
switch (category)
|
||||
{
|
||||
case 0:
|
||||
gameOptions.SetHelmetAlpha(0xff);
|
||||
gameOptions.SetHUDLag(true);
|
||||
gameOptions.SetIsHintSystemEnabled(true);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
gameOptions.SetScreenBrightness(4, true);
|
||||
gameOptions.SetScreenPositionX(0, true);
|
||||
gameOptions.SetScreenPositionY(0, true);
|
||||
gameOptions.SetScreenStretch(0, true);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
gameOptions.SetSfxVolume(0x7f, true);
|
||||
gameOptions.SetMusicVolume(0x7f, true);
|
||||
gameOptions.SetSurroundMode(1, true);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gameOptions.SetInvertYAxis(false);
|
||||
gameOptions.SetIsRumbleEnabled(true);
|
||||
gameOptions.ToggleControls(false);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
void CGameOptions::SetOption(EGameOption option, int value)
|
||||
{
|
||||
CGameOptions& options = g_GameState->GameOptions();
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case EGameOption::VisorOpacity:
|
||||
options.SetHUDAlpha(value);
|
||||
break;
|
||||
case EGameOption::HelmetOpacity:
|
||||
options.SetHelmetAlpha(value);
|
||||
break;
|
||||
case EGameOption::HUDLag:
|
||||
options.SetHUDLag(value);
|
||||
break;
|
||||
case EGameOption::HintSystem:
|
||||
options.SetIsHintSystemEnabled(value);
|
||||
break;
|
||||
case EGameOption::ScreenBrightness:
|
||||
options.SetScreenBrightness(value, true);
|
||||
break;
|
||||
case EGameOption::ScreenOffsetX:
|
||||
options.SetScreenPositionX(value, true);
|
||||
break;
|
||||
case EGameOption::ScreenOffsetY:
|
||||
options.SetScreenPositionY(value, true);
|
||||
break;
|
||||
case EGameOption::ScreenStretch:
|
||||
options.SetScreenStretch(value, true);
|
||||
break;
|
||||
case EGameOption::SFXVolume:
|
||||
options.SetSfxVolume(value, true);
|
||||
break;
|
||||
case EGameOption::MusicVolume:
|
||||
options.SetMusicVolume(value, true);
|
||||
break;
|
||||
case EGameOption::SoundMode:
|
||||
options.SetSurroundMode(value, true);
|
||||
break;
|
||||
case EGameOption::ReverseYAxis:
|
||||
options.SetInvertYAxis(value);
|
||||
break;
|
||||
case EGameOption::Rumble:
|
||||
options.SetIsRumbleEnabled(value);
|
||||
break;
|
||||
case EGameOption::SwapBeamControls:
|
||||
options.ToggleControls(value);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
CHintOptions::CHintOptions(CBitStreamReader& stream)
|
||||
{
|
||||
const auto& hints = g_MemoryCardSys->GetHints();
|
||||
|
|
|
@ -6,6 +6,48 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
class CFinalInput;
|
||||
|
||||
/** Options presented in UI */
|
||||
enum class EGameOption
|
||||
{
|
||||
VisorOpacity,
|
||||
HelmetOpacity,
|
||||
HUDLag,
|
||||
HintSystem,
|
||||
ScreenBrightness,
|
||||
ScreenOffsetX,
|
||||
ScreenOffsetY,
|
||||
ScreenStretch,
|
||||
SFXVolume,
|
||||
MusicVolume,
|
||||
SoundMode,
|
||||
ReverseYAxis,
|
||||
Rumble,
|
||||
SwapBeamControls,
|
||||
RestoreDefaults
|
||||
};
|
||||
|
||||
/** Option UI type */
|
||||
enum class EOptionType
|
||||
{
|
||||
Float,
|
||||
Boolean,
|
||||
Enum,
|
||||
RestoreDefaults
|
||||
};
|
||||
|
||||
/** Option UI presentation information */
|
||||
struct SGameOption
|
||||
{
|
||||
EGameOption option;
|
||||
u32 stringId;
|
||||
float minVal, maxVal, increment;
|
||||
EOptionType type;
|
||||
};
|
||||
|
||||
/** Static registry of Option UI presentation information */
|
||||
extern const std::pair<int, const SGameOption*> GameOptionsRegistry[];
|
||||
|
||||
/** Options tracked persistently between game sessions */
|
||||
class CPersistentOptions
|
||||
|
@ -62,18 +104,9 @@ public:
|
|||
/** Options tracked per game session */
|
||||
class CGameOptions
|
||||
{
|
||||
public:
|
||||
enum class ESoundMode
|
||||
{
|
||||
Mono,
|
||||
Stereo,
|
||||
Surround
|
||||
};
|
||||
|
||||
private:
|
||||
bool x0_[64] = {};
|
||||
ESoundMode x44_soundMode = ESoundMode::Stereo;
|
||||
u32 x48_ = 4;
|
||||
CAudioSys::ESurroundModes x44_soundMode = CAudioSys::ESurroundModes::Stereo;
|
||||
u32 x48_screenBrightness = 4;
|
||||
s32 x4c_screenXOffset = 0;
|
||||
s32 x50_screenYOffset = 0;
|
||||
s32 x54_screenStretch = 0;
|
||||
|
@ -108,20 +141,21 @@ public:
|
|||
void PutTo(CBitStreamWriter& writer) const;
|
||||
u32 GetMusicVolume() const { return x5c_musicVol; }
|
||||
|
||||
float sub8020F054();
|
||||
void sub8020F098(int, bool);
|
||||
float TuneScreenBrightness();
|
||||
void SetScreenBrightness(s32, bool);
|
||||
void SetScreenPositionX(s32, bool);
|
||||
void SetScreenPositionY(s32, bool);
|
||||
void SetScreenStretch(s32, bool);
|
||||
void SetSfxVolume(s32, bool);
|
||||
void SetMusicVolume(s32, bool);
|
||||
//void SetSurroundMode(CAudioSys::ESurroundModes, int);
|
||||
void SetHUDAlpha(u32);
|
||||
u32 GetHUDAlpha() const;
|
||||
void SetHelmetAlpha(u32);
|
||||
u32 GetHelmetAlpha() const;
|
||||
void SetHUDLag(bool);
|
||||
bool GetHUDLag() const;
|
||||
void SetSurroundMode(int mode, bool apply);
|
||||
CAudioSys::ESurroundModes GetSurroundMode() const;
|
||||
void SetInvertYAxis(bool);
|
||||
bool GetInvertYAxis() const;
|
||||
void SetIsRumbleEnabled(bool);
|
||||
|
@ -131,6 +165,10 @@ public:
|
|||
bool IsHintSystemEnabled() const;
|
||||
void SetControls(s32);
|
||||
void ResetControllerAssets();
|
||||
|
||||
static void TryRestoreDefaults(const CFinalInput& input, int category,
|
||||
int option, bool frontend);
|
||||
static void SetOption(EGameOption option, int value);
|
||||
};
|
||||
|
||||
class CHintOptions
|
||||
|
|
|
@ -9,7 +9,7 @@ CGuiSliderGroup::CGuiSliderGroup(const CGuiWidgetParms& parms, float a, float b,
|
|||
}
|
||||
|
||||
void CGuiSliderGroup::SetSelectionChangedCallback
|
||||
(std::function<void(const CGuiSliderGroup*, float)>&& func)
|
||||
(std::function<void(CGuiSliderGroup*, float)>&& func)
|
||||
{
|
||||
x114_changeCallback = std::move(func);
|
||||
}
|
||||
|
|
|
@ -15,12 +15,12 @@ class CGuiSliderGroup : public CGuiCompoundWidget
|
|||
float x104_increment;
|
||||
u32 x108_ = 2;
|
||||
CGuiWidget* x10c_workers[2] = {};
|
||||
std::function<void(const CGuiSliderGroup*, float)> x114_changeCallback;
|
||||
std::function<void(CGuiSliderGroup*, float)> x114_changeCallback;
|
||||
public:
|
||||
CGuiSliderGroup(const CGuiWidgetParms& parms, float a, float b, float c, float d);
|
||||
FourCC GetWidgetTypeID() const {return FOURCC('SLGP');}
|
||||
|
||||
void SetSelectionChangedCallback(std::function<void(const CGuiSliderGroup*, float)>&& func);
|
||||
void SetSelectionChangedCallback(std::function<void(CGuiSliderGroup*, float)>&& func);
|
||||
void SetIncrement(float inc) {x104_increment = inc;}
|
||||
void SetMinVal(float min) {xf8_minVal = min; SetCurVal(x100_curVal);}
|
||||
void SetMaxVal(float max) {xfc_maxVal = max; SetCurVal(x100_curVal);}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "GuiSys/CGuiFrame.hpp"
|
||||
#include "GuiSys/CStringTable.hpp"
|
||||
#include "GuiSys/CGuiTableGroup.hpp"
|
||||
#include "GuiSys/CGuiSliderGroup.hpp"
|
||||
#include "GuiSys/CGuiModel.hpp"
|
||||
#include "CGameState.hpp"
|
||||
#include "CDependencyGroup.hpp"
|
||||
|
@ -155,7 +156,25 @@ bool CFrontEndUI::SNewFileSelectFrame::IsTextDoneAnimating() const
|
|||
|
||||
void CFrontEndUI::SNewFileSelectFrame::Update(float dt)
|
||||
{
|
||||
|
||||
bool saveReady = x4_saveUI->GetUIType() == CSaveUI::EUIType::SaveReady;
|
||||
if (saveReady != x10c_saveReady)
|
||||
{
|
||||
if (saveReady)
|
||||
{
|
||||
ClearFrameContents();
|
||||
}
|
||||
else if (x8_subMenu != ESubMenu::Root)
|
||||
{
|
||||
ResetFrame();
|
||||
DeactivateExistingGamePopup();
|
||||
DeactivateNewGamePopup();
|
||||
x8_subMenu = ESubMenu::Root;
|
||||
}
|
||||
x10c_saveReady = saveReady;
|
||||
}
|
||||
if (x10c_saveReady)
|
||||
SetupFrameContents();
|
||||
x1c_loadedFrame->Update(dt);
|
||||
}
|
||||
|
||||
CFrontEndUI::SNewFileSelectFrame::EAction
|
||||
|
@ -170,7 +189,7 @@ CFrontEndUI::SNewFileSelectFrame::ProcessUserInput(const CFinalInput& input)
|
|||
if (x108_curTime < 0.5f)
|
||||
return xc_action;
|
||||
|
||||
if (x10c_inputEnable)
|
||||
if (x10c_saveReady)
|
||||
x1c_loadedFrame->ProcessUserInput(input);
|
||||
|
||||
if (x10d_needsExistingToggle)
|
||||
|
@ -196,7 +215,7 @@ CFrontEndUI::SNewFileSelectFrame::ProcessUserInput(const CFinalInput& input)
|
|||
|
||||
void CFrontEndUI::SNewFileSelectFrame::Draw() const
|
||||
{
|
||||
if (x1c_loadedFrame && x10c_inputEnable)
|
||||
if (x1c_loadedFrame && x10c_saveReady)
|
||||
x1c_loadedFrame->Draw(CGuiWidgetDrawParms::Default);
|
||||
}
|
||||
|
||||
|
@ -1137,7 +1156,23 @@ bool CFrontEndUI::SFrontEndFrame::PumpLoad()
|
|||
|
||||
void CFrontEndUI::SFrontEndFrame::Update(float dt)
|
||||
{
|
||||
CGuiTextPane* imageGallery =
|
||||
static_cast<CGuiTextPane*>(x18_tablegroup_mainmenu->GetWorkerWidget(3));
|
||||
|
||||
if (CSlideShow::SlideShowGalleryFlags())
|
||||
{
|
||||
imageGallery->SetIsSelectable(true);
|
||||
x24_cheatPair.x0_panes[0]->TextSupport()->SetFontColor(zeus::CColor::skWhite);
|
||||
}
|
||||
else
|
||||
{
|
||||
imageGallery->SetIsSelectable(false);
|
||||
zeus::CColor color = zeus::CColor::skGrey;
|
||||
color.a = 0.5f;
|
||||
x24_cheatPair.x0_panes[0]->TextSupport()->SetFontColor(color);
|
||||
}
|
||||
|
||||
x14_loadedFrme->Update(dt);
|
||||
}
|
||||
|
||||
CFrontEndUI::SFrontEndFrame::EAction
|
||||
|
@ -1153,19 +1188,45 @@ void CFrontEndUI::SFrontEndFrame::Draw() const
|
|||
x14_loadedFrme->Draw(CGuiWidgetDrawParms::Default);
|
||||
}
|
||||
|
||||
void CFrontEndUI::SFrontEndFrame::HandleActiveChange(CGuiTableGroup* active)
|
||||
{
|
||||
active->SetColors(zeus::CColor::skWhite,
|
||||
zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f});
|
||||
}
|
||||
|
||||
void CFrontEndUI::SFrontEndFrame::DoCancel(CGuiTableGroup* caller)
|
||||
{
|
||||
|
||||
/* Intentionally empty */
|
||||
}
|
||||
|
||||
void CFrontEndUI::SFrontEndFrame::DoSelectionChange(CGuiTableGroup* caller, int userSel)
|
||||
{
|
||||
|
||||
CSfxManager::SfxStart(1093, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
HandleActiveChange(caller);
|
||||
}
|
||||
|
||||
void CFrontEndUI::SFrontEndFrame::DoAdvance(CGuiTableGroup* caller)
|
||||
{
|
||||
|
||||
switch (x18_tablegroup_mainmenu->GetUserSelection())
|
||||
{
|
||||
case 0:
|
||||
CSfxManager::SfxStart(FETransitionForwardSFX[x0_rnd][0], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
CSfxManager::SfxStart(FETransitionForwardSFX[x0_rnd][1], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
x4_action = EAction::StartGame;
|
||||
break;
|
||||
case 1:
|
||||
x4_action = EAction::FusionBonus;
|
||||
break;
|
||||
case 2:
|
||||
PlayAdvanceSfx();
|
||||
x4_action = EAction::GameOptions;
|
||||
break;
|
||||
case 3:
|
||||
PlayAdvanceSfx();
|
||||
x4_action = EAction::SlideShow;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
CFrontEndUI::SFrontEndFrame::SFrontEndFrame(u32 rnd)
|
||||
|
@ -1348,21 +1409,191 @@ CFrontEndUI::SOptionsFrontEndFrame::SOptionsFrontEndFrame()
|
|||
{
|
||||
x4_frme = g_SimplePool->GetObj("FRME_OptionsFrontEnd");
|
||||
x10_pauseScreen = g_SimplePool->GetObj("STRG_PauseScreen");
|
||||
x134_24_visible = true;
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::DoSliderChange(CGuiSliderGroup* caller, float value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::DoMenuCancel(CGuiTableGroup* caller)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::DoMenuSelectionChange(CGuiTableGroup* caller, int sel)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::DoLeftMenuAdvance(CGuiTableGroup* caller)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::DeactivateRightMenu()
|
||||
{
|
||||
x2c_tablegroup_double->SetIsActive(false);
|
||||
x30_tablegroup_triple->SetIsActive(false);
|
||||
x34_slidergroup_slider->SetIsActive(false);
|
||||
x2c_tablegroup_double->SetVisibility(false, ETraversalMode::Children);
|
||||
x30_tablegroup_triple->SetVisibility(false, ETraversalMode::Children);
|
||||
x34_slidergroup_slider->SetVisibility(false, ETraversalMode::Children);
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::SetRightUIText()
|
||||
{
|
||||
int userSel = x24_tablegroup_leftmenu->GetUserSelection();
|
||||
const std::pair<int, const SGameOption*>& options = GameOptionsRegistry[userSel];
|
||||
|
||||
for (int i=0 ; i<5 ; ++i)
|
||||
{
|
||||
char name[36];
|
||||
snprintf(name, 36, "textpane_right%d", i);
|
||||
if (i < options.first)
|
||||
{
|
||||
FindTextPanePair(x1c_loadedFrame, name).SetPairText(
|
||||
x20_loadedPauseStrg->GetString(options.second[i].stringId));
|
||||
x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
FindTextPanePair(x1c_loadedFrame, name).SetPairText(L"");
|
||||
x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::SetTableColors(CGuiTableGroup* tbgp) const
|
||||
{
|
||||
tbgp->SetColors(zeus::CColor::skWhite,
|
||||
zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f});
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::FinishedLoading()
|
||||
{
|
||||
x24_tablegroup_leftmenu = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_leftmenu"));
|
||||
x28_tablegroup_rightmenu = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_rightmenu"));
|
||||
x2c_tablegroup_double = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_double"));
|
||||
x30_tablegroup_triple = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_triple"));
|
||||
x34_slidergroup_slider = static_cast<CGuiSliderGroup*>(x1c_loadedFrame->FindWidget("tablegroup_slider"));
|
||||
|
||||
x24_tablegroup_leftmenu->SetMenuAdvanceCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoLeftMenuAdvance, this, std::placeholders::_1));
|
||||
x24_tablegroup_leftmenu->SetMenuSelectionChangeCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoMenuSelectionChange, this, std::placeholders::_1, std::placeholders::_2));
|
||||
|
||||
x38_rowPitch = x24_tablegroup_leftmenu->GetWorkerWidget(1)->GetIdlePosition().z -
|
||||
x24_tablegroup_leftmenu->GetWorkerWidget(0)->GetIdlePosition().z;
|
||||
|
||||
x28_tablegroup_rightmenu->SetMenuSelectionChangeCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoMenuSelectionChange, this, std::placeholders::_1, std::placeholders::_2));
|
||||
x28_tablegroup_rightmenu->SetMenuCancelCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoMenuCancel, this, std::placeholders::_1));
|
||||
|
||||
x2c_tablegroup_double->SetMenuSelectionChangeCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoMenuSelectionChange, this, std::placeholders::_1, std::placeholders::_2));
|
||||
x2c_tablegroup_double->SetMenuCancelCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoMenuCancel, this, std::placeholders::_1));
|
||||
|
||||
x30_tablegroup_triple->SetMenuSelectionChangeCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoMenuSelectionChange, this, std::placeholders::_1, std::placeholders::_2));
|
||||
x30_tablegroup_triple->SetMenuCancelCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoMenuCancel, this, std::placeholders::_1));
|
||||
|
||||
x34_slidergroup_slider->SetSelectionChangedCallback(
|
||||
std::bind(&SOptionsFrontEndFrame::DoSliderChange, this, std::placeholders::_1, std::placeholders::_2));
|
||||
|
||||
FindTextPanePair(x1c_loadedFrame, "textpane_double0").SetPairText(x20_loadedPauseStrg->GetString(95)); // Off
|
||||
FindTextPanePair(x1c_loadedFrame, "textpane_double1").SetPairText(x20_loadedPauseStrg->GetString(94)); // On
|
||||
FindTextPanePair(x1c_loadedFrame, "textpane_triple0").SetPairText(x20_loadedPauseStrg->GetString(96)); // Mono
|
||||
FindTextPanePair(x1c_loadedFrame, "textpane_triple1").SetPairText(x20_loadedPauseStrg->GetString(97)); // Stereo
|
||||
FindTextPanePair(x1c_loadedFrame, "textpane_triple2").SetPairText(x20_loadedPauseStrg->GetString(98)); // Dolby
|
||||
|
||||
FindTextPanePair(x1c_loadedFrame, "textpane_title").SetPairText(g_MainStringTable->GetString(99)); // OPTIONS
|
||||
|
||||
if (CGuiTextPane* proceed = static_cast<CGuiTextPane*>(x1c_loadedFrame->FindWidget("textpane_proceed")))
|
||||
proceed->TextSupport()->SetText(g_MainStringTable->GetString(85));
|
||||
|
||||
if (CGuiTextPane* cancel = static_cast<CGuiTextPane*>(x1c_loadedFrame->FindWidget("textpane_cancel")))
|
||||
cancel->TextSupport()->SetText(g_MainStringTable->GetString(82));
|
||||
|
||||
// Visor, Display, Sound, Controller
|
||||
for (int i=0 ; i<4 ;++i)
|
||||
{
|
||||
char name[36];
|
||||
snprintf(name, 36, "textpane_filename%d", i);
|
||||
FindTextPanePair(x1c_loadedFrame, name).SetPairText(x20_loadedPauseStrg->GetString(16+i));
|
||||
}
|
||||
|
||||
x2c_tablegroup_double->SetVertical(false);
|
||||
x30_tablegroup_triple->SetVertical(false);
|
||||
|
||||
x24_tablegroup_leftmenu->SetIsActive(true);
|
||||
x28_tablegroup_rightmenu->SetIsActive(false);
|
||||
|
||||
SetTableColors(x24_tablegroup_leftmenu);
|
||||
SetTableColors(x28_tablegroup_rightmenu);
|
||||
SetTableColors(x2c_tablegroup_double);
|
||||
SetTableColors(x30_tablegroup_triple);
|
||||
|
||||
SetRightUIText();
|
||||
DeactivateRightMenu();
|
||||
}
|
||||
|
||||
bool CFrontEndUI::SOptionsFrontEndFrame::PumpLoad()
|
||||
{
|
||||
if (x1c_loadedFrame)
|
||||
return true;
|
||||
if (!x4_frme.IsLoaded())
|
||||
return false;
|
||||
if (!x10_pauseScreen.IsLoaded())
|
||||
return false;
|
||||
if (!x4_frme->GetIsFinishedLoading())
|
||||
return false;
|
||||
x1c_loadedFrame = x4_frme.GetObj();
|
||||
x20_loadedPauseStrg = x10_pauseScreen.GetObj();
|
||||
FinishedLoading();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& input, CSaveUI* sui)
|
||||
{
|
||||
return true;
|
||||
x134_25_exitOptions = false;
|
||||
if (sui)
|
||||
sui->ProcessUserInput(input);
|
||||
if (x1c_loadedFrame && x134_24_visible)
|
||||
{
|
||||
if (input.PB() && x24_tablegroup_leftmenu->GetIsActive())
|
||||
{
|
||||
x134_25_exitOptions = true;
|
||||
CSfxManager::SfxStart(1094, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
}
|
||||
else
|
||||
{
|
||||
x1c_loadedFrame->ProcessUserInput(input);
|
||||
CGameOptions::TryRestoreDefaults(input,
|
||||
x24_tablegroup_leftmenu->GetUserSelection(),
|
||||
x28_tablegroup_rightmenu->GetUserSelection(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
return !x134_25_exitOptions;
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::Update(float dt, CSaveUI* saveUi)
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::Update(float dt, CSaveUI* sui)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CFrontEndUI::SOptionsFrontEndFrame::Draw() const
|
||||
{
|
||||
|
||||
if (x1c_loadedFrame && x134_24_visible)
|
||||
{
|
||||
CGuiWidgetDrawParms params(x0_uiAlpha, zeus::CVector3f::skZero);
|
||||
x1c_loadedFrame->Draw(params);
|
||||
}
|
||||
}
|
||||
|
||||
CFrontEndUI::CFrontEndUI(CArchitectureQueue& queue)
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
zeus::CVector3f xf8_model_erase_position;
|
||||
float x104_rowPitch = 0.f;
|
||||
float x108_curTime = 0.f;
|
||||
bool x10c_inputEnable = false;
|
||||
bool x10c_saveReady = false;
|
||||
bool x10d_needsExistingToggle = false;
|
||||
bool x10e_needsNewToggle = false;
|
||||
|
||||
|
@ -284,6 +284,7 @@ public:
|
|||
void Update(float dt);
|
||||
EAction ProcessUserInput(const CFinalInput& input);
|
||||
void Draw() const;
|
||||
void HandleActiveChange(CGuiTableGroup* active);
|
||||
|
||||
void DoCancel(CGuiTableGroup* caller);
|
||||
void DoSelectionChange(CGuiTableGroup* caller, int userSel);
|
||||
|
@ -317,17 +318,17 @@ public:
|
|||
|
||||
struct SOptionsFrontEndFrame
|
||||
{
|
||||
float x0_ = 0.f;
|
||||
float x0_uiAlpha = 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;
|
||||
CGuiFrame* x1c_loadedFrame = nullptr;
|
||||
CStringTable* x20_loadedPauseStrg = nullptr;
|
||||
CGuiTableGroup* x24_tablegroup_leftmenu = nullptr;
|
||||
CGuiTableGroup* x28_tablegroup_rightmenu = nullptr;
|
||||
CGuiTableGroup* x2c_tablegroup_double = nullptr;
|
||||
CGuiTableGroup* x30_tablegroup_triple = nullptr;
|
||||
CGuiSliderGroup* x34_slidergroup_slider = nullptr;
|
||||
float x38_rowPitch = 0.f;
|
||||
u32 x3c_ = 0;
|
||||
CRumbleGenerator x40_rumbleGen;
|
||||
union
|
||||
|
@ -335,11 +336,24 @@ public:
|
|||
u8 _dummy = 0;
|
||||
struct
|
||||
{
|
||||
bool x134_24_;
|
||||
bool x134_25_;
|
||||
bool x134_24_visible : 1;
|
||||
bool x134_25_exitOptions : 1;
|
||||
};
|
||||
};
|
||||
SOptionsFrontEndFrame();
|
||||
|
||||
void DoSliderChange(CGuiSliderGroup* caller, float value);
|
||||
void DoMenuCancel(CGuiTableGroup* caller);
|
||||
void DoMenuSelectionChange(CGuiTableGroup* caller, int sel);
|
||||
void DoLeftMenuAdvance(CGuiTableGroup* caller);
|
||||
|
||||
void DeactivateRightMenu();
|
||||
|
||||
void SetRightUIText();
|
||||
void SetTableColors(CGuiTableGroup* tbgp) const;
|
||||
void FinishedLoading();
|
||||
bool PumpLoad();
|
||||
|
||||
bool ProcessUserInput(const CFinalInput& input, CSaveUI* sui);
|
||||
void Update(float dt, CSaveUI* saveUi);
|
||||
void Draw() const;
|
||||
|
|
Loading…
Reference in New Issue