@@ -703,16 +703,10 @@ 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 )
706+ // Append community information (removed, but we keep this to retain protocol compat )
707707 std::string strUser;
708708 pBitStream->Write (strUser.c_str (), MAX_SERIAL_LENGTH);
709709
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-
716710 // Send the packet as joindata
717711 g_pNet->SendPacket (PACKET_ID_PLAYER_JOINDATA, pBitStream, PACKET_PRIORITY_HIGH, PACKET_RELIABILITY_RELIABLE_ORDERED);
718712 g_pNet->DeallocateNetBitStream (pBitStream);
@@ -1829,12 +1823,10 @@ void CClientGame::UpdatePlayerWeapons()
18291823 SWeaponSlotSync slot;
18301824
18311825 // Always send bit in case server is not in sync
1832- if ((BitStream.Version () >= 0x44 && m_lastWeaponSlot == WEAPONSLOT_TYPE_THROWN) || BitStream.Version () >= 0x4D )
18331826 {
18341827 CWeapon* pLastWeapon = m_pLocalPlayer->GetWeapon (m_lastWeaponSlot);
18351828 if (pLastWeapon && pLastWeapon->GetAmmoTotal () == 0 &&
1836- (m_lastWeaponSlot == WEAPONSLOT_TYPE_THROWN ||
1837- (BitStream.Version () >= 0x5A && (m_lastWeaponSlot == WEAPONSLOT_TYPE_HEAVY || m_lastWeaponSlot == WEAPONSLOT_TYPE_SPECIAL))))
1829+ (m_lastWeaponSlot == WEAPONSLOT_TYPE_THROWN || m_lastWeaponSlot == WEAPONSLOT_TYPE_HEAVY || m_lastWeaponSlot == WEAPONSLOT_TYPE_SPECIAL))
18381830 BitStream.WriteBit (true );
18391831 else
18401832 BitStream.WriteBit (false );
@@ -2638,6 +2630,8 @@ void CClientGame::AddBuiltInEvents()
26382630 m_Events.AddEvent (" onClientElementModelChange" , " oldModel, newModel" , nullptr , false );
26392631 m_Events.AddEvent (" onClientElementDimensionChange" , " oldDimension, newDimension" , nullptr , false );
26402632 m_Events.AddEvent (" onClientElementInteriorChange" , " oldInterior, newInterior" , nullptr , false );
2633+ m_Events.AddEvent (" onClientElementAttach" , " attachSource, attachOffsetX, attachOffsetY, attachOffsetZ, attachOffsetRX, attachOffsetRY, attachOffsetRZ" , nullptr , false );
2634+ m_Events.AddEvent (" onClientElementDetach" , " detachSource, detachWorldX, detachWorldY, detachWorldZ, detachWorldRX, detachWorldRY, detachWorldRZ" , nullptr , false );
26412635
26422636 // Player events
26432637 m_Events.AddEvent (" onClientPlayerJoin" , " " , NULL , false );
@@ -2743,10 +2737,13 @@ void CClientGame::AddBuiltInEvents()
27432737 m_Events.AddEvent (" onClientCursorMove" , " relativeX, relativeX, absoluteX, absoluteY, worldX, worldY, worldZ" , NULL , false );
27442738
27452739 // Marker events
2746- m_Events.AddEvent (" onClientMarkerHit" , " entity, matchingDimension" , NULL , false );
2747- m_Events.AddEvent (" onClientMarkerLeave" , " entity, matchingDimension" , NULL , false );
2740+ m_Events.AddEvent (" onClientMarkerHit" , " entity, matchingDimension" , nullptr , false );
2741+ m_Events.AddEvent (" onClientMarkerLeave" , " entity, matchingDimension" , nullptr , false );
27482742
2749- // Marker events
2743+ m_Events.AddEvent (" onClientPlayerMarkerHit" , " marker, matchingDimension" , nullptr , false );
2744+ m_Events.AddEvent (" onClientPlayerMarkerLeave" , " marker, matchingDimension" , nullptr , false );
2745+
2746+ // Pickup events
27502747 m_Events.AddEvent (" onClientPickupHit" , " entity, matchingDimension" , NULL , false );
27512748 m_Events.AddEvent (" onClientPickupLeave" , " entity, matchingDimension" , NULL , false );
27522749
@@ -4625,34 +4622,32 @@ bool CClientGame::VehicleCollisionHandler(CVehicleSAInterface*& pCollidingVehicl
46254622 // Make sure it created
46264623 if (pBitStream)
46274624 {
4628- if (pBitStream->Version () >= 0x028 )
4625+ // Sync Stuff
4626+ // if it's not a local vehicle + it collided with the local player
4627+ if (pVehicleClientEntity->IsLocalEntity () == false && pCollidedWithClientEntity == g_pClientGame->GetLocalPlayer ())
46294628 {
4630- // Sync Stuff
4631- // if it's not a local vehicle + it collided with the local player
4632- if (pVehicleClientEntity->IsLocalEntity () == false && pCollidedWithClientEntity == g_pClientGame->GetLocalPlayer ())
4629+ // is it below the anti spam threshold?
4630+ if (pClientVehicle->GetTimeSinceLastPush () >= MIN_PUSH_ANTISPAM_RATE)
46334631 {
4634- // is it below the anti spam threshold?
4635- if (pClientVehicle->GetTimeSinceLastPush () >= MIN_PUSH_ANTISPAM_RATE )
4632+ // if there is no controlling player
4633+ if (! pClientVehicle->GetControllingPlayer () )
46364634 {
4637- // if there is no controlling player
4638- if (!pClientVehicle->GetControllingPlayer ())
4635+ CDeathmatchVehicle* Vehicle = static_cast <CDeathmatchVehicle*>(pVehicleClientEntity);
4636+ // if We aren't already syncing the vehicle
4637+ if (GetUnoccupiedVehicleSync ()->Exists (Vehicle) == false )
46394638 {
4640- CDeathmatchVehicle* Vehicle = static_cast <CDeathmatchVehicle*>(pVehicleClientEntity);
4641- // if We aren't already syncing the vehicle
4642- if (GetUnoccupiedVehicleSync ()->Exists (Vehicle) == false )
4643- {
4644- // Write the vehicle ID
4645- pBitStream->Write (pVehicleClientEntity->GetID ());
4646- // Send!
4647- g_pNet->SendPacket (PACKET_ID_VEHICLE_PUSH_SYNC, pBitStream, PACKET_PRIORITY_MEDIUM,
4648- PACKET_RELIABILITY_UNRELIABLE_SEQUENCED);
4649- // Reset our push time
4650- pClientVehicle->ResetLastPushTime ();
4651- }
4639+ // Write the vehicle ID
4640+ pBitStream->Write (pVehicleClientEntity->GetID ());
4641+ // Send!
4642+ g_pNet->SendPacket (PACKET_ID_VEHICLE_PUSH_SYNC, pBitStream, PACKET_PRIORITY_MEDIUM,
4643+ PACKET_RELIABILITY_UNRELIABLE_SEQUENCED);
4644+ // Reset our push time
4645+ pClientVehicle->ResetLastPushTime ();
46524646 }
46534647 }
46544648 }
46554649 }
4650+
46564651 g_pNet->DeallocateNetBitStream (pBitStream);
46574652 }
46584653 return true ;
@@ -5281,18 +5276,15 @@ void CClientGame::SendExplosionSync(const CVector& vecPosition, eExplosionType T
52815276
52825277 // Because we use this packet to notify the server of blown vehicles,
52835278 // we include a bit, whether the vehicle was blown without an explosion
5284- if (pBitStream-> Can (eBitStreamVersion::VehicleBlowStateSupport) )
5279+ if (pOrigin-> GetType () == CCLIENTVEHICLE )
52855280 {
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- }
5281+ auto vehicle = reinterpret_cast <CClientVehicle*>(pOrigin);
5282+ pBitStream->WriteBit (1 );
5283+ pBitStream->WriteBit (vehicleBlowState.value_or (vehicle->GetBlowState ()) == VehicleBlowState::BLOWN);
5284+ }
5285+ else
5286+ {
5287+ pBitStream->WriteBit (0 );
52965288 }
52975289
52985290 // Convert position
@@ -5365,9 +5357,7 @@ void CClientGame::SendProjectileSync(CClientProjectile* pProjectile)
53655357 pBitStream->Write (&weaponTypeSync);
53665358
53675359 // Write the projectile's model
5368- if (pBitStream->Version () >= 0x4F )
5369- if (pBitStream->Version () >= 0x52 || pOriginSource) // Fix possible error for 0x51 server
5370- pBitStream->Write (pProjectile->GetModel ());
5360+ pBitStream->Write (pProjectile->GetModel ());
53715361
53725362 switch (weaponType)
53735363 {
@@ -6257,10 +6247,7 @@ void CClientGame::TakePlayerScreenShot(uint uiSizeX, uint uiSizeY, const SString
62576247 else
62586248 pBitStream->Write ((uchar)EPlayerScreenShotResult::MINIMIZED);
62596249 pBitStream->Write (uiServerSentTime);
6260- if (pBitStream->Version () >= 0x053 )
6261- pBitStream->Write (pResource->GetNetID ());
6262- else
6263- pBitStream->WriteString (pResource->GetName ());
6250+ pBitStream->Write (pResource->GetNetID ());
62646251 pBitStream->WriteString (strTag);
62656252 g_pNet->SendPacket (PACKET_ID_PLAYER_SCREENSHOT, pBitStream, PACKET_PRIORITY_LOW, PACKET_RELIABILITY_RELIABLE_ORDERED, PACKET_ORDERING_DATA_TRANSFER);
62666253 g_pNet->DeallocateNetBitStream (pBitStream);
@@ -6325,13 +6312,9 @@ void CClientGame::GottenPlayerScreenShot(const CBuffer* pBuffer, uint uiTimeSpen
63256312 NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
63266313 pBitStream->Write ((uchar)EPlayerScreenShotResult::ERROR_);
63276314 pBitStream->Write (uiServerGrabTime);
6328- if (pBitStream->Version () >= 0x053 )
6329- pBitStream->Write (pResource->GetNetID ());
6330- else
6331- pBitStream->WriteString (pResource->GetName ());
6315+ pBitStream->Write (pResource->GetNetID ());
63326316 pBitStream->WriteString (strTag);
6333- if (pBitStream->Version () >= 0x053 )
6334- pBitStream->WriteString (strError);
6317+ pBitStream->WriteString (strError);
63356318 g_pNet->SendPacket (PACKET_ID_PLAYER_SCREENSHOT, pBitStream, PACKET_PRIORITY_LOW, PACKET_RELIABILITY_RELIABLE_ORDERED, PACKET_ORDERING_DATA_TRANSFER);
63366319 g_pNet->DeallocateNetBitStream (pBitStream);
63376320 return ;
@@ -6371,10 +6354,7 @@ void CClientGame::GottenPlayerScreenShot(const CBuffer* pBuffer, uint uiTimeSpen
63716354 pBitStream->Write (uiServerGrabTime);
63726355 pBitStream->Write (uiTotalByteSize);
63736356 pBitStream->Write ((ushort)uiNumParts);
6374- if (pBitStream->Version () >= 0x053 )
6375- pBitStream->Write (pResource->GetNetID ());
6376- else
6377- pBitStream->WriteString (pResource->GetName ());
6357+ pBitStream->Write (pResource->GetNetID ());
63786358 pBitStream->WriteString (strTag);
63796359 }
63806360
0 commit comments