Skip to content

Commit

Permalink
CUI: Team Overlay and Death Messages moved to HUD and (Team) Beep Cha…
Browse files Browse the repository at this point in the history
…t to Sound. (#251)
  • Loading branch information
NeonKnightOA authored Mar 21, 2024
1 parent 8489c33 commit 3da1793
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 78 deletions.
58 changes: 56 additions & 2 deletions code/q3_ui/ui_hud.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ GAME OPTIONS MENU
#define ID_ALWAYSWEAPONBAR 133
#define ID_WEAPONBARSTYLE 134
#define ID_IDENTIFYTARGET 135
#define ID_DRAWFPS 136

#define ID_DRAWTEAMOVERLAY 136
#define ID_OBITUARYOUTPUT 137
#define ID_DRAWFPS 138

typedef struct {
menuframework_s menu;
Expand All @@ -69,6 +70,8 @@ typedef struct {
menuradiobutton_s alwaysWeaponBar;
menulist_s weaponBarStyle;
menuradiobutton_s identifyTarget;
menulist_s drawTeamOverlay;
menulist_s obituaryOutput;

menuradiobutton_s drawFPS;

Expand All @@ -92,6 +95,25 @@ static const char *weaponBarStyle_names[] =
NULL
};

static const char *teamOverlay_names[] =
{
"off",
"upper right",
"lower right",
"lower left",
NULL
};

static const char *obituaryOutput_names[] =
{
"Disabled",
"Only Console Text",
"Only HUD Text",
"Only HUD Icon",
"HUD Icon + Console",
NULL
};

static void HUDOptions_SetMenuItems( void ) {
hudOptions_s.crosshair.curvalue = (int)trap_Cvar_VariableValue( "cg_drawCrosshair" ) % NUM_CROSSHAIRS;
hudOptions_s.crosshairHealth.curvalue = trap_Cvar_VariableValue( "cg_crosshairHealth") != 0;
Expand All @@ -102,6 +124,8 @@ static void HUDOptions_SetMenuItems( void ) {
hudOptions_s.weaponBarStyle.curvalue = trap_Cvar_VariableValue( "cg_weaponBarStyle" ) != 0;
hudOptions_s.identifyTarget.curvalue = trap_Cvar_VariableValue( "cg_drawCrosshairNames" ) != 0;
hudOptions_s.drawFPS.curvalue = trap_Cvar_VariableValue( "cg_drawfps") != 0;
hudOptions_s.drawTeamOverlay.curvalue = Com_Clamp( 0, 3, trap_Cvar_VariableValue( "cg_drawTeamOverlay" ) );
hudOptions_s.obituaryOutput.curvalue = trap_Cvar_VariableValue( "cg_obituaryOutput" ) != 0;
}

static void HUDOptions_Event( void* ptr, int notification ) {
Expand Down Expand Up @@ -157,6 +181,14 @@ static void HUDOptions_Event( void* ptr, int notification ) {
trap_Cvar_SetValue( "cg_drawCrosshairNames", hudOptions_s.identifyTarget.curvalue );
break;

case ID_DRAWTEAMOVERLAY:
trap_Cvar_SetValue( "cg_drawTeamOverlay", hudOptions_s.drawTeamOverlay.curvalue );
break;

case ID_OBITUARYOUTPUT:
trap_Cvar_SetValue( "cg_obituaryOutput", hudOptions_s.obituaryOutput.curvalue );
break;

case ID_DRAWFPS:
trap_Cvar_SetValue( "cg_drawFPS", hudOptions_s.drawFPS.curvalue );
break;
Expand Down Expand Up @@ -351,6 +383,26 @@ static void HUDOptions_MenuInit( void ) {
hudOptions_s.identifyTarget.generic.x = HUDOPTIONS_X_POS;
hudOptions_s.identifyTarget.generic.y = y;

y += BIGCHAR_HEIGHT+2;
hudOptions_s.drawTeamOverlay.generic.type = MTYPE_SPINCONTROL;
hudOptions_s.drawTeamOverlay.generic.name = "Draw Team Overlay:";
hudOptions_s.drawTeamOverlay.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
hudOptions_s.drawTeamOverlay.generic.callback = HUDOptions_Event;
hudOptions_s.drawTeamOverlay.generic.id = ID_DRAWTEAMOVERLAY;
hudOptions_s.drawTeamOverlay.generic.x = HUDOPTIONS_X_POS;
hudOptions_s.drawTeamOverlay.generic.y = y;
hudOptions_s.drawTeamOverlay.itemnames = teamOverlay_names;

y += BIGCHAR_HEIGHT+2;
hudOptions_s.obituaryOutput.generic.type = MTYPE_SPINCONTROL;
hudOptions_s.obituaryOutput.generic.name = "Death Messages:";
hudOptions_s.obituaryOutput.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
hudOptions_s.obituaryOutput.generic.callback = HUDOptions_Event;
hudOptions_s.obituaryOutput.generic.id = ID_OBITUARYOUTPUT;
hudOptions_s.obituaryOutput.generic.x = HUDOPTIONS_X_POS;
hudOptions_s.obituaryOutput.generic.y = y;
hudOptions_s.obituaryOutput.itemnames = obituaryOutput_names;

y += BIGCHAR_HEIGHT+2;
hudOptions_s.drawFPS.generic.type = MTYPE_RADIOBUTTON;
hudOptions_s.drawFPS.generic.name = "Draw FPS:";
Expand Down Expand Up @@ -383,6 +435,8 @@ static void HUDOptions_MenuInit( void ) {
Menu_AddItem( &hudOptions_s.menu, &hudOptions_s.alwaysWeaponBar );
Menu_AddItem( &hudOptions_s.menu, &hudOptions_s.weaponBarStyle );
Menu_AddItem( &hudOptions_s.menu, &hudOptions_s.identifyTarget );
Menu_AddItem( &hudOptions_s.menu, &hudOptions_s.drawTeamOverlay );
Menu_AddItem( &hudOptions_s.menu, &hudOptions_s.obituaryOutput );
Menu_AddItem( &hudOptions_s.menu, &hudOptions_s.drawFPS );

Menu_AddItem( &hudOptions_s.menu, &hudOptions_s.back );
Expand Down
78 changes: 2 additions & 76 deletions code/q3_ui/ui_preferences.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@ GAME OPTIONS MENU
#define ID_WALLMARKS 131
#define ID_SYNCEVERYFRAME 132
#define ID_FORCEMODEL 133
#define ID_DRAWTEAMOVERLAY 134
#define ID_MUZZLEFLASHSTYLE 135
#define ID_OBITUARYOUTPUT 136
#define ID_BACK 137
#define ID_CHATBEEP 138
#define ID_TEAMCHATBEEP 139
#define ID_MUZZLEFLASHSTYLE 134
#define ID_BACK 135

#undef NUM_CROSSHAIRS
#define NUM_CROSSHAIRS 99
Expand All @@ -69,25 +65,12 @@ typedef struct {
menuradiobutton_s highqualitysky;
menuradiobutton_s synceveryframe;
menuradiobutton_s forcemodel;
menulist_s drawteamoverlay;
menulist_s muzzleFlashStyle;
menulist_s obituaryOutput;
menuradiobutton_s chatbeep;
menuradiobutton_s teamchatbeep;
menubitmap_s back;
} preferences_t;

static preferences_t s_preferences;

static const char *teamoverlay_names[] =
{
"off",
"upper right",
"lower right",
"lower left",
NULL
};

static const char *muzzleFlashStyle_names[] =
{
"Off",
Expand All @@ -100,28 +83,14 @@ static const char *muzzleFlashStyle_names[] =
NULL
};

static const char *obituaryOutput_names[] =
{
"Disabled",
"Only Console Text",
"Only HUD Text",
"Only HUD Icon",
"HUD Icon + Console",
NULL
};

static void Preferences_SetMenuItems( void ) {
s_preferences.simpleitems.curvalue = trap_Cvar_VariableValue( "cg_simpleItems" ) != 0;
s_preferences.brass.curvalue = trap_Cvar_VariableValue( "cg_brassTime" ) != 0;
s_preferences.wallmarks.curvalue = trap_Cvar_VariableValue( "cg_marks" ) != 0;
s_preferences.highqualitysky.curvalue = trap_Cvar_VariableValue ( "r_fastsky" ) == 0;
s_preferences.synceveryframe.curvalue = trap_Cvar_VariableValue( "r_finish" ) != 0;
s_preferences.forcemodel.curvalue = trap_Cvar_VariableValue( "cg_forcemodel" ) != 0;
s_preferences.drawteamoverlay.curvalue = Com_Clamp( 0, 3, trap_Cvar_VariableValue( "cg_drawTeamOverlay" ) );
s_preferences.muzzleFlashStyle.curvalue = trap_Cvar_VariableValue( "cg_muzzleFlashStyle" ) != 0;
s_preferences.obituaryOutput.curvalue = trap_Cvar_VariableValue( "cg_obituaryOutput" ) != 0;
s_preferences.chatbeep.curvalue = trap_Cvar_VariableValue( "cg_chatBeep" ) != 0;
s_preferences.teamchatbeep.curvalue = trap_Cvar_VariableValue( "cg_teamChatBeep" ) != 0;
}

static void Preferences_Event( void* ptr, int notification ) {
Expand Down Expand Up @@ -158,26 +127,10 @@ static void Preferences_Event( void* ptr, int notification ) {
trap_Cvar_SetValue( "cg_forcemodel", s_preferences.forcemodel.curvalue );
break;

case ID_DRAWTEAMOVERLAY:
trap_Cvar_SetValue( "cg_drawTeamOverlay", s_preferences.drawteamoverlay.curvalue );
break;

case ID_MUZZLEFLASHSTYLE:
trap_Cvar_SetValue( "cg_muzzleFlashStyle", s_preferences.muzzleFlashStyle.curvalue );
break;

case ID_OBITUARYOUTPUT:
trap_Cvar_SetValue( "cg_obituaryOutput", s_preferences.obituaryOutput.curvalue );
break;

case ID_CHATBEEP:
trap_Cvar_SetValue( "cg_chatBeep", s_preferences.chatbeep.curvalue );
break;

case ID_TEAMCHATBEEP:
trap_Cvar_SetValue( "cg_teamChatBeep", s_preferences.teamchatbeep.curvalue );
break;

case ID_BACK:
UI_PopMenu();
break;
Expand Down Expand Up @@ -237,16 +190,6 @@ static void Preferences_MenuInit( void ) {
Preferences_Menu_AddBoolean(&s_preferences.highqualitysky, &y, ID_HIGHQUALITYSKY, "High Quality Sky:");
Preferences_Menu_AddBoolean(&s_preferences.synceveryframe, &y, ID_SYNCEVERYFRAME, "Sync Every Frame:");
Preferences_Menu_AddBoolean(&s_preferences.forcemodel, &y, ID_FORCEMODEL, "Force Player Models:");

y += BIGCHAR_HEIGHT+2;
s_preferences.drawteamoverlay.generic.type = MTYPE_SPINCONTROL;
s_preferences.drawteamoverlay.generic.name = "Draw Team Overlay:";
s_preferences.drawteamoverlay.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_preferences.drawteamoverlay.generic.callback = Preferences_Event;
s_preferences.drawteamoverlay.generic.id = ID_DRAWTEAMOVERLAY;
s_preferences.drawteamoverlay.generic.x = PREFERENCES_X_POS;
s_preferences.drawteamoverlay.generic.y = y;
s_preferences.drawteamoverlay.itemnames = teamoverlay_names;

y += BIGCHAR_HEIGHT+2;
s_preferences.muzzleFlashStyle.generic.type = MTYPE_SPINCONTROL;
Expand All @@ -258,19 +201,6 @@ static void Preferences_MenuInit( void ) {
s_preferences.muzzleFlashStyle.generic.y = y;
s_preferences.muzzleFlashStyle.itemnames = muzzleFlashStyle_names;

y += BIGCHAR_HEIGHT+2;
s_preferences.obituaryOutput.generic.type = MTYPE_SPINCONTROL;
s_preferences.obituaryOutput.generic.name = "Death Messages:";
s_preferences.obituaryOutput.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_preferences.obituaryOutput.generic.callback = Preferences_Event;
s_preferences.obituaryOutput.generic.id = ID_OBITUARYOUTPUT;
s_preferences.obituaryOutput.generic.x = PREFERENCES_X_POS;
s_preferences.obituaryOutput.generic.y = y;
s_preferences.obituaryOutput.itemnames = obituaryOutput_names;

Preferences_Menu_AddBoolean(&s_preferences.chatbeep, &y, ID_CHATBEEP, "Beep on Chat:");
Preferences_Menu_AddBoolean(&s_preferences.teamchatbeep, &y, ID_TEAMCHATBEEP, "Beep on Team Chat:");

s_preferences.back.generic.type = MTYPE_BITMAP;
s_preferences.back.generic.name = ART_BACK0;
s_preferences.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
Expand All @@ -292,11 +222,7 @@ static void Preferences_MenuInit( void ) {
Menu_AddItem( &s_preferences.menu, &s_preferences.highqualitysky );
Menu_AddItem( &s_preferences.menu, &s_preferences.synceveryframe );
Menu_AddItem( &s_preferences.menu, &s_preferences.forcemodel );
Menu_AddItem( &s_preferences.menu, &s_preferences.drawteamoverlay );
Menu_AddItem( &s_preferences.menu, &s_preferences.muzzleFlashStyle );
Menu_AddItem( &s_preferences.menu, &s_preferences.obituaryOutput );
Menu_AddItem( &s_preferences.menu, &s_preferences.chatbeep );
Menu_AddItem( &s_preferences.menu, &s_preferences.teamchatbeep );

Menu_AddItem( &s_preferences.menu, &s_preferences.back );

Expand Down
34 changes: 34 additions & 0 deletions code/q3_ui/ui_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ SOUND OPTIONS MENU
//Sago: Here I do some stuff!
#define ID_OPENAL 18
#define ID_BACK 19
#define ID_CHATBEEP 20
#define ID_TEAMCHATBEEP 21


static const char *quality_items[] = {
Expand All @@ -72,6 +74,8 @@ typedef struct {
menulist_s quality;
// menuradiobutton_s a3d;
menuradiobutton_s openal;
menuradiobutton_s chatBeep;
menuradiobutton_s teamChatBeep;

menubitmap_s back;
} soundOptionsInfo_t;
Expand Down Expand Up @@ -155,6 +159,14 @@ static void UI_SoundOptionsMenu_Event( void* ptr, int event ) {
soundOptionsInfo.openal.curvalue = (int)trap_Cvar_VariableValue( "s_useopenal" );
break;

case ID_CHATBEEP:
trap_Cvar_SetValue( "cg_chatBeep", soundOptionsInfo.chatBeep.curvalue );
break;

case ID_TEAMCHATBEEP:
trap_Cvar_SetValue( "cg_teamChatBeep", soundOptionsInfo.teamChatBeep.curvalue );
break;

case ID_BACK:
UI_PopMenu();
break;
Expand Down Expand Up @@ -300,6 +312,24 @@ static void UI_SoundOptionsMenu_Init( void ) {
soundOptionsInfo.openal.generic.x = 400;
soundOptionsInfo.openal.generic.y = y;

y += BIGCHAR_HEIGHT+2;
soundOptionsInfo.chatBeep.generic.type = MTYPE_RADIOBUTTON;
soundOptionsInfo.chatBeep.generic.name = "Beep on Chat:";
soundOptionsInfo.chatBeep.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
soundOptionsInfo.chatBeep.generic.callback = UI_SoundOptionsMenu_Event;
soundOptionsInfo.chatBeep.generic.id = ID_CHATBEEP;
soundOptionsInfo.chatBeep.generic.x = 400;
soundOptionsInfo.chatBeep.generic.y = y;

y += BIGCHAR_HEIGHT+2;
soundOptionsInfo.teamChatBeep.generic.type = MTYPE_RADIOBUTTON;
soundOptionsInfo.teamChatBeep.generic.name = "Beep on Team Chat:";
soundOptionsInfo.teamChatBeep.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
soundOptionsInfo.teamChatBeep.generic.callback = UI_SoundOptionsMenu_Event;
soundOptionsInfo.teamChatBeep.generic.id = ID_TEAMCHATBEEP;
soundOptionsInfo.teamChatBeep.generic.x = 400;
soundOptionsInfo.teamChatBeep.generic.y = y;

soundOptionsInfo.back.generic.type = MTYPE_BITMAP;
soundOptionsInfo.back.generic.name = ART_BACK0;
soundOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
Expand All @@ -324,13 +354,17 @@ static void UI_SoundOptionsMenu_Init( void ) {
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.quality );
// Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.a3d );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.openal );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.chatBeep );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.teamChatBeep );
Menu_AddItem( &soundOptionsInfo.menu, ( void * ) &soundOptionsInfo.back );

soundOptionsInfo.sfxvolume.curvalue = trap_Cvar_VariableValue( "s_volume" ) * 10;
soundOptionsInfo.musicvolume.curvalue = trap_Cvar_VariableValue( "s_musicvolume" ) * 10;
soundOptionsInfo.quality.curvalue = !trap_Cvar_VariableValue( "s_compression" );
// soundOptionsInfo.a3d.curvalue = (int)trap_Cvar_VariableValue( "s_usingA3D" );
soundOptionsInfo.openal.curvalue = (int)trap_Cvar_VariableValue( "s_useopenal" );
soundOptionsInfo.chatBeep.curvalue = (int)trap_Cvar_VariableValue( "cg_chatBeep" );
soundOptionsInfo.teamChatBeep.curvalue = (int)trap_Cvar_VariableValue( "cg_teamChatBeep" );
}


Expand Down

0 comments on commit 3da1793

Please sign in to comment.