From 8e6637dd0d59db9fe4912e6ef46a76b88b614cff Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 10 Apr 2005 23:42:47 +0000 Subject: [PATCH] merge ListDisplay into ActorScroller --- stepmania/src/ActorScroller.cpp | 153 +++++++++++++++++++---- stepmania/src/ActorScroller.h | 35 ++++-- stepmania/src/CourseContentsList.cpp | 116 ++++++------------ stepmania/src/CourseContentsList.h | 28 +---- stepmania/src/ListDisplay.cpp | 174 --------------------------- stepmania/src/ListDisplay.h | 70 ----------- stepmania/src/MusicWheel.cpp | 20 --- stepmania/src/RageUtil.h | 20 +++ stepmania/src/ScreenRanking.cpp | 17 ++- stepmania/src/ScreenRanking.h | 4 +- stepmania/src/StepMania.dsp | 12 +- stepmania/src/StepMania.vcproj | 6 - 12 files changed, 232 insertions(+), 423 deletions(-) delete mode 100644 stepmania/src/ListDisplay.cpp delete mode 100644 stepmania/src/ListDisplay.h diff --git a/stepmania/src/ActorScroller.cpp b/stepmania/src/ActorScroller.cpp index 9499020036..034ed501fc 100644 --- a/stepmania/src/ActorScroller.cpp +++ b/stepmania/src/ActorScroller.cpp @@ -28,11 +28,22 @@ ActorScroller::ActorScroller() m_fDestinationItem = 0; m_fSecondsPerItem = 1; m_fNumItemsToDraw = 7; + m_fSecondsPauseBetweenItems = 0; + m_fNumItemsToDraw = 7; + m_bLoop = false; + m_fPauseCountdownSeconds = 0; + + m_fMaskWidth = 1; + m_fMaskHeight = 1; m_vRotationDegrees = RageVector3(0,0,0); m_vTranslateTerm0 = RageVector3(0,0,0); m_vTranslateTerm1 = RageVector3(0,0,0); m_vTranslateTerm2 = RageVector3(0,0,0); + + m_quadMask.SetBlendMode( BLEND_NO_EFFECT ); // don't change color values + m_quadMask.SetUseZBuffer( true ); // we want to write to the Zbuffer + m_quadMask.SetHidden( true ); } void ActorScroller::Load( @@ -54,6 +65,50 @@ void ActorScroller::Load( m_bLoaded = true; } +void ActorScroller::Load2( + float fNumItemsToDraw, + float fItemWidth, + float fItemHeight, + bool bLoop, + float fSecondsPerItem, + float fSecondsPauseBetweenItems ) +{ + CLAMP( fNumItemsToDraw, 1, 10000 ); + CLAMP( fItemWidth, 1, 10000 ); + CLAMP( fItemHeight, 1, 10000 ); + CLAMP( fSecondsPerItem, 0.01f, 10000 ); + CLAMP( fSecondsPauseBetweenItems, 0, 10000 ); + + m_fNumItemsToDraw = fNumItemsToDraw; + m_fMaskWidth = fItemWidth; + m_fMaskHeight = fItemHeight; + m_vTranslateTerm1 = RageVector3( 0, fItemHeight, 0 ); + m_bLoop = bLoop; + m_fSecondsPerItem = fSecondsPerItem; + m_fSecondsPauseBetweenItems = fSecondsPauseBetweenItems; + m_fCurrentItem = m_bLoop ? 0 : (float)-m_fNumItemsToDraw; + m_fDestinationItem = (float)(m_SubActors.size()+1); + m_fPauseCountdownSeconds = 0; + + RectF rectBarSize( + -m_fMaskWidth/2, + -m_fMaskHeight/2, + m_fMaskWidth/2, + m_fMaskHeight/2 ); + m_quadMask.StretchTo( rectBarSize ); + m_quadMask.SetZ( 1 ); + + m_quadMask.SetHidden( false ); + + m_bLoaded = true; +} + +float ActorScroller::GetSecondsForCompleteScrollThrough() +{ + float fTotalItems = m_fNumItemsToDraw + m_SubActors.size(); + return fTotalItems * (m_fSecondsPerItem + m_fSecondsPauseBetweenItems ); +} + void ActorScroller::LoadFromNode( const CString &sDir, const XNode *pNode ) { ActorFrame::LoadFromNode( sDir, pNode ); @@ -115,10 +170,55 @@ void ActorScroller::Update( float fDeltaTime ) if( m_fHibernateSecondsLeft > 0 ) return; // early abort + /* If we have no children, the code below will busy loop. */ + if( !m_SubActors.size() ) + return; + + // handle pause + if( fDeltaTime > m_fPauseCountdownSeconds ) + { + fDeltaTime -= m_fPauseCountdownSeconds; + m_fPauseCountdownSeconds = 0; + } + else + { + m_fPauseCountdownSeconds -= fDeltaTime; + fDeltaTime = 0; + return; + } + + + if( m_fCurrentItem == m_fDestinationItem ) + return; // done scrolling + + + float fOldItemAtTop = m_fCurrentItem; if( m_fSecondsPerItem > 0 ) fapproach( m_fCurrentItem, m_fDestinationItem, fDeltaTime/m_fSecondsPerItem ); + + // if items changed, then pause + if( (int)fOldItemAtTop != (int)m_fCurrentItem ) + m_fPauseCountdownSeconds = m_fSecondsPauseBetweenItems; + + if( m_bLoop ) + m_fCurrentItem = fmodf( m_fCurrentItem, m_fNumItemsToDraw+1 ); } +#define PUSH_AND_TRANSFORM_FOR_ITEM( fPosition ) { \ + DISPLAY->PushMatrix(); \ + if( m_vRotationDegrees.x ) DISPLAY->RotateX( m_vRotationDegrees.x*fPosition ); \ + if( m_vRotationDegrees.y ) DISPLAY->RotateY( m_vRotationDegrees.y*fPosition ); \ + if( m_vRotationDegrees.z ) DISPLAY->RotateZ( m_vRotationDegrees.z*fPosition ); \ + RageVector3 vTranslation = \ + m_vTranslateTerm0 + /* m_vTranslateTerm0*fPosition^0 */ \ + m_vTranslateTerm1 * fPosition + /* m_vTranslateTerm1*fPosition^1 */ \ + m_vTranslateTerm2 * fPosition*fPosition; /* m_vTranslateTerm2*fPosition^2 */ \ + DISPLAY->Translate( \ + vTranslation.x, \ + vTranslation.y, \ + vTranslation.z ); \ + } + void ActorScroller::DrawPrimitives() { // Optimization: If we weren't loaded, then fall back to the ActorFrame logic @@ -128,34 +228,37 @@ void ActorScroller::DrawPrimitives() } else { - for( unsigned i=0; i m_fNumItemsToDraw / 2 ) + // write to z buffer so that top and bottom are clipped + float fPositionFullyOnScreenTop = -(m_fNumItemsToDraw-1)/2.f; + float fPositionFullyOnScreenBottom = (m_fNumItemsToDraw-1)/2.f; + float fPositionCompletelyOffScreenTop = fPositionFullyOnScreenTop - 1; + float fPositionCompletelyOffScreenBottom = fPositionFullyOnScreenBottom + 1; + + PUSH_AND_TRANSFORM_FOR_ITEM( fPositionCompletelyOffScreenTop ) + m_quadMask.Draw(); + DISPLAY->PopMatrix(); + + PUSH_AND_TRANSFORM_FOR_ITEM( fPositionCompletelyOffScreenBottom ) + m_quadMask.Draw(); + DISPLAY->PopMatrix(); + + float fFirstItemToDraw = fPositionCompletelyOffScreenTop + m_fCurrentItem; + float fLastItemToDraw = fPositionCompletelyOffScreenBottom + m_fCurrentItem; + + for( int iItem=(int)truncf(ceilf(fFirstItemToDraw)); iItem<=fLastItemToDraw; iItem++ ) + { + float fPosition = iItem - m_fCurrentItem; + int iIndex = iItem; + if( m_bLoop ) + wrap( iIndex, m_SubActors.size()-1 ); + else if( iIndex < 0 || iIndex >= (int)m_SubActors.size() ) continue; - DISPLAY->PushMatrix(); - - if( m_vRotationDegrees.x ) - DISPLAY->RotateX( m_vRotationDegrees.x*fItemOffset ); - if( m_vRotationDegrees.y ) - DISPLAY->RotateY( m_vRotationDegrees.y*fItemOffset ); - if( m_vRotationDegrees.z ) - DISPLAY->RotateZ( m_vRotationDegrees.z*fItemOffset ); - - RageVector3 vTranslation = - m_vTranslateTerm0 + // m_vTranslateTerm0*itemOffset^0 - m_vTranslateTerm1 * fItemOffset + // m_vTranslateTerm1*itemOffset^1 - m_vTranslateTerm2 * fItemOffset*fItemOffset; // m_vTranslateTerm2*itemOffset^2 - DISPLAY->Translate( - vTranslation.x, - vTranslation.y, - vTranslation.z - ); - - m_SubActors[i]->Draw(); - + PUSH_AND_TRANSFORM_FOR_ITEM( fPosition ) + m_SubActors[iIndex]->Draw(); DISPLAY->PopMatrix(); } } diff --git a/stepmania/src/ActorScroller.h b/stepmania/src/ActorScroller.h index 0d0d4cddab..0792819367 100644 --- a/stepmania/src/ActorScroller.h +++ b/stepmania/src/ActorScroller.h @@ -4,6 +4,7 @@ #define ActorScroller_H #include "ActorFrame.h" +#include "Quad.h" struct XNode; template @@ -34,12 +35,25 @@ public: const RageVector3 &vTranslateTerm1, const RageVector3 &vTranslateTerm2 ); + void Load2( + float fNumItemsToDraw, + float fItemWidth, + float fItemHeight, + bool bLoop, + float fSecondsPerItem, + float fSecondsPauseBetweenItems ); + virtual void Update( float fDelta ); virtual void DrawPrimitives(); // DOES draw void LoadFromNode( const CString &sDir, const XNode *pNode ); - void SetDestinationItem( float fItemIndex ) { m_fDestinationItem = fItemIndex; } - void SetCurrentAndDestinationItem( float fItemIndex ) { m_fCurrentItem = m_fDestinationItem = fItemIndex; } + + void SetDestinationItem( float fItemIndex ) { m_fDestinationItem = fItemIndex; } + void SetCurrentAndDestinationItem( float fItemIndex ) { m_fCurrentItem = m_fDestinationItem = fItemIndex; } + float GetDestinationItem() { return m_fDestinationItem; } + void SetPauseCountdownSeconds( float fSecs ) { m_fPauseCountdownSeconds = fSecs; } + + float GetSecondsForCompleteScrollThrough(); // // Commands @@ -47,12 +61,19 @@ public: void PushSelf( lua_State *L ); protected: - bool m_bLoaded; - float m_fCurrentItem; // usually between 0 and m_SubActors.size() - float m_fDestinationItem; - float m_fSecondsPerItem; // <= 0 means don't scroll - float m_fNumItemsToDraw; + bool m_bLoaded; + float m_fCurrentItem; // Item at top of list, usually between 0 and m_SubActors.size(), approaches destination + float m_fDestinationItem; + float m_fSecondsPerItem; // <= 0 means don't scroll + float m_fSecondsPauseBetweenItems; + float m_fNumItemsToDraw; + bool m_bLoop; + float m_fPauseCountdownSeconds; + float m_fMaskWidth; + float m_fMaskHeight; + Quad m_quadMask; + // Note: Rotation is applied before translation. // rot = m_vRotationDegrees*itemOffset^1 diff --git a/stepmania/src/CourseContentsList.cpp b/stepmania/src/CourseContentsList.cpp index b8efaf2b1b..fcf646b70a 100644 --- a/stepmania/src/CourseContentsList.cpp +++ b/stepmania/src/CourseContentsList.cpp @@ -12,45 +12,37 @@ #include "GameState.h" #include "Style.h" #include "RageTexture.h" +#include "CourseEntryDisplay.h" +const int MAX_VISIBLE_ITEMS = 5; +const int MAX_ITEMS = MAX_VISIBLE_ITEMS+2; CourseContentsList::CourseContentsList() { - m_iNumContents = 0; - m_quad.SetDiffuse( RageColor(0,0,0,1) ); - m_quad.SetBlendMode( BLEND_NO_EFFECT ); // invisible, since we want to write only to the Zbuffer + for( int i=0; iSetName( "CourseEntryDisplay" ); + (*d)->Load(); + (*d)->SetUseZBuffer( true ); } - - /* These are all the same; grab the dimensions. */ - ContentsBarHeight = m_CourseContentDisplays[0].GetUnzoomedHeight(); - ContentsBarWidth = m_CourseContentDisplays[0].GetUnzoomedWidth(); } void CourseContentsList::SetFromGameState() { - Course* pCourse = GAMESTATE->m_pCurCourse; - - if( pCourse == NULL ) - { - m_iNumContents = 0; - return; - } + RemoveAllChildren(); // FIXME: Is there a better way to handle when players don't have // the same number of TrailEntries? @@ -59,13 +51,13 @@ void CourseContentsList::SetFromGameState() Trail* pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber]; if( pMasterTrail == NULL ) return; - int iNumEntriesToShow = min((int)pMasterTrail->m_vEntries.size(), MAX_TOTAL_CONTENTS); + unsigned uNumEntriesToShow = min( pMasterTrail->m_vEntries.size(), m_vpDisplay.size() ); - m_iNumContents = 0; - - for( int i=0; iAddChild( &d ); const TrailEntry* pte[NUM_PLAYERS]; ZERO( pte ); @@ -78,73 +70,43 @@ void CourseContentsList::SetFromGameState() if( unsigned(i) < pTrail->m_vEntries.size() ) pte[pn] = &pTrail->m_vEntries[i]; } - display.LoadFromTrailEntry( m_iNumContents+1, pte ); - - m_iNumContents++; - } -} - -void CourseContentsList::Update( float fDeltaTime ) -{ - ActorFrame::Update( fDeltaTime ); - - if( m_fTimeUntilScroll > 0 && m_iNumContents > MAX_VISIBLE_CONTENTS) - m_fTimeUntilScroll -= fDeltaTime; - if( m_fTimeUntilScroll <= 0 ) { - m_fItemAtTopOfList += fDeltaTime; - m_fItemAtTopOfList = fmodf(m_fItemAtTopOfList, float(m_iNumContents)); + d.LoadFromTrailEntry( (int)(truncf(m_fItemAtPosition0InList))+i+1, pte ); } - for( int i=0; im_vEntries.size() > uNumEntriesToShow; -void CourseContentsList::DrawPrimitives() -{ - // write to z buffer so that top and bottom are clipped - m_quad.SetZ( 1 ); + this->Load2( + (float)MAX_VISIBLE_ITEMS, + m_vpDisplay[0]->GetUnzoomedWidth(), + m_vpDisplay[0]->GetUnzoomedHeight(), + bLoop, + 0.7f, + 0.7f ); - RectF rectBarSize(-ContentsBarWidth/2, -ContentsBarHeight/2, - ContentsBarWidth/2, ContentsBarHeight/2); - m_quad.StretchTo( rectBarSize ); - - m_quad.SetY( (-(MAX_VISIBLE_CONTENTS-1)/2 - 1) * float(ContentsBarHeight) ); - m_quad.Draw(); - - m_quad.SetY( ((MAX_VISIBLE_CONTENTS-1)/2 + 1) * float(ContentsBarHeight) ); - m_quad.Draw(); - - int iItemToDraw = (int)m_fItemAtTopOfList; - - // HACK: Insert a little pause as a new item appears on the screen - float fRemainder = m_fItemAtTopOfList - (int)m_fItemAtTopOfList; - fRemainder = min( fRemainder*1.5f, 1 ); - - const float fY = (-fRemainder-(MAX_VISIBLE_CONTENTS-1)/2) * ContentsBarHeight; - - for( int i=0; iSetCurrentAndDestinationItem( (MAX_VISIBLE_ITEMS-1)/2 ); + if( bLoop ) { - if( m_fTimeUntilScroll <= 0 ) - m_CourseContentDisplays[iItemToDraw].SetY( fY + i*ContentsBarHeight); - m_CourseContentDisplays[iItemToDraw].Draw(); - iItemToDraw = (iItemToDraw+1) % m_iNumContents; + SetPauseCountdownSeconds( 1.5f ); + this->SetDestinationItem( MAX_ITEMS+1 ); // loop forever } } void CourseContentsList::TweenInAfterChangedCourse() { + /* m_fItemAtTopOfList = 0; m_fTimeUntilScroll = 3; - for( int i=0; i m_vpDisplay; float m_fTimeUntilScroll; - float m_fItemAtTopOfList; // between 0 and m_iNumContents + float m_fItemAtPosition0InList; // 0 <= val < m_vpDisplay.size() }; #endif diff --git a/stepmania/src/ListDisplay.cpp b/stepmania/src/ListDisplay.cpp deleted file mode 100644 index dc1b210dc8..0000000000 --- a/stepmania/src/ListDisplay.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#include "global.h" -#include "ListDisplay.h" -#include "RageUtil.h" -#include "GameConstantsAndTypes.h" -#include "PrefsManager.h" -#include "RageLog.h" -#include "PrefsManager.h" -#include "Course.h" -#include "SongManager.h" -#include "ThemeManager.h" -#include "Steps.h" -#include "GameState.h" -#include "Style.h" -#include "RageTexture.h" - - -// -// TODO: Merge this with ActorScroller -// - -ListDisplay::ListDisplay() -{ - m_iNumItemsToShow = 0; - m_fItemWidth = 0; - m_fItemHeight = 0; - m_fCurrentItemAtTopOfList = 0; - m_fDestinationItemAtTopOfList = 0; - - m_quadMask.SetBlendMode( BLEND_NO_EFFECT ); // don't change color values - m_quadMask.SetUseZBuffer( true ); // we want to write to the Zbuffer -} - - -void ListDisplay::Load( - const vector &m_vpItems, - int iNumItemsToShow, - float fItemWidth, - float fItemHeight, - bool bLoop, - float fSecondsPerItem, - float fSecondsPauseBetweenItems, - bool bSlide ) -{ - CLAMP( iNumItemsToShow, 1, 10000 ); - CLAMP( fItemWidth, 1, 10000 ); - CLAMP( fItemHeight, 1, 10000 ); - CLAMP( fSecondsPerItem, 0.01f, 10000 ); - CLAMP( fSecondsPauseBetweenItems, 0, 10000 ); - - m_SubActors = m_vpItems; - m_iNumItemsToShow = iNumItemsToShow; - m_fItemWidth = fItemWidth; - m_fItemHeight = fItemHeight; - m_bLoop = bLoop; - m_fSecondsPerItem = fSecondsPerItem; - m_fSecondsPauseBetweenItems = fSecondsPauseBetweenItems; - m_bSlide = bSlide; - m_fCurrentItemAtTopOfList = m_bLoop ? 0 : (float)-m_iNumItemsToShow; - m_fDestinationItemAtTopOfList = (float)(m_vpItems.size()+1); - m_fSecondsPauseCountdown = 0; - - RectF rectBarSize(-m_fItemWidth/2, -m_fItemHeight/2, - m_fItemWidth/2, m_fItemHeight/2); - m_quadMask.StretchTo( rectBarSize ); - m_quadMask.SetZ( 1 ); -} - -float ListDisplay::GetSecondsForCompleteScrollThrough() -{ - int fTotalItems = m_iNumItemsToShow + m_SubActors.size(); - return fTotalItems * (m_fSecondsPerItem + m_fSecondsPauseBetweenItems ); -} - -void ListDisplay::Update( float fDeltaTime ) -{ - ActorFrame::Update( fDeltaTime ); - - /* If we have no children, the code below will busy loop. */ - if( !m_SubActors.size() ) - return; - - // handle pause - if( fDeltaTime > m_fSecondsPauseCountdown ) - { - fDeltaTime -= m_fSecondsPauseCountdown; - m_fSecondsPauseCountdown = 0; - } - else - { - m_fSecondsPauseCountdown -= fDeltaTime; - fDeltaTime = 0; - return; - } - - - if( m_fCurrentItemAtTopOfList == m_fDestinationItemAtTopOfList ) - return; // done scrolling - - - float fOldItemAtTop = m_fCurrentItemAtTopOfList; - fapproach( m_fCurrentItemAtTopOfList, m_fDestinationItemAtTopOfList, fDeltaTime/m_fSecondsPerItem ); - - // if items changed, then pause - if( (int)fOldItemAtTop != (int)m_fCurrentItemAtTopOfList ) - m_fSecondsPauseCountdown = m_fSecondsPauseBetweenItems; - - if( m_bLoop ) - wrap( m_fCurrentItemAtTopOfList, (float) m_SubActors.size() ); -} - -void ListDisplay::DrawPrimitives() -{ - if( m_SubActors.empty() ) - return; - - // write to z buffer so that top and bottom are clipped - float fIndexFullyOnScreenTop = -(m_iNumItemsToShow-1)/2.f; - float fIndexFullyOnScreenBottom = (m_iNumItemsToShow-1)/2.f; - float fIndexCompletelyOffScreenTop = fIndexFullyOnScreenTop - 1; - float fIndexCompletelyOffScreenBottom = fIndexFullyOnScreenBottom + 1; - - m_quadMask.SetY( fIndexCompletelyOffScreenTop * m_fItemHeight ); - m_quadMask.Draw(); - m_quadMask.SetY( fIndexCompletelyOffScreenBottom * m_fItemHeight ); - m_quadMask.Draw(); - - int iItemToDraw = (int)m_fCurrentItemAtTopOfList; - float fRemainder = m_fCurrentItemAtTopOfList - (int)m_fCurrentItemAtTopOfList; - float fIndex = fIndexFullyOnScreenTop - fRemainder; - float fY = (fIndex)*m_fItemHeight; - - for( int i=0; i= 0 && iItemToDraw < (int) m_SubActors.size() ) - { - float fX = 0; - if( m_bSlide && fIndex>fIndexFullyOnScreenBottom-1 ) - fX = SCALE( fIndex, fIndexFullyOnScreenBottom, fIndexFullyOnScreenBottom-1.f, 640.f, 0.f ); - m_SubActors[iItemToDraw]->SetXY( roundf(fX), roundf(fY) ); - m_SubActors[iItemToDraw]->Draw(); - } - - iItemToDraw++; - if( m_bLoop ) - wrap( iItemToDraw, m_SubActors.size() ); - fY += m_fItemHeight; - fIndex += 1; - } -} - -/* - * (c) 2003 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ diff --git a/stepmania/src/ListDisplay.h b/stepmania/src/ListDisplay.h deleted file mode 100644 index ac4e772ec3..0000000000 --- a/stepmania/src/ListDisplay.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef LIST_DISPLAY_H -#define LIST_DISPLAY_H - -#include "ActorFrame.h" -#include "Quad.h" - -class ListDisplay : public ActorFrame -{ -public: - ListDisplay(); - - virtual void Update( float fDeltaTime ); - virtual void DrawPrimitives(); - - void Load( - const vector &m_vpItems, - int iNumItemsToShow, - float fItemWidth, - float fItemHeight, - bool bLoop, - float fSecondsPerItem, - float fSecondsPauseBetweenItems, - bool bSlide ); - - float GetSecondsForCompleteScrollThrough(); - void SetCurrentItem( float fItem ) { m_fCurrentItemAtTopOfList = fItem; } - void SetDestinationItem( float fItem ) { m_fDestinationItemAtTopOfList = fItem; } - float GetDestinationItem() { return m_fDestinationItemAtTopOfList; } - -protected: - int m_iNumItemsToShow; - float m_fItemWidth; - float m_fItemHeight; - bool m_bLoop; - float m_fSecondsPerItem; - float m_fSecondsPauseBetweenItems; - bool m_bSlide; - - float m_fCurrentItemAtTopOfList; // approaches destination - float m_fDestinationItemAtTopOfList; - float m_fSecondsPauseCountdown; - Quad m_quadMask; -}; - -#endif - -/* - * (c) 2003 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index d087a2d273..06ab3123fa 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -829,26 +829,6 @@ void MusicWheel::SetItemPosition( Actor &item, float fPosOffsetsFromMiddle ) item.SetRotationX( fRotationX ); } -template -void CircularShift( vector &v, int dist ) -{ - for( int i = abs( dist ); i>0; i-- ) - { - if( dist > 0 ) - { - T t = v[0]; - v.erase( v.begin() ); - v.push_back( t ); - } - else - { - T t = v.back(); - v.erase( v.end()-1 ); - v.insert( v.begin(), t ); - } - } -} - void MusicWheel::RebuildAllMusicWheelItems() { RebuildMusicWheelItems( INT_MAX ); diff --git a/stepmania/src/RageUtil.h b/stepmania/src/RageUtil.h index 890eee8130..6c82b3c87c 100644 --- a/stepmania/src/RageUtil.h +++ b/stepmania/src/RageUtil.h @@ -73,6 +73,26 @@ inline void wrap(float &x, float n) x = fmodf(x,n); } +template +void CircularShift( vector &v, int dist ) +{ + for( int i = abs(dist); i>0; i-- ) + { + if( dist > 0 ) + { + T t = v[0]; + v.erase( v.begin() ); + v.push_back( t ); + } + else + { + T t = v.back(); + v.erase( v.end()-1 ); + v.insert( v.begin(), t ); + } + } +} + /* * We only have unsigned swaps; byte swapping a signed value doesn't make sense. * diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index c4a1afa0a9..5e62924f90 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -390,7 +390,7 @@ void ScreenRanking::Scroll( int iDir ) float fDest = m_ListScoreRowItems.GetDestinationItem(); float fOldDest = fDest; fDest += iDir; - CLAMP( fDest, 0.0f, (float)m_vScoreRowItem.size()-SONG_SCORE_ROWS_TO_SHOW ); + CLAMP( fDest, (SONG_SCORE_ROWS_TO_SHOW-1)/2.0f, m_vScoreRowItem.size()-(SONG_SCORE_ROWS_TO_SHOW-1)/2.0f-1 ); if( fOldDest != fDest ) { // TODO: play sound @@ -627,15 +627,13 @@ float ScreenRanking::SetPage( PageToShow pts ) m_ListScoreRowItems.Reset(); SET_XY_AND_ON_COMMAND( m_ListScoreRowItems ); - vector vpActors; for( unsigned i=0; i vpActors; for( unsigned i=0; i m_vScoreRowItem; // for all_steps - ListDisplay m_ListScoreRowItems; + ActorScroller m_ListScoreRowItems; vector m_vPagesToShow; diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 6d730cd063..93036c7a2d 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -62,7 +62,7 @@ IntDir=.\../Debug6 TargetDir=\stepmania\stepmania\Program TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -99,7 +99,7 @@ IntDir=.\../Release6 TargetDir=\stepmania\stepmania\Program TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -2286,14 +2286,6 @@ SOURCE=.\HelpDisplay.h # End Source File # Begin Source File -SOURCE=.\ListDisplay.cpp -# End Source File -# Begin Source File - -SOURCE=.\ListDisplay.h -# End Source File -# Begin Source File - SOURCE=.\MemoryCardDisplay.cpp # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index b8a0430fdb..d9a3213de6 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -1590,12 +1590,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ - - - -