Skip to content

Commit e17985e

Browse files
committed
Updated fix #9038 (bugged shotgun with bullet sync) to only work if all connected clients support it
1 parent 264de65 commit e17985e

File tree

8 files changed

+32
-10
lines changed

8 files changed

+32
-10
lines changed

MTA10/mods/deathmatch/logic/CClientGame.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ struct SMiscGameSettings
7777
bool bUseAltPulseOrder;
7878
bool bAllowFastSprintFix;
7979
bool bAllowBadDrivebyHitboxFix;
80+
bool bAllowShotgunDamageFix;
8081
};
8182

8283
class CClientGame

MTA10/mods/deathmatch/logic/CPacketHandler.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5158,10 +5158,15 @@ void CPacketHandler::Packet_SyncSettings ( NetBitStreamInterface& bitStream )
51585158
if ( bitStream.Version() >= 0x59 )
51595159
bitStream.Read ( ucAllowBadDrivebyHitboxesFix );
51605160

5161+
uchar ucAllowShotgunDamageFix = 0;
5162+
if ( bitStream.Version() >= 0x64 )
5163+
bitStream.Read ( ucAllowShotgunDamageFix );
5164+
51615165
SMiscGameSettings miscGameSettings;
51625166
miscGameSettings.bUseAltPulseOrder = ( ucUseAltPulseOrder != 0 );
51635167
miscGameSettings.bAllowFastSprintFix = ( ucAllowFastSprintFix != 0 );
51645168
miscGameSettings.bAllowBadDrivebyHitboxFix = (ucAllowBadDrivebyHitboxesFix != 0);
5169+
miscGameSettings.bAllowShotgunDamageFix = ( ucAllowShotgunDamageFix != 0 );
51655170
g_pClientGame->SetMiscGameSettings( miscGameSettings );
51665171
}
51675172

MTA10/mods/shared_logic/CClientPlayer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,14 @@ void CClientPlayer::DischargeWeapon ( eWeaponType weaponType, const CVector& vec
277277
m_shotSyncData->m_vecRemoteBulletSyncEnd = vecEnd;
278278
m_shotSyncData->m_bRemoteBulletSyncVectorsValid = true;
279279

280-
#if MTA_DM_VERSION >= 0x151
280+
g_iDamageEventLimit = 1;
281+
281282
// Fixed #9038: bugged shotgun with bullet sync
282283
if ( weaponType == WEAPONTYPE_SHOTGUN || weaponType == WEAPONTYPE_SAWNOFF_SHOTGUN || weaponType == WEAPONTYPE_SPAS12_SHOTGUN )
283-
g_iDamageEventLimit = 2;
284-
else
285-
#endif
286-
g_iDamageEventLimit = 1;
284+
{
285+
if ( g_pClientGame->GetMiscGameSettings().bAllowShotgunDamageFix )
286+
g_iDamageEventLimit = 2;
287+
}
287288

288289
// Fire
289290
CWeapon* pWeapon = m_pPlayerPed->GetWeapon ( m_pPlayerPed->GetCurrentWeaponSlot () );

MTA10/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
#define _NETCODE_VERSION_BRANCH_ID 0x4 // Use 0x1 - 0xF to indicate an incompatible branch is being used (0x0 is reserved, 0x4 is trunk)
7878
#define _CLIENT_NET_MODULE_VERSION 0x095 // (0x000 - 0xfff) Lvl9 wizards only
7979
#define _NETCODE_VERSION 0x1DA // (0x000 - 0xfff) Increment when net messages change (pre-release)
80-
#define MTA_DM_BITSTREAM_VERSION 0x063 // (0x000 - 0xfff) Increment when net messages change (post-release). (Changing will also require additional backward compatibility code).
80+
#define MTA_DM_BITSTREAM_VERSION 0x064 // (0x000 - 0xfff) Increment when net messages change (post-release). (Changing will also require additional backward compatibility code).
8181

8282
// To avoid user confusion, make sure the ASE version matches only if communication is possible
8383
#if defined(MTA_DM_CONNECT_TO_PUBLIC)

MTA10_Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#define SNIPER_BULLET_SYNC_MIN_CLIENT_VERSION "1.3.5-9.06054"
4040
#define SPRINT_FIX_MIN_CLIENT_VERSION "1.3.5-9.06277"
4141
#define DRIVEBY_HITBOX_FIX_MIN_CLIENT_VERSION "1.4.0-5.06399"
42+
#define SHOTGUN_DAMAGE_FIX_MIN_CLIENT_VERSION "1.5.1"
4243

4344
CGame* g_pGame = NULL;
4445

@@ -4172,6 +4173,7 @@ void CGame::SendSyncSettings ( CPlayer* pPlayer )
41724173
uchar ucUseAltPulseOrder = m_pMainConfig->GetUseAltPulseOrder () != 0;
41734174
uchar ucAllowFastSprintFix = false;
41744175
uchar ucAllowDrivebyAnimFix = false;
4176+
uchar ucAllowShotgunDamageFix = false;
41754177

41764178
// Add sprint fix if all clients can handle it
41774179
if ( ExtractVersionStringBuildNumber( m_pPlayerManager->GetLowestConnectedPlayerVersion() ) >= ExtractVersionStringBuildNumber( SPRINT_FIX_MIN_CLIENT_VERSION ) )
@@ -4181,7 +4183,11 @@ void CGame::SendSyncSettings ( CPlayer* pPlayer )
41814183
if (ExtractVersionStringBuildNumber(m_pPlayerManager->GetLowestConnectedPlayerVersion()) >= ExtractVersionStringBuildNumber( DRIVEBY_HITBOX_FIX_MIN_CLIENT_VERSION ))
41824184
ucAllowDrivebyAnimFix = true;
41834185

4184-
CSyncSettingsPacket packet(weaponTypesUsingBulletSync, ucVehExtrapolateEnabled, sVehExtrapolateBaseMs, sVehExtrapolatePercent, sVehExtrapolateMaxMs, ucUseAltPulseOrder, ucAllowFastSprintFix, ucAllowDrivebyAnimFix);
4186+
// Add shotgun bullet sync damage fix if all clients can handle it
4187+
if ( m_pPlayerManager->GetLowestConnectedPlayerVersion() >= SHOTGUN_DAMAGE_FIX_MIN_CLIENT_VERSION )
4188+
ucAllowShotgunDamageFix = true;
4189+
4190+
CSyncSettingsPacket packet(weaponTypesUsingBulletSync, ucVehExtrapolateEnabled, sVehExtrapolateBaseMs, sVehExtrapolatePercent, sVehExtrapolateMaxMs, ucUseAltPulseOrder, ucAllowFastSprintFix, ucAllowDrivebyAnimFix, ucAllowShotgunDamageFix );
41854191
if ( pPlayer )
41864192
pPlayer->Send ( packet );
41874193
else

MTA10_Server/mods/deathmatch/logic/packets/CSyncSettingsPacket.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ CSyncSettingsPacket::CSyncSettingsPacket ( const std::set < eWeaponType >& weapo
1818
short sVehExtrapolateMaxMs,
1919
uchar ucUseAltPulseOrder,
2020
uchar ucAllowFastSprintFix,
21-
uchar ucAllowDrivebyAnimationFix)
21+
uchar ucAllowDrivebyAnimationFix,
22+
uchar ucAllowShotgunDamageFix )
2223
{
2324
m_weaponTypesUsingBulletSync = weaponTypesUsingBulletSync;
2425
m_ucVehExtrapolateEnabled = ucVehExtrapolateEnabled;
@@ -28,6 +29,7 @@ CSyncSettingsPacket::CSyncSettingsPacket ( const std::set < eWeaponType >& weapo
2829
m_ucUseAltPulseOrder = ucUseAltPulseOrder;
2930
m_ucAllowFastSprintFix = ucAllowFastSprintFix;
3031
m_ucAllowDrivebyAnimationFix = ucAllowDrivebyAnimationFix;
32+
m_ucAllowShotgunDamageFix = ucAllowShotgunDamageFix;
3133
}
3234

3335

@@ -70,5 +72,10 @@ bool CSyncSettingsPacket::Write ( NetBitStreamInterface& BitStream ) const
7072
BitStream.Write(m_ucAllowDrivebyAnimationFix);
7173
}
7274

75+
if ( BitStream.Version() >= 0x64 )
76+
{
77+
BitStream.Write( m_ucAllowShotgunDamageFix );
78+
}
79+
7380
return true;
7481
}

MTA10_Server/mods/deathmatch/logic/packets/CSyncSettingsPacket.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class CSyncSettingsPacket : public CPacket
1919
short sVehExtrapolateMaxMs,
2020
uchar ucUseAltPulseOrder,
2121
uchar ucAllowFastSprintFix,
22-
uchar ucAllowDrivebyAnimationFix);
22+
uchar ucAllowDrivebyAnimationFix,
23+
uchar ucAllowShotgunDamageFix );
2324

2425
inline ePacketID GetPacketID ( void ) const { return PACKET_ID_SYNC_SETTINGS; };
2526
unsigned long GetFlags ( void ) const { return PACKET_HIGH_PRIORITY | PACKET_RELIABLE | PACKET_SEQUENCED; };
@@ -35,4 +36,5 @@ class CSyncSettingsPacket : public CPacket
3536
uchar m_ucUseAltPulseOrder;
3637
uchar m_ucAllowFastSprintFix;
3738
uchar m_ucAllowDrivebyAnimationFix;
39+
uchar m_ucAllowShotgunDamageFix;
3840
};

MTA10_Server/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
#define _NETCODE_VERSION_BRANCH_ID 0x4 // Use 0x1 - 0xF to indicate an incompatible branch is being used (0x0 is reserved, 0x4 is trunk)
8181
#define _SERVER_NET_MODULE_VERSION 0x095 // (0x000 - 0xfff) Lvl9 wizards only
8282
#define _NETCODE_VERSION 0x1DA // (0x000 - 0xfff) Increment when net messages change (pre-release)
83-
#define MTA_DM_BITSTREAM_VERSION 0x063 // (0x000 - 0xfff) Increment when net messages change (post-release). (Changing will also require additional backward compatibility code).
83+
#define MTA_DM_BITSTREAM_VERSION 0x064 // (0x000 - 0xfff) Increment when net messages change (post-release). (Changing will also require additional backward compatibility code).
8484

8585
// To avoid user confusion, make sure the ASE version matches only if communication is possible
8686
#if defined(MTA_DM_CONNECT_FROM_PUBLIC)

0 commit comments

Comments
 (0)