From 2cb5b54d334ebcf7cc9de3a487b46c2da3d9bd9d Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 22 Mar 2021 21:37:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=BA=9B=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/update.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/parts/player/update.lua b/parts/player/update.lua index 0834de0f..be8170c2 100644 --- a/parts/player/update.lua +++ b/parts/player/update.lua @@ -379,11 +379,10 @@ function update.remote_alive(P,dt) frmStep<480 and rnd(2,3) or 3 repeat - local pos=P.streamProgress - local eventTime=P.stream[pos] - if eventTime then - if P.stat.frame==eventTime then - local event=P.stream[pos+1] + local eventTime=P.stream[P.streamProgress] + if eventTime then--Normal state, event forward + if P.stat.frame==eventTime then--Event time, execute action, read next so don't update immediately + local event=P.stream[P.streamProgress+1] if event==0 then--Just wait elseif event<=32 then--Press key P:pressKey(event) @@ -419,13 +418,13 @@ function update.remote_alive(P,dt) end end end - P.streamProgress=pos+2 - else + P.streamProgress=P.streamProgress+2 + else--No event now, run one frame update.alive(P,dt) frmStep=frmStep-1 end - else - frmStep=frmStep-1 + else--Pause state, no actions, quit loop + break end until frmStep<=0 end