Skip to content

Commit

Permalink
use sys overlay for reload instead of screen (functional, not pretty)
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 22, 2018
1 parent e9f225e commit 3618d38
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 126 deletions.
141 changes: 46 additions & 95 deletions Themes/Til Death/BGAnimations/ScreenSystemLayer overlay/default.lua
Original file line number Diff line number Diff line change
@@ -1,117 +1,68 @@
local function CreditsText( pn )
local text = LoadFont(Var "LoadingScreen","credits") .. {
InitCommand=function(self)
self:name("Credits" .. PlayerNumberToString(pn))
ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen");
end;
UpdateTextCommand=function(self)
local str = ScreenSystemLayerHelpers.GetCreditsMessage(pn);
self:settext(str);
end;
UpdateVisibleCommand=function(self)
local screen = SCREENMAN:GetTopScreen();
local bShow = true;
if screen then
local sClass = screen:GetName();
bShow = THEME:GetMetric( sClass, "ShowCreditDisplay" );
end

self:visible( bShow );
end
};
return text;
end;

--[[ local function PlayerPane( PlayerNumber )
local t = Def.ActorFrame {
InitCommand=function(self)
self:name("PlayerPane" .. PlayerNumberToString(PlayerNumber));
-- ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen");
end
};
t[#t+1] = Def.ActorFrame {
Name = "Background";
Def.Quad {
InitCommand=function(self)
self:zoomto(160,28):queuecommand("On")
end;
OnCommand=function(self)
self:diffuse(PlayerColor(PlayerNumber)):fadebottom(1)
end;
};
};
t[#t+1] = Def.BitmapText{
Font="Common Normal";
Name = "PlayerText";
InitCommand=function(self)
self:x(-60):maxwidth(80/0.5):zoom(0.5):queuecommand("On")
end;
OnCommand=function(self)
self:playcommand("Set")
end;
SetCommand=function(self)
local profile = PROFILEMAN:GetProfile( PlayerNumber) or PROFILEMAN:GetMachineProfile()
if profile then
self:settext( profile:GetDisplayName() );
else
self:settext( "NoProf" );
end
end;
};
return t
end --]]
--
local t = Def.ActorFrame {}
-- Aux
t[#t+1] = LoadActor(THEME:GetPathB("ScreenSystemLayer","aux"));
-- Credits
--[[
t[#t+1] = Def.ActorFrame {
PlayerPane( PLAYER_1 ) .. {
InitCommand=function(self)
self:x(scale(0.125,0,1,SCREEN_LEFT,SCREEN_WIDTH)):y(SCREEN_BOTTOM-16)
end
};
CreditsText( PLAYER_1 );
CreditsText( PLAYER_2 );
};--]]
-- Text
t[#t+1] = Def.ActorFrame {
Def.Quad {
InitCommand=function(self)
self:zoomtowidth(SCREEN_WIDTH):zoomtoheight(30):horizalign(left):vertalign(top):y(SCREEN_TOP):diffuse(color("0,0,0,0"))
end;
end,
OnCommand=function(self)
self:finishtweening():diffusealpha(0.85)
end;
end,
OffCommand=function(self)
self:sleep(3):linear(0.5):diffusealpha(0)
end;
};
end
},
Def.BitmapText{
Font="Common Normal";
Name="Text";
Font="Common Normal",
Name="Text",
InitCommand=function(self)
self:maxwidth(750):horizalign(left):vertalign(top):y(SCREEN_TOP+10):x(SCREEN_LEFT+10):shadowlength(1):diffusealpha(0)
end;
self:maxwidth(SCREEN_WIDTH*0.8):horizalign(left):vertalign(top):y(SCREEN_TOP+10):x(SCREEN_LEFT+10):diffusealpha(0)
end,
OnCommand=function(self)
self:finishtweening():diffusealpha(1):zoom(0.5)
end;
end,
OffCommand=function(self)
self:sleep(3):linear(0.5):diffusealpha(0)
end;
};
end
},
SystemMessageMessageCommand = function(self, params)
self:GetChild("Text"):settext( params.Message );
self:playcommand( "On" );
self:GetChild("Text"):settext( params.Message )
self:playcommand( "On" )
if params.NoAnimate then
self:finishtweening();
self:finishtweening()
end
self:playcommand( "Off" );
end;
self:playcommand( "Off" )
end,
HideSystemMessageMessageCommand = function(self)
self:finishtweening()
end;
};
end
}

t[#t+1] = Def.ActorFrame {
DFRStartedMessageCommand=function(self)
self:visible(true)
end,
DFRFinishedMessageCommand=function(self,params)
self:visible(false)
end,
BeginCommand=function(self)
self:visible(false)
end,
Def.Quad {
InitCommand=function(self)
self:x(SCREEN_WIDTH/2):y(SCREEN_HEIGHT/2):zoomto(SCREEN_WIDTH/2, SCREEN_HEIGHT/2):diffuse(color("0.3,0.3,0.3,1"))
end,
},
Def.BitmapText{
Font="Common Normal",
InitCommand=function(self)
self:x(SCREEN_WIDTH/2):y(SCREEN_HEIGHT/2):diffusealpha(1):settext(""):maxwidth(SCREEN_WIDTH/2)
end,
DFRUpdateMessageCommand=function(self,params)
self:settext(params.txt)
end,
}
}


return t;
return t
4 changes: 2 additions & 2 deletions Themes/Til Death/BGAnimations/_PlayerInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ t[#t+1] = Def.ActorFrame{
SetCommand=function(self)
self:settextf("Songs Loaded: %i", SONGMAN:GetNumSongs())
end,
DifferentialReloadMessageCommand=function(self)
DFRFinishedMessageCommand=function(self)
self:queuecommand("Set")
end
end,
},
LoadFont("Common Normal") .. {
InitCommand=function(self)
Expand Down
4 changes: 1 addition & 3 deletions Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2698,14 +2698,13 @@ Fallback="ScreenOptionsSimpleService"
NextScreen=Branch.AfterInit()
PrevScreen=Branch.AfterInit()

LineNames="GameType,GraphicSound,KeyConfig,Arcade,InputOptions,SoundGraphics,Profiles,Network,Advanced,Reload"
LineNames="GameType,GraphicSound,KeyConfig,Arcade,InputOptions,SoundGraphics,Profiles,Network,Advanced"

LineSync="gamecommand;screen,ScreenGameplaySyncMachine;name,Calibrate Machine Sync"
LineGameType="gamecommand;screen,ScreenSelectGame;name,Select Game"
LineKeyConfig="gamecommand;screen,ScreenMapControllers;name,Key Joy Mappings"
LineTestInput="gamecommand;screen,ScreenTestInput;name,Test Input"
LineInput="gamecommand;screen,ScreenOptionsInput;name,Input Options"
LineReload="gamecommand;screen,ScreenReloadSongs;name,Reload Songs"
LineArcade="gamecommand;screen,ScreenOptionsArcade;name,Arcade Options"
LineAppearance="gamecommand;screen,ScreenAppearanceOptions;name,Appearance Options"
LineBGFit="gamecommand;screen,ScreenSetBGFit;name,Set BG Fit Mode"
Expand Down Expand Up @@ -3131,7 +3130,6 @@ TimerOnCommand=visible,false
[ScreenReloadSongs]
Class="ScreenReloadSongs"
Fallback="Screen"
PrevScreen="ScreenSelectMusic"
NextScreen=Branch.TitleMenu()

[ScreenNetPlayerOptions]
Expand Down
4 changes: 2 additions & 2 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ void DownloadManager::UpdatePacks(float fDeltaSeconds)
if (screen && screen->GetName() == "ScreenNetSelectMusic")
static_cast<ScreenNetSelectMusic*>(screen)->DifferentialReload();
else
SCREENMAN->SetNewScreen("ScreenReloadSongs");
SONGMAN->DifferentialReload();
}
if (downloadingPacks < maxPacksToDownloadAtOnce && !DownloadQueue.empty() && timeSinceLastDownload > DownloadCooldownTime) {
auto it = DownloadQueue.begin();
Expand Down Expand Up @@ -570,7 +570,7 @@ void DownloadManager::UpdatePacks(float fDeltaSeconds)
if (screen && screen->GetName() == "ScreenNetSelectMusic")
static_cast<ScreenNetSelectMusic*>(screen)->DifferentialReload();
else
SCREENMAN->SetNewScreen("ScreenReloadSongs");
SONGMAN->DifferentialReload();
}
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/ScreenNetSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ void ScreenNetSelectMusic::Init()

void ScreenNetSelectMusic::DifferentialReload()
{
SCREENMAN->SetNewScreen("ScreenReloadSongs");
SONGMAN->DifferentialReload();
m_MusicWheel.ReloadSongList(false, "");
}


Expand Down
6 changes: 1 addition & 5 deletions src/ScreenReloadSongs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ void ScreenReloadSongs::Update( float fDeltaTime )
return;

ASSERT( !IsFirstUpdate() );

int newsongs = SONGMAN->DifferentialReload(m_pLoadingWindow);
SCREENMAN->SystemMessage(ssprintf("Differential reload of %i songs", newsongs));
MESSAGEMAN->Broadcast("DifferentialReload");
SCREENMAN->PostMessageToTopScreen( SM_GoToPrevScreen, 0 );
SCREENMAN->PostMessageToTopScreen(SM_GoToNextScreen, 0);
}

/*
Expand Down
3 changes: 2 additions & 1 deletion src/ScreenSelectMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ void ScreenSelectMusic::Update(float fDeltaTime)

void ScreenSelectMusic::DifferentialReload()
{
SCREENMAN->SetNewScreen("ScreenReloadSongs");
SONGMAN->DifferentialReload();
m_MusicWheel.ReloadSongList(false, "");
}

bool ScreenSelectMusic::Input(const InputEventPlus &input)
Expand Down
27 changes: 12 additions & 15 deletions src/SongManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "ThemeManager.h"
#include "TitleSubstitution.h"
#include "arch/LoadingWindow/LoadingWindow.h"
#include "ScreenManager.h"

SongManager* SONGMAN = NULL; // global and accessible from anywhere in our program

Expand Down Expand Up @@ -99,29 +100,23 @@ static LocalizedString SANITY_CHECKING_GROUPS("SongManager", "Sanity checking gr

// See InitSongsFromDisk for any comment clarification -mina
int SongManager::DifferentialReload() {
MESSAGEMAN->Broadcast("DFRStarted");
FILEMAN->FlushDirCache(SpecialFiles::SONGS_DIR);
FILEMAN->FlushDirCache(ADDITIONAL_SONGS_DIR);
FILEMAN->FlushDirCache(EDIT_SUBDIR);
int newsongs = 0;
newsongs += DifferentialReloadDir(SpecialFiles::SONGS_DIR, NULL);
newsongs += DifferentialReloadDir(ADDITIONAL_SONGS_DIR, NULL);
newsongs += DifferentialReloadDir(SpecialFiles::SONGS_DIR);
newsongs += DifferentialReloadDir(ADDITIONAL_SONGS_DIR);
LoadEnabledSongsFromPref();
return newsongs;
}

int SongManager::DifferentialReload(LoadingWindow *ld) {
FILEMAN->FlushDirCache(SpecialFiles::SONGS_DIR);
FILEMAN->FlushDirCache(ADDITIONAL_SONGS_DIR);
FILEMAN->FlushDirCache(EDIT_SUBDIR);
int newsongs = 0;
newsongs += DifferentialReloadDir(SpecialFiles::SONGS_DIR, ld);
newsongs += DifferentialReloadDir(ADDITIONAL_SONGS_DIR, ld);
LoadEnabledSongsFromPref();
Message msg("DFRFinished");
msg.SetParam("newsongs", newsongs);
MESSAGEMAN->Broadcast(msg);
return newsongs;
}

// See LoadStepManiaSongDir for any comment clarification -mina
int SongManager::DifferentialReloadDir(string dir, LoadingWindow *ld) {
int SongManager::DifferentialReloadDir(string dir) {
if (dir.substr(dir.size()) != "/")
dir += "/";

Expand Down Expand Up @@ -184,8 +179,10 @@ int SongManager::DifferentialReloadDir(string dir, LoadingWindow *ld) {

index_entry.emplace_back(pNewSong);

if(ld)
ld->SetText("Loading:\n" + sGroupDirName + "\n" + pNewSong->GetMainTitle());
Message msg("DFRUpdate");
msg.SetParam("txt","Loading:\n" + sGroupDirName + "\n" + pNewSong->GetMainTitle());
MESSAGEMAN->Broadcast(msg);
SCREENMAN->Draw(); // not sure if this needs to be handled better (more safely?) or if its fine-mina

loaded++;
songIndex++;
Expand Down
3 changes: 1 addition & 2 deletions src/SongManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ class SongManager

void InitAll( LoadingWindow *ld ); // songs, groups - everything.
int DifferentialReload();
int DifferentialReload(LoadingWindow * ld);
int DifferentialReloadDir(string dir, LoadingWindow *ld);
int DifferentialReloadDir(string dir);
void PreloadSongImages();

bool IsGroupNeverCached(const RString& group) const;
Expand Down

0 comments on commit 3618d38

Please sign in to comment.