various changes from the ssc svn post-public beta 2 release.

* New Lua bindings SONGMAN:GetGroupNames() and SONGMAN:GetSongsInGroup(string)
* Add Lifts to PaneDisplay (StepMania 3.9+ added them)
* Fix an issue where course banners were able to trip off the uneven dimensions dialog
* NextSong/PrevSong now work when TwoPartSelection=true + TwoPartConfirmsOnly=true on ScreenSelectMusic. A new message ("TwoPartConfirmCanceled") was added to catch when this happens.
and there may have been some stray cleanup in here too
This commit is contained in:
AJ Kelly
2010-04-14 21:43:32 -05:00
parent 10a60946a8
commit 1867e92dee
13 changed files with 105 additions and 71 deletions
+1
View File
@@ -35,6 +35,7 @@ static const char *RadarCategoryNames[] = {
"Mines",
"Hands",
"Rolls",
"Lifts",
"MinMidiNote",
"MaxMidiNote",
};
+2 -1
View File
@@ -29,6 +29,7 @@ enum RadarCategory
RadarCategory_Mines,
RadarCategory_Hands,
RadarCategory_Rolls,
RadarCategory_Lifts,
RadarCategory_MinMidiNote,
RadarCategory_MaxMidiNote,
NUM_RadarCategory, // leave this at the end
@@ -54,7 +55,7 @@ enum StepsType
StepsType_dance_double,
StepsType_dance_couple,
StepsType_dance_solo,
//StepsType_dance_three,
//StepsType_dance_three, // kurisu calls this "3panel"
StepsType_dance_routine,
StepsType_pump_single,
StepsType_pump_halfdouble,
+47 -33
View File
@@ -37,18 +37,18 @@ bool NoteData::IsComposite() const
return false;
}
/* Clear [rowBegin,rowEnd). */
// Clear (rowBegin,rowEnd).
void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
{
/* Optimization: if the range encloses everything, just clear the whole maps. */
// Optimization: if the range encloses everything, just clear the whole maps.
if( rowBegin == 0 && rowEnd == MAX_NOTE_ROW )
{
m_TapNotes[iTrack].clear();
return;
}
/* If the range is empty, don't do anything. Otherwise, an empty range will cause
* hold notes to be split when they shouldn't be. */
/* If the range is empty, don't do anything. Otherwise, an empty range will
* cause hold notes to be split when they shouldn't be. */
if( rowBegin == rowEnd )
return;
@@ -57,8 +57,8 @@ void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
if( begin != end && begin->first < rowBegin && begin->first + begin->second.iDuration > rowEnd )
{
/* A hold note overlaps the whole range. Truncate it, and add the remainder to
* the end. */
/* A hold note overlaps the whole range. Truncate it, and add the
* remainder to the end. */
TapNote tn1 = begin->second;
TapNote tn2 = tn1;
@@ -71,12 +71,12 @@ void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
SetTapNote( iTrack, iRow, tn1 );
SetTapNote( iTrack, rowEnd, tn2 );
/* We may have invalidated our iterators. */
// We may have invalidated our iterators.
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, begin, end );
}
else if( begin != end && begin->first < rowBegin )
{
/* A hold note overlaps the beginning of the range. Truncate it. */
// A hold note overlaps the beginning of the range. Truncate it.
TapNote &tn1 = begin->second;
int iRow = begin->first;
tn1.iDuration = rowBegin - iRow;
@@ -92,7 +92,7 @@ void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
int iRow = prev->first;
if( tn.type == TapNote::hold_head && iRow + tn.iDuration > rowEnd )
{
/* A hold note overlaps the end of the range. Separate it. */
// A hold note overlaps the end of the range. Separate it.
SetTapNote( iTrack, iRow, TAP_EMPTY );
int iAdd = rowEnd - iRow;
@@ -102,7 +102,7 @@ void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
end = prev;
}
/* We may have invalidated our iterators. */
// We may have invalidated our iterators.
GetTapNoteRangeInclusive( iTrack, rowBegin, rowEnd, begin, end );
}
@@ -121,19 +121,19 @@ void NoteData::ClearAll()
m_TapNotes[t].clear();
}
/* Copy [rowFromBegin,rowFromEnd) from pFrom to this. (Note that this does *not* overlay;
* all data in the range is overwritten.) */
/* Copy [rowFromBegin,rowFromEnd) from pFrom to this. (Note that this does
* *not* overlay; all data in the range is overwritten.) */
void NoteData::CopyRange( const NoteData& from, int rowFromBegin, int rowFromEnd, int rowToBegin )
{
ASSERT( from.GetNumTracks() == GetNumTracks() );
if( rowFromBegin > rowFromEnd )
return; /* empty range */
return; // empty range
const int rowToEnd = (rowFromEnd-rowFromBegin) + rowToBegin;
const int iMoveBy = rowToBegin-rowFromBegin;
/* Clear the region. */
// Clear the region.
ClearRange( rowToBegin, rowToEnd );
for( int t=0; t<GetNumTracks(); t++ )
@@ -305,12 +305,12 @@ void NoteData::AddHoldNote( int iTrack, int iStartRow, int iEndRow, TapNote tn )
{
ASSERT( iStartRow>=0 && iEndRow>=0 );
ASSERT_M( iEndRow >= iStartRow, ssprintf("EndRow %d < StartRow %d",iEndRow,iStartRow) );
/* Include adjacent (non-overlapping) hold notes, since we need to merge with them. */
iterator begin, end;
GetTapNoteRangeInclusive( iTrack, iStartRow, iEndRow, begin, end, true );
/* Look for other hold notes that overlap and merge them into add. */
// Look for other hold notes that overlap and merge them into add.
for( iterator it = begin; it != end; ++it )
{
int iOtherRow = it->first;
@@ -324,19 +324,19 @@ void NoteData::AddHoldNote( int iTrack, int iStartRow, int iEndRow, TapNote tn )
tn.iDuration = iEndRow - iStartRow;
/* Remove everything in the range. */
// Remove everything in the range.
while( begin != end )
{
iterator next = begin;
++next;
RemoveTapNote( iTrack, begin );
begin = next;
}
/* Additionally, if there's a tap note lying at the end of our range, remove it,
* too. */
/* Additionally, if there's a tap note lying at the end of our range,
* remove it too. */
SetTapNote( iTrack, iEndRow, TAP_EMPTY );
// add a tap note at the start of this hold
@@ -358,8 +358,8 @@ bool NoteData::IsHoldHeadOrBodyAtRow( int iTrack, int iRow, int *pHeadRow ) cons
return IsHoldNoteAtRow( iTrack, iRow, pHeadRow );
}
/* Determine if a hold note lies on the given spot. Return true if so. If
* pHeadRow is non-NULL, return the row of the head. (Note that this returns
/* Determine if a hold note lies on the given spot. Return true if so. If
* pHeadRow is non-NULL, return the row of the head. (Note that this returns
* false if a hold head lies on iRow itself.) */
/* XXX: rename this to IsHoldBodyAtRow */
bool NoteData::IsHoldNoteAtRow( int iTrack, int iRow, int *pHeadRow ) const
@@ -368,9 +368,9 @@ bool NoteData::IsHoldNoteAtRow( int iTrack, int iRow, int *pHeadRow ) const
if( pHeadRow == NULL )
pHeadRow = &iDummy;
/* Starting at iRow, search upwards. If we find a TapNote::hold_head, we're within
* a hold. If we find a tap, mine or attack, we're not--those never lie within hold
* notes. Ignore autoKeysound. */
/* Starting at iRow, search upwards. If we find a TapNote::hold_head, we're within
* a hold. If we find a tap, mine or attack, we're not--those never lie
* within hold notes. Ignore autoKeysound. */
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE_REVERSE( *this, iTrack, r, 0, iRow )
{
const TapNote &tn = GetTapNote( iTrack, r );
@@ -391,7 +391,7 @@ bool NoteData::IsHoldNoteAtRow( int iTrack, int iRow, int *pHeadRow ) const
case TapNote::empty:
case TapNote::autoKeysound:
/* ignore */
// ignore
continue;
DEFAULT_FAIL( tn.type );
}
@@ -417,7 +417,7 @@ bool NoteData::IsEmpty() const
int NoteData::GetFirstRow() const
{
int iEarliestRowFoundSoFar = -1;
for( int t=0; t < GetNumTracks(); t++ )
{
int iRow = -1;
@@ -439,7 +439,7 @@ int NoteData::GetFirstRow() const
int NoteData::GetLastRow() const
{
int iOldestRowFoundSoFar = 0;
for( int t=0; t < GetNumTracks(); t++ )
{
int iRow = MAX_NOTE_ROW;
@@ -470,7 +470,7 @@ int NoteData::GetNumTapNotes( int iStartIndex, int iEndIndex ) const
iNumNotes++;
}
}
return iNumNotes;
}
@@ -486,7 +486,7 @@ int NoteData::GetNumRowsWithTap( int iStartIndex, int iEndIndex ) const
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( *this, r, iStartIndex, iEndIndex )
if( IsThereATapAtRow(r) )
iNumNotes++;
return iNumNotes;
}
@@ -500,7 +500,7 @@ int NoteData::GetNumMines( int iStartIndex, int iEndIndex ) const
if( GetTapNote(t, r).type == TapNote::mine )
iNumMines++;
}
return iNumMines;
}
@@ -510,7 +510,7 @@ int NoteData::GetNumRowsWithTapOrHoldHead( int iStartIndex, int iEndIndex ) cons
FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( *this, r, iStartIndex, iEndIndex )
if( IsThereATapOrHoldHeadAtRow(r) )
iNumNotes++;
return iNumNotes;
}
@@ -581,7 +581,7 @@ int NoteData::GetNumRowsWithSimultaneousTaps( int iMinTaps, int iStartIndex, int
if( iNumNotesThisIndex >= iMinTaps )
iNum++;
}
return iNum;
}
@@ -621,6 +621,20 @@ int NoteData::GetNumRolls( int iStartIndex, int iEndIndex ) const
return iNumRolls;
}
int NoteData::GetNumLifts( int iStartIndex, int iEndIndex ) const
{
int iNumLifts = 0;
for( int t=0; t<GetNumTracks(); t++ )
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
if( GetTapNote(t, r).type == TapNote::lift )
iNumLifts++;
}
return iNumLifts;
}
/*
int NoteData::GetNumMinefields( int iStartIndex, int iEndIndex ) const
{
+3
View File
@@ -207,6 +207,9 @@ public:
int GetNumHands( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const { return GetNumRowsWithSimultaneousPresses( 3, iStartIndex, iEndIndex ); }
int GetNumQuads( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const { return GetNumRowsWithSimultaneousPresses( 4, iStartIndex, iEndIndex ); }
// and the other notetypes
int GetNumLifts( int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW ) const;
// Transformations
void LoadTransformed( const NoteData& original, int iNewNumTracks, const int iOriginalTrackToTakeFrom[] ); // -1 for iOriginalTracksToTakeFrom means no track
+3 -2
View File
@@ -729,8 +729,8 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
switch( rc )
{
case RadarCategory_Stream: out[rc] = GetStreamRadarValue( in, fSongSeconds ); break;
case RadarCategory_Voltage: out[rc] = GetVoltageRadarValue( in, fSongSeconds ); break;
case RadarCategory_Air: out[rc] = GetAirRadarValue( in, fSongSeconds ); break;
case RadarCategory_Voltage: out[rc] = GetVoltageRadarValue( in, fSongSeconds ); break;
case RadarCategory_Air: out[rc] = GetAirRadarValue( in, fSongSeconds ); break;
case RadarCategory_Freeze: out[rc] = GetFreezeRadarValue( in, fSongSeconds ); break;
case RadarCategory_Chaos: out[rc] = GetChaosRadarValue( in, fSongSeconds ); break;
case RadarCategory_TapsAndHolds: out[rc] = (float) in.GetNumRowsWithTapOrHoldHead(); break;
@@ -739,6 +739,7 @@ void NoteDataUtil::CalculateRadarValues( const NoteData &in, float fSongSeconds,
case RadarCategory_Mines: out[rc] = (float) in.GetNumMines(); break;
case RadarCategory_Hands: out[rc] = (float) in.GetNumHands(); break;
case RadarCategory_Rolls: out[rc] = (float) in.GetNumRolls(); break;
case RadarCategory_Lifts: out[rc] = (float) in.GetNumLifts(); break;
case RadarCategory_MinMidiNote:
break; // fill in below
case RadarCategory_MaxMidiNote:
+13
View File
@@ -129,6 +129,18 @@ int GetSuccessfulHands( const NoteData &in, int iStartIndex = 0, int iEndIndex =
return iNum;
}
int GetSuccessfulLifts( const NoteData &in, TapNoteScore tns, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW )
{
int iNumSuccessfulLiftNotes = 0;
NoteData::all_tracks_const_iterator iter = in.GetTapNoteRangeAllTracks( iStartIndex, iEndIndex );
for( ; !iter.IsAtEnd(); ++iter )
{
if( iter->type == TapNote::lift && iter->result.tns == tns )
++iNumSuccessfulLiftNotes;
}
return iNumSuccessfulLiftNotes;
}
/* Return the last tap score of a row: the grade of the tap that completed
* the row. If the row has no tap notes, return -1. If any tap notes aren't
* graded (any tap is TNS_None) or are missed (TNS_Miss), return it. */
@@ -336,6 +348,7 @@ void NoteDataWithScoring::GetActualRadarValues( const NoteData &in, const Player
case RadarCategory_Mines: out[rc] = (float) GetSuccessfulMines( in ); break;
case RadarCategory_Hands: out[rc] = (float) GetSuccessfulHands( in ); break;
case RadarCategory_Rolls: out[rc] = (float) GetNumHoldNotesWithScore( in, TapNote::hold_head_roll, HNS_Held ); break;
case RadarCategory_Lifts: out[rc] = (float) GetSuccessfulLifts( in, TNS_W4 ); break;
case RadarCategory_MinMidiNote: out[rc] = 0; break; // no meaning
case RadarCategory_MaxMidiNote: out[rc] = 0; break; // no meaning
//case RadarCategory_Minefields: out[rc] = (float) GetNumMinefieldsWithScore( in, TapNote::hold_head_mine, HNS_Held ); break;
+13 -14
View File
@@ -25,7 +25,7 @@ static const char *PaneCategoryNames[] = {
"Rolls",
"Mines",
"Hands",
//"Lifts",
"Lifts",
"MachineHighScore",
"MachineHighName",
"ProfileHighScore",
@@ -43,16 +43,16 @@ struct Content_t
static const Content_t g_Contents[NUM_PaneCategory] =
{
{ NEED_NOTES, "count" },
{ NEED_NOTES, "count" },
{ NEED_NOTES, "count" },
{ NEED_NOTES, "count" },
{ NEED_NOTES, "count" },
{ NEED_NOTES, "count" },
//{ NEED_NOTES, "count" },
{ NEED_NOTES, "score" },
{ NEED_NOTES, "name" },
{ NEED_NOTES|NEED_PROFILE, "score" },
{ NEED_NOTES, "count" }, // NumSteps
{ NEED_NOTES, "count" }, // Jumps
{ NEED_NOTES, "count" }, // Holds
{ NEED_NOTES, "count" }, // Rolls
{ NEED_NOTES, "count" }, // Mines
{ NEED_NOTES, "count" }, // Hands
{ NEED_NOTES, "count" }, // Lifts
{ NEED_NOTES, "score" }, // MachineHighScore
{ NEED_NOTES, "name" }, // MachineHighName
{ NEED_NOTES|NEED_PROFILE, "score" }, // ProfileHighScore
};
REGISTER_ACTOR_CLASS( PaneDisplay )
@@ -65,7 +65,6 @@ void PaneDisplay::Load( const RString &sMetricsGroup, PlayerNumber pn )
NOT_AVAILABLE.Load( sMetricsGroup, "NotAvailable" );
COUNT_FORMAT.Load( sMetricsGroup, "CountFormat" );
FOREACH_ENUM( PaneCategory, pc )
{
LuaThreadVariable var( "PaneCategory", LuaReference::Create(pc) );
@@ -160,7 +159,7 @@ void PaneDisplay::SetContent( PaneCategory c )
case PaneCategory_Rolls: val = rv[RadarCategory_Rolls]; break;
case PaneCategory_Mines: val = rv[RadarCategory_Mines]; break;
case PaneCategory_Hands: val = rv[RadarCategory_Hands]; break;
//case PaneCategory_Lifts: val = rv[RadarCategory_Lifts]; break;
case PaneCategory_Lifts: val = rv[RadarCategory_Lifts]; break;
case PaneCategory_ProfileHighScore:
case PaneCategory_MachineHighName: /* set val for color */
case PaneCategory_MachineHighScore:
@@ -199,7 +198,7 @@ void PaneDisplay::SetContent( PaneCategory c )
case PaneCategory_Rolls:
case PaneCategory_Mines:
case PaneCategory_Hands:
//case PaneCategory_Lifts:
case PaneCategory_Lifts:
str = ssprintf( COUNT_FORMAT.GetValue(), val );
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ enum PaneCategory
PaneCategory_Rolls,
PaneCategory_Mines,
PaneCategory_Hands,
//PaneCategory_Lifts,
PaneCategory_Lifts,
PaneCategory_MachineHighScore,
PaneCategory_MachineHighName,
PaneCategory_ProfileHighScore,
+1
View File
@@ -28,6 +28,7 @@ struct RadarValues
float fNumMines;
float fNumHands;
float fNumRolls;
float fNumLifts;
float fMinMidiNote;
float fMaxMidiNote;
} v;
+15 -15
View File
@@ -357,7 +357,6 @@ void ScreenSelectMusic::CheckBackgroundRequests( bool bForce )
FallbackMusic.fFadeInLengthSeconds = SAMPLE_MUSIC_FALLBACK_FADE_IN_SECONDS;
FallbackMusic.bAlignBeat = ALIGN_MUSIC_BEATS;
//if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_StartToPreview )
SOUND->PlayMusic( PlayParams, FallbackMusic );
}
}
@@ -990,6 +989,15 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
// a song was selected
if( m_MusicWheel.GetSelectedSong() != NULL )
{
/*
if(TWO_PART_CONFIRMS_ONLY && SAMPLE_MUSIC_PREVIEW_MODE == SampleMusicPreviewMode_StartToPreview)
{
// start playing the preview music.
g_bSampleMusicWaiting = true;
CheckBackgroundRequests( true );
}
*/
const bool bIsNew = PROFILEMAN->IsSongNew( m_MusicWheel.GetSelectedSong() );
bool bIsHard = false;
FOREACH_HumanPlayer( p )
@@ -1048,15 +1056,6 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
// We haven't made a selection yet.
return;
}
/*
if(TWO_PART_CONFIRMS_ONLY && SAMPLE_MUSIC_PREVIEW_MODE == SampleMusicPreviewMode_StartToPreview)
{
// start playing the preview music.
g_bSampleMusicWaiting = true;
}
*/
// I believe this is for those who like pump pro. -aj
MESSAGEMAN->Broadcast("SongChosen");
@@ -1484,7 +1483,7 @@ void ScreenSelectMusic::AfterMusicChange()
m_iSelection[p] = -1;
g_sCDTitlePath = ""; // none
//if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong )
//{
m_fSampleStartSeconds = 0;
@@ -1535,22 +1534,23 @@ void ScreenSelectMusic::AfterMusicChange()
// check SampleMusicPreviewMode here.
switch( SAMPLE_MUSIC_PREVIEW_MODE )
{
DEFAULT_FAIL(SAMPLE_MUSIC_PREVIEW_MODE);
case SampleMusicPreviewMode_ScreenMusic:
// play the screen music, hopefully?
// play the screen music
m_sSampleMusicToPlay = m_sLoopMusicPath;
m_fSampleStartSeconds = 0;
m_fSampleLengthSeconds = -1;
break;
case SampleMusicPreviewMode_Normal:
//case SampleMusicPreviewMode_StartToPreview:
// we want to load the sample music, but we don't want to
// actually play it; fall through for now. -aj
case SampleMusicPreviewMode_Normal:
// play the sample music
m_sSampleMusicToPlay = pSong->GetMusicPath();
m_pSampleMusicTimingData = &pSong->m_Timing;
m_fSampleStartSeconds = pSong->m_fMusicSampleStartSeconds;
m_fSampleLengthSeconds = pSong->m_fMusicSampleLengthSeconds;
break;
default:
ASSERT(0);
}
SongUtil::GetPlayableSteps( pSong, m_vpSteps );
+3 -3
View File
@@ -70,9 +70,9 @@ SongManager::SongManager()
}
NUM_SONG_GROUP_COLORS .Load( "SongManager", "NumSongGroupColors" );
SONG_GROUP_COLOR .Load( "SongManager", SONG_GROUP_COLOR_NAME, NUM_SONG_GROUP_COLORS );
SONG_GROUP_COLOR .Load( "SongManager", SONG_GROUP_COLOR_NAME, NUM_SONG_GROUP_COLORS );
NUM_COURSE_GROUP_COLORS .Load( "SongManager", "NumCourseGroupColors" );
COURSE_GROUP_COLOR .Load( "SongManager", COURSE_GROUP_COLOR_NAME, NUM_COURSE_GROUP_COLORS );
COURSE_GROUP_COLOR .Load( "SongManager", COURSE_GROUP_COLOR_NAME, NUM_COURSE_GROUP_COLORS );
}
SongManager::~SongManager()
@@ -128,7 +128,7 @@ void SongManager::Reload( bool bAllowFastLoad, LoadingWindow *ld )
UpdatePreferredSort();
// Reload song/course group colors to prevent a crash when switching
// themes in-game. -aj
// themes in-game. (apparently not, though.) -aj
NUM_SONG_GROUP_COLORS .Load( "SongManager", "NumSongGroupColors" );
SONG_GROUP_COLOR .Load( "SongManager", SONG_GROUP_COLOR_NAME, NUM_SONG_GROUP_COLORS );
NUM_COURSE_GROUP_COLORS .Load( "SongManager", "NumCourseGroupColors" );
+2 -1
View File
@@ -215,8 +215,9 @@ void StatsManager::CommitStatsToProfiles( const StageStats *pSS )
int iNumRolls = (int) pSS->m_player[pn].m_radarActual[RadarCategory_Rolls];
int iNumMines = (int) pSS->m_player[pn].m_radarActual[RadarCategory_Mines];
int iNumHands = (int) pSS->m_player[pn].m_radarActual[RadarCategory_Hands];
int iNumLifts = (int) pSS->m_player[pn].m_radarActual[RadarCategory_Lifts];
float fCaloriesBurned = pSS->m_player[pn].m_fCaloriesBurned;
PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, fCaloriesBurned );
PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, iNumLifts, fCaloriesBurned );
}
// Update profile stats
+1 -1
View File
@@ -142,7 +142,7 @@ float Steps::PredictMeter() const
const float ChaosSquare = rv[RadarCategory_Chaos] * rv[RadarCategory_Chaos];
pMeter += -6.35f * SV;
pMeter += -2.58f * ChaosSquare;
if (pMeter < 1) pMeter = 1;
if (pMeter < 1) pMeter = 1;
return pMeter;
}