From 3f7562eeecab9881e57378116ffb12344a89e943 Mon Sep 17 00:00:00 2001 From: P3rlE <97919909+P3rlE@users.noreply.github.com> Date: Sun, 6 Mar 2022 14:36:31 +0100 Subject: [PATCH] enabled aspect correct HUD by default --- engine/code/cgame/cg_local.h | 4 ++ engine/code/cgame/cg_main.c | 5 ++- engine/code/qcommon/q_shared.h | 2 +- engine/code/ui/ui_main.c | 3 ++ engine/code/ui/ui_shared.c | 12 +----- engine/code/ui/ui_shared.h | 22 ++++++++++- q3rallycode.ppr | 70 ++++++++++++++++++++-------------- 7 files changed, 75 insertions(+), 43 deletions(-) diff --git a/engine/code/cgame/cg_local.h b/engine/code/cgame/cg_local.h index 99b582a9..9fb3e8fb 100644 --- a/engine/code/cgame/cg_local.h +++ b/engine/code/cgame/cg_local.h @@ -1496,6 +1496,9 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo // // cg_drawtools.c // +// ugly workaround for having it in cg_local.h and ui_shared.h +#ifndef HAVE_SCREEN_PLACEMENT +#define HAVE_SCREEN_PLACEMENT typedef enum { PLACE_STRETCH, PLACE_CENTER, @@ -1508,6 +1511,7 @@ typedef enum { PLACE_TOP, PLACE_BOTTOM } screenPlacement_e; +#endif void CG_SetScreenPlacement(screenPlacement_e hpos, screenPlacement_e vpos); void CG_PopScreenPlacement(void); diff --git a/engine/code/cgame/cg_main.c b/engine/code/cgame/cg_main.c index bf2f48c3..5f7e7023 100644 --- a/engine/code/cgame/cg_main.c +++ b/engine/code/cgame/cg_main.c @@ -314,7 +314,7 @@ static cvarTable_t cvarTable[] = { { &cg_statusScale, "cg_statusScale", "1", CVAR_ARCHIVE }, { &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE }, { &cg_fovGunAdjust, "cg_fovGunAdjust", "0", CVAR_ARCHIVE }, - { &cg_stretch, "cg_stretch", "1", CVAR_ARCHIVE }, + { &cg_stretch, "cg_stretch", "0", CVAR_ARCHIVE }, { &cg_crosshairSize, "cg_crosshairSize", "24", CVAR_ARCHIVE }, { &cg_crosshairHealth, "cg_crosshairHealth", "1", CVAR_ARCHIVE }, { &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE }, @@ -2111,6 +2111,9 @@ void CG_LoadHudMenu( void ) { cgDC.stopCinematic = &CG_StopCinematic; cgDC.drawCinematic = &CG_DrawCinematic; cgDC.runCinematicFrame = &CG_RunCinematicFrame; + cgDC.adjustFrom640 = &CG_AdjustFrom640; + cgDC.setScreenPlacement = &CG_SetScreenPlacement; + cgDC.popScreenPlacement = &CG_PopScreenPlacement; Init_Display(&cgDC); diff --git a/engine/code/qcommon/q_shared.h b/engine/code/qcommon/q_shared.h index 0a6aa9a3..24915425 100644 --- a/engine/code/qcommon/q_shared.h +++ b/engine/code/qcommon/q_shared.h @@ -67,7 +67,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define BASETA "missionpack" #ifndef PRODUCT_VERSION -#define PRODUCT_VERSION "v0.4_r502" +#define PRODUCT_VERSION "v0.4_r507" #endif diff --git a/engine/code/ui/ui_main.c b/engine/code/ui/ui_main.c index d5485dcb..60d283fb 100644 --- a/engine/code/ui/ui_main.c +++ b/engine/code/ui/ui_main.c @@ -5149,6 +5149,9 @@ void _UI_Init( qboolean inGameLoad ) { uiInfo.uiDC.stopCinematic = &UI_StopCinematic; uiInfo.uiDC.drawCinematic = &UI_DrawCinematic; uiInfo.uiDC.runCinematicFrame = &UI_RunCinematicFrame; + uiInfo.uiDC.adjustFrom640 = &UI_AdjustFrom640; + uiInfo.uiDC.setScreenPlacement = NULL; + uiInfo.uiDC.popScreenPlacement = NULL; Init_Display(&uiInfo.uiDC); diff --git a/engine/code/ui/ui_shared.c b/engine/code/ui/ui_shared.c index 74bc77eb..8e15ca85 100644 --- a/engine/code/ui/ui_shared.c +++ b/engine/code/ui/ui_shared.c @@ -3638,16 +3638,6 @@ qboolean Item_Bind_HandleKey(itemDef_t *item, int key, qboolean down) { return qtrue; } - - -void AdjustFrom640(float *x, float *y, float *w, float *h) { - //*x = *x * DC->scale + DC->bias; - *x *= DC->xscale; - *y *= DC->yscale; - *w *= DC->xscale; - *h *= DC->yscale; -} - void Item_Model_Paint(itemDef_t *item) { float x, y, w, h; refdef_t refdef; @@ -3669,7 +3659,7 @@ void Item_Model_Paint(itemDef_t *item) { w = item->window.rect.w-2; h = item->window.rect.h-2; - AdjustFrom640( &x, &y, &w, &h ); + DC->adjustFrom640( &x, &y, &w, &h ); refdef.x = x; refdef.y = y; diff --git a/engine/code/ui/ui_shared.h b/engine/code/ui/ui_shared.h index e70c716f..8ea3e5e1 100644 --- a/engine/code/ui/ui_shared.h +++ b/engine/code/ui/ui_shared.h @@ -105,6 +105,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define SLIDER_THUMB_HEIGHT 20.0 #define NUM_CROSSHAIRS 10 +// ugly workaround for having it in cg_local.h and ui_shared.h +#ifndef HAVE_SCREEN_PLACEMENT +#define HAVE_SCREEN_PLACEMENT +typedef enum { + PLACE_STRETCH, + PLACE_CENTER, + + // horizontal only + PLACE_LEFT, + PLACE_RIGHT, + + // vertical only + PLACE_TOP, + PLACE_BOTTOM +} screenPlacement_e; +#endif + typedef struct { const char *command; const char *args[MAX_SCRIPT_ARGS]; @@ -366,7 +383,10 @@ typedef struct { void (*stopCinematic)(int handle); void (*drawCinematic)(int handle, float x, float y, float w, float h); void (*runCinematicFrame)(int handle); - + void (*adjustFrom640)( float *x, float *y, float *w, float *h ); + void (*setScreenPlacement)( screenPlacement_e hpos, screenPlacement_e vpos ); + void (*popScreenPlacement)( void ); + float yscale; float xscale; float bias; diff --git a/q3rallycode.ppr b/q3rallycode.ppr index 1c78e892..27b7d6b2 100644 --- a/q3rallycode.ppr +++ b/q3rallycode.ppr @@ -745,7 +745,7 @@ q3rallycode engine\code\tools\lcc\LOG engine\code\tools\lcc\README engine\code\tools\lcc\README.id - -ui + +ui engine\code\ui\ui_atoms.c engine\code\ui\ui_gameinfo.c engine\code\ui\ui_local.h @@ -887,30 +887,30 @@ q3rallycode engine\resync_svn.sh engine\cross-make-mingw64.sh [Open project files] -0=engine\code\qcommon\q_shared.h -1=engine\code\client\cl_main.c -2=engine\code\q3_ui\ui_video.c -3=engine\code\qcommon\q_shared.c -4=engine\code\renderercommon\tr_common.h -5=engine\code\renderergl1\tr_backend.c -6=engine\code\renderergl1\tr_image.c -7=engine\code\renderergl1\tr_init.c -8=engine\code\renderergl1\tr_local.h -9=engine\code\renderergl1\tr_model_iqm.c -10=engine\code\cgame\cg_draw.c -11=engine\code\cgame\cg_info.c -12=engine\code\cgame\cg_local.h -13=engine\code\cgame\cg_main.c -14=engine\code\cgame\cg_scoreboard.c -15=engine\code\cgame\cg_view.c -16=engine\code\cgame\cg_weapons.c -17=engine\code\cgame\cg_drawtools.c +0=engine\code\client\cl_main.c +1=engine\code\q3_ui\ui_video.c +2=engine\code\qcommon\q_shared.c +3=engine\code\renderercommon\tr_common.h +4=engine\code\renderergl1\tr_backend.c +5=engine\code\renderergl1\tr_image.c +6=engine\code\renderergl1\tr_init.c +7=engine\code\renderergl1\tr_local.h +8=engine\code\renderergl1\tr_model_iqm.c +9=engine\code\cgame\cg_draw.c +10=engine\code\cgame\cg_info.c +11=engine\code\cgame\cg_scoreboard.c +12=engine\code\cgame\cg_view.c +13=engine\code\qcommon\q_shared.h +14=engine\code\cgame\cg_weapons.c +15=engine\code\cgame\cg_drawtools.c +16=engine\code\cgame\cg_local.h +17=engine\code\ui\ui_main.c +18=engine\code\ui\ui_shared.c +19=engine\code\cgame\cg_main.c +20=engine\code\ui\ui_shared.h [Selected Project Files] Main= -Selected=engine\code\cgame\cg_drawtools.c -[engine\code\qcommon\q_shared.h] -TopLine=610 -Caret=23,638 +Selected=engine\code\cgame\cg_main.c [engine\code\client\cl_main.c] TopLine=3069 Caret=3,3108 @@ -944,21 +944,33 @@ Caret=13,3131 [engine\code\cgame\cg_info.c] TopLine=143 Caret=102,176 -[engine\code\cgame\cg_local.h] -TopLine=1479 -Caret=55,1515 -[engine\code\cgame\cg_main.c] -TopLine=2203 -Caret=1,2222 [engine\code\cgame\cg_scoreboard.c] TopLine=615 Caret=5,639 [engine\code\cgame\cg_view.c] TopLine=522 Caret=3,552 +[engine\code\qcommon\q_shared.h] +TopLine=49 +Caret=35,70 [engine\code\cgame\cg_weapons.c] TopLine=1607 Caret=110,1632 [engine\code\cgame\cg_drawtools.c] TopLine=95 Caret=1,129 +[engine\code\cgame\cg_local.h] +TopLine=1479 +Caret=30,1501 +[engine\code\ui\ui_main.c] +TopLine=5130 +Caret=40,5154 +[engine\code\ui\ui_shared.c] +TopLine=322 +Caret=41,343 +[engine\code\cgame\cg_main.c] +TopLine=295 +Caret=33,317 +[engine\code\ui\ui_shared.h] +TopLine=364 +Caret=5,389