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 4c2a29ab6dc133c91d94a0af67a360886fb42374
Author: MAN-AT-ARMS <m4n4t4...@gmail.com>
Date:   Mon Nov 9 16:05:12 2015 -0500

    MP: Add fixed aspect HUD / SP: Some cleanup
---
 MP/code/cgame/cg_draw.c       | 237 ++++++++++++++++++++++++++++++++++++------
 MP/code/cgame/cg_drawtools.c  | 147 ++++++++++++++++++++++----
 MP/code/cgame/cg_info.c       |   6 +-
 MP/code/cgame/cg_local.h      |  25 ++++-
 MP/code/cgame/cg_main.c       |  28 ++++-
 MP/code/cgame/cg_newdraw.c    |  34 ++++++
 MP/code/cgame/cg_scoreboard.c |  24 ++++-
 MP/code/cgame/cg_view.c       |  47 +++++----
 MP/code/cgame/cg_weapons.c    |  34 ++++--
 SP/code/cgame/cg_drawtools.c  |  30 ------
 SP/code/cgame/cg_view.c       |   2 +
 11 files changed, 498 insertions(+), 116 deletions(-)

diff --git a/MP/code/cgame/cg_draw.c b/MP/code/cgame/cg_draw.c
index 215feec..c5d1d4f 100644
--- a/MP/code/cgame/cg_draw.c
+++ b/MP/code/cgame/cg_draw.c
@@ -511,9 +511,18 @@ void CG_DrawTeamBackground( int x, int y, int w, int h, 
float alpha, int team )
        } else {
                return;
        }
-       trap_R_SetColor( hcolor );
-       CG_DrawPic( x, y, w, h, cgs.media.teamStatusBar );
-       trap_R_SetColor( NULL );
+
+       if ( cg_fixedAspect.integer ) {
+               trap_R_SetColor( hcolor );
+               CG_SetScreenPlacement(PLACE_STRETCH, 
CG_GetScreenVerticalPlacement());
+               CG_DrawPic( x, y, w, h, cgs.media.teamStatusBar );
+               CG_PopScreenPlacement();
+               trap_R_SetColor( NULL );
+       } else {
+               trap_R_SetColor( hcolor );
+               CG_DrawPic( x, y, w, h, cgs.media.teamStatusBar );
+               trap_R_SetColor( NULL );
+       }
 }
 
 /*
@@ -863,6 +872,12 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame) {
 
        y = 0; // JPW NERVE move team overlay below obits, even with timer on 
left
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_RIGHT, PLACE_TOP);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        if ( cgs.gametype >= GT_TEAM ) {
                y = CG_DrawTeamOverlay( y );
        }
@@ -911,8 +926,14 @@ static void CG_DrawTeamInfo( void ) {
        }
        if ( chatHeight <= 0 ) {
                return; // disabled
-
        }
+
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement( PLACE_LEFT, PLACE_BOTTOM );
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement( PLACE_CENTER, PLACE_BOTTOM );
+       }
+
        if ( cgs.teamLastChatPos != cgs.teamChatPos ) {
                if ( cg.time - cgs.teamChatMsgTimes[cgs.teamLastChatPos % 
chatHeight] > cg_teamChatTime.integer ) {
                        cgs.teamLastChatPos++;
@@ -972,6 +993,12 @@ static void CG_DrawPickupItem( void ) {
        float color[4];
        const char *s;
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        value = cg.itemPickup;
        if ( value ) {
                fadeColor = CG_FadeColor( cg.itemPickupTime, 3000 );
@@ -1022,6 +1049,12 @@ static void CG_DrawNotify( void ) {
        char var[MAX_TOKEN_CHARS];
        float notifytime = 1.0f;
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_TOP);
+       }
+
        trap_Cvar_VariableStringBuffer( "con_notifytime", var, sizeof( var ) );
        notifytime = atof( var ) * 1000;
 
@@ -1146,6 +1179,10 @@ static void CG_DrawDisconnect( void ) {
                return;
        }
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        // also add text in center of screen
        s = CG_TranslateString( "Connection Interrupted" );
        w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
@@ -1156,6 +1193,10 @@ static void CG_DrawDisconnect( void ) {
                return;
        }
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+       }
+
        x = 640 - 72;
        y = 480 - 52;
 
@@ -1184,6 +1225,10 @@ static void CG_DrawLagometer( void ) {
                return;
        }
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+       }
+
        //
        // draw the graph
        //
@@ -1413,6 +1458,10 @@ static void CG_DrawCenterString( void ) {
                return;
        }
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        trap_R_SetColor( color );
 
        start = cg.centerPrint;
@@ -1469,6 +1518,7 @@ CG_DrawWeapReticle
 static void CG_DrawWeapReticle( void ) {
        qboolean snooper, sniper;
        vec4_t color = {0, 0, 0, 1};
+       float width = 80.0;
 
        // DHM - Nerve :: So that we will draw reticle
        if ( cgs.gametype >= GT_WOLF && ( ( cg.snap->ps.pm_flags & PMF_FOLLOW ) 
|| cg.demoPlayback ) ) {
@@ -1483,10 +1533,25 @@ static void CG_DrawWeapReticle( void ) {
                if ( cg_reticles.integer ) {
 
                        // sides
-                       CG_FillRect( 0, 0, 80, 480, color );
-                       CG_FillRect( 560, 0, 80, 480, color );
+                       if ( cg_fixedAspect.integer ) {
+                               if ( cgs.glconfig.vidWidth * 480 > 
cgs.glconfig.vidHeight * 640 ) {
+                                       width = 0.5 * ( ( cgs.glconfig.vidWidth 
- ( min( cgs.screenXScale, cgs.screenYScale ) * 480 ) ) / min( 
cgs.screenXScale, cgs.screenYScale ) );
+                               }
+
+                               CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+                               CG_FillRect( 0, 0, width, 480, color );
+                               CG_SetScreenPlacement(PLACE_RIGHT, 
PLACE_BOTTOM);
+                               CG_FillRect( 640-width, 0, width, 480, color );
+                       } else {
+                               CG_FillRect( 0, 0, 80, 480, color );
+                               CG_FillRect( 560, 0, 80, 480, color );
+                       }
 
                        // center
+                       if ( cg_fixedAspect.integer ) {
+                               CG_SetScreenPlacement(PLACE_CENTER, 
PLACE_CENTER);
+                       }
+
                        if ( cgs.media.reticleShaderSimple ) {
                                CG_DrawPic( 80, 0, 480, 480, 
cgs.media.reticleShaderSimple );
                        }
@@ -1501,10 +1566,24 @@ static void CG_DrawWeapReticle( void ) {
                if ( cg_reticles.integer ) {
 
                        // sides
-                       CG_FillRect( 0, 0, 80, 480, color );
-                       CG_FillRect( 560, 0, 80, 480, color );
+                       if ( cg_fixedAspect.integer ) {
+                               if ( cgs.glconfig.vidWidth * 480 > 
cgs.glconfig.vidHeight * 640 ) {
+                                       width = 0.5 * ( ( cgs.glconfig.vidWidth 
- ( min( cgs.screenXScale, cgs.screenYScale ) * 480 ) ) / min( 
cgs.screenXScale, cgs.screenYScale ) );
+                               }
+
+                               CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+                               CG_FillRect( 0, 0, width, 480, color );
+                               CG_SetScreenPlacement(PLACE_RIGHT, 
PLACE_BOTTOM);
+                               CG_FillRect( 640-width, 0, width, 480, color );
+                       } else {
+                               CG_FillRect( 0, 0, 80, 480, color );
+                               CG_FillRect( 560, 0, 80, 480, color );
+                       }
 
                        // center
+                       if ( cg_fixedAspect.integer ) {
+                               CG_SetScreenPlacement(PLACE_CENTER, 
PLACE_CENTER);
+                       }
 
 //----(SA)     added
                        // DM didn't like how bright it gets
@@ -1554,6 +1633,10 @@ CG_DrawBinocReticle
 ==============
 */
 static void CG_DrawBinocReticle( void ) {
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
+       }
+
        if ( cg_reticles.integer ) {
                if ( cg_reticleType.integer == 0 ) {
                        if ( cgs.media.binocShader ) {
@@ -1660,6 +1743,10 @@ static void CG_DrawCrosshair( void ) {
                return;
        }
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        // set color based on health
        if ( cg_crosshairHealth.integer ) {
                vec4_t hcolor;
@@ -1679,33 +1766,53 @@ static void CG_DrawCrosshair( void ) {
 
        x = cg_crosshairX.integer;
        y = cg_crosshairY.integer;
-       CG_AdjustFrom640( &x, &y, &w, &h );
+       if ( !cg_fixedAspect.integer ) {
+               CG_AdjustFrom640( &x, &y, &w, &h );
+       }
 
        hShader = cgs.media.crosshairShader[ cg_drawCrosshair.integer % 
NUM_CROSSHAIRS ];
 
        // NERVE - SMF - modified, fixes crosshair offset in shifted/scaled 3d 
views
        if ( cg.limboMenu ) { // JPW NERVE
-               trap_R_DrawStretchPic( x /*+ cg.refdef.x*/ + 0.5 * ( 
cg.refdef.width - w ),
-                                                          y /*+ cg.refdef.y*/ 
+ 0.5 * ( cg.refdef.height - h ),
-                                                          w, h, 0, 0, 1, 1, 
hShader );
+               if ( cg_fixedAspect.integer ) {
+                       CG_DrawPic( ( ( SCREEN_WIDTH - w ) * 0.5f ) + x, ( ( 
SCREEN_HEIGHT - h ) * 0.5f ) + y, w, h, hShader );
+               } else {
+                       trap_R_DrawStretchPic( x /*+ cg.refdef.x*/ + 0.5 * ( 
cg.refdef.width - w ),
+                                                                  y /*+ 
cg.refdef.y*/ + 0.5 * ( cg.refdef.height - h ),
+                                                                  w, h, 0, 0, 
1, 1, hShader );
+               }
        } else {
-               trap_R_DrawStretchPic( x + 0.5 * ( cgs.glconfig.vidWidth - w ), 
// JPW NERVE for scaled-down main windows
-                                                          y + 0.5 * ( 
cgs.glconfig.vidHeight - h ),
-                                                          w, h, 0, 0, 1, 1, 
hShader );
+               if ( cg_fixedAspect.integer ) {
+                       CG_DrawPic( ( ( SCREEN_WIDTH - w ) * 0.5f ) + x, ( ( 
SCREEN_HEIGHT - h ) * 0.5f ) + y, w, h, hShader );
+               } else {
+                       trap_R_DrawStretchPic( x + 0.5 * ( 
cgs.glconfig.vidWidth - w ), // JPW NERVE for scaled-down main windows
+                                                                  y + 0.5 * ( 
cgs.glconfig.vidHeight - h ),
+                                                                  w, h, 0, 0, 
1, 1, hShader );
+               }
        }
        // NERVE - SMF
        if ( cg.crosshairShaderAlt[ cg_drawCrosshair.integer % NUM_CROSSHAIRS ] 
) {
                w = h = cg_crosshairSize.value;
                x = cg_crosshairX.integer;
                y = cg_crosshairY.integer;
-               CG_AdjustFrom640( &x, &y, &w, &h );
+               if ( !cg_fixedAspect.integer ) {
+                       CG_AdjustFrom640( &x, &y, &w, &h );
+               }
 
                if ( cg.limboMenu ) { // JPW NERVE
-                       trap_R_DrawStretchPic( x + 0.5 * ( cg.refdef.width - w 
), y + 0.5 * ( cg.refdef.height - h ),
+                       if ( cg_fixedAspect.integer ) {
+                               CG_DrawPic( ( ( SCREEN_WIDTH - w ) * 0.5f ) + 
x, ( ( SCREEN_HEIGHT - h ) * 0.5f ) + y, w, h, cg.crosshairShaderAlt[ 
cg_drawCrosshair.integer % NUM_CROSSHAIRS ] );
+                       } else {
+                               trap_R_DrawStretchPic( x + 0.5 * ( 
cg.refdef.width - w ), y + 0.5 * ( cg.refdef.height - h ),
                                                                   w, h, 0, 0, 
1, 1, cg.crosshairShaderAlt[ cg_drawCrosshair.integer % NUM_CROSSHAIRS ] );
+                       }
                } else {
-                       trap_R_DrawStretchPic( x + 0.5 * ( 
cgs.glconfig.vidWidth - w ), y + 0.5 * ( cgs.glconfig.vidHeight - h ), // JPW 
NERVE fix for small main windows (dunno why people still do this, but it's 
supported)
+                       if ( cg_fixedAspect.integer ) {
+                               CG_DrawPic( ( ( SCREEN_WIDTH - w ) * 0.5f ) + 
x, ( ( SCREEN_HEIGHT - h ) * 0.5f ) + y, w, h, cg.crosshairShaderAlt[ 
cg_drawCrosshair.integer % NUM_CROSSHAIRS ] );
+                       } else {
+                               trap_R_DrawStretchPic( x + 0.5 * ( 
cgs.glconfig.vidWidth - w ), y + 0.5 * ( cgs.glconfig.vidHeight - h ), // JPW 
NERVE fix for small main windows (dunno why people still do this, but it's 
supported)
                                                                   w, h, 0, 0, 
1, 1, cg.crosshairShaderAlt[ cg_drawCrosshair.integer % NUM_CROSSHAIRS ] );
+                       }
                }
        }
        // -NERVE - SMF
@@ -2097,6 +2204,10 @@ static void CG_DrawCrosshairNames( void ) {
        }
        // done.
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        // scan the known entities to see if the crosshair is sighted on one
        CG_ScanForCrosshairEntity();
 
@@ -2177,6 +2288,9 @@ CG_DrawSpectator
 =================
 */
 static void CG_DrawSpectator( void ) {
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_BOTTOM);
+       }
        CG_DrawBigString( 320 - 9 * 8, 440, CG_TranslateString( "SPECTATOR" ), 
1.0F );
        if ( cgs.gametype == GT_TOURNAMENT ) {
                CG_DrawBigString( 320 - 15 * 8, 460, "waiting to play", 1.0F );
@@ -2250,6 +2364,10 @@ static void CG_DrawVote( void ) {
                Q_strncpyz( str2, "vote no", 32 );
        }
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
+       }
+
        // play a talk beep whenever it is modified
        if ( cgs.voteModified ) {
                cgs.voteModified = qfalse;
@@ -2471,6 +2589,13 @@ static qboolean CG_DrawFollow( void ) {
        if ( !( cg.snap->ps.pm_flags & PMF_FOLLOW ) ) {
                return qfalse;
        }
+
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_TOP);
+       }
+
        color[0] = 1;
        color[1] = 1;
        color[2] = 1;
@@ -2524,6 +2649,10 @@ static void CG_DrawWarmup( void ) {
                return;     // (SA) don't bother with this stuff in sp
        }
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_TOP);
+       }
+
        sec = cg.warmup;
        if ( !sec ) {
                if ( cgs.gamestate == GS_WAITING_FOR_PLAYERS ) {
@@ -2672,7 +2801,12 @@ static void CG_DrawFlashFade( void ) {
        if ( cgs.fadeAlphaCurrent > 0.0 ) {
                VectorClear( col );
                col[3] = cgs.fadeAlphaCurrent;
-               CG_FillRect( -10, -10, 650, 490, col );
+               if ( cg_fixedAspect.integer ) {
+                       CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
+                       CG_FillRect( -10, -10, 650, 490, col );
+               } else {        
+                       CG_FillRect( -10, -10, 650, 490, col );
+               }
        }
 }
 
@@ -2726,7 +2860,12 @@ static void CG_DrawFlashZoomTransition( void ) {
                        Vector4Set( color, 0, 0, 0, 1.0f - frac );
                }
 
-               CG_FillRect( -10, -10, 650, 490, color );
+               if ( cg_fixedAspect.integer ) {
+                       CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
+                       CG_FillRect( -10, -10, 650, 490, color );
+               } else {
+                       CG_FillRect( -10, -10, 650, 490, color );
+               }
        }
 }
 
@@ -2756,7 +2895,12 @@ static void CG_DrawFlashDamage( void ) {
                VectorSet( col, 0.2, 0, 0 );
                col[3] =  0.7 * ( redFlash / 5.0 );
 
-               CG_FillRect( -10, -10, 650, 490, col );
+               if ( cg_fixedAspect.integer ) {
+                       CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
+                       CG_FillRect( -10, -10, 650, 490, col );
+               } else {
+                       CG_FillRect( -10, -10, 650, 490, col );
+               }
        }
 }
 
@@ -2804,7 +2948,11 @@ static void CG_DrawFlashFire( void ) {
                col[2] = alpha;
                col[3] = alpha;
                trap_R_SetColor( col );
-               CG_DrawPic( -10, -10, 650, 490, cgs.media.viewFlashFire[( 
cg.time / 50 ) % 16] );
+               if ( cg_fixedAspect.integer ) {
+                       trap_R_DrawStretchPic( -10, -10, 650, 490, 0, 0, 1, 1, 
cgs.media.viewFlashFire[( cg.time / 50 ) % 16] );
+               } else {
+                       CG_DrawPic( -10, -10, 650, 490, 
cgs.media.viewFlashFire[( cg.time / 50 ) % 16] );
+               }
                trap_R_SetColor( NULL );
 
                CG_S_AddLoopingSound( cg.snap->ps.clientNum, 
cg.snap->ps.origin, vec3_origin, cgs.media.flameSound, (int)( 255.0 * alpha ) );
@@ -2843,7 +2991,11 @@ static void CG_DrawFlashLightning( void ) {
                shader = cgs.media.viewTeslaDamageEffectShader;
        }
 
-       CG_DrawPic( -10, -10, 650, 490, shader );
+       if ( cg_fixedAspect.integer ) {
+               trap_R_DrawStretchPic( -10, -10, 650, 490, 0, 0, 1, 1, shader );
+       } else {
+               CG_DrawPic( -10, -10, 650, 490, shader );
+       }
 }
 
 
@@ -3055,6 +3207,12 @@ void CG_DrawObjectiveIcons( void ) {
        vec4_t hcolor = { 0.2f, 0.2f, 0.2f, 1.f };
        int msec, mins, seconds, tens; // JPW NERVE
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_LEFT, PLACE_TOP);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
 // JPW NERVE added round timer
        y = 48;
        x = 5;
@@ -3299,7 +3457,11 @@ void CG_Draw2D2( void ) {
        hcolor[3] = cg_hudAlpha.value;
        trap_R_SetColor( hcolor );
 
-       CG_DrawPic( 0,480, 640, -70, cgs.media.hud1Shader );
+       if ( cg_fixedAspect.integer ) {
+               trap_R_DrawStretchPic( 0, 480, 640, -70, 0, 0, 1, 1, 
cgs.media.hud1Shader );
+       } else {
+               CG_DrawPic( 0, 480, 640, -70, cgs.media.hud1Shader );
+       }
 
        if ( !( cg.snap->ps.eFlags & EF_MG42_ACTIVE ) ) {
                switch ( cg.snap->ps.weapon ) {
@@ -3386,6 +3548,10 @@ static void CG_DrawCompass( void ) {
                return;
        }
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_BOTTOM);
+       }
+
        angle = ( cg.snap->ps.viewangles[YAW] + 180.f ) / 360.f - ( 0.25 / 2.f 
);
 
        VectorSet( hcolor, 1.f,1.f,1.f );
@@ -3537,6 +3703,12 @@ static void CG_Draw2D(stereoFrame_t stereoFrame) {
                        CG_DrawTeamInfo();
                }
                if ( cg_drawStatus.integer ) {
+                       if ( cg_fixedAspect.integer == 2 ) {
+                               CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+                       } else if ( cg_fixedAspect.integer == 1 ) {
+                               CG_SetScreenPlacement(PLACE_CENTER, 
PLACE_BOTTOM);
+                       }
+
                        Menu_PaintAll();
                        CG_DrawTimedMenus();
                }
@@ -3660,12 +3832,19 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
                h = LIMBO_3D_H;
 
                cg.refdef.width = 0;
-               CG_AdjustFrom640( &x, &y, &w, &h );
+               if ( cg_fixedAspect.integer ) {
+                       cg.refdef.x = LIMBO_3D_X * cgs.screenXScaleStretch;
+                       cg.refdef.y = LIMBO_3D_Y * cgs.screenYScaleStretch;
+                       cg.refdef.width = LIMBO_3D_W * cgs.screenXScaleStretch;
+                       cg.refdef.height = LIMBO_3D_H * cgs.screenYScaleStretch;
+               } else {
+                       CG_AdjustFrom640( &x, &y, &w, &h );
 
-               cg.refdef.x = x;
-               cg.refdef.y = y;
-               cg.refdef.width = w;
-               cg.refdef.height = h;
+                       cg.refdef.x = x;
+                       cg.refdef.y = y;
+                       cg.refdef.width = w;
+                       cg.refdef.height = h;
+               }
        }
        // -NERVE - SMF
 
diff --git a/MP/code/cgame/cg_drawtools.c b/MP/code/cgame/cg_drawtools.c
index b1c2d98..21c9b79 100644
--- a/MP/code/cgame/cg_drawtools.c
+++ b/MP/code/cgame/cg_drawtools.c
@@ -29,6 +29,56 @@ If you have questions concerning this license or the 
applicable additional terms
 // cg_drawtools.c -- helper functions called by cg_draw, cg_scoreboard, 
cg_info, etc
 #include "cg_local.h"
 
+static screenPlacement_e cg_horizontalPlacement = PLACE_CENTER;
+static screenPlacement_e cg_verticalPlacement = PLACE_CENTER;
+static screenPlacement_e cg_lastHorizontalPlacement = PLACE_CENTER;
+static screenPlacement_e cg_lastVerticalPlacement = PLACE_CENTER;
+
+/*
+================
+CG_SetScreenPlacement
+================
+*/
+void CG_SetScreenPlacement(screenPlacement_e hpos, screenPlacement_e vpos)
+{
+       cg_lastHorizontalPlacement = cg_horizontalPlacement;
+       cg_lastVerticalPlacement = cg_verticalPlacement;
+
+       cg_horizontalPlacement = hpos;
+       cg_verticalPlacement = vpos;
+}
+
+/*
+================
+CG_PopScreenPlacement
+================
+*/
+void CG_PopScreenPlacement(void)
+{
+       cg_horizontalPlacement = cg_lastHorizontalPlacement;
+       cg_verticalPlacement = cg_lastVerticalPlacement;
+}
+
+/*
+================
+CG_GetScreenHorizontalPlacement
+================
+*/
+screenPlacement_e CG_GetScreenHorizontalPlacement(void)
+{
+       return cg_horizontalPlacement;
+}
+
+/*
+================
+CG_GetScreenVerticalPlacement
+================
+*/
+screenPlacement_e CG_GetScreenVerticalPlacement(void)
+{
+       return cg_verticalPlacement;
+}
+
 /*
 ================
 CG_AdjustFrom640
@@ -44,23 +94,76 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float 
*h ) {
        }
 #endif
 
-       // NERVE - SMF - hack to make images display properly in small view / 
limbo mode
-       if ( cg.limboMenu && cg.refdef.width ) {
-               float xscale = ( ( cg.refdef.width / cgs.screenXScale ) / 640.f 
);
-               float yscale = ( ( cg.refdef.height / cgs.screenYScale ) / 
480.f );
+       if ( cg_fixedAspect.integer ) {
+               if (cg_horizontalPlacement == PLACE_STRETCH) {
+                       // scale for screen sizes (not aspect correct in wide 
screen)
+                       *w *= cgs.screenXScaleStretch;
+                       *x *= cgs.screenXScaleStretch;
+               } else if ( cg.limboMenu && cg.refdef.width ) {
+                       // NERVE - SMF - hack to make images display properly 
in small view / limbo mode
+                       float xscale = ( ( cg.refdef.width / cgs.screenXScale ) 
/ 640.f );
+
+                       ( *x ) = ( *x ) * xscale + ( cg.refdef.x / 
cgs.screenXScale );
+                       ( *w ) *= xscale;
+                       // -NERVE - SMF
+       
+                       // scale for screen sizes
+                       *w *= cgs.screenXScale;
+                       *x *= cgs.screenXScale;
+               } else {
+                       // scale for screen sizes
+                       *w *= cgs.screenXScale;
+                       *x *= cgs.screenXScale;
+       
+                       if (cg_horizontalPlacement == PLACE_CENTER) {
+                               *x += cgs.screenXBias;
+                       } else if (cg_horizontalPlacement == PLACE_RIGHT) {
+                               *x += cgs.screenXBias*2;
+                       }
+               }
 
-               ( *x ) = ( *x ) * xscale + ( cg.refdef.x / cgs.screenXScale );
-               ( *y ) = ( *y ) * yscale + ( cg.refdef.y / cgs.screenYScale );
-               ( *w ) *= xscale;
-               ( *h ) *= yscale;
-       }
-       // -NERVE - SMF
+               if (cg_verticalPlacement == PLACE_STRETCH) {
+                       *h *= cgs.screenYScaleStretch;
+                       *y *= cgs.screenYScaleStretch;
+               } else if ( cg.limboMenu && cg.refdef.width ) {
+                       // NERVE - SMF - hack to make images display properly 
in small view / limbo mode
+                       float yscale = ( ( cg.refdef.height / cgs.screenYScale 
) / 480.f );
 
-       // scale for screen sizes
-       *x *= cgs.screenXScale;
-       *y *= cgs.screenYScale;
-       *w *= cgs.screenXScale;
-       *h *= cgs.screenYScale;
+                       ( *y ) = ( *y ) * yscale + ( cg.refdef.y / 
cgs.screenYScale );
+                       ( *h ) *= yscale;
+                       // -NERVE - SMF
+
+                       *h *= cgs.screenYScale;
+                       *y *= cgs.screenYScale;
+               } else {
+                       *h *= cgs.screenYScale;
+                       *y *= cgs.screenYScale;
+       
+                       if (cg_verticalPlacement == PLACE_CENTER) {
+                               *y += cgs.screenYBias;
+                       } else if (cg_verticalPlacement == PLACE_BOTTOM) {
+                               *y += cgs.screenYBias*2;
+                       }
+               }
+       } else {
+               // NERVE - SMF - hack to make images display properly in small 
view / limbo mode
+               if ( cg.limboMenu && cg.refdef.width ) {
+                       float xscale = ( ( cg.refdef.width / cgs.screenXScale ) 
/ 640.f );
+                       float yscale = ( ( cg.refdef.height / cgs.screenYScale 
) / 480.f );
+
+                       ( *x ) = ( *x ) * xscale + ( cg.refdef.x / 
cgs.screenXScale );
+                       ( *y ) = ( *y ) * yscale + ( cg.refdef.y / 
cgs.screenYScale );
+                       ( *w ) *= xscale;
+                       ( *h ) *= yscale;
+               }
+               // -NERVE - SMF
+
+               // scale for screen sizes
+               *x *= cgs.screenXScale;
+               *y *= cgs.screenYScale;
+               *w *= cgs.screenXScale;
+               *h *= cgs.screenYScale;
+       }
 }
 
 /*
@@ -98,7 +201,7 @@ void CG_FillRectGradient( float x, float y, float width, 
float height, const flo
 ==============
 CG_HorizontalPercentBar
        Generic routine for pretty much all status indicators that show a 
fractional
-       value to the palyer by virtue of how full a drawn box is.
+       value to the player by virtue of how full a drawn box is.
 
 flags:
        left            - 1
@@ -1091,7 +1194,11 @@ static void UI_DrawBannerString2( int x, int y, const 
char* str, vec4_t color )
        trap_R_SetColor( color );
 
        ax = x * cgs.screenXScale + cgs.screenXBias;
-       ay = y * cgs.screenYScale;
+       if ( cg_fixedAspect.integer ) {
+               ay = y * cgs.screenYScale + cgs.screenYBias;
+       } else {
+               ay = y * cgs.screenYScale;
+       }
 
        s = str;
        while ( *s )
@@ -1198,7 +1305,11 @@ static void UI_DrawProportionalString2( int x, int y, 
const char* str, vec4_t co
        trap_R_SetColor( color );
 
        ax = x * cgs.screenXScale + cgs.screenXBias;
-       ay = y * cgs.screenYScale;
+       if ( cg_fixedAspect.integer ) {
+               ay = y * cgs.screenYScale + cgs.screenYBias;
+       } else {
+               ay = y * cgs.screenYScale;
+       }
 
        s = str;
        while ( *s )
diff --git a/MP/code/cgame/cg_info.c b/MP/code/cgame/cg_info.c
index e92ba51..b552182 100644
--- a/MP/code/cgame/cg_info.c
+++ b/MP/code/cgame/cg_info.c
@@ -260,7 +260,11 @@ void CG_DrawInformation( void ) {
                levelshot = trap_R_RegisterShaderNoMip( 
"levelshots/unknownmap.jpg" );
        }
        trap_R_SetColor( NULL );
-       CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot );
+       if ( cg_fixedAspect.integer ) {
+               trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, 
cgs.glconfig.vidHeight, 0, 0, 1, 1, levelshot );
+       } else {
+               CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot );
+       }
 
        // show the server motd
        CG_DrawMotd();
diff --git a/MP/code/cgame/cg_local.h b/MP/code/cgame/cg_local.h
index 61c74aa..5176640 100644
--- a/MP/code/cgame/cg_local.h
+++ b/MP/code/cgame/cg_local.h
@@ -784,7 +784,8 @@ typedef struct {
 
        // view rendering
        refdef_t refdef;
-       vec3_t refdefViewAngles;            // will be converted to 
refdef.viewaxis
+       vec3_t refdefViewAngles;        // will be converted to refdef.viewaxis
+       float fov;                      // either range checked cg_fov or 
forced value
 
        // zoom key
        qboolean zoomed;
@@ -1491,6 +1492,9 @@ typedef struct {
        float screenXScale;                 // derived from glconfig
        float screenYScale;
        float screenXBias;
+       float screenYBias;
+       float screenXScaleStretch;
+       float screenYScaleStretch;
 
        int serverCommandSequence;              // reliable command stream 
counter
        int processedSnapshotNum;            // the number of snapshots cgame 
has requested
@@ -1815,9 +1819,28 @@ void CG_ZoomUp_f( void );
 void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean 
demoPlayback );
 
 void CG_Concussive( centity_t *cent );
+
 //
 // cg_drawtools.c
 //
+typedef enum {
+       PLACE_STRETCH,
+       PLACE_CENTER,
+
+       // horizontal only
+       PLACE_LEFT,
+       PLACE_RIGHT,
+
+       // vertical only
+       PLACE_TOP,
+       PLACE_BOTTOM
+} screenPlacement_e;
+
+void CG_SetScreenPlacement(screenPlacement_e hpos, screenPlacement_e vpos);
+void CG_PopScreenPlacement(void);
+screenPlacement_e CG_GetScreenHorizontalPlacement(void);
+screenPlacement_e CG_GetScreenVerticalPlacement(void);
+
 void CG_AdjustFrom640( float *x, float *y, float *w, float *h );
 void CG_FillRect( float x, float y, float width, float height, const float 
*color );
 void CG_HorizontalPercentBar( float x, float y, float width, float height, 
float percent );
diff --git a/MP/code/cgame/cg_main.c b/MP/code/cgame/cg_main.c
index 6287dac..3eda330 100644
--- a/MP/code/cgame/cg_main.c
+++ b/MP/code/cgame/cg_main.c
@@ -305,7 +305,7 @@ cvarTable_t cvarTable[] = {
        { &cg_zoomStepSnooper, "cg_zoomStepSnooper", "5", CVAR_ARCHIVE },
        { &cg_zoomStepFG, "cg_zoomStepFG", "10", CVAR_ARCHIVE },          
//----(SA)    added
        { &cg_fov, "cg_fov", "90", CVAR_ARCHIVE },
-       { &cg_fixedAspect, "cg_fixedAspect", "0", CVAR_ARCHIVE }, // 
Essentially the same as setting DF_FIXED_FOV for widescreen aspects
+       { &cg_fixedAspect, "cg_fixedAspect", "0", CVAR_ARCHIVE | CVAR_LATCH }, 
// Essentially the same as setting DF_FIXED_FOV for widescreen aspects
        { &cg_viewsize, "cg_viewsize", "100", CVAR_ARCHIVE },
        { &cg_letterbox, "cg_letterbox", "0", CVAR_TEMP },    //----(SA)        
added
        { &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE  },
@@ -2304,8 +2304,30 @@ void CG_Init( int serverMessageNum, int 
serverCommandSequence, int clientNum ) {
 
        // get the rendering configuration from the client system
        trap_GetGlconfig( &cgs.glconfig );
-       cgs.screenXScale = cgs.glconfig.vidWidth / 640.0;
-       cgs.screenYScale = cgs.glconfig.vidHeight / 480.0;
+       if ( cg_fixedAspect.integer ) {
+               cgs.screenXScaleStretch = cgs.glconfig.vidWidth * (1.0/640.0);
+               cgs.screenYScaleStretch = cgs.glconfig.vidHeight * (1.0/480.0);
+               if ( cgs.glconfig.vidWidth * 480 > cgs.glconfig.vidHeight * 640 
) {
+                       cgs.screenXScale = cgs.glconfig.vidWidth * (1.0/640.0);
+                       cgs.screenYScale = cgs.glconfig.vidHeight * (1.0/480.0);
+                       // wide screen
+                       cgs.screenXBias = 0.5 * ( cgs.glconfig.vidWidth - ( 
cgs.glconfig.vidHeight * (640.0/480.0) ) );
+                       cgs.screenXScale = cgs.screenYScale;
+                       // no narrow screen
+                       cgs.screenYBias = 0;
+               } else {
+                       cgs.screenXScale = cgs.glconfig.vidWidth * (1.0/640.0);
+                       cgs.screenYScale = cgs.glconfig.vidHeight * (1.0/480.0);
+                       // narrow screen
+                       cgs.screenYBias = 0.5 * ( cgs.glconfig.vidHeight - ( 
cgs.glconfig.vidWidth * (480.0/640.0) ) );
+                       cgs.screenYScale = cgs.screenXScale;
+                       // no wide screen
+                       cgs.screenXBias = 0;
+               }
+       } else {
+               cgs.screenXScale = cgs.glconfig.vidWidth / 640.0;
+               cgs.screenYScale = cgs.glconfig.vidHeight / 480.0;
+       }
 
        // get the gamestate from the client system
        trap_GetGameState( &cgs.gameState );
diff --git a/MP/code/cgame/cg_newdraw.c b/MP/code/cgame/cg_newdraw.c
index 21b0148..600d465 100644
--- a/MP/code/cgame/cg_newdraw.c
+++ b/MP/code/cgame/cg_newdraw.c
@@ -288,6 +288,12 @@ static void CG_DrawPlayerWeaponIcon( rectDef_t *rect, 
qboolean drawHighlighted,
                return;
        }
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        realweap = cg.predictedPlayerState.weapon;
 
        size = weapIconDrawSize( realweap );
@@ -434,6 +440,10 @@ static void CG_DrawCursorhint( rectDef_t *rect ) {
 
        CG_CheckForCursorHints();
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        switch ( cg.cursorHintIcon ) {
 
        case HINT_NONE:
@@ -647,6 +657,12 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, float 
scale, vec4_t color,
                return;
        }
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        switch ( weap ) {      // some weapons don't draw ammo count text
        case WP_KNIFE:
        case WP_KNIFE2:
@@ -1091,6 +1107,12 @@ static void CG_DrawPlayerHealth( rectDef_t *rect, float 
scale, vec4_t color, qha
                value = 0;
        }
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        if ( shader ) {
                trap_R_SetColor( color );
                CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
@@ -2199,6 +2221,12 @@ void CG_DrawWeapHeat( rectDef_t *rect, int align ) {
                return;
        }
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        if ( align != HUD_HORIZONTAL ) {
                flags |= 4;   // BAR_VERT
 
@@ -2222,6 +2250,12 @@ static void CG_DrawFatigue( rectDef_t *rect, vec4_t 
color, int align ) {
        vec4_t colorBonus = {1, 1, 0, 0.45f};   // yellow (a little more solid 
for the 'bonus' stamina)
        int flags = 0;
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_LEFT, PLACE_BOTTOM);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        if ( align != HUD_HORIZONTAL ) {
                flags |= 4;   // BAR_VERT
                flags |= 1;   // BAR_LEFT (left, when vertical means grow 'up')
diff --git a/MP/code/cgame/cg_scoreboard.c b/MP/code/cgame/cg_scoreboard.c
index edf7d83..fd737f3 100644
--- a/MP/code/cgame/cg_scoreboard.c
+++ b/MP/code/cgame/cg_scoreboard.c
@@ -650,7 +650,11 @@ qboolean CG_DrawScoreboard( void ) {
        float   *fadeColor;
        char    *s;
 
-       // don't draw amuthing if the menu or console is up
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
+       // don't draw anything if the menu or console is up
        if ( cg_paused.integer ) {
                cg.deferredPlayerLoading = 0;
                return qfalse;
@@ -844,6 +848,10 @@ void CG_DrawTourneyScoreboard( void ) {
        vec4_t color;
        int x,y;
 
+       if ( cg_fixedAspect.integer ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+       }
+
        // request more scores regularly
        if ( cg.scoresRequestTime + 2000 < cg.time ) {
                cg.scoresRequestTime = cg.time;
@@ -851,9 +859,17 @@ void CG_DrawTourneyScoreboard( void ) {
        }
 
        // draw the dialog background
-       color[0] = color[1] = color[2] = 0;
-       color[3] = 1;
-       CG_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, color );
+       if ( cg_fixedAspect.integer ) {
+               color[0] = color[1] = color[2] = 0;
+               color[3] = 1;
+               CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
+               CG_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, color );
+               CG_PopScreenPlacement();
+       } else {
+               color[0] = color[1] = color[2] = 0;
+               color[3] = 1;
+               CG_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, color );
+       }
 
        color[0] = 1;
        color[1] = 1;
diff --git a/MP/code/cgame/cg_view.c b/MP/code/cgame/cg_view.c
index 29a8c3c..c9ff2a1 100644
--- a/MP/code/cgame/cg_view.c
+++ b/MP/code/cgame/cg_view.c
@@ -805,7 +805,6 @@ Fixed fov at intermissions, otherwise account for fov 
variable and zooms.
 */
 #define WAVE_AMPLITUDE  1
 #define WAVE_FREQUENCY  0.4
-#define STANDARD_ASPECT_RATIO  ( (float)640 / (float)480 )
 
 static int CG_CalcFov( void ) {
        static float lastfov = 90;      // for transitions back from zoomed in 
modes
@@ -828,10 +827,10 @@ static int CG_CalcFov( void ) {
 
        if ( cg.predictedPlayerState.pm_type == PM_INTERMISSION ) {
                // if in intermission, use a fixed value
-               fov_x = 90;
+               cg.fov = fov_x = 90;
        } else {
                // user selectable
-               if ( ( cgs.dmflags & DF_FIXED_FOV ) || cg_fixedAspect.value ) {
+               if ( ( cgs.dmflags & DF_FIXED_FOV ) || cg_fixedAspect.integer ) 
{
                        // dmflag to prevent wide fov for all clients
                        fov_x = 90;
                } else {
@@ -851,6 +850,8 @@ static int CG_CalcFov( void ) {
                        }
                }
 
+               cg.fov = fov_x;
+
                // account for zooms
                if ( cg.zoomval ) {
                        zoomFov = cg.zoomval;   // (SA) use user scrolled amount
@@ -894,12 +895,14 @@ static int CG_CalcFov( void ) {
                fov_x = 55;
        }
 
-       if ( cg_fixedAspect.value ) {
-               float aspectRatio = (float)cg.refdef.width / 
(float)cg.refdef.height;
+       if ( cg_fixedAspect.integer ) {
+               // Based on LordHavoc's code for Darkplaces
+               // 
http://www.quakeworld.nu/forum/topic/53/what-does-your-qw-look-like/page/30
+               const float baseAspect = 0.75f; // 3/4
+               const float aspect = 
(float)cg.refdef.width/(float)cg.refdef.height;
+               const float desiredFov = fov_x;
 
-               if ( aspectRatio > STANDARD_ASPECT_RATIO )
-                       fov_x = RAD2DEG( 2 * atan2( ( aspectRatio / 
STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov_x ) * 0.5 ), 1 ) );
-               fov_x = min( fov_x, 160 );
+               fov_x = atan2( tan( desiredFov*M_PI / 360.0f ) * 
baseAspect*aspect, 1 )*360.0f / M_PI;
        }
 
        x = cg.refdef.width / tan( fov_x / 360 * M_PI );
@@ -1133,12 +1136,14 @@ static int CG_CalcViewValues( void ) {
                        VectorCopy( angles, cg.refdefViewAngles );
                        AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
 
-                       if ( cg_fixedAspect.value ) {
-                               float aspectRatio = (float)cg.refdef.width / 
(float)cg.refdef.height;
-
-                               if ( aspectRatio > STANDARD_ASPECT_RATIO )
-                                       fov = RAD2DEG( 2 * atan2( ( aspectRatio 
/ STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov ) * 0.5 ), 1 ) );
-                               fov = min( fov, 160 );
+                       if ( cg_fixedAspect.integer ) {
+                               // Based on LordHavoc's code for Darkplaces
+                               // 
http://www.quakeworld.nu/forum/topic/53/what-does-your-qw-look-like/page/30
+                               const float baseAspect = 0.75f; // 3/4
+                               const float aspect = 
(float)cg.refdef.width/(float)cg.refdef.height;
+                               const float desiredFov = fov;
+               
+                               fov = atan2( tan( desiredFov*M_PI / 360.0f ) * 
baseAspect*aspect, 1 )*360.0f / M_PI;
                        }
 
                        x = cg.refdef.width / tan( fov / 360 * M_PI );
@@ -1420,7 +1425,7 @@ void CG_DrawSkyBoxPortal( void ) {
                fov_x = 90;
        } else {
                // user selectable
-               if ( ( cgs.dmflags & DF_FIXED_FOV ) || cg_fixedAspect.value ) {
+               if ( ( cgs.dmflags & DF_FIXED_FOV ) || cg_fixedAspect.integer ) 
{
                        // dmflag to prevent wide fov for all clients
                        fov_x = 90;
                } else {
@@ -1475,12 +1480,14 @@ void CG_DrawSkyBoxPortal( void ) {
                fov_x = 55;
        }
 
-       if ( cg_fixedAspect.value ) {
-               float aspectRatio = (float)cg.refdef.width / 
(float)cg.refdef.height;
+       if ( cg_fixedAspect.integer ) {
+               // Based on LordHavoc's code for Darkplaces
+               // 
http://www.quakeworld.nu/forum/topic/53/what-does-your-qw-look-like/page/30
+               const float baseAspect = 0.75f; // 3/4
+               const float aspect = 
(float)cg.refdef.width/(float)cg.refdef.height;
+               const float desiredFov = fov_x;
 
-               if ( aspectRatio > STANDARD_ASPECT_RATIO )
-                       fov_x = RAD2DEG( 2 * atan2( ( aspectRatio / 
STANDARD_ASPECT_RATIO ) * tan( DEG2RAD( fov_x ) * 0.5 ), 1 ) );
-               fov_x = min( fov_x, 160 );
+               fov_x = atan2( tan( desiredFov*M_PI / 360.0f ) * 
baseAspect*aspect, 1 )*360.0f / M_PI;
        }
 
        cg.refdef.time = cg.time;
diff --git a/MP/code/cgame/cg_weapons.c b/MP/code/cgame/cg_weapons.c
index 7901e68..30680b7 100644
--- a/MP/code/cgame/cg_weapons.c
+++ b/MP/code/cgame/cg_weapons.c
@@ -2771,7 +2771,7 @@ Add the weapon, and flash for the player's view
 */
 void CG_AddViewWeapon( playerState_t *ps ) {
        refEntity_t hand;
-       float fovOffset;
+       vec3_t fovOffset;
        vec3_t angles;
        vec3_t gunoff;
        weaponInfo_t    *weapon;
@@ -2816,12 +2816,20 @@ void CG_AddViewWeapon( playerState_t *ps ) {
                return;
        }
 
-       // drop gun lower at higher fov
-       if ( cg_fov.integer > 90 && !cg_fixedAspect.value ) {
-               fovOffset = -0.2 * ( cg_fov.integer - 90 );
-       } else {
-               fovOffset = 0;
-       }
+       VectorClear(fovOffset);
+
+       if ( cg_fixedAspect.integer ) {
+               fovOffset[2] = 0;
+       } else if ( cg.fov > 90 ) {
+               // drop gun lower at higher fov
+               fovOffset[2] = -0.2 * ( cg.fov - 90 ) * cg.refdef.fov_x / 
cg.fov;
+       } else if ( cg.fov < 90 ) {
+               // move gun forward at lower fov
+               fovOffset[0] = -0.2 * ( cg.fov - 90 ) * cg.refdef.fov_x / 
cg.fov;
+       } else if ( cg_fov.integer > 90 ) {
+               // old auto adjust
+               fovOffset[2] = -0.2 * ( cg_fov.integer - 90 );
+       }
 
        if ( ps->weapon > WP_NONE ) {
                CG_RegisterWeapon( ps->weapon );
@@ -2838,9 +2846,9 @@ void CG_AddViewWeapon( playerState_t *ps ) {
 
 //----(SA)     removed
 
-               VectorMA( hand.origin, gunoff[0], cg.refdef.viewaxis[0], 
hand.origin );
-               VectorMA( hand.origin, gunoff[1], cg.refdef.viewaxis[1], 
hand.origin );
-               VectorMA( hand.origin, ( gunoff[2] + fovOffset ), 
cg.refdef.viewaxis[2], hand.origin );
+               VectorMA( hand.origin, ( gunoff[0] + fovOffset[0] ), 
cg.refdef.viewaxis[0], hand.origin );
+               VectorMA( hand.origin, ( gunoff[1] + fovOffset[1] ), 
cg.refdef.viewaxis[1], hand.origin );
+               VectorMA( hand.origin, ( gunoff[2] + fovOffset[2] ), 
cg.refdef.viewaxis[2], hand.origin );
 
                AnglesToAxis( angles, hand.axis );
 
@@ -2917,6 +2925,12 @@ void CG_DrawWeaponSelect( void ) {
        }
        trap_R_SetColor( color );
 
+       if ( cg_fixedAspect.integer == 2 ) {
+               CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
+       } else if ( cg_fixedAspect.integer == 1 ) {
+               CG_SetScreenPlacement(PLACE_CENTER, PLACE_BOTTOM);
+       }
+
 
 //----(SA)     neither of these overlap the weapon selection area anymore, so 
let them stay
        // showing weapon select clears pickup item display, but not the blend 
blob
diff --git a/SP/code/cgame/cg_drawtools.c b/SP/code/cgame/cg_drawtools.c
index e5405af..c1cbd13 100644
--- a/SP/code/cgame/cg_drawtools.c
+++ b/SP/code/cgame/cg_drawtools.c
@@ -100,15 +100,6 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float 
*h ) {
                        *w *= cgs.screenXScaleStretch;
                        *x *= cgs.screenXScaleStretch;
                } else {
-                       // NERVE - SMF - hack to make images display properly 
in small view / limbo mode
-                       if ( cg.limboMenu && cg.refdef.width ) {
-                               float xscale = ( ( cg.refdef.width / 
cgs.screenXScale ) / 640.f );
-
-                               ( *x ) = ( *x ) * xscale + ( cg.refdef.x / 
cgs.screenXScale );
-                               ( *w ) *= xscale;
-                       }
-                       // -NERVE - SMF
-       
                        // scale for screen sizes
                        *w *= cgs.screenXScale;
                        *x *= cgs.screenXScale;
@@ -124,15 +115,6 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float 
*h ) {
                        *h *= cgs.screenYScaleStretch;
                        *y *= cgs.screenYScaleStretch;
                } else {
-                       // NERVE - SMF - hack to make images display properly 
in small view / limbo mode
-                       if ( cg.limboMenu && cg.refdef.width ) {
-                               float yscale = ( ( cg.refdef.height / 
cgs.screenYScale ) / 480.f );
-
-                               ( *y ) = ( *y ) * yscale + ( cg.refdef.y / 
cgs.screenYScale );
-                               ( *h ) *= yscale;
-                       }
-                       // -NERVE - SMF
-
                        *h *= cgs.screenYScale;
                        *y *= cgs.screenYScale;
        
@@ -143,18 +125,6 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float 
*h ) {
                        }
                }
        } else {
-               // NERVE - SMF - hack to make images display properly in small 
view / limbo mode
-               if ( cg.limboMenu && cg.refdef.width ) {
-                       float xscale = ( ( cg.refdef.width / cgs.screenXScale ) 
/ 640.f );
-                       float yscale = ( ( cg.refdef.height / cgs.screenYScale 
) / 480.f );
-
-                       ( *x ) = ( *x ) * xscale + ( cg.refdef.x / 
cgs.screenXScale );
-                       ( *y ) = ( *y ) * yscale + ( cg.refdef.y / 
cgs.screenYScale );
-                       ( *w ) *= xscale;
-                       ( *h ) *= yscale;
-               }
-               // -NERVE - SMF
-
                // scale for screen sizes
                *x *= cgs.screenXScale;
                *y *= cgs.screenYScale;
diff --git a/SP/code/cgame/cg_view.c b/SP/code/cgame/cg_view.c
index 213eb69..521154d 100644
--- a/SP/code/cgame/cg_view.c
+++ b/SP/code/cgame/cg_view.c
@@ -195,6 +195,7 @@ static void CG_CalcVrect( void ) {
        int xsize, ysize;
        float lbheight;
 
+/*
        // NERVE - SMF
        if ( cg.limboMenu ) {
                float x, y, w, h;
@@ -213,6 +214,7 @@ static void CG_CalcVrect( void ) {
                return;
        }
        // -NERVE - SMF
+*/
 
        // the intermission should allways be full screen
        if ( cg.snap->ps.pm_type == PM_INTERMISSION ) {

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/iortcw.git

_______________________________________________
Pkg-games-commits mailing list
Pkg-games-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to