Hide third person muzzle flash for spectators in eye, simplify particle emission, fix first person muzzle flash not rotating, rotate muzzle flash with viewmodel rotation, move setorigin and angles of muzzleflash to CalcViewModelView#1146
Merged
AdamTadeusz merged 7 commits intoAug 19, 2025
Conversation
DESTROYGIRL
previously approved these changes
May 27, 2025
Rainyan
requested changes
Jul 10, 2025
2 tasks
Rainyan
self-requested a review
July 31, 2025 17:09
Rainyan
approved these changes
Aug 1, 2025
sunzenshen
approved these changes
Aug 19, 2025
sunzenshen
left a comment
Contributor
There was a problem hiding this comment.
On a local branch, rebased on top of e80e9b0 and then observed bot matches in both first version view and 3rd person follow mode. I guess muzzle flashes look fine? But admittedly I didn't notice the problems mentioned in the PR description, so my observations might be unsophisticated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The function in C_BaseAnimating that calls CNEOBaseCombatWeapon::ProcessMuzzleFlashEvent is supposed to exit early if the weapon isn't visible to the local player, but this doesn't work for weapons which are hidden to spectators in first person observer mode. This seems to be at least known about considering the check in C_BaseCombatWeapon::DrawModel, so adding the same check to CNEOBaseCombatWeapon::ProcessMuzzleFlashEvent to exit early.
When trying to figure out why third person muzzle flashes were being drawn at world origin as well (turned out to be a particle error), I figured out a way to emit a particle client side only thats much simpler (see how "vortigaunt_beam_charge" is being emitted). Since we don't need to pass anything to the one and only particle controller in ntr_muzzle_source since we're using an attachment point, it becomes a one liner.
I also noticed two problems with the first person muzzle flash.
There was a problem discovered recently where the first person muzzle flash wouldn't move with the muzzle attachment. We're not actually attaching the muzzle flash to the view model, but instead changing the muzzle flash origin and angle to where the muzzle is each draw. I figured moving this code to CalcViewModelView instead so the position of the muzzle flash is updated right after the position of the viewmodel itself is updated, in roughly the same way as the position of the viewmodel, could solve this issue. If we still notice this problem we could also try actually setting the muzzle flash attachment point to the muzzle in a onNewModel function in the viewmodel.