2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2003-03-09 00:55:49 +00:00
|
|
|
#include "WheelNotifyIcon.h"
|
2002-01-16 10:01:32 +00:00
|
|
|
#include "RageUtil.h"
|
2002-05-01 19:14:55 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
2002-01-16 10:01:32 +00:00
|
|
|
#include "MusicWheel.h"
|
2003-03-09 00:55:49 +00:00
|
|
|
#include "WheelNotifyIcon.h"
|
2002-07-27 19:29:51 +00:00
|
|
|
#include "RageTimer.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2002-01-16 10:01:32 +00:00
|
|
|
|
|
|
|
|
|
2003-02-10 05:30:12 +00:00
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
WheelNotifyIcon::WheelNotifyIcon()
|
2002-07-27 19:29:51 +00:00
|
|
|
{
|
2005-02-06 03:32:53 +00:00
|
|
|
Load( THEME->GetPathG("WheelNotifyIcon","icons 4x2") );
|
2002-07-27 19:29:51 +00:00
|
|
|
StopAnimating();
|
2002-08-20 21:00:56 +00:00
|
|
|
}
|
2002-01-16 10:01:32 +00:00
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
void WheelNotifyIcon::SetFlags( Flags flags )
|
2002-07-27 19:29:51 +00:00
|
|
|
{
|
2003-02-10 05:30:12 +00:00
|
|
|
m_vIconsToShow.clear();
|
2002-07-27 19:29:51 +00:00
|
|
|
|
2003-02-10 05:30:12 +00:00
|
|
|
// push onto vector in highest to lowest priority
|
2002-08-20 21:00:56 +00:00
|
|
|
|
2003-02-10 05:30:12 +00:00
|
|
|
switch( flags.iPlayersBestNumber )
|
2002-07-27 19:29:51 +00:00
|
|
|
{
|
2003-02-10 05:30:12 +00:00
|
|
|
case 1: m_vIconsToShow.push_back( best1 ); break;
|
|
|
|
|
case 2: m_vIconsToShow.push_back( best2 ); break;
|
|
|
|
|
case 3: m_vIconsToShow.push_back( best3 ); break;
|
2002-07-27 19:29:51 +00:00
|
|
|
}
|
|
|
|
|
|
2003-02-10 05:30:12 +00:00
|
|
|
if( flags.bEdits )
|
|
|
|
|
m_vIconsToShow.push_back( edits );
|
|
|
|
|
|
|
|
|
|
switch( flags.iStagesForSong )
|
|
|
|
|
{
|
|
|
|
|
case 1: break;
|
|
|
|
|
case 2: m_vIconsToShow.push_back( long_ver ); break;
|
|
|
|
|
case 3: m_vIconsToShow.push_back( marathon ); break;
|
|
|
|
|
default: ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( flags.bHasBeginnerOr1Meter )
|
|
|
|
|
m_vIconsToShow.push_back( training );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// HACK: Make players best blink if it's the only icon
|
|
|
|
|
if( m_vIconsToShow.size() == 1 )
|
|
|
|
|
{
|
|
|
|
|
if( m_vIconsToShow[0] >= best1 && m_vIconsToShow[0] <= best3 )
|
|
|
|
|
m_vIconsToShow.push_back( empty );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_vIconsToShow.resize( min(m_vIconsToShow.size(),2u) ); // crop to most important 2
|
2004-06-08 19:56:35 +00:00
|
|
|
|
|
|
|
|
/* Make sure the right icon is selected, since we might be drawn before
|
|
|
|
|
* we get another update. */
|
|
|
|
|
Update(0);
|
2004-06-01 00:57:14 +00:00
|
|
|
}
|
2003-02-10 05:30:12 +00:00
|
|
|
|
2004-06-01 00:57:14 +00:00
|
|
|
bool WheelNotifyIcon::EarlyAbortDraw()
|
|
|
|
|
{
|
|
|
|
|
if( m_vIconsToShow.empty() )
|
|
|
|
|
return true;
|
|
|
|
|
return Sprite::EarlyAbortDraw();
|
2002-08-20 21:00:56 +00:00
|
|
|
}
|
2002-07-27 19:29:51 +00:00
|
|
|
|
2004-06-01 00:57:14 +00:00
|
|
|
void WheelNotifyIcon::Update( float fDeltaTime )
|
2002-07-27 19:29:51 +00:00
|
|
|
{
|
2003-02-10 05:30:12 +00:00
|
|
|
if( m_vIconsToShow.size() > 0 )
|
2002-07-27 19:29:51 +00:00
|
|
|
{
|
2004-06-08 19:59:33 +00:00
|
|
|
const float fSecondFraction = fmodf( RageTimer::GetTimeSinceStart(), 1 );
|
|
|
|
|
const int index = (int)(fSecondFraction*m_vIconsToShow.size());
|
2003-02-10 05:30:12 +00:00
|
|
|
Sprite::SetState( m_vIconsToShow[index] );
|
2002-07-27 19:29:51 +00:00
|
|
|
}
|
2003-02-10 05:30:12 +00:00
|
|
|
|
2004-06-01 00:57:14 +00:00
|
|
|
Sprite::Update( fDeltaTime );
|
2002-11-16 08:55:46 +00:00
|
|
|
}
|
2003-02-10 05:30:12 +00:00
|
|
|
|
2004-06-01 00:57:14 +00:00
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 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.
|
|
|
|
|
*/
|