-
Notifications
You must be signed in to change notification settings - Fork 20
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
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
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
Conversation
brysondev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
sunzenshen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.