From 7fe25a7ffbd8d2d73485936f7466d7d530b43673 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 12 Nov 2022 19:22:14 +0000 Subject: [PATCH] Correct aspect ratio on scope / binoculars overlay --- .../jni/OpenJK/codeJK2/cgame/cg_draw.cpp | 25 ++++++++++++++++++- .../jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp index 5f901c4..f33ada1 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp @@ -2512,6 +2512,24 @@ static qboolean CG_RenderingFromMiscCamera() return qfalse; } + +/* +------------------------- +CG_DrawZoomBorders +------------------------- +*/ + +static void CG_DrawZoomBorders( void ) +{ + vec4_t modulate; + modulate[0] = modulate[1] = modulate[2] = 0.0f; + modulate[3] = 1.0f; + + int bar_height = 80; + CG_FillRect( 0, 0, 640, bar_height, modulate ); + CG_FillRect( 0, 480 - 80, 640, bar_height, modulate ); +} + /* ================= CG_Draw2D @@ -2555,6 +2573,11 @@ static void CG_Draw2D( void ) CGCam_DrawWideScreen(); } + if (cg.zoomMode) + { + CG_DrawZoomBorders(); + } + cg.drawingHUD = CG_HUD_SCALED; CG_DrawBatteryCharge(); @@ -2831,7 +2854,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) { // offset vieworg appropriately if we're doing stereo separation VectorCopy( cg.refdef.vieworg, baseOrg ); - if ( separation != 0 && (!in_camera || vr->immersive_cinematics) && !in_misccamera) { + if ( separation != 0 && (!in_camera || vr->immersive_cinematics) && !in_misccamera && cg.zoomMode != 2 ) { VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg ); } diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp index bea1c32..56d3d05 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp @@ -30,7 +30,7 @@ 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 screenYScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? 2.5f : 1.25f); float xoffset = cg.drawingHUD == CG_HUD_SCALED ? -20 : 0; if (cg.refdef.stereoView == STEREO_LEFT) {