Skip to content

Commit b61970e

Browse files
committed
Make suggested changes
1 parent ee1b6d9 commit b61970e

File tree

3 files changed

+35
-7
lines changed

3 files changed

+35
-7
lines changed

Client/mods/deathmatch/logic/CNetAPI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ void CNetAPI::WritePlayerPuresync(CClientPlayer* pPlayerModel, NetBitStreamInter
11191119
flags.data.bStealthAiming = (pPlayerModel->IsStealthAiming() == true);
11201120

11211121
if (BitStream.Can(eBitStreamVersion::IsPedReloadingWeapon))
1122-
flags.data.isReloadingWeapon = (pPlayerModel->IsReloadingWeapon() == true);
1122+
flags.data2.isReloadingWeapon = (pPlayerModel->IsReloadingWeapon() == true);
11231123

11241124
if (pPlayerWeapon->GetSlot() > 15)
11251125
flags.data.bHasAWeapon = false;

Server/mods/deathmatch/logic/packets/CPlayerPuresyncPacket.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ bool CPlayerPuresyncPacket::Read(NetBitStreamInterface& BitStream)
6161
pSourcePlayer->SetAkimboArmUp(flags.data.bAkimboTargetUp);
6262
pSourcePlayer->SetOnFire(flags.data.bIsOnFire);
6363
pSourcePlayer->SetStealthAiming(flags.data.bStealthAiming);
64-
pSourcePlayer->SetReloadingWeapon(flags.data.isReloadingWeapon);
64+
65+
if (BitStream.Can(eBitStreamVersion::IsPedReloadingWeapon))
66+
pSourcePlayer->SetReloadingWeapon(flags.data2.isReloadingWeapon);
6567

6668
// Contact element
6769
CElement* pContactElement = NULL;
@@ -343,7 +345,7 @@ bool CPlayerPuresyncPacket::Write(NetBitStreamInterface& BitStream) const
343345
flags.data.bStealthAiming = (pSourcePlayer->IsStealthAiming() == true);
344346

345347
if (pSourcePlayer->CanBitStream(eBitStreamVersion::IsPedReloadingWeapon))
346-
flags.data.isReloadingWeapon = pSourcePlayer->IsReloadingWeapon();
348+
flags.data2.isReloadingWeapon = pSourcePlayer->IsReloadingWeapon();
347349

348350
CVector vecPosition = pSourcePlayer->GetPosition();
349351
if (pContactElement)

Shared/sdk/net/SyncStructures.h

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,11 +544,33 @@ struct SPlayerPuresyncFlags : public ISyncStructure
544544
{
545545
enum
546546
{
547-
BITCOUNT = 13
547+
BITCOUNT = 12
548548
};
549549

550-
bool Read(NetBitStreamInterface& bitStream) { return bitStream.ReadBits((char*)&data, BITCOUNT); }
551-
void Write(NetBitStreamInterface& bitStream) const { bitStream.WriteBits((const char*)&data, BITCOUNT); }
550+
enum
551+
{
552+
BITCOUNT2 = 1
553+
};
554+
555+
bool Read(NetBitStreamInterface& stream)
556+
{
557+
bool ok = stream.ReadBits((char*)&data, BITCOUNT);
558+
559+
if (stream.Can(eBitStreamVersion::IsPedReloadingWeapon))
560+
ok &= stream.ReadBits((char*)&data2, BITCOUNT2);
561+
else
562+
data2.isReloadingWeapon = 0;
563+
564+
return ok;
565+
}
566+
567+
void Write(NetBitStreamInterface& stream) const
568+
{
569+
stream.WriteBits((const char*)&data, BITCOUNT);
570+
571+
if (stream.Can(eBitStreamVersion::IsPedReloadingWeapon))
572+
stream.WriteBits((const char*)&data2, BITCOUNT2);
573+
}
552574

553575
struct
554576
{
@@ -564,8 +586,12 @@ struct SPlayerPuresyncFlags : public ISyncStructure
564586
bool bHasAWeapon : 1;
565587
bool bSyncingVelocity : 1;
566588
bool bStealthAiming : 1;
567-
bool isReloadingWeapon : 1;
568589
} data;
590+
591+
struct
592+
{
593+
bool isReloadingWeapon : 1;
594+
} data2;
569595
};
570596

571597
struct SPedRotationSync : public ISyncStructure

0 commit comments

Comments
 (0)