This commit is contained in:
RealFD 2022-03-04 08:08:43 +01:00
parent f522c00c91
commit 0d1fa4ceb1
3 changed files with 1314 additions and 112 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ json = require "json"
local common = require('common.common'); local common = require('common.common');
local difbar = require("components.diff_rectangle"); local difbar = require("components.diff_rectangle");
local spinnybg = require('components.background'); local Background = require('components.background');
local msg = game.GetSkinSetting("MSG"); local msg = game.GetSkinSetting("MSG");
local normname = game.GetSkinSetting("username") local normname = game.GetSkinSetting("username")
@ -29,29 +29,50 @@ local bg = gfx.CreateSkinImage("multi/lobby/bg.png", 1);
local bg_graid1 = gfx.CreateSkinImage("multi/lobby/gradient_bottom.png", 1); local bg_graid1 = gfx.CreateSkinImage("multi/lobby/gradient_bottom.png", 1);
local bg_graid2 = gfx.CreateSkinImage("multi/lobby/gradient_top.png", 1); local bg_graid2 = gfx.CreateSkinImage("multi/lobby/gradient_top.png", 1);
local backgroundImage = gfx.CreateSkinImage("bg_pattern.png", gfx.IMAGE_REPEATX | gfx.IMAGE_REPEATY)
local idolAnimation = gfx.LoadSkinAnimation('crew/anim/'..creww, 1 / 30, 0, true); local idolAnimation = gfx.LoadSkinAnimation('crew/anim/'..creww, 1 / 30, 0, true);
local idolAnimTransitionScale = 0; local idolAnimTransitionScale = 0;
local resX,resY = game.GetResolution()
local mposx = 0;
local mposy = 0;
local hovered = nil;
local buttonWidth = resX*(3/4);
local buttonHeight = 20;
local buttonBorder = 2;
local portrait
local jacket_size;
local BAR_ALPHA = 191;
local HEADER_HEIGHT = 100
local resx, resy = game.GetResolution() local resx, resy = game.GetResolution()
local desw = 1080 local desw = 1080
local desh = 1920 local desh = 1920
local scale; local scale;
local rightPanelX = 283;
local rightPanelY = 1187;
local leftPanelX = 575;
local leftPanelY = 1472;
local bottomPanelX = 1;
local bottomPanelY = 1250;
local jacketPanelX = 333;
local jacketPanelY = 1284;
local ownPanelX = 0;
local ownPanelY = 1310;
local roomNamePanelX = 429;
local roomNamePanelY = 1142;
local bpmPanelX = 0;
local bpmPanelY = 1692;
local infPanelX = 475
local infPanelY = 1590
local mposx = 0;
local mposy = 0;
local hovered = nil;
local buttonHeight = 20;
local buttonBorder = 2;
local portrait
local BAR_ALPHA = 191;
local HEADER_HEIGHT = 100
game.LoadSkinSample("click-02") game.LoadSkinSample("click-02")
game.LoadSkinSample("click-01") game.LoadSkinSample("click-01")
game.LoadSkinSample("menu_click") game.LoadSkinSample("menu_click")
@ -74,6 +95,9 @@ local missing_song = false;
local placeholderJacket = gfx.CreateSkinImage("song_select/loading.png", 0) local placeholderJacket = gfx.CreateSkinImage("song_select/loading.png", 0)
local did_exit = false; local did_exit = false;
-- Window variables
local resX, resY
-- Aspect Ratios -- Aspect Ratios
local landscapeWidescreenRatio = 16 / 9 local landscapeWidescreenRatio = 16 / 9
local landscapeStandardRatio = 4 / 3 local landscapeStandardRatio = 4 / 3
@ -84,6 +108,13 @@ local fullX, fullY
local desw = 1080 local desw = 1080
local desh = 1920 local desh = 1920
local function resolutionChange(x, y)
resX = x
resY = y
fullX = portraitWidescreenRatio * y
fullY = y
end
local irHeartbeatRequested = false; local irHeartbeatRequested = false;
local irText = '' local irText = ''
@ -143,44 +174,59 @@ local drawIdol = function(deltaTime)
end end
end end
songjacket = function() -- self explanatory songjacket = function() -- self explanatory -- done
if portrait then local resx, resy = game.GetResolution()
split = resX if resx ~= resX or resy ~= resY then
jacket_size = math.min(resX/4, resY/4); resolutionChange(resx, resy)
song_x_off = 0;
else
split = resX/2
jacket_size = math.min(resX/2, resY/2);
song_x_off = 1/2*resX;
end end
local jw , jh = gfx.ImageSize(m_jacket); local jw , jh = gfx.ImageSize(m_jacket);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(333, 1284, jw/1.18, jh/1.18, m_jacket,1,0); -- gfx.ImageRect(jacketPanelX, jacketPanelY, jw/1.18, jh/1.18, m_jacket,1,0);
gfx.ImageRect(resX, resY, jw/1.18, jh/1.18, m_jacket,1,0);
gfx.BeginPath()
gfx.ImageRect(jacketPanelX+12, jacketPanelY+19,jw/1.269,jh/1.35,jacket,1,0)
if mouse_clipped(jacketPanelX+12, jacketPanelY+19,jw/1.269,jh/1.35) and host == user_id then
hovered = function()
missing_song = false
mpScreen.SelectSong()
end
end
if selected_song == nil then
if jacket == 0 then
jacket = placeholderJacket
end
else
if selected_song.jacket == nil or selected_song.jacket == placeholderJacket then
selected_song.jacket = gfx.LoadImageJob(selected_song.jacketPath, placeholderJacket)
jacket = selected_song.jacket
end
end
end end
m_own_info = function() m_own_info = function() -- bottom left -- done
local x = 0
local y = 1310
gfx.BeginPath(); gfx.BeginPath();
gfx.FontSize(40) gfx.FontSize(40)
gfx.ImageRect(x, y, 343/1.18, 361/1.18,m_host_panel,1,0) gfx.ImageRect(ownPanelX, ownPanelY, 343/1.18, 361/1.18,m_host_panel,1,0)
gfx.Text(normname, x+20, y+78) gfx.Text(normname, ownPanelX+20, ownPanelY+78)
gfx.FontSize(22) gfx.FontSize(22)
gfx.Text(irText, x+5, y+288); gfx.Text(irText, ownPanelX+5, ownPanelY+288);
end end
m_base_part = function() -- just the images which slide up m_base_part = function() -- just the images which slide up -- done
local jw , jh = gfx.ImageSize(m_base_panel); local jw , jh = gfx.ImageSize(m_base_panel);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(1, 1250, jw/1.17, jh/1.18, m_base_panel,1,0); gfx.ImageRect(bottomPanelX, bottomPanelY, jw/1.17, jh/1.18, m_base_panel,1,0);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(1, 1250, jw/1.17, jh/1.18, m_anim,1,0); gfx.ImageRect(bottomPanelX, bottomPanelY, jw/1.17, jh/1.18, m_anim,1,0);
gfx.LoadSkinFont('Digital-Serial-Bold.ttf') gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
gfx.FillColor(255,255,255) gfx.FillColor(255,255,255)
@ -188,21 +234,21 @@ m_base_part = function() -- just the images which slide up
gfx.FontSize(24) gfx.FontSize(24)
end end
m_part = function() -- room name part m_part = function() -- room name part -- done
local jw , jh = gfx.ImageSize(m_panel); local jw , jh = gfx.ImageSize(m_panel);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(429, 1142, jw/1.175, jh/1.18, m_panel,1,0); gfx.ImageRect(roomNamePanelX, roomNamePanelY, jw/1.175, jh/1.18, m_panel,1,0);
gfx.FontSize(32); gfx.FontSize(32);
gfx.LoadSkinFont('Digital-Serial-Bold.ttf') gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT, gfx.TEXT_ALIGN_MIDDLE) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT, gfx.TEXT_ALIGN_MIDDLE)
gfx.Text(selected_room.name, 575, 1179) gfx.Text(selected_room.name,roomNamePanelX+146, roomNamePanelY+37)
end end
m_s_part = function () -- song info panel m_s_part = function () -- song info panel -- done
local jw , jh = gfx.ImageSize(m_s_panel); local jw , jh = gfx.ImageSize(m_s_panel);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(283, 1187, jw/1.175, jh/1.18, m_s_panel,1,0); gfx.ImageRect(rightPanelX, rightPanelY, jw/1.175, jh/1.18, m_s_panel,1,0);
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_LEFT); gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_LEFT);
gfx.FillColor(255,255,255) gfx.FillColor(255,255,255)
@ -210,82 +256,83 @@ m_s_part = function () -- song info panel
gfx.FontSize(32) gfx.FontSize(32)
if selected_song == nil then if selected_song == nil then
if host == user_id then if host == user_id then
gfx.Text("NO SONG", 535, 1236) gfx.Text("NO SONG", rightPanelX+245, rightPanelY+50)
gfx.Text("NO ARIST", 535, 1275) gfx.Text("NO ARIST", rightPanelX+245, rightPanelY+88)
gfx.FontSize(24) gfx.FontSize(24)
gfx.Text("NO EFFECTOR", 746, 1378) gfx.Text("NO EFFECTOR", rightPanelX+463, rightPanelY+191)
gfx.Text("NO ILLUSTRATOR", 746, 1406) gfx.Text("NO ILLUSTRATOR", rightPanelX+463, rightPanelY+219)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(22) gfx.FontSize(22)
gfx.Text("BPM ?",780, 1307) gfx.Text("BPM ?",rightPanelX+497, rightPanelY+118)
else else
if missing_song then if missing_song then
gfx.Text("MISSING SONG!!!!", 535, 1235) gfx.Text("MISSING SONG!!!!", rightPanelX+245, rightPanelY+50)
gfx.Text("MISSING ARIST!!!!", 535, 1275) gfx.Text("MISSING ARIST!!!!", rightPanelX+245, rightPanelY+88)
gfx.FontSize(24) gfx.FontSize(24)
gfx.Text("MISSING EFFECTOR!!!!", 744, 1378) gfx.Text("MISSING EFFECTOR!!!!", rightPanelX+463, rightPanelY+191)
gfx.Text("MISSING ILLUSTRATOR!!!!", 744, 1406) gfx.Text("MISSING ILLUSTRATOR!!!!", rightPanelX+463, rightPanelY+219)
else else
gfx.Text("HOST IS SELECTING SONG", 535, 1235) gfx.Text("HOST IS SELECTING SONG", rightPanelX+245, rightPanelY+50)
gfx.Text(" ", 535, 1275) gfx.Text(" ", rightPanelX+245, rightPanelY+88)
gfx.FontSize(24) gfx.FontSize(24)
gfx.Text(" ", 746, 1378) gfx.Text(" ", rightPanelX+463, rightPanelY+191)
gfx.Text(" ", 746, 1406) gfx.Text(" ", rightPanelX+463, rightPanelY+219)
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(22) gfx.FontSize(22)
gfx.Text("BPM ?",780, 1307) gfx.Text("BPM ?",rightPanelX+497, rightPanelY+118)
end end
end end
else else
if selected_song.min_bpm ~= selected_song.max_bpm then if selected_song.min_bpm ~= selected_song.max_bpm then
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(22); gfx.FontSize(22);
gfx.Text("BPM",777, 1307) gfx.Text("BPM",rightPanelX+497, rightPanelY+118)
gfx.FontSize(26); gfx.FontSize(26);
gfx.Text(string.format("%.0f - %.0f", gfx.Text(string.format("%.0f - %.0f",
selected_song.min_bpm, selected_song.max_bpm), selected_song.min_bpm, selected_song.max_bpm),
780 + 77, 1307) rightPanelX+497 + 77, rightPanelY+118)
else else
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(22); gfx.FontSize(22);
gfx.Text("BPM",777, 1307) gfx.Text("BPM",rightPanelX+497, rightPanelY+118)
gfx.Text(string.format("%.0f", gfx.Text(string.format("%.0f",
selected_song.min_bpm), selected_song.min_bpm),
780 + 77, 1307) rightPanelX+497 + 77, rightPanelY+118)
end end
gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_LEFT); gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_LEFT);
gfx.FontSize(32); gfx.FontSize(32);
gfx.Text(selected_song.title, 535, 1236) gfx.Text(selected_song.title, rightPanelX+245, rightPanelY+50)
gfx.Text(selected_song.artist, 535, 1275) gfx.Text(selected_song.artist, rightPanelX+245, rightPanelY+88)
gfx.FontSize(24) gfx.FontSize(24)
gfx.Text(selected_song.effector, 746, 1377) gfx.Text(selected_song.effector, rightPanelX+463, rightPanelY+191)
gfx.Text(selected_song.illustrator, 746, 1406) gfx.Text(selected_song.illustrator, rightPanelX+463, rightPanelY+219)
draw_diffs(selected_song.all_difficulties, 395, 205, 300, 100, selected_song.diff_index+1)
end end
end end
m_bpm_part = function () -- bpm and lane speed m_bpm_part = function () -- bpm and lane speed
local jw , jh = gfx.ImageSize(m_bpm_panel); local jw , jh = gfx.ImageSize(m_bpm_panel);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(0, 1692, jw/1.18, jh/1.18, m_bpm_panel,1,0); gfx.ImageRect(bpmPanelX, bpmPanelY, jw/1.18, jh/1.18, m_bpm_panel,1,0);
gfx.FontSize(32) gfx.FontSize(32)
if selected_song == nil then if selected_song == nil then
if host == user_id then if host == user_id then
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(32) gfx.FontSize(32)
gfx.Text("BPM ?",76, 1788) gfx.Text("BPM ?",bpmPanelX+76, bpmPanelY + 96)
gfx.Text("LANE-SPEED ?",76, 1832) gfx.Text("LANE-SPEED ?",bpmPanelX+76, bpmPanelY + 140)
else else
if missing_song then if missing_song then
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(32) gfx.FontSize(32)
gfx.Text("BPM ?",76, 1788) gfx.Text("BPM ?",bpmPanelX+76, bpmPanelY + 96)
gfx.Text("LANE-SPEED ?",76, 1832) gfx.Text("LANE-SPEED ?",bpmPanelX+76, bpmPanelY + 140)
else else
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP) gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_TOP)
gfx.FontSize(32) gfx.FontSize(32)
gfx.Text("BPM ?",76, 1788) gfx.Text("BPM ?",bpmPanelX+76, bpmPanelY + 96)
gfx.Text("LANE-SPEED ?",76, 1832) gfx.Text("LANE-SPEED ?",bpmPanelX+76, bpmPanelY + 140)
end end
end end
end end
@ -296,27 +343,27 @@ m_bpm_part = function () -- bpm and lane speed
if selected_song.min_bpm ~= selected_song.max_bpm then if selected_song.min_bpm ~= selected_song.max_bpm then
gfx.Text("BPM",76, 1788) gfx.Text("BPM",bpmPanelX+76, bpmPanelY + 96)
gfx.Text(string.format("%.0f - %.0f", gfx.Text(string.format("%.0f - %.0f",
selected_song.min_bpm, selected_song.max_bpm), selected_song.min_bpm, selected_song.max_bpm),
76 + 75, 1788) bpmPanelX+ 76 + 75, bpmPanelY + 96)
gfx.Text("LANE-SPEED",76, 1832) gfx.Text("LANE-SPEED",bpmPanelX+76, bpmPanelY + 140)
gfx.Text(string.format("%.2f = %.0f", gfx.Text(string.format("%.2f = %.0f",
selected_song.hispeed, selected_song.speed_bpm * selected_song.hispeed), selected_song.hispeed, selected_song.speed_bpm * selected_song.hispeed),
76 + 175, 1832) bpmPanelX +76 + 175, bpmPanelY + 140)
else else
gfx.FontSize(32); gfx.FontSize(32);
gfx.Text("BPM",76, 1788) gfx.Text("BPM",bpmPanelX+76, bpmPanelY + 96)
gfx.Text(string.format("%.0f", gfx.Text(string.format("%.0f",
selected_song.min_bpm), selected_song.min_bpm),
76 + 75, 1788) bpmPanelX+ 76 + 75, bpmPanelY + 96)
gfx.Text("LANE-SPEED",76, 1832) gfx.Text("LANE-SPEED",bpmPanelX+76, bpmPanelY + 140)
gfx.Text(string.format("%.2f = %.0f", gfx.Text(string.format("%.2f = %.0f",
selected_song.hispeed, selected_song.speed_bpm * selected_song.hispeed), selected_song.hispeed, selected_song.speed_bpm * selected_song.hispeed),
76 + 175, 1832) bpmPanelX + 76 + 175, bpmPanelY + 140)
end end
end end
end end
@ -324,19 +371,19 @@ end
m_info_part = function () -- the info panel m_info_part = function () -- the info panel
local jw , jh = gfx.ImageSize(m_info_panel); local jw , jh = gfx.ImageSize(m_info_panel);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(475, 1590, jw/1.18, jh/1.18, m_info_panel,1,0); gfx.ImageRect(infPanelX, infPanelY, jw/1.18, jh/1.18, m_info_panel,1,0);
draw_checkbox("Excessive", 635, 1639.25, toggle_hard, hard_mode, not start_game_soon) draw_checkbox("Excessive",infPanelX+160, infPanelY+49.25, toggle_hard, hard_mode, not start_game_soon)
draw_checkbox("Mirror",676.2, 1677.5, toggle_mirror, mirror_mode, not start_game_soon) draw_checkbox("Mirror",infPanelX+201.2, infPanelY+87.5, toggle_mirror, mirror_mode, not start_game_soon)
draw_checkbox("Rotate",854.1, 1677.5, toggle_rotate, do_rotate, draw_checkbox("Rotate",infPanelX+379.1, infPanelY+87.5, toggle_rotate, do_rotate,
(owner == user_id or host == user_id) and not start_game_soon) (owner == user_id or host == user_id) and not start_game_soon)
gfx.FillColor(255,255,255,100) gfx.FillColor(255,255,255,100)
gfx.Text("Leave",892.5, 1640) gfx.Text("Leave",infPanelX+417.5, infPanelY+50)
gfx.FillColor(255,255,255) gfx.FillColor(255,255,255)
gfx.FontSize(24) gfx.FontSize(24)
-- gfx.Text("FX-L/FX-R TO READY UP",765.5,1859) -- gfx.Text("FX-L/FX-R TO READY UP",infPanelX+290.5,infPanelY+269)
gfx.Text("FX-L/FX-R TO EXCEED SEX",765.5,1859) gfx.Text("FX-L/FX-R TO EXCEED SEX",infPanelX+290.5,infPanelY+269)
end end
user_setup = function () -- (semi new) user layering user_setup = function () -- (semi new) user layering
@ -698,6 +745,11 @@ end
function render_lobby(deltaTime) function render_lobby(deltaTime)
local resx, resy = game.GetResolution()
if resx ~= resX or resy ~= resY then
resolutionChange(resx, resy)
end
local jw , jh = gfx.ImageSize(bg); local jw , jh = gfx.ImageSize(bg);
gfx.BeginPath(); gfx.BeginPath();
gfx.ImageRect(0, 0, resX, resY, bg,1,0); gfx.ImageRect(0, 0, resX, resY, bg,1,0);
@ -717,38 +769,25 @@ function render_lobby(deltaTime)
m_s_part() m_s_part()
m_bpm_part() m_bpm_part()
songjacket() songjacket()
end
drawResultScreen = function (x, y, w, h, deltaTime)
if selected_song == nil then
if jacket == 0 then
jacket = placeholderJacket
end
else
draw_diffs(selected_song.all_difficulties, split/2 + song_x_off - 150, 200, 300, 100, selected_song.diff_index+1)
if selected_song.jacket == nil or selected_song.jacket == placeholderJacket then
selected_song.jacket = gfx.LoadImageJob(selected_song.jacketPath, placeholderJacket)
jacket = selected_song.jacket
end
end
gfx.Save()
gfx.BeginPath() gfx.BeginPath()
gfx.Translate(481, 1303+jacket_size/2)
gfx.ImageRect(-jacket_size/2,-jacket_size/2,jacket_size,jacket_size,jacket,1,0)
if mouse_clipped(481-jacket_size/2,1423+-jacket_size/2,jacket_size,jacket_size) and host == user_id then gfx.Translate(x, y);
hovered = function() gfx.Scale(w / 1080, h / 1920);
missing_song = false gfx.Scissor(0, 0, 1080, 1920);
mpScreen.SelectSong() Background.draw(deltaTime)
end
end gfx.GlobalAlpha(1)
gfx.Restore()
IR_Handle();
gfx.ResetTransform()
end end
function render_room_list(deltaTime) function render_room_list(deltaTime)
spinnybg.draw(deltaTime);
draw_rooms(175, resY - 290); draw_rooms(175, resY - 290);
-- Draw cover for rooms out of view -- Draw cover for rooms out of view
@ -855,12 +894,16 @@ function render_set_username(deltaTime)
end end
render = function(deltaTime) render = function(deltaTime)
resX,resY = game.GetResolution(); local resx, resy = game.GetResolution()
if resx ~= resX or resy ~= resY then
resolutionChange(resx, resy)
end
buttonWidth = resX*(3/4); buttonWidth = resX*(3/4);
mposx,mposy = game.GetMousePos(); mposx,mposy = game.GetMousePos();
portrait = resY > resX
IR_Handle()
common.stopMusic(); common.stopMusic();
doffset = doffset * 0.9 doffset = doffset * 0.9

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 182 KiB