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

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)
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()

View File

@@ -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)