Moving VCTRL related calls and adding buttons for name entry screen

This commit is contained in:
SweetSea-ButImNotSweet
2024-05-22 19:17:17 +07:00
parent c81b85b9ed
commit 2b916ca2ad
9 changed files with 146 additions and 113 deletions

View File

@@ -13,6 +13,8 @@ local Piece = require 'game.piece'
local GameMode = Object:extend()
function GameMode:new(player_name, input_file, replay_grade)
VCTRL.toggle(true)
if player_name == nil then self.training = true else self.training = false end
if input_file ~= nil then
input_file = love.filesystem.newFile(REPLAY_DIR..input_file, 'r'):read()
@@ -308,15 +310,6 @@ function GameMode:getReplayInputs(input_file)
local replay_inputs = {}
local semicolon_position = string.find(input_file, ';', 1, true)
-- for _=1,1e99 do
-- local c = string.sub(input_file,_,_)
-- if c == ';' then
-- reached_inputs = true
-- i = _ + 1
-- end
-- if reached_inputs then break end
-- end
if semicolon_position then
for i = semicolon_position + 1, #input_file, 3 do
local input_list = {right = false, rotate_right2 = false, up = false, rotate_left = false, left = false, down = false, rotate_right = false, rotate_left2 = false}
@@ -346,12 +339,6 @@ function GameMode:getInputPieceSeq(input_file)
input_file, string_start,
string.find(input_file, ';', string_start, true) - 1
) -- seed
-- for i = string_start, #input_file do
-- local c = string.sub(input_file, i, i)
-- if c == ';' then break
-- else seed = seed..c
-- end
-- end
end
function GameMode:update(inputs, ruleset)
@@ -936,19 +923,19 @@ end
function GameMode:drawInputDisplay(left, top)
if self.replay_inputs[self.frames] ~= nil then
drawText("+", left+10, top+8, 1000, "left")
drawText("v", left+10, top+18, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['down']),1,1-boolToInt(self.replay_inputs[self.frames]['down']),1})
drawText("<", left, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['left']),1,1-boolToInt(self.replay_inputs[self.frames]['left']),1})
drawText(">", left+20, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['right']),1,1-boolToInt(self.replay_inputs[self.frames]['right']),1})
drawText("·", left+10, top+8, 1000, "left")
drawText("", left+10, top+18, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['down']),1,1-boolToInt(self.replay_inputs[self.frames]['down']),1})
drawText("", left, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['left']),1,1-boolToInt(self.replay_inputs[self.frames]['left']),1})
drawText("", left+20, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['right']),1,1-boolToInt(self.replay_inputs[self.frames]['right']),1})
drawText("L", left+35, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_left']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_left']),1})
drawText("R", left+50, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_right']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_right']),1})
drawText("L", left+65, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_left2']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_left2']),1})
drawText("R", left+80, top+8, 1000, "left",{1-boolToInt(self.replay_inputs[self.frames]['rotate_right2']),1,1-boolToInt(self.replay_inputs[self.frames]['rotate_right2']),1})
else
drawText("+", left+10, top+8, 1000, "left")
drawText("v", left+10, top+18, 1000, "left")
drawText("<", left, top+8, 1000, "left")
drawText(">", left+20, top+8, 1000, "left")
drawText("·", left+10, top+8, 1000, "left")
drawText("", left+10, top+18, 1000, "left")
drawText("", left, top+8, 1000, "left")
drawText("", left+20, top+8, 1000, "left")
drawText("L", left+35, top+8, 1000, "left")
drawText("R", left+50, top+8, 1000, "left")
drawText("L", left+65, top+8, 1000, "left")