2019-10-22 20:48:43 +00:00
|
|
|
-- Copyright (c) 2019 David Vogel
|
|
|
|
--
|
|
|
|
-- This software is released under the MIT License.
|
|
|
|
-- https://opensource.org/licenses/MIT
|
|
|
|
|
2019-10-25 15:29:52 +00:00
|
|
|
UiHide = false
|
|
|
|
local UiReduce = false
|
|
|
|
|
2019-10-22 20:48:43 +00:00
|
|
|
async_loop(
|
|
|
|
function()
|
|
|
|
if modGUI ~= nil then
|
|
|
|
GuiStartFrame(modGUI)
|
|
|
|
|
2019-10-25 15:29:52 +00:00
|
|
|
GuiLayoutBeginVertical(modGUI, 50, 50)
|
|
|
|
if not UiReduce then
|
2019-11-01 01:40:21 +00:00
|
|
|
local problem
|
|
|
|
local rect = GetRect()
|
|
|
|
|
|
|
|
if not rect then
|
|
|
|
GuiTextCentered(modGUI, 0, 0, '!!! WARNING !!! You are not using "Windowed" mode.')
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "To fix the problem, do one of these:")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, '- Change the window mode in the game options to "Windowed"')
|
|
|
|
GuiTextCentered(modGUI, 0, 0, " ")
|
|
|
|
problem = true
|
|
|
|
end
|
|
|
|
|
|
|
|
if rect then
|
|
|
|
local screenWidth, screenHeight = rect.right - rect.left, rect.bottom - rect.top
|
|
|
|
local virtualWidth, virtualHeight =
|
|
|
|
tonumber(MagicNumbersGetValue("VIRTUAL_RESOLUTION_X")),
|
|
|
|
tonumber(MagicNumbersGetValue("VIRTUAL_RESOLUTION_Y"))
|
|
|
|
local ratioX, ratioY = screenWidth / virtualWidth, screenHeight / virtualHeight
|
|
|
|
--GuiTextCentered(modGUI, 0, 0, string.format("SCREEN_RESOLUTION_*: %d, %d", screenWidth, screenHeight))
|
|
|
|
--GuiTextCentered(modGUI, 0, 0, string.format("VIRTUAL_RESOLUTION_*: %d, %d", virtualWidth, virtualHeight))
|
|
|
|
if math.abs(ratioX - CAPTURE_PIXEL_SIZE) > 0.0001 or math.abs(ratioY - CAPTURE_PIXEL_SIZE) > 0.0001 then
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "!!! WARNING !!! Screen and virtual resolution differ.")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "To fix the problem, do one of these:")
|
|
|
|
GuiTextCentered(
|
|
|
|
modGUI,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
string.format(
|
|
|
|
"- Change the resolution in the game options to %dx%d",
|
|
|
|
virtualWidth * CAPTURE_PIXEL_SIZE,
|
|
|
|
virtualHeight * CAPTURE_PIXEL_SIZE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
GuiTextCentered(
|
|
|
|
modGUI,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
string.format(
|
|
|
|
"- Change the virtual resolution in the mod to %dx%d",
|
|
|
|
screenWidth / CAPTURE_PIXEL_SIZE,
|
|
|
|
screenHeight / CAPTURE_PIXEL_SIZE
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if math.abs(ratioX - ratioY) < 0.0001 then
|
|
|
|
GuiTextCentered(modGUI, 0, 0, string.format("- Change the CAPTURE_PIXEL_SIZE in the mod to %f", ratioX))
|
|
|
|
end
|
|
|
|
GuiTextCentered(modGUI, 0, 0, " ")
|
|
|
|
problem = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if not fileExists("mods/noita-mapcap/bin/capture-b/capture.dll") then
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "!!! WARNING !!! Can't find library for screenshots.")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "To fix the problem, do one of these:")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "- Redownload a release of this mod from GitHub, don't download the sourcecode")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, " ")
|
|
|
|
problem = true
|
|
|
|
end
|
|
|
|
|
|
|
|
if not fileExists("mods/noita-mapcap/bin/stitch/stitch.exe") then
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "!!! WARNING !!! Can't find software for stitching.")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "You can still take screenshots, but you won't be able to stitch those screenshots.")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "To fix the problem, do one of these:")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "- Redownload a release of this mod from GitHub, don't download the sourcecode")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, " ")
|
|
|
|
problem = true
|
|
|
|
end
|
|
|
|
|
|
|
|
if not problem then
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "No problems found.")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, " ")
|
|
|
|
end
|
|
|
|
|
2019-10-25 15:29:52 +00:00
|
|
|
GuiTextCentered(modGUI, 0, 0, "You can freely look around and search a place to start capturing.")
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "The mod will then take images in a spiral around your current view.")
|
2019-11-01 01:40:21 +00:00
|
|
|
GuiTextCentered(modGUI, 0, 0, "Use ESC to pause, and close the game to stop the process.")
|
2019-10-25 15:29:52 +00:00
|
|
|
GuiTextCentered(
|
|
|
|
modGUI,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
'You can resume capturing just by restarting noita and pressing "Start capturing map" again,'
|
|
|
|
)
|
|
|
|
GuiTextCentered(modGUI, 0, 0, "the mod will skip already captured files.")
|
|
|
|
GuiTextCentered(
|
|
|
|
modGUI,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
'If you want to start a new map, you have to delete all images from the "output" folder!'
|
|
|
|
)
|
2019-11-01 01:40:21 +00:00
|
|
|
GuiTextCentered(modGUI, 0, 0, " ")
|
2019-10-25 15:29:52 +00:00
|
|
|
if GuiButton(modGUI, 0, 0, ">> Start capturing map <<", 1) then
|
|
|
|
startCapturing()
|
|
|
|
UiReduce = true
|
|
|
|
end
|
2019-11-01 01:40:21 +00:00
|
|
|
GuiTextCentered(modGUI, 0, 0, " ")
|
2019-10-25 15:29:52 +00:00
|
|
|
end
|
|
|
|
if not UiHide then
|
|
|
|
local x, y = GameGetCameraPos()
|
|
|
|
GuiTextCentered(modGUI, 0, 0, string.format("Coordinates: %d, %d", x, y))
|
2019-10-22 20:48:43 +00:00
|
|
|
end
|
|
|
|
GuiLayoutEnd(modGUI)
|
|
|
|
end
|
|
|
|
|
|
|
|
wait(0)
|
|
|
|
end
|
|
|
|
)
|