account for sticky pads in mine hit detection
This commit is contained in:
@@ -117,8 +117,8 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
|
|||||||
m_pPrimaryScoreKeeper = pPrimaryScoreKeeper;
|
m_pPrimaryScoreKeeper = pPrimaryScoreKeeper;
|
||||||
m_pSecondaryScoreKeeper = pSecondaryScoreKeeper;
|
m_pSecondaryScoreKeeper = pSecondaryScoreKeeper;
|
||||||
m_pNoteField = pNoteField;
|
m_pNoteField = pNoteField;
|
||||||
m_iRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1;
|
m_iRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
||||||
// m_iRowLastCrossed = -1;
|
m_iMineRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this?
|
||||||
|
|
||||||
/* Ensure that this is up-to-date. */
|
/* Ensure that this is up-to-date. */
|
||||||
GAMESTATE->m_pPosition->Load(pn);
|
GAMESTATE->m_pPosition->Load(pn);
|
||||||
@@ -383,6 +383,7 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
SetHoldNoteScore(hn, hns);
|
SetHoldNoteScore(hn, hns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
// Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris
|
// Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris
|
||||||
/* We want to send the crossed row message exactly when we cross the row--not
|
/* We want to send the crossed row message exactly when we cross the row--not
|
||||||
* .5 before the row. Use a very slow song (around 2 BPM) as a test case: without
|
* .5 before the row. Use a very slow song (around 2 BPM) as a test case: without
|
||||||
@@ -394,6 +395,21 @@ void PlayerMinus::Update( float fDeltaTime )
|
|||||||
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
|
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
|
||||||
CrossedRow( m_iRowLastCrossed );
|
CrossedRow( m_iRowLastCrossed );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// TRICKY:
|
||||||
|
float fPositionSeconds = GAMESTATE->m_fMusicSeconds;
|
||||||
|
fPositionSeconds -= PREFSMAN->m_fPadStickSeconds;
|
||||||
|
const float fSongBeat = GAMESTATE->m_pCurSong ? GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ) : 0;
|
||||||
|
const int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
|
||||||
|
if( iRowNow >= 0 )
|
||||||
|
{
|
||||||
|
for( ; m_iMineRowLastCrossed <= iRowNow; m_iMineRowLastCrossed++ ) // for each index we crossed since the last update
|
||||||
|
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
|
||||||
|
CrossedMineRow( m_iMineRowLastCrossed );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// process transforms that are waiting to be applied
|
// process transforms that are waiting to be applied
|
||||||
@@ -574,10 +590,14 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
|||||||
|
|
||||||
ASSERT( col >= 0 && col <= GetNumTracks() );
|
ASSERT( col >= 0 && col <= GetNumTracks() );
|
||||||
|
|
||||||
|
float fPositionSeconds = GAMESTATE->m_fMusicSeconds;
|
||||||
|
fPositionSeconds -= tm.Ago();
|
||||||
|
const float fSongBeat = GAMESTATE->m_pCurSong ? GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ) : GAMESTATE->m_fSongBeat;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check for step on a TapNote
|
// Check for step on a TapNote
|
||||||
//
|
//
|
||||||
int iIndexOverlappingNote = GetClosestNote( col, GAMESTATE->m_fSongBeat,
|
int iIndexOverlappingNote = GetClosestNote( col, fSongBeat,
|
||||||
StepSearchDistanceForwards * GAMESTATE->m_fCurBPS * GAMESTATE->m_SongOptions.m_fMusicRate,
|
StepSearchDistanceForwards * GAMESTATE->m_fCurBPS * GAMESTATE->m_SongOptions.m_fMusicRate,
|
||||||
StepSearchDistanceBackwards * GAMESTATE->m_fCurBPS * GAMESTATE->m_SongOptions.m_fMusicRate );
|
StepSearchDistanceBackwards * GAMESTATE->m_fCurBPS * GAMESTATE->m_SongOptions.m_fMusicRate );
|
||||||
|
|
||||||
@@ -1036,18 +1056,22 @@ void PlayerMinus::CrossedRow( int iNoteRow )
|
|||||||
if( GetTapNoteScore(t, iNoteRow) == TNS_NONE )
|
if( GetTapNoteScore(t, iNoteRow) == TNS_NONE )
|
||||||
Step( t, now );
|
Step( t, now );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerMinus::CrossedMineRow( int iNoteRow )
|
||||||
|
{
|
||||||
// Hold the panel while crossing a mine will cause the mine to explode
|
// Hold the panel while crossing a mine will cause the mine to explode
|
||||||
|
RageTimer now;
|
||||||
for( int t=0; t<GetNumTracks(); t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( GetTapNote(t,iNoteRow) == TAP_MINE )
|
if( GetTapNote(t,iNoteRow) == TAP_MINE )
|
||||||
{
|
{
|
||||||
const StyleInput StyleI( m_PlayerNumber, t );
|
const StyleInput StyleI( m_PlayerNumber, t );
|
||||||
const GameInput GameI = GAMESTATE->GetCurrentStyleDef()->StyleInputToGameInput( StyleI );
|
const GameInput GameI = GAMESTATE->GetCurrentStyleDef()->StyleInputToGameInput( StyleI );
|
||||||
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
|
float fSecsHeld = INPUTMAPPER->GetSecsHeld( GameI );
|
||||||
|
|
||||||
if( bIsHoldingButton )
|
if( fSecsHeld >= PREFSMAN->m_fPadStickSeconds )
|
||||||
Step( t, now );
|
Step( t, now+(-PREFSMAN->m_fPadStickSeconds) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public:
|
|||||||
|
|
||||||
void Load( PlayerNumber player_no, const NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, ScoreDisplay* pSecondaryScoreDisplay, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper, NoteField* pNoteField );
|
void Load( PlayerNumber player_no, const NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, ScoreDisplay* pSecondaryScoreDisplay, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper, NoteField* pNoteField );
|
||||||
void CrossedRow( int iNoteRow );
|
void CrossedRow( int iNoteRow );
|
||||||
|
void CrossedMineRow( int iNoteRow );
|
||||||
void Step( int col, RageTimer tm );
|
void Step( int col, RageTimer tm );
|
||||||
void RandomiseNotes( int iNoteRow );
|
void RandomiseNotes( int iNoteRow );
|
||||||
void FadeToFail();
|
void FadeToFail();
|
||||||
@@ -99,6 +100,7 @@ protected:
|
|||||||
Inventory* m_pInventory;
|
Inventory* m_pInventory;
|
||||||
|
|
||||||
int m_iRowLastCrossed;
|
int m_iRowLastCrossed;
|
||||||
|
int m_iMineRowLastCrossed;
|
||||||
|
|
||||||
RageSound m_soundMine;
|
RageSound m_soundMine;
|
||||||
RageSound m_soundAttackLaunch;
|
RageSound m_soundAttackLaunch;
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ PrefsManager::PrefsManager()
|
|||||||
|
|
||||||
m_iAttractSoundFrequency = 1;
|
m_iAttractSoundFrequency = 1;
|
||||||
m_bAllowExtraStage = true;
|
m_bAllowExtraStage = true;
|
||||||
|
m_fPadStickSeconds = 0;
|
||||||
g_bAutoRestart = false;
|
g_bAutoRestart = false;
|
||||||
m_bSignProfileData = false;
|
m_bSignProfileData = false;
|
||||||
|
|
||||||
@@ -490,6 +491,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
|
|||||||
ini.GetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY );
|
ini.GetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY );
|
||||||
ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
|
ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
|
||||||
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
|
ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
|
||||||
|
ini.GetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
|
||||||
ini.GetValue( "Options", "AutoRestart", g_bAutoRestart );
|
ini.GetValue( "Options", "AutoRestart", g_bAutoRestart );
|
||||||
ini.GetValue( "Options", "SignProfileData", m_bSignProfileData );
|
ini.GetValue( "Options", "SignProfileData", m_bSignProfileData );
|
||||||
|
|
||||||
@@ -701,6 +703,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
|
|||||||
ini.SetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY );
|
ini.SetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY );
|
||||||
ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
|
ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency );
|
||||||
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
|
ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage );
|
||||||
|
ini.SetValue( "Options", "PadStickSeconds", m_fPadStickSeconds );
|
||||||
ini.SetValue( "Options", "AutoRestart", g_bAutoRestart );
|
ini.SetValue( "Options", "AutoRestart", g_bAutoRestart );
|
||||||
ini.SetValue( "Options", "SignProfileData", m_bSignProfileData );
|
ini.SetValue( "Options", "SignProfileData", m_bSignProfileData );
|
||||||
|
|
||||||
|
|||||||
@@ -189,6 +189,10 @@ public:
|
|||||||
int m_iAttractSoundFrequency; // 0 = never, 1 = every time
|
int m_iAttractSoundFrequency; // 0 = never, 1 = every time
|
||||||
bool m_bAllowExtraStage;
|
bool m_bAllowExtraStage;
|
||||||
|
|
||||||
|
// Number of seconds it takes for a button on the controller to release
|
||||||
|
// after pressed.
|
||||||
|
float m_fPadStickSeconds;
|
||||||
|
|
||||||
// If true, then signatures created when writing profile data
|
// If true, then signatures created when writing profile data
|
||||||
// and verified when reading profile data. Leave this false if
|
// and verified when reading profile data. Leave this false if
|
||||||
// you want to use a profile on different machines that don't
|
// you want to use a profile on different machines that don't
|
||||||
|
|||||||
Reference in New Issue
Block a user