Various local prediction and input processing related fixes

This commit is contained in:
karlberg
2021-05-15 15:10:17 -07:00
parent 61c24ee265
commit c6ea0c0a46
13 changed files with 78 additions and 74 deletions
@@ -9,7 +9,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma optimize ("", off)
#include <Multiplayer/NetworkInput/NetworkInput.h>
#include <Multiplayer/Components/MultiplayerComponentRegistry.h>
#include <Multiplayer/Components/NetBindComponent.h>
@@ -166,6 +166,7 @@ namespace Multiplayer
void NetworkInput::CopyInternal(const NetworkInput& rhs)
{
m_inputId = rhs.m_inputId;
m_hostFrameId = rhs.m_hostFrameId;
m_hostTimeMs = rhs.m_hostTimeMs;
m_componentInputs.resize(rhs.m_componentInputs.size());
for (int32_t i = 0; i < rhs.m_componentInputs.size(); ++i)
@@ -175,7 +176,7 @@ namespace Multiplayer
{
m_componentInputs[i] = AZStd::move(GetMultiplayerComponentRegistry()->AllocateComponentInput(rhsComponentId));
}
*m_componentInputs[i] = *rhs.m_componentInputs[i];
*(m_componentInputs[i]) = *(rhs.m_componentInputs[i]);
}
m_wasAttached = rhs.m_wasAttached;
}
@@ -48,16 +48,6 @@ namespace Multiplayer
return m_inputs[index].m_networkInput;
}
void NetworkInputArray::SetPreviousInputId(ClientInputId previousInputId)
{
m_previousInputId = previousInputId;
}
ClientInputId NetworkInputArray::GetPreviousInputId() const
{
return m_previousInputId;
}
bool NetworkInputArray::Serialize(AzNetworking::ISerializer& serializer)
{
// Always serialize the full first element
@@ -102,7 +92,6 @@ namespace Multiplayer
}
}
}
serializer.Serialize(m_previousInputId, "PreviousInputId");
return true;
}
}
@@ -33,9 +33,6 @@ namespace Multiplayer
NetworkInput& operator[](uint32_t index);
const NetworkInput& operator[](uint32_t index) const;
void SetPreviousInputId(ClientInputId previousInputId);
ClientInputId GetPreviousInputId() const;
bool Serialize(AzNetworking::ISerializer& serializer);
private:
@@ -49,6 +46,5 @@ namespace Multiplayer
ConstNetworkEntityHandle m_owner;
AZStd::array<Wrapper, MaxElements> m_inputs;
ClientInputId m_previousInputId;
};
}