mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-02-05 10:10:30 +03:00
FIX
: Reloading animation bug while holding weapon with altered Maxclip (#861)
* Add functions for default weaponinfo array * Whitespace cleaning and pointer safety check * Added reload condition to enhance conditions
This commit is contained in:
parent
8a52b7e38d
commit
67e7d87423
@ -4822,6 +4822,16 @@ int EXT_FUNC GetWeaponData(edict_t *pEdict, struct weapon_data_s *info)
|
||||
item->fuser2 = weapon->m_flStartThrow;
|
||||
item->fuser3 = weapon->m_flReleaseThrow;
|
||||
item->iuser1 = weapon->m_iSwing;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (pPlayerItem == pPlayer->m_pActiveItem && !weapon->m_fInReload && weapon->m_iClip == II.iMaxClip)
|
||||
{
|
||||
const WeaponInfoStruct *wpnInfo = GetDefaultWeaponInfo(II.iId);
|
||||
|
||||
if (wpnInfo && wpnInfo->gunClipSize != II.iMaxClip)
|
||||
item->m_iClip = wpnInfo->gunClipSize;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -529,6 +529,17 @@ WeaponInfoStruct *GetWeaponInfo(const char *weaponName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WeaponInfoStruct *GetDefaultWeaponInfo(int weaponID)
|
||||
{
|
||||
for (auto& info : g_weaponInfo_default) {
|
||||
if (info.id == weaponID) {
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AmmoInfoStruct *GetAmmoInfo(const char *ammoName)
|
||||
{
|
||||
for (auto& info : g_ammoInfo) {
|
||||
|
@ -445,6 +445,8 @@ void WeaponInfoReset();
|
||||
WeaponInfoStruct *GetWeaponInfo(int weaponID);
|
||||
WeaponInfoStruct *GetWeaponInfo(const char *weaponName);
|
||||
|
||||
WeaponInfoStruct *GetDefaultWeaponInfo(int weaponID);
|
||||
|
||||
AmmoInfoStruct *GetAmmoInfo(AmmoType ammoID);
|
||||
AmmoInfoStruct *GetAmmoInfo(const char *ammoName);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user