修复录像(流)的一帧误差问题,移除玩家keyRec属性
This commit is contained in:
@@ -36,10 +36,8 @@ 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
|
||||||
if P.keyRec then
|
ins(P.keyTime,1,GAME.frame)
|
||||||
ins(P.keyTime,1,GAME.frame)
|
P.keyTime[11]=nil
|
||||||
P.keyTime[11]=nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
P.stat.key=P.stat.key+1
|
P.stat.key=P.stat.key+1
|
||||||
end
|
end
|
||||||
@@ -50,22 +48,20 @@ 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+1)
|
ins(L,GAME.frame)
|
||||||
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
|
||||||
if P.keyRec then
|
ins(P.keyTime,1,GAME.frame)
|
||||||
ins(P.keyTime,1,GAME.frame)
|
P.keyTime[11]=nil
|
||||||
P.keyTime[11]=nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
P.stat.key=P.stat.key+1
|
P.stat.key=P.stat.key+1
|
||||||
end
|
end
|
||||||
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+1)
|
ins(L,GAME.frame)
|
||||||
ins(L,32+keyID)
|
ins(L,32+keyID)
|
||||||
P.keyPressing[keyID]=false
|
P.keyPressing[keyID]=false
|
||||||
end
|
end
|
||||||
@@ -102,7 +98,6 @@ local function newEmptyPlayer(id,mini)
|
|||||||
P.frameWait=rnd(30,120)
|
P.frameWait=rnd(30,120)
|
||||||
P.draw=PLY.draw.small
|
P.draw=PLY.draw.small
|
||||||
else
|
else
|
||||||
P.keyRec=true--If calculate keySpeed
|
|
||||||
P.draw=PLY.draw.norm
|
P.draw=PLY.draw.norm
|
||||||
end
|
end
|
||||||
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
P.randGen=love.math.newRandomGenerator(GAME.seed)
|
||||||
|
|||||||
@@ -118,26 +118,25 @@ function update.alive(P,dt)
|
|||||||
S.time=S.time+dt
|
S.time=S.time+dt
|
||||||
S.frame=S.frame+1
|
S.frame=S.frame+1
|
||||||
end
|
end
|
||||||
if P.keyRec then--Update speeds
|
|
||||||
local frame=GAME.frame
|
|
||||||
|
|
||||||
|
--Calculate key speed
|
||||||
|
do
|
||||||
local v=0
|
local v=0
|
||||||
for i=2,10 do v=v+i*(i-1)*7.2/(frame-P.keyTime[i]+1)end
|
for i=2,10 do v=v+i*(i-1)*7.2/(GAME.frame-P.keyTime[i]+1)end
|
||||||
P.keySpeed=P.keySpeed*.99+v*.1
|
P.keySpeed=P.keySpeed*.99+v*.1
|
||||||
|
|
||||||
v=0
|
v=0
|
||||||
for i=2,10 do v=v+i*(i-1)*7.2/(frame-P.dropTime[i])end
|
for i=2,10 do v=v+i*(i-1)*7.2/(GAME.frame-P.dropTime[i])end
|
||||||
P.dropSpeed=P.dropSpeed*.99+v*.1
|
P.dropSpeed=P.dropSpeed*.99+v*.1
|
||||||
|
end
|
||||||
|
|
||||||
if GAME.modeEnv.royaleMode then
|
if GAME.modeEnv.royaleMode then
|
||||||
v=P.swappingAtkMode
|
v=P.swappingAtkMode
|
||||||
if P.keyPressing[9]then
|
if P.keyPressing[9]then
|
||||||
P.swappingAtkMode=min(v+2,30)
|
P.swappingAtkMode=min(v+2,30)
|
||||||
else
|
else
|
||||||
local tar=#P.field>15 and 4 or 8
|
local tar=#P.field>15 and 4 or 8
|
||||||
if v~=tar then
|
if v~=tar then
|
||||||
P.swappingAtkMode=v+(v<tar and 1 or -1)
|
P.swappingAtkMode=v+(v<tar and 1 or -1)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -340,15 +339,16 @@ function update.alive(P,dt)
|
|||||||
updateTasks(P)
|
updateTasks(P)
|
||||||
end
|
end
|
||||||
function update.dead(P,dt)
|
function update.dead(P,dt)
|
||||||
if P.keyRec then
|
local S=P.stat
|
||||||
local S=P.stat
|
|
||||||
P.keySpeed=P.keySpeed*.96+S.key/S.frame*144
|
--Final average key speed
|
||||||
P.dropSpeed=P.dropSpeed*.96+S.piece/S.frame*144
|
P.keySpeed=P.keySpeed*.96+S.key/S.frame*144
|
||||||
--Final average speeds
|
P.dropSpeed=P.dropSpeed*.96+S.piece/S.frame*144
|
||||||
if GAME.modeEnv.royaleMode then
|
|
||||||
P.swappingAtkMode=min(P.swappingAtkMode+2,30)
|
if GAME.modeEnv.royaleMode then
|
||||||
end
|
P.swappingAtkMode=min(P.swappingAtkMode+2,30)
|
||||||
end
|
end
|
||||||
|
|
||||||
if P.falling>=0 then
|
if P.falling>=0 then
|
||||||
P.falling=P.falling-1
|
P.falling=P.falling-1
|
||||||
if P.falling<0 then
|
if P.falling<0 then
|
||||||
|
|||||||
@@ -270,30 +270,29 @@ function scene.update(dt)
|
|||||||
|
|
||||||
touchMoveLastFrame=false
|
touchMoveLastFrame=false
|
||||||
updateVirtualkey()
|
updateVirtualkey()
|
||||||
|
|
||||||
GAME.frame=GAME.frame+1
|
GAME.frame=GAME.frame+1
|
||||||
|
|
||||||
|
--Counting, include pre-das
|
||||||
|
if checkStart()then return end
|
||||||
|
|
||||||
|
--Update players
|
||||||
|
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
||||||
|
|
||||||
|
--Warning check
|
||||||
|
checkWarning()
|
||||||
|
|
||||||
|
--Upload stream
|
||||||
if GAME.frame-lastUpstreamTime>8 then
|
if GAME.frame-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
|
||||||
wsWrite("S"..data.encode("string","base64",stream))
|
wsWrite("S"..data.encode("string","base64",stream))
|
||||||
else
|
else
|
||||||
ins(GAME.rep,GAME.frame+1)
|
ins(GAME.rep,GAME.frame)
|
||||||
ins(GAME.rep,0)
|
ins(GAME.rep,0)
|
||||||
end
|
end
|
||||||
lastUpstreamTime=PLAYERS[1].alive and GAME.frame or 1e99
|
lastUpstreamTime=PLAYERS[1].alive and GAME.frame or 1e99
|
||||||
end
|
end
|
||||||
|
|
||||||
--Counting, include pre-das
|
|
||||||
if checkStart()then return end
|
|
||||||
|
|
||||||
--Update players
|
|
||||||
for p=1,#PLAYERS do
|
|
||||||
PLAYERS[p]:update(dt)
|
|
||||||
end
|
|
||||||
|
|
||||||
--Warning check
|
|
||||||
checkWarning()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
|
|||||||
@@ -125,16 +125,12 @@ end
|
|||||||
|
|
||||||
function scene.update(dt)
|
function scene.update(dt)
|
||||||
local _
|
local _
|
||||||
local P1=PLAYERS[1]
|
|
||||||
local GAME=GAME
|
local GAME=GAME
|
||||||
|
|
||||||
touchMoveLastFrame=false
|
|
||||||
updateVirtualkey()
|
|
||||||
GAME.frame=GAME.frame+1
|
|
||||||
|
|
||||||
--Replay
|
--Replay
|
||||||
if GAME.replaying then
|
if GAME.replaying then
|
||||||
_=GAME.replaying
|
_=GAME.replaying
|
||||||
|
local P1=PLAYERS[1]
|
||||||
local L=GAME.rep
|
local L=GAME.rep
|
||||||
while GAME.frame==L[_]do
|
while GAME.frame==L[_]do
|
||||||
local key=L[_+1]
|
local key=L[_+1]
|
||||||
@@ -151,21 +147,23 @@ function scene.update(dt)
|
|||||||
GAME.replaying=_
|
GAME.replaying=_
|
||||||
end
|
end
|
||||||
|
|
||||||
|
touchMoveLastFrame=false
|
||||||
|
updateVirtualkey()
|
||||||
|
GAME.frame=GAME.frame+1
|
||||||
|
|
||||||
--Counting, include pre-das
|
--Counting, include pre-das
|
||||||
if checkStart()then return end
|
if checkStart()then return end
|
||||||
|
|
||||||
--Update players
|
--Update players
|
||||||
for p=1,#PLAYERS do
|
for p=1,#PLAYERS do PLAYERS[p]:update(dt)end
|
||||||
PLAYERS[p]:update(dt)
|
|
||||||
end
|
--Warning check
|
||||||
|
checkWarning()
|
||||||
|
|
||||||
--Fresh royale target
|
--Fresh royale target
|
||||||
if GAME.modeEnv.royaleMode and GAME.frame%120==0 then
|
if GAME.modeEnv.royaleMode and GAME.frame%120==0 then
|
||||||
freshMostDangerous()
|
freshMostDangerous()
|
||||||
end
|
end
|
||||||
|
|
||||||
--Warning check
|
|
||||||
checkWarning()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drawAtkPointer(x,y)
|
local function drawAtkPointer(x,y)
|
||||||
|
|||||||
Reference in New Issue
Block a user