mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-24 08:59:03 -06:00
Compare commits
No commits in common. "3e68af6a5b42390356d97968825104c8a150a414" and "a4b7a41a1556685bf7bd7f8764fcffedd40f0a24" have entirely different histories.
3e68af6a5b
...
a4b7a41a15
@ -25,8 +25,6 @@ function GameScene:new(game_mode, ruleset, inputs)
|
|||||||
hold=false,
|
hold=false,
|
||||||
}
|
}
|
||||||
self.paused = false
|
self.paused = false
|
||||||
self.game.pause_count = 0
|
|
||||||
self.game.pause_time = 0
|
|
||||||
DiscordRPC:update({
|
DiscordRPC:update({
|
||||||
details = self.game.rpc_details,
|
details = self.game.rpc_details,
|
||||||
state = self.game.name,
|
state = self.game.name,
|
||||||
@ -35,9 +33,7 @@ function GameScene:new(game_mode, ruleset, inputs)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function GameScene:update()
|
function GameScene:update()
|
||||||
if self.paused then
|
if love.window.hasFocus() and not self.paused then
|
||||||
self.game.pause_time = self.game.pause_time + 1
|
|
||||||
else
|
|
||||||
local inputs = {}
|
local inputs = {}
|
||||||
for input, value in pairs(self.inputs) do
|
for input, value in pairs(self.inputs) do
|
||||||
inputs[input] = value
|
inputs[input] = value
|
||||||
@ -54,16 +50,6 @@ end
|
|||||||
|
|
||||||
function GameScene:render()
|
function GameScene:render()
|
||||||
self.game:draw(self.paused)
|
self.game:draw(self.paused)
|
||||||
if self.game.pause_time > 0 or self.game.pause_count > 0 then
|
|
||||||
love.graphics.setColor(1, 1, 1, 1)
|
|
||||||
love.graphics.setFont(font_3x5_2)
|
|
||||||
love.graphics.printf(string.format(
|
|
||||||
"%d PAUSE%s (%s)",
|
|
||||||
self.game.pause_count,
|
|
||||||
self.game.pause_count == 1 and "" or "S",
|
|
||||||
formatTime(self.game.pause_time)
|
|
||||||
), 0, 0, 635, "right")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function GameScene:onInputPress(e)
|
function GameScene:onInputPress(e)
|
||||||
@ -85,12 +71,8 @@ function GameScene:onInputPress(e)
|
|||||||
scene = GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs)
|
scene = GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs)
|
||||||
elseif e.input == "pause" and not (self.game.game_over or self.game.completed) then
|
elseif e.input == "pause" and not (self.game.game_over or self.game.completed) then
|
||||||
self.paused = not self.paused
|
self.paused = not self.paused
|
||||||
if self.paused then
|
if self.paused then pauseBGM()
|
||||||
pauseBGM()
|
else resumeBGM() end
|
||||||
self.game.pause_count = self.game.pause_count + 1
|
|
||||||
else
|
|
||||||
resumeBGM()
|
|
||||||
end
|
|
||||||
elseif e.input == "menu_back" then
|
elseif e.input == "menu_back" then
|
||||||
self.game:onExit()
|
self.game:onExit()
|
||||||
scene = ModeSelectScene()
|
scene = ModeSelectScene()
|
||||||
|
@ -29,8 +29,6 @@ function ReplayScene:new(replay, game_mode, ruleset)
|
|||||||
hold=false,
|
hold=false,
|
||||||
}
|
}
|
||||||
self.paused = false
|
self.paused = false
|
||||||
self.game.pause_count = replay["pause_count"]
|
|
||||||
self.game.pause_time = replay["pause_time"]
|
|
||||||
self.replay = deepcopy(replay)
|
self.replay = deepcopy(replay)
|
||||||
self.replay_index = 1
|
self.replay_index = 1
|
||||||
DiscordRPC:update({
|
DiscordRPC:update({
|
||||||
@ -41,7 +39,7 @@ function ReplayScene:new(replay, game_mode, ruleset)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ReplayScene:update()
|
function ReplayScene:update()
|
||||||
if not self.paused then
|
if love.window.hasFocus() and not self.paused then
|
||||||
self.inputs = self.replay["inputs"][self.replay_index]["inputs"]
|
self.inputs = self.replay["inputs"][self.replay_index]["inputs"]
|
||||||
self.replay["inputs"][self.replay_index]["frames"] = self.replay["inputs"][self.replay_index]["frames"] - 1
|
self.replay["inputs"][self.replay_index]["frames"] = self.replay["inputs"][self.replay_index]["frames"] - 1
|
||||||
if self.replay["inputs"][self.replay_index]["frames"] == 0 and self.replay_index < table.getn(self.replay["inputs"]) then
|
if self.replay["inputs"][self.replay_index]["frames"] == 0 and self.replay_index < table.getn(self.replay["inputs"]) then
|
||||||
@ -66,19 +64,6 @@ function ReplayScene:render()
|
|||||||
love.graphics.setColor(1, 1, 1, 1)
|
love.graphics.setColor(1, 1, 1, 1)
|
||||||
love.graphics.setFont(font_3x5_3)
|
love.graphics.setFont(font_3x5_3)
|
||||||
love.graphics.printf("REPLAY", 0, 0, 635, "right")
|
love.graphics.printf("REPLAY", 0, 0, 635, "right")
|
||||||
love.graphics.setFont(font_3x5_2)
|
|
||||||
if self.game.pause_time and self.game.pause_count then
|
|
||||||
if self.game.pause_time > 0 or self.game.pause_count > 0 then
|
|
||||||
love.graphics.printf(string.format(
|
|
||||||
"%d PAUSE%s (%s)",
|
|
||||||
self.game.pause_count,
|
|
||||||
self.game.pause_count == 1 and "" or "S",
|
|
||||||
formatTime(self.game.pause_time)
|
|
||||||
), 0, 23, 635, "right")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
love.graphics.printf("?? PAUSES (--:--.--)", 0, 23, 635, "right")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ReplayScene:onInputPress(e)
|
function ReplayScene:onInputPress(e)
|
||||||
|
@ -136,8 +136,6 @@ function GameMode:saveReplay()
|
|||||||
replay["gamesettings"] = config.gamesettings
|
replay["gamesettings"] = config.gamesettings
|
||||||
replay["secret_inputs"] = self.secret_inputs
|
replay["secret_inputs"] = self.secret_inputs
|
||||||
replay["timestamp"] = os.time()
|
replay["timestamp"] = os.time()
|
||||||
replay["pause_count"] = self.pause_count
|
|
||||||
replay["pause_time"] = self.pause_time
|
|
||||||
if love.filesystem.getInfo("replays") == nil then
|
if love.filesystem.getInfo("replays") == nil then
|
||||||
love.filesystem.createDirectory("replays")
|
love.filesystem.createDirectory("replays")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user