dep fixes: move Player's timing prefs into Player; add and
use accessor; fix using SE_ instead of TW_; move code back into GCAT (was in PrefsMan due to dependency for SMPackage)
This commit is contained in:
@@ -199,6 +199,18 @@ HoldNoteScore StringToHoldNoteScore( const RString &s )
|
||||
}
|
||||
XToLocalizedString( HoldNoteScore );
|
||||
|
||||
static const char *TimingWindowNames[] = {
|
||||
"W1",
|
||||
"W2",
|
||||
"W3",
|
||||
"W4",
|
||||
"W5",
|
||||
"Mine",
|
||||
"Attack",
|
||||
"Hold",
|
||||
"Roll",
|
||||
};
|
||||
XToString( TimingWindow );
|
||||
|
||||
static const char *MemoryCardStateNames[] = {
|
||||
"ready",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "GamePreferences.h"
|
||||
#include "NetworkSyncServer.h"
|
||||
#include "RageLog.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "Player.h"
|
||||
#include <time.h>
|
||||
|
||||
#if defined(WITHOUT_NETWORKING)
|
||||
@@ -980,19 +982,19 @@ void StepManiaLanServer::CheckLowerJudge(const unsigned int clientNum)
|
||||
if (Client[clientNum]->IsPlaying(x))
|
||||
{
|
||||
if ((Client[clientNum]->Player[x].currstep == 2)&&
|
||||
(PREFSMAN->m_fTimingWindowSeconds[SE_W5] < Client[clientNum]->Player[x].offset))
|
||||
(Player::GetWindowSeconds(TW_W5) < Client[clientNum]->Player[x].offset))
|
||||
Client[clientNum]->lowerJudge = true;
|
||||
if ((Client[clientNum]->Player[x].currstep == 3)&&
|
||||
(PREFSMAN->m_fTimingWindowSeconds[SE_W4] < Client[clientNum]->Player[x].offset))
|
||||
(Player::GetWindowSeconds(TW_W4) < Client[clientNum]->Player[x].offset))
|
||||
Client[clientNum]->lowerJudge = true;
|
||||
if ((Client[clientNum]->Player[x].currstep == 4)&&
|
||||
(PREFSMAN->m_fTimingWindowSeconds[SE_W3] < Client[clientNum]->Player[x].offset))
|
||||
(Player::GetWindowSeconds(TW_W3) < Client[clientNum]->Player[x].offset))
|
||||
Client[clientNum]->lowerJudge = true;
|
||||
if ((Client[clientNum]->Player[x].currstep == 5)&&
|
||||
(PREFSMAN->m_fTimingWindowSeconds[SE_W2] < Client[clientNum]->Player[x].offset))
|
||||
(Player::GetWindowSeconds(TW_W2) < Client[clientNum]->Player[x].offset))
|
||||
Client[clientNum]->lowerJudge = true;
|
||||
if ((Client[clientNum]->Player[x].currstep == 6)&&
|
||||
(PREFSMAN->m_fTimingWindowSeconds[SE_W1] < Client[clientNum]->Player[x].offset))
|
||||
(Player::GetWindowSeconds(TW_W1) < Client[clientNum]->Player[x].offset))
|
||||
Client[clientNum]->lowerJudge = true;
|
||||
}
|
||||
}
|
||||
|
||||
+37
-15
@@ -49,11 +49,33 @@ RString ATTACK_DISPLAY_X_NAME( size_t p, size_t both_sides ) { return "AttackDis
|
||||
static const float StepSearchDistance = 1.0f;
|
||||
static const float JUMP_WINDOW_SECONDS = 0.25f;
|
||||
|
||||
static float ADJUSTED_WINDOW_SECONDS( TimingWindow tw )
|
||||
void TimingWindowSecondsInit( size_t /*TimingWindow*/ i, RString &sNameOut, float &defaultValueOut )
|
||||
{
|
||||
float fSecs = PREFSMAN->m_fTimingWindowSeconds[tw];
|
||||
fSecs *= PREFSMAN->m_fTimingWindowScale;
|
||||
fSecs += PREFSMAN->m_fTimingWindowAdd;
|
||||
sNameOut = "TimingWindowSeconds" + TimingWindowToString( (TimingWindow)i );
|
||||
switch( i )
|
||||
{
|
||||
default: ASSERT(0);
|
||||
case TW_W1: defaultValueOut = 0.0225f; break;
|
||||
case TW_W2: defaultValueOut = 0.045f; break;
|
||||
case TW_W3: defaultValueOut = 0.090f; break;
|
||||
case TW_W4: defaultValueOut = 0.135f; break;
|
||||
case TW_W5: defaultValueOut = 0.180f; break;
|
||||
case TW_Mine: defaultValueOut = 0.090f; break; // same as great
|
||||
case TW_Hold: defaultValueOut = 0.250f; break; // allow enough time to take foot off and put back on
|
||||
case TW_Roll: defaultValueOut = 0.350f; break;
|
||||
case TW_Attack: defaultValueOut = 0.135f; break;
|
||||
}
|
||||
}
|
||||
|
||||
static Preference<float> m_fTimingWindowScale ( "TimingWindowScale", 1.0f );
|
||||
static Preference<float> m_fTimingWindowAdd ( "TimingWindowAdd", 0 );
|
||||
static Preference1D<float> m_fTimingWindowSeconds( TimingWindowSecondsInit, NUM_TimingWindow );
|
||||
|
||||
float Player::GetWindowSeconds( TimingWindow tw )
|
||||
{
|
||||
float fSecs = m_fTimingWindowSeconds[tw];
|
||||
fSecs *= m_fTimingWindowScale;
|
||||
fSecs += m_fTimingWindowAdd;
|
||||
return fSecs;
|
||||
}
|
||||
|
||||
@@ -679,7 +701,7 @@ void Player::Update( float fDeltaTime )
|
||||
else
|
||||
{
|
||||
// Decrease life
|
||||
fLife -= fDeltaTime/ADJUSTED_WINDOW_SECONDS(TW_Hold);
|
||||
fLife -= fDeltaTime/GetWindowSeconds(TW_Hold);
|
||||
fLife = max( fLife, 0 ); // clamp
|
||||
}
|
||||
break;
|
||||
@@ -690,7 +712,7 @@ void Player::Update( float fDeltaTime )
|
||||
// give positive life in Step(), not here.
|
||||
|
||||
// Decrease life
|
||||
fLife -= fDeltaTime/ADJUSTED_WINDOW_SECONDS(TW_Roll);
|
||||
fLife -= fDeltaTime/GetWindowSeconds(TW_Roll);
|
||||
fLife = max( fLife, 0 ); // clamp
|
||||
break;
|
||||
default:
|
||||
@@ -1211,23 +1233,23 @@ void Player::StepOrStrum( int col, int row, const RageTimer &tm, bool bHeld, boo
|
||||
{
|
||||
case TapNote::mine:
|
||||
// Stepped too close to mine?
|
||||
if( !bRelease && fSecondsFromExact <= ADJUSTED_WINDOW_SECONDS(TW_Mine) )
|
||||
if( !bRelease && fSecondsFromExact <= GetWindowSeconds(TW_Mine) )
|
||||
score = TNS_HitMine;
|
||||
break;
|
||||
|
||||
case TapNote::attack:
|
||||
if( !bRelease && fSecondsFromExact <= ADJUSTED_WINDOW_SECONDS(TW_Attack) && !pTN->result.bHidden )
|
||||
if( !bRelease && fSecondsFromExact <= GetWindowSeconds(TW_Attack) && !pTN->result.bHidden )
|
||||
score = TNS_W2; /* sentinel */
|
||||
break;
|
||||
|
||||
default:
|
||||
if( (pTN->type == TapNote::lift) == bRelease )
|
||||
{
|
||||
if( fSecondsFromExact <= ADJUSTED_WINDOW_SECONDS(TW_W1) ) score = TNS_W1;
|
||||
else if( fSecondsFromExact <= ADJUSTED_WINDOW_SECONDS(TW_W2) ) score = TNS_W2;
|
||||
else if( fSecondsFromExact <= ADJUSTED_WINDOW_SECONDS(TW_W3) ) score = TNS_W3;
|
||||
else if( fSecondsFromExact <= ADJUSTED_WINDOW_SECONDS(TW_W4) ) score = TNS_W4;
|
||||
else if( fSecondsFromExact <= ADJUSTED_WINDOW_SECONDS(TW_W5) ) score = TNS_W5;
|
||||
if( fSecondsFromExact <= GetWindowSeconds(TW_W1) ) score = TNS_W1;
|
||||
else if( fSecondsFromExact <= GetWindowSeconds(TW_W2) ) score = TNS_W2;
|
||||
else if( fSecondsFromExact <= GetWindowSeconds(TW_W3) ) score = TNS_W3;
|
||||
else if( fSecondsFromExact <= GetWindowSeconds(TW_W4) ) score = TNS_W4;
|
||||
else if( fSecondsFromExact <= GetWindowSeconds(TW_W5) ) score = TNS_W5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1242,7 +1264,7 @@ void Player::StepOrStrum( int col, int row, const RageTimer &tm, bool bHeld, boo
|
||||
// GetTapNoteScore always returns TNS_W1 in autoplay.
|
||||
// If the step is far away, don't judge it.
|
||||
if( m_pPlayerState->m_PlayerController == PC_AUTOPLAY &&
|
||||
fSecondsFromExact > ADJUSTED_WINDOW_SECONDS(TW_W5) )
|
||||
fSecondsFromExact > GetWindowSeconds(TW_W5) )
|
||||
{
|
||||
score = TNS_None;
|
||||
break;
|
||||
@@ -1894,7 +1916,7 @@ void Player::HandleHoldScore( const TapNote &tn )
|
||||
|
||||
float Player::GetMaxStepDistanceSeconds()
|
||||
{
|
||||
return GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate * ADJUSTED_WINDOW_SECONDS(TW_W5);
|
||||
return GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate * GetWindowSeconds(TW_W5);
|
||||
}
|
||||
|
||||
void Player::FadeToFail()
|
||||
|
||||
@@ -126,6 +126,7 @@ public:
|
||||
void SetPaused( bool bPaused ) { m_bPaused = bPaused; }
|
||||
|
||||
static float GetMaxStepDistanceSeconds();
|
||||
static float GetWindowSeconds( TimingWindow tw );
|
||||
const NoteData &GetNoteData() const { return m_NoteData; }
|
||||
bool HasNoteField() const { return m_pNoteField != NULL; }
|
||||
|
||||
|
||||
@@ -18,20 +18,6 @@
|
||||
|
||||
PrefsManager* PREFSMAN = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
static const char *TimingWindowNames[] = {
|
||||
"W1",
|
||||
"W2",
|
||||
"W3",
|
||||
"W4",
|
||||
"W5",
|
||||
"Mine",
|
||||
"Attack",
|
||||
"Hold",
|
||||
"Roll",
|
||||
};
|
||||
XToString( TimingWindow );
|
||||
|
||||
|
||||
static const char *ScoreEventNames[] = {
|
||||
"W1",
|
||||
"W2",
|
||||
@@ -149,24 +135,6 @@ bool g_bAutoRestart = false;
|
||||
# define TRUE_IF_DEBUG false
|
||||
#endif
|
||||
|
||||
void TimingWindowSecondsInit( size_t /*TimingWindow*/ i, RString &sNameOut, float &defaultValueOut )
|
||||
{
|
||||
sNameOut = "TimingWindowSeconds" + TimingWindowToString( (TimingWindow)i );
|
||||
switch( i )
|
||||
{
|
||||
default: ASSERT(0);
|
||||
case TW_W1: defaultValueOut = 0.0225f; break;
|
||||
case TW_W2: defaultValueOut = 0.045f; break;
|
||||
case TW_W3: defaultValueOut = 0.090f; break;
|
||||
case TW_W4: defaultValueOut = 0.135f; break;
|
||||
case TW_W5: defaultValueOut = 0.180f; break;
|
||||
case TW_Mine: defaultValueOut = 0.090f; break; // same as great
|
||||
case TW_Hold: defaultValueOut = 0.250f; break; // allow enough time to take foot off and put back on
|
||||
case TW_Roll: defaultValueOut = 0.350f; break;
|
||||
case TW_Attack: defaultValueOut = 0.135f; break;
|
||||
}
|
||||
}
|
||||
|
||||
void PercentScoreWeightInit( size_t /*ScoreEvent*/ i, RString &sNameOut, int &defaultValueOut )
|
||||
{
|
||||
sNameOut = "PercentScoreWeight" + ScoreEventToString( (ScoreEvent)i );
|
||||
@@ -289,10 +257,6 @@ PrefsManager::PrefsManager() :
|
||||
m_bOnlyDedicatedMenuButtons ( "OnlyDedicatedMenuButtons", false ),
|
||||
m_bMenuTimer ( "MenuTimer", true ),
|
||||
|
||||
m_fTimingWindowScale ( "TimingWindowScale", 1.0f ),
|
||||
m_fTimingWindowAdd ( "TimingWindowAdd", 0 ),
|
||||
m_fTimingWindowSeconds ( TimingWindowSecondsInit, NUM_TimingWindow ),
|
||||
|
||||
m_fLifeDifficultyScale ( "LifeDifficultyScale", 1.0f ),
|
||||
|
||||
|
||||
|
||||
@@ -130,11 +130,6 @@ public:
|
||||
Preference<bool> m_bOnlyDedicatedMenuButtons;
|
||||
Preference<bool> m_bMenuTimer;
|
||||
|
||||
Preference<float> m_fTimingWindowScale;
|
||||
Preference<float> m_fTimingWindowAdd; // this is useful for compensating for changes in sampling rate between devices
|
||||
|
||||
Preference1D<float> m_fTimingWindowSeconds;
|
||||
|
||||
Preference<float> m_fLifeDifficultyScale;
|
||||
|
||||
// Whoever added these: Please add a comment saying what they do. -Chris
|
||||
|
||||
Reference in New Issue
Block a user