不允许使用瞬移操作的模式虚拟按键也不显示

This commit is contained in:
MrZ626
2020-09-08 23:08:18 +08:00
parent 6bc0da712d
commit 30f4073bc6
2 changed files with 42 additions and 29 deletions

View File

@@ -310,6 +310,7 @@ function resetGameData()
game.seed=rnd(261046101471026) game.seed=rnd(261046101471026)
destroyPlayers() destroyPlayers()
restoreVirtualKey()
modeEnv=curMode.env modeEnv=curMode.env
curMode.load()--BG/BGM need redefine in custom,so up here curMode.load()--BG/BGM need redefine in custom,so up here
if modeEnv.task then if modeEnv.task then
@@ -328,7 +329,6 @@ function resetGameData()
game.stage=1 game.stage=1
game.garbageSpeed=.3 game.garbageSpeed=.3
end end
restoreVirtualKey()
stat.game=stat.game+1 stat.game=stat.game+1
freeRow.reset(30*#players) freeRow.reset(30*#players)
SFX.play("ready") SFX.play("ready")
@@ -360,6 +360,7 @@ function resetPartGameData(replaying)
end end
destroyPlayers() destroyPlayers()
restoreVirtualKey()
modeEnv=curMode.env modeEnv=curMode.env
curMode.load() curMode.load()
if modeEnv.task then if modeEnv.task then
@@ -378,7 +379,6 @@ function resetPartGameData(replaying)
game.stage=1 game.stage=1
game.garbageSpeed=.3 game.garbageSpeed=.3
end end
restoreVirtualKey()
collectgarbage() collectgarbage()
end end
function gameStart() function gameStart()

View File

@@ -1027,32 +1027,36 @@ local function getNewStatTable()
return T return T
end end
local function pressKey(P,i) local function pressKey(P,i)
P.keyPressing[i]=true if P.keyAvailable[i]then
P.act[i](P) P.keyPressing[i]=true
if P.control then P.act[i](P)
if P.keyRec then if P.control then
ins(P.keyTime,1,game.frame) if P.keyRec then
P.keyTime[11]=nil ins(P.keyTime,1,game.frame)
P.keyTime[11]=nil
end
P.stat.key=P.stat.key+1
end end
P.stat.key=P.stat.key+1
end end
end end
local function releaseKey(P,i) local function releaseKey(P,i)
P.keyPressing[i]=false P.keyPressing[i]=false
end end
local function pressKey_Rec(P,i) local function pressKey_Rec(P,i)
if game.recording then if P.keyAvailable[i]then
ins(game.rec,game.frame) if game.recording then
ins(game.rec,i) ins(game.rec,game.frame)
end ins(game.rec,i)
P.keyPressing[i]=true end
P.act[i](P) P.keyPressing[i]=true
if P.control then P.act[i](P)
if P.keyRec then if P.control then
ins(P.keyTime,1,game.frame) if P.keyRec then
P.keyTime[11]=nil ins(P.keyTime,1,game.frame)
P.keyTime[11]=nil
end
P.stat.key=P.stat.key+1
end end
P.stat.key=P.stat.key+1
end end
end end
local function releaseKey_Rec(P,i) local function releaseKey_Rec(P,i)
@@ -1103,6 +1107,15 @@ local function applyGameEnv(P)--Finish gameEnv processing
P.life=ENV.life 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.das=max(ENV.das,ENV.mindas)
ENV.arr=max(ENV.arr,ENV.minarr) ENV.arr=max(ENV.arr,ENV.minarr)
ENV.sdarr=max(ENV.sdarr,ENV.minsdarr) ENV.sdarr=max(ENV.sdarr,ENV.minsdarr)
@@ -2723,7 +2736,7 @@ function player.act.restart(P)
end end
end end
function player.act.insLeft(P,auto) 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 local x0=P.curX
while not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)do while not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)do
if P.gameEnv.moveFX and P.gameEnv.block then if P.gameEnv.moveFX and P.gameEnv.block then
@@ -2745,7 +2758,7 @@ function player.act.insLeft(P,auto)
end end
end end
function player.act.insRight(P,auto) 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 local x0=P.curX
while not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)do while not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)do
if P.gameEnv.moveFX and P.gameEnv.block then if P.gameEnv.moveFX and P.gameEnv.block then
@@ -2767,7 +2780,7 @@ function player.act.insRight(P,auto)
end end
end end
function player.act.insDown(P) 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.curY>P.imgY then
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.imgY-P.r>-1 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) 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
end end
function player.act.down4(P) 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 if P.curY>P.imgY then
local y=max(P.cur-4,P.imgY) local y=max(P.cur-4,P.imgY)
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then 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
end end
function player.act.down10(P) 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 if P.curY>P.imgY then
local y=max(P.cur-10,P.imgY) local y=max(P.cur-10,P.imgY)
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then 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
end end
function player.act.dropLeft(P) 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.insLeft(P)
P.act.hardDrop(P) P.act.hardDrop(P)
end end
function player.act.dropRight(P) 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.insRight(P)
P.act.hardDrop(P) P.act.hardDrop(P)
end end
function player.act.zangiLeft(P) 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.insLeft(P)
P.act.insDown(P) P.act.insDown(P)
P.act.insRight(P) P.act.insRight(P)
P.act.hardDrop(P) P.act.hardDrop(P)
end end
function player.act.zangiRight(P) 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.insRight(P)
P.act.insDown(P) P.act.insDown(P)
P.act.insLeft(P) P.act.insLeft(P)