@@ -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 );
@@ -2745,10 +2737,13 @@ void CClientGame::AddBuiltInEvents()
27452737 m_Events.AddEvent (" onClientCursorMove" , " relativeX, relativeX, absoluteX, absoluteY, worldX, worldY, worldZ" , NULL , false );
27462738
27472739 // Marker events
2748- m_Events.AddEvent (" onClientMarkerHit" , " entity, matchingDimension" , NULL , false );
2749- 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 );
27502742
2751- // Marker events
2743+ m_Events.AddEvent (" onClientPlayerMarkerHit" , " marker, matchingDimension" , nullptr , false );
2744+ m_Events.AddEvent (" onClientPlayerMarkerLeave" , " marker, matchingDimension" , nullptr , false );
2745+
2746+ // Pickup events
27522747 m_Events.AddEvent (" onClientPickupHit" , " entity, matchingDimension" , NULL , false );
27532748 m_Events.AddEvent (" onClientPickupLeave" , " entity, matchingDimension" , NULL , false );
27542749
@@ -4627,34 +4622,32 @@ bool CClientGame::VehicleCollisionHandler(CVehicleSAInterface*& pCollidingVehicl
46274622 // Make sure it created
46284623 if (pBitStream)
46294624 {
4630- 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 ())
46314628 {
4632- // Sync Stuff
4633- // if it's not a local vehicle + it collided with the local player
4634- if (pVehicleClientEntity->IsLocalEntity () == false && pCollidedWithClientEntity == g_pClientGame->GetLocalPlayer ())
4629+ // is it below the anti spam threshold?
4630+ if (pClientVehicle->GetTimeSinceLastPush () >= MIN_PUSH_ANTISPAM_RATE)
46354631 {
4636- // is it below the anti spam threshold?
4637- if (pClientVehicle->GetTimeSinceLastPush () >= MIN_PUSH_ANTISPAM_RATE )
4632+ // if there is no controlling player
4633+ if (! pClientVehicle->GetControllingPlayer () )
46384634 {
4639- // if there is no controlling player
4640- 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 )
46414638 {
4642- CDeathmatchVehicle* Vehicle = static_cast <CDeathmatchVehicle*>(pVehicleClientEntity);
4643- // if We aren't already syncing the vehicle
4644- if (GetUnoccupiedVehicleSync ()->Exists (Vehicle) == false )
4645- {
4646- // Write the vehicle ID
4647- pBitStream->Write (pVehicleClientEntity->GetID ());
4648- // Send!
4649- g_pNet->SendPacket (PACKET_ID_VEHICLE_PUSH_SYNC, pBitStream, PACKET_PRIORITY_MEDIUM,
4650- PACKET_RELIABILITY_UNRELIABLE_SEQUENCED);
4651- // Reset our push time
4652- pClientVehicle->ResetLastPushTime ();
4653- }
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 ();
46544646 }
46554647 }
46564648 }
46574649 }
4650+
46584651 g_pNet->DeallocateNetBitStream (pBitStream);
46594652 }
46604653 return true ;
@@ -5283,18 +5276,15 @@ void CClientGame::SendExplosionSync(const CVector& vecPosition, eExplosionType T
52835276
52845277 // Because we use this packet to notify the server of blown vehicles,
52855278 // we include a bit, whether the vehicle was blown without an explosion
5286- if (pBitStream-> Can (eBitStreamVersion::VehicleBlowStateSupport) )
5279+ if (pOrigin-> GetType () == CCLIENTVEHICLE )
52875280 {
5288- if (pOrigin->GetType () == CCLIENTVEHICLE)
5289- {
5290- auto vehicle = reinterpret_cast <CClientVehicle*>(pOrigin);
5291- pBitStream->WriteBit (1 );
5292- pBitStream->WriteBit (vehicleBlowState.value_or (vehicle->GetBlowState ()) == VehicleBlowState::BLOWN);
5293- }
5294- else
5295- {
5296- pBitStream->WriteBit (0 );
5297- }
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 );
52985288 }
52995289
53005290 // Convert position
@@ -5367,9 +5357,7 @@ void CClientGame::SendProjectileSync(CClientProjectile* pProjectile)
53675357 pBitStream->Write (&weaponTypeSync);
53685358
53695359 // Write the projectile's model
5370- if (pBitStream->Version () >= 0x4F )
5371- if (pBitStream->Version () >= 0x52 || pOriginSource) // Fix possible error for 0x51 server
5372- pBitStream->Write (pProjectile->GetModel ());
5360+ pBitStream->Write (pProjectile->GetModel ());
53735361
53745362 switch (weaponType)
53755363 {
@@ -6259,10 +6247,7 @@ void CClientGame::TakePlayerScreenShot(uint uiSizeX, uint uiSizeY, const SString
62596247 else
62606248 pBitStream->Write ((uchar)EPlayerScreenShotResult::MINIMIZED);
62616249 pBitStream->Write (uiServerSentTime);
6262- if (pBitStream->Version () >= 0x053 )
6263- pBitStream->Write (pResource->GetNetID ());
6264- else
6265- pBitStream->WriteString (pResource->GetName ());
6250+ pBitStream->Write (pResource->GetNetID ());
62666251 pBitStream->WriteString (strTag);
62676252 g_pNet->SendPacket (PACKET_ID_PLAYER_SCREENSHOT, pBitStream, PACKET_PRIORITY_LOW, PACKET_RELIABILITY_RELIABLE_ORDERED, PACKET_ORDERING_DATA_TRANSFER);
62686253 g_pNet->DeallocateNetBitStream (pBitStream);
@@ -6327,13 +6312,9 @@ void CClientGame::GottenPlayerScreenShot(const CBuffer* pBuffer, uint uiTimeSpen
63276312 NetBitStreamInterface* pBitStream = g_pNet->AllocateNetBitStream ();
63286313 pBitStream->Write ((uchar)EPlayerScreenShotResult::ERROR_);
63296314 pBitStream->Write (uiServerGrabTime);
6330- if (pBitStream->Version () >= 0x053 )
6331- pBitStream->Write (pResource->GetNetID ());
6332- else
6333- pBitStream->WriteString (pResource->GetName ());
6315+ pBitStream->Write (pResource->GetNetID ());
63346316 pBitStream->WriteString (strTag);
6335- if (pBitStream->Version () >= 0x053 )
6336- pBitStream->WriteString (strError);
6317+ pBitStream->WriteString (strError);
63376318 g_pNet->SendPacket (PACKET_ID_PLAYER_SCREENSHOT, pBitStream, PACKET_PRIORITY_LOW, PACKET_RELIABILITY_RELIABLE_ORDERED, PACKET_ORDERING_DATA_TRANSFER);
63386319 g_pNet->DeallocateNetBitStream (pBitStream);
63396320 return ;
@@ -6373,10 +6354,7 @@ void CClientGame::GottenPlayerScreenShot(const CBuffer* pBuffer, uint uiTimeSpen
63736354 pBitStream->Write (uiServerGrabTime);
63746355 pBitStream->Write (uiTotalByteSize);
63756356 pBitStream->Write ((ushort)uiNumParts);
6376- if (pBitStream->Version () >= 0x053 )
6377- pBitStream->Write (pResource->GetNetID ());
6378- else
6379- pBitStream->WriteString (pResource->GetName ());
6357+ pBitStream->Write (pResource->GetNetID ());
63806358 pBitStream->WriteString (strTag);
63816359 }
63826360
0 commit comments