Freeze MP position during replay.
Now you can replay and watch your favourite landing 101 times without pi**ing off everyone else playing MP. :)
This commit is contained in:
parent
39bc2d53ff
commit
da32e9332c
1 changed files with 133 additions and 116 deletions
|
@ -536,12 +536,27 @@ FGMultiplayMgr::SendMyPosition(const FGExternalMotionData& motionInfo)
|
|||
return;
|
||||
}
|
||||
|
||||
MsgBuf msgBuf;
|
||||
static MsgBuf msgBuf;
|
||||
static unsigned msgLen = 0;
|
||||
T_PositionMsg* PosMsg = msgBuf.posMsg();
|
||||
|
||||
strncpy(PosMsg->Model, fgGetString("/sim/model/path"), MAX_MODEL_NAME_LEN);
|
||||
PosMsg->Model[MAX_MODEL_NAME_LEN - 1] = '\0';
|
||||
|
||||
if (fgGetBool("/sim/freeze/replay-state", true))
|
||||
{
|
||||
// do not send position updates during replay
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
{
|
||||
// no movement during replay
|
||||
PosMsg->linearVel[i] = XDR_encode_float (0.0);
|
||||
PosMsg->angularVel[i] = XDR_encode_float (0.0);
|
||||
PosMsg->linearAccel[i] = XDR_encode_float (0.0);
|
||||
PosMsg->angularAccel[i] = XDR_encode_float (0.0);
|
||||
}
|
||||
// all other data remains unchanged (resend last state)
|
||||
}
|
||||
else
|
||||
{
|
||||
PosMsg->time = XDR_encode_double (motionInfo.time);
|
||||
PosMsg->lag = XDR_encode_double (motionInfo.lag);
|
||||
for (unsigned i = 0 ; i < 3; ++i)
|
||||
|
@ -654,8 +669,10 @@ FGMultiplayMgr::SendMyPosition(const FGExternalMotionData& motionInfo)
|
|||
++it;
|
||||
}
|
||||
escape:
|
||||
unsigned msgLen = reinterpret_cast<char*>(ptr) - msgBuf.Msg;
|
||||
msgLen = reinterpret_cast<char*>(ptr) - msgBuf.Msg;
|
||||
FillMsgHdr(msgBuf.msgHdr(), POS_DATA_ID, msgLen);
|
||||
}
|
||||
if (msgLen>0)
|
||||
mSocket->sendto(msgBuf.Msg, msgLen, 0, &mServer);
|
||||
SG_LOG(SG_NETWORK, SG_DEBUG, "FGMultiplayMgr::SendMyPosition");
|
||||
} // FGMultiplayMgr::SendMyPosition()
|
||||
|
|
Loading…
Reference in a new issue