玩家新增getCenterX方法,移除SFX.fieldPlay

This commit is contained in:
MrZ626
2021-03-25 15:28:15 +08:00
parent 7d5059c6ca
commit f7ece80bec
3 changed files with 13 additions and 13 deletions

View File

@@ -25,9 +25,6 @@ function SFX.init(list)
end
SFX.loadOne=nil
function SFX.fieldPlay(s,v,P)
SFX.play(s,v,(P.curX+P.cur.sc[2]-5.5)*.15)
end
function SFX.play(s,vol,pos)
if SETTING.sfx==0 or vol==0 then return end
local S=Sources[s]--Source list

View File

@@ -130,7 +130,7 @@ do
if P.gameEnv.ospin then
local x,y=P.curX,P.curY
if y==P.ghoY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
if P.sound then SFX.fieldPlay("rotatekick",nil,P)end
if P.sound then SFX.play("rotatekick",nil,P:getCenterX()*.15)end
local D=P.spinSeq%100*10+d
P.spinSeq=D
if D<100 then return end
@@ -155,11 +155,11 @@ do
end
end
else
if P.sound then SFX.fieldPlay("rotate",nil,P)end
if P.sound then SFX.play("rotate",nil,P:getCenterX()*.15)end
P.spinSeq=0
end
else
if P.sound then SFX.fieldPlay("rotate",nil,P)end
if P.sound then SFX.play("rotate",nil,P:getCenterX()*.15)end
end
end,--O
{
@@ -270,7 +270,7 @@ do
[31]={{ 0,-1},{ 1, 0}},
},--W
function(P,d)
if P.type=="human"then SFX.fieldPlay("rotate",nil,P)end
if P.type=="human"then SFX.play("rotate",nil,P:getCenterX()*.15)end
local kickData=XspinList[d]
for test=1,#kickData do
local x,y=P.curX+kickData[test][1],P.curY+kickData[test][2]

View File

@@ -315,6 +315,9 @@ function Player.pushNextList(P,L,mir)--Push some nexts to nextQueue
end
end
function Player.getCenterX(P)
return P.curX+P.cur.sc[2]-5.5
end
function Player.solid(P,x,y)
if x<1 or x>10 or y<1 then return true end
if y>#P.field then return false end
@@ -579,7 +582,7 @@ function Player.spin(P,d,ifpre)
kickData=kickData[P.cur.dir*10+idir]
if not kickData then
P:freshBlock("move")
SFX.fieldPlay(ifpre and"prerotate"or"rotate",nil,P)
SFX.play(ifpre and"prerotate"or"rotate",nil,P:getCenterX()*.15)
return
end
local icb=BLOCKS[P.cur.id][idir]
@@ -605,7 +608,7 @@ function Player.spin(P,d,ifpre)
end
if P.sound then
SFX.fieldPlay(ifpre and"prerotate"or P:ifoverlap(P.cur.bk,P.curX,P.curY+1)and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate",nil,P)
SFX.play(ifpre and"prerotate"or P:ifoverlap(P.cur.bk,P.curX,P.curY+1)and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate",nil,P:getCenterX()*.15)
end
P.stat.rotate=P.stat.rotate+1
return
@@ -615,7 +618,7 @@ function Player.spin(P,d,ifpre)
kickData(P,d)
else
P:freshBlock("move")
SFX.fieldPlay(ifpre and"prerotate"or"rotate",nil,P)
SFX.play(ifpre and"prerotate"or"rotate",nil,P:getCenterX()*.15)
end
end
local phyHoldKickX={
@@ -1118,11 +1121,11 @@ do--Player.drop(P)--Place piece
elseif ENV.fine then
SFX.play("finesseError",.8)
else
SFX.fieldPlay("lock",nil,P)
SFX.play("lock",nil,P:getCenterX()*.15)
end
end
elseif P.sound then
SFX.fieldPlay("lock",nil,P)
SFX.play("lock",nil,P:getCenterX()*.15)
end
if finePts<=1 then
@@ -1902,7 +1905,7 @@ function Player.act_hardDrop(P)
P.fieldOff.vy=P.gameEnv.shakeFX*.6
end
if P.sound then
SFX.fieldPlay("drop",nil,P)
SFX.play("drop",nil,P:getCenterX()*.15)
VIB(1)
end
end