From 30f4073bc6e78021884e1cea91cf11951ece7d02 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 8 Sep 2020 23:08:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9E=AC=E7=A7=BB=E6=93=8D=E4=BD=9C=E7=9A=84=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E8=99=9A=E6=8B=9F=E6=8C=89=E9=94=AE=E4=B9=9F=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/gametoolfunc.lua | 4 +-- parts/player.lua | 67 +++++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index cac0a52d..a9186d39 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -310,6 +310,7 @@ function resetGameData() game.seed=rnd(261046101471026) destroyPlayers() + restoreVirtualKey() modeEnv=curMode.env curMode.load()--BG/BGM need redefine in custom,so up here if modeEnv.task then @@ -328,7 +329,6 @@ function resetGameData() game.stage=1 game.garbageSpeed=.3 end - restoreVirtualKey() stat.game=stat.game+1 freeRow.reset(30*#players) SFX.play("ready") @@ -360,6 +360,7 @@ function resetPartGameData(replaying) end destroyPlayers() + restoreVirtualKey() modeEnv=curMode.env curMode.load() if modeEnv.task then @@ -378,7 +379,6 @@ function resetPartGameData(replaying) game.stage=1 game.garbageSpeed=.3 end - restoreVirtualKey() collectgarbage() end function gameStart() diff --git a/parts/player.lua b/parts/player.lua index 04e28c44..b0cc5852 100644 --- a/parts/player.lua +++ b/parts/player.lua @@ -1027,32 +1027,36 @@ local function getNewStatTable() return T end local function pressKey(P,i) - P.keyPressing[i]=true - P.act[i](P) - if P.control then - if P.keyRec then - ins(P.keyTime,1,game.frame) - P.keyTime[11]=nil + if P.keyAvailable[i]then + P.keyPressing[i]=true + P.act[i](P) + if P.control then + if P.keyRec then + ins(P.keyTime,1,game.frame) + P.keyTime[11]=nil + end + P.stat.key=P.stat.key+1 end - P.stat.key=P.stat.key+1 end end local function releaseKey(P,i) P.keyPressing[i]=false end local function pressKey_Rec(P,i) - if game.recording then - ins(game.rec,game.frame) - ins(game.rec,i) - end - P.keyPressing[i]=true - P.act[i](P) - if P.control then - if P.keyRec then - ins(P.keyTime,1,game.frame) - P.keyTime[11]=nil + if P.keyAvailable[i]then + if game.recording then + ins(game.rec,game.frame) + ins(game.rec,i) + end + P.keyPressing[i]=true + P.act[i](P) + if P.control then + if P.keyRec then + ins(P.keyTime,1,game.frame) + P.keyTime[11]=nil + end + P.stat.key=P.stat.key+1 end - P.stat.key=P.stat.key+1 end end local function releaseKey_Rec(P,i) @@ -1103,6 +1107,15 @@ local function applyGameEnv(P)--Finish gameEnv processing P.life=ENV.life + P.keyAvailable={true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true} + if ENV.noTele then + local L={11,12,13,15,16,17,18,19,20} + for i=1,#L do + P.keyAvailable[L[i]]=false + virtualkey[L[i]].ava=false + end + end + ENV.das=max(ENV.das,ENV.mindas) ENV.arr=max(ENV.arr,ENV.minarr) ENV.sdarr=max(ENV.sdarr,ENV.minsdarr) @@ -2723,7 +2736,7 @@ function player.act.restart(P) end end function player.act.insLeft(P,auto) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end local x0=P.curX while not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)do if P.gameEnv.moveFX and P.gameEnv.block then @@ -2745,7 +2758,7 @@ function player.act.insLeft(P,auto) end end function player.act.insRight(P,auto) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end local x0=P.curX while not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)do if P.gameEnv.moveFX and P.gameEnv.block then @@ -2767,7 +2780,7 @@ function player.act.insRight(P,auto) end end function player.act.insDown(P) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end if P.curY>P.imgY then if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.imgY-P.r>-1 then P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1) @@ -2792,7 +2805,7 @@ function player.act.down1(P) end end function player.act.down4(P) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end if P.curY>P.imgY then local y=max(P.cur-4,P.imgY) if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then @@ -2804,7 +2817,7 @@ function player.act.down4(P) end end function player.act.down10(P) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end if P.curY>P.imgY then local y=max(P.cur-10,P.imgY) if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then @@ -2816,24 +2829,24 @@ function player.act.down10(P) end end function player.act.dropLeft(P) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end P.act.insLeft(P) P.act.hardDrop(P) end function player.act.dropRight(P) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end P.act.insRight(P) P.act.hardDrop(P) end function player.act.zangiLeft(P) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end P.act.insLeft(P) P.act.insDown(P) P.act.insRight(P) P.act.hardDrop(P) end function player.act.zangiRight(P) - if P.gameEnv.noTele or not P.cur then return end + if not P.cur then return end P.act.insRight(P) P.act.insDown(P) P.act.insLeft(P)