| 1321 | } |
| 1322 | |
| 1323 | void GameConnection::writePacket(BitStream *bstream, PacketNotify *note) |
| 1324 | { |
| 1325 | bstream->clearCompressionPoint(); |
| 1326 | bstream->clearStringBuffer(); |
| 1327 | |
| 1328 | GamePacketNotify *gnote = (GamePacketNotify *) note; |
| 1329 | |
| 1330 | U32 startPos = bstream->getBitPosition(); |
| 1331 | if (isConnectionToServer()) |
| 1332 | { |
| 1333 | mMoveList->clientWriteMovePacket(bstream); |
| 1334 | |
| 1335 | bstream->writeFlag(mCameraPos == 1); |
| 1336 | |
| 1337 | // if we're recording, we want to make sure that we get periodic updates of the |
| 1338 | // control object "just in case" - ie if the math copro is different between the |
| 1339 | // recording machine (SIMD vs FPU), we get periodic corrections |
| 1340 | |
| 1341 | bool forceUpdate = false; |
| 1342 | if(isRecording()) |
| 1343 | { |
| 1344 | U32 currentTime = Platform::getVirtualMilliseconds(); |
| 1345 | if(currentTime - mLastControlRequestTime > ControlRequestTime) |
| 1346 | { |
| 1347 | mLastControlRequestTime = currentTime; |
| 1348 | forceUpdate=true;; |
| 1349 | } |
| 1350 | } |
| 1351 | bstream->writeFlag(forceUpdate); |
| 1352 | |
| 1353 | // Control scheme changed? |
| 1354 | if(bstream->writeFlag(mUpdateControlScheme)) |
| 1355 | { |
| 1356 | bstream->writeFlag(mAbsoluteRotation); |
| 1357 | bstream->writeFlag(mAddYawToAbsRot); |
| 1358 | bstream->writeFlag(mAddPitchToAbsRot); |
| 1359 | mUpdateControlScheme = false; |
| 1360 | } |
| 1361 | |
| 1362 | // first person changed? |
| 1363 | if(bstream->writeFlag(mUpdateFirstPerson)) |
| 1364 | { |
| 1365 | bstream->writeFlag(mFirstPerson); |
| 1366 | mUpdateFirstPerson = false; |
| 1367 | } |
| 1368 | |
| 1369 | // camera fov changed? (server fov resolution is 1 degree) |
| 1370 | if(bstream->writeFlag(mUpdateCameraFov)) |
| 1371 | { |
| 1372 | bstream->writeInt(mClamp(S32(mCameraFov), S32(MinCameraFov), S32(MaxCameraFov)), 8); |
| 1373 | mUpdateCameraFov = false; |
| 1374 | } |
| 1375 | DEBUG_LOG(("PKLOG %d CLIENTMOVES: %d", getId(), bstream->getCurPos() - startPos)); |
| 1376 | } |
| 1377 | else |
| 1378 | { |
| 1379 | mMoveList->serverWriteMovePacket(bstream); |
| 1380 |
nothing calls this directly
no test coverage detected