Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear Sky: Missing variable in gun setting file #1678

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

sobkas
Copy link
Contributor

@sobkas sobkas commented May 20, 2024

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

Copy link
Member

@Xottab-DUTY Xottab-DUTY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
There are some notes about the solution.

src/xrCore/xr_ini.h Outdated Show resolved Hide resolved
src/xrGame/WeaponMagazined.cpp Outdated Show resolved Hide resolved
@Xottab-DUTY Xottab-DUTY added Enhancement Player Experience Modmaker Experience Modmaker experience with OpenXRay Clear Sky This can affect Clear Sky compatibility, or related to this game. labels May 20, 2024
@sobkas sobkas force-pushed the dev_crash_no_snd_silncer_shot branch from 3508daa to f4f9284 Compare May 20, 2024 21:13
@Xottab-DUTY
Copy link
Member

Xottab-DUTY commented May 21, 2024

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
Copy link
Contributor Author

sobkas commented May 21, 2024

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

@sobkas sobkas force-pushed the dev_crash_no_snd_silncer_shot branch 2 times, most recently from 4295c9d to d01b5f8 Compare May 21, 2024 20:16
@@ -90,7 +90,7 @@ void CWeaponMagazined::Load(LPCSTR section)
m_sSndShotCurrent = "sndShot";

//звуки и партиклы глушителя, если такой есть
if (m_eSilencerStatus == ALife::eAddonAttachable || m_eSilencerStatus == ALife::eAddonPermanent)
if ((m_eSilencerStatus == ALife::eAddonAttachable || m_eSilencerStatus == ALife::eAddonPermanent) && WeaponSoundExist(section, "snd_silncer_shot"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, don't disable flame particles when shot sound doesn't exist. This code does exactly that.

@sobkas sobkas force-pushed the dev_crash_no_snd_silncer_shot branch 2 times, most recently from b5f481f to 3d6856c Compare June 1, 2024 15:07
@Xottab-DUTY
Copy link
Member

Well it fixes also other problem I have found wpn_pb

What was that problem?

@sobkas
Copy link
Contributor Author

sobkas commented Jun 2, 2024

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 silencer_light_*)
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
Copy link
Contributor Author

sobkas commented Jun 3, 2024

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

…sor don't have snd_silncer_shot only snd_shoot
@sobkas sobkas force-pushed the dev_crash_no_snd_silncer_shot branch from 3d6856c to 9551f3e Compare June 27, 2024 22:25
@sobkas
Copy link
Contributor Author

sobkas commented Jul 22, 2024

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

@Xottab-DUTY Xottab-DUTY force-pushed the dev branch 2 times, most recently from e89fcc8 to f6fd5cc Compare October 24, 2024 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clear Sky This can affect Clear Sky compatibility, or related to this game. Enhancement Modmaker Experience Modmaker experience with OpenXRay Player Experience
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants