OpenXRay / xray-16

Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World. Join OpenXRay! ;)
https://discord.gg/sjRMQwv
Other
2.97k stars 456 forks source link

Clear Sky: Missing variable in gun setting file #1678

Open sobkas opened 4 months ago

sobkas commented 4 months ago

Crash when some weapons(eg. wpn_val) with built in suppressor don't have snd_silncer_shot only snd_shoot

Xottab-DUTY commented 4 months ago

I just checked the difference between CS and COP sources: image

CS code was trying to use sndSilencerShot only if silencer attached and is actually attachable/detachable, assuming the use of normal sndShot when there's no silencer or it's built-in. In COP SilencerAttachable() check was commented out.

The most natural fix would be checking for sndSilencerShot existence in InitAddons function on line 1068. Replace this:

    if (IsSilencerAttached() /* && SilencerAttachable() */)

With this:

    if (IsSilencerAttached() && m_layered_sounds.FindSoundItem("sndSilencerShot", false))

Please, change the code accordingly!

sobkas commented 4 months ago

I just checked the difference between CS and COP sources: image

CS code was trying to use sndSilencerShot only if silencer attached and is actually attachable/detachable, assuming the use of normal sndShot when there's no silencer or it's built-in. In COP SilencerAttachable() check was commented out.

The most natural fix would be checking for sndSilencerShot existence in InitAddons function on line 1068. Replace this:

    if (IsSilencerAttached() /* && SilencerAttachable() */)

With this:

    if (IsSilencerAttached() && m_layered_sounds.FindSoundItem("sndSilencerShot", false))

Please, change the code accordingly!

Well it fixes also other problem I have found wpn_pb

Xottab-DUTY commented 4 months ago

Well it fixes also other problem I have found wpn_pb

What was that problem?

sobkas commented 4 months ago

Well it fixes also other problem I have found wpn_pb

What was that problem?

It doesn't have silencer_light_color and family(all silencerlight*) So when it tries to use any of them it crashes.

;silencer_flame_particles = weapons\generic_weapon03 ;silencer_smoke_particles = weapons\generic_shoot_00

;silencer_light_color = 0.6, 0.5, 0.3 ;silencer_light_range = 0.01 ;silencer_light_var_color = 0.05 ;silencer_light_var_range = 0.5 ;silencer_light_time = 0.2

sobkas commented 4 months ago

t1.zip When used with SRP_v1.1.4:Optional Features/#2. (Choose From This Folder Last)/Alternative Ballistics it causes crash

sobkas commented 2 months ago

Without it merged or getting feedback I can't continue to test Clear Sky support