mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 12:59:02 -06:00
Major changes, including modpack support
This commit is contained in:
parent
9b89c4d1de
commit
3641d85fcb
22
main.lua
22
main.lua
@ -30,6 +30,28 @@ function love.load()
|
||||
if config.current_ruleset then current_ruleset = config.current_ruleset end
|
||||
scene = TitleScene()
|
||||
end
|
||||
|
||||
game_modes = {}
|
||||
mode_list = love.filesystem.getDirectoryItems("tetris/modes")
|
||||
for i=1,#mode_list do
|
||||
if(mode_list[i] ~= "gamemode.lua" and mode_list[i] ~= "unrefactored_modes") then
|
||||
game_modes[#game_modes+1] = require ("tetris.modes."..string.sub(mode_list[i],1,-5))
|
||||
end
|
||||
end
|
||||
rulesets = {}
|
||||
rule_list = love.filesystem.getDirectoryItems("tetris/rulesets")
|
||||
for i=1,#rule_list do
|
||||
if(rule_list[i] ~= "ruleset.lua" and rule_list[i] ~= "unrefactored_rulesets") then
|
||||
rulesets[#rulesets+1] = require ("tetris.rulesets."..string.sub(rule_list[i],1,-5))
|
||||
end
|
||||
end
|
||||
--sort mode/rule lists
|
||||
local function padnum(d) return ("%03d%s"):format(#d, d) end
|
||||
table.sort(game_modes, function(a,b)
|
||||
return tostring(a.name):gsub("%d+",padnum) < tostring(b.name):gsub("%d+",padnum) end)
|
||||
table.sort(rulesets, function(a,b)
|
||||
return tostring(a.name):gsub("%d+",padnum) < tostring(b.name):gsub("%d+",padnum) end)
|
||||
|
||||
end
|
||||
|
||||
local TARGET_FPS = 60
|
||||
|
@ -5,45 +5,6 @@ ModeSelectScene.title = "Game Start"
|
||||
current_mode = 1
|
||||
current_ruleset = 1
|
||||
|
||||
game_modes = {
|
||||
require 'tetris.modes.marathon_2020',
|
||||
require 'tetris.modes.survival_2020',
|
||||
require 'tetris.modes.ck',
|
||||
--require 'tetris.modes.strategy',
|
||||
--require 'tetris.modes.interval_training',
|
||||
--require 'tetris.modes.pacer_test',
|
||||
require 'tetris.modes.demon_mode',
|
||||
require 'tetris.modes.phantom_mania',
|
||||
require 'tetris.modes.phantom_mania2',
|
||||
require 'tetris.modes.phantom_mania_n',
|
||||
require 'tetris.modes.race_40',
|
||||
require 'tetris.modes.marathon_a1',
|
||||
require 'tetris.modes.marathon_a2',
|
||||
require 'tetris.modes.marathon_a3',
|
||||
require 'tetris.modes.marathon_ax4',
|
||||
require 'tetris.modes.marathon_c89',
|
||||
require 'tetris.modes.survival_a1',
|
||||
require 'tetris.modes.survival_a2',
|
||||
require 'tetris.modes.survival_a3',
|
||||
require 'tetris.modes.big_a2',
|
||||
require 'tetris.modes.konoha',
|
||||
require 'tetris.modes.tgmplus',
|
||||
}
|
||||
|
||||
rulesets = {
|
||||
require 'tetris.rulesets.cambridge',
|
||||
require 'tetris.rulesets.arika',
|
||||
require 'tetris.rulesets.arika_ti',
|
||||
require 'tetris.rulesets.ti_srs',
|
||||
require 'tetris.rulesets.arika_ace',
|
||||
require 'tetris.rulesets.arika_ace2',
|
||||
require 'tetris.rulesets.arika_srs',
|
||||
require 'tetris.rulesets.standard_exp',
|
||||
--require 'tetris.rulesets.bonkers',
|
||||
--require 'tetris.rulesets.shirase',
|
||||
--require 'tetris.rulesets.super302',
|
||||
}
|
||||
|
||||
function ModeSelectScene:new()
|
||||
self.menu_state = {
|
||||
mode = current_mode,
|
||||
@ -71,14 +32,14 @@ function ModeSelectScene:render()
|
||||
elseif self.menu_state.select == "ruleset" then
|
||||
love.graphics.setColor(1, 1, 1, 0.25)
|
||||
end
|
||||
love.graphics.rectangle("fill", 20, 78 + 20 * self.menu_state.mode, 240, 22)
|
||||
love.graphics.rectangle("fill", 20, 258, 240, 22)
|
||||
|
||||
if self.menu_state.select == "mode" then
|
||||
love.graphics.setColor(1, 1, 1, 0.25)
|
||||
elseif self.menu_state.select == "ruleset" then
|
||||
love.graphics.setColor(1, 1, 1, 0.5)
|
||||
end
|
||||
love.graphics.rectangle("fill", 340, 78 + 20 * self.menu_state.ruleset, 200, 22)
|
||||
love.graphics.rectangle("fill", 340, 258, 200, 22)
|
||||
|
||||
love.graphics.setColor(1, 1, 1, 1)
|
||||
|
||||
@ -86,10 +47,14 @@ function ModeSelectScene:render()
|
||||
|
||||
love.graphics.setFont(font_3x5_2)
|
||||
for idx, mode in pairs(game_modes) do
|
||||
love.graphics.printf(mode.name, 40, 80 + 20 * idx, 200, "left")
|
||||
if(idx >= self.menu_state.mode-9 and idx <= self.menu_state.mode+9) then
|
||||
love.graphics.printf(mode.name, 40, (260 - 20*(self.menu_state.mode)) + 20 * idx, 200, "left")
|
||||
end
|
||||
end
|
||||
for idx, ruleset in pairs(rulesets) do
|
||||
love.graphics.printf(ruleset.name, 360, 80 + 20 * idx, 160, "left")
|
||||
if(idx >= self.menu_state.ruleset-9 and idx <= self.menu_state.ruleset+9) then
|
||||
love.graphics.printf(ruleset.name, 360, (260 - 20*(self.menu_state.ruleset)) + 20 * idx, 160, "left")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
39
tetris/modes/4wide.lua
Normal file
39
tetris/modes/4wide.lua
Normal file
@ -0,0 +1,39 @@
|
||||
require 'funcs'
|
||||
|
||||
local SurvivalA3Game = require 'tetris.modes.survival_a3'
|
||||
|
||||
local FourWideGame = SurvivalA3Game:extend()
|
||||
|
||||
FourWideGame.name = "4-wide Simulator"
|
||||
FourWideGame.hash = "4wide"
|
||||
|
||||
function FourWideGame:initialize(ruleset)
|
||||
self.level = 1299
|
||||
self.super:initialize(ruleset)
|
||||
self.grid:applyFourWide()
|
||||
end
|
||||
|
||||
local cleared_row_levels = {1, 2, 4, 6}
|
||||
|
||||
function FourWideGame:onLineClear(cleared_row_count)
|
||||
if not self.clear then
|
||||
local new_level = self.level + cleared_row_levels[cleared_row_count]
|
||||
self:updateSectionTimes(self.level, new_level)
|
||||
if new_level >= 1300 or self:hitTorikan(self.level, new_level) then
|
||||
self.clear = true
|
||||
if new_level >= 1300 then
|
||||
self.level = 1300
|
||||
self.grid:clear()
|
||||
self.roll_frames = -150
|
||||
else
|
||||
self.game_over = true
|
||||
end
|
||||
else
|
||||
self.level = math.min(new_level, 1300)
|
||||
end
|
||||
self:advanceBottomRow(-cleared_row_count)
|
||||
end
|
||||
self.grid:applyFourWide()
|
||||
end
|
||||
|
||||
return FourWideGame
|
@ -3,7 +3,7 @@ require 'funcs'
|
||||
local GameMode = require 'tetris.modes.gamemode'
|
||||
local Piece = require 'tetris.components.piece'
|
||||
|
||||
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls'
|
||||
local History6RollsRandomizer = require 'tetris.randomizers.history_6rolls_35bag'
|
||||
|
||||
local IntervalTrainingGame = GameMode:extend()
|
||||
|
||||
@ -19,7 +19,7 @@ function IntervalTrainingGame:new()
|
||||
self.roll_frames = 0
|
||||
self.combo = 1
|
||||
self.randomizer = History6RollsRandomizer()
|
||||
self.section_time_limit = 1800
|
||||
|
||||
self.section_start_time = 0
|
||||
self.section_times = { [0] = 0 }
|
||||
self.lock_drop = true
|
||||
@ -27,20 +27,26 @@ function IntervalTrainingGame:new()
|
||||
self.next_queue_length = 3
|
||||
end
|
||||
|
||||
function IntervalTrainingGame:initialize(ruleset)
|
||||
self.section_time_limit = 1800
|
||||
if ruleset.world then self.section_time_limit = 37 * 60 end
|
||||
self.super.initialize(self, ruleset)
|
||||
end
|
||||
|
||||
function IntervalTrainingGame:getARE()
|
||||
return 4
|
||||
return 6
|
||||
end
|
||||
|
||||
function IntervalTrainingGame:getLineARE()
|
||||
return 4
|
||||
return 6
|
||||
end
|
||||
|
||||
function IntervalTrainingGame:getDasLimit()
|
||||
return 6
|
||||
return 7
|
||||
end
|
||||
|
||||
function IntervalTrainingGame:getLineClearDelay()
|
||||
return 6
|
||||
return 4
|
||||
end
|
||||
|
||||
function IntervalTrainingGame:getLockDelay()
|
||||
|
Loading…
Reference in New Issue
Block a user