syncing changes from ssc svn, mostly.

[Course.cpp] HasTimedMods() now actually checks for timed mods (technically non-global) instead of being a clone of HasMods()
[Player.cpp] add MAX_HOLD_LIFE/[Player] MaxHoldLife metric
[ScreenGameplay] looking into places to put loading of replay data, perhaps?
[elsewhere] lots of cleanup, and I'm sure there's lots more to be done.
add a todo to ProductivityHelpers.
This commit is contained in:
AJ Kelly
2010-02-02 16:00:10 -06:00
parent 81b4011423
commit ca8f660c4f
12 changed files with 93 additions and 77 deletions
+43 -46
View File
@@ -137,23 +137,23 @@ void Course::SetCourseType( CourseType ct )
m_iLives = -1;
if( !m_vEntries.empty() )
m_vEntries[0].fGainSeconds = 0;
switch( ct )
{
default: ASSERT(0);
case COURSE_TYPE_NONSTOP:
break;
break;
case COURSE_TYPE_ONI:
m_iLives = 4;
break;
break;
case COURSE_TYPE_ENDLESS:
m_bRepeat = true;
break;
break;
case COURSE_TYPE_SURVIVAL:
if( !m_vEntries.empty() )
m_vEntries[0].fGainSeconds = 120;
break;
}
break;
}
}
PlayMode Course::GetPlayMode() const
@@ -222,7 +222,7 @@ bool Course::IsPlayableIn( StepsType st ) const
FOREACH_CONST( CourseEntry, m_vEntries, e )
{
SongCriteria soc = e->songCriteria;
Song *pSong = e->songID.ToSong();
if( pSong )
{
@@ -233,27 +233,27 @@ bool Course::IsPlayableIn( StepsType st ) const
soc.m_Locked = SongCriteria::Locked_Unlocked;
if( !soc.m_bUseSongAllowedList )
soc.m_iMaxStagesForSong = 1;
StepsCriteria stc = e->stepsCriteria;
stc.m_st = st;
stc.m_Locked = StepsCriteria::Locked_Unlocked;
const bool bSameSongCriteria = e != m_vEntries.begin() && (e-1)->songCriteria == soc;
const bool bSameStepsCriteria = e != m_vEntries.begin() && (e-1)->stepsCriteria == stc;
if( pSong )
{
if( StepsUtil::HasMatching(pSong, stc) )
if( StepsUtil::HasMatching(pSong, stc) )
return true;
}
else if( !(bSameSongCriteria && bSameStepsCriteria) )
{
if( StepsUtil::HasMatching(soc, stc) )
return true;
return true;
}
}
return false;
}
@@ -307,18 +307,14 @@ Trail* Course::GetTrail( StepsType st, CourseDifficulty cd ) const
{
ASSERT( cd != Difficulty_Invalid );
//
// Check to see if the Trail cache is out of date
//
if( m_iTrailCacheSeed != GAMESTATE->m_iStageSeed )
{
RegenerateNonFixedTrails();
m_iTrailCacheSeed = GAMESTATE->m_iStageSeed;
}
//
// Look in the Trail cache
//
{
TrailCache_t::iterator it = m_TrailCache.find( CacheEntry(st, cd) );
if( it != m_TrailCache.end() )
@@ -335,22 +331,18 @@ Trail* Course::GetTrail( StepsType st, CourseDifficulty cd ) const
Trail* Course::GetTrailForceRegenCache( StepsType st, CourseDifficulty cd ) const
{
//
// Construct a new Trail, add it to the cache, then return it.
//
CacheData &cache = m_TrailCache[ CacheEntry(st, cd) ];
Trail &trail = cache.trail;
trail.Init();
if( !GetTrailSorted(st, cd, trail) )
{
/* This course difficulty doesn't exist. */
// This course difficulty doesn't exist.
cache.null = true;
return NULL;
}
//
// If we have cached RadarValues for this trail, insert them.
//
{
RadarCache_t::const_iterator it = m_RadarCache.find( CacheEntry( st, cd ) );
if( it != m_RadarCache.end() )
@@ -453,10 +445,8 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
return false;
}
//
// Construct a new Trail, add it to the cache, then return it.
//
/* Different seed for each course, but the same for the whole round: */
// Different seed for each course, but the same for the whole round:
RandomGen rnd( GAMESTATE->m_iStageSeed + GetHashForString(m_sMainTitle) );
vector<CourseEntry> tmp_entries;
@@ -471,7 +461,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
const vector<CourseEntry> &entries = m_bShuffle ? tmp_entries:m_vEntries;
/* This can take some time, so don't fill it out unless we need it. */
// This can take some time, so don't fill it out unless we need it.
vector<Song*> vSongsByMostPlayed;
vector<Song*> AllSongsShuffled;
@@ -479,7 +469,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
trail.m_CourseType = GetCourseType();
trail.m_CourseDifficulty = cd;
/* Set to true if CourseDifficulty is able to change something. */
// Set to true if CourseDifficulty is able to change something.
bool bCourseDifficultyIsSignificant = (cd == Difficulty_Medium);
vector<Song*> vpAllPossibleSongs;
@@ -490,7 +480,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
{
SongAndSteps resolved; // fill this in
SongCriteria soc = e->songCriteria;
Song *pSong = e->songID.ToSong();
if( pSong )
{
@@ -505,7 +495,7 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
StepsCriteria stc = e->stepsCriteria;
stc.m_st = st;
stc.m_Locked = StepsCriteria::Locked_Unlocked;
const bool bSameSongCriteria = e != entries.begin() && (e-1)->songCriteria == soc;
const bool bSameStepsCriteria = e != entries.begin() && (e-1)->stepsCriteria == stc;
@@ -525,7 +515,6 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
if( trail.m_vEntries.size() > 0 && vSongAndSteps.size() > 1 )
{
const TrailEntry &teLast = trail.m_vEntries.back();
RemoveIf( vSongAndSteps, SongIsEqual(teLast.pSong) );
}
@@ -539,14 +528,14 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
FOREACH_CONST( SongAndSteps, vSongAndSteps, sas )
{
StepsVector &v = mapSongToSteps[sas->pSong];
v.push_back( sas->pSteps );
if( v.size() == 1 )
vpSongs.push_back( sas->pSong );
}
CourseSortSongs( e->songSort, vpSongs, rnd );
ASSERT( e->iChooseIndex >= 0 );
if( e->iChooseIndex < int(vSongAndSteps.size()) )
{
@@ -651,9 +640,9 @@ bool Course::GetTrailUnsorted( StepsType st, CourseDifficulty cd, Trail &trail )
trail.m_vEntries.push_back( te );
// LOG->Trace( "Chose: %s, %d", te.pSong->GetSongDir().c_str(), te.pSteps->GetMeter() );
if( IsAnEdit() && MAX_SONGS_IN_EDIT_COURSE > 0 &&
int(trail.m_vEntries.size()) >= MAX_SONGS_IN_EDIT_COURSE )
int(trail.m_vEntries.size()) >= MAX_SONGS_IN_EDIT_COURSE )
{
break;
}
@@ -723,13 +712,22 @@ bool Course::HasMods() const
bool Course::HasTimedMods() const
{
// ???: This seems to be the exact same as Course::HasMods(). -aj
// What makes this different from the SM4 implementation is that
// HasTimedMods now searches for bGlobal in the attacks; if one of
// them is false, it has timed mods. Also returning false will probably
// take longer than expected. -aj
FOREACH_CONST( CourseEntry, m_vEntries, e )
{
if( !e->attacks.empty() )
return true;
{
for( unsigned s=0; s < e->attacks.size(); s++ )
{
Attack &attack = e->attacks[s];
if(!attack.bGlobal)
return true;
}
}
}
return false;
}
@@ -779,7 +777,7 @@ void Course::Invalidate( const Song *pStaleSong )
// Invalidate any Trails that contain this song.
// If we find a Trail that contains this song, then it's part of a
// non-fixed entry. So, regenerating the Trail will force different
// non-fixed entry. So, regenerating the Trail will force different
// songs to be chosen.
FOREACH_ENUM( StepsType,st )
{
@@ -820,7 +818,7 @@ RageColor Course::GetColor() const
switch( PREFSMAN->m_CourseSortOrder )
{
case COURSE_SORT_PREFERRED:
return SORT_PREFERRED_COLOR; //This will also be used for autogen'd courses in some cases.
return SORT_PREFERRED_COLOR; //This will also be used for autogen'd courses in some cases.
case COURSE_SORT_SONGS:
if( m_vEntries.size() >= 7 ) return SORT_LEVEL2_COLOR;
@@ -848,7 +846,7 @@ RageColor Course::GetColor() const
else return SORT_LEVEL4_COLOR;
default:
FAIL_M( ssprintf("Invalid course sort %d.", int(PREFSMAN->m_CourseSortOrder)) );
return RageColor(1,1,1,1); // white, never should reach here
return RageColor(1,1,1,1); // white; should never reach here
}
}
@@ -911,9 +909,8 @@ void Course::UpdateCourseStats( StepsType st )
m_SortOrder_TotalDifficulty += pTrail != NULL? pTrail->GetTotalMeter():0;
// OPTIMIZATION: Ranking info isn't dependant on style, so
// call it sparingly. Its handled on startup and when
// themes change..
// OPTIMIZATION: Ranking info isn't dependent on style, so call it
// sparingly. It's handled on startup and when themes change.
LOG->Trace("%s: Total feet: %d",
this->m_sMainTitle.c_str(),
@@ -923,7 +920,7 @@ void Course::UpdateCourseStats( StepsType st )
bool Course::IsRanking() const
{
vector<RString> rankingsongs;
split(THEME->GetMetric("ScreenRanking", "CoursesToShow"), ",", rankingsongs);
for(unsigned i=0; i < rankingsongs.size(); i++)
@@ -960,7 +957,7 @@ void Course::GetAllCachedTrails( vector<Trail *> &out )
bool Course::ShowInDemonstrationAndRanking() const
{
// Don't show endless courses in Ranking.
// todo: make this a metric? -aj
// todo: make this a metric of course types not to show? -aj
return !IsEndless();
}
-2
View File
@@ -19,9 +19,7 @@ public:
void LoadFromMultiPlayer( MultiPlayer mp );
virtual void HandleMessage( const Message &msg );
//
// Lua
//
virtual void PushSelf( lua_State *L );
protected:
+8 -4
View File
@@ -127,7 +127,7 @@ static Preference<bool> g_bEnableMineSoundPlayback ( "EnableMineHitSound", true
Preference<float> g_fTimingWindowHopo ( "TimingWindowHopo", 0.25 ); // max time between notes in a hopo chain
Preference<float> g_fTimingWindowStrum ( "TimingWindowStrum", 0.1f ); // max time between strum and when the frets must match
ThemeMetric<float> INITIAL_HOLD_LIFE ( "Player", "InitialHoldLife" );
ThemeMetric<float> MAX_HOLD_LIFE ( "Player", "MaxHoldLife" );
ThemeMetric<float> MAX_HOLD_LIFE ( "Player", "MaxHoldLife" ); // sm-ssc addition
ThemeMetric<bool> PENALIZE_TAP_SCORE_NONE ( "Player", "PenalizeTapScoreNone" );
ThemeMetric<bool> JUDGE_HOLD_NOTES_ON_SAME_ROW_TOGETHER ( "Player", "JudgeHoldNotesOnSameRowTogether" );
ThemeMetric<bool> HOLD_CHECKPOINTS ( "Player", "HoldCheckpoints" );
@@ -137,7 +137,7 @@ ThemeMetric<bool> REQUIRE_STEP_ON_HOLD_HEADS ( "Player", "RequireStepOnHoldHeads
//ThemeMetric<bool> REQUIRE_STEP_ON_TAP_NOTES ( "Player", "RequireStepOnTapNotes" ); // parastar stuff; leave in though
ThemeMetric<bool> ROLL_BODY_INCREMENTS_COMBO ( "Player", "RollBodyIncrementsCombo" );
ThemeMetric<bool> CHECKPOINTS_TAPS_SEPARATE_JUDGMENT ( "Player", "CheckpointsTapsSeparateJudgment" );
ThemeMetric<bool> SCORE_MISSED_HOLDS_AND_ROLLS ( "Player", "ScoreMissedHoldsAndRolls" );
ThemeMetric<bool> SCORE_MISSED_HOLDS_AND_ROLLS ( "Player", "ScoreMissedHoldsAndRolls" ); // sm-ssc addition
float Player::GetWindowSeconds( TimingWindow tw )
{
@@ -374,6 +374,7 @@ void Player::Init(
for( int i = 0; i < GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer; ++i )
{
HoldJudgment *pJudgment = new HoldJudgment;
// xxx: assumes sprite; todo: don't force 1x2 -aj
pJudgment->Load( THEME->GetPathG("HoldJudgment","label 1x2") );
m_vpHoldJudgment[i] = pJudgment;
this->AddChild( m_vpHoldJudgment[i] );
@@ -671,6 +672,7 @@ void Player::Update( float fDeltaTime )
// Update Y positions
{
// todo: unhardcode hold judgment cmds -aj
for( int c=0; c<GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer; c++ )
{
float fPercentReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(c);
@@ -1040,7 +1042,7 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vector<TrackRowTap
if( bInitiatedNote && bIsHoldingButton )
{
// Increase life
fLife = MAX_HOLD_LIFE;
fLife = MAX_HOLD_LIFE; // was 1 -aj
}
else
{
@@ -1976,6 +1978,9 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b
/*
case PC_REPLAY:
// based on where we are, see what grade to get.
score = PlayerAI::GetTapNoteScore( m_pPlayerState );
// row is the current row, col is current column (track)
fNoteOffset = TapNoteOffset attribute
break;
*/
default:
@@ -2588,7 +2593,6 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
Step( iTrack, iRow, now, false, false );
if( m_pPlayerState->m_PlayerController == PC_AUTOPLAY )
{
if( m_pPlayerStageStats )
m_pPlayerStageStats->m_bDisqualified = true;
}
+1
View File
@@ -75,6 +75,7 @@ TapNoteScore PlayerAI::GetTapNoteScore( const PlayerState* pPlayerState )
return TNS_W1;
/*
// handle replay data playback -aj
if( pPlayerState->m_PlayerController == PC_REPLAY )
{
// ghost house
+6
View File
@@ -2811,6 +2811,12 @@ void ScreenGameplay::SaveReplay()
}
}
/*
bool ScreenGameplay::LoadReplay()
{
// Load
}
*/
// lua start
#include "LuaBinding.h"
+1
View File
@@ -177,6 +177,7 @@ protected:
virtual void SaveStats();
virtual void StageFinished( bool bBackedOut );
void SaveReplay();
//bool LoadReplay();
bool AllAreFailing();
virtual void InitSongQueues();
+7 -7
View File
@@ -474,7 +474,8 @@ void ScreenSelectMaster::UpdateSelectableChoices()
vector<PlayerNumber> vpns;
GetActiveElementPlayerNumbers( vpns );
if(m_bUsingTwoLists && m_iSelectedList == 1) // using two lists and on the 2nd list
// using two lists and on the 2nd list
if(m_bUsingTwoLists && m_iSelectedList == 1)
{
for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{
@@ -482,13 +483,13 @@ void ScreenSelectMaster::UpdateSelectableChoices()
{
m_vsprIcon[c]->PlayCommand( "List2Enabled" );
}
FOREACH( PlayerNumber, vpns, p )
if( m_vsprScroll[*p][c].IsLoaded() )
{
m_vsprScroll[*p][c]->PlayCommand( "List2Enabled" );
}
}
}
for( unsigned c=0; c<m_aGameCommandsB.size(); c++ )
{
@@ -496,14 +497,14 @@ void ScreenSelectMaster::UpdateSelectableChoices()
{
m_vsprIconB[c]->PlayCommand( "List2Enabled" );
m_vsprIconB[c]->PlayCommand( m_aGameCommandsB[c].IsPlayable()? "Enabled":"Disabled" );
// we will make element 0 the new selection, so it will gain focus
if(c==0)
m_vsprIconB[c]->PlayCommand( "GainFocus" );
else // everything else loses focus
m_vsprIconB[c]->PlayCommand( "LoseFocus" );
}
FOREACH( PlayerNumber, vpns, p )
if( m_vsprScrollB[*p][c].IsLoaded() )
{
@@ -516,11 +517,10 @@ void ScreenSelectMaster::UpdateSelectableChoices()
m_vsprScrollB[*p][c]->PlayCommand( "LoseFocus" );
}
}
}
}
else
{
for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{
if( SHOW_ICON )
+1 -5
View File
@@ -97,9 +97,7 @@ static LocalizedString COLLECTING_SAMPLE( "ScreenSyncOverlay", "Collecting sampl
static LocalizedString STANDARD_DEVIATION( "ScreenSyncOverlay", "Standard deviation" );
void ScreenSyncOverlay::UpdateText()
{
//
// Update Status
//
vector<RString> vs;
if( g_bShowAutoplay )
@@ -126,14 +124,12 @@ void ScreenSyncOverlay::UpdateText()
{
AdjustSync::GetSyncChangeTextGlobal( vs );
AdjustSync::GetSyncChangeTextSong( vs );
}
}
m_textStatus.SetText( join("\n",vs) );
//
// Update SyncInfo
//
bool bVisible = GAMESTATE->m_SongOptions.GetCurrent().m_AutosyncType != SongOptions::AUTOSYNC_OFF;
m_textAdjustments.SetVisible( bVisible );
if( bVisible )
+8 -6
View File
@@ -103,8 +103,10 @@ void StepMania::GetPreferredVideoModeParams( VideoModeParams &paramsOut )
int iWidth = PREFSMAN->m_iDisplayWidth;
if( PREFSMAN->m_bWindowed )
{
//float fRatio = PREFSMAN->m_iDisplayWidth / PREFSMAN->m_iDisplayHeight;
//iWidth = PREFSMAN->m_iDisplayHeight * fRatio;
/*
float fRatio = PREFSMAN->m_iDisplayWidth / PREFSMAN->m_iDisplayHeight;
iWidth = PREFSMAN->m_iDisplayHeight * fRatio;
*/
iWidth = PREFSMAN->m_iDisplayHeight * PREFSMAN->m_fDisplayAspectRatio;
}
@@ -645,11 +647,11 @@ bool CheckVideoDefaultSettings()
{
// Video card changed since last run
RString sVideoDriver = GetVideoDriverName();
LOG->Trace( "Last seen video driver: %s", PREFSMAN->m_sLastSeenVideoDriver.Get().c_str() );
VideoCardDefaults defaults;
for( unsigned i=0; i<ARRAYLEN(g_VideoCardDefaults); i++ )
{
defaults = g_VideoCardDefaults[i];
@@ -677,7 +679,7 @@ found_defaults:
bSetDefaultVideoParams = true;
LOG->Trace( "Video card has changed from %s to %s. Applying new defaults.", PREFSMAN->m_sLastSeenVideoDriver.Get().c_str(), sVideoDriver.c_str() );
}
if( bSetDefaultVideoParams )
{
PREFSMAN->m_sVideoRenderers.Set( defaults.sVideoRenderers );
@@ -915,7 +917,7 @@ static void WriteLogHeader()
#endif
// this code should only be enabled in distributed builds
LOG->Info("sm-ssc is Copyright ©2009 the spinal shark collective, all rights reserved. Commercial use of this binary is prohibited by law and will be prosecuted to the fullest extent of the law.");
LOG->Info("sm-ssc is Copyright ©2009 the spinal shark collective, all rights reserved. Commercial use of this binary is prohibited by law and will be prosecuted to the fullest extent of the law.");
// end limited code
time_t cur_time;
+15 -5
View File
@@ -59,7 +59,6 @@ void StepsDisplay::Load( const RString &sMetricsGroup, const PlayerState *pPlaye
m_bShowStepsType.Load(m_sMetricsGroup,"ShowStepsType");
m_sZeroMeterString.Load(m_sMetricsGroup,"ZeroMeterString");
m_sprFrame.Load( THEME->GetPathG(m_sMetricsGroup,"frame") );
m_sprFrame->SetName( "Frame" );
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_sprFrame, m_sMetricsGroup );
@@ -67,7 +66,7 @@ void StepsDisplay::Load( const RString &sMetricsGroup, const PlayerState *pPlaye
if( m_bShowTicks )
{
RString sChars = "10"; // on, off
RString sChars = "10"; // on, off (todo: make this metricable -aj)
m_textTicks.SetName( "Ticks" );
m_textTicks.LoadFromTextureAndChars( THEME->GetPathF(m_sMetricsGroup,"ticks"), sChars );
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_textTicks, m_sMetricsGroup );
@@ -84,7 +83,7 @@ void StepsDisplay::Load( const RString &sMetricsGroup, const PlayerState *pPlaye
// These commands should have been loaded by SetXYAndOnCommand above.
ASSERT( m_textMeter.HasCommand("Set") );
}
if( m_bShowDescription )
{
m_textDescription.SetName( "Description" );
@@ -92,7 +91,7 @@ void StepsDisplay::Load( const RString &sMetricsGroup, const PlayerState *pPlaye
ActorUtil::LoadAllCommandsAndSetXYAndOnCommand( m_textDescription, m_sMetricsGroup );
this->AddChild( &m_textDescription );
}
if( m_bShowAutogen )
{
m_sprAutogen.Load( THEME->GetPathG(m_sMetricsGroup,"Autogen") );
@@ -242,13 +241,24 @@ void StepsDisplay::SetInternal( const SetParams &params )
{
m_textDescription.SetText( sDisplayDescription );
}
if( m_bShowAutogen )
{
bool b = params.pSteps && params.pSteps->IsAutogen();
m_sprAutogen->SetVisible( b );
}
if( m_bShowStepsType )
{
if( params.st != StepsType_Invalid )
{
/*
RString sStepsType = GAMEMAN->GetStepsTypeInfo(params.st).szName;
m_sprStepsType.Load( THEME->GetPathG(m_sMetricsGroup,"StepsType "+sStepsType) );
*/
}
}
this->HandleMessage( msg );
}
+2 -2
View File
@@ -107,12 +107,12 @@ public:
* Return true if the application has input focus.
*/
bool AppHasFocus() const { return m_bHasFocus; }
/*
* Returns true if the application's focus has changed since last called.
*/
bool AppFocusChanged();
/*
* Open a URL in the default web browser
*/