rudimentary support for extreme-style unlocks list (its not perfect yet, still have to work on commands)

This commit is contained in:
Andrew Wong
2003-07-18 15:00:33 +00:00
parent b91d1039ae
commit bd78736692
2 changed files with 83 additions and 5 deletions
+81 -5
View File
@@ -39,6 +39,8 @@
ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
{
unsigned i;
LOG->Trace("ScreenUnlock::ScreenUnlock()");
PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") );
PointsUntilNextUnlock.SetHorizAlign( Actor::align_left );
@@ -50,7 +52,7 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
CString IconCommand = ICON_COMMAND;
for(int i=1; i <= NUM_UNLOCKS; i++)
for(i=1; i <= NUM_UNLOCKS; i++)
{
Sprite* entry = new Sprite;
@@ -94,15 +96,20 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
if (SecondsToScroll > 2) SecondsToScroll--;
const float SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows + NumberUnlocks);
float SECS_PER_CYCLE = 0;
for(int i = 1; i <= NumberUnlocks; i++)
if (UNLOCK_TEXT_SCROLL != 3)
SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows + NumberUnlocks);
else
SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumberUnlocks + 4);
for(i = 1; i <= NumberUnlocks; i++)
{
BitmapText* text = new BitmapText;
/* XXX: Don't load _shared directly. Instead, create a redir in the
* Fonts directory, eg. "ScreenUnlock text.redir", that points to it. */
text->LoadFromFont( THEME->GetPathToF("_shared2") );
text->LoadFromFont( THEME->GetPathToF("ScreenUnlock text") );
text->SetHorizAlign( Actor::align_left );
CString DisplayedSong = DISPLAYED_SONG(i);
@@ -153,7 +160,7 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
item.push_back(text);
this->AddChild(item[i-1]);
if (UNLOCK_TEXT_SCROLL == 2)
if (UNLOCK_TEXT_SCROLL >= 2)
{
Sprite* IconCount = new Sprite;
@@ -173,10 +180,79 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
this->AddChild(ItemIcons[i-1]);
LOG->Trace("Added unlock text %d", i);
if (UNLOCK_TEXT_SCROLL == 3)
{
if (!pSong->isLocked)
LastUnlocks.push_back(i);
}
}
}
}
if (UNLOCK_TEXT_SCROLL == 3)
{
int NumberUnlocks = NUM_UNLOCKS;
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;
float SecondsToScroll = TIME_TO_DISPLAY - 1;
float SECS_PER_CYCLE = (float)SecondsToScroll/(ScrollingTextRows * 3 + NumberUnlocks + 4);
for(i=1; i < UNLOCK_TEXT_SCROLL_ROWS; i++)
{
if (i > LastUnlocks.size())
continue;
int NextIcon = LastUnlocks[LastUnlocks.size() - i];
Sprite* NewIcon = new Sprite;
BitmapText* NewText = new BitmapText;
NewText->LoadFromFont( THEME->GetPathToF("ScreenUnlock text") );
NewText->SetHorizAlign( Actor::align_left );
CString DisplayedSong = DISPLAYED_SONG(NextIcon);
DisplayedSong.MakeUpper();
SongEntry *pSong = GAMESTATE->m_pUnlockingSys->FindLockEntry(DisplayedSong);
/* Reset zoom before using SetTextMaxWidth. */
NewText->SetZoom(UNLOCK_TEXT_SCROLL_ZOOM);
CString title = pSong->m_pSong->GetDisplayMainTitle();
CString subtitle = pSong->m_pSong->GetDisplaySubTitle();
if( subtitle != "" )
title = title + "\n" + subtitle;
NewText->SetTextMaxWidth( MaxWidth, title );
RageColor color = SONGMAN->GetGroupColor(pSong->m_pSong->m_sGroupName);
NewText->SetGlobalDiffuseColor(color);
NewText->SetXY(ScrollingTextX, ScrollingTextStartY);
NewText->Command( ssprintf("diffusealpha,0;sleep,%f;linear,0.5;diffusealpha,1;linear,%f;y,%f;", SECS_PER_CYCLE * (NumberUnlocks + 2 * i - 2), SECS_PER_CYCLE * 2 * (ScrollingTextRows + 1 - i), (ScrollingTextStartY + (ScrollingTextEndY - ScrollingTextStartY) * (ScrollingTextRows - i + 0.5) / ScrollingTextRows )) );
// new unlock graphic
NewIcon->Load( THEME->GetPathToG(ssprintf("ScreenUnlock %d icon", NextIcon)) );
// set graphic location
NewIcon->SetXY( UNLOCK_TEXT_SCROLL_ICON_X, ScrollingTextStartY);
NewIcon->SetHeight(UNLOCK_TEXT_SCROLL_ICON_SIZE);
NewIcon->SetWidth(UNLOCK_TEXT_SCROLL_ICON_SIZE);
NewIcon->Command( ssprintf("diffusealpha,0;sleep,%f;linear,0.5;diffusealpha,1;linear,%f;y,%f;", SECS_PER_CYCLE * (NumberUnlocks + 2 * i - 2), SECS_PER_CYCLE * 2 * (ScrollingTextRows + 1 - i), (ScrollingTextStartY + (ScrollingTextEndY - ScrollingTextStartY) * (ScrollingTextRows - i + 0.5) / ScrollingTextRows )) );
ItemIcons.push_back(NewIcon);
item.push_back(NewText);
this->AddChild(ItemIcons[ItemIcons.size() - 1]);
this->AddChild(item[item.size() - 1]);
}
}
PointsUntilNextUnlock.SetName( "PointsDisplay" );