Removed the annoying window reopening for all states unless it's actually needed

This commit is contained in:
entar 2025-09-10 09:03:35 +07:00
parent 2df39b8b44
commit e09d1281ac
6 changed files with 40 additions and 15 deletions

View File

@ -6,27 +6,37 @@ local started = false
function module.onCreate()
if gameMode == "storymode" then
print("evil")
-- print("evil")
video:play()
sharedVars.canStart = false
sharedVars.shouldCountdown = false
sharedVars.cutscene = true
end
end
function module.onUpdate()
if not video:isPlaying() and not started then
print("evil")
-- print("evil")
sharedVars.canStart = true
sharedVars.shouldCountdown = true
started = true
sharedVars.cutscene = false
end
end
function module.drawAboveCanvas()
if not started then
print("evil")
-- print("evil")
love.graphics.draw(video, 0, 0, 0, 1280 / video:getWidth(), 720 / video:getHeight())
end
end
function module.onClose()
if video then
video:pause()
video:release()
video = nil
end
end
return module

View File

@ -34,9 +34,6 @@ function module.onCreate()
-- rain.layer = 0
-- rain:PlayAnimation("Rain", 15, true)
-- no.
end
return module

View File

@ -48,7 +48,7 @@ return function()
local curSong = songs[1]
local evilCurIndex = 1
local evilCurIndex = -500
local curDiffList = songs[1].difficulties
local curDiff = songs[1].difficulties[1]
@ -416,7 +416,10 @@ return function()
function state.load()
setup()
love.window.setMode(1280, 720, { fullscreen = false, resizable = false, centered = true, borderless = false })
if love.graphics.getWidth() ~= 1280 then
love.window.setMode(1280, 720, { fullscreen = false, resizable = false, centered = true, borderless = false })
end
end
function state.wheelmoved(x, y)

View File

@ -61,7 +61,7 @@ return function()
credits = "creditsstate",
login = "loginstate"
}
local evilCurrentOption = 1
local evilCurrentOption = -10
local optionSprites = {}
local moving = false

View File

@ -512,10 +512,15 @@ local function state(songName, songDifficulty, show)
end
render.updateSprites(dt)
end
if sharedVars.cutscene then
render.updateSprites(dt)
end
return
end
render.updateSprites(dt)
-- playing isn't supposed to work like "paused", it's there to keep the game from working during loading
if counting and sharedVars.shouldCountdown then
@ -545,10 +550,16 @@ local function state(songName, songDifficulty, show)
end
elseif not sharedVars.shouldCountdown then
counting = false
if sharedVars.cutscene then
render.updateSprites(dt)
end
end
if paused then goto continue end -- if paused then skip this cycle
render.updateSprites(dt)
local currentTime = socket.gettime()
elapsed = (currentTime - startTime) * 1000 - pauseTime - cdLength
@ -960,19 +971,19 @@ local function state(songName, songDifficulty, show)
-- GF first so she is below other chars
if metadata.playData.characters.girlfriend then
characters.gf = Character(metadata.playData.characters.girlfriend)
characters.gf:PlayAnimation("danceLeft")
characters.gf.sprite.layer = 0
if not characters.gf.hasStagePosition then
characters.gf.stagePosition = Vector2(stage.girlfriend[1], stage.girlfriend[2])
end
characters.gf:PlayAnimation(characters.gf.animInfo.idle and "idle" or "danceLeft")
end
characters.bf = Character(metadata.playData.characters.player)
characters.bf:PlayAnimation("idle")
characters.bf.sprite.layer = 1
if not characters.bf.hasStagePosition then
characters.bf.stagePosition = Vector2(stage.boyfriend[1], stage.boyfriend[2])
end
characters.bf:PlayAnimation(characters.bf.animInfo.idle and "idle" or "danceLeft")
shader:send("pr", characters.bf.colors[1] / 255)
shader:send("pg", characters.bf.colors[2] / 255)
shader:send("pb", characters.bf.colors[3] / 255)
@ -991,12 +1002,12 @@ local function state(songName, songDifficulty, show)
if metadata.playData.characters.opponent and metadata.playData.characters.opponent ~= "none" then -- you can have no player2 but always player1
characters.dad = Character(metadata.playData.characters.opponent)
characters.dad:PlayAnimation(characters.dad.animInfo.idle and "idle" or "danceLeft")
characters.dad.sprite.layer = 1
if not characters.dad.hasStagePosition then
characters.dad.stagePosition = Vector2(stage.opponent[1], stage.opponent[2])
print(stage.opponent[1], stage.opponent[2])
end
characters.dad:PlayAnimation(characters.dad.animInfo.idle and "idle" or "danceLeft")
local image = love.graphics.newImage(string.format("images/icons/icon-%s.png", characters.dad.icon))
icons.dad = {
@ -1140,7 +1151,9 @@ local function state(songName, songDifficulty, show)
local screenSize = sharedVars.screenSize or Vector2(1280, 720)
love.window.setMode(screenSize.x, screenSize.y, { fullscreen = false, resizable = false })
if love.graphics.getWidth() ~= screenSize.x then
love.window.setMode(screenSize.x, screenSize.y, { fullscreen = false, resizable = false })
end
render.offset = Vector2(960, 540)
end

View File

@ -82,7 +82,9 @@ return function(score, accuracy, ratings, combo)
end
function state.load()
love.window.setMode(1280, 720)
if love.graphics.getWidth() ~= 1280 then
love.window.setMode(1280, 720, { fullscreen = false, resizable = false, centered = true, borderless = false })
end
local rank = "LOSS"
local animation = "LOSS animation"