From 6de1c350d10717c49f9ac982b3989b1e29408602 Mon Sep 17 00:00:00 2001 From: Izuru Yakumo Date: Sat, 26 Jul 2025 22:59:27 -0300 Subject: [PATCH] Some more 'borrowed' code --- code/cgame/cg_draw.c | 15 +++++++-------- code/q3_ui/ui_controls2.c | 26 ++++++++++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index dccfe5e..abbd613 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -3001,15 +3001,14 @@ static qboolean CG_DrawFollow( void ) { color[2] = 1; color[3] = 1; - - CG_DrawBigString( 320 - 9 * 8, 24, "following", 1.0F ); - + // I like how Bishop-333 does it + // (no, it's not anything sexual) + // ~Y.A.K.U.M.O. name = cgs.clientinfo[ cg.snap->ps.clientNum ].name; - - x = 0.5 * ( 640 - GIANT_WIDTH * CG_DrawStrlen( name ) ); - - CG_DrawStringExt( x, 40, name, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); - + x = 0.5 * ( 640 - SMALLCHAR_WIDTH * CG_DrawStrlen( name ) ) - SMALLCHAR_WIDTH * 3; + CG_DrawStringExt( x, 40, name, color, qtrue, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 ); + CG_DrawSmallString( x + SMALLCHAR_WIDTH * CG_DrawStrlen( name ), 40, "'s view", 1.0F); + return qtrue; } diff --git a/code/q3_ui/ui_controls2.c b/code/q3_ui/ui_controls2.c index 5abd39a..20c577e 100644 --- a/code/q3_ui/ui_controls2.c +++ b/code/q3_ui/ui_controls2.c @@ -127,7 +127,7 @@ typedef struct #define ID_JOYTHRESHOLD 45 #define ID_SMOOTHMOUSE 46 #define ID_VOIP_TEAMONLY 47 - +#define ID_FOV 48 #define ANIM_IDLE 0 @@ -214,6 +214,7 @@ typedef struct menuradiobutton_s invertmouse; menuslider_s sensitivity; menuradiobutton_s smoothmouse; + menuslider_s fov; menuradiobutton_s alwaysrun; menuaction_s showscores; menulist_s autoswitch; @@ -253,11 +254,7 @@ static const char *autoswitch_items[] = { NULL }; -// OLD -//static vec4_t controls_binding_color = {1.00f, 0.43f, 0.00f, 1.00f}; // bk: Win32 C4305 - -// New! -static vec4_t controls_binding_color = {0.58f, 0.70f, 0.81f, 1.00f}; +static vec4_t controls_binding_color = {1.00f, 0.43f, 0.00f, 1.00f}; // bk: Win32 C4305 static bind_t g_bindings[] = { @@ -309,6 +306,7 @@ static configcvar_t g_configcvars[] = {"m_pitch", 0, 0}, {"cg_autoswitch", 0, 0}, {"sensitivity", 0, 0}, + {"cg_fov", 0, 0}, {"in_joystick", 0, 0}, {"joy_threshold", 0, 0}, {"m_filter", 0, 0}, @@ -358,6 +356,7 @@ static menucommon_s *g_looking_controls[] = { (menucommon_s *)&s_controls.sensitivity, (menucommon_s *)&s_controls.smoothmouse, (menucommon_s *)&s_controls.invertmouse, + (menucommon_s *)&s_controls.fov, (menucommon_s *)&s_controls.lookup, (menucommon_s *)&s_controls.lookdown, (menucommon_s *)&s_controls.mouselook, @@ -869,6 +868,7 @@ static void Controls_GetConfig( void ) s_controls.alwaysrun.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_run" ) ); s_controls.autoswitch.curvalue = UI_ClampCvar( 0, 4, Controls_GetCvarValue( "cg_autoswitch" ) ); s_controls.sensitivity.curvalue = UI_ClampCvar( 2, 30, Controls_GetCvarValue( "sensitivity" ) ); + s_controls.fov.curvalue = UI_ClampCvar( 90, 130, Controls_GetCvarValue( "cg_fov" ) ); s_controls.joyenable.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "in_joystick" ) ); s_controls.joythreshold.curvalue = UI_ClampCvar( 0.05f, 0.75f, Controls_GetCvarValue( "joy_threshold" ) ); s_controls.freelook.curvalue = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_freelook" ) ); @@ -912,6 +912,7 @@ static void Controls_SetConfig( void ) trap_Cvar_SetValue( "cl_run", s_controls.alwaysrun.curvalue ); trap_Cvar_SetValue( "cg_autoswitch", s_controls.autoswitch.curvalue ); trap_Cvar_SetValue( "sensitivity", s_controls.sensitivity.curvalue ); + trap_Cvar_SetValue( "cg_fov", s_controls.fov.curvalue ); trap_Cvar_SetValue( "in_joystick", s_controls.joyenable.curvalue ); trap_Cvar_SetValue( "joy_threshold", s_controls.joythreshold.curvalue ); trap_Cvar_SetValue( "cl_freelook", s_controls.freelook.curvalue ); @@ -947,6 +948,7 @@ static void Controls_SetDefaults( void ) s_controls.alwaysrun.curvalue = Controls_GetCvarDefault( "cl_run" ); s_controls.autoswitch.curvalue = Controls_GetCvarDefault( "cg_autoswitch" ); s_controls.sensitivity.curvalue = Controls_GetCvarDefault( "sensitivity" ); + s_controls.fov.curvalue = Controls_GetCvarDefault( "cg_fov" ); s_controls.joyenable.curvalue = Controls_GetCvarDefault( "in_joystick" ); s_controls.joythreshold.curvalue = Controls_GetCvarDefault( "joy_threshold" ); s_controls.freelook.curvalue = Controls_GetCvarDefault( "cl_freelook" ); @@ -1177,6 +1179,7 @@ static void Controls_MenuEvent( void* ptr, int event ) case ID_MOUSESPEED: case ID_INVERTMOUSE: case ID_SMOOTHMOUSE: + case ID_FOV: case ID_ALWAYSRUN: case ID_AUTOSWITCH: case ID_VOIP_TEAMONLY: @@ -1592,6 +1595,16 @@ static void Controls_MenuInit( void ) s_controls.sensitivity.maxvalue = 30; s_controls.sensitivity.generic.statusbar = Controls_StatusBar; + s_controls.fov.generic.type = MTYPE_SLIDER; + s_controls.fov.generic.x = SCREEN_WIDTH/2; + s_controls.fov.generic.flags = QMF_SMALLFONT; + s_controls.fov.generic.name = "field of view"; + s_controls.fov.generic.id = ID_FOV; + s_controls.fov.generic.callback = Controls_MenuEvent; + s_controls.fov.minvalue = 90; + s_controls.fov.maxvalue = 130; + s_controls.fov.generic.statusbar = Controls_StatusBar; + s_controls.gesture.generic.type = MTYPE_ACTION; s_controls.gesture.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS|QMF_GRAYED|QMF_HIDDEN; s_controls.gesture.generic.callback = Controls_ActionEvent; @@ -1676,6 +1689,7 @@ static void Controls_MenuInit( void ) Menu_AddItem( &s_controls.menu, &s_controls.sensitivity ); Menu_AddItem( &s_controls.menu, &s_controls.smoothmouse ); Menu_AddItem( &s_controls.menu, &s_controls.invertmouse ); + Menu_AddItem( &s_controls.menu, &s_controls.fov ); Menu_AddItem( &s_controls.menu, &s_controls.lookup ); Menu_AddItem( &s_controls.menu, &s_controls.lookdown ); Menu_AddItem( &s_controls.menu, &s_controls.mouselook );