序列复制粘贴,回放
This commit is contained in:
@@ -29,7 +29,7 @@ local ins,rem=table.insert,table.remove
|
|||||||
local scr=scr
|
local scr=scr
|
||||||
local xOy=love.math.newTransform()
|
local xOy=love.math.newTransform()
|
||||||
local mx,my,mouseShow=-20,-20,false
|
local mx,my,mouseShow=-20,-20,false
|
||||||
local touching=nil--first touching ID(userdata)
|
local touching=nil--First touching ID(userdata)
|
||||||
local touchDist=nil
|
local touchDist=nil
|
||||||
joysticks={}
|
joysticks={}
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ function touchMove.mode(id,x,y,dx,dy)
|
|||||||
mapCam.x,mapCam.y=mapCam.x-dx,mapCam.y-dy
|
mapCam.x,mapCam.y=mapCam.x-dx,mapCam.y-dy
|
||||||
elseif not L[3]then
|
elseif not L[3]then
|
||||||
x,y=xOy:inverseTransformPoint(tc.getPosition(L[1]))
|
x,y=xOy:inverseTransformPoint(tc.getPosition(L[1]))
|
||||||
dx,dy=xOy:inverseTransformPoint(tc.getPosition(L[2]))--not delta!!!
|
dx,dy=xOy:inverseTransformPoint(tc.getPosition(L[2]))--Not delta!!!
|
||||||
local d=(x-dx)^2+(y-dy)^2
|
local d=(x-dx)^2+(y-dy)^2
|
||||||
if d>100 then
|
if d>100 then
|
||||||
d=d^.5
|
d=d^.5
|
||||||
@@ -387,6 +387,18 @@ function keyDown.sequence(key)
|
|||||||
else
|
else
|
||||||
sceneTemp.sure=50
|
sceneTemp.sure=50
|
||||||
end
|
end
|
||||||
|
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||||
|
if #preBag>0 then
|
||||||
|
love.system.setClipboardText("Techmino SEQ:"..copySequence())
|
||||||
|
TEXT.show(text.copySuccess,640,225,50,"appear",.5)
|
||||||
|
end
|
||||||
|
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||||
|
local str=love.system.getClipboardText()
|
||||||
|
local p=string.find(str,":")--ptr*
|
||||||
|
if p then str=string.sub(str,p+1)end
|
||||||
|
if not pasteSequence(str)then
|
||||||
|
TEXT.show(text.dataCorrupted,640,225,45,"flicker",.5)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -459,10 +471,16 @@ function keyDown.draw(key)
|
|||||||
SCN.swapTo("custom")
|
SCN.swapTo("custom")
|
||||||
elseif key=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
elseif key=="c"and kb.isDown("lctrl","rctrl")then
|
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||||
copyBoard()
|
love.system.setClipboardText("Techmino Field:"..copyBoard())
|
||||||
elseif key=="v"and kb.isDown("lctrl","rctrl")then
|
TEXT.show(text.copySuccess,350,360,40,"appear",.5)
|
||||||
pasteBoard()
|
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||||
|
local str=love.system.getClipboardText()
|
||||||
|
local p=string.find(str,":")--ptr*
|
||||||
|
if p then str=string.sub(str,p+1)end
|
||||||
|
if not pasteBoard(str)then
|
||||||
|
TEXT.show(text.dataCorrupted,350,360,35,"flicker",.5)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
pen=penKey[key]or pen
|
pen=penKey[key]or pen
|
||||||
end
|
end
|
||||||
@@ -601,64 +619,68 @@ function keyDown.pause(key)
|
|||||||
mergeStat(stat,players[1].stat)
|
mergeStat(stat,players[1].stat)
|
||||||
resetGameData()
|
resetGameData()
|
||||||
SCN.swapTo("play","none")
|
SCN.swapTo("play","none")
|
||||||
|
elseif key=="p"and game.result then
|
||||||
|
TASK.removeTask_code(TICK.autoPause)
|
||||||
|
resetPartGameData(true)
|
||||||
|
SCN.swapTo("play","none")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function touchDown.play(id,x,y)
|
function touchDown.play(id,x,y)
|
||||||
if setting.VKSwitch then
|
if not setting.VKSwitch or game.replaying then return end
|
||||||
local t=onVirtualkey(x,y)
|
|
||||||
if t then
|
local t=onVirtualkey(x,y)
|
||||||
players[1]:pressKey(t)
|
if t then
|
||||||
if setting.VKSFX>0 then
|
players[1]:pressKey(t)
|
||||||
SFX.play("virtualKey",setting.VKSFX*.25)
|
if setting.VKSFX>0 then
|
||||||
end
|
SFX.play("virtualKey",setting.VKSFX*.25)
|
||||||
virtualkey[t].isDown=true
|
end
|
||||||
virtualkey[t].pressTime=10
|
virtualkey[t].isDown=true
|
||||||
if setting.VKTrack then
|
virtualkey[t].pressTime=10
|
||||||
local B=virtualkey[t]
|
if setting.VKTrack then
|
||||||
if setting.VKDodge then--button collision (not accurate)
|
local B=virtualkey[t]
|
||||||
for i=1,#virtualkey do
|
if setting.VKDodge then--Button collision (not accurate)
|
||||||
local b=virtualkey[i]
|
for i=1,#virtualkey do
|
||||||
local d=B.r+b.r-((B.x-b.x)^2+(B.y-b.y)^2)^.5--hit depth(Neg means distance)
|
local b=virtualkey[i]
|
||||||
if d>0 then
|
local d=B.r+b.r-((B.x-b.x)^2+(B.y-b.y)^2)^.5--Hit depth(Neg means distance)
|
||||||
b.x=b.x+(b.x-B.x)*d*b.r*5e-4
|
if d>0 then
|
||||||
b.y=b.y+(b.y-B.y)*d*b.r*5e-4
|
b.x=b.x+(b.x-B.x)*d*b.r*5e-4
|
||||||
end
|
b.y=b.y+(b.y-B.y)*d*b.r*5e-4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local O=VK_org[t]
|
|
||||||
local _FW,_CW=setting.VKTchW*.1,1-setting.VKCurW*.1
|
|
||||||
local _OW=1-_FW-_CW
|
|
||||||
|
|
||||||
--Auto follow: finger, current, origin (weight from setting)
|
|
||||||
B.x,B.y=x*_FW+B.x*_CW+O.x*_OW,y*_FW+B.y*_CW+O.y*_OW
|
|
||||||
end
|
end
|
||||||
VIB(setting.VKVIB)
|
local O=VK_org[t]
|
||||||
|
local _FW,_CW=setting.VKTchW*.1,1-setting.VKCurW*.1
|
||||||
|
local _OW=1-_FW-_CW
|
||||||
|
|
||||||
|
--Auto follow: finger, current, origin (weight from setting)
|
||||||
|
B.x,B.y=x*_FW+B.x*_CW+O.x*_OW,y*_FW+B.y*_CW+O.y*_OW
|
||||||
end
|
end
|
||||||
|
VIB(setting.VKVIB)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function touchUp.play(id,x,y)
|
function touchUp.play(id,x,y)
|
||||||
if setting.VKSwitch then
|
if not setting.VKSwitch or game.replaying then return end
|
||||||
local t=onVirtualkey(x,y)
|
|
||||||
if t then
|
local t=onVirtualkey(x,y)
|
||||||
players[1]:releaseKey(t)
|
if t then
|
||||||
end
|
players[1]:releaseKey(t)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function touchMove.play(id,x,y,dx,dy)
|
function touchMove.play(id,x,y,dx,dy)
|
||||||
if setting.VKSwitch then
|
if not setting.VKSwitch or game.replaying then return end
|
||||||
local l=tc.getTouches()
|
|
||||||
for n=1,#virtualkey do
|
local l=tc.getTouches()
|
||||||
local B=virtualkey[n]
|
for n=1,#virtualkey do
|
||||||
for i=1,#l do
|
local B=virtualkey[n]
|
||||||
local x,y=xOy:inverseTransformPoint(tc.getPosition(l[i]))
|
for i=1,#l do
|
||||||
if(x-B.x)^2+(y-B.y)^2<=B.r^2 then
|
local x,y=xOy:inverseTransformPoint(tc.getPosition(l[i]))
|
||||||
goto next
|
if(x-B.x)^2+(y-B.y)^2<=B.r^2 then
|
||||||
end
|
goto next
|
||||||
end
|
end
|
||||||
players[1]:releaseKey(n)
|
|
||||||
::next::
|
|
||||||
end
|
end
|
||||||
|
players[1]:releaseKey(n)
|
||||||
|
::next::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function keyDown.play(key)
|
function keyDown.play(key)
|
||||||
@@ -666,6 +688,7 @@ function keyDown.play(key)
|
|||||||
pauseGame()
|
pauseGame()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if game.replaying then return end
|
||||||
local m=keyMap
|
local m=keyMap
|
||||||
for k=1,20 do
|
for k=1,20 do
|
||||||
if key==m[1][k]or key==m[2][k]then
|
if key==m[1][k]or key==m[2][k]then
|
||||||
@@ -677,6 +700,7 @@ function keyDown.play(key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function keyUp.play(key)
|
function keyUp.play(key)
|
||||||
|
if game.replaying then return end
|
||||||
local m=keyMap
|
local m=keyMap
|
||||||
for k=1,20 do
|
for k=1,20 do
|
||||||
if key==m[1][k]or key==m[2][k]then
|
if key==m[1][k]or key==m[2][k]then
|
||||||
@@ -688,6 +712,8 @@ function keyUp.play(key)
|
|||||||
end
|
end
|
||||||
function gamepadDown.play(key)
|
function gamepadDown.play(key)
|
||||||
if key=="back"then SCN.back()return end
|
if key=="back"then SCN.back()return end
|
||||||
|
if game.replaying then return end
|
||||||
|
|
||||||
local m=keyMap
|
local m=keyMap
|
||||||
for k=1,20 do
|
for k=1,20 do
|
||||||
if key==m[3][k]or key==m[4][k]then
|
if key==m[3][k]or key==m[4][k]then
|
||||||
@@ -699,14 +725,14 @@ function gamepadDown.play(key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function gamepadUp.play(key)
|
function gamepadUp.play(key)
|
||||||
|
if game.replaying then return end
|
||||||
|
|
||||||
local m=keyMap
|
local m=keyMap
|
||||||
for p=1,players.human do
|
for k=1,20 do
|
||||||
for k=1,20 do
|
if key==m[3][k]or key==m[4][k]then
|
||||||
if key==m[3][k]or key==m[4][k]then
|
players[1]:releaseKey(k)
|
||||||
players[1]:releaseKey(k)
|
virtualkey[k].isDown=false
|
||||||
virtualkey[k].isDown=false
|
return
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -744,15 +770,15 @@ function wheelMoved.history(x,y)
|
|||||||
end
|
end
|
||||||
function keyDown.history(key)
|
function keyDown.history(key)
|
||||||
if key=="up"then
|
if key=="up"then
|
||||||
sceneTemp[2]=max(sceneTemp[2]-1,1)
|
sceneTemp.pos=max(sceneTemp.pos-1,1)
|
||||||
elseif key=="down"then
|
elseif key=="down"then
|
||||||
sceneTemp[2]=min(sceneTemp[2]+1,#sceneTemp[1])
|
sceneTemp.pos=min(sceneTemp.pos+1,#sceneTemp.text)
|
||||||
elseif key=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-------------------------------------------------------------
|
-------------------------------------------------------------
|
||||||
local lastX,lastY=0,0--last clickDown pos
|
local lastX,lastY=0,0--Last clickDown pos
|
||||||
function love.mousepressed(x,y,k,t,num)
|
function love.mousepressed(x,y,k,t,num)
|
||||||
if t then return end
|
if t then return end
|
||||||
mouseShow=true
|
mouseShow=true
|
||||||
@@ -807,7 +833,7 @@ function love.touchpressed(id,x,y)
|
|||||||
touching=id
|
touching=id
|
||||||
love.touchmoved(id,x,y,0,0)
|
love.touchmoved(id,x,y,0,0)
|
||||||
end
|
end
|
||||||
touchDist=nil--reset distance
|
touchDist=nil--Reset distance
|
||||||
x,y=xOy:inverseTransformPoint(x,y)
|
x,y=xOy:inverseTransformPoint(x,y)
|
||||||
lastX,lastY=x,y
|
lastX,lastY=x,y
|
||||||
if touchDown[SCN.cur]then
|
if touchDown[SCN.cur]then
|
||||||
@@ -1011,9 +1037,10 @@ function love.run()
|
|||||||
|
|
||||||
local waitTime=1/60
|
local waitTime=1/60
|
||||||
local LIST={}
|
local LIST={}
|
||||||
local lastFrame=T.getTime()
|
|
||||||
|
local lastFrame=Timer()
|
||||||
local lastFreshPow=lastFrame
|
local lastFreshPow=lastFrame
|
||||||
local FCT=0--framedraw counter
|
local FCT=0--Framedraw counter
|
||||||
|
|
||||||
love.resize(gc.getWidth(),gc.getHeight())
|
love.resize(gc.getWidth(),gc.getHeight())
|
||||||
SCN.init("load")--Scene Launch
|
SCN.init("load")--Scene Launch
|
||||||
@@ -1124,7 +1151,8 @@ function love.run()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Keep 60fps
|
--Keep 60fps
|
||||||
if Timer()-lastFrame<.005 then WAIT(.01)end
|
_=Timer()-lastFrame
|
||||||
while Timer()-lastFrame<.0159 do WAIT(.001)end
|
if _<.016 then WAIT(.016-_)end
|
||||||
|
while Timer()-lastFrame<1/60-0.000005 do WAIT(0)end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -12,6 +12,7 @@ local langList={
|
|||||||
mini="Mini",b2b="B2B ",b3b="B2B2B ",
|
mini="Mini",b2b="B2B ",b3b="B2B2B ",
|
||||||
PC="Perfect Clear",HPC="Half Clear",
|
PC="Perfect Clear",HPC="Half Clear",
|
||||||
hold="暂存",next="下一个",
|
hold="暂存",next="下一个",
|
||||||
|
replaying="[回放]",
|
||||||
|
|
||||||
stage=function(n)return"关卡 "..n end,
|
stage=function(n)return"关卡 "..n end,
|
||||||
great="Great!",
|
great="Great!",
|
||||||
@@ -228,6 +229,8 @@ local langList={
|
|||||||
right="→",
|
right="→",
|
||||||
backsp="<X",
|
backsp="<X",
|
||||||
reset="R",
|
reset="R",
|
||||||
|
copy="复制",
|
||||||
|
paste="粘贴",
|
||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
draw={
|
draw={
|
||||||
@@ -244,9 +247,10 @@ local langList={
|
|||||||
pause="暂停",
|
pause="暂停",
|
||||||
},
|
},
|
||||||
pause={
|
pause={
|
||||||
|
setting="设置(S)",
|
||||||
|
replay= "回放(P)",
|
||||||
resume= "继续(esc)",
|
resume= "继续(esc)",
|
||||||
restart="重新开始(R)",
|
restart="重新开始(R)",
|
||||||
setting="设置(S)",
|
|
||||||
quit= "退出(Q)",
|
quit= "退出(Q)",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
@@ -470,6 +474,7 @@ local langList={
|
|||||||
mini="迷你",b2b="满贯",b3b="大满贯",
|
mini="迷你",b2b="满贯",b3b="大满贯",
|
||||||
PC="场地全清",HPC="场地半清",
|
PC="场地全清",HPC="场地半清",
|
||||||
hold="暂存",next="下一个",
|
hold="暂存",next="下一个",
|
||||||
|
replaying="[回放]",
|
||||||
|
|
||||||
stage=function(n)return"关卡 "..n end,
|
stage=function(n)return"关卡 "..n end,
|
||||||
great="不错!",
|
great="不错!",
|
||||||
@@ -683,6 +688,8 @@ local langList={
|
|||||||
right="→",
|
right="→",
|
||||||
backsp="<X",
|
backsp="<X",
|
||||||
reset="R",
|
reset="R",
|
||||||
|
copy="复制",
|
||||||
|
paste="粘贴",
|
||||||
back="返回",
|
back="返回",
|
||||||
},
|
},
|
||||||
draw={
|
draw={
|
||||||
@@ -699,9 +706,10 @@ local langList={
|
|||||||
pause="暂停",
|
pause="暂停",
|
||||||
},
|
},
|
||||||
pause={
|
pause={
|
||||||
|
setting="设置(S)",
|
||||||
|
replay= "回放(P)",
|
||||||
resume= "继续(esc)",
|
resume= "继续(esc)",
|
||||||
restart="重新开始(R)",
|
restart="重新开始(R)",
|
||||||
setting="设置(S)",
|
|
||||||
quit= "退出(Q)",
|
quit= "退出(Q)",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
@@ -925,6 +933,7 @@ local langList={
|
|||||||
mini="Mini",b2b="B2B ",b3b="B2B2B ",
|
mini="Mini",b2b="B2B ",b3b="B2B2B ",
|
||||||
PC="Perfect Clear",HPC="Clear",
|
PC="Perfect Clear",HPC="Clear",
|
||||||
hold="Hold",next="Next",
|
hold="Hold",next="Next",
|
||||||
|
replaying="[Replaying]",
|
||||||
|
|
||||||
stage=function(n)return"Stage "..n end,
|
stage=function(n)return"Stage "..n end,
|
||||||
great="Great!",
|
great="Great!",
|
||||||
@@ -1127,6 +1136,8 @@ local langList={
|
|||||||
right="→",
|
right="→",
|
||||||
backsp="<X",
|
backsp="<X",
|
||||||
reset="R",
|
reset="R",
|
||||||
|
copy="Copy",
|
||||||
|
paste="Paste",
|
||||||
back="Back",
|
back="Back",
|
||||||
},
|
},
|
||||||
draw={
|
draw={
|
||||||
@@ -1143,9 +1154,10 @@ local langList={
|
|||||||
pause="Pause",
|
pause="Pause",
|
||||||
},
|
},
|
||||||
pause={
|
pause={
|
||||||
|
setting="Settings (S)",
|
||||||
|
replay="Replay (P)",
|
||||||
resume="Resume (esc)",
|
resume="Resume (esc)",
|
||||||
restart="Retry (R)",
|
restart="Retry (R)",
|
||||||
setting="Settings (S)",
|
|
||||||
quit="Quit (Q)",
|
quit="Quit (Q)",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
@@ -1369,6 +1381,7 @@ local langList={
|
|||||||
mini="v",b2b="^ ",b3b="^^ ",
|
mini="v",b2b="^ ",b3b="^^ ",
|
||||||
PC="#<>#",HPC="<>",
|
PC="#<>#",HPC="<>",
|
||||||
hold="[ ]",next="→",
|
hold="[ ]",next="→",
|
||||||
|
replaying="[Replaying]",
|
||||||
|
|
||||||
stage=function(n)return"::"..n.."::"end,
|
stage=function(n)return"::"..n.."::"end,
|
||||||
great="!~",
|
great="!~",
|
||||||
@@ -1567,6 +1580,8 @@ local langList={
|
|||||||
right="→",
|
right="→",
|
||||||
backsp="<X",
|
backsp="<X",
|
||||||
reset="R",
|
reset="R",
|
||||||
|
copy="→__",
|
||||||
|
paste="__→",
|
||||||
back="X",
|
back="X",
|
||||||
},
|
},
|
||||||
draw={
|
draw={
|
||||||
@@ -1583,9 +1598,10 @@ local langList={
|
|||||||
pause="||",
|
pause="||",
|
||||||
},
|
},
|
||||||
pause={
|
pause={
|
||||||
|
setting="_?_ (S)",
|
||||||
|
replay="## (P)",
|
||||||
resume="!! (esc)",
|
resume="!! (esc)",
|
||||||
restart="_→_ (R)",
|
restart="_→_ (R)",
|
||||||
setting="_?_ (S)",
|
|
||||||
quit="X (Q)",
|
quit="X (Q)",
|
||||||
},
|
},
|
||||||
setting_game={
|
setting_game={
|
||||||
@@ -1843,6 +1859,7 @@ local gc=love.graphics
|
|||||||
local LANG={}
|
local LANG={}
|
||||||
local drawableTextLoad={
|
local drawableTextLoad={
|
||||||
"anykey",
|
"anykey",
|
||||||
|
"replaying",
|
||||||
"next","hold",
|
"next","hold",
|
||||||
"win","finish","lose","pause",
|
"win","finish","lose","pause",
|
||||||
"custom","sequence",
|
"custom","sequence",
|
||||||
|
|||||||
@@ -505,6 +505,12 @@ function Pnt.play()
|
|||||||
gc.draw(drawableText.modeName,485,10)
|
gc.draw(drawableText.modeName,485,10)
|
||||||
gc.draw(drawableText.levelName,511+drawableText.modeName:getWidth(),10)
|
gc.draw(drawableText.levelName,511+drawableText.modeName:getWidth(),10)
|
||||||
|
|
||||||
|
--Replaying
|
||||||
|
if game.replaying then
|
||||||
|
gc.setColor(1,1,Timer()%1>.5 and 1 or 0)
|
||||||
|
mText(drawableText.replaying,410,17)
|
||||||
|
end
|
||||||
|
|
||||||
--Warning
|
--Warning
|
||||||
gc.push("transform")
|
gc.push("transform")
|
||||||
gc.origin()
|
gc.origin()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
local int,max,log=math.floor,math.max,math.log
|
local int,abs=math.floor,math.abs
|
||||||
|
local max,log=math.max,math.log
|
||||||
local rnd,sin,cos=math.random,math.sin,math.cos
|
local rnd,sin,cos=math.random,math.sin,math.cos
|
||||||
local format=string.format
|
local format=string.format
|
||||||
local scr=scr
|
local scr=scr
|
||||||
@@ -38,11 +39,18 @@ end
|
|||||||
function sceneInit.main()
|
function sceneInit.main()
|
||||||
BG.set("space")
|
BG.set("space")
|
||||||
BGM.play("blank")
|
BGM.play("blank")
|
||||||
destroyPlayers()
|
|
||||||
|
game.frame=0
|
||||||
|
game.recording=false
|
||||||
|
game.replaying=false
|
||||||
|
game.seed=1046101471
|
||||||
|
game.rec={}
|
||||||
|
|
||||||
modeEnv={}
|
modeEnv={}
|
||||||
if not players[1]then
|
destroyPlayers()
|
||||||
PLY.newDemoPlayer(1,900,35,1.1)
|
|
||||||
end--Create demo player
|
--Create demo player
|
||||||
|
PLY.newDemoPlayer(1,900,35,1.1)
|
||||||
end
|
end
|
||||||
function sceneInit.music()
|
function sceneInit.music()
|
||||||
if BGM.nowPlay then
|
if BGM.nowPlay then
|
||||||
@@ -263,7 +271,7 @@ function sceneInit.history()
|
|||||||
}
|
}
|
||||||
if newVersionLaunch then
|
if newVersionLaunch then
|
||||||
newVersionLaunch=nil
|
newVersionLaunch=nil
|
||||||
sceneTemp[2]=4
|
sceneTemp.pos=4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function sceneInit.debug()
|
function sceneInit.debug()
|
||||||
@@ -351,7 +359,7 @@ function SCN.pop()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local swap={
|
local swap={
|
||||||
none={1,0,NULL},
|
none={1,0,NULL},--swap time, change time, draw function
|
||||||
flash={8,1,function()gc.clear(1,1,1)end},
|
flash={8,1,function()gc.clear(1,1,1)end},
|
||||||
fade={30,15,function(t)
|
fade={30,15,function(t)
|
||||||
local t=t>15 and 2-t/15 or t/15
|
local t=t>15 and 2-t/15 or t/15
|
||||||
@@ -359,7 +367,7 @@ local swap={
|
|||||||
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
|
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
|
||||||
end},
|
end},
|
||||||
fade_togame={120,20,function(t)
|
fade_togame={120,20,function(t)
|
||||||
local t=t>20 and (120-t)/100 or t/20
|
local t=t>20 and(120-t)/100 or t/20
|
||||||
gc.setColor(0,0,0,t)
|
gc.setColor(0,0,0,t)
|
||||||
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
|
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
|
||||||
end},
|
end},
|
||||||
|
|||||||
@@ -146,9 +146,11 @@ function Tmr.draw()
|
|||||||
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
|
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
|
||||||
end
|
end
|
||||||
function Tmr.play(dt)
|
function Tmr.play(dt)
|
||||||
|
local _
|
||||||
game.frame=game.frame+1
|
game.frame=game.frame+1
|
||||||
stat.time=stat.time+dt
|
stat.time=stat.time+dt
|
||||||
local P1=players[1]
|
|
||||||
|
--Update attack FX
|
||||||
for i=#FX_attack,1,-1 do
|
for i=#FX_attack,1,-1 do
|
||||||
local b=FX_attack[i]
|
local b=FX_attack[i]
|
||||||
b.t=b.t+1
|
b.t=b.t+1
|
||||||
@@ -156,15 +158,16 @@ function Tmr.play(dt)
|
|||||||
b.rad=b.rad*1.05+.1
|
b.rad=b.rad*1.05+.1
|
||||||
b.x,b.y=b.x2,b.y2
|
b.x,b.y=b.x2,b.y2
|
||||||
elseif b.t>10 then
|
elseif b.t>10 then
|
||||||
local t=((b.t-10)*.025)t=(3-2*t)*t*t
|
_=(b.t-10)*.025
|
||||||
b.x,b.y=b.x1*(1-t)+b.x2*t,b.y1*(1-t)+b.y2*t
|
_=(3-2*_)*_*_
|
||||||
|
b.x,b.y=b.x1*(1-_)+b.x2*_,b.y1*(1-_)+b.y2*_
|
||||||
end
|
end
|
||||||
if b.t<60 then
|
if b.t<60 then
|
||||||
local L=FX_attack[i].drag
|
_=FX_attack[i].drag
|
||||||
if #L==4*setting.atkFX then
|
if #_==4*setting.atkFX then
|
||||||
rem(L,1)rem(L,1)
|
rem(_,1)rem(_,1)
|
||||||
end
|
end
|
||||||
ins(L,b.x)ins(L,b.y)
|
ins(_,b.x)ins(_,b.y)
|
||||||
else
|
else
|
||||||
for i=i,#FX_attack do
|
for i=i,#FX_attack do
|
||||||
FX_attack[i]=FX_attack[i+1]
|
FX_attack[i]=FX_attack[i+1]
|
||||||
@@ -172,6 +175,7 @@ function Tmr.play(dt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Update badge FX
|
||||||
for i=#FX_badge,1,-1 do
|
for i=#FX_badge,1,-1 do
|
||||||
local b=FX_badge[i]
|
local b=FX_badge[i]
|
||||||
b.t=b.t+1
|
b.t=b.t+1
|
||||||
@@ -179,14 +183,38 @@ function Tmr.play(dt)
|
|||||||
rem(FX_badge,i)
|
rem(FX_badge,i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local _
|
|
||||||
for i=1,#virtualkey do
|
--Update virtualkey animation
|
||||||
_=virtualkey[i]
|
if setting.VKSwitch then
|
||||||
if _.pressTime>0 then
|
for i=1,#virtualkey do
|
||||||
_.pressTime=_.pressTime-1
|
_=virtualkey[i]
|
||||||
|
if _.pressTime>0 then
|
||||||
|
_.pressTime=_.pressTime-1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local P1=players[1]
|
||||||
|
|
||||||
|
--Replay
|
||||||
|
if game.replaying then
|
||||||
|
_=game.replaying
|
||||||
|
local L=game.rec
|
||||||
|
while game.frame==L[_]do
|
||||||
|
local k=L[_+1]
|
||||||
|
if k>0 then
|
||||||
|
P1:pressKey(k)
|
||||||
|
virtualkey[k].isDown=true
|
||||||
|
virtualkey[k].pressTime=10
|
||||||
|
else
|
||||||
|
virtualkey[-k].isDown=false
|
||||||
|
P1:releaseKey(-k)
|
||||||
|
end
|
||||||
|
_=_+2
|
||||||
|
end
|
||||||
|
game.replaying=_
|
||||||
|
end
|
||||||
|
--Counting,include pre-das,directy RETURN,or restart counting
|
||||||
if game.frame<180 then
|
if game.frame<180 then
|
||||||
if game.frame==179 then
|
if game.frame==179 then
|
||||||
gameStart()
|
gameStart()
|
||||||
@@ -210,26 +238,31 @@ function Tmr.play(dt)
|
|||||||
if restartCount>20 then
|
if restartCount>20 then
|
||||||
TASK.clear("play")
|
TASK.clear("play")
|
||||||
mergeStat(stat,P1.stat)
|
mergeStat(stat,P1.stat)
|
||||||
resetGameData()
|
resetPartGameData()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
elseif restartCount>0 then
|
elseif restartCount>0 then
|
||||||
restartCount=restartCount>2 and restartCount-2 or 0
|
restartCount=restartCount>2 and restartCount-2 or 0
|
||||||
end--Counting,include pre-das,directy RETURN,or restart counting
|
end
|
||||||
|
|
||||||
|
--Update players
|
||||||
for p=1,#players do
|
for p=1,#players do
|
||||||
local P=players[p]
|
local P=players[p]
|
||||||
P:update(dt)
|
P:update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Fresh royale target
|
||||||
if game.frame%120==0 then
|
if game.frame%120==0 then
|
||||||
if modeEnv.royaleMode then freshMostDangerous()end
|
if modeEnv.royaleMode then freshMostDangerous()end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Warning check
|
||||||
if P1.alive then
|
if P1.alive then
|
||||||
if game.frame%26==0 and setting.warn then
|
if game.frame%26==0 and setting.warn then
|
||||||
local F=P1.field
|
local F=P1.field
|
||||||
local M=#F
|
|
||||||
local height=0--Max height of row 4~7
|
local height=0--Max height of row 4~7
|
||||||
for x=4,7 do
|
for x=4,7 do
|
||||||
for y=M,1,-1 do
|
for y=#F,1,-1 do
|
||||||
if F[y][x]>0 then
|
if F[y][x]>0 then
|
||||||
if y>height then
|
if y>height then
|
||||||
height=y
|
height=y
|
||||||
@@ -240,13 +273,13 @@ function Tmr.play(dt)
|
|||||||
end
|
end
|
||||||
game.warnLVL0=ln(height-15+P1.atkBuffer.sum*.8)
|
game.warnLVL0=ln(height-15+P1.atkBuffer.sum*.8)
|
||||||
end
|
end
|
||||||
local M=game.warnLVL
|
_=game.warnLVL
|
||||||
if M<game.warnLVL0 then
|
if _<game.warnLVL0 then
|
||||||
M=M*.95+game.warnLVL0*.05
|
_=_*.95+game.warnLVL0*.05
|
||||||
elseif M>0 then
|
elseif _>0 then
|
||||||
M=max(M-.026,0)
|
_=max(_-.026,0)
|
||||||
end
|
end
|
||||||
game.warnLVL=M
|
game.warnLVL=_
|
||||||
elseif game.warnLVL>0 then
|
elseif game.warnLVL>0 then
|
||||||
game.warnLVL=max(game.warnLVL-.026,0)
|
game.warnLVL=max(game.warnLVL-.026,0)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -115,6 +115,38 @@ function pasteBoard()
|
|||||||
::ERROR::TEXT.show(text.dataCorrupted,350,360,35,"flicker",.5)
|
::ERROR::TEXT.show(text.dataCorrupted,350,360,35,"flicker",.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function copySequence()
|
||||||
|
local str=""
|
||||||
|
|
||||||
|
for i=1,#preBag do
|
||||||
|
str=str..char(preBag[i]-1)
|
||||||
|
end
|
||||||
|
|
||||||
|
return data.encode("string","base64",data.compress("string","deflate",str))
|
||||||
|
end
|
||||||
|
function pasteSequence(str)
|
||||||
|
local _
|
||||||
|
|
||||||
|
--Decode
|
||||||
|
_,str=pcall(data.decode,"string","base64",str)
|
||||||
|
if not _ then return end
|
||||||
|
_,str=pcall(data.decompress,"string","deflate",str)
|
||||||
|
if not _ then return end
|
||||||
|
|
||||||
|
local bag={}
|
||||||
|
for i=1,#str do
|
||||||
|
_=byte(str,i)
|
||||||
|
if _<25 then
|
||||||
|
bag[i]=_+1
|
||||||
|
else
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
preBag=bag
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
function mergeStat(stat,delta)
|
function mergeStat(stat,delta)
|
||||||
for k,v in next,delta do
|
for k,v in next,delta do
|
||||||
if type(v)=="table"then
|
if type(v)=="table"then
|
||||||
@@ -128,7 +160,7 @@ function mergeStat(stat,delta)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function randomTarget(P)
|
function randomTarget(P)--Return a random opponent for P
|
||||||
if #players.alive>1 then
|
if #players.alive>1 then
|
||||||
local R
|
local R
|
||||||
repeat
|
repeat
|
||||||
@@ -136,7 +168,7 @@ function randomTarget(P)
|
|||||||
until R~=P
|
until R~=P
|
||||||
return R
|
return R
|
||||||
end
|
end
|
||||||
end--return a random opponent for P
|
end
|
||||||
function freshMostDangerous()
|
function freshMostDangerous()
|
||||||
game.mostDangerous,game.secDangerous=nil
|
game.mostDangerous,game.secDangerous=nil
|
||||||
local m,m2=0,0
|
local m,m2=0,0
|
||||||
@@ -198,7 +230,7 @@ function royaleLevelup()
|
|||||||
if P.gameEnv.drop==0 then
|
if P.gameEnv.drop==0 then
|
||||||
P.curY=P.y_img
|
P.curY=P.y_img
|
||||||
P.gameEnv._20G=true
|
P.gameEnv._20G=true
|
||||||
if P.AI_mode=="CC"then CC_switch20G(P)end--little cheating,never mind
|
if P.AI_mode=="CC"then CC_switch20G(P)end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -223,65 +255,34 @@ end
|
|||||||
function resumeGame()
|
function resumeGame()
|
||||||
SCN.swapTo("play","none")
|
SCN.swapTo("play","none")
|
||||||
end
|
end
|
||||||
function loadGame(M)
|
function loadGame(M,ifQuickPlay)
|
||||||
--rec={}
|
|
||||||
stat.lastPlay=M
|
stat.lastPlay=M
|
||||||
curMode=Modes[M]
|
curMode=Modes[M]
|
||||||
local lang=setting.lang
|
local lang=setting.lang
|
||||||
drawableText.modeName:set(text.modes[M][1])
|
drawableText.modeName:set(text.modes[M][1])
|
||||||
drawableText.levelName:set(text.modes[M][2])
|
drawableText.levelName:set(text.modes[M][2])
|
||||||
needResetGameData=true
|
needResetGameData=true
|
||||||
SCN.swapTo("play","fade_togame")
|
SCN.swapTo("play",ifQuickPlay and"swipe"or"fade_togame")
|
||||||
SFX.play("enter")
|
SFX.play("enter")
|
||||||
end
|
end
|
||||||
function resetPartGameData()
|
|
||||||
game={
|
|
||||||
frame=150-setting.reTime*15,
|
|
||||||
result=false,
|
|
||||||
pauseTime=0,
|
|
||||||
pauseCount=0,
|
|
||||||
garbageSpeed=1,
|
|
||||||
warnLVL0=0,
|
|
||||||
warnLVL=0,
|
|
||||||
}
|
|
||||||
destroyPlayers()
|
|
||||||
curMode.load()
|
|
||||||
TEXT.clear()
|
|
||||||
if modeEnv.task then
|
|
||||||
for i=1,#players do
|
|
||||||
players[i]:newTask(modeEnv.task)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if modeEnv.royaleMode then
|
|
||||||
for i=1,#players do
|
|
||||||
players[i]:changeAtk(randomTarget(players[i]))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
BG.set(modeEnv.bg)
|
|
||||||
BGM.play(modeEnv.bgm)
|
|
||||||
if modeEnv.royaleMode then
|
|
||||||
for i=1,#players do
|
|
||||||
players[i]:changeAtk(randomTarget(players[i]))
|
|
||||||
end
|
|
||||||
game.stage=1
|
|
||||||
game.garbageSpeed=.3
|
|
||||||
end
|
|
||||||
restoreVirtualKey()
|
|
||||||
collectgarbage()
|
|
||||||
end
|
|
||||||
function resetGameData()
|
function resetGameData()
|
||||||
game={
|
game.frame=150-setting.reTime*15
|
||||||
frame=150-setting.reTime*15,
|
game.result=false
|
||||||
result=false,
|
game.pauseTime=0
|
||||||
pauseTime=0,--Time paused
|
game.pauseCount=0
|
||||||
pauseCount=0,--Pausing count
|
game.garbageSpeed=1
|
||||||
garbageSpeed=1,--garbage timing speed
|
game.warnLVL0=0
|
||||||
warnLVL0=0,
|
game.warnLVL=0
|
||||||
warnLVL=0,
|
game.recording=true
|
||||||
}
|
game.replaying=false
|
||||||
|
game.rec={}
|
||||||
|
math.randomseed(tm.getTime())
|
||||||
|
game.seed=rnd(261046101471026)
|
||||||
|
|
||||||
destroyPlayers()
|
destroyPlayers()
|
||||||
modeEnv=curMode.env
|
modeEnv=curMode.env
|
||||||
curMode.load()--bg/bgm need redefine in custom,so up here
|
math.randomseed(game.seed)
|
||||||
|
curMode.load()--BG/BGM need redefine in custom,so up here
|
||||||
if modeEnv.task then
|
if modeEnv.task then
|
||||||
for i=1,#players do
|
for i=1,#players do
|
||||||
players[i]:newTask(modeEnv.task)
|
players[i]:newTask(modeEnv.task)
|
||||||
@@ -306,6 +307,47 @@ function resetGameData()
|
|||||||
SFX.play("ready")
|
SFX.play("ready")
|
||||||
collectgarbage()
|
collectgarbage()
|
||||||
end
|
end
|
||||||
|
function resetPartGameData(replaying)
|
||||||
|
game.result=false
|
||||||
|
game.garbageSpeed=1
|
||||||
|
if replaying then
|
||||||
|
game.frame=0
|
||||||
|
game.recording=false
|
||||||
|
game.replaying=1
|
||||||
|
else
|
||||||
|
game.frame=150-setting.reTime*15
|
||||||
|
game.pauseTime=0
|
||||||
|
game.pauseCount=0
|
||||||
|
game.recording=true
|
||||||
|
game.replaying=false
|
||||||
|
game.rec={}
|
||||||
|
math.randomseed(tm.getTime())
|
||||||
|
game.seed=rnd(1046101471,2662622626)
|
||||||
|
end
|
||||||
|
|
||||||
|
destroyPlayers()
|
||||||
|
modeEnv=curMode.env
|
||||||
|
math.randomseed(game.seed)
|
||||||
|
curMode.load()
|
||||||
|
if modeEnv.task then
|
||||||
|
for i=1,#players do
|
||||||
|
players[i]:newTask(modeEnv.task)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
BG.set(modeEnv.bg)
|
||||||
|
BGM.play(modeEnv.bgm)
|
||||||
|
|
||||||
|
TEXT.clear()
|
||||||
|
if modeEnv.royaleMode then
|
||||||
|
for i=1,#players do
|
||||||
|
players[i]:changeAtk(randomTarget(players[i]))
|
||||||
|
end
|
||||||
|
game.stage=1
|
||||||
|
game.garbageSpeed=.3
|
||||||
|
end
|
||||||
|
restoreVirtualKey()
|
||||||
|
collectgarbage()
|
||||||
|
end
|
||||||
function gameStart()
|
function gameStart()
|
||||||
SFX.play("start")
|
SFX.play("start")
|
||||||
for P=1,#players do
|
for P=1,#players do
|
||||||
|
|||||||
@@ -189,17 +189,14 @@ drawableText={
|
|||||||
mxcmb=T(20,"Max Combo"),
|
mxcmb=T(20,"Max Combo"),
|
||||||
pc=T(20,"Perfect Clear"),
|
pc=T(20,"Perfect Clear"),
|
||||||
ko=T(25,"KO"),
|
ko=T(25,"KO"),
|
||||||
D=T(100,"D"),
|
D=T(100,"D"),C=T(100,"C"),B=T(100,"B"),A=T(100,"A"),S=T(100,"S"),
|
||||||
C=T(100,"C"),
|
|
||||||
B=T(100,"B"),
|
|
||||||
A=T(100,"A"),
|
|
||||||
S=T(100,"S"),
|
|
||||||
|
|
||||||
|
|
||||||
modeName=T(30),levelName=T(30),
|
modeName=T(30),levelName=T(30),
|
||||||
|
|
||||||
|
|
||||||
anykey=T(40),
|
anykey=T(40),
|
||||||
|
replaying=T(20),
|
||||||
next=T(40),hold=T(40),
|
next=T(40),hold=T(40),
|
||||||
win=T(120),finish=T(120),
|
win=T(120),finish=T(120),
|
||||||
lose=T(120),pause=T(120),
|
lose=T(120),pause=T(120),
|
||||||
@@ -210,9 +207,7 @@ drawableText={
|
|||||||
preview=T(40),
|
preview=T(40),
|
||||||
keyboard=T(25),joystick=T(25),
|
keyboard=T(25),joystick=T(25),
|
||||||
ctrlSetHelp=T(30),
|
ctrlSetHelp=T(30),
|
||||||
musicRoom=T(80),
|
musicRoom=T(80),nowPlaying=T(50),
|
||||||
nowPlaying=T(50),
|
|
||||||
VKTchW=T(30),VKOrgW=T(30),VKCurW=T(30),
|
VKTchW=T(30),VKOrgW=T(30),VKCurW=T(30),
|
||||||
noScore=T(45),
|
noScore=T(45),highScore=T(30),
|
||||||
highScore=T(30),
|
|
||||||
}
|
}
|
||||||
542
parts/player.lua
542
parts/player.lua
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user