local t = LoadFallbackB();

--t[#t+1] = StandardDecorationFromFile( "StageFrame", "StageFrame" );

t[#t+1] = LoadActor("danger");

--[[ top of screen ]]
t[#t+1] = StandardDecorationFromFile( "LifeFrame", "LifeFrame" );
t[#t+1] = StandardDecorationFromFileOptional( "StageDisplay", "StageDisplay" );
t[#t+1] = StandardDecorationFromFile( "SongTitle", "SongTitle" );

--[[ bottom of screen ]]
t[#t+1] = StandardDecorationFromFile( "ScoreFrame", "ScoreFrame" );

t[#t+1] = StandardDecorationFromFile( "SongPosition", "SongPosition" );

if ShowStandardDecoration("MaxCombo") then
	for pn in ivalues(PlayerNumber) do
		local combo = LoadFont("","Combo")..{
			Name="MaxCombo"..ToEnumShortString(pn);
			Text="0";
			BeginCommand=function(self)
				-- change horizalign based on # of active players.
				local value = 0.5;
				if GAMESTATE:GetNumPlayersEnabled() > 1 then value = (pn == PLAYER_1) and 0 or 1; end;
				self:halign(value);
				self:visible(GAMESTATE:IsHumanPlayer(pn));
			end;
			ComboChangedMessageCommand=function(self,param)
				if param.Player ~= pn then return; end;
				if param.PlayerStageStats then
					local pss = param.PlayerStageStats
					--local oldCombo = param.OldCombo;
					local curCombo = pss:GetCurrentCombo();
					local maxCombo = pss:MaxCombo();
					if curCombo > maxCombo then
						self:settext(curCombo);
					end;
				end;
			end;
		};
		t[#t+1] = StandardDecorationFromTable( "MaxCombo"..ToEnumShortString(pn), combo );
	end;
	-- if there's more than one player active, show who's got the bigger combo
	t[#t+1] = LoadFont("Screen", "credits")..{
		InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_BOTTOM-30;draworder,100;shadowlength,0;diffusecolor,color("#FFE5F4"));
		BeginCommand=function(self)
			self:settext(GAMESTATE:GetNumPlayersEnabled() > 1 and "=" or "");
		end;
		OnCommand=cmd(addy,100;decelerate,1;addy,-100;);
		OffCommand=cmd(accelerate,0.7;addy,120);
		SetCommand=function(self,param)
			if GAMESTATE:GetNumPlayersEnabled() > 1 then
				-- get two playerstagestats, compare the max combos, update
				local p1Stats = STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_1)
				local p2Stats = STATSMAN:GetCurStageStats():GetPlayerStageStats(PLAYER_2)
				local maxComboP1 = p1Stats:MaxCombo();
				local maxComboP2 = p2Stats:MaxCombo();
				local text = "";
				if maxComboP1 and maxComboP2 then
					if maxComboP1 > maxComboP2 then text = ">";
					elseif maxComboP1 < maxComboP2 then text = "<";
					elseif maxComboP1 == maxComboP2 then text = "=";
					end;
				else
					text = "";
				end;
				self:settext(text);
			end;
		end;
		ComboChangedMessageCommand=cmd(playcommand,"Set");
		--JudgmentMessageCommand=cmd(playcommand,"Set");
	};
end;

--[[
if ShowStandardDecoration("ModIconRows") then
	for pn in ivalues(PlayerNumber) do
		local t2 = Def.ModIconRow {
				InitCommand=cmd(Load,"ModIconRowGameplay"..ToEnumShortString(pn),pn);
			};	
		t[#t+1] = StandardDecorationFromTable( "ModIconRow" .. ToEnumShortString(pn), t2 );
	end
end
--]]

return t;