Skip to content

Commit

Permalink
Fixed first shot freeze on weapons, optimize memory usage (#1369)
Browse files Browse the repository at this point in the history
Co-authored-by: Xottab_DUTY <Xottab-DUTY@users.noreply.github.com>
  • Loading branch information
Herman Semenov and Xottab-DUTY authored Oct 17, 2023
1 parent bd820af commit b8fc862
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/xrGame/CarWeapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ CCarWeapon::CCarWeapon(CPhysicsShellHolder* obj)
m_destEnemyDir.setHP(m_bind_y_rot, m_bind_x_rot);
m_object->XFORM().transform_dir(m_destEnemyDir);

inheritedShooting::Light_Create();
Load(pUserData->r_string("mounted_weapon_definition", "wpn_section"));
SetBoneCallbacks();
m_object->processing_activate();
Expand All @@ -82,6 +81,8 @@ void CCarWeapon::Load(LPCSTR section)
inheritedShooting::Load(section);
HUD_SOUND_ITEM::LoadSound(section, "snd_shoot", m_sndShot, SOUND_TYPE_WEAPON_SHOOTING);
m_Ammo->Load(pSettings->r_string(section, "ammo_class"), 0);
if (m_bLightShotEnabled)
inheritedShooting::Light_Create();
}

void CCarWeapon::UpdateCL()
Expand Down
3 changes: 2 additions & 1 deletion src/xrGame/Helicopter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ bool CHelicopter::net_Spawn(CSE_Abstract* DC)
m_engineSound.create(*heli->engine_sound, st_Effect, sg_SourceType);
m_engineSound.play_at_pos(0, XFORM().c, sm_Looped);

CShootingObject::Light_Create();
if (m_bLightShotEnabled)
CShootingObject::Light_Create();

setVisible(TRUE);
setEnabled(TRUE);
Expand Down
3 changes: 3 additions & 0 deletions src/xrGame/Weapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,9 @@ bool CWeapon::net_Spawn(CSE_Abstract* DC)
VERIFY((u32)iAmmoElapsed == m_magazine.size());
m_bAmmoWasSpawned = false;

if (m_bLightShotEnabled)
Light_Create();

return bResult;
}

Expand Down
3 changes: 2 additions & 1 deletion src/xrGame/WeaponStatMgun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ bool CWeaponStatMgun::net_Spawn(CSE_Abstract* DC)
m_destEnemyDir.setHP(m_bind_y_rot, m_bind_x_rot);
XFORM().transform_dir(m_destEnemyDir);

inheritedShooting::Light_Create();
if (m_bLightShotEnabled)
inheritedShooting::Light_Create();

processing_activate();
setVisible(TRUE);
Expand Down

0 comments on commit b8fc862

Please sign in to comment.