Configurable HUD scaling menu options

This commit is contained in:
Simon 2023-01-31 21:45:13 +00:00
parent d2b1beab32
commit 89fb6f6887
10 changed files with 264 additions and 9 deletions

View file

@ -30,10 +30,10 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
if (cg.drawingHUD && !vr->cin_camera && !vr->using_screen_layer)
{
float screenXScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? 2.5f : 1.0f);
float screenYScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? 2.5f : 1.0f);
float screenXScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? cg_hudScale.value : 1.0f);
float screenYScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? cg_hudScale.value : 1.25f);
float xoffset = cg.drawingHUD == CG_HUD_SCALED ? -20 : 0;
float xoffset = cg.drawingHUD == CG_HUD_SCALED ? -cg_hudStereo.value : 0;
if (cg.stereoView == STEREO_LEFT) {
xoffset *= -1;
}
@ -48,9 +48,10 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
}
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
*y += (480 - (480 * screenYScale)) / 2.0f;
*y += (480 - (480 * screenYScale)) / 2.0f - cg_hudYOffset.value;
}
}
void CG_AdjustFrom640Int( int *x, int *y, int *w, int *h ) {
float fx = (float)*x;
float fy = (float)*y;

View file

@ -644,6 +644,10 @@ extern vmCvar_t cg_developer;
extern vmCvar_t cg_timescale;
extern vmCvar_t cg_skippingcin;
extern vmCvar_t cg_hudScale;
extern vmCvar_t cg_hudStereo;
extern vmCvar_t cg_hudYOffset;
extern vmCvar_t cg_pano;
extern vmCvar_t cg_panoNumShots;

View file

@ -320,6 +320,11 @@ vmCvar_t cg_developer;
vmCvar_t cg_timescale;
vmCvar_t cg_skippingcin;
vmCvar_t cg_hudScale;
vmCvar_t cg_hudStereo;
vmCvar_t cg_hudYOffset;
vmCvar_t cg_pano;
vmCvar_t cg_panoNumShots;
@ -392,6 +397,10 @@ static cvarTable_t cvarTable[] = {
{ &cg_footsteps, "cg_footsteps", "3", CVAR_ARCHIVE },//1 = sounds, 2 = sounds & effects, 3 = sounds, effects & marks, 4 = always
{ &cg_saberEntMarks, "cg_saberEntMarks", "1", CVAR_ARCHIVE },
{ &cg_hudScale, "cg_hudScale", "2.5", CVAR_ARCHIVE },
{ &cg_hudStereo, "cg_hudStereo", "20", CVAR_ARCHIVE },
{ &cg_hudYOffset, "cg_hudYOffset", "0.0", CVAR_ARCHIVE },
{ &cg_draw2D, "cg_draw2D", "1", CVAR_ARCHIVE },
{ &cg_drawStatus, "cg_drawStatus", "1", CVAR_ARCHIVE },
{ &cg_drawHUD, "cg_drawHUD", "1", 0 },

View file

@ -29,10 +29,10 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
if (cg.drawingHUD && !vr->cin_camera && !vr->using_screen_layer)
{
float screenXScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? 2.5f : 1.0f);
float screenYScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? 2.5f : 1.25f);
float screenXScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? cg_hudScale.value : 1.0f);
float screenYScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? cg_hudScale.value : 1.25f);
float xoffset = cg.drawingHUD == CG_HUD_SCALED ? -20 : 0;
float xoffset = cg.drawingHUD == CG_HUD_SCALED ? -cg_hudStereo.value : 0;
if (cg.stereoView == STEREO_LEFT) {
xoffset *= -1;
}
@ -47,7 +47,7 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
}
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
*y += (480 - (480 * screenYScale)) / 2.0f;
*y += (480 - (480 * screenYScale)) / 2.0f - cg_hudYOffset.value;
}
}

View file

@ -640,6 +640,10 @@ extern vmCvar_t cg_developer;
extern vmCvar_t cg_timescale;
extern vmCvar_t cg_skippingcin;
extern vmCvar_t cg_hudScale;
extern vmCvar_t cg_hudStereo;
extern vmCvar_t cg_hudYOffset;
extern vmCvar_t cg_pano;
extern vmCvar_t cg_panoNumShots;

View file

@ -315,6 +315,11 @@ vmCvar_t cg_developer;
vmCvar_t cg_timescale;
vmCvar_t cg_skippingcin;
vmCvar_t cg_hudScale;
vmCvar_t cg_hudStereo;
vmCvar_t cg_hudYOffset;
vmCvar_t cg_pano;
vmCvar_t cg_panoNumShots;
@ -381,6 +386,10 @@ static cvarTable_t cvarTable[] = {
{ &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE },
{ &cg_shadows, "cg_shadows", "3", CVAR_ARCHIVE },
{ &cg_hudScale, "cg_hudScale", "2.5", CVAR_ARCHIVE },
{ &cg_hudStereo, "cg_hudStereo", "20", CVAR_ARCHIVE },
{ &cg_hudYOffset, "cg_hudYOffset", "0.0", CVAR_ARCHIVE },
{ &cg_draw2D, "cg_draw2D", "1", CVAR_ARCHIVE },
{ &cg_drawStatus, "cg_drawStatus", "1", CVAR_ARCHIVE },
{ &cg_drawHUD, "cg_drawHUD", "1", 0 },

Binary file not shown.

View file

@ -3,7 +3,7 @@ CONFIG W:\bin\striped.cfg
ID 100
REFERENCE MENUS_VR
DESCRIPTION "VR Menu Localizations"
COUNT 136
COUNT 142
INDEX 0
{
REFERENCE COMMON_CONTROLS_ITEM
@ -684,3 +684,33 @@ INDEX 135
REFERENCE DIRECTORS_CUT_DESC
TEXT_LANGUAGE1 "Various tweaks for better balance of VR gameplay."
}
INDEX 136
{
REFERENCE HUD_SCALE_ITEM
TEXT_LANGUAGE1 "VR HUD Scale:"
}
INDEX 137
{
REFERENCE HUD_SCALE_DESC
TEXT_LANGUAGE1 "Scale of the HUD in VR."
}
INDEX 138
{
REFERENCE HUD_STEREO_ITEM
TEXT_LANGUAGE1 "VR HUD Stereo:"
}
INDEX 139
{
REFERENCE HUD_STEREO_DESC
TEXT_LANGUAGE1 "Stereo depth of the HUD in VR."
}
INDEX 140
{
REFERENCE HUD_YOFFSET_ITEM
TEXT_LANGUAGE1 "VR HUD Y-Offset:"
}
INDEX 141
{
REFERENCE HUD_YOFFSET_DESC
TEXT_LANGUAGE1 "Y-Offset of the HUD in VR."
}

View file

@ -1984,5 +1984,104 @@
}
}
itemDef
{
name none
group comfortcontrols
type ITEM_TYPE_SLIDER
text @MENUS_VR_HUD_SCALE_ITEM
cvarfloat "cg_hudScale" 0.1 1.0 5.0
rect 305 291 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
textaligny -2
font 2
textscale 0.8
forecolor 1 1 1 1
visible 0
// appearance_slot 1
descText @MENUS_VR_HUD_SCALE_DESC
action
{
play sound/interface/button1
}
mouseenter
{
show highlight7
}
mouseexit
{
hide highlight7
}
}
itemDef
{
name none
group comfortcontrols
type ITEM_TYPE_SLIDER
text @MENUS_VR_HUD_STEREO_ITEM
cvarfloat "cg_hudStereo" 1 1 30
rect 305 311 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
textaligny -2
font 2
textscale 0.8
forecolor 1 1 1 1
visible 0
// appearance_slot 1
descText @MENUS_VR_HUD_STEREO_DESC
action
{
play sound/interface/button1
}
mouseenter
{
show highlight8
}
mouseexit
{
hide highlight8
}
}
itemDef
{
name none
group comfortcontrols
type ITEM_TYPE_SLIDER
text @MENUS_VR_HUD_YOFFSET_ITEM
cvarfloat "cg_hudYOffset" 1 -50 120
rect 305 331 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
textaligny -2
font 2
textscale 0.8
forecolor 1 1 1 1
visible 0
// appearance_slot 1
descText @MENUS_VR_HUD_YOFFSET_DESC
action
{
play sound/interface/button1
}
mouseenter
{
show highlight8
}
mouseexit
{
hide highlight8
}
}
}
}

View file

@ -1983,5 +1983,104 @@
}
}
itemDef
{
name none
group comfortcontrols
type ITEM_TYPE_SLIDER
text @MENUS_VR_HUD_SCALE_ITEM
cvarfloat "cg_hudScale" 0.1 1.0 5.0
rect 305 291 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
textaligny -2
font 2
textscale 0.8
forecolor 1 1 1 1
visible 0
// appearance_slot 1
descText @MENUS_VR_HUD_SCALE_DESC
action
{
play sound/interface/button1
}
mouseenter
{
show highlight7
}
mouseexit
{
hide highlight7
}
}
itemDef
{
name none
group comfortcontrols
type ITEM_TYPE_SLIDER
text @MENUS_VR_HUD_STEREO_ITEM
cvarfloat "cg_hudStereo" 1 1 30
rect 305 311 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
textaligny -2
font 2
textscale 0.8
forecolor 1 1 1 1
visible 0
// appearance_slot 1
descText @MENUS_VR_HUD_STEREO_DESC
action
{
play sound/interface/button1
}
mouseenter
{
show highlight8
}
mouseexit
{
hide highlight8
}
}
itemDef
{
name none
group comfortcontrols
type ITEM_TYPE_SLIDER
text @MENUS_VR_HUD_YOFFSET_ITEM
cvarfloat "cg_hudYOffset" 1 -50 120
rect 305 331 300 20
textalign ITEM_ALIGN_RIGHT
textalignx 151
textaligny -2
font 2
textscale 0.8
forecolor 1 1 1 1
visible 0
// appearance_slot 1
descText @MENUS_VR_HUD_YOFFSET_DESC
action
{
play sound/interface/button1
}
mouseenter
{
show highlight8
}
mouseexit
{
hide highlight8
}
}
}
}