新增误硬降打断延迟机制

This commit is contained in:
MrZ626
2021-06-24 03:13:57 +08:00
parent 0f1c8c7b2f
commit 2ce2f91414
14 changed files with 67 additions and 42 deletions

BIN
media/SFX/drop_cancel.ogg Normal file

Binary file not shown.

View File

@@ -377,7 +377,7 @@ end
do--function dumpBasicConfig()
local gameSetting={
--Tuning
'das','arr','dascut','sddas','sdarr',
'das','arr','dascut','dropcut','sddas','sdarr',
'ihs','irs','ims','RS','swap',
--System

View File

@@ -286,7 +286,8 @@ ROOMENV={
}
SETTING={--Settings
--Tuning
das=10,arr=2,dascut=0,
das=10,arr=2,
dascut=0,dropcut=0,
sddas=0,sdarr=2,
ihs=true,irs=true,ims=true,
RS='TRS',

View File

@@ -367,7 +367,9 @@ return{
title="Control Settings",
preview="Preview",
das="DAS",arr="ARR",dascut="DAS cut",
das="DAS",arr="ARR",
dascut="DAS cut",
dropcut="Auto-lock cut",
sddas="Soft Drop DAS",sdarr="Soft Drop ARR",
ihs="Initial Hold",
irs="Initial Rotation",

View File

@@ -339,7 +339,9 @@ return{
title="Ajustes de Controles",
preview="Ejemplo",
das="DAS",arr="ARR",dascut="Intrrp. de DAS",
das="DAS",arr="ARR",
dascut="Intrrp. de DAS",
-- dropcut="Auto-lock cut",
sddas="DAS de C. Ráp.",sdarr="ARR de C. Rápida",
ihs="Resv. Inicial",
irs="Rot. Inicial",

View File

@@ -338,7 +338,9 @@ return{
title="Paramètres de contrôle",
preview="Aperçu",
das="DAS",arr="ARR",dascut="DAS cut",
das="DAS",arr="ARR",
dascut="DAS cut",
-- dropcut="Auto-lock cut",
sddas="DAS de chute rapide",sdarr="ARR de chute rapide",
ihs="Réserve Initiale",
irs="Rotation Initiale",

View File

@@ -366,7 +366,9 @@ return{
title="Config. controles",
preview="Preview",
das="DAS",arr="ARR",dascut="DAS cut",
das="DAS",arr="ARR",
dascut="DAS cut",
-- dropcut="Auto-lock cut",
sddas="Soft Drop DAS",sdarr="Soft Drop ARR",
ihs="Segurar Inicial",
irs="Rotação Inicial",

View File

@@ -193,7 +193,9 @@ return{
title="[~~]",
preview="?:",
das="x---x x x",arr="x x-x-x",dascut="x x ↓___x x",
das="x---x x x",arr="x x-x-x",
dascut="x x ↓___x x",
dropcut="↓_ !↓↓x",
sddas="↓---↓ ↓ ↓",sdarr="↓ ↓-↓-↓",
ihs="![ ]",
irs="!''",

View File

@@ -366,7 +366,9 @@ return{
title="控制设置",
preview="预览",
das="DAS",arr="ARR",dascut="DAS打断",
das="DAS",arr="ARR",
dascut="DAS打断",
dropcut="误硬降打断",
sddas="软降DAS",sdarr="软降ARR",
ihs="提前Hold",
irs="提前旋转",

View File

@@ -1,6 +1,6 @@
return{
das=10,arr=2,
dascut=0,
dascut=0,dropcut=0,
sddas=2,sdarr=2,
ihs=true,irs=true,ims=true,
swap=true,

View File

@@ -197,6 +197,9 @@ local function newEmptyPlayer(id,mini)
P.lastPiece={
id=0,name=0,--block id/name
frame=-1e99,--lock time
autoLock=true,--if lock with gravity
finePts=0,--finesse Points
row=0,dig=0,--lines/garbage cleared

View File

@@ -956,7 +956,7 @@ do--Player.drop(self)--Place piece
end
end
function Player:drop()
function Player:drop(autoLock)
local _
local CHN=VOC.getFreeChannel()
self.dropTime[11]=ins(self.dropTime,1,self.frameRun)--Update speed dial
@@ -975,6 +975,7 @@ do--Player.drop(self)--Place piece
local dospin,mini=0
piece.id,piece.name=C.id,C.name
piece.frame,piece.autoLock=self.frameRun,autoLock
self.waiting=ENV.wait
--Tri-corner spin check
@@ -1858,31 +1859,36 @@ function Player:act_rot180()
end
end
function Player:act_hardDrop()
local ENV=self.gameEnv
if self.keyPressing[9]then
if self.gameEnv.swap then
if ENV.swap then
self:changeAtkMode(3)
end
self.keyPressing[6]=false
elseif self.control and self.waiting==-1 and self.cur then
if self.curY>self.ghoY then
local CB=self.cur.bk
if self.gameEnv.dropFX and self.gameEnv.block and self.curY-self.ghoY-#CB>-1 then
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-self.ghoY-#CB+1)
if self.lastPiece.autoLock and self.frameRun-self.lastPiece.frame<ENV.dropcut then
SFX.play('drop_cancel')
else
if self.curY>self.ghoY then
local CB=self.cur.bk
if ENV.dropFX and ENV.block and self.curY-self.ghoY-#CB>-1 then
self:createDropFX(self.curX,self.curY-1,#CB[1],self.curY-self.ghoY-#CB+1)
end
self.curY=self.ghoY
self.spinLast=false
if self.sound then
SFX.play('drop',nil,self:getCenterX()*.15)
VIB(1)
end
end
self.curY=self.ghoY
self.spinLast=false
if self.sound then
SFX.play('drop',nil,self:getCenterX()*.15)
VIB(1)
if ENV.shakeFX then
self.fieldOff.vy=ENV.shakeFX*.6
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*ENV.shakeFX*6e-4
end
self.lockDelay=-1
self:drop(false)
self.keyPressing[6]=false
end
if self.gameEnv.shakeFX then
self.fieldOff.vy=self.gameEnv.shakeFX*.6
self.fieldOff.va=self.fieldOff.va+self:getCenterX()*self.gameEnv.shakeFX*6e-4
end
self.lockDelay=-1
self:drop()
self.keyPressing[6]=false
end
end
function Player:act_softDrop()

View File

@@ -363,7 +363,7 @@ function update.alive(P,dt)
if P.lockDelay>=0 then
goto THROW_stop
end
P:drop()
P:drop(true)
if P.AI_mode=='CC'and P.AI_bot then
CC.updateField(P)
end

View File

@@ -51,26 +51,28 @@ function scene.update()
end
function scene.draw()
gc.translate(550,600)
--Testing grid line
gc.setLineWidth(4)
gc.setColor(1,1,1,.4)
gc.line(550,540,950,540)
gc.line(550,580,950,580)
gc.line(550,620,950,620)
for x=590,910,40 do
gc.line(x,530,x,630)
gc.line(0,0,400,0)
gc.line(0,40,400,40)
gc.line(0,80,400,80)
for x=40,360,40 do
gc.line(x,-10,x,90)
end
gc.setColor(1,1,1)
gc.line(550,530,550,630)
gc.line(950,530,950,630)
gc.line(0,-10,0,90)
gc.line(400,-10,400,90)
--O mino animation
local O=SKIN.curText[SETTING.skin[6]]
local x=550+40*pos
gc.draw(O,x,540,nil,40/30)
gc.draw(O,x,580,nil,40/30)
gc.draw(O,x+40,540,nil,40/30)
gc.draw(O,x+40,580,nil,40/30)
gc.draw(O,40*pos,0,nil,40/30)
gc.draw(O,40*pos,40,nil,40/30)
gc.draw(O,40*pos+40,0,nil,40/30)
gc.draw(O,40*pos+40,40,nil,40/30)
gc.translate(-550,-600)
end
local function sliderShow(S)
@@ -79,17 +81,18 @@ local function sliderShow(S)
end
scene.widgetList={
WIDGET.newText{name="title", x=80, y=50,font=70,align='L'},
WIDGET.newText{name="preview", x=520, y=540,font=40,align='R'},
WIDGET.newText{name="preview", x=520, y=610,font=40,align='R'},
WIDGET.newSlider{name="das", x=250, y=190,w=600,unit=20,disp=SETval("das"), show=sliderShow,code=SETsto("das")},
WIDGET.newSlider{name="arr", x=250, y=260,w=525,unit=15,disp=SETval("arr"), show=sliderShow,code=SETsto("arr")},
WIDGET.newSlider{name="sddas", x=250, y=330,w=350,unit=10,disp=SETval("sddas"),show=sliderShow,code=SETsto("sddas")},
WIDGET.newSlider{name="sdarr", x=250, y=400,w=140,unit=4, disp=SETval("sdarr"),show=sliderShow,code=SETsto("sdarr")},
WIDGET.newSlider{name="dascut", x=250, y=470,w=600,unit=20,disp=SETval("dascut"),show=sliderShow,code=SETsto("dascut")},
WIDGET.newSlider{name="dropcut",x=250, y=540,w=300,unit=10,disp=SETval("dropcut"),show=sliderShow,code=SETsto("dropcut")},
WIDGET.newSwitch{name="ihs", x=1100, y=260, disp=SETval("ihs"), code=SETrev("ihs")},
WIDGET.newSwitch{name="irs", x=1100, y=330, disp=SETval("irs"), code=SETrev("irs")},
WIDGET.newSwitch{name="ims", x=1100, y=400, disp=SETval("ims"), code=SETrev("ims")},
WIDGET.newButton{name="reset", x=160, y=580,w=200,h=100,color='lR',font=40,
WIDGET.newButton{name="reset", x=160, y=640,w=200,h=100,color='lR',font=40,
code=function()
local _=SETTING
_.das,_.arr,_.dascut=10,2,0