Skip to content

Move NVG functionality clientside + add support for default flashlight - #374

Merged
1upD merged 1 commit into
entropy-zero:ez2/mapbasefrom
Blixibon:ez2/feature/nvg-client-and-flashlight-support
Nov 9, 2026
Merged

1upD merged 1 commit into
entropy-zero:ez2/mapbasefrom
Blixibon:ez2/feature/nvg-client-and-flashlight-support

Conversation

@Blixibon

@Blixibon Blixibon commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

This PR moves NVG functionality clientside and sets up dedicated post-processing effects for it, eliminating the managed color_correction entity on the server, fixing conflicts with env_screenoverlay, and preventing potential issues in multiplayer.

This PR also restores support for the default flashlight, which can be controlled through new Enable/DisableNVG inputs on the player (and on logic_playerproxy).

@1upD 1upD left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I left a few comments on this PR but none are blocking per se. I just want to make sure we go over this before I approve it.

This will be huge for mapping! I have a few maps that need this.

void Flashlight( void );
virtual void UpdateFlashlight( void );
#ifdef EZ
virtual int GetFlashlightType() { return 0; }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should 0 be enumerated here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it's particularly necessary for just 0 in the base class (although that comes down to personal preference)

UTIL_PrecacheOther( "prop_command_point" );
#endif
#ifdef EZ2
PrecacheScriptSound( "EZ2Player.NVGOn" );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The "EmitSound" call in FlashlightTurnOn uses this sound but it is within an #ifdef EZ preprocessor, not #ifdef EZ2. Should this apply for EZ1 too? Or would it only be applicable for EZ2?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think I set E:Z1 code to still always use the NVG by default, but I haven't tested that and I don't think the specific implementation details in E:Z1 are too relevant for this PR since we're not maintaining that in this branch. It will need other changes if we ever do use this code in E:Z1 anyway

C_EZ2_Player *pEZ2Player = ToEZ2Player( pPlayer );
if ( pEZ2Player->IsNVGActive() )
{
IMaterial *pOverlayMaterial = materials->FindMaterial( "Ezero/Mask_NvMap", TEXTURE_GROUP_OTHER, true );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Future comment - I wonder if we should make this texture configurable just like how the flashlight texture is

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That could be done with a cvar or networked string (or a protagonist system keyvalue) in the future

}

// TODO: Should really put this in the protagonist system
ConVar sv_flashlight_cc_filename( "sv_flashlight_cc_filename", "ez2_nvg.raw", FCVAR_REPLICATED, "", OnNVGCCFileChange );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment: It's funny that this is an sv_ convar but it's literally for the client.

I know we can't change it though because that would be breaking!

@1upD 1upD left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You addressed all the comments, so I'm comfortable moving forward with this

@1upD
1upD merged commit 99b7405 into entropy-zero:ez2/mapbase Nov 9, 2026
8 of 9 checks passed
@Blixibon
Blixibon deleted the ez2/feature/nvg-client-and-flashlight-support branch November 9, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants