2003-07-09 03:10:01 +00:00
#include "global.h"
#include "PrefsManager.h"
#include "ScreenUnlock.h"
#include "ThemeManager.h"
#include "GameState.h"
#include "RageLog.h"
2005-02-21 06:22:46 +00:00
#include "UnlockManager.h"
2003-07-09 04:46:24 +00:00
#include "SongManager.h"
2003-07-12 20:35:48 +00:00
#include "ActorUtil.h"
2003-07-16 20:11:03 +00:00
#include "song.h"
2003-07-17 23:33:19 +00:00
#include "Course.h"
2004-11-06 23:13:47 +00:00
#define UNLOCK_TEXT_SCROLL_X THEME->GetMetricF("ScreenUnlock", "UnlockTextScrollX");
#define UNLOCK_TEXT_SCROLL_START_Y THEME->GetMetricF("ScreenUnlock", "UnlockTextScrollStartY")
#define UNLOCK_TEXT_SCROLL_END_Y THEME->GetMetricF("ScreenUnlock", "UnlockTextScrollEndY")
#define UNLOCK_TEXT_SCROLL_ZOOM THEME->GetMetricF("ScreenUnlock", "UnlockTextScrollZoom")
#define UNLOCK_TEXT_SCROLL_ROWS THEME->GetMetricF("ScreenUnlock", "UnlockTextScrollRows")
#define UNLOCK_TEXT_SCROLL_MAX_WIDTH THEME->GetMetricF("ScreenUnlock", "UnlockTextScrollMaxWidth")
2003-07-17 23:33:19 +00:00
#define UNLOCK_TEXT_SCROLL_ICON_X THEME->GetMetricF("ScreenUnlock", "UnlockTextScrollIconX")
#define UNLOCK_TEXT_SCROLL_ICON_SIZE THEME->GetMetricF("ScreenUnlock", "UnlockTextScrollIconSize")
2004-11-06 23:13:47 +00:00
#define UNLOCK_TEXT_SCROLL THEME->GetMetricI("ScreenUnlock", "UnlockTextScroll")
#define TYPE_TO_DISPLAY THEME->GetMetric ("ScreenUnlock", "TypeOfPointsToDisplay")
#define ICON_COMMAND THEME->GetMetricA("ScreenUnlock", "UnlockIconCommand")
#define TIME_TO_DISPLAY THEME->GetMetricF("ScreenUnlock", "TimeToDisplay")
#define POINTS_ZOOM THEME->GetMetricF("ScreenUnlock","PointsZoom")
2003-07-09 03:10:01 +00:00
2004-11-26 17:28:47 +00:00
REGISTER_SCREEN_CLASS ( ScreenUnlock );
2003-09-27 22:30:51 +00:00
ScreenUnlock :: ScreenUnlock ( CString sClassName ) : ScreenAttract ( sClassName )
2003-07-09 03:10:01 +00:00
{
LOG -> Trace ( "ScreenUnlock::ScreenUnlock()" );
2003-07-30 01:59:11 +00:00
2005-03-12 08:11:31 +00:00
unsigned NumUnlocks = UNLOCKMAN -> m_SongEntries . size ();
2003-08-06 11:28:46 +00:00
if ( ! PREFSMAN -> m_bUseUnlockSystem || NumUnlocks == 0 )
2003-07-30 01:59:11 +00:00
{
this -> HandleScreenMessage ( SM_GoToNextScreen );
return ;
}
2005-02-23 06:29:05 +00:00
}
void ScreenUnlock :: Init ()
{
ScreenAttract :: Init ();
2005-03-12 08:11:31 +00:00
unsigned NumUnlocks = UNLOCKMAN -> m_SongEntries . size ();
2003-07-30 01:59:11 +00:00
2005-02-06 03:32:53 +00:00
PointsUntilNextUnlock . LoadFromFont ( THEME -> GetPathF ( "Common" , "normal" ) );
2003-07-09 03:10:01 +00:00
PointsUntilNextUnlock . SetHorizAlign ( Actor :: align_left );
2005-01-26 11:21:43 +00:00
apActorCommands IconCommand = ICON_COMMAND ;
2004-09-21 07:53:39 +00:00
for ( unsigned i = 1 ; i <= NumUnlocks ; i ++ )
2003-07-09 03:10:01 +00:00
{
2004-01-24 22:55:59 +00:00
// get pertaining UnlockEntry
2005-03-12 08:15:36 +00:00
CString SongTitle = UNLOCKMAN -> m_SongEntries [ i - 1 ]. m_sSongName ;
2004-01-24 22:55:59 +00:00
LOG -> Trace ( "UnlockScreen: Searching for %s" , SongTitle . c_str ());
2004-02-21 01:06:35 +00:00
const UnlockEntry * pSong = UNLOCKMAN -> FindLockEntry ( SongTitle );
2004-01-24 22:55:59 +00:00
if ( pSong == NULL )
{
LOG -> Trace ( "Can't find song %s" , SongTitle . c_str ());
continue ;
}
2003-07-16 14:03:40 +00:00
Sprite * entry = new Sprite ;
2003-07-09 03:10:01 +00:00
// new unlock graphic
2005-02-06 03:32:53 +00:00
entry -> Load ( THEME -> GetPathG ( "ScreenUnlock" , ssprintf ( "%d icon" , i )) );
2003-07-09 03:10:01 +00:00
2003-07-10 14:44:13 +00:00
// set graphic location
2003-07-16 14:03:40 +00:00
entry -> SetName ( ssprintf ( "Unlock%d" , i ) );
SET_XY ( * entry );
2003-07-09 03:10:01 +00:00
2004-12-03 05:19:46 +00:00
entry -> RunCommands ( IconCommand );
2003-07-16 14:03:40 +00:00
Unlocks . push_back ( entry );
2003-07-10 07:22:31 +00:00
2004-01-25 16:24:34 +00:00
if ( ! pSong -> IsLocked () )
2003-07-17 12:14:19 +00:00
this -> AddChild ( Unlocks [ Unlocks . size () - 1 ]);
2003-07-09 03:10:01 +00:00
}
2003-07-16 13:13:26 +00:00
// scrolling text
2003-07-17 23:33:19 +00:00
if ( UNLOCK_TEXT_SCROLL != 0 )
2003-07-16 13:13:26 +00:00
{
2003-07-17 23:33:19 +00:00
float ScrollingTextX = UNLOCK_TEXT_SCROLL_X ;
float ScrollingTextStartY = UNLOCK_TEXT_SCROLL_START_Y ;
float ScrollingTextEndY = UNLOCK_TEXT_SCROLL_END_Y ;
float ScrollingTextZoom = UNLOCK_TEXT_SCROLL_ZOOM ;
float ScrollingTextRows = UNLOCK_TEXT_SCROLL_ROWS ;
float MaxWidth = UNLOCK_TEXT_SCROLL_MAX_WIDTH ;
2003-07-16 13:13:26 +00:00
2003-07-17 23:33:19 +00:00
float SecondsToScroll = TIME_TO_DISPLAY ;
2003-07-16 13:13:26 +00:00
if ( SecondsToScroll > 2 ) SecondsToScroll -- ;
2003-07-18 15:00:33 +00:00
float SECS_PER_CYCLE = 0 ;
2003-07-16 13:13:26 +00:00
2003-07-18 15:00:33 +00:00
if ( UNLOCK_TEXT_SCROLL != 3 )
2003-08-06 13:53:40 +00:00
SECS_PER_CYCLE = ( float ) SecondsToScroll / ( ScrollingTextRows + NumUnlocks );
2003-07-18 15:00:33 +00:00
else
2003-08-06 13:53:40 +00:00
SECS_PER_CYCLE = ( float ) SecondsToScroll / ( ScrollingTextRows * 3 + NumUnlocks + 4 );
2003-07-18 15:00:33 +00:00
2004-09-21 07:53:39 +00:00
for ( unsigned i = 1 ; i <= NumUnlocks ; i ++ )
2003-07-16 13:13:26 +00:00
{
2005-03-12 08:15:36 +00:00
CString DisplayedSong = UNLOCKMAN -> m_SongEntries [ i - 1 ]. m_sSongName ;
2003-07-25 05:25:23 +00:00
2003-07-17 23:33:19 +00:00
DisplayedSong . MakeUpper ();
2004-02-22 21:25:22 +00:00
const UnlockEntry * pSong = UNLOCKMAN -> FindLockEntry ( DisplayedSong );
2003-08-06 13:53:40 +00:00
if ( pSong == NULL ) // no such song
2003-07-28 19:30:40 +00:00
continue ;
2003-07-17 23:33:19 +00:00
2004-01-24 22:55:59 +00:00
BitmapText * text = new BitmapText ;
2005-02-06 03:32:53 +00:00
text -> LoadFromFont ( THEME -> GetPathF ( "ScreenUnlock" , "text" ) );
2004-01-24 22:55:59 +00:00
text -> SetHorizAlign ( Actor :: align_left );
2003-07-17 23:33:19 +00:00
text -> SetZoom ( ScrollingTextZoom );
2003-07-16 13:13:26 +00:00
2003-07-18 06:38:05 +00:00
if ( pSong && pSong -> m_pSong != NULL )
2003-07-17 23:33:19 +00:00
{
2003-07-18 06:38:05 +00:00
CString title = pSong -> m_pSong -> GetDisplayMainTitle ();
2003-07-18 07:34:43 +00:00
CString subtitle = pSong -> m_pSong -> GetDisplaySubTitle ();
2003-07-17 23:33:19 +00:00
if ( subtitle != "" )
title = title + " \n " + subtitle ;
2003-12-17 09:53:00 +00:00
text -> SetMaxWidth ( MaxWidth );
text -> SetText ( title );
2003-07-17 23:33:19 +00:00
}
2003-08-06 13:53:40 +00:00
else // song is missing, might be a course
2003-07-17 12:14:19 +00:00
{
2003-07-17 23:33:19 +00:00
Course * crs = SONGMAN -> FindCourse ( DisplayedSong );
if ( crs != NULL )
{
2003-12-17 09:53:00 +00:00
text -> SetMaxWidth ( MaxWidth );
2004-07-11 10:02:38 +00:00
text -> SetText ( crs -> GetFullDisplayTitle () );
2004-11-06 23:13:47 +00:00
text -> SetDiffuse ( RageColor ( 0 , 1 , 0 , 1 ) );
2003-07-17 23:33:19 +00:00
}
2003-07-18 07:34:43 +00:00
else // entry isn't a song or course
2003-07-17 23:33:19 +00:00
{
text -> SetText ( "" );
2004-11-06 23:13:47 +00:00
text -> SetDiffuse ( RageColor ( 0.5 , 0 , 0 , 1 ) );
2003-07-17 23:33:19 +00:00
}
2003-07-17 12:14:19 +00:00
}
2003-07-16 13:13:26 +00:00
2003-07-24 14:04:13 +00:00
if ( pSong != NULL && pSong -> m_pSong != NULL )
2003-07-17 23:33:19 +00:00
{
2004-01-25 16:24:34 +00:00
if ( pSong -> IsLocked () ) // song is locked
2003-07-17 23:33:19 +00:00
{
text -> SetText ( "???" );
2003-07-28 08:46:16 +00:00
text -> SetZoomX ( 1 );
2003-08-06 13:53:40 +00:00
} else { // song is unlocked, change color
2003-07-18 06:38:05 +00:00
RageColor color = SONGMAN -> GetGroupColor ( pSong -> m_pSong -> m_sGroupName );
2003-07-17 23:33:19 +00:00
text -> SetGlobalDiffuseColor ( color );
}
2003-07-17 12:14:19 +00:00
}
2003-07-16 13:13:26 +00:00
2003-07-16 14:03:40 +00:00
text -> SetXY ( ScrollingTextX , ScrollingTextStartY );
2003-07-20 15:09:37 +00:00
2003-08-06 11:28:46 +00:00
if ( UNLOCK_TEXT_SCROLL == 3 && UNLOCK_TEXT_SCROLL_ROWS + i > NumUnlocks )
2003-08-06 13:53:40 +00:00
{ // special command for last unlocks when extreme-style scrolling is in effect
2003-08-06 11:28:46 +00:00
float TargetRow = - 0.5f + i + UNLOCK_TEXT_SCROLL_ROWS - NumUnlocks ;
2003-07-20 15:09:37 +00:00
float StopOffPoint = ScrollingTextEndY - TargetRow / UNLOCK_TEXT_SCROLL_ROWS * ( ScrollingTextEndY - ScrollingTextStartY );
float FirstCycleTime = ( UNLOCK_TEXT_SCROLL_ROWS - TargetRow ) * SECS_PER_CYCLE ;
float SecondCycleTime = ( 6 + TargetRow ) * SECS_PER_CYCLE - FirstCycleTime ;
LOG -> Trace ( "Target Row: %f" , TargetRow );
LOG -> Trace ( "command for icon %d: %s" , i , ssprintf ( "diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0" , SECS_PER_CYCLE * ( i - 1 ), FirstCycleTime , StopOffPoint , SecondCycleTime * 2 , ScrollingTextEndY ). c_str () );
2004-11-06 23:13:47 +00:00
CString sCommand = ssprintf ( "diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0" , SECS_PER_CYCLE * ( i - 1 ), FirstCycleTime , StopOffPoint , SecondCycleTime , ScrollingTextEndY );
2005-02-23 19:15:24 +00:00
text -> RunCommands ( ActorCommands ( sCommand ) );
2003-07-20 15:09:37 +00:00
}
else
2004-11-06 23:13:47 +00:00
{
CString sCommand = ssprintf ( "diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,0.1;diffusealpha,0" , SECS_PER_CYCLE * ( i - 1 ), SECS_PER_CYCLE * ( ScrollingTextRows ), ScrollingTextEndY );
2005-02-23 19:15:24 +00:00
text -> RunCommands ( ActorCommands ( sCommand ) );
2004-11-06 23:13:47 +00:00
}
2003-07-16 14:03:40 +00:00
item . push_back ( text );
2003-07-18 15:00:33 +00:00
if ( UNLOCK_TEXT_SCROLL >= 2 )
2003-07-16 13:13:26 +00:00
{
2003-07-16 14:03:40 +00:00
Sprite * IconCount = new Sprite ;
// new unlock graphic
2005-02-06 03:32:53 +00:00
IconCount -> Load ( THEME -> GetPathG ( "ScreenUnlock" , ssprintf ( "%d icon" , i )) );
2003-07-16 14:03:40 +00:00
// set graphic location
2003-07-17 23:33:19 +00:00
IconCount -> SetXY ( UNLOCK_TEXT_SCROLL_ICON_X , ScrollingTextStartY );
2003-07-16 14:03:40 +00:00
2003-07-17 23:33:19 +00:00
IconCount -> SetHeight ( UNLOCK_TEXT_SCROLL_ICON_SIZE );
IconCount -> SetWidth ( UNLOCK_TEXT_SCROLL_ICON_SIZE );
2003-07-16 14:03:40 +00:00
2003-08-06 11:28:46 +00:00
if ( UNLOCK_TEXT_SCROLL == 3 && UNLOCK_TEXT_SCROLL_ROWS + i > NumUnlocks )
2003-07-20 15:09:37 +00:00
{
2003-08-06 11:28:46 +00:00
float TargetRow = - 0.5f + i + UNLOCK_TEXT_SCROLL_ROWS - NumUnlocks ;
2003-07-20 15:09:37 +00:00
float StopOffPoint = ScrollingTextEndY - TargetRow / UNLOCK_TEXT_SCROLL_ROWS * ( ScrollingTextEndY - ScrollingTextStartY );
float FirstCycleTime = ( UNLOCK_TEXT_SCROLL_ROWS - TargetRow ) * SECS_PER_CYCLE ;
float SecondCycleTime = ( 6 + TargetRow ) * SECS_PER_CYCLE - FirstCycleTime ;
LOG -> Trace ( "Target Row: %f" , TargetRow );
LOG -> Trace ( "command for icon %d: %s" , i , ssprintf ( "diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0" , SECS_PER_CYCLE * ( i - 1 ), FirstCycleTime , StopOffPoint , SecondCycleTime * 2 , ScrollingTextEndY ). c_str () );
2004-11-06 23:13:47 +00:00
CString sCommand = ssprintf ( "diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0" , SECS_PER_CYCLE * ( i - 1 ), FirstCycleTime , StopOffPoint , SecondCycleTime , ScrollingTextEndY );
2005-02-23 19:15:24 +00:00
IconCount -> RunCommands ( ActorCommands ( sCommand ) );
2003-07-20 15:09:37 +00:00
}
else
2004-11-06 23:13:47 +00:00
{
CString sCommand = ssprintf ( "diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,0.1;diffusealpha,0" , SECS_PER_CYCLE * ( i - 1 ), SECS_PER_CYCLE * ( ScrollingTextRows ), ScrollingTextEndY );
2005-02-23 19:15:24 +00:00
IconCount -> RunCommands ( ActorCommands ( sCommand ) );
2004-11-06 23:13:47 +00:00
}
2003-07-16 14:03:40 +00:00
ItemIcons . push_back ( IconCount );
2003-07-17 12:14:19 +00:00
LOG -> Trace ( "Added unlock text %d" , i );
2003-07-16 14:03:40 +00:00
2003-07-18 15:00:33 +00:00
if ( UNLOCK_TEXT_SCROLL == 3 )
{
2004-01-25 16:24:34 +00:00
if ( ! pSong -> IsLocked () )
2003-07-18 15:00:33 +00:00
LastUnlocks . push_back ( i );
}
2003-07-16 13:13:26 +00:00
}
}
}
2003-07-18 15:00:33 +00:00
if ( UNLOCK_TEXT_SCROLL == 3 )
{
float ScrollingTextX = UNLOCK_TEXT_SCROLL_X ;
float ScrollingTextStartY = UNLOCK_TEXT_SCROLL_START_Y ;
float ScrollingTextEndY = UNLOCK_TEXT_SCROLL_END_Y ;
float ScrollingTextRows = UNLOCK_TEXT_SCROLL_ROWS ;
float MaxWidth = UNLOCK_TEXT_SCROLL_MAX_WIDTH ;
float SecondsToScroll = TIME_TO_DISPLAY - 1 ;
2003-08-06 13:53:40 +00:00
float SECS_PER_CYCLE = ( float ) SecondsToScroll / ( ScrollingTextRows * 3 + NumUnlocks + 4 );
2003-07-18 15:00:33 +00:00
2004-09-21 07:53:39 +00:00
for ( unsigned i = 1 ; i <= UNLOCK_TEXT_SCROLL_ROWS ; i ++ )
2003-07-18 15:00:33 +00:00
{
2003-08-10 03:23:17 +00:00
if ( i > LastUnlocks . size ())
2003-07-18 15:00:33 +00:00
continue ;
2003-07-31 20:34:01 +00:00
unsigned NextIcon = LastUnlocks [ LastUnlocks . size () - i ];
2003-07-18 15:00:33 +00:00
2005-03-12 08:15:36 +00:00
CString DisplayedSong = UNLOCKMAN -> m_SongEntries [ NextIcon - 1 ]. m_sSongName ;
2003-07-25 05:25:23 +00:00
2003-07-18 15:00:33 +00:00
DisplayedSong . MakeUpper ();
2004-02-22 21:25:22 +00:00
const UnlockEntry * pSong = UNLOCKMAN -> FindLockEntry ( DisplayedSong );
2003-07-18 15:00:33 +00:00
2003-07-28 08:46:16 +00:00
if ( pSong -> m_pSong == NULL )
continue ;
2004-01-24 22:55:59 +00:00
BitmapText * NewText = new BitmapText ;
2005-02-06 03:32:53 +00:00
NewText -> LoadFromFont ( THEME -> GetPathF ( "ScreenUnlock" , "text" ) );
2004-01-24 22:55:59 +00:00
NewText -> SetHorizAlign ( Actor :: align_left );
CString title = pSong -> m_pSong -> GetDisplayMainTitle ();
CString subtitle = pSong -> m_pSong -> GetDisplaySubTitle ();
2003-07-28 08:46:16 +00:00
2003-07-18 15:00:33 +00:00
if ( subtitle != "" )
title = title + " \n " + subtitle ;
2004-01-24 22:55:59 +00:00
NewText -> SetZoom ( UNLOCK_TEXT_SCROLL_ZOOM );
2003-12-17 09:53:00 +00:00
NewText -> SetMaxWidth ( MaxWidth );
NewText -> SetText ( title );
2003-07-18 15:00:33 +00:00
RageColor color = SONGMAN -> GetGroupColor ( pSong -> m_pSong -> m_sGroupName );
NewText -> SetGlobalDiffuseColor ( color );
NewText -> SetXY ( ScrollingTextX , ScrollingTextStartY );
2004-11-06 23:13:47 +00:00
{
CString sCommand = ssprintf ( "diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;" , SECS_PER_CYCLE * ( NumUnlocks + 2 * i - 2 ), SECS_PER_CYCLE * (( ScrollingTextRows - i ) * 2 + 1 ), ( ScrollingTextStartY + ( ScrollingTextEndY - ScrollingTextStartY ) * ( ScrollingTextRows - i + 0.5 ) / ScrollingTextRows ));
2005-02-23 19:15:24 +00:00
NewText -> RunCommands ( ActorCommands ( sCommand ) );
2004-11-06 23:13:47 +00:00
}
2003-07-18 15:00:33 +00:00
// new unlock graphic
2004-01-24 22:55:59 +00:00
Sprite * NewIcon = new Sprite ;
2005-02-06 03:32:53 +00:00
NewIcon -> Load ( THEME -> GetPathG ( "ScreenUnlock" , ssprintf ( "%d icon" , NextIcon )) );
2003-07-18 15:00:33 +00:00
NewIcon -> SetXY ( UNLOCK_TEXT_SCROLL_ICON_X , ScrollingTextStartY );
NewIcon -> SetHeight ( UNLOCK_TEXT_SCROLL_ICON_SIZE );
NewIcon -> SetWidth ( UNLOCK_TEXT_SCROLL_ICON_SIZE );
2004-11-06 23:13:47 +00:00
{
CString sCommand = ssprintf ( "diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;" , SECS_PER_CYCLE * ( NumUnlocks + 2 * i - 2 ), SECS_PER_CYCLE * (( ScrollingTextRows - i ) * 2 + 1 ), ( ScrollingTextStartY + ( ScrollingTextEndY - ScrollingTextStartY ) * ( ScrollingTextRows - i + 0.5 ) / ScrollingTextRows ));
2005-02-23 19:15:24 +00:00
NewIcon -> RunCommands ( ActorCommands ( sCommand ) );
2004-11-06 23:13:47 +00:00
}
2003-07-18 15:00:33 +00:00
ItemIcons . push_back ( NewIcon );
item . push_back ( NewText );
}
}
2003-07-16 13:13:26 +00:00
2003-08-10 05:54:20 +00:00
// NOTE: the following two loops require the iterator to
// be ints because if you decrement an unsigned when it
// equals zero, you get the maximum value of an unsigned,
// which is still greater than 0. By typecasting it as
// an integer, you can achieve -1, which exits the loop.
2004-09-21 07:53:39 +00:00
for ( int i = item . size () - 1 ; ( int ) i >= 0 ; i -- )
2003-07-20 03:54:26 +00:00
this -> AddChild ( item [ i ]);
2004-09-21 07:53:39 +00:00
for ( int i = ItemIcons . size () - 1 ; ( int ) i >= 0 ; i -- )
2003-07-20 03:54:26 +00:00
this -> AddChild ( ItemIcons [ i ]);
2003-07-09 06:05:43 +00:00
PointsUntilNextUnlock . SetName ( "PointsDisplay" );
2003-07-17 23:33:19 +00:00
CString PointDisplay = TYPE_TO_DISPLAY ;
2003-07-09 06:05:43 +00:00
if ( PointDisplay == "DP" || PointDisplay == "Dance" )
2003-08-06 13:53:40 +00:00
{
2004-02-21 01:06:35 +00:00
CString sDP = ssprintf ( "%d" , ( int ) UNLOCKMAN -> DancePointsUntilNextUnlock () );
2003-07-09 06:05:43 +00:00
PointsUntilNextUnlock . SetText ( sDP );
2003-08-06 13:53:40 +00:00
} else if ( PointDisplay == "AP" || PointDisplay == "Arcade" ) {
2004-02-21 01:06:35 +00:00
CString sAP = ssprintf ( "%d" , ( int ) UNLOCKMAN -> ArcadePointsUntilNextUnlock () );
2003-07-09 06:05:43 +00:00
PointsUntilNextUnlock . SetText ( sAP );
2003-08-06 13:53:40 +00:00
} else if ( PointDisplay == "SP" || PointDisplay == "Song" ) {
2004-02-21 01:06:35 +00:00
CString sSP = ssprintf ( "%d" , ( int ) UNLOCKMAN -> SongPointsUntilNextUnlock () );
2003-07-09 06:05:43 +00:00
PointsUntilNextUnlock . SetText ( sSP );
2003-08-06 13:53:40 +00:00
}
2003-07-09 06:05:43 +00:00
2003-07-17 23:33:19 +00:00
PointsUntilNextUnlock . SetZoom ( POINTS_ZOOM );
2003-07-09 03:10:01 +00:00
SET_XY ( PointsUntilNextUnlock );
this -> AddChild ( & PointsUntilNextUnlock );
2003-07-10 07:22:31 +00:00
this -> ClearMessageQueue ( SM_BeginFadingOut ); // ignore ScreenAttract's SecsToShow
2003-07-17 23:33:19 +00:00
this -> PostScreenMessage ( SM_BeginFadingOut , TIME_TO_DISPLAY );
2004-02-13 05:39:15 +00:00
2004-05-02 03:01:27 +00:00
this -> SortByDrawOrder ();
2003-07-09 03:10:01 +00:00
}
2003-08-03 14:29:12 +00:00
ScreenUnlock ::~ ScreenUnlock ()
{
while ( Unlocks . size () > 0 )
{
Sprite * entry = Unlocks [ Unlocks . size () - 1 ];
SAFE_DELETE ( entry );
Unlocks . pop_back ();
}
while ( item . size () > 0 )
{
BitmapText * entry = item [ item . size () - 1 ];
SAFE_DELETE ( entry );
item . pop_back ();
}
while ( ItemIcons . size () > 0 )
{
Sprite * entry = ItemIcons [ ItemIcons . size () - 1 ];
SAFE_DELETE ( entry );
ItemIcons . pop_back ();
}
2003-08-10 03:23:17 +00:00
}
2004-06-08 05:22:33 +00:00
/*
* (c) 2003 Andrew Wong
* 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.
*/