metaforce/Runtime/CGameOptions.hpp

168 lines
4.6 KiB
C++
Raw Normal View History

2016-04-12 23:07:23 -07:00
#ifndef __URDE_CGAMEOPTIONS_HPP__
#define __URDE_CGAMEOPTIONS_HPP__
2015-08-17 13:33:58 -07:00
2015-08-30 20:44:42 -07:00
#include "RetroTypes.hpp"
2017-01-06 17:58:05 -08:00
#include "Audio/CAudioSys.hpp"
2015-08-30 20:44:42 -07:00
2016-03-04 15:04:53 -08:00
namespace urde
{
2016-09-24 18:58:20 -07:00
/** Options tracked persistently between game sessions */
class CPersistentOptions
{
2016-12-20 13:51:50 -08:00
friend class CGameState;
2016-12-30 16:51:51 -08:00
u8 x0_[98] = {};
2016-09-24 18:58:20 -07:00
bool x68_[64] = {};
std::vector<std::pair<ResId, TEditorId>> xac_cinematicStates; /* (MLVL, Cinematic) */
u32 xbc_ = 0;
u32 xc0_ = 0;
u32 xc4_ = 0;
u32 xc8_ = 0;
2016-12-16 15:05:29 -08:00
u32 xcc_logScanCount = 0;
2016-09-24 18:58:20 -07:00
union
{
struct
{
2016-12-31 22:46:52 -08:00
bool xd0_24_fusionLinked : 1;
bool xd0_25_normalModeBeat : 1;
2016-12-16 15:05:29 -08:00
bool xd0_26_hardModeBeat : 1;
2016-12-31 22:46:52 -08:00
bool xd0_27_fusionBeat : 1;
bool xd0_28_fusionSuitActive : 1;
2016-12-16 15:05:29 -08:00
bool xd0_29_allItemsCollected : 1;
2016-09-24 18:58:20 -07:00
};
u16 _dummy = 0;
};
public:
CPersistentOptions() = default;
CPersistentOptions(CBitStreamReader& stream);
2016-12-22 22:41:39 -08:00
bool GetCinematicState(ResId mlvlId, TEditorId cineId) const;
2016-09-24 18:58:20 -07:00
void SetCinematicState(ResId mlvlId, TEditorId cineId, bool state);
2016-12-31 22:46:52 -08:00
bool GetPlayerLinkedFusion() const { return xd0_24_fusionLinked; }
void SetPlayerLinkedFusion(bool v) { xd0_24_fusionLinked = v; }
bool GetPlayerBeatNormalMode() const { return xd0_25_normalModeBeat; }
void SetPlayerBeatNormalMode(bool v) { xd0_25_normalModeBeat = v; }
2016-12-20 13:51:50 -08:00
bool GetPlayerBeatHardMode() const { return xd0_26_hardModeBeat; }
void SetPlayerBeatHardMode(bool v) { xd0_26_hardModeBeat = v; }
2016-12-31 22:46:52 -08:00
bool GetPlayerBeatFusion() const { return xd0_27_fusionBeat; }
void SetPlayerBeatFusion(bool v) { xd0_27_fusionBeat = v; }
bool GetPlayerFusionSuitActive() const { return xd0_28_fusionSuitActive; }
void SetPlayerFusionSuitActive(bool v) { xd0_28_fusionSuitActive = v; }
2016-12-20 13:51:50 -08:00
bool GetAllItemsCollected() const { return xd0_29_allItemsCollected; }
void SetAllItemsCollected(bool v) { xd0_29_allItemsCollected = v; }
2016-12-16 15:05:29 -08:00
u32 GetLogScanCount() const { return xcc_logScanCount; }
2016-12-20 13:51:50 -08:00
void SetLogScanCount(u32 v) { xcc_logScanCount = v; }
2016-12-22 22:41:39 -08:00
void PutTo(CBitStreamWriter& w) const;
2016-12-30 16:51:51 -08:00
u8* GetNESState() { return x0_; }
2016-09-24 18:58:20 -07:00
};
/** Options tracked per game session */
2015-08-17 13:33:58 -07:00
class CGameOptions
{
2016-09-24 18:58:20 -07:00
public:
enum class ESoundMode
{
Mono,
Stereo,
Surround
};
private:
bool x0_[64] = {};
ESoundMode x44_soundMode = ESoundMode::Stereo;
u32 x48_ = 4;
2017-01-06 17:58:05 -08:00
s32 x4c_screenXOffset = 0;
s32 x50_screenYOffset = 0;
s32 x54_screenStretch = 0;
u32 x58_sfxVol = 0x7f;
2016-12-14 14:56:59 -08:00
u32 x5c_musicVol = 0x7f;
2017-01-06 17:58:05 -08:00
u32 x60_helmetAlpha = 0xff;
u32 x64_hudAlpha = 0xff;
2016-09-24 18:58:20 -07:00
union
{
struct
{
2017-01-06 17:58:05 -08:00
bool x68_24_hudLag : 1;
bool x68_25_invertY : 1;
bool x68_26_rumble : 1;
bool x68_27_swapBeamsControls : 1;
bool x68_28_hintSystem : 1;
2016-09-24 18:58:20 -07:00
};
u16 _dummy = 0;
};
u32 x70_ = 0;
u32 x74_ = 0;
u32 x78_ = 0;
public:
CGameOptions();
CGameOptions(CBitStreamReader& stream);
2017-01-06 17:58:05 -08:00
void ResetToDefaults();
2016-09-24 18:58:20 -07:00
void InitSoundMode();
2017-01-06 17:58:05 -08:00
void EnsureSettings();
2016-10-09 14:41:23 -07:00
void PutTo(CBitStreamWriter& writer) const;
2016-12-14 14:56:59 -08:00
u32 GetMusicVolume() const { return x5c_musicVol; }
2017-01-06 17:58:05 -08:00
float sub8020F054();
void sub8020F098(int, 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 SetInvertYAxis(bool);
bool GetInvertYAxis() const;
void SetIsRumbleEnabled(bool);
bool IsRumbleEnabled() const;
void ToggleControls(bool);
void SetIsHintSystemEnabled(bool);
bool IsHintSystemEnabled() const;
void SetControls(s32);
void ResetControllerAssets();
2016-09-24 18:58:20 -07:00
};
class CHintOptions
{
public:
enum class EHintState
{
Zero,
One,
Two
};
struct SHintState
{
EHintState x0_state = EHintState::Zero;
float x4_time = 0.f;
bool x8_flag = false;
SHintState() = default;
SHintState(EHintState state, float time, bool flag)
: x0_state(state), x4_time(time), x8_flag(flag) {}
};
private:
std::vector<SHintState> x0_hintStates;
u32 x10_nextHintIdx = -1;
public:
CHintOptions() = default;
CHintOptions(CBitStreamReader& stream);
2016-10-09 14:41:23 -07:00
void PutTo(CBitStreamWriter& writer) const;
2016-12-21 18:48:22 -08:00
void SetNextHintTime();
2015-08-17 13:33:58 -07:00
};
}
2016-04-12 23:07:23 -07:00
#endif // __URDE_CGAMEOPTIONS_HPP__