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