play场景改名game,整理代码,重构GAME.frame相关内容,修复联网录像播放不正确
This commit is contained in:
@@ -349,7 +349,7 @@ end
|
|||||||
function love.focus(f)
|
function love.focus(f)
|
||||||
if f then
|
if f then
|
||||||
love.timer.step()
|
love.timer.step()
|
||||||
elseif SCN.cur=="play"and SETTING.autoPause then
|
elseif SCN.cur=="game"and SETTING.autoPause then
|
||||||
pauseGame()
|
pauseGame()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -614,7 +614,7 @@ function loadGame(M,ifQuickPlay,ifNet)--Load a mode and go to game scene
|
|||||||
SCN.go("net_game","swipeD")
|
SCN.go("net_game","swipeD")
|
||||||
else
|
else
|
||||||
drawableText.modeName:set(text.modes[M][1].." "..text.modes[M][2])
|
drawableText.modeName:set(text.modes[M][1].." "..text.modes[M][2])
|
||||||
SCN.go("play",ifQuickPlay and"swipeD"or"fade_togame")
|
SCN.go("game",ifQuickPlay and"swipeD"or"fade_togame")
|
||||||
SFX.play("enter")
|
SFX.play("enter")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -731,7 +731,7 @@ do--function resetGameData(args)
|
|||||||
end
|
end
|
||||||
function resetGameData(args,seed)
|
function resetGameData(args,seed)
|
||||||
if not args then args=""end
|
if not args then args=""end
|
||||||
if PLAYERS[1]and not GAME.replaying and(GAME.frame>400 or GAME.result)then
|
if PLAYERS[1]and not GAME.replaying and(PLAYERS[1].frameRun>400 or GAME.result)then
|
||||||
mergeStat(STAT,PLAYERS[1].stat)
|
mergeStat(STAT,PLAYERS[1].stat)
|
||||||
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
||||||
end
|
end
|
||||||
@@ -740,11 +740,11 @@ do--function resetGameData(args)
|
|||||||
GAME.warnLVL0=0
|
GAME.warnLVL0=0
|
||||||
GAME.warnLVL=0
|
GAME.warnLVL=0
|
||||||
if args:find("r")then
|
if args:find("r")then
|
||||||
GAME.frame=0
|
GAME.frameStart=0
|
||||||
GAME.recording=false
|
GAME.recording=false
|
||||||
GAME.replaying=1
|
GAME.replaying=1
|
||||||
else
|
else
|
||||||
GAME.frame=args:find("n")and 0 or 150-SETTING.reTime*15
|
GAME.frameStart=args:find("n")and 0 or 150-SETTING.reTime*15
|
||||||
GAME.seed=seed or rnd(1046101471,2662622626)
|
GAME.seed=seed or rnd(1046101471,2662622626)
|
||||||
GAME.pauseTime=0
|
GAME.pauseTime=0
|
||||||
GAME.pauseCount=0
|
GAME.pauseCount=0
|
||||||
@@ -790,39 +790,10 @@ do--function resetGameData(args)
|
|||||||
collectgarbage()
|
collectgarbage()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function gameStart()--Call when countdown finish (GAME.frame==180)
|
|
||||||
SFX.play("start")
|
|
||||||
for P=1,#PLAYERS do
|
|
||||||
P=PLAYERS[P]
|
|
||||||
P.control=true
|
|
||||||
P.timing=true
|
|
||||||
P:popNext()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function checkStart()
|
|
||||||
if GAME.frame<=180 then
|
|
||||||
if GAME.frame==180 then
|
|
||||||
gameStart()
|
|
||||||
elseif GAME.frame==60 or GAME.frame==120 then
|
|
||||||
SFX.play("ready")
|
|
||||||
end
|
|
||||||
for p=1,#PLAYERS do
|
|
||||||
local P=PLAYERS[p]
|
|
||||||
if P.movDir~=0 then
|
|
||||||
if P.moving<P.gameEnv.das then
|
|
||||||
P.moving=P.moving+1
|
|
||||||
end
|
|
||||||
else
|
|
||||||
P.moving=0
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function checkWarning()
|
function checkWarning()
|
||||||
local P1=PLAYERS[1]
|
local P1=PLAYERS[1]
|
||||||
if P1.alive then
|
if P1.alive then
|
||||||
if GAME.frame%26==0 then
|
if P1.frameRun%26==0 then
|
||||||
local F=P1.field
|
local F=P1.field
|
||||||
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
|
||||||
@@ -847,7 +818,7 @@ function checkWarning()
|
|||||||
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
|
||||||
if GAME.warnLVL>1.126 and GAME.frame%30==0 then
|
if GAME.warnLVL>1.126 and P1.frameRun%30==0 then
|
||||||
SFX.fplay("warning",SETTING.sfx_warn)
|
SFX.fplay("warning",SETTING.sfx_warn)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ GAME={--Global game data
|
|||||||
init=false, --If need initializing game when enter scene-play
|
init=false, --If need initializing game when enter scene-play
|
||||||
net=false, --If play net game
|
net=false, --If play net game
|
||||||
|
|
||||||
frame=0, --Frame count
|
|
||||||
result=false, --Game result (string)
|
result=false, --Game result (string)
|
||||||
rank=false, --Rank reached
|
rank=false, --Rank reached
|
||||||
pauseTime=0, --Time paused
|
pauseTime=0, --Time paused
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"and P.atkBuffer.sum==0 then
|
if P.control and P.atkBuffer.sum==0 then
|
||||||
local p=#P.atkBuffer+1
|
local p=#P.atkBuffer+1
|
||||||
local B,D=P.atkBuffer,P.modeData
|
local B,D=P.atkBuffer,P.modeData
|
||||||
local t
|
local t
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"and P.atkBuffer.sum<4 then
|
if P.control and P.atkBuffer.sum<4 then
|
||||||
local p=#P.atkBuffer+1
|
local p=#P.atkBuffer+1
|
||||||
local B,D=P.atkBuffer,P.modeData
|
local B,D=P.atkBuffer,P.modeData
|
||||||
local s
|
local s
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
local t=math.max(240-2*D.wave,40)
|
local t=math.max(240-2*D.wave,40)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
local t=math.max(360-D.wave*2,60)
|
local t=math.max(360-D.wave*2,60)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(90,180-D.wave)then
|
if D.timer>=math.max(90,180-D.wave)then
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(30,80-.3*D.wave)then
|
if D.timer>=math.max(30,80-.3*D.wave)then
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(60,150-2*D.wave)and P.atkBuffer.sum<4 then
|
if D.timer>=math.max(60,150-2*D.wave)and P.atkBuffer.sum<4 then
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
local B=P.atkBuffer
|
local B=P.atkBuffer
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(60,150-D.wave)and P.atkBuffer.sum<20 then
|
if D.timer>=math.max(60,150-D.wave)and P.atkBuffer.sum<20 then
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(90,180-2*D.wave)and P.atkBuffer.sum<8 then
|
if D.timer>=math.max(90,180-2*D.wave)and P.atkBuffer.sum<8 then
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ return{
|
|||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
YIELD()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.timer=D.timer+1
|
D.timer=D.timer+1
|
||||||
if D.timer>=math.max(300,600-10*D.wave)and P.atkBuffer.sum<20 then
|
if D.timer>=math.max(300,600-10*D.wave)and P.atkBuffer.sum<20 then
|
||||||
|
|||||||
@@ -426,12 +426,12 @@ local function drawMission(P)
|
|||||||
end
|
end
|
||||||
local function drawStartCounter(P)
|
local function drawStartCounter(P)
|
||||||
gc_setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
if GAME.frame<180 then
|
if P.frameRun<180 then
|
||||||
if GAME.frame==0 then
|
if P.frameRun==0 then
|
||||||
setFont(70)
|
setFont(70)
|
||||||
mStr(P.ready and text.beReady or text.notReady,305,220)
|
mStr(P.ready and text.beReady or text.notReady,305,220)
|
||||||
else
|
else
|
||||||
local count=179-GAME.frame
|
local count=179-P.frameRun
|
||||||
gc_push("transform")
|
gc_push("transform")
|
||||||
gc_translate(305,220)
|
gc_translate(305,220)
|
||||||
setFont(95)
|
setFont(95)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ local function pressKey(P,keyID)
|
|||||||
P.keyPressing[keyID]=true
|
P.keyPressing[keyID]=true
|
||||||
P.actList[keyID](P)
|
P.actList[keyID](P)
|
||||||
if P.control then
|
if P.control then
|
||||||
ins(P.keyTime,1,GAME.frame)
|
ins(P.keyTime,1,P.frameRun)
|
||||||
P.keyTime[11]=nil
|
P.keyTime[11]=nil
|
||||||
end
|
end
|
||||||
P.stat.key=P.stat.key+1
|
P.stat.key=P.stat.key+1
|
||||||
@@ -55,12 +55,12 @@ end
|
|||||||
local function pressKey_Rec(P,keyID)
|
local function pressKey_Rec(P,keyID)
|
||||||
if P.keyAvailable[keyID]and P.alive then
|
if P.keyAvailable[keyID]and P.alive then
|
||||||
local L=GAME.rep
|
local L=GAME.rep
|
||||||
ins(L,GAME.frame)
|
ins(L,P.frameRun)
|
||||||
ins(L,keyID)
|
ins(L,keyID)
|
||||||
P.keyPressing[keyID]=true
|
P.keyPressing[keyID]=true
|
||||||
P.actList[keyID](P)
|
P.actList[keyID](P)
|
||||||
if P.control then
|
if P.control then
|
||||||
ins(P.keyTime,1,GAME.frame)
|
ins(P.keyTime,1,P.frameRun)
|
||||||
P.keyTime[11]=nil
|
P.keyTime[11]=nil
|
||||||
end
|
end
|
||||||
P.stat.key=P.stat.key+1
|
P.stat.key=P.stat.key+1
|
||||||
@@ -68,7 +68,7 @@ local function pressKey_Rec(P,keyID)
|
|||||||
end
|
end
|
||||||
local function releaseKey_Rec(P,keyID)
|
local function releaseKey_Rec(P,keyID)
|
||||||
local L=GAME.rep
|
local L=GAME.rep
|
||||||
ins(L,GAME.frame)
|
ins(L,P.frameRun)
|
||||||
ins(L,32+keyID)
|
ins(L,32+keyID)
|
||||||
P.keyPressing[keyID]=false
|
P.keyPressing[keyID]=false
|
||||||
end
|
end
|
||||||
@@ -114,6 +114,7 @@ local function newEmptyPlayer(id,mini)
|
|||||||
|
|
||||||
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
||||||
|
|
||||||
|
P.frameRun=GAME.frameStart
|
||||||
P.alive=true
|
P.alive=true
|
||||||
P.control=false
|
P.control=false
|
||||||
P.timing=false
|
P.timing=false
|
||||||
@@ -354,6 +355,7 @@ function PLY.newDemoPlayer(id)
|
|||||||
P.sound=true
|
P.sound=true
|
||||||
P.demo=true
|
P.demo=true
|
||||||
|
|
||||||
|
P.frameRun=180
|
||||||
P.draw=PLY.draw.demo
|
P.draw=PLY.draw.demo
|
||||||
P.control=true
|
P.control=true
|
||||||
GAME.modeEnv=DemoEnv
|
GAME.modeEnv=DemoEnv
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ function Player:attack(R,send,time,line,fromStream)
|
|||||||
local atkFX=self.gameEnv.atkFX
|
local atkFX=self.gameEnv.atkFX
|
||||||
if GAME.net then
|
if GAME.net then
|
||||||
if self.type=="human"then--Local player attack others
|
if self.type=="human"then--Local player attack others
|
||||||
ins(GAME.rep,GAME.frame)
|
ins(GAME.rep,self.frameRun)
|
||||||
ins(GAME.rep,
|
ins(GAME.rep,
|
||||||
R.sid+
|
R.sid+
|
||||||
send*0x100+
|
send*0x100+
|
||||||
@@ -352,7 +352,7 @@ function Player:attack(R,send,time,line,fromStream)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fromStream and R.type=="human"then--Local player receiving lines
|
if fromStream and R.type=="human"then--Local player receiving lines
|
||||||
ins(GAME.rep,GAME.frame)
|
ins(GAME.rep,self.frameRun)
|
||||||
ins(GAME.rep,
|
ins(GAME.rep,
|
||||||
self.sid+
|
self.sid+
|
||||||
send*0x100+
|
send*0x100+
|
||||||
@@ -960,7 +960,7 @@ do--Player.drop(self)--Place piece
|
|||||||
function Player:drop()
|
function Player:drop()
|
||||||
local _
|
local _
|
||||||
local CHN=VOC.getFreeChannel()
|
local CHN=VOC.getFreeChannel()
|
||||||
self.dropTime[11]=ins(self.dropTime,1,GAME.frame)--Update speed dial
|
self.dropTime[11]=ins(self.dropTime,1,self.frameRun)--Update speed dial
|
||||||
local ENV=self.gameEnv
|
local ENV=self.gameEnv
|
||||||
local Stat=self.stat
|
local Stat=self.stat
|
||||||
local piece=self.lastPiece
|
local piece=self.lastPiece
|
||||||
@@ -1609,7 +1609,7 @@ function tick_autoPause()
|
|||||||
while true do
|
while true do
|
||||||
yield()
|
yield()
|
||||||
time=time+1
|
time=time+1
|
||||||
if SCN.cur~="play"or GAME.frame<180 then
|
if SCN.cur~="game"or PLAYERS[1].frameRun<180 then
|
||||||
return
|
return
|
||||||
elseif time==120 then
|
elseif time==120 then
|
||||||
pauseGame()
|
pauseGame()
|
||||||
@@ -1697,7 +1697,7 @@ function Player:die()--Called both when win/lose!
|
|||||||
end
|
end
|
||||||
if GAME.net then
|
if GAME.net then
|
||||||
if self.id==1 then
|
if self.id==1 then
|
||||||
ins(GAME.rep,GAME.frame)
|
ins(GAME.rep,self.frameRun)
|
||||||
ins(GAME.rep,0)
|
ins(GAME.rep,0)
|
||||||
else
|
else
|
||||||
if self.lastRecv and self.lastRecv.id==1 then
|
if self.lastRecv and self.lastRecv.id==1 then
|
||||||
|
|||||||
@@ -114,8 +114,29 @@ local update={
|
|||||||
}
|
}
|
||||||
function update.alive(P,dt)
|
function update.alive(P,dt)
|
||||||
local ENV=P.gameEnv
|
local ENV=P.gameEnv
|
||||||
|
local S=P.stat
|
||||||
|
|
||||||
|
P.frameRun=P.frameRun+1
|
||||||
|
if P.frameRun<=180 then
|
||||||
|
if P.frameRun==180 then
|
||||||
|
if P.id==1 then SFX.play("start")end
|
||||||
|
P.control=true
|
||||||
|
P.timing=true
|
||||||
|
P:popNext()
|
||||||
|
elseif P.frameRun==60 or P.frameRun==120 then
|
||||||
|
if P.id==1 then SFX.play("ready")end
|
||||||
|
end
|
||||||
|
if P.movDir~=0 then
|
||||||
|
if P.moving<P.gameEnv.das then
|
||||||
|
P.moving=P.moving+1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
P.moving=0
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
if P.timing then
|
if P.timing then
|
||||||
local S=P.stat
|
|
||||||
S.time=S.time+dt
|
S.time=S.time+dt
|
||||||
S.frame=S.frame+1
|
S.frame=S.frame+1
|
||||||
end
|
end
|
||||||
@@ -123,10 +144,10 @@ function update.alive(P,dt)
|
|||||||
--Calculate key speed
|
--Calculate key speed
|
||||||
do
|
do
|
||||||
local v=0
|
local v=0
|
||||||
for i=2,10 do v=v+i*(i-1)*72/(GAME.frame-P.keyTime[i]+1)end
|
for i=2,10 do v=v+i*(i-1)*72/(P.frameRun-P.keyTime[i]+1)end
|
||||||
P.keySpeed=P.keySpeed*.99+v*.01
|
P.keySpeed=P.keySpeed*.99+v*.01
|
||||||
v=0
|
v=0
|
||||||
for i=2,10 do v=v+i*(i-1)*72/(GAME.frame-P.dropTime[i])end
|
for i=2,10 do v=v+i*(i-1)*72/(P.frameRun-P.dropTime[i])end
|
||||||
P.dropSpeed=P.dropSpeed*.99+v*.01
|
P.dropSpeed=P.dropSpeed*.99+v*.01
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -372,17 +393,17 @@ function update.dead(P,dt)
|
|||||||
updateTasks(P)
|
updateTasks(P)
|
||||||
end
|
end
|
||||||
function update.remote_alive(P,dt)
|
function update.remote_alive(P,dt)
|
||||||
local frmStep=GAME.frame-P.stat.frame
|
local frmDelta=PLAYERS[1].frameRun-P.frameRun
|
||||||
for _=1,
|
for _=1,
|
||||||
frmStep<20 and 1 or
|
frmDelta<20 and 1 or
|
||||||
frmStep<45 and rnd(2)or
|
frmDelta<45 and rnd(2)or
|
||||||
frmStep<90 and 2 or
|
frmDelta<90 and 2 or
|
||||||
frmStep<180 and rnd(2,3) or
|
frmDelta<180 and rnd(2,3) or
|
||||||
3
|
3
|
||||||
do
|
do
|
||||||
local eventTime=P.stream[P.streamProgress]
|
local eventTime=P.stream[P.streamProgress]
|
||||||
if eventTime then--Normal state, event forward
|
if eventTime then--Normal state, event forward
|
||||||
if P.stat.frame==eventTime then--Event time, execute action, read next so don't update immediately
|
if P.frameRun==eventTime then--Event time, execute action, read next so don't update immediately
|
||||||
local event=P.stream[P.streamProgress+1]
|
local event=P.stream[P.streamProgress+1]
|
||||||
if event==0 then--Just wait
|
if event==0 then--Just wait
|
||||||
elseif event<=32 then--Press key
|
elseif event<=32 then--Press key
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ function scene.update(dt)
|
|||||||
timer=timer-dt*.8
|
timer=timer-dt*.8
|
||||||
if timer<0 then
|
if timer<0 then
|
||||||
SFX.play("click")
|
SFX.play("click")
|
||||||
SCN.swapTo("play","none")
|
SCN.swapTo("game","none")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
--Game scene
|
--Game scene
|
||||||
if timer*1.26<1 then
|
if timer*1.26<1 then
|
||||||
SCN.scenes.play.draw()
|
SCN.scenes.game.draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
--Grey screen cover
|
--Grey screen cover
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ end
|
|||||||
|
|
||||||
scene.mouseDown=NULL
|
scene.mouseDown=NULL
|
||||||
local function restart()
|
local function restart()
|
||||||
resetGameData(GAME.frame<240 and"q")
|
resetGameData(PLAYERS[1].frameRun<240 and"q")
|
||||||
noKey=GAME.replaying
|
noKey=GAME.replaying
|
||||||
noTouch=noKey
|
noTouch=noKey
|
||||||
end
|
end
|
||||||
@@ -133,7 +133,7 @@ function scene.update(dt)
|
|||||||
_=GAME.replaying
|
_=GAME.replaying
|
||||||
local P1=PLAYERS[1]
|
local P1=PLAYERS[1]
|
||||||
local L=GAME.rep
|
local L=GAME.rep
|
||||||
while GAME.frame==L[_]do
|
while P1.frameRun==L[_]do
|
||||||
local key=L[_+1]
|
local key=L[_+1]
|
||||||
if key==0 then--Just wait
|
if key==0 then--Just wait
|
||||||
elseif key<=32 then--Press key
|
elseif key<=32 then--Press key
|
||||||
@@ -150,10 +150,6 @@ function scene.update(dt)
|
|||||||
|
|
||||||
touchMoveLastFrame=false
|
touchMoveLastFrame=false
|
||||||
updateVirtualkey()
|
updateVirtualkey()
|
||||||
GAME.frame=GAME.frame+1
|
|
||||||
|
|
||||||
--Counting, include pre-das
|
|
||||||
if checkStart()then return end
|
|
||||||
|
|
||||||
--Update players
|
--Update players
|
||||||
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
||||||
@@ -162,7 +158,7 @@ function scene.update(dt)
|
|||||||
checkWarning()
|
checkWarning()
|
||||||
|
|
||||||
--Fresh royale target
|
--Fresh royale target
|
||||||
if GAME.modeEnv.royaleMode and GAME.frame%120==0 then
|
if GAME.modeEnv.royaleMode and PLAYERS[1].frameRun%120==0 then
|
||||||
freshMostDangerous()
|
freshMostDangerous()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -37,7 +37,6 @@ function scene.sceneInit()
|
|||||||
--Create demo player
|
--Create demo player
|
||||||
destroyPlayers()
|
destroyPlayers()
|
||||||
GAME.modeEnv=NONE
|
GAME.modeEnv=NONE
|
||||||
GAME.frame=0
|
|
||||||
GAME.seed=math.random(2e6)
|
GAME.seed=math.random(2e6)
|
||||||
PLY.newDemoPlayer(1)
|
PLY.newDemoPlayer(1)
|
||||||
PLAYERS[1]:setPosition(520,140,.8)
|
PLAYERS[1]:setPosition(520,140,.8)
|
||||||
@@ -127,7 +126,6 @@ function scene.keyDown(key)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scene.update(dt)
|
function scene.update(dt)
|
||||||
GAME.frame=GAME.frame+1
|
|
||||||
PLAYERS[1]:update(dt)
|
PLAYERS[1]:update(dt)
|
||||||
scrollX=scrollX-2.6
|
scrollX=scrollX-2.6
|
||||||
if scrollX<-tip:getWidth()then
|
if scrollX<-tip:getWidth()then
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ function scene.update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local _=SCN.stat.tar
|
local _=SCN.stat.tar
|
||||||
mapCam.zoomMethod=_=="play"and 1 or _=="mode"and 2
|
mapCam.zoomMethod=_=="game"and 1 or _=="mode"and 2
|
||||||
if mapCam.zoomMethod==1 then
|
if mapCam.zoomMethod==1 then
|
||||||
_=mapCam.zoomK
|
_=mapCam.zoomK
|
||||||
if _<.8 then _=_*1.05 end
|
if _<.8 then _=_*1.05 end
|
||||||
|
|||||||
@@ -199,15 +199,11 @@ function scene.update(dt)
|
|||||||
if NET.checkPlayDisconn()then SCN.back()end
|
if NET.checkPlayDisconn()then SCN.back()end
|
||||||
if not playing then return end
|
if not playing then return end
|
||||||
|
|
||||||
local _
|
local P1=PLAYERS[1]
|
||||||
local GAME=GAME
|
local GAME=GAME
|
||||||
|
|
||||||
touchMoveLastFrame=false
|
touchMoveLastFrame=false
|
||||||
updateVirtualkey()
|
updateVirtualkey()
|
||||||
GAME.frame=GAME.frame+1
|
|
||||||
|
|
||||||
--Counting, include pre-das
|
|
||||||
if checkStart()then return end
|
|
||||||
|
|
||||||
--Update players
|
--Update players
|
||||||
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
||||||
@@ -216,16 +212,16 @@ function scene.update(dt)
|
|||||||
checkWarning()
|
checkWarning()
|
||||||
|
|
||||||
--Upload stream
|
--Upload stream
|
||||||
if GAME.frame-lastUpstreamTime>8 then
|
if P1.frameRun-lastUpstreamTime>8 then
|
||||||
local stream
|
local stream
|
||||||
stream,upstreamProgress=dumpRecording(GAME.rep,upstreamProgress)
|
stream,upstreamProgress=dumpRecording(GAME.rep,upstreamProgress)
|
||||||
if #stream>0 then
|
if #stream>0 then
|
||||||
NET.uploadRecStream(stream)
|
NET.uploadRecStream(stream)
|
||||||
else
|
else
|
||||||
ins(GAME.rep,GAME.frame)
|
ins(GAME.rep,P1.frameRun)
|
||||||
ins(GAME.rep,0)
|
ins(GAME.rep,0)
|
||||||
end
|
end
|
||||||
lastUpstreamTime=PLAYERS[1].alive and GAME.frame or 1e99
|
lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function scene.sceneInit(org)
|
|||||||
local P=PLAYERS[1]
|
local P=PLAYERS[1]
|
||||||
local S=P.stat
|
local S=P.stat
|
||||||
|
|
||||||
timer=org=="play"and 0 or 50
|
timer=org=="game"and 0 or 50
|
||||||
|
|
||||||
local frameLostRate=(S.frame/S.time/60-1)*100
|
local frameLostRate=(S.frame/S.time/60-1)*100
|
||||||
form={
|
form={
|
||||||
@@ -113,14 +113,14 @@ function scene.sceneInit(org)
|
|||||||
else
|
else
|
||||||
rank,trophy=nil
|
rank,trophy=nil
|
||||||
end
|
end
|
||||||
if org~="play"and GAME.prevBG then
|
if org~="game"and GAME.prevBG then
|
||||||
BG.set(GAME.prevBG)
|
BG.set(GAME.prevBG)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.sceneBack()
|
function scene.sceneBack()
|
||||||
love.keyboard.setKeyRepeat(true)
|
love.keyboard.setKeyRepeat(true)
|
||||||
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
STAT.todayTime=STAT.todayTime+PLAYERS[1].stat.time
|
||||||
if not GAME.replaying and(GAME.frame>400 or GAME.result)and not GAME.result then
|
if not GAME.replaying and(PLAYERS[1].frameRun>400 or GAME.result)and not GAME.result then
|
||||||
mergeStat(STAT,PLAYERS[1].stat)
|
mergeStat(STAT,PLAYERS[1].stat)
|
||||||
FILE.save(STAT,"conf/data")
|
FILE.save(STAT,"conf/data")
|
||||||
end
|
end
|
||||||
@@ -130,17 +130,17 @@ function scene.keyDown(key)
|
|||||||
if key=="q"then
|
if key=="q"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
elseif key=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.swapTo(GAME.result and"play"or"depause","none")
|
SCN.swapTo(GAME.result and"game"or"depause","none")
|
||||||
elseif key=="s"then
|
elseif key=="s"then
|
||||||
GAME.prevBG=BG.cur
|
GAME.prevBG=BG.cur
|
||||||
SCN.go("setting_sound")
|
SCN.go("setting_sound")
|
||||||
elseif key=="r"then
|
elseif key=="r"then
|
||||||
resetGameData()
|
resetGameData()
|
||||||
SCN.swapTo("play","none")
|
SCN.swapTo("game","none")
|
||||||
elseif key=="p"then
|
elseif key=="p"then
|
||||||
if(GAME.result or GAME.replaying)and #PLAYERS==1 then
|
if(GAME.result or GAME.replaying)and #PLAYERS==1 then
|
||||||
resetGameData("r")
|
resetGameData("r")
|
||||||
SCN.swapTo("play","none")
|
SCN.swapTo("game","none")
|
||||||
end
|
end
|
||||||
elseif key=="o"then
|
elseif key=="o"then
|
||||||
if(GAME.result or GAME.replaying)and #PLAYERS==1 and not GAME.saved and saveRecording()then
|
if(GAME.result or GAME.replaying)and #PLAYERS==1 and not GAME.saved and saveRecording()then
|
||||||
@@ -166,7 +166,7 @@ local textPos={90,131,-90,131,-200,-25,-90,-181,90,-181,200,-25}
|
|||||||
local dataPos={90,143,-90,143,-200,-13,-90,-169,90,-169,200,-13}
|
local dataPos={90,143,-90,143,-200,-13,-90,-169,90,-169,200,-13}
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
local T=timer*.02
|
local T=timer*.02
|
||||||
if T<1 or GAME.result then SCN.scenes.play.draw()end
|
if T<1 or GAME.result then SCN.scenes.game.draw()end
|
||||||
|
|
||||||
--Dark BG
|
--Dark BG
|
||||||
local _=T
|
local _=T
|
||||||
@@ -194,7 +194,7 @@ function scene.draw()
|
|||||||
gc.draw(drawableText.modeName,40,240)
|
gc.draw(drawableText.modeName,40,240)
|
||||||
|
|
||||||
--Infos
|
--Infos
|
||||||
if GAME.frame>180 then
|
if PLAYERS[1].frameRun>180 then
|
||||||
gc.setLineWidth(2)
|
gc.setLineWidth(2)
|
||||||
--Finesse rank & trophy
|
--Finesse rank & trophy
|
||||||
if rank then
|
if rank then
|
||||||
@@ -264,7 +264,7 @@ function scene.draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--Radar Chart
|
--Radar Chart
|
||||||
if T>.5 and GAME.frame>180 then
|
if T>.5 and PLAYERS[1].frameRun>180 then
|
||||||
T=T*2-1
|
T=T*2-1
|
||||||
gc.setLineWidth(2)
|
gc.setLineWidth(2)
|
||||||
gc.push("transform")
|
gc.push("transform")
|
||||||
|
|||||||
Reference in New Issue
Block a user