Skip to content

SERVER/CLIENT/MENU: Add accessibility setting for screen flashes#117

Merged
MotoLegacy merged 4 commits into
nzp-team:mainfrom
katniny:black-nuke
Jun 19, 2025
Merged

SERVER/CLIENT/MENU: Add accessibility setting for screen flashes#117
MotoLegacy merged 4 commits into
nzp-team:mainfrom
katniny:black-nuke

Conversation

@katniny
Copy link
Copy Markdown
Contributor

@katniny katniny commented Mar 3, 2025

Description of Changes


Might close nzp-team/nzportable#613, though it doesn't "disable" the nuke, it just makes the flash black and pretty transparent.

This adds a setting to the Accessibility tab to have the standard "White" flash (default), or "Black" which will be black (of course) and be mostly transparent to prevent "being flashbanged".

Visual Sample


8mb.video-09Y-LbdUTm1X.mp4

Checklist


  • I have thoroughly tested my changes to the best of my ability
  • I confirm I have not contributed anything that would impact Nazi Zombies: Portable's licensing and usage
  • This Pull Request fixes a critical issue that should be reviewed and merged as soon as possible

Comment thread source/menu/menu_aces.qc Outdated
void() Menu_Accessibility_StoreCurrentSettings =
{
current_hitmarker = cvar("cl_hitmarkers");
current_nukeflash = cvar("cl_nukeflashcolor");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

instead of nukeflash this should be a bit more generic since it will apply to all white flashes.

additionally, please use scr_ instead of cl_ for the cvar

Comment thread source/menu/menu_aces.qc Outdated
Menu_CvarSlider(2, [0, 1, 20], "cl_textopacity", false, false);

// Nuke flash color
Menu_Button(3, "ac_nukefla", "NUKE FLASH COLOR", "Choose the color of the nuke flash.") ? Menu_Accessibility_UpdateNukeFlash() : 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

WHITE SCREEN FLASHES or something

Comment thread source/menu/menu_ctrl.qc Outdated
@@ -1,4 +1,4 @@
string menu_ctrl_buttons[7] = {"cm_adsm", "cm_sens", "cm_invs", "cm_gpad", "cm_bind", "cm_apply", "cm_back"};
string menu_ctrl_buttons[8] = {"cm_adsm", "cm_sens", "cm_invs", "cm_gpad", "cm_bind", "cm_apply", "cm_back"};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorry, i was originally working on something else, i guess i forgot to set that back to 7 😅

Comment thread source/server/entities/powerups.qc Outdated
{
// Flash the screen white
nzp_screenflash(world, SCREENFLASH_COLOR_WHITE, 1, SCREENFLASH_FADE_INANDOUT);
if (cvar("cl_nukeflashcolor") == 0) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can't do this on the server. It will only respect the hosts setting. We should be intercepting the type sent on the client side so it respects the users choice and we can do this for all white flashes

Comment thread source/server/entities/powerups.qc Outdated
if (cvar("cl_nukeflashcolor") == 0) {
nzp_screenflash(world, SCREENFLASH_COLOR_WHITE, 1, SCREENFLASH_FADE_INANDOUT);
} else if (cvar("cl_nukeflashcolor") == 1) {
nzp_screenflash(world, SCREENFLASH_COLOR_BLACK, 1, SCREENFLASH_FADE_INANDOUT);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You said you made it less intense if enabled but the duration seems the same here?

@katniny katniny marked this pull request as draft March 3, 2025 15:27
@katniny katniny closed this Jun 14, 2025
…SER & respect users preference when a white screen flash occurs
@katniny katniny changed the title SERVER/MENU: Add accessibility setting for the nuke flash SERVER/MENU: Add accessibility setting for screen flashes Jun 15, 2025
@katniny katniny changed the title SERVER/MENU: Add accessibility setting for screen flashes SERVER/CLIENT/MENU: Add accessibility setting for screen flashes Jun 15, 2025
@katniny
Copy link
Copy Markdown
Contributor Author

katniny commented Jun 15, 2025

Finally got back around to this PR:

2025-06-15.03-02-42.mp4

(Game instances on the left are both black flashes, game instances on the right are both white flashes based on user's setting).

NZ:P will now respect the users screen flash preference (scr_flashmode), assuming its set. If the cvar isn't set, it'll flash white.

Also, you should now be able to call SCREENFLASH_COLOR_RESPECT_USER as the color within a nzp_screenflash function call, and it should flash what the user has it set to, if it's ever needed anywhere else in NZ:P.

@katniny katniny reopened this Jun 15, 2025
@katniny katniny marked this pull request as ready for review June 15, 2025 09:20
@katniny
Copy link
Copy Markdown
Contributor Author

katniny commented Jun 16, 2025

Fixed a couple minor oopsies, but it should be all good now.

@MotoLegacy
Copy link
Copy Markdown
Member

MotoLegacy commented Jun 16, 2025

To be honest I much preferred the original intent of the setting to change the behavior of white flashes to be black instead, as I commented in the original revision. Adding a new field 99 will break compatibility with Vril and also the settings strings and code here imply all flashes will be overwritten as black.

Can you please go back to the initial idea of an accessibility setting where, when the client receives a request for a white screenflash, it displays a black one instead?

…h black if applicable, remove SCREENFLASH_COLOR_RESPECT_USER, and make menu options accurate
@katniny
Copy link
Copy Markdown
Contributor Author

katniny commented Jun 16, 2025

To be honest I much preferred the original intent of the setting to change the behavior of white flashes to be black instead, as I commented in the original revision. Adding a new field 99 will break compatibility with Vril and also the settings strings and code here imply all flashes will be overwritten as black.

Can you please go back to the initial idea of an accessibility setting where, when the client receives a request for a white screenflash, it displays a black one instead?

yep :) sorry, 3am brain definitely make me over-complicate things lol, sorry! i'll try to consult you more on discord for future prs (or this one if needed)!

nz:p will now check if the requested flash color is SCREENFLASH_COLOR_WHITE and if the scr_whiteflash cvar is 1, it'll replace the screenflash_color with black, otherwise it'll stay white
menu options are also now representative that they're only affecting white screen flashes instead of all of them

2025-06-16.00-50-47.mp4

(left windows are white flashes, right windows are black flashes)

Copy link
Copy Markdown
Member

@MotoLegacy MotoLegacy left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for contributing this

@MotoLegacy MotoLegacy merged commit 393ab1b into nzp-team:main Jun 19, 2025
2 checks passed
@katniny katniny deleted the black-nuke branch June 22, 2025 06:24
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.

Make nuke flash optional

2 participants