Skip to content

Commit 859e6ce

Browse files
committed
Remove outdated bitstream checks
1 parent 25e07c4 commit 859e6ce

30 files changed

+379
-1050
lines changed

Client/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -703,16 +703,6 @@ bool CClientGame::StartGame(const char* szNick, const char* szPassword, eServerT
703703
pBitStream->Write(strTemp.c_str(), MAX_PLAYER_NICK_LENGTH);
704704
pBitStream->Write(reinterpret_cast<const char*>(Password.data), sizeof(MD5));
705705

706-
// Append community information (Removed)
707-
std::string strUser;
708-
pBitStream->Write(strUser.c_str(), MAX_SERIAL_LENGTH);
709-
710-
// Send an empty string if server still has old Discord implementation (#2499)
711-
if (g_pNet->CanServerBitStream(eBitStreamVersion::Discord_InitialImplementation) && !g_pNet->CanServerBitStream(eBitStreamVersion::Discord_Cleanup))
712-
{
713-
pBitStream->WriteString<uchar>("");
714-
}
715-
716706
// Send the packet as joindata
717707
g_pNet->SendPacket(PACKET_ID_PLAYER_JOINDATA, pBitStream, PACKET_PRIORITY_HIGH, PACKET_RELIABILITY_RELIABLE_ORDERED);
718708
g_pNet->DeallocateNetBitStream(pBitStream);
@@ -5281,18 +5271,15 @@ void CClientGame::SendExplosionSync(const CVector& vecPosition, eExplosionType T
52815271

52825272
// Because we use this packet to notify the server of blown vehicles,
52835273
// we include a bit, whether the vehicle was blown without an explosion
5284-
if (pBitStream->Can(eBitStreamVersion::VehicleBlowStateSupport))
5274+
if (pOrigin->GetType() == CCLIENTVEHICLE)
52855275
{
5286-
if (pOrigin->GetType() == CCLIENTVEHICLE)
5287-
{
5288-
auto vehicle = reinterpret_cast<CClientVehicle*>(pOrigin);
5289-
pBitStream->WriteBit(1);
5290-
pBitStream->WriteBit(vehicleBlowState.value_or(vehicle->GetBlowState()) == VehicleBlowState::BLOWN);
5291-
}
5292-
else
5293-
{
5294-
pBitStream->WriteBit(0);
5295-
}
5276+
auto vehicle = reinterpret_cast<CClientVehicle*>(pOrigin);
5277+
pBitStream->WriteBit(1);
5278+
pBitStream->WriteBit(vehicleBlowState.value_or(vehicle->GetBlowState()) == VehicleBlowState::BLOWN);
5279+
}
5280+
else
5281+
{
5282+
pBitStream->WriteBit(0);
52965283
}
52975284

52985285
// Convert position

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6477,12 +6477,6 @@ bool CClientPed::EnterVehicle(CClientVehicle* pVehicle, bool bPassenger)
64776477
return false;
64786478
}
64796479

6480-
// Check the server is compatible if we are a ped
6481-
if (!IsLocalPlayer() && !g_pNet->CanServerBitStream(eBitStreamVersion::PedEnterExit))
6482-
{
6483-
return false;
6484-
}
6485-
64866480
// Are we already inside a vehicle
64876481
if (GetOccupiedVehicle())
64886482
{
@@ -6651,11 +6645,7 @@ bool CClientPed::EnterVehicle(CClientVehicle* pVehicle, bool bPassenger)
66516645
return false;
66526646
}
66536647

6654-
// Write the ped ID to it if server supports it
6655-
if (g_pNet->CanServerBitStream(eBitStreamVersion::PedEnterExit))
6656-
{
6657-
pBitStream->Write(GetID());
6658-
}
6648+
pBitStream->Write(GetID());
66596649

66606650
// Write the vehicle id to it and that we're requesting to get into it
66616651
pBitStream->Write(pVehicle->GetID());
@@ -6718,12 +6708,6 @@ bool CClientPed::ExitVehicle()
67186708
return false;
67196709
}
67206710

6721-
// Check the server is compatible if we are a ped
6722-
if (!IsLocalPlayer() && !g_pNet->CanServerBitStream(eBitStreamVersion::PedEnterExit))
6723-
{
6724-
return false;
6725-
}
6726-
67276711
// Are we already sending an in/out request or not allowed to create a new in/out?
67286712
if (m_bNoNewVehicleTask // Are we permitted to even enter a vehicle?
67296713
|| m_VehicleInOutID != INVALID_ELEMENT_ID // Make sure we're not already processing a vehicle enter (would refer to valid ID if we were)
@@ -6784,11 +6768,7 @@ bool CClientPed::ExitVehicle()
67846768
return false;
67856769
}
67866770

6787-
// Write the ped ID to it if server supports it
6788-
if (g_pNet->CanServerBitStream(eBitStreamVersion::PedEnterExit))
6789-
{
6790-
pBitStream->Write(GetID());
6791-
}
6771+
pBitStream->Write(GetID());
67926772

67936773
// Write the vehicle id to it and that we're requesting to get out of it
67946774
pBitStream->Write(pOccupiedVehicle->GetID());
@@ -6916,10 +6896,7 @@ void CClientPed::UpdateVehicleInOut()
69166896
if (pBitStream)
69176897
{
69186898
// Write the ped ID to it
6919-
if (g_pNet->CanServerBitStream(eBitStreamVersion::PedEnterExit))
6920-
{
6921-
pBitStream->Write(GetID());
6922-
}
6899+
pBitStream->Write(GetID());
69236900

69246901
// Write the car id and the action id (enter complete)
69256902
pBitStream->Write(m_VehicleInOutID);
@@ -6969,10 +6946,7 @@ void CClientPed::UpdateVehicleInOut()
69696946
if (pBitStream)
69706947
{
69716948
// Write the ped or player ID to it
6972-
if (g_pNet->CanServerBitStream(eBitStreamVersion::PedEnterExit))
6973-
{
6974-
pBitStream->Write(GetID());
6975-
}
6949+
pBitStream->Write(GetID());
69766950

69776951
// Write the car id and the action id (enter complete)
69786952
pBitStream->Write(m_VehicleInOutID);
@@ -7016,10 +6990,7 @@ void CClientPed::UpdateVehicleInOut()
70166990
if (pBitStream)
70176991
{
70186992
// Write the ped or player ID to it
7019-
if (g_pNet->CanServerBitStream(eBitStreamVersion::PedEnterExit))
7020-
{
7021-
pBitStream->Write(GetID());
7022-
}
6993+
pBitStream->Write(GetID());
70236994

70246995
// Write the car id and the action id (enter complete)
70256996
pBitStream->Write(m_VehicleInOutID);
@@ -7131,10 +7102,7 @@ void CClientPed::UpdateVehicleInOut()
71317102
return;
71327103

71337104
// Write the ped or player ID to it
7134-
if (g_pNet->CanServerBitStream(eBitStreamVersion::PedEnterExit))
7135-
{
7136-
pBitStream->Write(GetID());
7137-
}
7105+
pBitStream->Write(GetID());
71387106

71397107
// Vehicle id
71407108
pBitStream->Write(pOccupiedVehicle->GetID());

Client/mods/deathmatch/logic/CNetAPI.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,9 +1118,7 @@ void CNetAPI::WritePlayerPuresync(CClientPlayer* pPlayerModel, NetBitStreamInter
11181118
flags.data.bHasAWeapon = (pPlayerWeapon != NULL);
11191119
flags.data.bSyncingVelocity = (!flags.data.bIsOnGround || (pPlayerModel->GetPlayerSyncCount() % 4) == 0);
11201120
flags.data.bStealthAiming = (pPlayerModel->IsStealthAiming() == true);
1121-
1122-
if (BitStream.Can(eBitStreamVersion::IsPedReloadingWeapon))
1123-
flags.data2.isReloadingWeapon = (pPlayerModel->IsReloadingWeapon() == true);
1121+
flags.data.isReloadingWeapon = (pPlayerModel->IsReloadingWeapon() == true);
11241122

11251123
if (pPlayerWeapon->GetSlot() > 15)
11261124
flags.data.bHasAWeapon = false;
@@ -1545,8 +1543,7 @@ void CNetAPI::ReadVehiclePuresync(CClientPlayer* pPlayer, CClientVehicle* pVehic
15451543

15461544
pPlayer->SetControllerState(ControllerState);
15471545

1548-
if (BitStream.Can(eBitStreamVersion::SetElementOnFire))
1549-
pVehicle->SetOnFire(BitStream.ReadBit());
1546+
pVehicle->SetOnFire(BitStream.ReadBit());
15501547

15511548
// Remember now as the last puresync time
15521549
CVector vecPosition;
@@ -1773,8 +1770,7 @@ void CNetAPI::WriteVehiclePuresync(CClientPed* pPlayerModel, CClientVehicle* pVe
17731770
BitStream.WriteBit(ControllerState.RightShoulder2 != 0);
17741771
}
17751772

1776-
if (BitStream.Can(eBitStreamVersion::SetElementOnFire))
1777-
BitStream.WriteBit(pVehicle->IsOnFire());
1773+
BitStream.WriteBit(pVehicle->IsOnFire());
17781774

17791775
// Write the sent position to the interpolator
17801776
AddInterpolation(vecPosition);
@@ -1786,19 +1782,19 @@ bool CNetAPI::ReadSmallKeysync(CControllerState& ControllerState, NetBitStreamIn
17861782
if (!BitStream.Read(&keys))
17871783
return false;
17881784

1789-
// Put the result into the controllerstate
1790-
ControllerState.LeftShoulder1 = 255 * keys.data.bLeftShoulder1;
1791-
ControllerState.RightShoulder1 = 255 * keys.data.bRightShoulder1;
17921785
short sButtonSquare = 255 * keys.data.bButtonSquare;
17931786
short sButtonCross = 255 * keys.data.bButtonCross;
1794-
if (BitStream.Can(eBitStreamVersion::AnalogControlSync_AccelBrakeReverse))
17951787
{
17961788
if (keys.data.ucButtonSquare != 0)
17971789
sButtonSquare = (short)keys.data.ucButtonSquare; // override controller state with analog data if present
17981790

17991791
if (keys.data.ucButtonCross != 0)
18001792
sButtonCross = (short)keys.data.ucButtonCross; // override controller state with analog data if present
18011793
}
1794+
1795+
// Put the result into the controllerstate
1796+
ControllerState.LeftShoulder1 = 255 * keys.data.bLeftShoulder1;
1797+
ControllerState.RightShoulder1 = 255 * keys.data.bRightShoulder1;
18021798
ControllerState.ButtonSquare = sButtonSquare;
18031799
ControllerState.ButtonCross = sButtonCross;
18041800
ControllerState.ButtonCircle = 255 * keys.data.bButtonCircle;
@@ -1837,19 +1833,19 @@ bool CNetAPI::ReadFullKeysync(CControllerState& ControllerState, NetBitStreamInt
18371833
if (!BitStream.Read(&keys))
18381834
return false;
18391835

1840-
// Put the result into the controllerstate
1841-
ControllerState.LeftShoulder1 = 255 * keys.data.bLeftShoulder1;
1842-
ControllerState.RightShoulder1 = 255 * keys.data.bRightShoulder1;
18431836
short sButtonSquare = 255 * keys.data.bButtonSquare;
18441837
short sButtonCross = 255 * keys.data.bButtonCross;
1845-
if (BitStream.Can(eBitStreamVersion::AnalogControlSync_AccelBrakeReverse))
18461838
{
18471839
if (keys.data.ucButtonSquare != 0)
18481840
sButtonSquare = (short)keys.data.ucButtonSquare; // override controller state with analog data if present
18491841

18501842
if (keys.data.ucButtonCross != 0)
18511843
sButtonCross = (short)keys.data.ucButtonCross; // override controller state with analog data if present
18521844
}
1845+
1846+
// Put the result into the controllerstate
1847+
ControllerState.LeftShoulder1 = 255 * keys.data.bLeftShoulder1;
1848+
ControllerState.RightShoulder1 = 255 * keys.data.bRightShoulder1;
18531849
ControllerState.ButtonSquare = sButtonSquare;
18541850
ControllerState.ButtonCross = sButtonCross;
18551851
ControllerState.ButtonCircle = 255 * keys.data.bButtonCircle;

0 commit comments

Comments
 (0)