Added hide lights feature in player options
This commit is contained in:
+45
-2
@@ -11,6 +11,8 @@
|
||||
#include "Actor.h"
|
||||
#include "Preference.h"
|
||||
#include "GameManager.h"
|
||||
#include "PlayerState.h"
|
||||
#include "GameState.h"
|
||||
#include "CommonMetrics.h"
|
||||
#include "Style.h"
|
||||
|
||||
@@ -279,9 +281,50 @@ void LightsManager::Update( float fDeltaTime )
|
||||
case LIGHTSMODE_DEMONSTRATION:
|
||||
case LIGHTSMODE_GAMEPLAY:
|
||||
{
|
||||
FOREACH_CabinetLight( cl )
|
||||
m_LightsState.m_bCabinetLights[cl] = m_fSecsLeftInCabinetLightBlink[cl] > 0;
|
||||
FOREACH_CabinetLight(cl)
|
||||
{
|
||||
int currLightPlayerNumber = (cl & 1) == 1 ? 1 : 0;
|
||||
bool skipLightActivation = false;
|
||||
|
||||
auto playerOptions = GAMESTATE->m_pPlayerState[currLightPlayerNumber]->m_PlayerOptions.GetCurrent();
|
||||
|
||||
if (cl == LIGHT_MARQUEE_UP_LEFT ||
|
||||
cl == LIGHT_MARQUEE_UP_RIGHT ||
|
||||
cl == LIGHT_MARQUEE_LR_LEFT ||
|
||||
cl == LIGHT_MARQUEE_LR_RIGHT)
|
||||
{
|
||||
if (GAMESTATE->IsHumanPlayer((PlayerNumber)currLightPlayerNumber))
|
||||
{
|
||||
skipLightActivation = playerOptions.m_HideLightType == HideLightType::HideLightType_HideMarqueeLights ||
|
||||
playerOptions.m_HideLightType == HideLightType::HideLightType_HideAllLights;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool lightsBassParallel = PREFSMAN->m_bLightsBassParallel;
|
||||
|
||||
int otherPn = currLightPlayerNumber == 0 ? 1 : 0;
|
||||
auto otherPlayerOptions = GAMESTATE->m_pPlayerState[otherPn]->m_PlayerOptions.GetCurrent();
|
||||
|
||||
if (GAMESTATE->IsHumanPlayer((PlayerNumber)currLightPlayerNumber))
|
||||
{
|
||||
skipLightActivation = playerOptions.m_HideLightType == HideLightType::HideLightType_HideBassLights ||
|
||||
playerOptions.m_HideLightType == HideLightType::HideLightType_HideAllLights ||
|
||||
(lightsBassParallel &&
|
||||
(otherPlayerOptions.m_HideLightType == HideLightType::HideLightType_HideBassLights ||
|
||||
otherPlayerOptions.m_HideLightType == HideLightType::HideLightType_HideAllLights));
|
||||
}
|
||||
else
|
||||
{
|
||||
skipLightActivation = lightsBassParallel &&
|
||||
(otherPlayerOptions.m_HideLightType == HideLightType::HideLightType_HideBassLights ||
|
||||
otherPlayerOptions.m_HideLightType == HideLightType::HideLightType_HideAllLights);
|
||||
}
|
||||
}
|
||||
|
||||
if (!skipLightActivation)
|
||||
m_LightsState.m_bCabinetLights[cl] = m_fSecsLeftInCabinetLightBlink[cl] > 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,16 @@ XToString( DrainType );
|
||||
XToLocalizedString( DrainType );
|
||||
LuaXType( DrainType );
|
||||
|
||||
static const char* HideLightTypeNames[] = {
|
||||
"NoHideLights",
|
||||
"HideAllLights",
|
||||
"HideMarqueeLights",
|
||||
"HideBassLights",
|
||||
};
|
||||
XToString(HideLightType);
|
||||
XToLocalizedString(HideLightType);
|
||||
LuaXType(HideLightType);
|
||||
|
||||
static const char *ModTimerTypeNames[] = {
|
||||
"Game",
|
||||
"Beat",
|
||||
@@ -65,6 +75,7 @@ void PlayerOptions::Init()
|
||||
{
|
||||
m_LifeType = LifeType_Bar;
|
||||
m_DrainType = DrainType_Normal;
|
||||
m_HideLightType = HideLightType_NoHideLights;
|
||||
m_ModTimerType = ModTimerType_Default;
|
||||
m_BatteryLives = 4;
|
||||
m_MinTNSToHideNotes= PREFSMAN->m_MinTNSToHideNotes;
|
||||
@@ -127,6 +138,7 @@ void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds )
|
||||
|
||||
DO_COPY( m_LifeType );
|
||||
DO_COPY( m_DrainType );
|
||||
DO_COPY( m_HideLightType );
|
||||
DO_COPY( m_ModTimerType );
|
||||
DO_COPY( m_BatteryLives );
|
||||
APPROACH( fModTimerMult );
|
||||
@@ -245,6 +257,24 @@ void PlayerOptions::GetMods( std::vector<RString> &AddTo, bool bForceNoteSkin )
|
||||
FAIL_M(ssprintf("Invalid LifeType: %i", m_LifeType));
|
||||
}
|
||||
|
||||
switch (m_HideLightType)
|
||||
{
|
||||
case HideLightType_NoHideLights:
|
||||
AddTo.push_back("NoHideLights");
|
||||
break;
|
||||
case HideLightType_HideAllLights:
|
||||
AddTo.push_back("HideAllLights");
|
||||
break;
|
||||
case HideLightType_HideMarqueeLights:
|
||||
AddTo.push_back("HideMarqueeLights");
|
||||
break;
|
||||
case HideLightType_HideBassLights:
|
||||
AddTo.push_back("HideBassLights");
|
||||
break;
|
||||
default:
|
||||
FAIL_M(ssprintf("Invalid HideLightType: %i", m_HideLightType));
|
||||
}
|
||||
|
||||
if( !m_fTimeSpacing )
|
||||
{
|
||||
if( m_fMaxScrollBPM )
|
||||
@@ -747,6 +777,13 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut
|
||||
else if( sBit == "norecover" || sBit == "power-drop" ) { m_DrainType= DrainType_NoRecover; }
|
||||
else if( sBit == "suddendeath" || sBit == "death" ) { m_DrainType= DrainType_SuddenDeath; }
|
||||
else if( sBit == "normal-drain" ) { m_DrainType= DrainType_Normal; }
|
||||
else if (sBit.find("lights") != sBit.npos)
|
||||
{
|
||||
if (sBit == "nohidelights") m_HideLightType = HideLightType_NoHideLights;
|
||||
else if (sBit == "hidealllights") m_HideLightType = HideLightType_HideAllLights;
|
||||
else if (sBit == "hidemarqueelights") m_HideLightType = HideLightType_HideMarqueeLights;
|
||||
else if (sBit == "hidebasslights") m_HideLightType = HideLightType_HideBassLights;
|
||||
}
|
||||
else if( sBit == "boost" ) SET_FLOAT( fAccels[ACCEL_BOOST] )
|
||||
else if( sBit == "brake" || sBit == "land" ) SET_FLOAT( fAccels[ACCEL_BRAKE] )
|
||||
else if( sBit.find("wave") != sBit.npos)
|
||||
@@ -1412,6 +1449,7 @@ bool PlayerOptions::operator==( const PlayerOptions &other ) const
|
||||
#define COMPARE(x) { if( x != other.x ) return false; }
|
||||
COMPARE(m_LifeType);
|
||||
COMPARE(m_DrainType);
|
||||
COMPARE(m_HideLightType);
|
||||
COMPARE(m_ModTimerType);
|
||||
COMPARE(m_fModTimerMult);
|
||||
COMPARE(m_fModTimerOffset);
|
||||
@@ -1495,6 +1533,7 @@ PlayerOptions& PlayerOptions::operator=(PlayerOptions const& other)
|
||||
#define CPY_SPEED(x) m_ ## x = other.m_ ## x; m_Speed ## x = other.m_Speed ## x;
|
||||
CPY(m_LifeType);
|
||||
CPY(m_DrainType);
|
||||
CPY(m_HideLightType);
|
||||
CPY(m_ModTimerType);
|
||||
CPY_SPEED(fModTimerMult);
|
||||
CPY_SPEED(fModTimerOffset);
|
||||
@@ -1771,6 +1810,7 @@ void PlayerOptions::ResetPrefs( ResetPrefsType type )
|
||||
}
|
||||
CPY(m_LifeType);
|
||||
CPY(m_DrainType);
|
||||
CPY(m_HideLightType);
|
||||
CPY(m_BatteryLives);
|
||||
CPY(m_ModTimerType);
|
||||
CPY(m_fModTimerMult);
|
||||
@@ -1830,6 +1870,7 @@ public:
|
||||
|
||||
ENUM_INTERFACE(LifeSetting, LifeType, LifeType);
|
||||
ENUM_INTERFACE(DrainSetting, DrainType, DrainType);
|
||||
ENUM_INTERFACE(HideLightSetting, HideLightType, HideLightType);
|
||||
ENUM_INTERFACE(ModTimerSetting, ModTimerType, ModTimerType)
|
||||
INT_INTERFACE(BatteryLives, BatteryLives);
|
||||
FLOAT_INTERFACE(ModTimerMult, ModTimerMult, true);
|
||||
@@ -2391,6 +2432,7 @@ public:
|
||||
|
||||
ADD_METHOD(LifeSetting);
|
||||
ADD_METHOD(DrainSetting);
|
||||
ADD_METHOD(HideLightSetting);
|
||||
ADD_METHOD(ModTimerSetting);
|
||||
ADD_METHOD(ModTimerMult);
|
||||
ADD_METHOD(ModTimerOffset);
|
||||
|
||||
+14
-1
@@ -41,6 +41,18 @@ const RString& DrainTypeToString( DrainType cat );
|
||||
const RString& DrainTypeToLocalizedString( DrainType cat );
|
||||
LuaDeclareType( DrainType );
|
||||
|
||||
enum HideLightType {
|
||||
HideLightType_NoHideLights = 0,
|
||||
HideLightType_HideAllLights,
|
||||
HideLightType_HideMarqueeLights,
|
||||
HideLightType_HideBassLights,
|
||||
NUM_HideLightType,
|
||||
HideLightType_Invalid
|
||||
};
|
||||
const RString& HideLightTypeToString(HideLightType cat);
|
||||
const RString& HideLightTypeToLocalizedString(HideLightType cat);
|
||||
LuaDeclareType(HideLightType);
|
||||
|
||||
enum ModTimerType
|
||||
{
|
||||
ModTimerType_Game,
|
||||
@@ -62,7 +74,7 @@ public:
|
||||
* @brief Set up the PlayerOptions with some reasonable defaults.
|
||||
*
|
||||
* This code was taken from Init() to use proper initialization. */
|
||||
PlayerOptions(): m_LifeType(LifeType_Bar), m_DrainType(DrainType_Normal),
|
||||
PlayerOptions(): m_LifeType(LifeType_Bar), m_DrainType(DrainType_Normal), m_HideLightType(HideLightType_NoHideLights),
|
||||
m_ModTimerType(ModTimerType_Default),
|
||||
m_BatteryLives(4),
|
||||
m_bSetScrollSpeed(false),
|
||||
@@ -340,6 +352,7 @@ public:
|
||||
|
||||
PlayerNumber m_pn; // Needed for fetching the style.
|
||||
|
||||
HideLightType m_HideLightType;
|
||||
LifeType m_LifeType;
|
||||
DrainType m_DrainType; // only used with LifeBar
|
||||
ModTimerType m_ModTimerType;
|
||||
|
||||
@@ -296,6 +296,7 @@ PrefsManager::PrefsManager() :
|
||||
m_iSoundPreferredSampleRate ( "SoundPreferredSampleRate", 0 ),
|
||||
m_sLightsStepsDifficulty ( "LightsStepsDifficulty", "hard,medium" ),
|
||||
m_bLightsSimplifyBass ( "LightsSimplifyBass", false),
|
||||
m_bLightsBassParallel ( "LightsBassParallel", false),
|
||||
m_bAllowUnacceleratedRenderer ( "AllowUnacceleratedRenderer", false ),
|
||||
m_bThreadedInput ( "ThreadedInput", true ),
|
||||
m_bThreadedMovieDecode ( "ThreadedMovieDecode", true ),
|
||||
|
||||
@@ -322,6 +322,7 @@ public:
|
||||
Preference<int> m_iSoundPreferredSampleRate;
|
||||
Preference<RString> m_sLightsStepsDifficulty;
|
||||
Preference<bool> m_bLightsSimplifyBass;
|
||||
Preference<bool> m_bLightsBassParallel;
|
||||
Preference<bool> m_bAllowUnacceleratedRenderer;
|
||||
Preference<bool> m_bThreadedInput;
|
||||
Preference<bool> m_bThreadedMovieDecode;
|
||||
|
||||
Reference in New Issue
Block a user