diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 09a5076c0c..4f879ee322 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -333,7 +333,7 @@ void Background::LoadFromSong( Song* pSong ) index = 1; // force the first random background to play first else index = 1 + rand()%(m_BGAnimations.GetSize()-1); - m_aBGSegments.Add( BGSegment(f,index,bFade || f==fFirstBeat) ); + m_aBGSegments.Add( BGSegment(f,index,bFade) ); } // change BG every BPM change diff --git a/stepmania/src/InputFilter.cpp b/stepmania/src/InputFilter.cpp index 1f5f29c31b..ab555ab75a 100644 --- a/stepmania/src/InputFilter.cpp +++ b/stepmania/src/InputFilter.cpp @@ -23,7 +23,7 @@ InputFilter::InputFilter() for( int i=0; iUpdate(); @@ -67,9 +72,9 @@ void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime ) { if( IsBeingPressed(di) ) { - const float fOldHoldTime = m_fTimeHeld[d][b]; - m_fTimeHeld[d][b] += fDeltaTime; - const float fNewHoldTime = m_fTimeHeld[d][b]; + const float fOldHoldTime = m_fSecsHeld[d][b]; + m_fSecsHeld[d][b] += fDeltaTime; + const float fNewHoldTime = m_fSecsHeld[d][b]; float fTimeBetweenRepeats; InputEventType iet; @@ -90,7 +95,7 @@ void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime ) } } else { // !IsBeingPressed(di) - m_fTimeHeld[d][b] = 0; + m_fSecsHeld[d][b] = 0; array.Add( InputEvent(di,IET_RELEASE) ); } } diff --git a/stepmania/src/InputFilter.h b/stepmania/src/InputFilter.h index 21fb044f73..e0210f48e5 100644 --- a/stepmania/src/InputFilter.h +++ b/stepmania/src/InputFilter.h @@ -43,10 +43,11 @@ public: bool BeingPressed( DeviceInput di, bool Prev = false); bool WasBeingPressed( DeviceInput di ); bool IsBeingPressed( DeviceInput di ); + float GetSecsHeld( DeviceInput di ); void GetInputEvents( InputEventArray &array, float fDeltaTime ); - float m_fTimeHeld[NUM_INPUT_DEVICES][NUM_DEVICE_BUTTONS]; + float m_fSecsHeld[NUM_INPUT_DEVICES][NUM_DEVICE_BUTTONS]; }; diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index f4f36b7465..ab8348b0d5 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -266,10 +266,8 @@ bool InputMapper::IsButtonDown( GameInput GameI ) DeviceInput DeviceI; if( GameToDevice( GameI, i, DeviceI ) ) - { if( INPUTFILTER->IsBeingPressed( DeviceI ) ) return true; - } } return false; @@ -286,10 +284,45 @@ bool InputMapper::IsButtonDown( MenuInput MenuI ) return false; } - bool InputMapper::IsButtonDown( StyleInput StyleI ) { GameInput GameI; StyleToGame( StyleI, GameI ); return IsButtonDown( GameI ); } + + +float InputMapper::GetSecsHeld( GameInput GameI ) +{ + float fMaxSecsHeld = 0; + + for( int i=0; iGetSecsHeld(DeviceI) ); + } + + return fMaxSecsHeld; +} + +float InputMapper::GetSecsHeld( MenuInput MenuI ) +{ + float fMaxSecsHeld = 0; + + GameInput GameI[4]; + MenuToGame( MenuI, GameI ); + for( int i=0; i<4; i++ ) + if( GameI[i].IsValid() ) + fMaxSecsHeld = max( fMaxSecsHeld, GetSecsHeld(GameI[i]) ); + + return fMaxSecsHeld; +} + +float InputMapper::GetSecsHeld( StyleInput StyleI ) +{ + GameInput GameI; + StyleToGame( StyleI, GameI ); + return GetSecsHeld( GameI ); +} diff --git a/stepmania/src/InputMapper.h b/stepmania/src/InputMapper.h index 50c3e541a1..f30b371448 100644 --- a/stepmania/src/InputMapper.h +++ b/stepmania/src/InputMapper.h @@ -52,11 +52,14 @@ public: void GameToMenu( GameInput GameI, MenuInput &MenuI ); void MenuToGame( MenuInput MenuI, GameInput GameIout[4] ); + float GetSecsHeld( GameInput GameI ); + float GetSecsHeld( MenuInput MenuI ); + float GetSecsHeld( StyleInput StyleI ); + bool IsButtonDown( GameInput GameI ); bool IsButtonDown( MenuInput MenuI ); bool IsButtonDown( StyleInput StyleI ); - protected: // all the DeviceInputs that map to a GameInput DeviceInput m_GItoDI[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS][NUM_GAME_TO_DEVICE_SLOTS]; diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 6e6d124d66..9e27081457 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -905,7 +905,7 @@ void NoteData::LoadTransformedSlidingWindow( NoteData* pOriginal, int iNewNumTra for( int r=0; r<=iLastRow; r++ ) { // copy notes in this measure - for( int t=0; t<=pOriginal->m_iNumTracks; t++ ) + for( int t=0; tm_iNumTracks; t++ ) { int iOldTrack = t; int iNewTrack = (iOldTrack + iCurTrackOffset) % iNewNumTracks; diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 4d7c42bc0f..cd34edfa6b 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -112,6 +112,7 @@ public: void Turn( PlayerOptions::TurnType tt ); void MakeLittle(); + void SnapToNearestNoteType( NoteType nt, float fBeginBeat, float fEndBeat ) { SnapToNearestNoteType( nt, (NoteType)-1, fBeginBeat, fEndBeat ); } void SnapToNearestNoteType( NoteType nt1, NoteType nt2, float fBeginBeat, float fEndBeat ); NoteType GetSmallestNoteTypeForMeasure( int iMeasureIndex ); diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 543d712c5d..5de6182fd1 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -227,13 +227,15 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float else DISPLAY->SetColorTextureMultDiffuse(); DISPLAY->SetAlphaTextureMultDiffuse(); + DISPLAY->EnableTextureWrapping(); DISPLAY->SetTexture( m_sprHoldParts.GetTexture() ); // // Draw the tail // float fY; - for( fY=max(fYTailTop,fYHead); fYSetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_BORDER ); - //m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_BORDER ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_BORDER ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_BORDER ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_BORDERCOLOR, D3DCOLOR_ARGB(0,0,0,0) ); m_pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX ); @@ -783,4 +784,28 @@ void RageDisplay::DisableZBuffer() m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, FALSE ); m_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); -} \ No newline at end of file +} +void RageDisplay::EnableTextureWrapping() +{ + DWORD dw0, dw1; + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ADDRESSU, &dw0 ); + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ADDRESSV, &dw1 ); + + if( dw0!=D3DTADDRESS_WRAP || dw1!=D3DTADDRESS_WRAP ) + FlushQueue(); + + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP ); +} +void RageDisplay::DisableTextureWrapping() +{ + DWORD dw0, dw1; + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ADDRESSU, &dw0 ); + m_pd3dDevice->GetTextureStageState( 0, D3DTSS_ADDRESSV, &dw1 ); + + if( dw0!=D3DTADDRESS_BORDER || dw1!=D3DTADDRESS_BORDER ) + FlushQueue(); + + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_BORDER ); + m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_BORDER ); +} diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 99b075d1f0..218f5bc443 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -159,6 +159,8 @@ public: void SetBlendModeAdd(); void EnableZBuffer(); void DisableZBuffer(); + void EnableTextureWrapping(); + void DisableTextureWrapping(); }; diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index c0633c3fac..9e787c8669 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -20,10 +20,13 @@ #include "GameConstantsAndTypes.h" #include "RageLog.h" #include "GameState.h" -#include "InputFilter.h" +#include "InputMapper.h" #include + +const float RECORD_HOLD_THRESHOLD = 0.3f; + // // Defines specific to GameScreenTitleMenu // @@ -366,6 +369,34 @@ void ScreenEdit::Update( float fDeltaTime ) GAMESTATE->m_bFreeze = bFreeze; + if( m_EditMode == MODE_RECORDING ) + { + // add or extend holds + + for( int t=0; tGetCurrentStyleDef()->m_iColsPerPlayer; t++ ) // for each track + { + StyleInput StyleI( PLAYER_1, t ); + float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI ); + + if( fSecsHeld > RECORD_HOLD_THRESHOLD ) + { + // add or extend hold + const float fHoldStartSeconds = m_soundMusic.GetPositionSeconds() - fSecsHeld; + + float fStartBeat = m_pSong->GetBeatFromElapsedTime( fHoldStartSeconds ); + float fEndBeat = GAMESTATE->m_fSongBeat; + + // Round hold start and end to the nearest snap interval + fStartBeat = froundf( fStartBeat, NoteTypeToBeat(m_SnapDisplay.GetNoteType()) ); + fEndBeat = froundf( fEndBeat, NoteTypeToBeat(m_SnapDisplay.GetNoteType()) ); + + // create a new hold note + HoldNote newHN = { t, fStartBeat, fEndBeat }; + m_NoteFieldRecord.AddHoldNote( newHN ); + } + } + } + if( m_EditMode == MODE_RECORDING || m_EditMode == MODE_PLAYING ) { GAMESTATE->m_fSongBeat = fSongBeat; @@ -450,14 +481,14 @@ void ScreenEdit::Update( float fDeltaTime ) CString sNoteType; - switch( m_SnapDisplay.GetSnapMode() ) + switch( m_SnapDisplay.GetNoteType() ) { - case NOTE_TYPE_4TH: sNoteType = "quarter notes"; break; - case NOTE_TYPE_8TH: sNoteType = "eighth notes"; break; - case NOTE_TYPE_12TH: sNoteType = "triplets"; break; - case NOTE_TYPE_16TH: sNoteType = "sixteenth notes"; break; - case NOTE_TYPE_24TH: sNoteType = "twentyforth notes"; break; - case NOTE_TYPE_32ND: sNoteType = "thirtysecond notes"; break; + case NOTE_TYPE_4TH: sNoteType = "4th notes"; break; + case NOTE_TYPE_8TH: sNoteType = "8th notes"; break; + case NOTE_TYPE_12TH: sNoteType = "12th notes"; break; + case NOTE_TYPE_16TH: sNoteType = "16th notes"; break; + case NOTE_TYPE_24TH: sNoteType = "24th notes"; break; + case NOTE_TYPE_32ND: sNoteType = "32nd notes"; break; default: ASSERT(0); } @@ -738,7 +769,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ { case DIK_UP: case DIK_DOWN: - fBeatsToMove = NoteTypeToBeat( m_SnapDisplay.GetSnapMode() ); + fBeatsToMove = NoteTypeToBeat( m_SnapDisplay.GetNoteType() ); if( DeviceI.button == DIK_UP ) fBeatsToMove *= -1; break; @@ -799,7 +830,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ GAMESTATE->m_fSongBeat += fBeatsToMove; GAMESTATE->m_fSongBeat = clamp( GAMESTATE->m_fSongBeat, 0, MAX_BEATS-1 ); - GAMESTATE->m_fSongBeat = froundf( GAMESTATE->m_fSongBeat, NoteTypeToBeat(m_SnapDisplay.GetSnapMode()) ); + GAMESTATE->m_fSongBeat = froundf( GAMESTATE->m_fSongBeat, NoteTypeToBeat(m_SnapDisplay.GetNoteType()) ); m_soundChangeLine.Play(); } break; @@ -1158,53 +1189,39 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { - if(type == IET_RELEASE) return; // don't care - if( DeviceI.device == DEVICE_KEYBOARD ) + if( DeviceI.device == DEVICE_KEYBOARD && DeviceI.button == DIK_ESCAPE ) { - switch( DeviceI.button ) + TransitionFromRecordToEdit(); + return; + } + + if( StyleI.player != PLAYER_1 ) + return; // ignore + + const int iCol = StyleI.col; + + switch( type ) + { + case IET_FIRST_PRESS: { - case DIK_ESCAPE: - TransitionFromRecordToEdit(); - return; - } - } - switch( StyleI.player ) - { - case PLAYER_1: - int iCol; - iCol = StyleI.col; - - int iNoteIndex; - iNoteIndex = BeatToNoteRow( GAMESTATE->m_fSongBeat ); - if(iNoteIndex < 0) + // Add a tap + + float fBeat = GAMESTATE->m_fSongBeat; + fBeat = froundf( fBeat, NoteTypeToBeat(m_SnapDisplay.GetNoteType()) ); + + const int iRow = BeatToNoteRow( fBeat ); + if( iRow < 0 ) break; - if( type == IET_FIRST_PRESS ) - { - m_NoteFieldRecord.m_TapNotes[iCol][iNoteIndex] = '1'; - m_NoteFieldRecord.SnapToNearestNoteType( NOTE_TYPE_12TH, NOTE_TYPE_16TH, max(0,GAMESTATE->m_fSongBeat-1), GAMESTATE->m_fSongBeat+1); - m_GrayArrowRowRecord.Step( iCol ); - } - else - { - const float fHoldEndSeconds = m_soundMusic.GetPositionSeconds(); - const float fHoldStartSeconds = m_soundMusic.GetPositionSeconds() - TIME_BEFORE_SLOW_REPEATS * m_soundMusic.GetPlaybackRate() * 1.2f; // 1.2 is a fudge. This doesn't compensate enough for the repeat delay and leaves a tap note near the head of the hold. - - float fStartBeat, fEndBeat, fThrowAway; - bool bFreeze; - m_pSong->GetBeatAndBPSFromElapsedTime( fHoldStartSeconds, fStartBeat, fThrowAway, bFreeze ); - m_pSong->GetBeatAndBPSFromElapsedTime( fHoldEndSeconds, fEndBeat, fThrowAway, bFreeze ); - - // create a new hold note - HoldNote newHN; - newHN.m_iTrack = iCol; - newHN.m_fStartBeat = fStartBeat; - newHN.m_fEndBeat = fEndBeat; - - m_NoteFieldRecord.AddHoldNote( newHN ); - m_NoteFieldRecord.SnapToNearestNoteType( NOTE_TYPE_12TH, NOTE_TYPE_16TH, max(0,GAMESTATE->m_fSongBeat-2), GAMESTATE->m_fSongBeat+2); - } - break; + m_NoteFieldRecord.m_TapNotes[iCol][iRow] = '1'; + m_GrayArrowRowRecord.Step( iCol ); + } + break; + case IET_SLOW_REPEAT: + case IET_FAST_REPEAT: + case IET_RELEASE: + // don't add or extend holds here + break; } } @@ -1375,7 +1392,7 @@ void ScreenEdit::TransitionToEdit() m_rectRecordBack.SetTweenDiffuse( D3DXCOLOR(0,0,0,0) ); /* Make sure we're snapped. */ - GAMESTATE->m_fSongBeat = froundf( GAMESTATE->m_fSongBeat, NoteTypeToBeat(m_SnapDisplay.GetSnapMode()) ); + GAMESTATE->m_fSongBeat = froundf( GAMESTATE->m_fSongBeat, NoteTypeToBeat(m_SnapDisplay.GetNoteType()) ); /* Playing and recording have lead-ins, which may start before beat 0; * make sure we don't stay there if we escaped out early. */ @@ -1415,7 +1432,7 @@ void ScreenEdit::OnSnapModeChange() { m_soundChangeSnap.Play(); - NoteType nt = m_SnapDisplay.GetSnapMode(); + NoteType nt = m_SnapDisplay.GetNoteType(); int iStepIndex = BeatToNoteRow( GAMESTATE->m_fSongBeat ); int iElementsPerNoteType = BeatToNoteRow( NoteTypeToBeat(nt) ); int iStepIndexHangover = iStepIndex % iElementsPerNoteType; diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 94476a2f2a..7c2edea876 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -101,6 +101,7 @@ const ScreenMessage SM_GoToSelectMusic = ScreenMessage(SM_User+1); const ScreenMessage SM_GoToSelectCourse = ScreenMessage(SM_User+2); const ScreenMessage SM_GoToFinalEvaluation = ScreenMessage(SM_User+3); const ScreenMessage SM_GoToMusicScroll = ScreenMessage(SM_User+4); +const ScreenMessage SM_PlayCheer = ScreenMessage(SM_User+5); ScreenEvaluation::ScreenEvaluation( bool bSummary ) @@ -592,11 +593,11 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) case RM_ARCADE_SUMMARY: switch( max_grade ) { - case GRADE_E: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final e") ); break; - case GRADE_D: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final d") ); break; - case GRADE_C: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final c") ); break; - case GRADE_B: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final b") ); break; - case GRADE_A: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final a") ); break; + case GRADE_E: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final e") ); break; + case GRADE_D: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final d") ); break; + case GRADE_C: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final c") ); break; + case GRADE_B: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final b") ); break; + case GRADE_A: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final a") ); break; case GRADE_AA: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final aa") ); break; case GRADE_AAA: SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation final aaa") ); break; case GRADE_NO_DATA: @@ -609,6 +610,14 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) } } + switch( max_grade ) + { + case GRADE_AA: + case GRADE_AAA: + this->SendScreenMessage( SM_PlayCheer, 3 ); + break; + } + m_Menu.TweenOnScreenFromBlack( SM_None ); MUSIC->LoadAndPlayIfNotAlready( THEME->GetPathTo("Sounds","evaluation music") ); @@ -817,6 +826,9 @@ void ScreenEvaluation::HandleScreenMessage( const ScreenMessage SM ) case SM_GoToFinalEvaluation: SCREENMAN->SetNewScreen( "ScreenFinalEvaluation" ); break; + case SM_PlayCheer: + SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo("evaluation cheer") ); + break; } } diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index ac9172c386..1e64992dd9 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -183,6 +183,18 @@ ScreenGameplay::ScreenGameplay() m_sprMiddleFrame.SetXY( MIDDLE_FRAME_X, MIDDLE_FRAME_Y ); + // LifeFrame goes below LifeMeter + CString sLifeFrameName; + if( bExtra ) + sLifeFrameName = "gameplay extra life frame"; + else if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY ) + sLifeFrameName = "gameplay oni life frame"; + else + sLifeFrameName = "gameplay life frame"; + m_sprLifeFrame.Load( THEME->GetPathTo("Graphics",sLifeFrameName) ); + m_sprLifeFrame.SetXY( LIFE_FRAME_X, LIFE_FRAME_Y(bExtra) ); + this->AddChild( &m_sprLifeFrame ); + for( p=0; pm_SongOptions.m_LifeType ) @@ -202,18 +214,6 @@ ScreenGameplay::ScreenGameplay() this->AddChild( m_pLifeMeter[p] ); } - // LifeFrame goes above LifeMeter - CString sLifeFrameName; - if( bExtra ) - sLifeFrameName = "gameplay extra life frame"; - else if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY ) - sLifeFrameName = "gameplay oni life frame"; - else - sLifeFrameName = "gameplay life frame"; - m_sprLifeFrame.Load( THEME->GetPathTo("Graphics",sLifeFrameName) ); - m_sprLifeFrame.SetXY( LIFE_FRAME_X, LIFE_FRAME_Y(bExtra) ); - this->AddChild( &m_sprLifeFrame ); - m_textStageNumber.LoadFromFont( THEME->GetPathTo("Fonts","gameplay stage") ); m_textStageNumber.TurnShadowOff(); diff --git a/stepmania/src/SnapDisplay.h b/stepmania/src/SnapDisplay.h index 89532addb6..60697c0aa5 100644 --- a/stepmania/src/SnapDisplay.h +++ b/stepmania/src/SnapDisplay.h @@ -29,7 +29,7 @@ public: bool PrevSnapMode(); bool NextSnapMode(); - NoteType GetSnapMode() { return m_NoteType; }; + NoteType GetNoteType() { return m_NoteType; }; protected: int m_iNumCols; diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 24cbbb0932..4a5c1a43f0 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -194,12 +194,13 @@ void Sprite::DrawPrimitives() ::Sleep( PREFSMAN->m_iMovieDecodeMS ); // let the movie decode a frame - // offset so that pixels are aligned to texels - if( PREFSMAN->m_iDisplayResolution == 320 ) - DISPLAY->TranslateLocal( -1, -1, 0 ); - else - DISPLAY->TranslateLocal( -0.5f, -0.5f, 0 ); - + // Offset so that pixels are aligned to texels + // Offset by -0.5, -0.5 if 640x480 + // Offset by -1.0, -1.0 if 320x240 + DISPLAY->TranslateLocal( + -0.5f*SCREEN_WIDTH/(float)PREFSMAN->m_iDisplayResolution, + -0.5f*SCREEN_WIDTH/(float)PREFSMAN->GetDisplayHeight(), + 0 ); // use m_temp_* variables to draw the object FRECT quadVerticies; @@ -235,6 +236,8 @@ void Sprite::DrawPrimitives() v[1].t = D3DXVECTOR2( m_CustomTexCoords[2], m_CustomTexCoords[3] ); // top left v[2].t = D3DXVECTOR2( m_CustomTexCoords[4], m_CustomTexCoords[5] ); // bottom right v[3].t = D3DXVECTOR2( m_CustomTexCoords[6], m_CustomTexCoords[7] ); // top right + + DISPLAY->EnableTextureWrapping(); } else { @@ -245,6 +248,11 @@ void Sprite::DrawPrimitives() v[1].t = D3DXVECTOR2( pTexCoordRect->left, pTexCoordRect->top ); // top left v[2].t = D3DXVECTOR2( pTexCoordRect->right, pTexCoordRect->bottom ); // bottom right v[3].t = D3DXVECTOR2( pTexCoordRect->right, pTexCoordRect->top ); // top right + + // if the texture has more than one frame, we're going to get border mess from the + // neighboring frame, so don't bother turning wrapping off. + if( m_pTexture->GetNumFrames() == 1 ) + DISPLAY->DisableTextureWrapping(); } diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 5891f2e4f1..e703b438ff 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -177,6 +177,13 @@ public: return m_BackgroundChanges[i].m_sBGName; }; void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const; + float GetBeatFromElapsedTime( float fElapsedTime ) const // shortcut for places that care only about the beat + { + float fBeat, fThrowAway; + bool bThrowAway; + GetBeatAndBPSFromElapsedTime( fElapsedTime, fBeat, fThrowAway, bThrowAway ); + return fBeat; + } float GetElapsedTimeFromBeat( float fBeat ) const;