Bump version to beta6 (also closes #19)

This commit is contained in:
Ishaan Bhardwaj 2021-07-11 14:04:22 -04:00
parent 61d5410f22
commit 7dbfe23059
9 changed files with 121 additions and 74 deletions

View File

@ -1 +1 @@
version = "v0.3-beta5.2" version = "v0.3-beta6"

View File

@ -42,36 +42,17 @@ function GameScene:update()
end end
function GameScene:render() function GameScene:render()
self.game:drawBackground() self.game:draw(self.paused)
self.game:drawFrame()
self.game:drawGrid()
if self.game:canDrawLCA() then
self.game:drawLineClearAnimation()
end
self.game:drawPiece()
self.game:drawNextQueue(self.ruleset)
self.game:drawScoringInfo()
self.game:drawReadyGo()
self.game:drawCustom()
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setFont(font_3x5_2)
if config.gamesettings.display_gamemode == 1 then
love.graphics.printf(self.game.name .. " - " .. self.ruleset.name, 0, 460, 640, "left")
end
love.graphics.setFont(font_3x5_3)
if self.paused then love.graphics.print("PAUSED!", 80, 100) end
if self.game.completed then
self.game:onGameComplete()
elseif self.game.game_over then
self.game:onGameOver()
end
end end
function GameScene:onInputPress(e) function GameScene:onInputPress(e)
if (self.game.game_over or self.game.completed) and (e.input == "menu_decide" or e.input == "menu_back" or e.input == "retry") then if (
self.game.game_over or self.game.completed
) and (
e.input == "menu_decide" or
e.input == "menu_back" or
e.input == "retry"
) then
highscore_entry = self.game:getHighscoreData() highscore_entry = self.game:getHighscoreData()
highscore_hash = self.game.hash .. "-" .. self.ruleset.hash highscore_hash = self.game.hash .. "-" .. self.ruleset.hash
submitHighscore(highscore_hash, highscore_entry) submitHighscore(highscore_hash, highscore_entry)

View File

@ -17,7 +17,7 @@ ConfigScene.options = {
{"smooth_movement", "Smooth Piece Drop", false, {"On", "Off"}}, {"smooth_movement", "Smooth Piece Drop", false, {"On", "Off"}},
{"synchroes_allowed", "Synchroes", false, {"Per ruleset", "On", "Off"}}, {"synchroes_allowed", "Synchroes", false, {"Per ruleset", "On", "Off"}},
{"diagonal_input", "Diagonal Input", false, {"On", "Off"}}, {"diagonal_input", "Diagonal Input", false, {"On", "Off"}},
{"buffer_lock", "Buffer Lock Inputs", false, {"On", "Off"}}, {"buffer_lock", "Buffer Lock Type", false, {"Off", "Hold", "Tap"}},
{"sfx_volume", "SFX", true, "sfxSlider"}, {"sfx_volume", "SFX", true, "sfxSlider"},
{"bgm_volume", "BGM", true, "bgmSlider"}, {"bgm_volume", "BGM", true, "bgmSlider"},
} }

View File

@ -85,10 +85,11 @@ function GameMode:getDasCutDelay() return 0 end
function GameMode:getGravity() return 1/64 end function GameMode:getGravity() return 1/64 end
function GameMode:getNextPiece(ruleset) function GameMode:getNextPiece(ruleset)
local shape = self.used_randomizer:nextPiece()
return { return {
skin = self:getSkin(), skin = self:getSkin(),
shape = self.used_randomizer:nextPiece(), shape = shape,
orientation = ruleset:getDefaultOrientation(), orientation = ruleset:getDefaultOrientation(shape),
} }
end end
@ -178,7 +179,10 @@ function GameMode:update(inputs, ruleset)
ruleset:processPiece( ruleset:processPiece(
inputs, self.piece, self.grid, self:getGravity(), self.prev_inputs, inputs, self.piece, self.grid, self:getGravity(), self.prev_inputs,
self.move, self:getLockDelay(), self:getDropSpeed(), (
inputs.up and self.lock_on_hard_drop and not self.hard_drop_locked
) and "none" or self.move,
self:getLockDelay(), self:getDropSpeed(),
self.drop_locked, self.hard_drop_locked, self.drop_locked, self.hard_drop_locked,
self.enable_hard_drop, self.additive_gravity, self.classic_lock self.enable_hard_drop, self.additive_gravity, self.classic_lock
) )
@ -426,18 +430,37 @@ function GameMode:areCancel(inputs, ruleset)
end end
end end
function GameMode:checkBufferedInputs(inputs)
if (
config.gamesettings.buffer_lock ~= 1 and
not self.prev_inputs["up"] and inputs["up"] and
self.enable_hard_drop
) then
self.buffer_hard_drop = true
elseif (
config.gamesettings.buffer_lock == 2 and not inputs["up"]
) then
self.buffer_hard_drop = false
end
if (
config.gamesettings.buffer_lock ~= 1 and
not self.prev_inputs["down"] and inputs["down"]
) then
self.buffer_soft_drop = true
elseif (
config.gamesettings.buffer_lock == 2 and not inputs["down"]
) then
self.buffer_soft_drop = false
end
end
function GameMode:processDelays(inputs, ruleset, drop_speed) function GameMode:processDelays(inputs, ruleset, drop_speed)
if self.ready_frames == 100 then if self.ready_frames == 100 then
playedReadySE = false playedReadySE = false
playedGoSE = false playedGoSE = false
end end
if self.ready_frames > 0 then if self.ready_frames > 0 then
if not self.prev_inputs["up"] and inputs["up"] and self.enable_hard_drop then self:checkBufferedInputs(inputs)
self.buffer_hard_drop = true
end
if not self.prev_inputs["down"] and inputs["down"] then
self.buffer_soft_drop = true
end
if not playedReadySE then if not playedReadySE then
playedReadySE = true playedReadySE = true
playSEOnce("ready") playSEOnce("ready")
@ -451,12 +474,7 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
self:initializeOrHold(inputs, ruleset) self:initializeOrHold(inputs, ruleset)
end end
elseif self.lcd > 0 then elseif self.lcd > 0 then
if not self.prev_inputs["up"] and inputs["up"] and self.enable_hard_drop then self:checkBufferedInputs(inputs)
self.buffer_hard_drop = true
end
if not self.prev_inputs["down"] and inputs["down"] then
self.buffer_soft_drop = true
end
self.lcd = self.lcd - 1 self.lcd = self.lcd - 1
self:areCancel(inputs, ruleset) self:areCancel(inputs, ruleset)
if self.lcd == 0 then if self.lcd == 0 then
@ -469,12 +487,7 @@ function GameMode:processDelays(inputs, ruleset, drop_speed)
end end
end end
elseif self.are > 0 then elseif self.are > 0 then
if not self.prev_inputs["up"] and inputs["up"] and self.enable_hard_drop then self:checkBufferedInputs(inputs)
self.buffer_hard_drop = true
end
if not self.prev_inputs["down"] and inputs["down"] then
self.buffer_soft_drop = true
end
self.are = self.are - 1 self.are = self.are - 1
self:areCancel(inputs, ruleset) self:areCancel(inputs, ruleset)
if self.are == 0 then if self.are == 0 then
@ -541,10 +554,8 @@ function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next
) and self.irs or false ) and self.irs or false
) )
if self.buffer_hard_drop then if self.buffer_hard_drop then
if config.gamesettings.buffer_lock == 1 then
self.piece:dropToBottom(self.grid) self.piece:dropToBottom(self.grid)
if self.lock_on_hard_drop then self.piece.locked = true end self.piece.locked = self.lock_on_hard_drop
end
local above_field = ( local above_field = (
(config.gamesettings.spawn_positions == 1 and (config.gamesettings.spawn_positions == 1 and
ruleset.spawn_above_field) or ruleset.spawn_above_field) or
@ -563,8 +574,7 @@ function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next
if self.buffer_soft_drop then if self.buffer_soft_drop then
if ( if (
self.lock_on_soft_drop and self.lock_on_soft_drop and
self.piece:isDropBlocked(self.grid) and self.piece:isDropBlocked(self.grid)
config.gamesettings.buffer_lock == 1
) then ) then
self.piece.locked = true self.piece.locked = true
end end
@ -904,4 +914,38 @@ end
function GameMode:drawCustom() end function GameMode:drawCustom() end
function GameMode:draw(paused)
self:drawBackground()
self:drawFrame()
self:drawGrid()
self:drawPiece()
self:drawNextQueue(self.ruleset)
self:drawScoringInfo()
self:drawReadyGo()
self:drawCustom()
if self:canDrawLCA() then
self:drawLineClearAnimation()
end
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setFont(font_3x5_2)
if config.gamesettings.display_gamemode == 1 then
love.graphics.printf(
self.name .. " - " .. self.ruleset.name,
0, 460, 640, "left"
)
end
love.graphics.setFont(font_3x5_3)
if paused then
love.graphics.printf("GAME PAUSED!", 64, 160, 160, "center")
end
if self.completed then
self:onGameComplete()
elseif self.game_over then
self:onGameOver()
end
end
return GameMode return GameMode

View File

@ -84,6 +84,7 @@ function Marathon2020Game:getLineClearDelay()
end end
function Marathon2020Game:getLockDelay() function Marathon2020Game:getLockDelay()
--[[
if self.delay_level < 6 then return 30 if self.delay_level < 6 then return 30
elseif self.delay_level < 7 then return 26 elseif self.delay_level < 7 then return 26
elseif self.delay_level < 8 then return 22 elseif self.delay_level < 8 then return 22
@ -95,6 +96,7 @@ function Marathon2020Game:getLockDelay()
elseif self.delay_level < 19 then return 10 elseif self.delay_level < 19 then return 10
elseif self.delay_level < 20 then return 9 elseif self.delay_level < 20 then return 9
else return 8 end else return 8 end
]] return 1
end end
function Marathon2020Game:getGravity() function Marathon2020Game:getGravity()
@ -144,7 +146,7 @@ function Marathon2020Game:advanceOneFrame()
if self.roll_frames < 0 then if self.roll_frames < 0 then
return false return false
elseif self.roll_frames > 4000 then elseif self.roll_frames > 4000 then
if self.grade >= 30 and self.section_cool_count >= 20 then self.grade = 31 end if self:qualifiesForMRoll() then self.grade = 31 end
self.completed = true self.completed = true
end end
elseif self.ready_frames == 0 then elseif self.ready_frames == 0 then
@ -227,13 +229,14 @@ local mid_cleared_line_points = {2, 6, 12, 24}
local high_cleared_line_points = {1, 4, 9, 20} local high_cleared_line_points = {1, 4, 9, 20}
local function getGradeForGradePoints(points) local function getGradeForGradePoints(points)
return math.floor(math.sqrt((points / 50) * 8 + 1) / 2 - 0.5) return math.min(30, math.floor(math.sqrt((points / 50) * 8 + 1) / 2 - 0.5))
-- Don't be afraid of the above function. All it does is make it so that -- Don't be afraid of the above function. All it does is make it so that
-- you need 50 points to get to grade 1, 100 points to grade 2, etc. -- you need 50 points to get to grade 1, 100 points to grade 2, etc.
end end
function Marathon2020Game:updateGrade(cleared_lines) function Marathon2020Game:updateGrade(cleared_lines)
-- update grade points and max grade points -- update grade points and max grade points
if self.clear then return end
local point_level = math.floor(self.level / 100) + self.delay_level local point_level = math.floor(self.level / 100) + self.delay_level
local plus_points = math.max( local plus_points = math.max(
low_cleared_line_points[cleared_lines], low_cleared_line_points[cleared_lines],
@ -249,7 +252,6 @@ function Marathon2020Game:updateGrade(cleared_lines)
end end
function Marathon2020Game:getTotalGrade() function Marathon2020Game:getTotalGrade()
if self.grade + self.section_cool_count > 50 then return "GM" end
return self.grade + self.section_cool_count return self.grade + self.section_cool_count
end end
@ -331,14 +333,16 @@ end
function Marathon2020Game:updateSectionTimes(old_level, new_level) function Marathon2020Game:updateSectionTimes(old_level, new_level)
function sectionCool(section) function sectionCool(section)
self.section_cool_count = self.section_cool_count + 1 self.section_cool_count = self.section_cool_count + 1
if section < 10 then
self.delay_level = math.min(20, self.delay_level + 1) self.delay_level = math.min(20, self.delay_level + 1)
if section < 10 then table.insert(self.section_status, "cool") end end
table.insert(self.section_status, "cool")
self.cool_timer = 300 self.cool_timer = 300
end end
local section = getSectionForLevel(old_level) local section = getSectionForLevel(old_level)
if section <= 19 and old_level % 100 < 70 and new_level >= math.floor(old_level / 100) * 100 + 70 then if old_level % 100 < 70 and new_level >= math.floor(old_level / 100) * 100 + 70 then
-- record section 70 time -- record section 70 time
section_70_time = self.frames - self.section_start_time section_70_time = self.frames - self.section_start_time
table.insert(self.secondary_section_times, section_70_time) table.insert(self.secondary_section_times, section_70_time)
@ -355,14 +359,14 @@ function Marathon2020Game:updateSectionTimes(old_level, new_level)
self:checkClear(new_level) self:checkClear(new_level)
if ( if (
section <= 19 and self.section_status[section - 1] == "cool" and 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] < self.secondary_section_times[section - 1] + 120 and
self.secondary_section_times[section] < cool_cutoffs[section] self.secondary_section_times[section] < cool_cutoffs[section]
) then ) then
sectionCool(section) sectionCool(section)
elseif self.section_status[section - 1] == "cool" then elseif self.section_status[section - 1] == "cool" then
table.insert(self.section_status, "none") table.insert(self.section_status, "none")
elseif section <= 19 and self.secondary_section_times[section] < cool_cutoffs[section] then elseif self.secondary_section_times[section] < cool_cutoffs[section] then
sectionCool(section) sectionCool(section)
else else
table.insert(self.section_status, "none") table.insert(self.section_status, "none")
@ -452,7 +456,13 @@ function Marathon2020Game:drawScoringInfo()
end end
love.graphics.setFont(font_3x5_3) love.graphics.setFont(font_3x5_3)
love.graphics.printf(self:getTotalGrade(), text_x, 120, 90, "left")
local grade = self:getTotalGrade()
love.graphics.printf(
grade > 50 and "GM" or grade,
text_x, 120, 90, "left"
)
love.graphics.printf(self.grade_points, text_x, 220, 90, "left") love.graphics.printf(self.grade_points, text_x, 220, 90, "left")
love.graphics.printf(self.level, text_x, 340, 50, "right") love.graphics.printf(self.level, text_x, 340, 50, "right")
@ -466,7 +476,7 @@ end
function Marathon2020Game:getHighscoreData() function Marathon2020Game:getHighscoreData()
return { return {
grade = self.grade, grade = self:getTotalGrade(),
level = self.level, level = self.level,
frames = self.frames, frames = self.frames,
} }

View File

@ -19,6 +19,7 @@ function MarathonA2Game:new()
self.roll_frames = 0 self.roll_frames = 0
self.combo = 1 self.combo = 1
self.grade_combo = 1
self.randomizer = History6RollsRandomizer() self.randomizer = History6RollsRandomizer()
self.grade = 0 self.grade = 0
self.grade_points = 0 self.grade_points = 0
@ -135,15 +136,23 @@ function MarathonA2Game:updateScore(level, drop_bonus, cleared_lines)
if cleared_lines >= 4 then if cleared_lines >= 4 then
self.tetris_count = self.tetris_count + 1 self.tetris_count = self.tetris_count + 1
end end
if self.grid:checkForBravo(cleared_lines) then self.bravo = 4 else self.bravo = 1 end if self.grid:checkForBravo(cleared_lines) then
self.bravo = 4
else
self.bravo = 1
end
if cleared_lines > 0 then if cleared_lines > 0 then
self.combo = self.combo + (cleared_lines - 1) * 2 self.combo = self.combo + (cleared_lines - 1) * 2
if cleared_lines > 1 then
self.grade_combo = self.grade_combo + 1
end
self.score = self.score + ( self.score = self.score + (
(math.ceil((level + cleared_lines) / 4) + drop_bonus) * (math.ceil((level + cleared_lines) / 4) + drop_bonus) *
cleared_lines * self.combo * self.bravo cleared_lines * self.combo * self.bravo
) )
else else
self.combo = 1 self.combo = 1
self.grade_combo = 1
end end
self.drop_bonus = 0 self.drop_bonus = 0
else self.lines = self.lines + cleared_lines end else self.lines = self.lines + cleared_lines end
@ -253,7 +262,7 @@ function MarathonA2Game:updateGrade(cleared_lines)
self.grade_points = self.grade_points + ( self.grade_points = self.grade_points + (
math.ceil( math.ceil(
grade_point_bonuses[self.grade + 1][cleared_lines] * grade_point_bonuses[self.grade + 1][cleared_lines] *
combo_multipliers[math.min(self.combo, 10)][cleared_lines] combo_multipliers[math.min(self.grade_combo, 10)][cleared_lines]
) * (1 + math.floor(self.level / 250)) ) * (1 + math.floor(self.level / 250))
) )
if self.grade_points >= 100 and self.grade < 31 then if self.grade_points >= 100 and self.grade < 31 then

View File

@ -20,6 +20,7 @@ function MarathonA3Game:new()
self.speed_level = 0 self.speed_level = 0
self.roll_frames = 0 self.roll_frames = 0
self.combo = 1 self.combo = 1
self.grade_combo = 1
self.grade = 0 self.grade = 0
self.grade_points = 0 self.grade_points = 0
self.roll_points = 0 self.roll_points = 0
@ -236,12 +237,16 @@ function MarathonA3Game:updateScore(level, drop_bonus, cleared_lines)
if not self.clear then if not self.clear then
if cleared_lines > 0 then if cleared_lines > 0 then
self.combo = self.combo + (cleared_lines - 1) * 2 self.combo = self.combo + (cleared_lines - 1) * 2
if cleared_lines > 1 then
self.grade_combo = self.grade_combo + 1
end
self.score = self.score + ( self.score = self.score + (
(math.ceil((level + cleared_lines) / 4) + drop_bonus) * (math.ceil((level + cleared_lines) / 4) + drop_bonus) *
cleared_lines * self.combo cleared_lines * self.combo
) )
else else
self.combo = 1 self.combo = 1
self.grade_combo = 1
end end
self.drop_bonus = 0 self.drop_bonus = 0
end end
@ -335,7 +340,7 @@ function MarathonA3Game:updateGrade(cleared_lines)
self.grade_points = self.grade_points + ( self.grade_points = self.grade_points + (
math.ceil( math.ceil(
grade_point_bonuses[self.grade + 1][cleared_lines] * grade_point_bonuses[self.grade + 1][cleared_lines] *
combo_multipliers[math.min(self.combo, 10)][cleared_lines] combo_multipliers[math.min(self.grade_combo, 10)][cleared_lines]
) * (1 + math.floor(self.level / 250)) ) * (1 + math.floor(self.level / 250))
) )
if self.grade_points >= 100 and self.grade < 31 then if self.grade_points >= 100 and self.grade < 31 then
@ -468,7 +473,7 @@ function MarathonA3Game:drawScoringInfo()
love.graphics.setFont(font_3x5_3) love.graphics.setFont(font_3x5_3)
love.graphics.printf(self.score, 240, 220, 90, "left") love.graphics.printf(self.score, 240, 220, 90, "left")
if self.roll_frames > 3238 then love.graphics.setColor(1, 0.5, 0, 1) if self.roll_frames > 3238 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 elseif self.level >= 999 then love.graphics.setColor(0, 1, 0, 1) end
love.graphics.printf(self:getLetterGrade(), 240, 140, 90, "left") love.graphics.printf(self:getLetterGrade(), 240, 140, 90, "left")
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.printf(self.level, 240, 340, 40, "right") love.graphics.printf(self.level, 240, 340, 40, "right")

View File

@ -237,7 +237,7 @@ function SurvivalA3Game:drawScoringInfo()
love.graphics.setFont(font_3x5_3) love.graphics.setFont(font_3x5_3)
if self.roll_frames > 3238 then love.graphics.setColor(1, 0.5, 0, 1) if self.roll_frames > 3238 then love.graphics.setColor(1, 0.5, 0, 1)
elseif self.level >= 1300 and self.clear then love.graphics.setColor(0, 1, 0, 1) end elseif self.level >= 1300 then love.graphics.setColor(0, 1, 0, 1) end
love.graphics.printf(getLetterGrade(math.floor(self.grade)), text_x, 140, 90, "left") love.graphics.printf(getLetterGrade(math.floor(self.grade)), text_x, 140, 90, "left")
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.printf(self.score, text_x, 220, 90, "left") love.graphics.printf(self.score, text_x, 220, 90, "left")

View File

@ -76,7 +76,7 @@ function Ruleset:rotatePiece(inputs, piece, grid, prev_inputs, initial)
self:attemptRotate(new_inputs, piece, grid, initial) self:attemptRotate(new_inputs, piece, grid, initial)
end end
if not was_drop_blocked and piece:isDropBlocked(grid) then if not initial and not was_drop_blocked and piece:isDropBlocked(grid) then
playSE("bottom") playSE("bottom")
end end
@ -260,8 +260,6 @@ function Ruleset:processPiece(
drop_locked, hard_drop_locked, drop_locked, hard_drop_locked,
hard_drop_enabled, additive_gravity, classic_lock hard_drop_enabled, additive_gravity, classic_lock
) )
if piece.locked then return end
local synchroes_allowed = ({not self.world, true, false})[config.gamesettings.synchroes_allowed] local synchroes_allowed = ({not self.world, true, false})[config.gamesettings.synchroes_allowed]
if synchroes_allowed then if synchroes_allowed then