Merge pull request #104 from nzp-team/cypress_hudorder

CLIENT: Fix small HUD inaccuracies; add accessibility options
This commit is contained in:
cypress 2025-01-21 20:05:24 -08:00 committed by GitHub
commit 6d28bcc808
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 607 additions and 262 deletions

View file

@ -21,6 +21,7 @@ menu_audi.qc // Audio Menu
menu_ctrl.qc // Control Menu menu_ctrl.qc // Control Menu
menu_gpad.qc // Gamepad Menu menu_gpad.qc // Gamepad Menu
menu_bind.qc // Bindings Menu menu_bind.qc // Bindings Menu
menu_aces.qc // Accessibility Menu
sound_enhanced.qc sound_enhanced.qc
weapon_stats.qc weapon_stats.qc

View file

@ -19,6 +19,7 @@ menu_audi.qc // Audio Menu
menu_ctrl.qc // Control Menu menu_ctrl.qc // Control Menu
menu_gpad.qc // Gamepad Menu menu_gpad.qc // Gamepad Menu
menu_bind.qc // Bindings Menu menu_bind.qc // Bindings Menu
menu_aces.qc // Accessibility Menu
menu_cred.qc // Credits Menu menu_cred.qc // Credits Menu
menu_load.qc // Loading Screen menu_load.qc // Loading Screen
menu_coop.qc // Co-op Menu menu_coop.qc // Co-op Menu

View file

@ -54,7 +54,9 @@ float hud_maxammo_starttime;
float nameprint_time; float nameprint_time;
float HUD_Change_time; float HUD_Change_time;
float Hitmark_time; float hitmark_time;
float hitmark_ignore_time;
float hitmark_type;
float recoil_kick_time; float recoil_kick_time;
float crosshair_pulse_grenade; float crosshair_pulse_grenade;
float zoom_2_time; float zoom_2_time;

File diff suppressed because it is too large Load diff

View file

@ -162,6 +162,8 @@ noref void(float apiver, string enginename, float enginever) CSQC_Init =
autocvar(cl_controllerglyphs, "xbox"); autocvar(cl_controllerglyphs, "xbox");
autocvar(in_rumbleenabled, 1); autocvar(in_rumbleenabled, 1);
autocvar(in_aimassist, 0); autocvar(in_aimassist, 0);
autocvar(cl_hitmarkers, 1);
autocvar(cl_textopacity, 0.20);
autocvar(scr_playerdebuginfo, 0); autocvar(scr_playerdebuginfo, 0);
autocvar(scr_playerdebuginfo_x, 64); autocvar(scr_playerdebuginfo_x, 64);
@ -806,8 +808,7 @@ noref void(float width, float height, float menushown) CSQC_UpdateView =
{ {
// sorta-nasty hack: flashes should still draw if we're // sorta-nasty hack: flashes should still draw if we're
// drawing the menu. // drawing the menu.
if (screenflash_duration > time) HUD_Screenflash();
HUD_Screenflash();
setlocaluserinfo(0, "in_menu", "1"); setlocaluserinfo(0, "in_menu", "1");
@ -818,7 +819,7 @@ noref void(float width, float height, float menushown) CSQC_UpdateView =
else else
{ {
setcursormode(FALSE); setcursormode(FALSE);
HUD_Draw(g_width, g_height); HUD_DrawElements();
Chat_Draw(); Chat_Draw();
setlocaluserinfo(0, "in_menu", "0"); setlocaluserinfo(0, "in_menu", "0");
} }
@ -1024,7 +1025,6 @@ noref void() CSQC_Parse_Event =
break; break;
case CSQC_EVENT_ROUNDCHANGE: case CSQC_EVENT_ROUNDCHANGE:
rounds = readbyte(); rounds = readbyte();
HUD_Change_time = time + 6;
break; break;
case CSQC_EVENT_BROADCASTMESSAGE: case CSQC_EVENT_BROADCASTMESSAGE:
broadcast_type = readbyte(); broadcast_type = readbyte();
@ -1086,7 +1086,7 @@ noref void() CSQC_Parse_Event =
Chat_Register(sender, player_id, message); Chat_Register(sender, player_id, message);
break; break;
case EVENT_ENDGAME: case EVENT_ENDGAME:
game_over = true; in_endgame_sequence = true;
break; break;
case EVENT_DOUBLETAPUPDATE: case EVENT_DOUBLETAPUPDATE:
double_tap_version = readbyte(); double_tap_version = readbyte();
@ -1106,8 +1106,18 @@ noref void() CSQC_Parse_Event =
rounds_change = var_1; rounds_change = var_1;
break; break;
case 3: case 3:
if (Hitmark_time < time) if (hitmark_ignore_time > time)
Hitmark_time = time + 0.2; return;
hitmark_type = var_1;
// Red
if (hitmark_type == 1) {
hitmark_time = time + 0.2;
hitmark_ignore_time = time + 0.2;
} else {
hitmark_time = time + 0.3;
}
break; break;
case 5: case 5:
recoil_kick_time = time + 70/getWeaponRecoilReturn(getstatf(STAT_ACTIVEWEAPON)); recoil_kick_time = time + 70/getWeaponRecoilReturn(getstatf(STAT_ACTIVEWEAPON));

View file

@ -175,7 +175,7 @@ void(entity viewent) ViewModel_Animate =
// If we switched to a different weapon model, // If we switched to a different weapon model,
// make sure to update the HUD. // make sure to update the HUD.
if (getmodelindex(GetWeaponModel(getstatf(STAT_ACTIVEWEAPON), false)) == viewent.modelindex) if (getmodelindex(GetWeaponModel(getstatf(STAT_ACTIVEWEAPON), false)) == viewent.modelindex)
HUD_Change_time = time + 6; HUD_Change_time = time + 7;
// Update the skin. // Update the skin.
viewent.skin = getstatf(STAT_WEAPONSKIN); viewent.skin = getstatf(STAT_WEAPONSKIN);

View file

@ -54,6 +54,7 @@ enum {
MENU_CONTROL, MENU_CONTROL,
MENU_GAMEPAD, MENU_GAMEPAD,
MENU_BINDINGS, MENU_BINDINGS,
MENU_ACCESSIBILITY,
MENU_CREDITS, MENU_CREDITS,
MENU_PAUSE MENU_PAUSE
}; };
@ -85,6 +86,7 @@ void() Menu_Audio;
void() Menu_Control; void() Menu_Control;
void() Menu_Gamepad; void() Menu_Gamepad;
void() Menu_Bindings; void() Menu_Bindings;
void() Menu_Accessibility;
#ifdef MENU #ifdef MENU
@ -125,6 +127,8 @@ string(string prev_id) Menu_Gamepad_GetNextButton;
string(string next_id) Menu_Gamepad_GetPreviousButton; string(string next_id) Menu_Gamepad_GetPreviousButton;
string(string prev_id) Menu_Bindings_GetNextButton; string(string prev_id) Menu_Bindings_GetNextButton;
string(string next_id) Menu_Bindings_GetPreviousButton; string(string next_id) Menu_Bindings_GetPreviousButton;
string(string prev_id) Menu_Accessibility_GetNextButton;
string(string next_id) Menu_Accessibility_GetPreviousButton;
enum { enum {
MAP_SOLOSTOCK, MAP_SOLOSTOCK,

View file

@ -548,7 +548,7 @@ void(float order, vector minmaxsteps, string cvar_s, float is_int, float no_text
if (is_int) if (is_int)
sui_text(position + [175, 0, 0], MENU_TEXT_MEDIUM, ftos(rint(current)), [1, 1, 1], 1, 0); sui_text(position + [175, 0, 0], MENU_TEXT_MEDIUM, ftos(rint(current)), [1, 1, 1], 1, 0);
else else
sui_text(position + [175, 0, 0], MENU_TEXT_MEDIUM, ftos(current), [1, 1, 1], 1, 0); sui_text(position + [175, 0, 0], MENU_TEXT_MEDIUM, sprintf("%.2f", current), [1, 1, 1], 1, 0);
} }
}; };
@ -871,6 +871,7 @@ void(vector size) root_menu =
case MENU_CONTROL: Menu_Control(); break; case MENU_CONTROL: Menu_Control(); break;
case MENU_GAMEPAD: Menu_Gamepad(); break; case MENU_GAMEPAD: Menu_Gamepad(); break;
case MENU_BINDINGS: Menu_Bindings(); break; case MENU_BINDINGS: Menu_Bindings(); break;
case MENU_ACCESSIBILITY: Menu_Accessibility(); break;
default: break; default: break;
} }

View file

@ -218,6 +218,8 @@ void() m_init =
autocvar(nzp_uivolume, 1); autocvar(nzp_uivolume, 1);
autocvar(nzp_bgmvolume, 1); autocvar(nzp_bgmvolume, 1);
autocvar(vid_ultrawide_limiter, 0); autocvar(vid_ultrawide_limiter, 0);
autocvar(cl_hitmarkers, 1);
autocvar(cl_textopacity, 0.20);
music_duration_time = 0; music_duration_time = 0;
menu_changetime = 0; menu_changetime = 0;

98
source/menu/menu_aces.qc Normal file
View file

@ -0,0 +1,98 @@
string menu_accesibility_buttons[4] = {"ac_hitm", "ac_text", "ac_apply", "ac_back"};
float menu_accessibility_init;
float current_hitmarker;
string(string prev_id) Menu_Accessibility_GetNextButton =
{
if (prev_id == "")
return menu_accesibility_buttons[0];
string ret = menu_accesibility_buttons[0];
for(float i = 0; i < menu_accesibility_buttons.length; i++) {
if (menu_accesibility_buttons[i] == prev_id) {
if (i + 1 >= menu_accesibility_buttons.length)
break;
ret = menu_accesibility_buttons[i + 1];
break;
}
}
return ret;
};
string(string next_id) Menu_Accessibility_GetPreviousButton =
{
if (next_id == "")
return menu_accesibility_buttons[menu_accesibility_buttons.length - 1];
string ret = menu_accesibility_buttons[menu_accesibility_buttons.length - 1];
for(float i = menu_accesibility_buttons.length - 1; i > 0; i--) {
if (menu_accesibility_buttons[i] == next_id) {
if (i - 1 < 0)
break;
ret = menu_accesibility_buttons[i - 1];
break;
}
}
return ret;
};
void() Menu_Accessibility_StoreCurrentSettings =
{
current_hitmarker = cvar("cl_hitmarkers");
}
void() Menu_Accessibility_ApplySettings =
{
localcmd("vid_reload\nsaveconfig user_settings.cfg\n");
music_duration_time = 0;
};
void() Menu_Accessibility_Init =
{
Menu_Accessibility_StoreCurrentSettings();
menu_accessibility_init = true;
};
void() Menu_Accessibility_UpdateHitmarkers =
{
Menu_PlaySound(MENU_SND_ENTER);
current_hitmarker = !current_hitmarker;
cvar_set("cl_hitmarkers", ftos(current_hitmarker));
};
void() Menu_Accessibility =
{
if (!menu_accessibility_init)
Menu_Accessibility_Init();
Menu_DrawBackground();
Menu_DrawTitle("ACCESSIBILITY");
// Hitmarkers
Menu_Button(1, "ac_hitm", "HITMARKERS", "HUD Hitmarkers for visual feedback.") ? Menu_Accessibility_UpdateHitmarkers() : 0;
string hitmarker_string = "";
switch(current_hitmarker) {
case 0: hitmarker_string = "DISABLED"; break;
case 1: hitmarker_string = "ENABLED"; break;
default: break;
}
Menu_DrawOptionValue(1, hitmarker_string);
// Text Backdrop
Menu_Button(2, "ac_text", "TEXT BACKDROP", "Opacity of backdrop for text elements on HUD.") ? 0 : 0;
Menu_CvarSlider(2, [0, 1, 20], "cl_textopacity", false, false);
Menu_DrawDivider(12.25);
Menu_Button(-2, "ac_apply", "APPLY", "Save & Apply Settings.") ? Menu_Accessibility_ApplySettings() : 0;
Menu_Button(-1, "ac_back", "BACK", "Return to Configuration Menu.") ? current_menu = MENU_OPTIONS : 0;
sui_pop_frame();
};

View file

@ -48,8 +48,7 @@ void() Menu_Options =
Menu_Button(1, "om_video", "VIDEO", "Visual Fidelity options.") ? current_menu = MENU_VIDEO : 0; Menu_Button(1, "om_video", "VIDEO", "Visual Fidelity options.") ? current_menu = MENU_VIDEO : 0;
Menu_Button(2, "om_audio", "AUDIO", "Volume sliders.") ? current_menu = MENU_AUDIO : 0; Menu_Button(2, "om_audio", "AUDIO", "Volume sliders.") ? current_menu = MENU_AUDIO : 0;
Menu_Button(3, "om_binds", "CONTROLS", "Control Options and Bindings.") ? current_menu = MENU_CONTROL : 0; Menu_Button(3, "om_binds", "CONTROLS", "Control Options and Bindings.") ? current_menu = MENU_CONTROL : 0;
//Menu_Button(4, "om_acces", "ACCESSIBILITY", "Light Sensitivity options.") ? 1 : 0; Menu_Button(4, "om_acces", "ACCESSIBILITY", "Interface and Readability options.") ? current_menu = MENU_ACCESSIBILITY : 0;
Menu_GreyButton(4, "ACCESSIBILITY");
Menu_DrawDivider(5); Menu_DrawDivider(5);
Menu_Button(5.25, "om_console", "OPEN CONSOLE", "Access the Developer Console.") ? localcmd("toggleconsole\n") : 0; Menu_Button(5.25, "om_console", "OPEN CONSOLE", "Access the Developer Console.") ? localcmd("toggleconsole\n") : 0;

View file

@ -448,6 +448,9 @@ void() _sui_menukey_downarrow =
case MENU_BINDINGS: case MENU_BINDINGS:
_hover_actions[0] = Menu_Bindings_GetNextButton(current_hovered_option); _hover_actions[0] = Menu_Bindings_GetNextButton(current_hovered_option);
break; break;
case MENU_ACCESSIBILITY:
_hover_actions[0] = Menu_Accessibility_GetNextButton(current_hovered_option);
break;
default: default:
break; break;
} }
@ -514,6 +517,9 @@ void() _sui_menukey_uparrow =
case MENU_BINDINGS: case MENU_BINDINGS:
_hover_actions[0] = Menu_Bindings_GetPreviousButton(current_hovered_option); _hover_actions[0] = Menu_Bindings_GetPreviousButton(current_hovered_option);
break; break;
case MENU_ACCESSIBILITY:
_hover_actions[0] = Menu_Accessibility_GetPreviousButton(current_hovered_option);
break;
default: default:
break; break;
} }

View file

@ -221,6 +221,27 @@ void(entity who, float weapon) CL_SendWeaponFire =
self.recoil_delay = 60/recoil_return_time + time; self.recoil_delay = 60/recoil_return_time + time;
} }
//
// nzp_hitmarker(who)
// Tells client to draw hitmarker for "who". death_marker
// indicates a red hitmarker.
//
void(entity who, float death_marker) nzp_hitmarker =
{
#ifdef FTE
SetUpdate(who, UT_HM, death_marker, 0, 0);
#else
msg_entity = who;
WriteByte(MSG_ONE, SVC_HITMARK);
#endif // FTE
};
#ifdef FTE #ifdef FTE
// //

View file

@ -152,11 +152,12 @@ void() EndGameSetup =
players = find(players, classname, "player"); players = find(players, classname, "player");
} }
if (!game_over) { if (in_endgame_sequence == false) {
Rounds_PlayTransition("sounds/music/end.wav"); Rounds_PlayTransition("sounds/music/end.wav");
NotifyGameEnd(); NotifyGameEnd();
} }
game_over = true;
in_endgame_sequence = true;
Player_RemoveScore(self, self.points); Player_RemoveScore(self, self.points);
Player_AddScore(self, self.score, false); Player_AddScore(self, self.score, false);
for (float i = 0; i < MAX_PLAYER_WEAPONS; ++i) for (float i = 0; i < MAX_PLAYER_WEAPONS; ++i)
@ -233,6 +234,7 @@ void(entity attacker, float d_style) DieHandler =
if (attacker.classname == "player") { if (attacker.classname == "player") {
attacker.kills++; attacker.kills++;
nzp_hitmarker(attacker, true);
float points_earned = 0; float points_earned = 0;
switch(d_style) { switch(d_style) {
@ -283,6 +285,7 @@ void(entity victim, entity attacker, float damage, float d_style) DamageHandler
if (attacker.classname == "player" && (victim.health - damage) > 0 && d_style != DMG_TYPE_OTHER) { if (attacker.classname == "player" && (victim.health - damage) > 0 && d_style != DMG_TYPE_OTHER) {
Player_AddScore(attacker, DMG_SCORE_STDDAMAGE, true); Player_AddScore(attacker, DMG_SCORE_STDDAMAGE, true);
nzp_hitmarker(attacker, false);
} }
victim.health = victim.health - damage; victim.health = victim.health - damage;

View file

@ -214,7 +214,7 @@ void(entity client) LastStand_KillPlayer =
// If we are in the middle of the Game Over // If we are in the middle of the Game Over
// sequence, we should not allow a bleed // sequence, we should not allow a bleed
// out to override it. // out to override it.
if (!game_over) if (in_endgame_sequence == false)
startspectate(); startspectate();
self = old_self; self = old_self;

View file

@ -311,7 +311,7 @@ void() NewRound =
void() Round_Core = void() Round_Core =
{ {
if (game_over) if (in_endgame_sequence)
return; return;
if (round_changetime) { if (round_changetime) {

View file

@ -353,7 +353,7 @@ void() Soft_Restart = {
self.progress_bar = 0; self.progress_bar = 0;
self.progress_bar_time = 0; self.progress_bar_time = 0;
self.progress_bar_percent = 0; self.progress_bar_percent = 0;
game_over = false; in_endgame_sequence = false;
rounds = 0; rounds = 0;
self.score = 0; self.score = 0;
self.points = 0; self.points = 0;

View file

@ -394,6 +394,8 @@ void(float side) W_Reload =
if (self.zoom == 2) if (self.zoom == 2)
return; return;
SetUpdate(self, UT_HUD, 7, 0, 0);
if (GetFiretype(self.weapon) == FIRETYPE_FLAME) if (GetFiretype(self.weapon) == FIRETYPE_FLAME)
return; return;
@ -864,16 +866,6 @@ void(float damage, vector dir, vector org, vector plane, entity hit_ent, float s
hit_ent.washit = 1; hit_ent.washit = 1;
hit_ent.hitamount = hit_ent.hitamount + f_damage; hit_ent.hitamount = hit_ent.hitamount + f_damage;
SetUpdate(self, UT_HM, 0, 0, 0);
#ifndef FTE
msg_entity = self;
WriteByte(MSG_ONE, SVC_HITMARK);
#endif // FTE
} else { } else {
#ifndef FTE #ifndef FTE
@ -1182,7 +1174,7 @@ void(float side) W_Fire =
Sound_PlaySound(self, "sounds/weapons/papfire.wav", SOUND_TYPE_WEAPON_PACK, SOUND_PRIORITY_PLAYALWAYS); Sound_PlaySound(self, "sounds/weapons/papfire.wav", SOUND_TYPE_WEAPON_PACK, SOUND_PRIORITY_PLAYALWAYS);
} }
SetUpdate(self, UT_HUD, 6, 0, 0); SetUpdate(self, UT_HUD, 7, 0, 0);
SetUpdate(self, UT_CROSSHAIR, 5, 0, 0); SetUpdate(self, UT_CROSSHAIR, 5, 0, 0);
@ -1214,7 +1206,7 @@ void() WeaponCore_Melee =
// Do not trigger if we're Aiming down the Sight, or // Do not trigger if we're Aiming down the Sight, or
// already melee-ing, or doing some other action. // already melee-ing, or doing some other action.
if (self.knife_delay > time || self.new_anim_stop || if (self.knife_delay > time || self.new_anim_stop ||
self.new_anim2_stop || self.zoom || game_over) self.new_anim2_stop || self.zoom || in_endgame_sequence)
return; return;
// Perform the third person animation if standing // Perform the third person animation if standing
@ -1446,7 +1438,7 @@ void() W_ThrowGrenade =
modelname = GetWeaponModel(self.weapon, 0); modelname = GetWeaponModel(self.weapon, 0);
Set_W_Frame (startframe, endframe, 0, 0, 0, ReturnWeaponModel, modelname, false, S_BOTH, false); Set_W_Frame (startframe, endframe, 0, 0, 0, ReturnWeaponModel, modelname, false, S_BOTH, false);
SetUpdate(self, UT_HUD, 6, 0, 0); SetUpdate(self, UT_HUD, 7, 0, 0);
} }
void() checkHold = void() checkHold =

View file

@ -320,7 +320,7 @@ float map_compatibility_mode;
.float revives; .float revives;
.float points; .float points;
float game_over; float in_endgame_sequence;
#ifdef FTE #ifdef FTE
.float is_in_menu; .float is_in_menu;