From 703ce66c42ec50c338919245c3666ff62c4d2440 Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Wed, 9 Feb 2022 23:48:09 -0500 Subject: [PATCH 01/53] fix 2s rule for cools --- tetris/modes/marathon_2020.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/tetris/modes/marathon_2020.lua b/tetris/modes/marathon_2020.lua index 7994ecf..0bfab3b 100644 --- a/tetris/modes/marathon_2020.lua +++ b/tetris/modes/marathon_2020.lua @@ -352,18 +352,9 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level) table.insert(self.section_times, section_time) self.section_start_time = self.frames - if ( - self.section_status[section - 1] == "cool" and - self.secondary_section_times[section] <= self.secondary_section_times[section - 1] + 120 and - self.secondary_section_times[section] < cool_cutoffs[self.delay_level] - ) then + if self.secondary_section_times[section] < cool_cutoffs[self.delay_level] and + (section == 1 or self.secondary_section_times[section] <= self.secondary_section_times[section - 1] + 120) then sectionCool(section) - elseif self.section_status[section - 1] == "cool" then - table.insert(self.section_status, "none") - elseif self.secondary_section_times[section] < cool_cutoffs[self.delay_level] then - sectionCool(section) - else - table.insert(self.section_status, "none") end if section > 5 then From 8730261a782158ab676960f3f946b348d6bfc1ce Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Thu, 10 Feb 2022 00:40:25 -0500 Subject: [PATCH 02/53] fixes a3 regret grading getting a cool and a regret in the same split displays as yellow --- tetris/modes/marathon_a3.lua | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/tetris/modes/marathon_a3.lua b/tetris/modes/marathon_a3.lua index 2c2890c..e40d373 100644 --- a/tetris/modes/marathon_a3.lua +++ b/tetris/modes/marathon_a3.lua @@ -26,7 +26,9 @@ function MarathonA3Game:new() self.roll_points = 0 self.grade_point_decay_counter = 0 self.section_cool_grade = 0 - self.section_status = { [0] = "none" } + --self.section_status = { [0] = "none" } + self.section_cools = { [0] = 0 } + self.section_regrets = { [0] = 0 } self.section_start_time = 0 self.secondary_section_times = { [0] = 0 } self.section_times = { [0] = 0 } @@ -201,15 +203,23 @@ function MarathonA3Game:updateSectionTimes(old_level, new_level) self.speed_level = self.section_cool and self.speed_level + 100 or self.speed_level if section_time > regret_cutoffs[section] then - self.section_cool_grade = self.section_cool_grade - 1 - table.insert(self.section_status, "regret") + if self.grade > 0 then + --this happens after the points are added, intentionally + local currentgrade = self:getAggregateGrade() + while self:getAggregateGrade() >= currentgrade do + self.grade = self.grade - 1 + end + self.grade_points = 0 + end + table.insert(self.section_regrets, 1) self.coolregret_message = "REGRET!!" self.coolregret_timer = 300 - elseif self.section_cool then - self.section_cool_grade = self.section_cool_grade + 1 - table.insert(self.section_status, "cool") else - table.insert(self.section_status, "none") + table.insert(self.section_regrets, 0) + end + + if self.section_cool then + self.section_cool_grade = self.section_cool_grade + 1 end self.section_cool = false @@ -223,6 +233,9 @@ function MarathonA3Game:updateSectionTimes(old_level, new_level) self.section_cool = true self.coolregret_message = "COOL!!" self.coolregret_timer = 300 + table.insert(self.section_cools, 1) + else + table.insert(self.section_cools, 0) end end end @@ -402,9 +415,11 @@ MarathonA3Game.mRollOpacityFunction = function(age) end function MarathonA3Game:sectionColourFunction(section) - if self.section_status[section] == "cool" then + if self.section_cools[section] == 1 and self.section_regrets[section] == 1 then + return { 1, 1, 0, 1 } + elseif self.section_cools[section] == 1 then return { 0, 1, 0, 1 } - elseif self.section_status[section] == "regret" then + elseif self.section_regrets[section] == 1 then return { 1, 0, 0, 1 } else return { 1, 1, 1, 1 } From 47863175a348e328fa6502ab7d74667326bfc89a Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Thu, 10 Feb 2022 01:09:21 -0500 Subject: [PATCH 03/53] added cool+regret colors to splits --- tetris/modes/phantom_mania2.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tetris/modes/phantom_mania2.lua b/tetris/modes/phantom_mania2.lua index 12ca98b..e78161d 100644 --- a/tetris/modes/phantom_mania2.lua +++ b/tetris/modes/phantom_mania2.lua @@ -41,6 +41,7 @@ function PhantomMania2Game:new() self.coolregret_message = "" self.coolregret_timer = 0 + self.coolregrets = { [0] = 0 } end function PhantomMania2Game:getARE() @@ -219,11 +220,14 @@ function PhantomMania2Game:updateSectionTimes(old_level, new_level) self.section_start_time = self.frames if section_time <= cool_cutoffs[section] then self.grade = self.grade + 2 + table.insert(self.coolregrets, 2) self.coolregret_message = "COOL!!" self.coolregret_timer = 300 elseif section_time <= regret_cutoffs[section] then self.grade = self.grade + 1 + table.insert(self.coolregrets, 1) else + table.insert(self.coolregrets, 0) self.coolregret_message = "REGRET!!" self.coolregret_timer = 300 end @@ -292,6 +296,16 @@ function PhantomMania2Game:setHoldOpacity() end end +function PhantomMania2Game:sectionColourFunction(section) + if self.coolregrets[section] == 2 then + return { 0, 1, 0, 1 } + elseif self.coolregrets[section] == 0 then + return { 1, 0, 0, 1 } + else + return { 1, 1, 1, 1 } + end +end + function PhantomMania2Game:drawScoringInfo() PhantomMania2Game.super.drawScoringInfo(self) From d868e8b80384ac1729ad2fe99f4a1d22cf9f2d1b Mon Sep 17 00:00:00 2001 From: Tetro48 <76738929+Tetro48@users.noreply.github.com> Date: Wed, 9 Mar 2022 10:05:06 +0700 Subject: [PATCH 04/53] Replay tunings fix --- scene/replay.lua | 3 +++ tetris/modes/gamemode.lua | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scene/replay.lua b/scene/replay.lua index f1ca2c0..bc8a71a 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -6,6 +6,9 @@ ReplayScene.title = "Replay" function ReplayScene:new(replay, game_mode, ruleset) config.gamesettings = replay["gamesettings"] + if replay["delayed_auto_shift"] then config.das = replay["delayed_auto_shift"] end + if replay["auto_repeat_rate"] then config.arr = replay["auto_repeat_rate"] end + if replay["das_cut_delay"] then config.dcd = replay["das_cut_delay"] end love.math.setRandomSeed(replay["random_low"], replay["random_high"]) love.math.setRandomState(replay["random_state"]) self.retry_replay = replay diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 2734806..f0b7d5d 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -135,6 +135,9 @@ function GameMode:saveReplay() replay["lines"] = self.lines replay["gamesettings"] = config.gamesettings replay["secret_inputs"] = self.secret_inputs + replay["delayed_auto_shift"] = config.das + replay["auto_repeat_rate"] = config.arr + replay["das_cut_delay"] = config.dcd replay["timestamp"] = os.time() if love.filesystem.getInfo("replays") == nil then love.filesystem.createDirectory("replays") From d7c83b0bc7755cb6f14f4e7220cadccbdcae91ab Mon Sep 17 00:00:00 2001 From: Tetro48 Date: Mon, 16 May 2022 19:53:31 +0700 Subject: [PATCH 05/53] =?UTF-8?q?New=20replay=20file=20naming=20and=20*fas?= =?UTF-8?q?t=20replay=20saving.=20*fast=20because=20lower=20CPU=20and=20IO?= =?UTF-8?q?=20use.=20No=20longer=20O(n=C2=B2).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tetris/modes/gamemode.lua | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 2734806..51c7f43 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -139,21 +139,18 @@ function GameMode:saveReplay() if love.filesystem.getInfo("replays") == nil then love.filesystem.createDirectory("replays") end - local replay_files = love.filesystem.getDirectoryItems("replays") - -- Select replay filename that doesn't collide with an existing one + local init_name = string.format("replays/%s.crp", os.date("%Y-%m-%d_%H-%M-%S")) + local replay_name = init_name local replay_number = 0 - local collision = true - while collision do - collision = false - replay_number = replay_number + 1 - for key, file in pairs(replay_files) do - if file == replay_number..".crp" then - collision = true - break - end + while true do + if love.filesystem.getInfo(replay_name, "file") then + replay_number = replay_number + 1 + replay_name = string.format("%s (%d)", init_name, replay_number) + else + break end end - love.filesystem.write("replays/"..replay_number..".crp", binser.serialize(replay)) + love.filesystem.write(replay_name, binser.serialize(replay)) end function GameMode:addReplayInput(inputs) From 63823ed4b1261de1c3655bdcf946c9ab1a15c0c1 Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Tue, 14 Jun 2022 00:28:27 -0400 Subject: [PATCH 06/53] fix line clear delay --- tetris/modes/phantom_mania.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tetris/modes/phantom_mania.lua b/tetris/modes/phantom_mania.lua index 5bab937..72b8bbc 100644 --- a/tetris/modes/phantom_mania.lua +++ b/tetris/modes/phantom_mania.lua @@ -55,7 +55,7 @@ function PhantomManiaGame:getDasLimit() end function PhantomManiaGame:getLineClearDelay() - return self:getLineARE() + return self:getLineARE() - 2 end function PhantomManiaGame:getLockDelay() From decc1f563f2d41100ac13888437fc3729f698681 Mon Sep 17 00:00:00 2001 From: Joe Zeng Date: Wed, 28 Sep 2022 00:18:44 -0400 Subject: [PATCH 07/53] Changed cool/regret cutoffs. They're all the same past 500 now - I've been meaning to tweak that for quite some time now. --- tetris/modes/phantom_mania2.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tetris/modes/phantom_mania2.lua b/tetris/modes/phantom_mania2.lua index 12ca98b..523d2f5 100644 --- a/tetris/modes/phantom_mania2.lua +++ b/tetris/modes/phantom_mania2.lua @@ -202,13 +202,13 @@ end local cool_cutoffs = { frameTime(0,36), frameTime(0,36), frameTime(0,36), frameTime(0,36), frameTime(0,36), frameTime(0,30), frameTime(0,30), frameTime(0,30), frameTime(0,30), frameTime(0,30), - frameTime(0,27), frameTime(0,27), frameTime(0,27), + frameTime(0,30), frameTime(0,30), frameTime(0,30), } local regret_cutoffs = { frameTime(0,50), frameTime(0,50), frameTime(0,50), frameTime(0,50), frameTime(0,50), - frameTime(0,40), frameTime(0,40), frameTime(0,40), frameTime(0,40), frameTime(0,40), - frameTime(0,35), frameTime(0,35), frameTime(0,35), + frameTime(0,42), frameTime(0,42), frameTime(0,42), frameTime(0,42), frameTime(0,42), + frameTime(0,42), frameTime(0,42), frameTime(0,42), } function PhantomMania2Game:updateSectionTimes(old_level, new_level) From 323c4578091ada3fcb218d677f0c507eb9f639e2 Mon Sep 17 00:00:00 2001 From: Joe Zeng Date: Mon, 24 Oct 2022 20:09:08 -0400 Subject: [PATCH 08/53] Reorganized the ruleset names and added ARS-X. Also, the ruleset inheritance was a little wonky, so I changed that too. In particular, I made SRS-X always spawn in-frame since that was always supposed to be how it worked. --- tetris/rulesets/arika_exp.lua | 49 +++++++++++++++++++ tetris/rulesets/standard.lua | 10 +++- .../{arika_srs.lua => standard_ace.lua} | 2 +- tetris/rulesets/standard_exp.lua | 4 +- .../rulesets/{ti_srs.lua => standard_ti.lua} | 0 5 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 tetris/rulesets/arika_exp.lua rename tetris/rulesets/{arika_srs.lua => standard_ace.lua} (93%) mode change 100755 => 100644 rename tetris/rulesets/{ti_srs.lua => standard_ti.lua} (100%) diff --git a/tetris/rulesets/arika_exp.lua b/tetris/rulesets/arika_exp.lua new file mode 100644 index 0000000..bd5aa6c --- /dev/null +++ b/tetris/rulesets/arika_exp.lua @@ -0,0 +1,49 @@ +local Piece = require 'tetris.components.piece' +local Ruleset = require 'tetris.rulesets.arika_ace2' + +local ARS = Ruleset:extend() + +ARS.name = "ARS-X" +ARS.hash = "ArikaEXP" + +ARS.MANIPULATIONS_MAX = 24 +ARS.ROTATIONS_MAX = 12 + +function ARS:onPieceCreate(piece, grid) + piece.manipulations = 0 + piece.rotations = 0 + piece.lowest_y = -math.huge +end + +function ARS:checkNewLow(piece) + for _, block in pairs(piece:getBlockOffsets()) do + local y = piece.position.y + block.y + if y > piece.lowest_y then + piece.manipulations = 0 + piece.rotations = 0 + piece.lowest_y = y + end + end +end + +function ARS:onPieceMove(piece, grid) + piece.lock_delay = 0 -- move reset + if piece:isDropBlocked(grid) then + piece.manipulations = piece.manipulations + 1 + if piece.manipulations >= ARS.MANIPULATIONS_MAX then + piece.locked = true + end + end +end + +function ARS:onPieceRotate(piece, grid, upward) + piece.lock_delay = 0 -- rotate reset + if upward or piece:isDropBlocked(grid) then + piece.rotations = piece.rotations + 1 + if piece.rotations >= ARS.ROTATIONS_MAX and piece:isDropBlocked(grid) then + piece.locked = true + end + end +end + +return ARS \ No newline at end of file diff --git a/tetris/rulesets/standard.lua b/tetris/rulesets/standard.lua index 79226d7..0b0b5d1 100644 --- a/tetris/rulesets/standard.lua +++ b/tetris/rulesets/standard.lua @@ -1,5 +1,5 @@ local Piece = require 'tetris.components.piece' -local Ruleset = require 'tetris.rulesets.standard_exp' +local Ruleset = require 'tetris.rulesets.standard_ace' local SRS = Ruleset:extend() @@ -33,8 +33,8 @@ SRS.wallkicks_line = { }, }; -function SRS:attemptWallkicks(piece, new_piece, rot_dir, grid) +function SRS:attemptWallkicks(piece, new_piece, rot_dir, grid) local kicks if piece.shape == "O" then return @@ -69,6 +69,12 @@ function SRS:checkNewLow(piece) end end +function SRS:onPieceCreate(piece, grid) + piece.manipulations = 0 + piece.rotations = 0 + piece.lowest_y = -math.huge +end + function SRS:onPieceDrop(piece, grid) self:checkNewLow(piece) if piece.manipulations >= self.MANIPULATIONS_MAX and piece:isDropBlocked(grid) then diff --git a/tetris/rulesets/arika_srs.lua b/tetris/rulesets/standard_ace.lua old mode 100755 new mode 100644 similarity index 93% rename from tetris/rulesets/arika_srs.lua rename to tetris/rulesets/standard_ace.lua index 784c23d..15a68f6 --- a/tetris/rulesets/arika_srs.lua +++ b/tetris/rulesets/standard_ace.lua @@ -1,5 +1,5 @@ local Piece = require 'tetris.components.piece' -local Ruleset = require 'tetris.rulesets.ti_srs' +local Ruleset = require 'tetris.rulesets.standard_ti' local SRS = Ruleset:extend() diff --git a/tetris/rulesets/standard_exp.lua b/tetris/rulesets/standard_exp.lua index b36192a..354f90d 100755 --- a/tetris/rulesets/standard_exp.lua +++ b/tetris/rulesets/standard_exp.lua @@ -1,5 +1,5 @@ local Piece = require 'tetris.components.piece' -local Ruleset = require 'tetris.rulesets.arika_srs' +local Ruleset = require 'tetris.rulesets.standard_ti' local SRS = Ruleset:extend() @@ -27,8 +27,6 @@ function SRS:checkNewLow(piece) for _, block in pairs(piece:getBlockOffsets()) do local y = piece.position.y + block.y if y > piece.lowest_y then - --piece.manipulations = 0 - --piece.rotations = 0 piece.lowest_y = y end end diff --git a/tetris/rulesets/ti_srs.lua b/tetris/rulesets/standard_ti.lua similarity index 100% rename from tetris/rulesets/ti_srs.lua rename to tetris/rulesets/standard_ti.lua From 40ac08c7e56a7898b365aa448806db872a8a0749 Mon Sep 17 00:00:00 2001 From: hebo-MAI Date: Mon, 9 Jan 2023 00:12:00 +0900 Subject: [PATCH 09/53] fix the bug hanging up when starting M-roll --- tetris/modes/marathon_a2.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tetris/modes/marathon_a2.lua b/tetris/modes/marathon_a2.lua index 08fccd3..906c87f 100644 --- a/tetris/modes/marathon_a2.lua +++ b/tetris/modes/marathon_a2.lua @@ -249,10 +249,13 @@ local grade_conversion = { } function MarathonA2Game:whilePieceActive() - self.grade_point_decay_counter = self.grade_point_decay_counter + 1 - if self.grade_point_decay_counter >= grade_point_decays[self.grade + 1] then - self.grade_point_decay_counter = 0 - self.grade_points = math.max(0, self.grade_points - 1) + if self.clear then return + else + self.grade_point_decay_counter = self.grade_point_decay_counter + 1 + if self.grade_point_decay_counter >= grade_point_decays[self.grade + 1] then + self.grade_point_decay_counter = 0 + self.grade_points = math.max(0, self.grade_points - 1) + end end end From aa9e03506ba73f1df3db477770436f0348ef3dd1 Mon Sep 17 00:00:00 2001 From: nightmareci Date: Mon, 13 Feb 2023 09:35:28 -0800 Subject: [PATCH 10/53] Create unified batch file for running the game from the source directory on Windows and update README.md --- README.md | 10 +++++----- start.bat | 7 +++++++ start_win32.bat | 1 - start_win64.bat | 1 - 4 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 start.bat delete mode 100644 start_win32.bat delete mode 100644 start_win64.bat diff --git a/README.md b/README.md index 4305da6..02abf98 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Cambridge Welcome to Cambridge, the next open-source falling-block game engine! -The project is written and maintained exclusively by [Milla](https://github.com/MillaBasset), [joezeng](https://github.com/joezeng) and [Oshisaure](https://github.com/oshisaure)! +The project is written and maintained exclusively by [Milla](https://github.com/MillaBasset), [joezeng](https://github.com/joezeng) and [Oshisaure](https://github.com/oshisaure)! The Discord server has been reopened! https://discord.gg/AADZUmgsph @@ -16,11 +16,11 @@ Playing the game ### Windows -You do not need LÖVE on Windows, as it comes bundled with the program. +You do not need LÖVE on Windows, as it comes bundled with the program. #### Stable release -To get the stable release, simply download either `cambridge-win32.zip` (32-bit) or `cambridge-windows.zip` (64-bit) in the [latest release](https://github.com/MillaBasset/cambridge/releases/latest). +To get the stable release, simply download either `cambridge-win32.zip` (32-bit) or `cambridge-windows.zip` (64-bit) in the [latest release](https://github.com/MillaBasset/cambridge/releases/latest). All assets needed are bundled with the executable. @@ -28,11 +28,11 @@ All assets needed are bundled with the executable. If you want the bleeding edge version, download [this](https://github.com/MillaBasset/cambridge/archive/master.zip). Extract the ZIP to a folder of your choosing. -Assuming you're on a 64-bit system, you can double-click `start_win64.bat` to run the game. If that doesn't work, open a Command Prompt where you extracted Cambridge and run: +If you're on Windows, you can double-click `start.bat` to run the game. If that doesn't work, open a Command Prompt where you extracted Cambridge and run: dist\windows\love.exe . -If you're on a 32-bit system, you'll want to double-click `start_win32.bat`. If that doesn't work, run this instead: +If that doesn't work, run this instead, still using Command Prompt where you extracted Cambridge: dist\win32\love.exe . diff --git a/start.bat b/start.bat new file mode 100644 index 0000000..aa7685b --- /dev/null +++ b/start.bat @@ -0,0 +1,7 @@ +@echo OFF + +rem This solution of detecting the current CPU taken from here: https://stackoverflow.com/a/24590583 +reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set CURRENT_CPU=32BIT || set CURRENT_CPU=64BIT + +if %CURRENT_CPU%==32BIT .\dist\win32\love.exe . +if %CURRENT_CPU%==64BIT .\dist\windows\love.exe . \ No newline at end of file diff --git a/start_win32.bat b/start_win32.bat deleted file mode 100644 index 5d2ac86..0000000 --- a/start_win32.bat +++ /dev/null @@ -1 +0,0 @@ -dist\win32\love.exe . \ No newline at end of file diff --git a/start_win64.bat b/start_win64.bat deleted file mode 100644 index acdd477..0000000 --- a/start_win64.bat +++ /dev/null @@ -1 +0,0 @@ -dist\windows\love.exe . \ No newline at end of file From a4b7a41a1556685bf7bd7f8764fcffedd40f0a24 Mon Sep 17 00:00:00 2001 From: Joe Zeng Date: Tue, 11 Apr 2023 12:18:11 -0400 Subject: [PATCH 11/53] Changed the Phantom Mania non-N requirement back to automatic GM at 999. (Only N should have the 31-tetris rule.) --- load/version.lua | 2 +- tetris/modes/phantom_mania.lua | 12 +++++------- tetris/modes/phantom_mania_n.lua | 10 ++++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/load/version.lua b/load/version.lua index 0328391..8812b23 100644 --- a/load/version.lua +++ b/load/version.lua @@ -1 +1 @@ -version = "v0.3.1" \ No newline at end of file +version = "v0.3.2" \ No newline at end of file diff --git a/tetris/modes/phantom_mania.lua b/tetris/modes/phantom_mania.lua index 5bab937..72ba5b2 100644 --- a/tetris/modes/phantom_mania.lua +++ b/tetris/modes/phantom_mania.lua @@ -28,7 +28,6 @@ function PhantomManiaGame:new() self.combo = 1 self.tetrises = 0 self.section_tetrises = {[0] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} - self.section_req = true self.randomizer = History6RollsRandomizer() end @@ -120,11 +119,6 @@ function PhantomManiaGame:onLineClear(cleared_row_count) self.level = 999 end self.clear = true - for i = 0, 9 do - if self.section_tetrises[i] < (i == 9 and 1 or 2) then - self.section_req = false - end - end else self.level = new_level end @@ -175,6 +169,10 @@ local function getLetterGrade(level, clear) end end +function PhantomManiaGame:qualifiesForGM() + return true +end + function PhantomManiaGame:drawScoringInfo() PhantomManiaGame.super.drawScoringInfo(self) @@ -195,7 +193,7 @@ function PhantomManiaGame:drawScoringInfo() if getLetterGrade(self.level, self.clear) ~= "" then if self.roll_frames > 1982 then love.graphics.setColor(1, 0.5, 0, 1) elseif self.level == 999 and self.clear then love.graphics.setColor(0, 1, 0, 1) end - if self.level == 999 and self.section_req and self.tetrises >= 31 then + if self.level == 999 and self:qualifiesForGM() then love.graphics.printf("GM", text_x, 140, 90, "left") else love.graphics.printf(getLetterGrade(self.level, self.clear), text_x, 140, 90, "left") diff --git a/tetris/modes/phantom_mania_n.lua b/tetris/modes/phantom_mania_n.lua index c063745..74b026a 100644 --- a/tetris/modes/phantom_mania_n.lua +++ b/tetris/modes/phantom_mania_n.lua @@ -13,4 +13,14 @@ function PhantomManiaNGame:new() self.enable_hold = true end +function PhantomManiaNGame:qualifiesForGM() + if self.tetrises < 31 then return false end + for i = 0, 9 do + if self.section_tetrises[i] < (i == 9 and 1 or 2) then + return false + end + end + return true +end + return PhantomManiaNGame From 8e6a760fe7964a660910df7c03537de5bc287682 Mon Sep 17 00:00:00 2001 From: Oshisaure Date: Sat, 24 Jun 2023 15:46:38 +0100 Subject: [PATCH 12/53] Added counter for amount of pauses used * Pause count is saved in replays and shown when viewing replay * Old replays display ?? pauses * Removed suspend on lose focus --- scene/game.lua | 24 +++++++++++++++++++++--- scene/replay.lua | 17 ++++++++++++++++- tetris/modes/gamemode.lua | 2 ++ 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/scene/game.lua b/scene/game.lua index e3015ea..d941114 100644 --- a/scene/game.lua +++ b/scene/game.lua @@ -25,6 +25,8 @@ function GameScene:new(game_mode, ruleset, inputs) hold=false, } self.paused = false + self.game.pause_count = 0 + self.game.pause_time = 0 DiscordRPC:update({ details = self.game.rpc_details, state = self.game.name, @@ -33,7 +35,9 @@ function GameScene:new(game_mode, ruleset, inputs) end function GameScene:update() - if love.window.hasFocus() and not self.paused then + if self.paused then + self.game.pause_time = self.game.pause_time + 1 + else local inputs = {} for input, value in pairs(self.inputs) do inputs[input] = value @@ -50,6 +54,16 @@ end function GameScene:render() 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 function GameScene:onInputPress(e) @@ -71,8 +85,12 @@ function GameScene:onInputPress(e) 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 self.paused = not self.paused - if self.paused then pauseBGM() - else resumeBGM() end + if self.paused then + pauseBGM() + self.game.pause_count = self.game.pause_count + 1 + else + resumeBGM() + end elseif e.input == "menu_back" then self.game:onExit() scene = ModeSelectScene() diff --git a/scene/replay.lua b/scene/replay.lua index f1ca2c0..d2ec5e0 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -29,6 +29,8 @@ function ReplayScene:new(replay, game_mode, ruleset) hold=false, } self.paused = false + self.game.pause_count = replay["pause_count"] + self.game.pause_time = replay["pause_time"] self.replay = deepcopy(replay) self.replay_index = 1 DiscordRPC:update({ @@ -39,7 +41,7 @@ function ReplayScene:new(replay, game_mode, ruleset) end function ReplayScene:update() - if love.window.hasFocus() and not self.paused then + if not self.paused then self.inputs = self.replay["inputs"][self.replay_index]["inputs"] 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 @@ -64,6 +66,19 @@ function ReplayScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.setFont(font_3x5_3) 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 function ReplayScene:onInputPress(e) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 2734806..2586cb3 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -136,6 +136,8 @@ function GameMode:saveReplay() replay["gamesettings"] = config.gamesettings replay["secret_inputs"] = self.secret_inputs replay["timestamp"] = os.time() + replay["pause_count"] = self.pause_count + replay["pause_time"] = self.pause_time if love.filesystem.getInfo("replays") == nil then love.filesystem.createDirectory("replays") end From e5cb69df43f07a7e764c66cfe5760f18edabe1ff Mon Sep 17 00:00:00 2001 From: Oshisaure Date: Sat, 1 Jul 2023 01:56:51 +0100 Subject: [PATCH 13/53] Slight revamp on BG image handling - The game can now load more than 20 backgrounds by putting them in /res/backgrounds in the save directory - If a gamemode tries to set its background to an ID higher than the max it will be clamped down to the last background loaded --- load/graphics.lua | 27 +++++++-------------------- tetris/modes/gamemode.lua | 4 +++- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/load/graphics.lua b/load/graphics.lua index 066ce72..893bb1b 100644 --- a/load/graphics.lua +++ b/load/graphics.lua @@ -1,24 +1,4 @@ backgrounds = { - [0] = love.graphics.newImage("res/backgrounds/0.png"), - love.graphics.newImage("res/backgrounds/100.png"), - love.graphics.newImage("res/backgrounds/200.png"), - love.graphics.newImage("res/backgrounds/300.png"), - love.graphics.newImage("res/backgrounds/400.png"), - love.graphics.newImage("res/backgrounds/500.png"), - love.graphics.newImage("res/backgrounds/600.png"), - love.graphics.newImage("res/backgrounds/700.png"), - love.graphics.newImage("res/backgrounds/800.png"), - love.graphics.newImage("res/backgrounds/900.png"), - love.graphics.newImage("res/backgrounds/1000.png"), - love.graphics.newImage("res/backgrounds/1100.png"), - love.graphics.newImage("res/backgrounds/1200.png"), - love.graphics.newImage("res/backgrounds/1300.png"), - love.graphics.newImage("res/backgrounds/1400.png"), - love.graphics.newImage("res/backgrounds/1500.png"), - love.graphics.newImage("res/backgrounds/1600.png"), - love.graphics.newImage("res/backgrounds/1700.png"), - love.graphics.newImage("res/backgrounds/1800.png"), - love.graphics.newImage("res/backgrounds/1900.png"), title = love.graphics.newImage("res/backgrounds/title.png"), title_no_icon = love.graphics.newImage("res/backgrounds/title-no-icon.jpg"), title_night = love.graphics.newImage("res/backgrounds/title-night.jpg"), @@ -27,6 +7,13 @@ backgrounds = { game_config = love.graphics.newImage("res/backgrounds/options-game.png"), } +local i = 0 +local bgpath = "res/backgrounds/%d.png" +while love.filesystem.getInfo(bgpath:format(i*100)) do + backgrounds[i] = love.graphics.newImage(bgpath:format(i*100)) + i = i + 1 +end + -- in order, the colors are: -- red, orange, yellow, green, cyan, blue -- magenta (or purple), white, black diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 2586cb3..eb07c37 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -979,9 +979,11 @@ function GameMode:drawSectionTimesWithSplits(current_section, section_limit) end function GameMode:drawBackground() + local id = self:getBackground() + if type(id) == "number" then id = clamp(id, 0, #backgrounds) end love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds[self:getBackground()], + backgrounds[id], 0, 0, 0, 0.5, 0.5 ) From 8d7ccae2bc7baf546e94717dd43572566a4bd596 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sat, 1 Jul 2023 22:25:50 -0400 Subject: [PATCH 14/53] README: fix Cambridge logo link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 02abf98..6c33cdb 100644 --- a/README.md +++ b/README.md @@ -107,4 +107,4 @@ Other Notable Games - [Puzzle Trial](https://kagamine-rin.itch.io/puzzle-trial) by Rin - [stackfuse](https://github.com/sinefuse/stackfuse) by sinefuse -![Cambridge Logo](https://cdn.discordapp.com/attachments/625496179433668635/763363717730664458/Icon_2.png) +![Cambridge Logo](https://cdn.discordapp.com/attachments/827186653772644452/1077674343544393820/Icon_2.png) From 9d5dbb4674e84dca70dec772355f0471f7c6c6dc Mon Sep 17 00:00:00 2001 From: --global <--global> Date: Sat, 1 Jul 2023 22:34:34 -0400 Subject: [PATCH 15/53] Bump version to v0.3.3 --- load/version.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load/version.lua b/load/version.lua index 8812b23..7194e61 100644 --- a/load/version.lua +++ b/load/version.lua @@ -1 +1 @@ -version = "v0.3.2" \ No newline at end of file +version = "v0.3.3" \ No newline at end of file From 7c322739715e7661b3fe86045290b7a2156d1b77 Mon Sep 17 00:00:00 2001 From: --global <--global> Date: Sat, 1 Jul 2023 23:15:14 -0400 Subject: [PATCH 16/53] Alias Lua random functions to Love2D's --- main.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.lua b/main.lua index 52fecf9..093a95f 100644 --- a/main.lua +++ b/main.lua @@ -1,5 +1,4 @@ function love.load() - math.randomseed(os.time()) highscores = {} love.graphics.setDefaultFilter("linear", "nearest") require "load.rpc" @@ -24,6 +23,11 @@ function love.load() -- used for screenshots GLOBAL_CANVAS = love.graphics.newCanvas() + -- aliasing to prevent people using math.random by accident + math.random = love.math.random + math.randomseed = love.math.setRandomSeed + math.randomseed(os.time()) + -- init config initConfig() @@ -285,8 +289,8 @@ function love.focus(f) end function love.resize(w, h) - GLOBAL_CANVAS:release() - GLOBAL_CANVAS = love.graphics.newCanvas(w, h) + GLOBAL_CANVAS:release() + GLOBAL_CANVAS = love.graphics.newCanvas(w, h) end local TARGET_FPS = 60 From 80de771d2afe10f82652a58b587053e013ba6af5 Mon Sep 17 00:00:00 2001 From: --global <--global> Date: Sat, 1 Jul 2023 23:27:10 -0400 Subject: [PATCH 17/53] Elaborate on TARGET_FPS --- main.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.lua b/main.lua index 093a95f..ec82eb7 100644 --- a/main.lua +++ b/main.lua @@ -293,6 +293,8 @@ function love.resize(w, h) GLOBAL_CANVAS = love.graphics.newCanvas(w, h) end +-- higher values of TARGET_FPS will make the game run "faster" +-- since the game is mostly designed for 60 FPS local TARGET_FPS = 60 local FRAME_DURATION = 1.0 / TARGET_FPS From df19129228bb8c1845bd3c4766021c5e76be01ea Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sat, 1 Jul 2023 23:30:36 -0400 Subject: [PATCH 18/53] Update main.lua --- main.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/main.lua b/main.lua index ec82eb7..d19249e 100644 --- a/main.lua +++ b/main.lua @@ -298,6 +298,7 @@ end local TARGET_FPS = 60 local FRAME_DURATION = 1.0 / TARGET_FPS +-- custom run function; optimizes game by syncing draw/update calls function love.run() if love.load then love.load(love.arg.parseGameArguments(arg), arg) end From 9a67a6ce037c3c691288c17ef70ebd25bc72739e Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 2 Jul 2023 18:07:40 -0400 Subject: [PATCH 19/53] 8x11 font by MattMayuga with more characters --- load/fonts.lua | 16 +++++++++++++--- res/fonts/8x11.png | Bin 591 -> 2384 bytes res/fonts/8x11_medium.png | Bin 734 -> 5008 bytes 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/load/fonts.lua b/load/fonts.lua index 36ae0c3..8a37d8d 100644 --- a/load/fonts.lua +++ b/load/fonts.lua @@ -26,8 +26,18 @@ font_3x5_4 = love.graphics.newImageFont( -4 ) -font_8x11 = love.graphics.newImageFont( - "res/fonts/8x11_medium.png", - "0123456789:.", +-- this would be font_8x11 with the other one as 8x11_2 +-- but that would break compatibility :( +font_8x11_small = love.graphics.newImageFont( + "res/fonts/8x11.png", + " 0123456789:;.,ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" .. + "?!/\\^@$%<=>()*-+[]_&", + 1 +) + +font_8x11 = love.graphics.newImageFont( + "res/fonts/8x11_medium.png", + " 0123456789:;.,ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" .. + "?!/\\^@$%<=>()*-+[]_&", 1 ) diff --git a/res/fonts/8x11.png b/res/fonts/8x11.png index 2693141ea4fbf03fb0649e9f8fc2d919bbdbdd2f..7546e3df74c60068567a3de11489f89492673d27 100644 GIT binary patch literal 2384 zcma)8XE@u78vh5;NUTt+NU2pqgsMg=tq`L|M2wnkVl{4iiW%;Q^pA751G9KG8xXOFQFZ;QI+ZK0aPs z`)4M-*}D7$z=33J1TDS6u*uO~e9IIXz{wwz&!C5vftV23h zb$oa(i%ZXDVf8{D11jCo)tsG~pq`mUt%AUjZK_&R!n zw^B~?hF$KsGuP+Y-r(4Sk5ELi^#P`R7Tq)`w46`kt>WvGIdzgmLzWY?&P@N`B)JN# z&ae*u@y7sFVTBf=Y*zIQdDEeSow0F4Di$iYptW*Xw401^jD1anfE0<*R#maijlYrv z4PS~~kxy-0NY`DOHF=$flQ<3rPl+64dpEj-T)G_Rrzz3JhIeiBR4Y=3&@7RE5ov3R z>XnCD1K-*dExHq|wCC@5q1%X9z2}1i$;3bl@zOPvjzoli=(7pAl^WJ$EOZ?n1G_kF zBf&Yt#=FK$Uodu1Q+BG*uuI9SbXl~;thIS4^S5(1Ar-fP{Io71b_;mb{Mhi}P9cTK zN&C+{7CjC~SWh4|Fu!x@e;&oa5Su(s8b3S2Z48B|j)pK&oFYn=8$|V;k$DoLtdf?5 z@dHCHysJ?BgBT2@=0 zrRv^;Lz9Elxo!10>#VX;9P8V0r_7Tu=A^80s~k=VB^GRuy>ew?=M;ZtGnUT;uV7C_w>jgT=n~K8-B}tO?qK`fB2>PB~14t3c zNErQT!BTaprK_DL{|!&fFSj#4b=}v+1yW6q{C5qh0-}1B+zgn39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u?i{>Tr(NVkTWwkuAe6z&y23YHkTB)+d0DP6m)w7Ic=UQn#(Rb1xkR_-kb zbNH2Ex?9l9qN~`@O~C0~+g`gQi~9b2$;des@4f>jioYh1z{jRxYlMhjdX@{YDu&Q( z^R=xzL@hw$vZ1&OSEGEHs>R9;I7bg*51A`Iti{k1n4fW3Kdz(M%du99N7GBsLZ9|L zEe+fL(|VlVlc?BI$8)CX;E`_pX5HO74lTnvU@GbRBTms(D&SlOzVPf@{GRLY)gi34i7P|9uw+KaS?EdXL2B(+q5rPd*#qnlX`3Z%B#y8;74ny#N3J literal 591 zcmV-V0WFU8GbZ8()Nlj2>E@cM*00FZ}L_t(o!|hmGj>8}f zv{&3A_dgz-q0;Qnrb?*+kAbuwYpGI|48!<=fe7RQaoRujyRp`@^zy!MYR=Qgcm!(z zD})wz(8xIK;*I9Qv~(o|Y+hBZCw=}u$NXX5y+T`S&C6h|;I*{$cq_ao4!d{}%!Mn# z-QWPAoofZ9$ID<_$&F~S{PJL#qGsYtVBt!dRX?>@@&zi6e*>=F|?k0-{+jAlp?D7_G_((8dpk@obzzr>KR&m9$pW&=c_jk z2Cud>8$P4@eWXRR_c!V;Z3R8&EXQ%&c^HZw&@l1M;l=-pzaLHTGP4{SIlI$7Id`uR zQuJyPTop58BVW}pd9sa;)k$8gD)e*(=A6xzSCh2bqG!?`cW;lISs4s369=~AFub04 zdA2i!JfM=)Q8g#lS^5vzfW7J+u3$oMBn~?09;a^+-iQXV{7vKmh{0hKmer+;cvc@C dS8FiG{sNi{l-bl-ACv$9002ovPDHLkV1nb20}=oL diff --git a/res/fonts/8x11_medium.png b/res/fonts/8x11_medium.png index 54d170b6e470a54986c93f2c3643e605275935e7..4ebcafcd43339493ccc8f052d00e37007a5bc5c7 100644 GIT binary patch literal 5008 zcmZu#30PCtwx)VfuSyZHPzfbhvBe59h!Vw+SVgfFMHGz80xAfUK@5~;3uXP7-Wy{`%-`Mf@4yF3K+ZK zaB$?T!D>F&t0Z;q3cSs5a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g2XskIMF-&u2oM_#B5rmF0000TX;fHrLvL+uWo~o;00000 zLvm$dbY)~9cWHEJAV*0}P-HG;2LJ#9LP_} zMJ?E|9TIqNQ)xs$#tHs$%21@dM9ND_FzBL-Zo97bxW57b({g|Ndh`3J>SE;6iK>pZ zlWs}MizLqx88pAW;_ZE3n81MnPU65H6-LBXaB8i4mFnx?*XMcD(Un_iD~x;bX6b63 z!=pNIW z7q4#bC%`0WK8a`itt%EB7yt(bE!JMHwKC7jRj<3%(Q#mai#Tw|f8BKK)s8xEb`Q1Q zH9zW^;og7etp~@Oa=qRa84e6^CI?>b?Dg+s-b!NKZH=l_t#Mm*j_%pA;?0^5*?SCG z@kY(B!jo74P?xvA*K(_tJAbcNdD9JUyk2Dz-E|&9d*Fop{)$&R<)P_4;T_|Zp7TLF zzBn+znR?(7{|5PJJ()~5J70CMc#b|#ojebw^Wqu602A{MiTbKY!&b|Y00000NkvXX Hu0mjfP1aP_ From 4b456cf49c55cf52037ad51c616ce26ffc5edd9a Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 2 Jul 2023 18:20:56 -0400 Subject: [PATCH 20/53] Removed xcf fonts --- res/fonts/3x5.xcf | Bin 13661 -> 0 bytes res/fonts/8x12.xcf | Bin 5636 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 res/fonts/3x5.xcf delete mode 100644 res/fonts/8x12.xcf diff --git a/res/fonts/3x5.xcf b/res/fonts/3x5.xcf deleted file mode 100644 index 7b6fdcbbab53ee4ae197acbc55e2673d4ce1b1dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13661 zcmbuGOOIVg5y#IQU)$qJ?3l#ZmWZN@i6bY9Ljs8qkx)<&AcTT~1QLqG!m-DbL4HKG z5y=Ke;sd}6Hf-3l;sa#EDiTXr93mx%JQT^c$cs3Su@C=WRoCh6d(R!ukh#-+s;jH2 zyQ{1Jx2Nu%we_>lPhU8BdU|^O%xcp#?ax&0Q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sqEOJ>p!<^9&eHc8s8VMKlmPJ>6dYJ{2Mu*G%CzYa$KrhnbLXu4${lNNxQ za}f`x??C{nBoQ1yJ@qi#UiQm3cie2m@(au&vpjd4+exH8v1vwQ>%kfy>K(9rL0R)9 z(%EvLIaF{jH@~${LriO{RfKvoyC5BuR8wi<%gpAcO8EC Iw;B8SA4W!c5dZ)H diff --git a/res/fonts/8x12.xcf b/res/fonts/8x12.xcf deleted file mode 100644 index 746c8774046ec3ae8ff643105bfd540189f26099..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5636 zcmd5=&2A$_5bpW4on&FjE}Rhfm_)k)KuK)n*SUJOBr{ z@fFT-I@oPfl3w)wuQ?)KQ8vAtO&cBG!Jsh_T&uIZ|oUjO)6`=WE$KI|WL4Xz7} zcM0Hn46s=ntN@pM3T8H>BJZ*8cHcue;ql>mLvY?#OJN4_+R1+vlf8{euTCx#~ zdrPM6v)=w*`{B+*xhjB1j`RSc`xT;|-mV8IdU5`2uhT#2wI6w1K)$R(I^6d2lm4LH zKj}Q}o>Ttx@bJ7l2nJGm9;KLRQO3bt(QgReC;kbu-y=qK{qbJs``+2<^AibO4itCB zVl*90ww8l2nGZ|wS_xh+!5by`P6=jea9w{j08k$ zKK{j+wQq^LjDEF|iR~+6cLC%CKDJSjU}PAn9h;&+eng}+fQj8`*u%!0TTLA?UEm+QklV!A zvh6W8BQmYvW^N(p!hK_ngdMwNup`)eQndD2^ z*s^uwF_<#Ma+(3cA!)`gX-46lM%s*B+6bRZ8{&q@i8;xkNHT3yYz%Qpn_3CgkF-&N z8wj|xxuwVmcDb|>-OdD=ByGHc8<3GU<#5a-K{)p8!Rh^R`tWf`}l855g@0D^}7M6T@E5-7P=l9c+ZT>z>O zx&Vb)gPF>(Fg6Q$hSCa5bFt2Fu(!~aR^v(xiW)nM1T6v0$uXxGd`BE<+glZ!pDC@b z$hMGSRh8tw!ZR89&Q|GIM61_-U0}b$LCheq2b=B%7*)xdRhbbrMl?0E0&M1ziq&6R z0OlYL#kHiHp4W(pF3)#P3V#4{u)-yH>h@_8zxv1^%9V#Zvu=#r|3kl)6Qy4NGP;<) zlKt4bsS@onV+zO2K+W|bSykjp+kVQ;int7!({c+DHS90#Dd3As6W^wcJthDWmVW~O zOgZPHcXa9A*PXJ+9iGSXHqGCJ8uQR$fn(ufRhQP>J(o+HTdTTkF+W`en-p--y%PVG z7C+kh2K-uhbb)$@6LFWx?_qpy8a73%nizBk7`e2q z4Xvf@pc4N%oJ!AFMMHVdi4`Nu7ui(h>|$i=do18sKRujEI3pF(R?F zDkW*nB5D&H&O|JLuL&uCBB-i2085=i^;=GzD~y>~I?+&O@HF*m@)MyEg8CW4{$&`u zu)y Date: Sun, 2 Jul 2023 19:13:13 -0400 Subject: [PATCH 21/53] Bump version to v0.3.3.1 --- load/version.lua | 2 +- scene/replay_select.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/load/version.lua b/load/version.lua index 7194e61..18d8a8c 100644 --- a/load/version.lua +++ b/load/version.lua @@ -1 +1 @@ -version = "v0.3.3" \ No newline at end of file +version = "v0.3.3.1" \ No newline at end of file diff --git a/scene/replay_select.lua b/scene/replay_select.lua index 7ae3140..5655df7 100644 --- a/scene/replay_select.lua +++ b/scene/replay_select.lua @@ -83,7 +83,7 @@ function ReplaySelectScene:render() -- Same graphic as mode select --love.graphics.draw(misc_graphics["select_mode"], 20, 40) - love.graphics.setFont(font_3x5_4) + love.graphics.setFont(font_8x11) love.graphics.print("SELECT REPLAY", 20, 35) if self.display_warning then From 5fa144f146c0a402cc9ffcaee4f0a5be55202984 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 2 Jul 2023 19:47:39 -0400 Subject: [PATCH 22/53] Fix Marathon 2020 section cool highlighting --- tetris/modes/marathon_2020.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tetris/modes/marathon_2020.lua b/tetris/modes/marathon_2020.lua index 0bfab3b..e8dcb28 100644 --- a/tetris/modes/marathon_2020.lua +++ b/tetris/modes/marathon_2020.lua @@ -352,9 +352,13 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level) table.insert(self.section_times, section_time) self.section_start_time = self.frames - if self.secondary_section_times[section] < cool_cutoffs[self.delay_level] and - (section == 1 or self.secondary_section_times[section] <= self.secondary_section_times[section - 1] + 120) then + if ( + self.secondary_section_times[section] < cool_cutoffs[self.delay_level] and + section == 1 or self.secondary_section_times[section] <= self.secondary_section_times[section - 1] + 120 + ) then sectionCool(section) + else + table.insert(self.section_status, "none") end if section > 5 then From 79d706a415e42b84797536e0f676c37975a83008 Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Tue, 4 Jul 2023 02:27:04 -0400 Subject: [PATCH 23/53] re-add 180s and IRS wallkicks after inheritance change fixes results of https://github.com/MillaBasset/cambridge/commit/323c4578091ada3fcb218d677f0c507eb9f639e2 --- tetris/rulesets/standard.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tetris/rulesets/standard.lua b/tetris/rulesets/standard.lua index 0b0b5d1..8a8a841 100644 --- a/tetris/rulesets/standard.lua +++ b/tetris/rulesets/standard.lua @@ -8,6 +8,8 @@ SRS.hash = "Standard" SRS.softdrop_lock = false SRS.harddrop_lock = true +SRS.enable_IRS_wallkicks = true + SRS.MANIPULATIONS_MAX = 15 SRS.wallkicks_line = { @@ -108,4 +110,6 @@ end function SRS:canPieceRotate() return true end +function SRS:get180RotationValue() return 2 end + return SRS From bdc317c3c5c3e024ebac5da97628fdcd2389bcb5 Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Fri, 7 Jul 2023 17:10:24 -0400 Subject: [PATCH 24/53] hotfix cool logic --- tetris/modes/marathon_2020.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tetris/modes/marathon_2020.lua b/tetris/modes/marathon_2020.lua index e8dcb28..7286620 100644 --- a/tetris/modes/marathon_2020.lua +++ b/tetris/modes/marathon_2020.lua @@ -353,8 +353,8 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level) self.section_start_time = self.frames if ( - self.secondary_section_times[section] < cool_cutoffs[self.delay_level] and - section == 1 or self.secondary_section_times[section] <= self.secondary_section_times[section - 1] + 120 + (self.secondary_section_times[section] < cool_cutoffs[self.delay_level]) and + (section == 1 or self.secondary_section_times[section] <= self.secondary_section_times[section - 1] + 120) ) then sectionCool(section) else From b06d03c4e618e622ed7387ea0fed69ecceadd3c5 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Fri, 7 Jul 2023 18:14:17 -0400 Subject: [PATCH 25/53] Fix bravo detection --- tetris/components/grid.lua | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tetris/components/grid.lua b/tetris/components/grid.lua index 2015e2b..8fb8030 100644 --- a/tetris/components/grid.lua +++ b/tetris/components/grid.lua @@ -231,12 +231,15 @@ function Grid:applyBigPiece(piece) end end -function Grid:checkForBravo(cleared_row_count) - for i = 0, self.height - 1 - cleared_row_count do - for j = 0, self.width - 1 do - if self:isOccupied(j, i) then return false end - end +-- places where you see this take an argument used the old, buggy method +function Grid:checkForBravo() + for i = 0, self.height - 1 do + if not self:isRowFull(i+1) then + for j = 0, self.width - 1 do + if self:isOccupied(j, i) then return false end + end end + end return true end From 788aa11470c00a6ebf68056f81ab36f91bf6b144 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Fri, 7 Jul 2023 18:16:34 -0400 Subject: [PATCH 26/53] Bump version to v0.3.3.2 --- load/version.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load/version.lua b/load/version.lua index 18d8a8c..627db68 100644 --- a/load/version.lua +++ b/load/version.lua @@ -1 +1 @@ -version = "v0.3.3.1" \ No newline at end of file +version = "v0.3.3.2" \ No newline at end of file From 082697c3cd5c4bed5c86bf62ec6299b99010a5d8 Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Sun, 9 Jul 2023 15:41:19 -0400 Subject: [PATCH 27/53] fix duplicate cool at 2000 now you have to survive the roll for gm! terrifying --- tetris/modes/marathon_2020.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tetris/modes/marathon_2020.lua b/tetris/modes/marathon_2020.lua index 7286620..54d1c3b 100644 --- a/tetris/modes/marathon_2020.lua +++ b/tetris/modes/marathon_2020.lua @@ -283,7 +283,7 @@ function Marathon2020Game:sectionPassed(old_level, new_level) ) else return ( - (new_level < 2001 and math.floor(old_level / 100) < math.floor(new_level / 100)) or + (new_level < 2000 and math.floor(old_level / 100) < math.floor(new_level / 100)) or (new_level >= 2020) ) end From 7d6f783c408e3edf240817e0aaae29223cfddc9e Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Sun, 9 Jul 2023 20:06:27 -0400 Subject: [PATCH 28/53] fix lategame levelling bug --- tetris/modes/survival_2020.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tetris/modes/survival_2020.lua b/tetris/modes/survival_2020.lua index 76e7fa3..d27109e 100644 --- a/tetris/modes/survival_2020.lua +++ b/tetris/modes/survival_2020.lua @@ -143,7 +143,7 @@ end function Survival2020Game:onPieceEnter() if not self.clear and ( (self.level < 1900 and self.level % 100 ~= 99) or - self.level == 2019 + (1900 <= self.level and self.level < 2019) ) then self.level = self.level + 1 end @@ -249,7 +249,7 @@ function Survival2020Game:drawScoringInfo() end function Survival2020Game:getBackground() - return math.floor(self.level / 100) + return math.min(19, math.floor(self.level / 100)) end function Survival2020Game:getHighscoreData() From 1fef7b48801abf8a5af3bae08750cd26d57da8fd Mon Sep 17 00:00:00 2001 From: Tetro48 <76738929+Tetro48@users.noreply.github.com> Date: Mon, 10 Jul 2023 08:58:09 +0700 Subject: [PATCH 29/53] Added replay fast-forwarding --- scene/replay.lua | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/scene/replay.lua b/scene/replay.lua index 29f78cf..d72eed6 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -36,6 +36,7 @@ function ReplayScene:new(replay, game_mode, ruleset) self.game.pause_time = replay["pause_time"] self.replay = deepcopy(replay) self.replay_index = 1 + self.replay_speed = 1 DiscordRPC:update({ details = "Viewing a replay", state = self.game.name, @@ -44,18 +45,22 @@ function ReplayScene:new(replay, game_mode, ruleset) end function ReplayScene:update() + local frames_left = self.replay_speed if not self.paused then - self.inputs = self.replay["inputs"][self.replay_index]["inputs"] - 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 - self.replay_index = self.replay_index + 1 + while frames_left > 0 do + frames_left = frames_left - 1 + self.inputs = self.replay["inputs"][self.replay_index]["inputs"] + 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 + self.replay_index = self.replay_index + 1 + end + local input_copy = {} + for input, value in pairs(self.inputs) do + input_copy[input] = value + end + self.game:update(input_copy, self.ruleset) + self.game.grid:update() end - local input_copy = {} - for input, value in pairs(self.inputs) do - input_copy[input] = value - end - self.game:update(input_copy, self.ruleset) - self.game.grid:update() DiscordRPC:update({ details = "Viewing a replay", state = self.game.name, @@ -69,6 +74,11 @@ function ReplayScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.setFont(font_3x5_3) love.graphics.printf("REPLAY", 0, 0, 635, "right") + local pauses_y_coordinate = 23 + if self.replay_speed > 1 then + pauses_y_coordinate = pauses_y_coordinate + 20 + love.graphics.printf(self.replay_speed.."X", 0, 20, 635, "right") + end 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 @@ -77,10 +87,10 @@ function ReplayScene:render() self.game.pause_count, self.game.pause_count == 1 and "" or "S", formatTime(self.game.pause_time) - ), 0, 23, 635, "right") + ), 0, pauses_y_coordinate, 635, "right") end else - love.graphics.printf("?? PAUSES (--:--.--)", 0, 23, 635, "right") + love.graphics.printf("?? PAUSES (--:--.--)", 0, pauses_y_coordinate, 635, "right") end end @@ -104,6 +114,16 @@ function ReplayScene:onInputPress(e) self.paused = not self.paused if self.paused then pauseBGM() else resumeBGM() end + elseif e.input == "left" then + self.replay_speed = self.replay_speed - 1 + if self.replay_speed < 1 then + self.replay_speed = 1 + end + elseif e.input == "right" then + self.replay_speed = self.replay_speed + 1 + if self.replay_speed > 99 then + self.replay_speed = 99 + end end end From 057280362713242428659594e2ba0d669af30067 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 9 Jul 2023 22:35:07 -0400 Subject: [PATCH 30/53] Fixed a slight indentation error --- main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.lua b/main.lua index d19249e..d6980eb 100644 --- a/main.lua +++ b/main.lua @@ -114,7 +114,7 @@ function love.keypressed(key, scancode) scene.restart_message = true if config.secret then playSE("mode_decide") else playSE("erase") end - -- f12 is reserved for saving screenshots + -- f12 is reserved for saving screenshots elseif scancode == "f12" then local ss_name = os.date("ss/%Y-%m-%d_%H-%M-%S.png") local info = love.filesystem.getInfo("ss", "directory") From 4478c07acfdd5502657ff93544ba287a5de7ffb2 Mon Sep 17 00:00:00 2001 From: aur9ra <93367045+aur9ra@users.noreply.github.com> Date: Fri, 14 Jul 2023 17:54:35 -0700 Subject: [PATCH 31/53] First commit, WIP --- load/graphics.lua | 85 +++++++++++++++++++++++++++++++++------ scene/credits.lua | 2 +- scene/game_config.lua | 2 +- scene/input_config.lua | 2 +- scene/key_config.lua | 2 +- scene/mode_select.lua | 2 +- scene/replay_select.lua | 2 +- scene/settings.lua | 2 +- scene/stick_config.lua | 2 +- scene/title.lua | 4 +- scene/tuning.lua | 2 +- tetris/modes/gamemode.lua | 4 +- 12 files changed, 85 insertions(+), 26 deletions(-) diff --git a/load/graphics.lua b/load/graphics.lua index 893bb1b..eb7f747 100644 --- a/load/graphics.lua +++ b/load/graphics.lua @@ -1,17 +1,76 @@ -backgrounds = { - title = love.graphics.newImage("res/backgrounds/title.png"), - title_no_icon = love.graphics.newImage("res/backgrounds/title-no-icon.jpg"), - title_night = love.graphics.newImage("res/backgrounds/title-night.jpg"), - snow = love.graphics.newImage("res/backgrounds/snow.png"), - input_config = love.graphics.newImage("res/backgrounds/options-input.png"), - game_config = love.graphics.newImage("res/backgrounds/options-game.png"), -} +named_backgrounds = {"title", "title_no_icon", "title_night", "snow", "options_input", "options_game"} +backgrounds_played_recently = {} +image_formats = {".png", ".jpg"} +local bgpath = "res/backgrounds/" -local i = 0 -local bgpath = "res/backgrounds/%d.png" -while love.filesystem.getInfo(bgpath:format(i*100)) do - backgrounds[i] = love.graphics.newImage(bgpath:format(i*100)) - i = i + 1 +backgrounds = {} + +--helper method to populate backgrounds +function createBackgroundIfExists(name, file_name) + local format_index = 1 + + --try creating image backgrounds + while format_index <= #image_formats do + if love.filesystem.getInfo(bgpath.. file_name ..image_formats[format_index]) then + local tempBgPath = bgpath .. file_name .. image_formats[format_index] + backgrounds[name] = love.graphics.newImage(tempBgPath) + return true + end + format_index = format_index + 1 + end + + if love.filesystem.getInfo(bgpath .. file_name ..".ogv") then + local tempBgPath = bgpath .. file_name .. ".ogv" + backgrounds[name] = love.graphics.newVideo(tempBgPath, {["audio"] = false}) + -- you can set audio to true, but the video will not loop properly if audio extends beyond video frames + return true + end + + return false +end + +function fetchBackgroundAndLoop(id) + bg = backgrounds[id] + + if bg:typeOf("Video") and not bg:isPlaying() then + bg:rewind() + bg:play() + if (not backgrounds_played_recently[1] == bg) or backgrounds_played_recently[1] == nil then + table.insert(backgrounds_played_recently, 1, bg) + print(id) + end + end + + --if background is not loaded, rewind it and pause it + if #backgrounds_played_recently >= 1 then + if backgrounds_played_recently[1] == bg and #backgrounds_played_recently >= 2 then + print("!") + backgrounds_played_recently[2]:pause() + backgrounds_played_recently[2]:rewind() + table.remove(backgrounds_played_recently, 2) + print("Unloaded video #2") + elseif not backgrounds_played_recently[1] == bg then + backgrounds_played_recently[1]:pause() + backgrounds_played_recently[1]:rewind() + table.remove(backgrounds_played_recently, 1) + print("Unloaded most recently played") + end + end + + return bg +end + +--create section backgrounds +local section = 0 +while (createBackgroundIfExists(section, section*100)) do + section = section + 1 +end + +--create named backgrounds +local nbgIndex = 1 +while nbgIndex <= #named_backgrounds do + createBackgroundIfExists(named_backgrounds[nbgIndex], string.gsub(named_backgrounds[nbgIndex], "_", "-")) + nbgIndex = nbgIndex + 1 end -- in order, the colors are: diff --git a/scene/credits.lua b/scene/credits.lua index 63fbc98..f37301d 100644 --- a/scene/credits.lua +++ b/scene/credits.lua @@ -33,7 +33,7 @@ function CreditsScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds[19], + fetchBackgroundAndLoop(id), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/game_config.lua b/scene/game_config.lua index 2276ad6..597a33a 100644 --- a/scene/game_config.lua +++ b/scene/game_config.lua @@ -46,7 +46,7 @@ end function ConfigScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds["game_config"], + fetchBackgroundAndLoop("options_game"), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/input_config.lua b/scene/input_config.lua index 7b488f8..7909f33 100644 --- a/scene/input_config.lua +++ b/scene/input_config.lua @@ -21,7 +21,7 @@ function ConfigScene:update() end function ConfigScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds["input_config"], + fetchBackgroundAndLoop("options_input"), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/key_config.lua b/scene/key_config.lua index 419ebb5..f025bd9 100644 --- a/scene/key_config.lua +++ b/scene/key_config.lua @@ -46,7 +46,7 @@ end function KeyConfigScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds["input_config"], + fetchBackgroundAndLoop("input_config"), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/mode_select.lua b/scene/mode_select.lua index b394896..015cc0f 100755 --- a/scene/mode_select.lua +++ b/scene/mode_select.lua @@ -59,7 +59,7 @@ end function ModeSelectScene:render() love.graphics.draw( - backgrounds[0], + fetchBackgroundAndLoop(0), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/replay_select.lua b/scene/replay_select.lua index 5655df7..a120918 100644 --- a/scene/replay_select.lua +++ b/scene/replay_select.lua @@ -75,7 +75,7 @@ end function ReplaySelectScene:render() love.graphics.draw( - backgrounds[0], + fetchBackgroundAndLoop(0), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/settings.lua b/scene/settings.lua index eaa7361..14d7282 100644 --- a/scene/settings.lua +++ b/scene/settings.lua @@ -30,7 +30,7 @@ function SettingsScene:update() end function SettingsScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds["game_config"], + fetchBackgroundAndLoop("options_game"), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/stick_config.lua b/scene/stick_config.lua index 3e7be01..7c68d23 100644 --- a/scene/stick_config.lua +++ b/scene/stick_config.lua @@ -47,7 +47,7 @@ end function StickConfigScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds["input_config"], + fetchBackgroundAndLoop("options_input"), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/title.lua b/scene/title.lua index 35bbc82..72978fa 100644 --- a/scene/title.lua +++ b/scene/title.lua @@ -74,7 +74,7 @@ function TitleScene:render() love.graphics.setFont(font_3x5_4) love.graphics.setColor(1, 1, 1, 1 - self.snow_bg_opacity) love.graphics.draw( - backgrounds["title_no_icon"], -- title, title_night + fetchBackgroundAndLoop("title_no_icon"), -- title, title_night 0, 0, 0, 0.5, 0.5 ) @@ -100,7 +100,7 @@ function TitleScene:render() love.graphics.setFont(font_3x5_2) love.graphics.setColor(1, 1, 1, self.snow_bg_opacity) love.graphics.draw( - backgrounds["snow"], + fetchBackgroundAndLoop("snow"), 0, 0, 0, 0.5, 0.5 ) diff --git a/scene/tuning.lua b/scene/tuning.lua index ef0f4ee..738d22c 100644 --- a/scene/tuning.lua +++ b/scene/tuning.lua @@ -35,7 +35,7 @@ end function TuningScene:render() love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds["game_config"], + fetchBackgroundAndLoop("options_game"), 0, 0, 0, 0.5, 0.5 ) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index a24e1a5..1179d20 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -980,10 +980,10 @@ end function GameMode:drawBackground() local id = self:getBackground() - if type(id) == "number" then id = clamp(id, 0, #backgrounds) end + -- if type(id) == "number" then id = clamp(id, 0, #backgrounds) end love.graphics.setColor(1, 1, 1, 1) love.graphics.draw( - backgrounds[id], + fetchBackgroundAndLoop(id), 0, 0, 0, 0.5, 0.5 ) From 4769daedf4bc55d2846defb8206245c2ccc71ef8 Mon Sep 17 00:00:00 2001 From: aur9ra <93367045+aur9ra@users.noreply.github.com> Date: Fri, 14 Jul 2023 22:50:16 -0700 Subject: [PATCH 32/53] Added show invis support to replays. --- scene/replay.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scene/replay.lua b/scene/replay.lua index d72eed6..527bb12 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -11,6 +11,7 @@ function ReplayScene:new(replay, game_mode, ruleset) if replay["das_cut_delay"] then config.dcd = replay["das_cut_delay"] end love.math.setRandomSeed(replay["random_low"], replay["random_high"]) love.math.setRandomState(replay["random_state"]) + self.game_mode = game_mode self.retry_replay = replay self.retry_mode = game_mode self.retry_ruleset = ruleset @@ -37,6 +38,7 @@ function ReplayScene:new(replay, game_mode, ruleset) self.replay = deepcopy(replay) self.replay_index = 1 self.replay_speed = 1 + self.show_invisible = false DiscordRPC:update({ details = "Viewing a replay", state = self.game.name, @@ -92,6 +94,12 @@ function ReplayScene:render() else love.graphics.printf("?? PAUSES (--:--.--)", 0, pauses_y_coordinate, 635, "right") end + if self.show_invisible then + self.game.grid:draw() + love.graphics.setColor(1, 1, 1, 1) + love.graphics.setFont(font_3x5_3) + love.graphics.printf("SHOW INVIS", 64, 60, 160, "center") + end end function ReplayScene:onInputPress(e) @@ -124,6 +132,8 @@ function ReplayScene:onInputPress(e) if self.replay_speed > 99 then self.replay_speed = 99 end + elseif e.input == "hold" then + self.show_invisible = not self.show_invisible end end From 02f314997dfec59ea12aa2b2fcc57e4153d3523e Mon Sep 17 00:00:00 2001 From: aur9ra <93367045+aur9ra@users.noreply.github.com> Date: Fri, 14 Jul 2023 22:55:10 -0700 Subject: [PATCH 33/53] Removed unnecessary change --- scene/replay.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/scene/replay.lua b/scene/replay.lua index 527bb12..cf1cd78 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -11,7 +11,6 @@ function ReplayScene:new(replay, game_mode, ruleset) if replay["das_cut_delay"] then config.dcd = replay["das_cut_delay"] end love.math.setRandomSeed(replay["random_low"], replay["random_high"]) love.math.setRandomState(replay["random_state"]) - self.game_mode = game_mode self.retry_replay = replay self.retry_mode = game_mode self.retry_ruleset = ruleset From 7199aa7ef63cd4f977d5bf9496c01b61735c37e0 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sat, 15 Jul 2023 02:18:43 -0400 Subject: [PATCH 34/53] BGM playing changes and bugfixes --- load/bgm.lua | 21 +++++++++------------ main.lua | 8 -------- scene/credits.lua | 4 +--- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/load/bgm.lua b/load/bgm.lua index 9e28b94..749aed8 100644 --- a/load/bgm.lua +++ b/load/bgm.lua @@ -7,13 +7,15 @@ bgm = { local current_bgm = nil local bgm_locked = false -local unfocused = false function switchBGM(sound, subsound) + if bgm_locked then + return + end if current_bgm ~= nil then current_bgm:stop() end - if bgm_locked or config.bgm_volume <= 0 then + if config.bgm_volume <= 0 then current_bgm = nil elseif sound ~= nil then if subsound ~= nil then @@ -67,24 +69,19 @@ function processBGMFadeout(dt) fadeout_time = 0 fading_bgm = false end - current_bgm:setVolume(fadeout_time * config.bgm_volume / total_fadeout_time) + current_bgm:setVolume( + fadeout_time * config.bgm_volume / total_fadeout_time + ) end end -function pauseBGM(f) - if f then - unfocused = true - end +function pauseBGM() if current_bgm ~= nil then current_bgm:pause() end end -function resumeBGM(f) - if f and scene.paused and unfocused then - unfocused = false - return - end +function resumeBGM() if current_bgm ~= nil then current_bgm:play() end diff --git a/main.lua b/main.lua index d6980eb..31353b1 100644 --- a/main.lua +++ b/main.lua @@ -280,14 +280,6 @@ function love.wheelmoved(x, y) scene:onInputPress({input=nil, type="wheel", x=x, y=y}) end -function love.focus(f) - if f then - resumeBGM(true) - else - pauseBGM(true) - end -end - function love.resize(w, h) GLOBAL_CANVAS:release() GLOBAL_CANVAS = love.graphics.newCanvas(w, h) diff --git a/scene/credits.lua b/scene/credits.lua index 63fbc98..62545e3 100644 --- a/scene/credits.lua +++ b/scene/credits.lua @@ -16,9 +16,7 @@ function CreditsScene:new() end function CreditsScene:update() - if love.window.hasFocus() then - self.frames = self.frames + 1 - end + self.frames = self.frames + 1 if self.frames >= 2100 * self.scroll_speed then playSE("mode_decide") scene = TitleScene() From 2ba3611c564120fc33aeb0bbc53fa630207929cb Mon Sep 17 00:00:00 2001 From: aur9ra <93367045+aur9ra@users.noreply.github.com> Date: Sat, 15 Jul 2023 21:28:03 -0700 Subject: [PATCH 35/53] Added support for video backgrounds --- load/graphics.lua | 84 +++++++++++++++++---------- res/backgrounds/extend_section_bg.lua | 14 +++++ 2 files changed, 66 insertions(+), 32 deletions(-) create mode 100644 res/backgrounds/extend_section_bg.lua diff --git a/load/graphics.lua b/load/graphics.lua index eb7f747..aa075c0 100644 --- a/load/graphics.lua +++ b/load/graphics.lua @@ -1,32 +1,70 @@ named_backgrounds = {"title", "title_no_icon", "title_night", "snow", "options_input", "options_game"} -backgrounds_played_recently = {} +current_playing_bgs = {} +extended_bgs = {} image_formats = {".png", ".jpg"} -local bgpath = "res/backgrounds/" +bgpath = "res/backgrounds/" +dir = love.filesystem.getDirectoryItems(bgpath) -backgrounds = {} +local backgrounds = {} + +function loadExtendedBgs() + extended_bgs = require("res.backgrounds.extend_section_bg") +end + +--error handling for if there is no extend_section_bg +if pcall(loadExtendedBgs) then end --helper method to populate backgrounds function createBackgroundIfExists(name, file_name) local format_index = 1 - --try creating image backgrounds + -- see if background is an extension of another background + if extended_bgs[file_name] ~= null then + copy_bg = extended_bgs[file_name] + copy_bg = copy_bg/100 + backgrounds[name] = backgrounds[copy_bg] + return true + end + + -- try creating image backgrounds while format_index <= #image_formats do - if love.filesystem.getInfo(bgpath.. file_name ..image_formats[format_index]) then - local tempBgPath = bgpath .. file_name .. image_formats[format_index] - backgrounds[name] = love.graphics.newImage(tempBgPath) - return true + for num, existing_file in pairs(dir) do + if existing_file == (file_name..image_formats[format_index]) then + local tempBgPath = bgpath .. file_name .. image_formats[format_index] + backgrounds[name] = love.graphics.newImage(tempBgPath) + return true + end end format_index = format_index + 1 end + -- try creating video background if love.filesystem.getInfo(bgpath .. file_name ..".ogv") then - local tempBgPath = bgpath .. file_name .. ".ogv" - backgrounds[name] = love.graphics.newVideo(tempBgPath, {["audio"] = false}) - -- you can set audio to true, but the video will not loop properly if audio extends beyond video frames - return true + for num, existing_file in pairs(dir) do + if existing_file == (file_name..".ogv") then + local tempBgPath = bgpath .. file_name .. ".ogv" + backgrounds[name] = love.graphics.newVideo(tempBgPath, {["audio"] = false}) + -- you can set audio to true, but the video will not loop properly if audio extends beyond video frames + return true + end + end + end + return false +end + +function StopOtherBgs(bg) + if #current_playing_bgs == 0 and bg:typeOf("Video") then + current_playing_bgs[#current_playing_bgs+1] = bg + end + + if #current_playing_bgs >= 1 then + while current_playing_bgs[1] ~= bg and #current_playing_bgs >= 1 do + current_playing_bgs[1]:pause() + current_playing_bgs[1]:rewind() + table.remove(current_playing_bgs, 1) + end end - return false end function fetchBackgroundAndLoop(id) @@ -35,27 +73,9 @@ function fetchBackgroundAndLoop(id) if bg:typeOf("Video") and not bg:isPlaying() then bg:rewind() bg:play() - if (not backgrounds_played_recently[1] == bg) or backgrounds_played_recently[1] == nil then - table.insert(backgrounds_played_recently, 1, bg) - print(id) - end end - --if background is not loaded, rewind it and pause it - if #backgrounds_played_recently >= 1 then - if backgrounds_played_recently[1] == bg and #backgrounds_played_recently >= 2 then - print("!") - backgrounds_played_recently[2]:pause() - backgrounds_played_recently[2]:rewind() - table.remove(backgrounds_played_recently, 2) - print("Unloaded video #2") - elseif not backgrounds_played_recently[1] == bg then - backgrounds_played_recently[1]:pause() - backgrounds_played_recently[1]:rewind() - table.remove(backgrounds_played_recently, 1) - print("Unloaded most recently played") - end - end + StopOtherBgs(bg) return bg end diff --git a/res/backgrounds/extend_section_bg.lua b/res/backgrounds/extend_section_bg.lua new file mode 100644 index 0000000..33dbb4c --- /dev/null +++ b/res/backgrounds/extend_section_bg.lua @@ -0,0 +1,14 @@ +-- ex: extend_section_bg[100] = 0 +-- extend_section_bg[200] = 0 +-- the video background associated with section 0 will continue playing into 100 and 200 without restarting. +-- will also cause any existing level 100, 200 backgrounds specified to NOT render. + +-- please also note that you cannot currently extend any "named" backgrounds, such as "title" and "options-input" + +extend_section_bg = {} + +-- extend_section_bg[100] = 0 +-- extend_section_bg[200] = 0 +-- remove the dashes + +return extend_section_bg \ No newline at end of file From c693871621ae0bd9bc716be48e07c3c623649aeb Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 16 Jul 2023 00:46:45 -0400 Subject: [PATCH 36/53] Added error handling in the case of a corrupt replay --- scene/replay_select.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scene/replay_select.lua b/scene/replay_select.lua index 5655df7..6857dcf 100644 --- a/scene/replay_select.lua +++ b/scene/replay_select.lua @@ -14,8 +14,12 @@ function ReplaySelectScene:new() replay_file_list = love.filesystem.getDirectoryItems("replays") for i=1,#replay_file_list do local data = love.filesystem.read("replays/"..replay_file_list[i]) - local new_replay = binser.deserialize(data)[1] - replays[#replays + 1] = new_replay + local success, new_replay = pcall( + function() return binser.deserialize(data)[1] end + ) + if success then + replays[#replays + 1] = new_replay + end end table.sort(replays, function(a, b) return a["timestamp"] > b["timestamp"] From 1556b247fe40a4ed28408c8b04feec04c3417492 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 16 Jul 2023 01:06:06 -0400 Subject: [PATCH 37/53] Style fixes for last pull request --- load/graphics.lua | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/load/graphics.lua b/load/graphics.lua index aa075c0..df97541 100644 --- a/load/graphics.lua +++ b/load/graphics.lua @@ -1,4 +1,7 @@ -named_backgrounds = {"title", "title_no_icon", "title_night", "snow", "options_input", "options_game"} +named_backgrounds = { + "title", "title_no_icon", "title_night", + "snow", "options_input", "options_game" +} current_playing_bgs = {} extended_bgs = {} image_formats = {".png", ".jpg"} @@ -7,21 +10,21 @@ dir = love.filesystem.getDirectoryItems(bgpath) local backgrounds = {} -function loadExtendedBgs() +local function loadExtendedBgs() extended_bgs = require("res.backgrounds.extend_section_bg") end ---error handling for if there is no extend_section_bg +-- error handling for if there is no extend_section_bg if pcall(loadExtendedBgs) then end ---helper method to populate backgrounds -function createBackgroundIfExists(name, file_name) +-- helper method to populate backgrounds +local function createBackgroundIfExists(name, file_name) local format_index = 1 -- see if background is an extension of another background - if extended_bgs[file_name] ~= null then + if extended_bgs[file_name] ~= nil then copy_bg = extended_bgs[file_name] - copy_bg = copy_bg/100 + copy_bg = copy_bg / 100 backgrounds[name] = backgrounds[copy_bg] return true end @@ -39,12 +42,15 @@ function createBackgroundIfExists(name, file_name) end -- try creating video background - if love.filesystem.getInfo(bgpath .. file_name ..".ogv") then + if love.filesystem.getInfo(bgpath .. file_name .. ".ogv") then for num, existing_file in pairs(dir) do if existing_file == (file_name..".ogv") then local tempBgPath = bgpath .. file_name .. ".ogv" - backgrounds[name] = love.graphics.newVideo(tempBgPath, {["audio"] = false}) - -- you can set audio to true, but the video will not loop properly if audio extends beyond video frames + backgrounds[name] = love.graphics.newVideo( + tempBgPath, {["audio"] = false} + ) + -- you can set audio to true, but the video will not loop + -- properly if audio extends beyond video frames return true end end @@ -52,7 +58,7 @@ function createBackgroundIfExists(name, file_name) return false end -function StopOtherBgs(bg) +local function stopOtherBgs(bg) if #current_playing_bgs == 0 and bg:typeOf("Video") then current_playing_bgs[#current_playing_bgs+1] = bg end @@ -75,21 +81,24 @@ function fetchBackgroundAndLoop(id) bg:play() end - StopOtherBgs(bg) + stopOtherBgs(bg) return bg end ---create section backgrounds +-- create section backgrounds local section = 0 while (createBackgroundIfExists(section, section*100)) do section = section + 1 end ---create named backgrounds +-- create named backgrounds local nbgIndex = 1 while nbgIndex <= #named_backgrounds do - createBackgroundIfExists(named_backgrounds[nbgIndex], string.gsub(named_backgrounds[nbgIndex], "_", "-")) + createBackgroundIfExists( + named_backgrounds[nbgIndex], + string.gsub(named_backgrounds[nbgIndex], "_", "-") + ) nbgIndex = nbgIndex + 1 end From 2166a3c6d84c6c4467d6cff9df878467f81e42c5 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 16 Jul 2023 01:49:26 -0400 Subject: [PATCH 38/53] Added support for backgrounds that are not 1280x960 --- load/graphics.lua | 15 ++++++++++++++- scene/credits.lua | 6 +----- scene/game_config.lua | 6 +----- scene/input_config.lua | 6 +----- scene/key_config.lua | 6 +----- scene/mode_select.lua | 6 +----- scene/replay_select.lua | 6 +----- scene/settings.lua | 6 +----- scene/stick_config.lua | 6 +----- scene/title.lua | 12 ++---------- scene/tuning.lua | 6 +----- tetris/modes/gamemode.lua | 6 +----- 12 files changed, 26 insertions(+), 61 deletions(-) diff --git a/load/graphics.lua b/load/graphics.lua index df97541..6fb160e 100644 --- a/load/graphics.lua +++ b/load/graphics.lua @@ -197,4 +197,17 @@ misc_graphics = { strike = love.graphics.newImage("res/img/strike.png"), santa = love.graphics.newImage("res/img/santa.png"), icon = love.graphics.newImage("res/img/cambridge_transparent.png") -} \ No newline at end of file +} + +-- utility function to allow any size background to be used +-- this will stretch the background to 4:3 aspect ratio +function drawBackground(id) + local bg_object = fetchBackgroundAndLoop(id) + local width = bg_object:getWidth() + local height = bg_object:getHeight() + love.graphics.draw( + bg_object, + 0, 0, 0, + 640 / width, 480 / height + ) +end \ No newline at end of file diff --git a/scene/credits.lua b/scene/credits.lua index fdede66..eacc9d5 100644 --- a/scene/credits.lua +++ b/scene/credits.lua @@ -30,11 +30,7 @@ function CreditsScene:render() local offset = self.frames / self.scroll_speed love.graphics.setColor(1, 1, 1, 1) - love.graphics.draw( - fetchBackgroundAndLoop(id), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground(19) love.graphics.setFont(font_3x5_4) love.graphics.print("Cambridge Credits", 320, 500 - offset) diff --git a/scene/game_config.lua b/scene/game_config.lua index 597a33a..68b4aff 100644 --- a/scene/game_config.lua +++ b/scene/game_config.lua @@ -45,11 +45,7 @@ end function ConfigScene:render() love.graphics.setColor(1, 1, 1, 1) - love.graphics.draw( - fetchBackgroundAndLoop("options_game"), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground("options_game") love.graphics.setFont(font_3x5_4) love.graphics.print("GAME SETTINGS", 80, 40) diff --git a/scene/input_config.lua b/scene/input_config.lua index 7909f33..230c514 100644 --- a/scene/input_config.lua +++ b/scene/input_config.lua @@ -20,11 +20,7 @@ function ConfigScene:update() end function ConfigScene:render() love.graphics.setColor(1, 1, 1, 1) - love.graphics.draw( - fetchBackgroundAndLoop("options_input"), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground("options_input") love.graphics.setFont(font_3x5_4) love.graphics.print("INPUT CONFIG", 80, 40) diff --git a/scene/key_config.lua b/scene/key_config.lua index f025bd9..ce32226 100644 --- a/scene/key_config.lua +++ b/scene/key_config.lua @@ -45,11 +45,7 @@ end function KeyConfigScene:render() love.graphics.setColor(1, 1, 1, 1) - love.graphics.draw( - fetchBackgroundAndLoop("input_config"), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground("input_config") love.graphics.setFont(font_3x5_2) for i, input in ipairs(configurable_inputs) do diff --git a/scene/mode_select.lua b/scene/mode_select.lua index 015cc0f..329de3c 100755 --- a/scene/mode_select.lua +++ b/scene/mode_select.lua @@ -58,11 +58,7 @@ function ModeSelectScene:update() end function ModeSelectScene:render() - love.graphics.draw( - fetchBackgroundAndLoop(0), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground(0) love.graphics.draw(misc_graphics["select_mode"], 20, 40) diff --git a/scene/replay_select.lua b/scene/replay_select.lua index 0d4c30b..aecb468 100644 --- a/scene/replay_select.lua +++ b/scene/replay_select.lua @@ -78,11 +78,7 @@ function ReplaySelectScene:update() end function ReplaySelectScene:render() - love.graphics.draw( - fetchBackgroundAndLoop(0), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground(0) -- Same graphic as mode select --love.graphics.draw(misc_graphics["select_mode"], 20, 40) diff --git a/scene/settings.lua b/scene/settings.lua index 14d7282..a51d8c1 100644 --- a/scene/settings.lua +++ b/scene/settings.lua @@ -29,11 +29,7 @@ function SettingsScene:update() end function SettingsScene:render() love.graphics.setColor(1, 1, 1, 1) - love.graphics.draw( - fetchBackgroundAndLoop("options_game"), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground("options_game") love.graphics.setFont(font_3x5_4) love.graphics.print("SETTINGS", 80, 40) diff --git a/scene/stick_config.lua b/scene/stick_config.lua index 7c68d23..d8bc03c 100644 --- a/scene/stick_config.lua +++ b/scene/stick_config.lua @@ -46,11 +46,7 @@ end function StickConfigScene:render() love.graphics.setColor(1, 1, 1, 1) - love.graphics.draw( - fetchBackgroundAndLoop("options_input"), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground("options_input") love.graphics.setFont(font_3x5_2) for i, input in ipairs(configurable_inputs) do diff --git a/scene/title.lua b/scene/title.lua index 72978fa..06a28ec 100644 --- a/scene/title.lua +++ b/scene/title.lua @@ -73,11 +73,7 @@ local block_offsets = { function TitleScene:render() love.graphics.setFont(font_3x5_4) love.graphics.setColor(1, 1, 1, 1 - self.snow_bg_opacity) - love.graphics.draw( - fetchBackgroundAndLoop("title_no_icon"), -- title, title_night - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground("title_no_icon"), -- title, title_night -- 490, 192 for _, b in ipairs(block_offsets) do @@ -99,11 +95,7 @@ function TitleScene:render() love.graphics.setFont(font_3x5_2) love.graphics.setColor(1, 1, 1, self.snow_bg_opacity) - love.graphics.draw( - fetchBackgroundAndLoop("snow"), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground("snow") love.graphics.draw( misc_graphics["santa"], diff --git a/scene/tuning.lua b/scene/tuning.lua index 738d22c..42bc65a 100644 --- a/scene/tuning.lua +++ b/scene/tuning.lua @@ -34,11 +34,7 @@ end function TuningScene:render() love.graphics.setColor(1, 1, 1, 1) - love.graphics.draw( - fetchBackgroundAndLoop("options_game"), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground("options_game") love.graphics.setColor(1, 1, 1, 0.5) love.graphics.rectangle("fill", 75, 98 + self.highlight * 75, 400, 33) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 1179d20..9123e59 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -982,11 +982,7 @@ function GameMode:drawBackground() local id = self:getBackground() -- if type(id) == "number" then id = clamp(id, 0, #backgrounds) end love.graphics.setColor(1, 1, 1, 1) - love.graphics.draw( - fetchBackgroundAndLoop(id), - 0, 0, 0, - 0.5, 0.5 - ) + drawBackground(id) end function GameMode:drawFrame() From 91c8dc3dcc958d235f2150119e5420dd3af51d65 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 16 Jul 2023 01:50:42 -0400 Subject: [PATCH 39/53] Bump version to v0.3.3.3 --- load/version.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load/version.lua b/load/version.lua index 627db68..7638b7e 100644 --- a/load/version.lua +++ b/load/version.lua @@ -1 +1 @@ -version = "v0.3.3.2" \ No newline at end of file +version = "v0.3.3.3" \ No newline at end of file From 6fb583e46372f5411b0c3386a939fc9e193c8bfd Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 16 Jul 2023 01:52:02 -0400 Subject: [PATCH 40/53] Typo fix --- scene/title.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/title.lua b/scene/title.lua index 06a28ec..d48be7c 100644 --- a/scene/title.lua +++ b/scene/title.lua @@ -73,7 +73,7 @@ local block_offsets = { function TitleScene:render() love.graphics.setFont(font_3x5_4) love.graphics.setColor(1, 1, 1, 1 - self.snow_bg_opacity) - drawBackground("title_no_icon"), -- title, title_night + drawBackground("title_no_icon") -- title, title_night -- 490, 192 for _, b in ipairs(block_offsets) do From 50410958f0016d8b47d4ee77956e4f711e9227c6 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 16 Jul 2023 01:54:20 -0400 Subject: [PATCH 41/53] Re-add clamp for backgrounds beyond the limit --- load/graphics.lua | 2 +- tetris/modes/gamemode.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/load/graphics.lua b/load/graphics.lua index 6fb160e..b2f3e12 100644 --- a/load/graphics.lua +++ b/load/graphics.lua @@ -8,7 +8,7 @@ image_formats = {".png", ".jpg"} bgpath = "res/backgrounds/" dir = love.filesystem.getDirectoryItems(bgpath) -local backgrounds = {} +backgrounds = {} local function loadExtendedBgs() extended_bgs = require("res.backgrounds.extend_section_bg") diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 9123e59..980f00f 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -980,7 +980,7 @@ end function GameMode:drawBackground() local id = self:getBackground() - -- if type(id) == "number" then id = clamp(id, 0, #backgrounds) end + if type(id) == "number" then id = clamp(id, 0, #backgrounds) end love.graphics.setColor(1, 1, 1, 1) drawBackground(id) end From 2a2148413775d1524bda1f8faad544ab0de932b3 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 16 Jul 2023 02:02:55 -0400 Subject: [PATCH 42/53] Bump version to v0.3.4 --- load/version.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load/version.lua b/load/version.lua index 7638b7e..cca4f97 100644 --- a/load/version.lua +++ b/load/version.lua @@ -1 +1 @@ -version = "v0.3.3.3" \ No newline at end of file +version = "v0.3.4" \ No newline at end of file From a1f0dfd9f24cc2c527f353004370a66638428cb1 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 16 Jul 2023 18:40:10 -0400 Subject: [PATCH 43/53] Hotfix: Key config screen draws the correct background --- scene/key_config.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/key_config.lua b/scene/key_config.lua index ce32226..a062b2e 100644 --- a/scene/key_config.lua +++ b/scene/key_config.lua @@ -45,7 +45,7 @@ end function KeyConfigScene:render() love.graphics.setColor(1, 1, 1, 1) - drawBackground("input_config") + drawBackground("options_input") love.graphics.setFont(font_3x5_2) for i, input in ipairs(configurable_inputs) do From 39e9dc33035d1ce4522934768e3dae72e8db5132 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Fri, 21 Jul 2023 22:55:00 -0400 Subject: [PATCH 44/53] Fixed pressing F8 twice at the title screen --- main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.lua b/main.lua index 31353b1..977593d 100644 --- a/main.lua +++ b/main.lua @@ -113,7 +113,7 @@ function love.keypressed(key, scancode) saveConfig() scene.restart_message = true if config.secret then playSE("mode_decide") - else playSE("erase") end + else playSE("erase", "single") end -- f12 is reserved for saving screenshots elseif scancode == "f12" then local ss_name = os.date("ss/%Y-%m-%d_%H-%M-%S.png") From ba6f5bb8379805858f3c2f2ea5a6696c6c571706 Mon Sep 17 00:00:00 2001 From: infinifen <48841404+infinifen@users.noreply.github.com> Date: Sat, 22 Jul 2023 13:21:21 +0200 Subject: [PATCH 45/53] Fix a typo causing crashes in Survival 2020 level 1500+ --- tetris/modes/survival_2020.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tetris/modes/survival_2020.lua b/tetris/modes/survival_2020.lua index d27109e..dd9f9d0 100644 --- a/tetris/modes/survival_2020.lua +++ b/tetris/modes/survival_2020.lua @@ -201,7 +201,7 @@ end Survival2020Game.opacityFunction = function(age) if age > 300 then return 0 - else return 1 - Math.max(age - 240, 0) / 60 end + else return 1 - math.max(age - 240, 0) / 60 end end function Survival2020Game:drawGrid() From e69659b2adab6582eab0478eb3c8821fa43aa416 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Wed, 26 Jul 2023 05:20:55 -0400 Subject: [PATCH 46/53] Changed the order of the image extensions list To avoid Funny Stuff --- load/graphics.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/load/graphics.lua b/load/graphics.lua index b2f3e12..154b886 100644 --- a/load/graphics.lua +++ b/load/graphics.lua @@ -4,7 +4,7 @@ named_backgrounds = { } current_playing_bgs = {} extended_bgs = {} -image_formats = {".png", ".jpg"} +image_formats = {".jpg", ".png"} bgpath = "res/backgrounds/" dir = love.filesystem.getDirectoryItems(bgpath) From cd904058650a7ecdf96e18e23247ec3ae2e0f0e1 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Thu, 27 Jul 2023 06:00:48 -0400 Subject: [PATCH 47/53] Simplified Big A2 code --- tetris/modes/big_a2.lua | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/tetris/modes/big_a2.lua b/tetris/modes/big_a2.lua index 73d8034..51d06ff 100755 --- a/tetris/modes/big_a2.lua +++ b/tetris/modes/big_a2.lua @@ -10,41 +10,10 @@ BigA2Game.tagline = "Big blocks in the most celebrated TGM mode!" function BigA2Game:new() BigA2Game.super:new() self.big_mode = true -end - -function BigA2Game:updateScore(level, drop_bonus, cleared_lines) - cleared_lines = cleared_lines / 2 - if not self.clear then - self:updateGrade(cleared_lines) - if cleared_lines >= 4 then - self.tetris_count = self.tetris_count + 1 - end - if self.grid:checkForBravo(cleared_lines) then self.bravo = 4 else self.bravo = 1 end - if cleared_lines > 0 then - self.combo = self.combo + (cleared_lines - 1) * 2 - self.score = self.score + ( - (math.ceil((level + cleared_lines) / 4) + drop_bonus) * - cleared_lines * self.combo * self.bravo - ) - else - self.combo = 1 - end - self.drop_bonus = 0 - else self.lines = self.lines + cleared_lines end -end - -function BigA2Game:onLineClear(cleared_row_count) - cleared_row_count = cleared_row_count / 2 - self:updateSectionTimes(self.level, self.level + cleared_row_count) - self.level = math.min(self.level + cleared_row_count, 999) - if self.level == 999 and not self.clear then - self.clear = true - self.grid:clear() - if self:qualifiesForMRoll() then self.grade = 32 end - self.roll_frames = -150 + local getClearedRowCount = self.grid.getClearedRowCount + self.grid.getClearedRowCount = function(self) + return getClearedRowCount(self) / 2 end - self.lock_drop = self.level >= 900 - self.lock_hard_drop = self.level >= 900 end return BigA2Game \ No newline at end of file From a79552a6f324eab918278ca5c2adc01c32acff83 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sun, 30 Jul 2023 04:53:23 -0400 Subject: [PATCH 48/53] Pitching BGM added and implemented in replays --- load/bgm.lua | 9 +++++++++ scene/game.lua | 1 + scene/replay.lua | 4 ++++ scene/replay_select.lua | 2 -- tetris/modes/gamemode.lua | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/load/bgm.lua b/load/bgm.lua index 749aed8..feb075d 100644 --- a/load/bgm.lua +++ b/load/bgm.lua @@ -6,6 +6,7 @@ bgm = { } local current_bgm = nil +local pitch = 1 local bgm_locked = false function switchBGM(sound, subsound) @@ -84,5 +85,13 @@ end function resumeBGM() if current_bgm ~= nil then current_bgm:play() + current_bgm:setPitch(pitch) + end +end + +function pitchBGM(new_pitch) + pitch = new_pitch + if current_bgm ~= nil then + current_bgm:setPitch(pitch) end end diff --git a/scene/game.lua b/scene/game.lua index d941114..21e4c91 100644 --- a/scene/game.lua +++ b/scene/game.lua @@ -81,6 +81,7 @@ function GameScene:onInputPress(e) scene = e.input == "retry" and GameScene(self.retry_mode, self.retry_ruleset, self.secret_inputs) or ModeSelectScene() elseif e.input == "retry" then switchBGM(nil) + pitchBGM(1) self.game:onExit() 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 diff --git a/scene/replay.lua b/scene/replay.lua index cf1cd78..a9af502 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -107,6 +107,8 @@ function ReplayScene:onInputPress(e) e.input == "menu_decide" or e.input == "retry" ) then + switchBGM(nil) + pitchBGM(1) self.game:onExit() loadSave() love.math.setRandomSeed(os.time()) @@ -126,11 +128,13 @@ function ReplayScene:onInputPress(e) if self.replay_speed < 1 then self.replay_speed = 1 end + pitchBGM(self.replay_speed) elseif e.input == "right" then self.replay_speed = self.replay_speed + 1 if self.replay_speed > 99 then self.replay_speed = 99 end + pitchBGM(self.replay_speed) elseif e.input == "hold" then self.show_invisible = not self.show_invisible end diff --git a/scene/replay_select.lua b/scene/replay_select.lua index aecb468..4101075 100644 --- a/scene/replay_select.lua +++ b/scene/replay_select.lua @@ -47,8 +47,6 @@ function ReplaySelectScene:new() end function ReplaySelectScene:update() - switchBGM(nil) -- experimental - if self.das_up or self.das_down or self.das_left or self.das_right then self.das = self.das + 1 else diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 980f00f..7bebb06 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -400,6 +400,7 @@ end function GameMode:onGameOver() switchBGM(nil) + pitchBGM(1) local alpha = 0 local animation_length = 120 if self.game_over_frames < animation_length then From 4caa268adc6fd2de9b07ec348285c9ee5e0339fd Mon Sep 17 00:00:00 2001 From: Kirby703 <14858059+Kirby703@users.noreply.github.com> Date: Sun, 13 Aug 2023 13:51:36 -0400 Subject: [PATCH 49/53] easter egg scholars remain divided on whether 15640 frames should also be rounded up so as to never jump by .03, or whether it should remain rounded down so as to only have one exceptional timestamp rather than two --- funcs.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/funcs.lua b/funcs.lua index dfd8aa3..831e97f 100644 --- a/funcs.lua +++ b/funcs.lua @@ -60,6 +60,9 @@ function formatTime(frames) min = math.floor(frames/3600) sec = math.floor(frames/60) % 60 hund = math.floor(frames/.6) % 100 + if frames == 15641 then + hund = math.ceil(frames/.6) % 100 + end str = string.format("%02d:%02d.%02d", min, sec, hund) return str end From 649dd5f31d3665f74eafd12e34831504fb49729a Mon Sep 17 00:00:00 2001 From: Tetro48 <76738929+Tetro48@users.noreply.github.com> Date: Mon, 14 Aug 2023 21:46:00 +0700 Subject: [PATCH 50/53] Added frame stepping for replays `menu_decide` for frame step action is temporary --- scene/replay.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scene/replay.lua b/scene/replay.lua index a9af502..f37bd3b 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -38,6 +38,7 @@ function ReplayScene:new(replay, game_mode, ruleset) self.replay_index = 1 self.replay_speed = 1 self.show_invisible = false + self.frame_steps = 0 DiscordRPC:update({ details = "Viewing a replay", state = self.game.name, @@ -47,7 +48,10 @@ end function ReplayScene:update() local frames_left = self.replay_speed - if not self.paused then + if not self.paused or self.frame_steps > 0 then + if self.frame_steps > 0 then + self.frame_steps = self.frame_steps - 1 + end while frames_left > 0 do frames_left = frames_left - 1 self.inputs = self.replay["inputs"][self.replay_index]["inputs"] @@ -123,6 +127,9 @@ function ReplayScene:onInputPress(e) self.paused = not self.paused if self.paused then pauseBGM() else resumeBGM() end + --frame step + elseif e.input == "menu_decide" then + self.frame_steps = self.frame_steps + 1 elseif e.input == "left" then self.replay_speed = self.replay_speed - 1 if self.replay_speed < 1 then From 635ef6270f5a162393063681a58f7ae0ecb46425 Mon Sep 17 00:00:00 2001 From: Tetro48 <76738929+Tetro48@users.noreply.github.com> Date: Mon, 14 Aug 2023 21:52:22 +0700 Subject: [PATCH 51/53] Changed frame step input to `rotate_left` --- scene/replay.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/replay.lua b/scene/replay.lua index f37bd3b..d6f7d18 100644 --- a/scene/replay.lua +++ b/scene/replay.lua @@ -128,7 +128,7 @@ function ReplayScene:onInputPress(e) if self.paused then pauseBGM() else resumeBGM() end --frame step - elseif e.input == "menu_decide" then + elseif e.input == "rotate_left" then self.frame_steps = self.frame_steps + 1 elseif e.input == "left" then self.replay_speed = self.replay_speed - 1 From 52ddbbc1743a9d47b029293085227e12ce8290da Mon Sep 17 00:00:00 2001 From: aur9ra <93367045+aur9ra@users.noreply.github.com> Date: Sun, 20 Aug 2023 22:22:36 -0700 Subject: [PATCH 52/53] Ensure replays are only saved once per game --- tetris/modes/gamemode.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index 7bebb06..0e127af 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -179,6 +179,9 @@ function GameMode:update(inputs, ruleset) if self.game_over or self.completed then if self.save_replay and self.game_over_frames == 0 then self:saveReplay() + + -- ensure replays are only saved once per game, incase self.game_over_frames == 0 for longer than one frame + self.save_replay = false end self.game_over_frames = self.game_over_frames + 1 return From 8062f6e3fabe4964ae583611379a79c17895228b Mon Sep 17 00:00:00 2001 From: Aymir Dmitrievich Danilov <76738929+Tetro48@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:33:25 +0700 Subject: [PATCH 53/53] Patch standard.lua to prevent midair lock --- tetris/rulesets/standard.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tetris/rulesets/standard.lua b/tetris/rulesets/standard.lua index 8a8a841..0013277 100644 --- a/tetris/rulesets/standard.lua +++ b/tetris/rulesets/standard.lua @@ -93,6 +93,8 @@ function SRS:onPieceMove(piece, grid) if piece.manipulations >= SRS.MANIPULATIONS_MAX then piece.locked = true end + else + piece.locked = false end end