添加逻辑追帧功能,设置默认关闭,联网强制打开防止低帧率设备影响游戏体验

This commit is contained in:
MrZ626
2021-09-24 02:08:00 +08:00
parent 4c7ba04274
commit c927e58ce4
12 changed files with 82 additions and 63 deletions

View File

@@ -201,6 +201,7 @@ ROOMENV={
lock=60,
wait=0,
fall=0,
FTLock=true,
--Control
nextCount=6,
@@ -250,6 +251,7 @@ SETTING={--Settings
ihs=true,irs=true,ims=true,
RS='TRS',
swap=true,
FTLock=true,
--System
reTime=4,

View File

@@ -351,7 +351,9 @@ return{
splashFX="Splash FX",
shakeFX="Field Sway",
atkFX="Atk. FX",
frame="Render Frame Rate(%)",
FTlock="Frame-Time Lock",
text="Line Clear Pop-up",
score="Score Pop-up",

View File

@@ -317,7 +317,9 @@ return{
splashFX="FX Vis. de Splash",
shakeFX="Bamboleo del Tablero",
atkFX="FX Vis. de Ataque",
frame="Ratio de FPSs(%)",
-- FTlock="Frame-Time Lock",
text="Texto de Acciones",
score="Puntaje en Pantalla",

View File

@@ -315,7 +315,9 @@ return{
splashFX="Effets splash",
shakeFX="Tremblements de l'écran",
atkFX="Effets d'attaque",
frame="Montrer les FPS(%)",
-- FTlock="Frame-Time Lock",
text="Texte d'action",
score="Pop-up de score",

View File

@@ -339,7 +339,9 @@ return{
splashFX="Nível FX Splash",
shakeFX="Nível Tremida Tabuleiro",
atkFX="Nível FX Atk.",
frame="Render Frame Rate(%)",
-- FTlock="Frame-Time Lock",
text="Texto de ação",
score="Pop-up de pontos",

View File

@@ -233,7 +233,9 @@ return{
splashFX="↑↑↑~",
shakeFX="~|~|~",
atkFX="→→~",
frame="|=|%",
FTlock="||=|→→|=||",
text="ABC",
score="+123",

View File

@@ -351,7 +351,9 @@ return{
splashFX="溅射特效",
shakeFX="晃动特效",
atkFX="攻击特效",
frame="绘制帧率(%)",
FTlock="逻辑追帧",
text="消行文本",
score="分数动画",

View File

@@ -352,7 +352,9 @@ return{
splashFX="飞溅外汇",
shakeFX="磁场摆动",
atkFX="攻击外汇",
frame="渲染帧率(%)",
FTlock="逻辑追帧",
text="行清除弹出窗口",
score="分数弹出窗口",

View File

@@ -4,6 +4,7 @@ return{
sddas=2,sdarr=2,
ihs=true,irs=true,ims=true,
swap=true,
FTLock=true,
ghostType='gray',
block=true,ghost=.3,center=1,

View File

@@ -131,7 +131,7 @@ local function _newEmptyPlayer(id,mini)
P.alive=true
P.control=false
P.timing=false
P.trigTime=0
P.trigFrame=0
P.result=false--String: 'finish'|'win'|'lose'
P.stat=_getNewStatTable()
P.modeData=setmetatable({},modeDataMeta)--Data use by mode

View File

@@ -1685,7 +1685,7 @@ end
--------------------------</Tick>--------------------------
--------------------------<Event>--------------------------
local function _updateMisc(P,dt)
local function _updateMisc(P)
--Finesse combo animation
if P.finesseComboTime>0 then
P.finesseComboTime=P.finesseComboTime-1
@@ -1748,6 +1748,38 @@ local function _updateMisc(P,dt)
end
end
--Field shaking
if P.gameEnv.shakeFX then
local O=P.fieldOff
O.vx=O.vx*.7-abs(O.x)^1.3*(O.x>0 and .1 or -.1)
O.x=O.x+O.vx
O.vy=O.vy*.7-abs(O.y)^1.2*(O.y>0 and .1 or -.1)
O.y=O.y+O.vy
O.va=O.va*.7-abs(O.a)^1.4*(O.a>0 and .08 or -.08)
O.a=O.a+O.va
if abs(O.a)<.0006 then
O.a,O.va=0,0
end
end
--Update texts
if P.bonus then
TEXT.update(P.bonus)
end
--Update tasks
local L=P.tasks
for i=#L,1,-1 do
local tr=L[i].thread
assert(resume(tr))
if status(tr)=='dead'then
rem(L,i)
end
end
end
local function _updateFX(P,dt)
--Update lock FX
for i=#P.lockFX,1,-1 do
local S=P.lockFX[i]
@@ -1783,37 +1815,6 @@ local function _updateMisc(P,dt)
rem(P.clearFX,i)
end
end
--Field shaking
if P.gameEnv.shakeFX then
local O=P.fieldOff
O.vx=O.vx*.7-abs(O.x)^1.3*(O.x>0 and .1 or -.1)
O.x=O.x+O.vx
O.vy=O.vy*.7-abs(O.y)^1.2*(O.y>0 and .1 or -.1)
O.y=O.y+O.vy
O.va=O.va*.7-abs(O.a)^1.4*(O.a>0 and .08 or -.08)
O.a=O.a+O.va
if abs(O.a)<.0006 then
O.a,O.va=0,0
end
end
--Update texts
if P.bonus then
TEXT.update(P.bonus)
end
--Update tasks
local L=P.tasks
for i=#L,1,-1 do
local tr=L[i].thread
assert(resume(tr))
if status(tr)=='dead'then
rem(L,i)
end
end
end
local function update_alive(P,dt)
local ENV=P.gameEnv
@@ -2050,8 +2051,7 @@ local function update_alive(P,dt)
P.b2b1=max(P.b2b1*.95+P.b2b*.05-.6,P.b2b)
end
--Others
_updateMisc(P,dt)
_updateMisc(P)
-- P:setPosition(640-150-(30*(P.curX+P.cur.sc[2])-15),30*(P.curY+P.cur.sc[1])+15-300+(ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0))
end
local function update_remote_alive(P,dt)
@@ -2110,7 +2110,7 @@ local function update_remote_alive(P,dt)
end
end
end
local function update_dead(P,dt)
local function update_dead(P)
local S=P.stat
--Final average speed
@@ -2133,7 +2133,7 @@ local function update_dead(P,dt)
if P.b2b1>0 then
P.b2b1=max(0,P.b2b1*.92-1)
end
_updateMisc(P,dt)
_updateMisc(P)
end
function Player:_die()
self.alive=false
@@ -2160,16 +2160,16 @@ function Player:_die()
end
end
function Player:update(dt)
-- self.trigTime=self.trigTime+dt
-- while self.trigTime>.016666666666666666 do
(
self.alive and(
self.type=='remote'and update_remote_alive
or update_alive
)or update_dead
)(self,dt)
-- self.trigTime=self.trigTime-.016666666666666666
-- end
if self.type=='remote'and self.alive then
update_remote_alive(self,dt)
else
self.trigFrame=self.trigFrame+(self.gameEnv.FTLock and dt*60 or 1)
while self.trigFrame>=1 do
(self.alive and update_alive or update_dead)(self,dt)
self.trigFrame=self.trigFrame-1
end
end
_updateFX(self,dt)
end
function Player:revive()
self.waiting=62

View File

@@ -44,10 +44,10 @@ scene.widgetList={
WIDGET.newSwitch{name="bagLine", x=380,y=390,lim=300,disp=SETval('bagLine'),code=SETrev('bagLine')},
WIDGET.newSelector{name="ghostType", x=915,y=180, w=350,list={'color','gray','colorCell','grayCell','colorLine','grayLine'},disp=SETval('ghostType'),code=SETsto('ghostType')},
WIDGET.newSlider{name="ghost", x=740,y=240,lim=280,w=350,unit=1,disp=SETval('ghost'), show="percent",code=SETsto('ghost')},
WIDGET.newSlider{name="center", x=740,y=300,lim=280,w=350,unit=1,disp=SETval('center'), show="percent",code=SETsto('center')},
WIDGET.newSlider{name="grid", x=740,y=360,lim=280,w=350,unit=.4,disp=SETval('grid'), show="percent",code=SETsto('grid')},
WIDGET.newSlider{name="lineNum", x=740,y=420,lim=280,w=350,unit=1,disp=SETval('lineNum'), show="percent",code=SETsto('lineNum')},
WIDGET.newSlider{name="ghost", x=740,y=240,lim=280,w=350,unit=1,disp=SETval('ghost'), show="percent",code=SETsto('ghost')},
WIDGET.newSlider{name="center", x=740,y=300,lim=280,w=350,unit=1,disp=SETval('center'), show="percent",code=SETsto('center')},
WIDGET.newSlider{name="grid", x=740,y=360,lim=280,w=350,unit=.4,disp=SETval('grid'), show="percent",code=SETsto('grid')},
WIDGET.newSlider{name="lineNum", x=740,y=420,lim=280,w=350,unit=1,disp=SETval('lineNum'), show="percent",code=SETsto('lineNum')},
WIDGET.newSlider{name="lockFX", x=330,y=460,lim=280,w=540,unit=5,disp=SETval('lockFX'), code=SETsto('lockFX')},
WIDGET.newSlider{name="dropFX", x=330,y=520,lim=280,w=540,unit=5,disp=SETval('dropFX'), code=SETsto('dropFX')},
@@ -56,20 +56,22 @@ scene.widgetList={
WIDGET.newSlider{name="splashFX", x=330,y=700,lim=280,w=540,unit=5,disp=SETval('splashFX'), code=SETsto('splashFX')},
WIDGET.newSlider{name="shakeFX", x=330,y=760,lim=280,w=540,unit=5,disp=SETval('shakeFX'), code=SETsto('shakeFX')},
WIDGET.newSlider{name="atkFX", x=330,y=820,lim=280,w=540,unit=5,disp=SETval('atkFX'), code=SETsto('atkFX')},
WIDGET.newSelector{name="frame", x=600,y=890,lim=280,w=460,list={8,10,13,17,22,29,37,47,62,80,100},disp=SETval('frameMul'),code=SETsto('frameMul')},
WIDGET.newSwitch{name="text", x=450,y=980,lim=360,disp=SETval('text'), code=SETrev('text')},
WIDGET.newSwitch{name="score", x=450,y=1030,lim=360,disp=SETval('score'), code=SETrev('score')},
WIDGET.newSwitch{name="bufferWarn", x=450,y=1100,lim=360,disp=SETval('bufferWarn'), code=SETrev('bufferWarn')},
WIDGET.newSwitch{name="showSpike", x=450,y=1150,lim=360,disp=SETval('showSpike'), code=SETrev('showSpike')},
WIDGET.newSwitch{name="nextPos", x=450,y=1220,lim=360,disp=SETval('nextPos'), code=SETrev('nextPos')},
WIDGET.newSwitch{name="highCam", x=450,y=1270,lim=360,disp=SETval('highCam'), code=SETrev('highCam')},
WIDGET.newSwitch{name="warn", x=450,y=1340,lim=360,disp=SETval('warn'), code=SETrev('warn')},
WIDGET.newSelector{name="frame", x=400,y=890,lim=280,w=460,list={8,10,13,17,22,29,37,47,62,80,100},disp=SETval('frameMul'),code=SETsto('frameMul')},
WIDGET.newSwitch{name="FTlock", x=950,y=890,lim=290,disp=SETval('FTLock'), code=SETsto('FTLock')},
WIDGET.newSwitch{name="clickFX", x=950,y=980,lim=360,disp=SETval('clickFX'), code=SETrev('clickFX')},
WIDGET.newSwitch{name="power", x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=SETrev('powerInfo')},
WIDGET.newSwitch{name="clean", x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=SETrev('cleanCanvas')},
WIDGET.newSwitch{name="fullscreen", x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=switchFullscreen},
WIDGET.newSwitch{name="text", x=450,y=980,lim=360,disp=SETval('text'), code=SETrev('text')},
WIDGET.newSwitch{name="score", x=450,y=1030,lim=360,disp=SETval('score'), code=SETrev('score')},
WIDGET.newSwitch{name="bufferWarn", x=450,y=1100,lim=360,disp=SETval('bufferWarn'), code=SETrev('bufferWarn')},
WIDGET.newSwitch{name="showSpike", x=450,y=1150,lim=360,disp=SETval('showSpike'), code=SETrev('showSpike')},
WIDGET.newSwitch{name="nextPos", x=450,y=1220,lim=360,disp=SETval('nextPos'), code=SETrev('nextPos')},
WIDGET.newSwitch{name="highCam", x=450,y=1270,lim=360,disp=SETval('highCam'), code=SETrev('highCam')},
WIDGET.newSwitch{name="warn", x=450,y=1340,lim=360,disp=SETval('warn'), code=SETrev('warn')},
WIDGET.newSwitch{name="clickFX", x=950,y=980,lim=360,disp=SETval('clickFX'), code=SETrev('clickFX')},
WIDGET.newSwitch{name="power", x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=SETrev('powerInfo')},
WIDGET.newSwitch{name="clean", x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=SETrev('cleanCanvas')},
WIDGET.newSwitch{name="fullscreen", x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=switchFullscreen},
WIDGET.newSwitch{name="bg", x=950,y=1340,lim=360,disp=SETval('bg'),
code=function()
BG.set('none')