mirror of
https://github.com/genxium/DelayNoMore
synced 2024-12-25 11:18:55 +00:00
Fixed (refRenderFrameId, snapshotStFrameId) pairing in "markConfirmationIfApplicable".
This commit is contained in:
parent
17cac19c62
commit
e3fe773634
@ -1102,18 +1102,22 @@ func (pR *Room) markConfirmationIfApplicable(inputFrameUpsyncBatch []*InputFrame
|
||||
}
|
||||
}
|
||||
|
||||
refRenderFrameIdIfNeeded := pR.CurDynamicsRenderFrameId - 1
|
||||
var inputsBufferSnapshot []*InputFrameDownsync = nil
|
||||
if 0 < newAllConfirmedCount {
|
||||
snapshotStFrameId := pR.LastAllConfirmedInputFrameId - newAllConfirmedCount
|
||||
if snapshotStFrameId < 0 {
|
||||
// This applies to the first all-confirmed inputFrame whose inputFrameId is 0
|
||||
snapshotStFrameId = 0
|
||||
}
|
||||
/*
|
||||
[WARNING]
|
||||
|
||||
If "pR.InputsBufferLock" was previously held by "battleMainLoop -> applyInputFrameDownsyncDynamics", then this value would be just (pR.LastAllConfirmedInputFrameId - newAllConfirmedCount).
|
||||
|
||||
However if "pR.InputsBufferLock" was previously held by another "OnBattleCmdReceived -> markConfirmationIfApplicable", this value might be smaller than (pR.LastAllConfirmedInputFrameId - newAllConfirmedCount)!
|
||||
*/
|
||||
snapshotStFrameId := pR.ConvertToInputFrameId(refRenderFrameIdIfNeeded, pR.InputDelayFrames)
|
||||
// Duplicate downsynced inputFrameIds will be filtered out by frontend.
|
||||
inputsBufferSnapshot = pR.createInputsBufferSnapshot(snapshotStFrameId, pR.LastAllConfirmedInputFrameId+1)
|
||||
}
|
||||
|
||||
Logger.Debug(fmt.Sprintf("markConfirmationIfApplicable for roomId=%v returning newAllConfirmedCount=%d: InputsBuffer=%v", pR.Id, newAllConfirmedCount, pR.InputsBufferString(false)))
|
||||
refRenderFrameIdIfNeeded := pR.CurDynamicsRenderFrameId - 1
|
||||
return newAllConfirmedCount, refRenderFrameIdIfNeeded, inputsBufferSnapshot
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
210.2448888647705,
|
||||
210.43753679824133,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
Loading…
Reference in New Issue
Block a user