Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Client/mods/deathmatch/logic/CNetAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,34 @@ void CNetAPI::WriteVehiclePuresync(CClientPed* pPlayerModel, CClientVehicle* pVe
BitStream.WriteBit(false);
}

if (!g_pClientGame->GetDamageSent())
{
g_pClientGame->SetDamageSent(true);

ElementID DamagerID = g_pClientGame->GetDamagerID();
if (DamagerID != RESERVED_ELEMENT_ID)
{
BitStream.WriteBit(true);
BitStream.Write(DamagerID);

SWeaponTypeSync weaponType;
weaponType.data.ucWeaponType = g_pClientGame->GetDamageWeapon();
BitStream.Write(&weaponType);

SBodypartSync bodypart;
bodypart.data.uiBodypart = g_pClientGame->GetDamageBodyPiece();
BitStream.Write(&bodypart);
}
else
{
BitStream.WriteBit(false);
}
}
else
{
BitStream.WriteBit(false);
}

// Player health sync (scaled from 0.0f-200.0f to 0-255 to save three bytes).
// Scale goes up to 200.0f because having max stats gives you the double of health.
SPlayerHealthSync health;
Expand Down
15 changes: 15 additions & 0 deletions Server/mods/deathmatch/logic/net/CSimVehiclePuresyncPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,21 @@ bool CSimVehiclePuresyncPacket::Read(NetBitStreamInterface& BitStream)
}
}

if (BitStream.ReadBit())
{
ElementID DamagerID;
if (!BitStream.Read(DamagerID))
return false;

SWeaponTypeSync weaponType;
if (!BitStream.Read(&weaponType))
return false;

SBodypartSync bodyPart;
if (!BitStream.Read(&bodyPart))
return false;
}

// Player health
SPlayerHealthSync health;
if (!BitStream.Read(&health))
Expand Down
26 changes: 11 additions & 15 deletions Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,25 +275,21 @@ bool CVehiclePuresyncPacket::Read(NetBitStreamInterface& BitStream)
}
}

// Update Damage info
if (BitStream.Version() >= 0x047)
if (BitStream.ReadBit())
{
if (BitStream.ReadBit() == true)
{
ElementID DamagerID;
if (!BitStream.Read(DamagerID))
return false;
ElementID DamagerID;
if (!BitStream.Read(DamagerID))
return false;

SWeaponTypeSync weaponType;
if (!BitStream.Read(&weaponType))
return false;
SWeaponTypeSync weaponType;
if (!BitStream.Read(&weaponType))
return false;

SBodypartSync bodyPart;
if (!BitStream.Read(&bodyPart))
return false;
SBodypartSync bodyPart;
if (!BitStream.Read(&bodyPart))
return false;

pSourcePlayer->SetDamageInfo(DamagerID, weaponType.data.ucWeaponType, static_cast<unsigned char>(bodyPart.data.uiBodypart));
}
pSourcePlayer->SetDamageInfo(DamagerID, weaponType.data.ucWeaponType, static_cast<unsigned char>(bodyPart.data.uiBodypart));
}

// Player health
Expand Down
Loading