Skip to content

Commit ae9b838

Browse files
committed
Fix weapon hiding animation
Was wrecked when I merging commits Also replace FALSE, TRUE and NULL with false, true and nullptr
1 parent 05a48e4 commit ae9b838

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

src/xrGame/WeaponMagazined.cpp

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
ENGINE_API bool g_dedicated_server;
2929

30-
CUIXml* pWpnScopeXml = NULL;
30+
CUIXml* pWpnScopeXml = nullptr;
3131

3232
void createWpnScopeXML()
3333
{
@@ -48,8 +48,8 @@ CWeaponMagazined::CWeaponMagazined(ESoundTypes eSoundType) : CWeapon()
4848
m_eSoundReloadEmpty = ESoundTypes(SOUND_TYPE_WEAPON_RECHARGING | eSoundType);
4949
m_sounds_enabled = true;
5050

51-
m_sSndShotCurrent = NULL;
52-
m_sSilencerFlameParticles = m_sSilencerSmokeParticles = NULL;
51+
m_sSndShotCurrent = nullptr;
52+
m_sSilencerFlameParticles = m_sSilencerSmokeParticles = nullptr;
5353

5454
m_bFireSingleShot = false;
5555
m_iShotNum = 0;
@@ -207,14 +207,14 @@ bool CWeaponMagazined::TryReload()
207207

208208
if (IsMisfire() && iAmmoElapsed)
209209
{
210-
SetPending(TRUE);
210+
SetPending(true);
211211
SwitchState(eReload);
212212
return true;
213213
}
214214

215215
if (m_pCurrentAmmo || unlimited_ammo())
216216
{
217-
SetPending(TRUE);
217+
SetPending(true);
218218
SwitchState(eReload);
219219
return true;
220220
}
@@ -225,7 +225,7 @@ bool CWeaponMagazined::TryReload()
225225
if (m_pCurrentAmmo)
226226
{
227227
m_set_next_ammoType_on_reload = i;
228-
SetPending(TRUE);
228+
SetPending(true);
229229
SwitchState(eReload);
230230
return true;
231231
}
@@ -321,7 +321,7 @@ void CWeaponMagazined::ReloadMagazine()
321321

322322
if (!m_bLockType)
323323
{
324-
m_pCurrentAmmo = NULL;
324+
m_pCurrentAmmo = nullptr;
325325
}
326326

327327
if (!m_pInventory)
@@ -391,7 +391,7 @@ void CWeaponMagazined::ReloadMagazine()
391391

392392
//выкинуть коробку патронов, если она пустая
393393
if (m_pCurrentAmmo && !m_pCurrentAmmo->m_boxCurr && OnServer())
394-
m_pCurrentAmmo->SetDropManual(TRUE);
394+
m_pCurrentAmmo->SetDropManual(true);
395395

396396
if (iMagazineSize > iAmmoElapsed)
397397
{
@@ -501,14 +501,14 @@ void CWeaponMagazined::state_Fire(float dt)
501501

502502
if (!H_Parent())
503503
return;
504-
if (smart_cast<CMPPlayersBag*>(H_Parent()) != NULL)
504+
if (smart_cast<CMPPlayersBag*>(H_Parent()) != nullptr)
505505
{
506506
Msg("! WARNING: state_Fire of object [%d][%s] while parent is CMPPlayerBag...", ID(), cNameSect().c_str());
507507
return;
508508
}
509509

510510
CInventoryOwner* io = smart_cast<CInventoryOwner*>(H_Parent());
511-
if (NULL == io->inventory().ActiveItem())
511+
if (nullptr == io->inventory().ActiveItem())
512512
{
513513
Log("current_state", GetState());
514514
Log("next_state", GetNextState());
@@ -647,7 +647,7 @@ void CWeaponMagazined::switch2_Idle()
647647
if (m_fOldBulletSpeed != 0.f)
648648
SetBulletSpeed(m_fOldBulletSpeed);
649649

650-
SetPending(FALSE);
650+
SetPending(false);
651651
PlayAnimIdle();
652652
}
653653

@@ -749,7 +749,7 @@ void CWeaponMagazined::switch2_Reload()
749749

750750
PlayReloadSound();
751751
PlayAnimReload();
752-
SetPending(TRUE);
752+
SetPending(true);
753753
}
754754
void CWeaponMagazined::switch2_Hiding()
755755
{
@@ -760,7 +760,7 @@ void CWeaponMagazined::switch2_Hiding()
760760
PlaySound("sndHide", get_LastFP());
761761

762762
PlayAnimHide();
763-
SetPending(TRUE);
763+
SetPending(true);
764764
}
765765

766766
void CWeaponMagazined::switch2_Hidden()
@@ -777,7 +777,7 @@ void CWeaponMagazined::switch2_Showing()
777777
if (m_sounds_enabled)
778778
PlaySound("sndShow", get_LastFP());
779779

780-
SetPending(TRUE);
780+
SetPending(true);
781781
PlayAnimShow();
782782
}
783783

@@ -1019,7 +1019,7 @@ void CWeaponMagazined::InitAddons()
10191019
m_zoom_params.m_sUseZoomPostprocess =
10201020
READ_IF_EXISTS(pSettings, r_string, GetScopeName(), "scope_nightvision", 0);
10211021
m_zoom_params.m_bUseDynamicZoom =
1022-
READ_IF_EXISTS(pSettings, r_bool, GetScopeName(), "scope_dynamic_zoom", FALSE);
1022+
READ_IF_EXISTS(pSettings, r_bool, GetScopeName(), "scope_dynamic_zoom", false);
10231023
m_zoom_params.m_sUseBinocularVision =
10241024
READ_IF_EXISTS(pSettings, r_string, GetScopeName(), "scope_alive_detector", 0);
10251025
m_fRTZoomFactor = m_zoom_params.m_fScopeZoomFactor;
@@ -1099,23 +1099,13 @@ void CWeaponMagazined::ResetSilencerKoeffs() { cur_silencer_koef.Reset(); }
10991099
void CWeaponMagazined::PlayAnimShow()
11001100
{
11011101
VERIFY(GetState() == eShowing);
1102-
PlayHUDMotion("anm_show", FALSE, this, GetState());
1102+
PlayHUDMotion("anm_show", false, this, GetState());
11031103
}
11041104

11051105
void CWeaponMagazined::PlayAnimHide()
11061106
{
11071107
VERIFY(GetState() == eHiding);
1108-
if (iAmmoElapsed == 0)
1109-
{
1110-
#ifdef NEW_ANIMS //AVO: new reload animation
1111-
if (isHUDAnimationExist("anm_reload_empty"))
1112-
PlayHUDMotion("anm_reload_empty", true, this, GetState());
1113-
else
1114-
#endif //-NEW_ANIMS
1115-
PlayHUDMotion("anm_reload", true, this, GetState());
1116-
}
1117-
else
1118-
PlayHUDMotion("anm_reload", true, this, GetState());
1108+
PlayHUDMotion("anm_hide", true, this, GetState());
11191109
}
11201110

11211111
void CWeaponMagazined::PlayAnimReload()
@@ -1159,7 +1149,7 @@ void CWeaponMagazined::PlayAnimIdle()
11591149
void CWeaponMagazined::PlayAnimShoot()
11601150
{
11611151
VERIFY(GetState() == eFire);
1162-
PlayHUDMotion("anm_shots", FALSE, this, GetState());
1152+
PlayHUDMotion("anm_shots", false, this, GetState());
11631153
}
11641154

11651155
void CWeaponMagazined::OnZoomIn()

0 commit comments

Comments
 (0)