cleanup and comment part unknown of a trillion

This commit is contained in:
AJ Kelly
2010-03-09 12:21:56 -06:00
parent 31c69f1d9c
commit a7b52df0fa
12 changed files with 160 additions and 169 deletions
+3 -3
View File
@@ -147,7 +147,7 @@ void Bookkeeper::CoinInserted()
++m_mapCoinsForHour[d];
}
/* Return the number of coins between [beginning,ending). */
// Return the number of coins between [beginning,ending).
int Bookkeeper::GetNumCoinsInRange( map<Date,int>::const_iterator begin, map<Date,int>::const_iterator end ) const
{
int iCoins = 0;
@@ -206,8 +206,8 @@ void Bookkeeper::GetCoinsLastWeeks( int coins[NUM_LAST_WEEKS] ) const
}
}
/* iDay is days since Jan 1. iYear is eg. 2005. Return the day of the week, where
* 0 is Sunday. */
/* iDay is days since Jan 1. iYear is eg. 2005. Return the day of the week,
* where 0 is Sunday. */
void Bookkeeper::GetCoinsByDayOfWeek( int coins[DAYS_IN_WEEK] ) const
{
for( int i=0; i<DAYS_IN_WEEK; i++ )
+4 -4
View File
@@ -49,7 +49,7 @@ void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss )
const float fFirstSecond = 0;
const float fLastSecond = s.GetTotalPossibleStepsSeconds();
/* Find the largest combo. */
// Find the largest combo.
int iMaxComboSize = 0;
for( unsigned i = 0; i < pss.m_ComboList.size(); ++i )
iMaxComboSize = max( iMaxComboSize, pss.m_ComboList[i].GetStageCnt() );
@@ -58,7 +58,7 @@ void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss )
{
const PlayerStageStats::Combo_t &combo = pss.m_ComboList[i];
if( combo.GetStageCnt() < MinComboSizeToShow )
continue; /* too small */
continue; // too small
const bool bIsMax = (combo.GetStageCnt() == iMaxComboSize);
@@ -80,7 +80,7 @@ void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss )
{
const PlayerStageStats::Combo_t &combo = pss.m_ComboList[i];
if( combo.GetStageCnt() < MinComboSizeToShow )
continue; /* too small */
continue; // too small
if( !iMaxComboSize )
continue;
@@ -103,7 +103,7 @@ void ComboGraph::Set( const StageStats &s, const PlayerStageStats &pss )
this->AddChild( pText );
}
/* Hide the templates. */
// Hide the templates.
m_pNormalCombo->SetVisible( false );
m_pMaxCombo->SetVisible( false );
m_pComboNumber->SetVisible( false );
-2
View File
@@ -18,9 +18,7 @@ public:
virtual ComboGraph *Copy() const;
virtual bool AutoLoadChildren() const { return true; }
//
// Commands
//
virtual void PushSelf( lua_State *L );
private:
+2 -2
View File
@@ -78,7 +78,7 @@ public:
GoalType m_GoalType;
RString m_sProfileID;
RString m_sUrl;
/* sm-ssc adds: */
// sm-ssc adds:
bool m_bUrlExits; // for making stepmania not exit on url
bool m_bPushScreen; // for pushing a screen on top instead of as next
@@ -86,7 +86,7 @@ public:
bool m_bClearCredits;
bool m_bStopMusic;
bool m_bApplyDefaultOptions;
/* sm-ssc also adds: */
// sm-ssc also adds:
bool m_bFadeMusic;
float m_fMusicFadeOutVolume;
// currently, GameSoundManager uses consts for fade out/in times, so this
+11 -11
View File
@@ -79,7 +79,7 @@ int GetSuccessfulMines( const NoteData &in, int iStartIndex = 0, int iEndIndex =
return iNumSuccessfulMinesNotes;
}
/* See NoteData::GetNumHands(). */
// See NoteData::GetNumHands().
int GetSuccessfulHands( const NoteData &in, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW )
{
int iNum = 0;
@@ -105,7 +105,7 @@ int GetSuccessfulHands( const NoteData &in, int iStartIndex = 0, int iEndIndex =
if( Missed )
continue;
/* Check hold scores. */
// Check hold scores.
for( int t=0; t<in.GetNumTracks(); ++t )
{
int iHeadRow;
@@ -113,8 +113,8 @@ int GetSuccessfulHands( const NoteData &in, int iStartIndex = 0, int iEndIndex =
continue;
const TapNote &tn = in.GetTapNote( t, iHeadRow );
/* If a hold is released *after* a hands containing it, the hands is
* still good. So, ignore the judgement and only examine iLastHeldRow
/* If a hold is released *after* a hand containing it, the hand is
* still good. Ignore the judgement and only examine iLastHeldRow
* to be sure that the hold was still held at the point of this row.
* (Note that if the hold head tap was missed, then iLastHeldRow == i
* and this won't fail--but the tap check above will have already failed.) */
@@ -227,7 +227,6 @@ const TapNote &NoteDataWithScoring::LastTapNoteWithResult( const NoteData &in, u
return in.GetTapNote( iTrack, iRow );
}
/* Return the minimum tap score of a row. If the row isn't complete (not all
* taps have been hit), return TNS_None or TNS_Miss. */
TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned row )
@@ -236,7 +235,7 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore( const NoteData &in, unsigned
TapNoteScore score = TNS_W1;
for( int t=0; t<in.GetNumTracks(); t++ )
{
/* Ignore mines (and fake arrows), or the score will always be TNS_None. */
// Ignore mines (and fake arrows), or the score will always be TNS_None.
const TapNote &tn = in.GetTapNote( t, row );
if( tn.type == TapNote::empty || tn.type == TapNote::mine || tn.type == TapNote::fake )
continue;
@@ -254,7 +253,7 @@ bool NoteDataWithScoring::IsRowCompletelyJudged( const NoteData &in, unsigned ro
namespace
{
/* Return the ratio of actual to possible Bs. */
// Return the ratio of actual to possible Bs.
float GetActualStreamRadarValue( const NoteData &in, float fSongSeconds )
{
int iTotalSteps = in.GetNumTapNotes();
@@ -268,10 +267,11 @@ float GetActualStreamRadarValue( const NoteData &in, float fSongSeconds )
/* Return the ratio of actual combo to max combo. */
float GetActualVoltageRadarValue( const NoteData &in, float fSongSeconds, const PlayerStageStats &pss )
{
/* STATSMAN->m_CurStageStats.iMaxCombo is unrelated to GetNumTapNotes: m_bComboContinuesBetweenSongs
* might be on, and the way combo is counted varies depending on the mode and score
* keeper. Instead, let's use the length of the longest recorded combo. This is
* only subtly different: it's the percent of the song the longest combo took to get. */
/* STATSMAN->m_CurStageStats.iMaxCombo is unrelated to GetNumTapNotes:
* m_bComboContinuesBetweenSongs might be on, and the way combo is counted
* varies depending on the mode and score keeper. Instead, let's use the
* length of the longest recorded combo. This is only subtly different:
* it's the percent of the song the longest combo took to get. */
const PlayerStageStats::Combo_t MaxCombo = pss.GetMaxCombo();
float fComboPercent = SCALE( MaxCombo.m_fSizeSeconds, 0, pss.m_fLastSecond-pss.m_fFirstSecond, 0.0f, 1.0f );
return clamp( fComboPercent, 0.0f, 1.0f );
+12 -10
View File
@@ -428,8 +428,8 @@ float PlayerStageStats::GetCurrentLife() const
return iter->second;
}
/* If bRollover is true, we're being called before gameplay begins, so we can record
* the amount of the first combo that comes from the previous song. */
/* If bRollover is true, we're being called before gameplay begins, so we can
* record the amount of the first combo that comes from the previous song. */
void PlayerStageStats::UpdateComboList( float fSecond, bool bRollover )
{
// Don't save combo stats in endless courses, or could run OOM in a few hours.
@@ -448,21 +448,21 @@ void PlayerStageStats::UpdateComboList( float fSecond, bool bRollover )
int cnt = m_iCurCombo;
if( !cnt )
return; /* no combo */
return; // no combo
if( m_ComboList.size() == 0 || m_ComboList.back().m_cnt >= cnt )
{
/* If the previous combo (if any) starts on -9999, then we rolled over some
* combo, but missed the first step. Remove it. */
/* If the previous combo (if any) starts on -9999, then we rolled over
* some combo, but missed the first step. Remove it. */
if( m_ComboList.size() && m_ComboList.back().m_fStartSecond == -9999 )
m_ComboList.erase( m_ComboList.begin()+m_ComboList.size()-1, m_ComboList.end() );
/* This is a new combo. */
// This is a new combo.
Combo_t NewCombo;
/* "start" is the position that the combo started within this song. If we're
* recording rollover, the combo hasn't started yet (within this song), so put
* a placeholder in and set it on the next call. (Otherwise, start will be less
* than fFirstPos.) */
/* "start" is the position that the combo started within this song.
* If we're recording rollover, the combo hasn't started yet (within
* this song), so put a placeholder in and set it on the next call.
* (Otherwise, start will be less than fFirstPos.) */
if( bRollover )
NewCombo.m_fStartSecond = -9999;
else
@@ -682,6 +682,7 @@ public:
DEFINE_METHOD( GetPeakComboAward, m_PeakComboAward )
DEFINE_METHOD( IsDisqualified, IsDisqualified() )
DEFINE_METHOD( GetAliveSeconds, m_fAliveSeconds )
DEFINE_METHOD( GetPercentageOfTaps, GetPercentageOfTaps( Enum::Check<TapNoteScore>(L, 1) ) )
static int GetPlayedSteps( T* p, lua_State *L )
{
@@ -734,6 +735,7 @@ public:
ADD_METHOD( GetPlayedSteps );
ADD_METHOD( GetPossibleSteps );
ADD_METHOD( GetAliveSeconds );
ADD_METHOD( GetPercentageOfTaps );
}
};
+6 -6
View File
@@ -72,18 +72,18 @@ public:
struct Combo_t
{
/* Start and size of this combo, in the same scale as the combo list mapping and
* the life record. */
/* Start and size of this combo, in the same scale as the combo list
* mapping and the life record. */
float m_fStartSecond, m_fSizeSeconds;
/* Combo size, in steps. */
// Combo size, in steps.
int m_cnt;
/* Size of the combo that didn't come from this stage (rollover from the last song).
* (This is a subset of cnt.) */
/* Size of the combo that didn't come from this stage (rollover from the
* last song). (This is a subset of cnt.) */
int m_rollover;
/* Get the size of the combo that came from this song. */
// Get the size of the combo that came from this song.
int GetStageCnt() const { return m_cnt - m_rollover; }
Combo_t(): m_fStartSecond(0), m_fSizeSeconds(0), m_cnt(0), m_rollover(0) { }
+8 -6
View File
@@ -62,7 +62,7 @@ void PlayerState::Update( float fDelta )
bool bRebuildPlayerOptions = false;
/* See if any delayed attacks are starting or ending. */
// See if any delayed attacks are starting or ending.
for( unsigned s=0; s<m_ActiveAttacks.size(); s++ )
{
Attack &attack = m_ActiveAttacks[s];
@@ -78,7 +78,7 @@ void PlayerState::Update( float fDelta )
GAMESTATE->m_fMusicSeconds < attack.fStartSecond+attack.fSecsRemaining );
if( m_ActiveAttacks[s].bOn == bCurrentlyEnabled )
continue; /* OK */
continue; // OK
if( m_ActiveAttacks[s].bOn && !bCurrentlyEnabled )
m_bAttackEndedThisUpdate = true;
@@ -93,7 +93,7 @@ void PlayerState::Update( float fDelta )
if( bRebuildPlayerOptions )
RebuildPlayerOptionsFromActiveAttacks();
/* Update after enabling attacks, so we appraoch the new state. */
// Update after enabling attacks, so we approach the new state.
m_PlayerOptions.Update( fDelta );
if( m_fSecondsUntilAttacksPhasedOut > 0 )
@@ -136,9 +136,9 @@ void PlayerState::LaunchAttack( const Attack& a )
Attack attack = a;
/* If fStartSecond is -1, it means "launch as soon as possible". For m_ActiveAttacks,
* mark the real time it's starting (now), so Update() can know when the attack started
* so it can be removed later. For m_ModsToApply, leave the -1 in, so Player::Update
* knows to apply attack transforms correctly. (yuck) */
* mark the real time it's starting (now), so Update() can know when the attack
* started so it can be removed later. For m_ModsToApply, leave the -1 in,
* so Player::Update knows to apply attack transforms correctly. (yuck) */
m_ModsToApply.push_back( attack );
if( attack.fStartSecond == -1 )
attack.fStartSecond = GAMESTATE->m_fMusicSeconds;
@@ -221,6 +221,7 @@ class LunaPlayerState: public Luna<PlayerState>
{
public:
DEFINE_METHOD( GetPlayerNumber, m_PlayerNumber );
DEFINE_METHOD( GetMultiPlayerNumber, m_mp );
DEFINE_METHOD( GetPlayerController, m_PlayerController );
static int SetPlayerOptions( T* p, lua_State *L )
{
@@ -241,6 +242,7 @@ public:
LunaPlayerState()
{
ADD_METHOD( GetPlayerNumber );
ADD_METHOD( GetMultiPlayerNumber );
ADD_METHOD( SetPlayerOptions );
ADD_METHOD( GetPlayerOptions );
}
+1 -3
View File
@@ -49,9 +49,7 @@ public:
SampleHistory m_EffectHistory;
//
// Used in Battle and Rave
//
void LaunchAttack( const Attack& a );
void RemoveActiveAttacks( AttackLevel al=NUM_ATTACK_LEVELS /*all*/ );
void EndActiveAttacks();
@@ -61,7 +59,7 @@ public:
// Attacks take a while to transition out of use. Account for this in PlayerAI
// by still penalizing it for 1 second after the player options are rebuilt.
int m_iLastPositiveSumOfAttackLevels;
float m_fSecondsUntilAttacksPhasedOut;// positive means PlayerAI is still affected
float m_fSecondsUntilAttacksPhasedOut; // positive means PlayerAI is still affected
bool m_bAttackBeganThisUpdate; // flag for other objects to watch (play sounds)
bool m_bAttackEndedThisUpdate; // flag for other objects to watch (play sounds)
+8 -12
View File
@@ -186,14 +186,14 @@ public:
Preference<bool> m_bMercifulSuperMeter; // negative super deltas are scaled by the players life percentage
Preference<bool> m_bDelayedBack;
Preference<bool> m_bShowInstructions; // how to play a mode
Preference<bool> m_bShowSelectGroup; // uh i thought we removed this shit
Preference<bool> m_bShowSelectGroup; // uh i thought we removed this shit -aj
Preference<bool> m_bShowCaution;
Preference<bool> m_bShowNativeLanguage;
Preference<int> m_iArcadeOptionsNavigation;
Preference<MusicWheelUsesSections> m_MusicWheelUsesSections;
Preference<int> m_iMusicWheelSwitchSpeed;
Preference<AllowW1> m_AllowW1; // this should almost always be on, given use cases.
Preference<bool> m_bEventMode; // IF THIS IS NOT TRUE I WILL SHIT IN YOUR MOUTH -aj
Preference<AllowW1> m_AllowW1; // this should almost always be on, given use cases. -aj
Preference<bool> m_bEventMode;
Preference<int> m_iCoinsPerCredit;
Preference<int> m_iSongsPerPlay;
Preference<bool> m_bDelayedCreditsReconcile; // zuh?
@@ -241,10 +241,10 @@ public:
Preference<bool> m_bTrilinearFiltering; // has no effect without mipmaps on
Preference<bool> m_bAnisotropicFiltering; // has no effect without mipmaps on. Not mutually exclusive with trilinear.
// If true, then signatures created when writing profile data
// and verified when reading profile data. Leave this false if
// you want to use a profile on different machines that don't
// have the same key, or else the profile's data will be discarded.
// If true, then signatures created when writing profile data and verified
// when reading profile data. Leave this false if you want to use a profile
// on different machines that don't have the same key, or else the
// profile's data will be discarded.
Preference<bool> m_bSignProfileData;
// course ranking
@@ -279,7 +279,7 @@ public:
Preference<bool> m_bQuirksMode; // enable quirky behavior desired by users of microsoft stepmania explorer 6.9
/* Debug: */
// Debug:
Preference<bool> m_bLogToDisk;
Preference<bool> m_bForceLogFlush;
Preference<bool> m_bShowLogOutput;
@@ -292,7 +292,6 @@ public:
Preference<bool> m_bEnableScoreboard; //Alows disabling of scoreboard in network play
#endif
void ReadPrefsFromIni( const IniFile &ini, const RString &sSection, bool bIsStatic );
void ReadGamePrefsFromIni( const RString &sIni );
void ReadDefaultsFromIni( const IniFile &ini, const RString &sSection );
@@ -313,9 +312,6 @@ protected:
void ReadDefaultsFromFile( const RString &sIni, const RString &sSection );
};
/* This is global, because it can be accessed by crash handlers and error handlers
* that are run after PREFSMAN shuts down (and probably don't want to deref that
* pointer anyway). */
+8 -13
View File
@@ -40,10 +40,8 @@ static float g_fImageScaleDestination = 1;
static const ThemeMetric<RageColor> LINE_ON_COLOR ("ScreenDebugOverlay", "LineOnColor");
static const ThemeMetric<RageColor> LINE_OFF_COLOR ("ScreenDebugOverlay", "LineOffColor");
//
// self-registering debug lines
// We don't use SubscriptionManager, because we want to keep the line order.
//
static LocalizedString ON ( "ScreenDebugOverlay", "on" );
static LocalizedString OFF ( "ScreenDebugOverlay", "off" );
@@ -256,6 +254,7 @@ void ScreenDebugOverlay::Init()
p->SetName( "PageText" );
p->LoadFromFont( THEME->GetPathF("ScreenDebugOverlay", "page") );
LOAD_ALL_COMMANDS( p );
// todo: be able to set different values? -aj
p->SetXY( SCREEN_CENTER_X-100+iPage*100, SCREEN_TOP+20 );
p->SetText( *s + " (" + sButton + ")" );
p->SetShadowLength( 1 );
@@ -299,7 +298,7 @@ void ScreenDebugOverlay::Update( float fDeltaTime )
if( INPUTFILTER->IsBeingPressed(g_Mappings.holdForFast) )
{
if( INPUTFILTER->IsBeingPressed(g_Mappings.holdForSlow) )
fRate = 0; /* both; stop time */
fRate = 0; // both; stop time
else
fRate *= 4;
}
@@ -352,6 +351,7 @@ void ScreenDebugOverlay::UpdateText()
m_vptextPages[iPage]->PlayCommand( (iPage == m_iCurrentPage) ? "GainFocus" : "LoseFocus" );
}
// todo: allow changing of various spacing/location things -aj
int iOffset = 0;
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
{
@@ -442,7 +442,7 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
if( g_bIsDisplayed && GetValueFromMap(g_Mappings.pageButton, input.DeviceI, iPage) )
{
if( input.type != IET_FIRST_PRESS )
return true; /* eat the input but do nothing */
return true; // eat the input but do nothing
m_iCurrentPage = iPage;
CLAMP( m_iCurrentPage, 0, (int) m_asPages.size()-1 );
return true;
@@ -454,8 +454,8 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
int i = p-g_pvpSubscribers->begin();
// Gameplay buttons are available only in gameplay. Non-gameplay buttons are
// only available when the screen is displayed.
// Gameplay buttons are available only in gameplay. Non-gameplay buttons
// are only available when the screen is displayed.
switch( (*p)->GetType() )
{
case IDebugLine::all_screens:
@@ -475,7 +475,7 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
if( input.DeviceI == (*p)->m_Button )
{
if( input.type != IET_FIRST_PRESS )
return true; /* eat the input but do nothing */
return true; // eat the input but do nothing
// do the action
RString sMessage;
@@ -509,9 +509,7 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
}
//
// DebugLine helpers
//
static void SetSpeed()
{
// PauseMusic( g_bIsHalt );
@@ -537,10 +535,7 @@ void ChangeVisualDelay( float fDelta )
}
//
// DebugLines
//
static LocalizedString AUTO_PLAY ( "ScreenDebugOverlay", "AutoPlay" );
static LocalizedString ASSIST ( "ScreenDebugOverlay", "Assist" );
static LocalizedString AUTOSYNC ( "ScreenDebugOverlay", "Autosync" );
@@ -883,7 +878,7 @@ static void FillProfileStats( Profile *pProfile )
static int s_iCount = 0;
// Choose a percent for all scores. This is useful for testing unlocks
// where some elements are unlocked at a certain percent complete
// where some elements are unlocked at a certain percent complete.
float fPercentDP = s_iCount ? randomf( 0.6f, 1.0f ) : 1.0f;
s_iCount = (s_iCount+1)%2;