Skip to content

Commit

Permalink
rebirth fix gameplay positioning inconsistency across aspect ratios
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Dec 10, 2021
1 parent 2dc4565 commit cf85b43
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ local t = Def.ActorFrame {
EndCommand = function(self)
-- exiting customize gameplay will turn off autoplay
GAMESTATE:SetAutoplay(false)
playerConfig:save()
end,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ local t = Def.ActorFrame {
-- queue so it doesnt reach the children
self:queuecommand("SetUpMovableValues")
end,
EndCommand = function(self)
-- exiting the screen saves customization changes
playerConfig:get_data().CurrentWidth = SCREEN_WIDTH
playerConfig:get_data().CurrentHeight = SCREEN_HEIGHT
playerConfig:save()
end,
SetUpMovableValuesMessageCommand = function(self)
local screen = SCREENMAN:GetTopScreen()
local usingReverse = GAMESTATE:GetPlayerState():GetCurrentPlayerOptions():UsingReverse()
Expand Down
20 changes: 20 additions & 0 deletions Themes/Rebirth/Scripts/02 CustomizeGameplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ allowedCustomization = false
local function loadValuesTable()
allowedCustomization = playerConfig:get_data().CustomizeGameplay
usingReverse = GAMESTATE:GetPlayerState():GetCurrentPlayerOptions():UsingReverse()

local ratioX = SCREEN_WIDTH / playerConfig:get_data().CurrentWidth
local ratioY = SCREEN_HEIGHT / playerConfig:get_data().CurrentHeight

MovableValues.ScreenZoom = playerConfig:get_data().GameplaySizes[keymode].ScreenZoom
MovableValues.ScreenX = playerConfig:get_data().GameplayXYCoordinates[keymode].ScreenX
MovableValues.ScreenY = playerConfig:get_data().GameplayXYCoordinates[keymode].ScreenY
Expand Down Expand Up @@ -80,6 +84,22 @@ local function loadValuesTable()
MovableValues.MeasureCounterX = playerConfig:get_data().GameplayXYCoordinates[keymode].MeasureCounterX
MovableValues.MeasureCounterY = playerConfig:get_data().GameplayXYCoordinates[keymode].MeasureCounterY
MovableValues.MeasureCounterZoom = playerConfig:get_data().GameplaySizes[keymode].MeasureCounterZoom

-- if the aspect ratio changed at all we need to reset all these numbers
if ratioX ~= 1 or ratioY ~= 1 then
for name, val in pairs(MovableValues) do
if name:find("X$") ~= nil or name:find("Y$") ~= nil or name:find("Rotation$") ~= nil then
-- coordinates
playerConfig:get_data().GameplayXYCoordinates[keymode][name] = val
elseif name:find("Zoom$") ~= nil or name:find("Height$") ~= nil or name:find("Width$") ~= nil or name:find("Spacing$") ~= nil then
-- sizes
playerConfig:get_data().GameplaySizes[keymode][name] = val
end
end
playerConfig:get_data().CurrentWidth = SCREEN_WIDTH
playerConfig:get_data().CurrentHeight = SCREEN_HEIGHT
playerConfig:save()
end
end

-- registry for elements which are able to be modified in customizegameplay
Expand Down

0 comments on commit cf85b43

Please sign in to comment.