[iortcw] 453/497: All: Add aspect corrected binocs
Simon McVittie
smcv at debian.org
Fri Sep 8 10:37:50 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to annotated tag 1.42d
in repository iortcw.
commit becaaf53ebd733300b8c496046a7fe004749c9fc
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date: Thu Dec 3 13:53:26 2015 -0500
All: Add aspect corrected binocs
---
MP/code/cgame/cg_draw.c | 30 ++++++++++++++++++++++--------
SP/code/cgame/cg_draw.c | 31 +++++++++++++++++++++++--------
2 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/MP/code/cgame/cg_draw.c b/MP/code/cgame/cg_draw.c
index 8a84319..49023c4 100644
--- a/MP/code/cgame/cg_draw.c
+++ b/MP/code/cgame/cg_draw.c
@@ -1659,8 +1659,29 @@ CG_DrawBinocReticle
==============
*/
static void CG_DrawBinocReticle( void ) {
+ vec4_t color = {0, 0, 0, 1};
+ float mask = 0, lb = 0;
+
if ( cg_fixedAspect.integer ) {
- CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
+ if ( cgs.glconfig.vidWidth * 480.0 > cgs.glconfig.vidHeight * 640.0 ) {
+ mask = 0.5 * ( ( cgs.glconfig.vidWidth - ( cgs.screenXScale * 640.0 ) ) / cgs.screenXScale );
+
+ CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
+ CG_FillRect( 0, 0, mask, 480, color );
+ CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+ CG_FillRect( 640 - mask, 0, mask, 480, color );
+ } else if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+ lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
+
+ CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+ CG_FillRect( 0, 480 - lb, 640, lb, color );
+ CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
+ CG_FillRect( 0, 0, 640, lb, color );
+ }
+ }
+
+ if ( cg_fixedAspect.integer ) {
+ CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
}
if ( cg_reticles.integer ) {
@@ -1670,18 +1691,11 @@ static void CG_DrawBinocReticle( void ) {
}
} else if ( cg_reticleType.integer == 1 ) {
// an alternative. This gives nice sharp lines at the expense of a few extra polys
- vec4_t color;
- color[0] = color[1] = color[2] = 0;
- color[3] = 1;
if ( cgs.media.binocShaderSimple ) {
CG_DrawPic( 0, 0, 640, 480, cgs.media.binocShaderSimple );
}
- if ( cg_fixedAspect.integer ) {
- CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
- }
-
CG_FillRect( 146, 239, 348, 1, color );
CG_FillRect( 188, 234, 1, 13, color ); // ll
diff --git a/SP/code/cgame/cg_draw.c b/SP/code/cgame/cg_draw.c
index 36daf81..683e70e 100644
--- a/SP/code/cgame/cg_draw.c
+++ b/SP/code/cgame/cg_draw.c
@@ -2310,23 +2310,38 @@ static void CG_DrawBinocReticle( void ) {
// an alternative. This gives nice sharp lines at the expense of a few extra polys
vec4_t color = {0, 0, 0, 1};
float x, y, w = 320, h = 240;
+ float mask = 0, lb = 0;
if ( cg_fixedAspect.integer ) {
- CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
- }
+ if ( cgs.glconfig.vidWidth * 480.0 > cgs.glconfig.vidHeight * 640.0 ) {
+ mask = 0.5 * ( ( cgs.glconfig.vidWidth - ( cgs.screenXScale * 640.0 ) ) / cgs.screenXScale );
- if ( cgs.media.binocShaderSimpleQ ) {
- CG_AdjustFrom640( &x, &y, &w, &h );
- trap_R_DrawStretchPic( 0, 0, w, h, 0, 0, 1, 1, cgs.media.binocShaderSimpleQ ); // tl
- trap_R_DrawStretchPic( w, 0, w, h, 1, 0, 0, 1, cgs.media.binocShaderSimpleQ ); // tr
- trap_R_DrawStretchPic( 0, h, w, h, 0, 1, 1, 0, cgs.media.binocShaderSimpleQ ); // bl
- trap_R_DrawStretchPic( w, h, w, h, 1, 1, 0, 0, cgs.media.binocShaderSimpleQ ); // br
+ CG_SetScreenPlacement(PLACE_LEFT, PLACE_CENTER);
+ CG_FillRect( 0, 0, mask, 480, color );
+ CG_SetScreenPlacement(PLACE_RIGHT, PLACE_CENTER);
+ CG_FillRect( 640 - mask, 0, mask, 480, color );
+ } else if ( cgs.glconfig.vidWidth * 480.0 < cgs.glconfig.vidHeight * 640.0 ) {
+ lb = 0.5 * ( ( cgs.glconfig.vidHeight - ( cgs.screenYScale * 480.0 ) ) / cgs.screenYScale );
+
+ CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+ CG_FillRect( 0, 480 - lb, 640, lb, color );
+ CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
+ CG_FillRect( 0, 0, 640, lb, color );
+ }
}
if ( cg_fixedAspect.integer ) {
CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
}
+ if ( cgs.media.binocShaderSimpleQ ) {
+ CG_AdjustFrom640( &x, &y, &w, &h );
+ trap_R_DrawStretchPic( mask * cgs.screenXScale, lb * cgs.screenYScale, w, h, 0, 0, 1, 1, cgs.media.binocShaderSimpleQ ); // tl
+ trap_R_DrawStretchPic( w + mask * cgs.screenXScale, lb * cgs.screenYScale, w, h, 1, 0, 0, 1, cgs.media.binocShaderSimpleQ ); // tr
+ trap_R_DrawStretchPic( mask * cgs.screenXScale, h + lb * cgs.screenYScale, w, h, 0, 1, 1, 0, cgs.media.binocShaderSimpleQ ); // bl
+ trap_R_DrawStretchPic( w + mask * cgs.screenXScale, h + lb * cgs.screenYScale, w, h, 1, 1, 0, 0, cgs.media.binocShaderSimpleQ ); // br
+ }
+
CG_FillRect( 146, 239, 348, 1, color );
CG_FillRect( 188, 234, 1, 13, color ); // ll
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list