Separate styles for players. Notefields positioned between margins. Edit mode works for kickbox.
This commit is contained in:
@@ -27,6 +27,55 @@ function GetExtraColorThreshold()
|
||||
return Modes[CurGameName()] or 10
|
||||
end
|
||||
|
||||
-- GameplayMargins exists to provide a layer of backwards compatibility for
|
||||
-- people using the X position metrics to set where the notefields are.
|
||||
-- This makes it somewhat complex.
|
||||
-- Rather than trying to understand how it works, you can simply do this:
|
||||
-- (example values in parentheses)
|
||||
-- 1. Decide how much space you want in the center between notefields. (80)
|
||||
-- 2. Decide how much space you want on each side. (40)
|
||||
-- 3. Write a simple function that just returns those numbers:
|
||||
-- function GameplayMargins() return 40, 80, 40 end
|
||||
-- Then the engine does the work of figuring out where each notefield should
|
||||
-- be centered.
|
||||
function GameplayMargins(enabled_players, styletype)
|
||||
local other= {[PLAYER_1]= PLAYER_2, [PLAYER_2]= PLAYER_1}
|
||||
local margins= {[PLAYER_1]= {40, 40}, [PLAYER_2]= {40, 40}}
|
||||
-- Use a fake style width because calculating the real style width throws off
|
||||
-- the code in the engine.
|
||||
local fake_style_width= 272
|
||||
-- Handle the case of a single player that is centered first because it's
|
||||
-- simpler.
|
||||
if Center1Player() then
|
||||
local pn= enabled_players[1]
|
||||
fake_style_width= 544
|
||||
local center= _screen.cx
|
||||
local left= center - (fake_style_width / 2)
|
||||
local right= _screen.w - center - (fake_style_width / 2)
|
||||
-- center margin width will be ignored.
|
||||
return left, 80, right
|
||||
end
|
||||
local half_screen= _screen.w / 2
|
||||
local left= {[PLAYER_1]= 0, [PLAYER_2]= half_screen}
|
||||
for i, pn in ipairs(enabled_players) do
|
||||
local edge= left[pn]
|
||||
local center= THEME:GetMetric("ScreenGameplay",
|
||||
"Player"..ToEnumShortString(pn)..ToEnumShortString(styletype).."X")
|
||||
-- Adjust for the p2 center being on the right side.
|
||||
center= center - edge
|
||||
margins[pn][1]= center - (fake_style_width / 2)
|
||||
margins[pn][2]= half_screen - center - (fake_style_width / 2)
|
||||
if #enabled_players == 1 then
|
||||
margins[other[pn]][1]= margins[pn][2]
|
||||
margins[other[pn]][2]= margins[pn][1]
|
||||
end
|
||||
end
|
||||
local left= margins[PLAYER_1][1]
|
||||
local center= margins[PLAYER_1][2] + margins[PLAYER_2][1]
|
||||
local right= margins[PLAYER_2][2]
|
||||
return left, center, right
|
||||
end
|
||||
|
||||
-- AllowOptionsMenu()
|
||||
-- [en] returns if you are able to select options
|
||||
-- on ScreenSelectMusic.
|
||||
|
||||
Reference in New Issue
Block a user