From 776e6ec87eb5f81abf6fd319f1502b7aa77abd42 Mon Sep 17 00:00:00 2001 From: "Squishy (C6H12O6+NaCl+H2O)" <106439598+SweetSea-ButImNotSweet@users.noreply.github.com> Date: Sun, 28 Apr 2024 22:28:56 +0700 Subject: [PATCH] Apply V2.2 patch --- game/gamemode.lua | 15 ++++++----- scene.lua | 11 ++++---- scene/lines_toggle.lua | 21 ++++++++++++++++ scene/replay.lua | 57 +++++++++++++++++++++++------------------- scene/title.lua | 10 +++++--- settings.lua | 4 +-- 6 files changed, 74 insertions(+), 44 deletions(-) create mode 100644 scene/lines_toggle.lua diff --git a/game/gamemode.lua b/game/gamemode.lua index 13c5610..74ed697 100644 --- a/game/gamemode.lua +++ b/game/gamemode.lua @@ -164,7 +164,6 @@ function GameMode:readHiScores() end function GameMode:updateGradeHistory() - promo_string = "" if self.grade_score >= self.promo_table[self.grade] then if (self.grade == 28 and self.grade_history[2] < 4) or self.grade < 28 then self.grade_history[2] = self.grade_history[2] + 1 end self.point_flash = 60 @@ -201,14 +200,13 @@ function GameMode:updateGradeHistory() self.grade_history[2] = 2 end self.grade_history[4] = self.grade_history[4] + 1 - return promo_string end function GameMode:updateHiScores() self:readHiScores() - hiscore_pos = {0,0} - i = 2 - score_position = -1 + local hiscore_pos = {0,0} + local i = 2 + local score_position = -1 while i <= 10 do if score_position == -1 and self.hi_scores[i] < self.grade_score then score_position = i @@ -556,7 +554,6 @@ function GameMode:stackQualityCheck() end function GameMode:doStackQuality() - local total_speed = 0 local contiguous_holes = self:stackQualityCheck() local total_speed = 0 if contiguous_holes > self.last_holes then @@ -708,7 +705,9 @@ function GameMode:onGameOver() if not self.input_playback and not self.training and not PENTO_MODE then if not self.did_grades then self.grade_score = self.grade_score + self.speed_level - promo_string = self:updateGradeHistory() + if #self.speed_table >= 49 then + self:updateGradeHistory() + end hiscore_pos = self:updateHiScores() bitser.dumpLoveFile(SAVE_DIR..self.player_name.."_grade_history.sav", self.grade_history) self.did_grades = true @@ -728,7 +727,7 @@ function GameMode:drawEndScoringInfo() if not PENTO_MODE then drawText("Best scores:", 247, 220, 1000, "left") - i = 2 + local i = 2 while i <= 10 do if i == hiscore_pos[1] or i == hiscore_pos[2] then drawText(self.hi_scores[i-1]..' - '..self.hi_scores[i], 255, 220+(i*10), 1000, "left", {0,1,0,1}) diff --git a/scene.lua b/scene.lua index 813e5e2..88cd773 100644 --- a/scene.lua +++ b/scene.lua @@ -7,17 +7,15 @@ function SCENE:update() end function SCENE:render() end -- e in 3 below functions will contain: --- key - input, key, scancode +-- key - input, key, scancode -- joystick - input, button, name --- touch - x, y, dx, dy, id --- virtual - key +-- virtual - input +-- touch - x, y, dx, dy, id function SCENE:onInputPress(e) end function SCENE:onInputMove(e) end function SCENE:onInputRelease(e) end -ExitScene = require "scene.exit" - GameScene = require "scene.game" NameEntryScene = require "scene.name_entry" @@ -31,4 +29,7 @@ TrainingScene = require "scene.training" FullscreenScene = require "scene.fullscreen" MusicToggleScene = require "scene.music_toggle" +LinesToggleScene = require "scene.lines_toggle" + +ExitScene = require "scene.exit" TitleScene = require "scene.title" \ No newline at end of file diff --git a/scene/lines_toggle.lua b/scene/lines_toggle.lua new file mode 100644 index 0000000..06aa01b --- /dev/null +++ b/scene/lines_toggle.lua @@ -0,0 +1,21 @@ +local LinesToggleScene = SCENE:extend() +LinesToggleScene.title = "Show lines during game:" + +function LinesToggleScene:new() +end + +function LinesToggleScene:update() + SETTINGS["lines"] = not SETTINGS["lines"] + SCENE = TitleScene() +end + +function LinesToggleScene:render() +end + +function LinesToggleScene:changeOption(rel) +end + +function LinesToggleScene:onInputPress(e) +end + +return LinesToggleScene \ No newline at end of file diff --git a/scene/replay.lua b/scene/replay.lua index 0da476a..9e91f74 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -1,8 +1,6 @@ local ReplaySelectScene = SCENE:extend() ReplaySelectScene.title = "Replay" -require 'funcs' - function ReplaySelectScene:new() self:initList() PENTO_MODE = false @@ -38,6 +36,9 @@ function ReplaySelectScene:initList() self.dialog = false self.dialog_select = 1 self.replay_select = 1 + self.direction = nil + self.repeat_limit = 10 + self.repeat_counter = self.repeat_limit-1 end function ReplaySelectScene:render() @@ -74,6 +75,22 @@ function ReplaySelectScene:render() end end +function ReplaySelectScene:update() + if self.direction == "up" then + if self.repeat_counter >= self.repeat_limit then + self:changeOption(-1) + self.repeat_counter = 0 + end + self.repeat_counter = self.repeat_counter + 1 + elseif self.direction == "down" then + if self.repeat_counter >= self.repeat_limit then + self:changeOption(1) + self.repeat_counter = 0 + end + self.repeat_counter = self.repeat_counter + 1 + end +end + function ReplaySelectScene:changeOption(rel) local len = #self.replays self.replay_select = self.replay_select + rel @@ -106,21 +123,6 @@ function ReplaySelectScene:onInputPress(e) if e.input == "menu_decide" or e.input == "rotate_left" or e.scancode == "return" then if self.replays[1] == nil then SCENE = TitleScene() - --if not self.dialog then - -- self.dialog_select = 1 - -- self.dialog = true - --elseif self.dialog_select == 2 then - -- love.filesystem.remove(selected_replay) - -- self:initList() - --elseif self.dialog_select == 1 then - -- line_components = {} - -- for str in string.gmatch(selected_replay_text, "([^".."-".."]+)") do - -- table.insert(line_components, str) - -- end - -- player_name = line_components[1] - -- player_grade = string.gsub(line_components[2], " ", "") - -- scene = GameScene(player_name, selected_replay, player_grade) - --end else line_components = {} for str in string.gmatch(selected_replay_text, "([^".."-".."]+)") do @@ -131,17 +133,20 @@ function ReplaySelectScene:onInputPress(e) SCENE = GameScene(player_name, selected_replay, player_grade) end elseif e.input == "up" or e.scancode == "up" then - if self.replays[1] == nil then SCENE = TitleScene() end - if not self.dialog then self:changeOption(-1) - else self:changeDialog(-1) end + if self.replays[1] == nil then scene = TitleScene() end + self.direction = 'up' elseif e.input == "down" or e.scancode == "down" then - if self.replays[1] == nil then SCENE = TitleScene() end - if not self.dialog then self:changeOption(1) - else self:changeDialog(1) end + if self.replays[1] == nil then scene = TitleScene() end + self.direction = 'down' elseif e.input == "menu_back" or e.input == "rotate_right" or e.scancode == "backspace" or e.scancode == "delete" then - if self.replays[1] == nil then SCENE = TitleScene() end - if not self.dialog then SCENE = TitleScene() - else self.dialog = false end + scene = TitleScene() + end +end + +function ReplaySelectScene:onInputRelease(e) + if e.input == "up" or e.scancode == "up" or e.input == "down" or e.scancode == "down" then + self.direction = nil + self.repeat_counter = self.repeat_limit-1 end end diff --git a/scene/title.lua b/scene/title.lua index 7c95776..bae6ec0 100644 --- a/scene/title.lua +++ b/scene/title.lua @@ -1,6 +1,4 @@ local TitleScene = SCENE:extend() -require 'settings' -require 'funcs' TitleScene.title = "Title" TitleScene.restart_message = false @@ -12,6 +10,7 @@ local main_menu_screens = { InputConfigScene, FullscreenScene, MusicToggleScene, + LinesToggleScene, ExitScene, } @@ -56,7 +55,7 @@ end function TitleScene:render() MainBackground() love.graphics.setColor(0,0,0,0.7) - love.graphics.rectangle("fill", 14, 174, 260, 200, 10, 10) + love.graphics.rectangle("fill", 14, 174, 260, 220, 10, 10) love.graphics.setColor(0,0,0,0.7) love.graphics.rectangle("fill", 14, 400, 605, 75, 10, 10) love.graphics.setColor(0.4, 1, 1, 0.5) @@ -73,6 +72,11 @@ function TitleScene:render() else drawText("Off", 230, 320, 1000) end + if SETTINGS["lines"] == true then + drawText("On", 230, 340, 1000) + else + drawText("Off", 230, 340, 1000) + end for i, screen in pairs(main_menu_screens) do drawText(screen.title, 40, 200 + 20 * i, 1200, "left") end diff --git a/settings.lua b/settings.lua index b44760c..e39fe0a 100644 --- a/settings.lua +++ b/settings.lua @@ -7,6 +7,7 @@ local _defaultSettings = { fullscreen = false, music = true, + lines = true, ---@class input ---@field keys table @@ -22,8 +23,7 @@ SETTINGS = setmetatable( {}, { __index = function(_, k) - if _settings[k] == nil then _settings[k] = _defaultSettings[k] end - return _settings[k] + return _settings[k] == nil and _defaultSettings[k] or _settings[k] end, __newindex = function(_, k, v) _settings[k] = v