[iortcw] 460/497: MP: Fix cinematics and some scaling issues

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:52 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 5206fd503207eb5160040e750cbb1502f486f0fc
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Sun Dec 6 09:51:32 2015 -0500

    MP: Fix cinematics and some scaling issues
---
 MP/code/cgame/cg_draw.c       | 21 +++++++---------
 MP/code/cgame/cg_drawtools.c  | 47 +++++++++++++++++++++++------------
 MP/code/cgame/cg_scoreboard.c |  8 +++++-
 MP/code/cgame/cg_view.c       |  4 +++
 MP/code/ui/ui_main.c          | 57 ++++++++++++++++++++++++++++++++++++++-----
 SP/code/cgame/cg_draw.c       |  8 +++---
 6 files changed, 106 insertions(+), 39 deletions(-)

diff --git a/MP/code/cgame/cg_draw.c b/MP/code/cgame/cg_draw.c
index 49023c4..6a856cc 100644
--- a/MP/code/cgame/cg_draw.c
+++ b/MP/code/cgame/cg_draw.c
@@ -3880,20 +3880,17 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
 		w = LIMBO_3D_W;
 		h = LIMBO_3D_H;
 
+		if ( cg_fixedAspect.integer ) { //FIXME:MAN-AT-ARMS...Use correct view
+			CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+		}
+
 		cg.refdef.width = 0;
-		if ( cg_fixedAspect.integer == 2 ) { //FIXME:MAN-AT-ARMS...Use correct view
-			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_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 21c9b79..0a6d230 100644
--- a/MP/code/cgame/cg_drawtools.c
+++ b/MP/code/cgame/cg_drawtools.c
@@ -96,21 +96,28 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
 
 	if ( cg_fixedAspect.integer ) {
 		if (cg_horizontalPlacement == PLACE_STRETCH) {
+			// 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.screenXScaleStretch ) / 640.f );
+
+				( *x ) = ( *x ) * xscale + ( cg.refdef.x / cgs.screenXScaleStretch );
+				( *w ) *= xscale;
+			}
+			// -NERVE - SMF
+
 			// scale for screen sizes (not aspect correct in wide screen)
 			*w *= cgs.screenXScaleStretch;
 			*x *= cgs.screenXScaleStretch;
-		} else if ( cg.limboMenu && cg.refdef.width ) {
+		} else {
 			// NERVE - SMF - hack to make images display properly in small view / limbo mode
-			float xscale = ( ( cg.refdef.width / cgs.screenXScale ) / 640.f );
+			if ( cg.limboMenu && cg.refdef.width ) {
+				float xscale = ( ( cg.refdef.width / cgs.screenXScaleStretch ) / 640.f );
 
-			( *x ) = ( *x ) * xscale + ( cg.refdef.x / cgs.screenXScale );
-			( *w ) *= xscale;
+				( *x ) = ( *x ) * xscale + ( cg.refdef.x / cgs.screenXScaleStretch );
+				( *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;
@@ -123,21 +130,29 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
 		}
 
 		if (cg_verticalPlacement == PLACE_STRETCH) {
+			// 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.screenYScaleStretch ) / 480.f );
+
+				( *y ) = ( *y ) * yscale + ( cg.refdef.y / cgs.screenYScaleStretch );
+				( *h ) *= yscale;
+			}
+			// -NERVE - SMF
+
 			*h *= cgs.screenYScaleStretch;
 			*y *= cgs.screenYScaleStretch;
-		} else if ( cg.limboMenu && cg.refdef.width ) {
+		} else {
 			// NERVE - SMF - hack to make images display properly in small view / limbo mode
-			float yscale = ( ( cg.refdef.height / cgs.screenYScale ) / 480.f );
+			if ( cg.limboMenu && cg.refdef.width ) {
+				float yscale = ( ( cg.refdef.height / cgs.screenYScaleStretch ) / 480.f );
 
-			( *y ) = ( *y ) * yscale + ( cg.refdef.y / cgs.screenYScale );
-			( *h ) *= yscale;
+				( *y ) = ( *y ) * yscale + ( cg.refdef.y / cgs.screenYScaleStretch );
+				( *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;
diff --git a/MP/code/cgame/cg_scoreboard.c b/MP/code/cgame/cg_scoreboard.c
index 14a35cb..42e7472 100644
--- a/MP/code/cgame/cg_scoreboard.c
+++ b/MP/code/cgame/cg_scoreboard.c
@@ -666,7 +666,9 @@ qboolean CG_DrawScoreboard( void ) {
 		return qfalse;
 	}
 
-	if ( cg_fixedAspect.integer ) {
+	if ( cg_fixedAspect.integer && cg.limboMenu ) {
+		CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH);
+	} else if ( cg_fixedAspect.integer && !cg.limboMenu ) {
 		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
 	}
 
@@ -810,6 +812,10 @@ qboolean CG_DrawScoreboard( void ) {
 		CG_LoadDeferredPlayers();
 	}
 
+	if ( cg_fixedAspect.integer ) {
+		CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+	}
+
 	return qtrue;
 }
 
diff --git a/MP/code/cgame/cg_view.c b/MP/code/cgame/cg_view.c
index c9ff2a1..77ab410 100644
--- a/MP/code/cgame/cg_view.c
+++ b/MP/code/cgame/cg_view.c
@@ -202,6 +202,10 @@ static void CG_CalcVrect( void ) {
 		w = LIMBO_3D_W;
 		h = LIMBO_3D_H;
 
+		if ( cg_fixedAspect.integer ) { //FIXME:MAN-AT-ARMS...Use correct view
+			CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER);
+		}
+
 		cg.refdef.width = 0;
 		CG_AdjustFrom640( &x, &y, &w, &h );
 
diff --git a/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c
index 819d1a3..c1add3e 100644
--- a/MP/code/ui/ui_main.c
+++ b/MP/code/ui/ui_main.c
@@ -1747,8 +1747,24 @@ static void UI_DrawMapCinematic( rectDef_t *rect, float scale, vec4_t color, qbo
 		}
 		if ( uiInfo.mapList[map].cinematic >= 0 ) {
 			trap_CIN_RunCinematic( uiInfo.mapList[map].cinematic );
-			// FIXME:MAN-AT-ARMS Scale this
-			trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h );
+
+			if ( ui_fixedAspect.integer ) {
+				// HACK HACK HACK - FIXME: x,y scaling
+				if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+					float scaledw = rect->w * ( 480.0 / 640.0 );
+
+					trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, 103, rect->y, scaledw, rect->h );
+				} else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+					float scaledh = rect->h * ( 480.0 / 640.0 );
+
+					trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, 163, rect->w, scaledh );
+				} else {
+					trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h );
+				}
+			} else {
+				trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h );
+			}
+
 			trap_CIN_DrawCinematic( uiInfo.mapList[map].cinematic );
 		} else {
 			uiInfo.mapList[map].cinematic = -2;
@@ -1875,8 +1891,24 @@ static void UI_DrawNetMapCinematic( rectDef_t *rect, float scale, vec4_t color )
 
 	if ( uiInfo.serverStatus.currentServerCinematic >= 0 ) {
 		trap_CIN_RunCinematic( uiInfo.serverStatus.currentServerCinematic );
-		// FIXME:MAN-AT-ARMS Scale this
-		trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h );
+
+		if ( ui_fixedAspect.integer ) {
+			// HACK HACK HACK - FIXME: x,y scaling
+			if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+				float scaledw = rect->w * ( 480.0 / 640.0 );
+
+				trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, 469, rect->y, scaledw, rect->h );
+			} else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+				float scaledh = rect->h * ( 480.0 / 640.0 );
+
+				trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, 150, rect->w, scaledh );
+			} else {
+				trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h );
+			}
+		} else {
+			trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h );
+		}
+
 		trap_CIN_DrawCinematic( uiInfo.serverStatus.currentServerCinematic );
 	} else {
 		UI_DrawNetMapPreview( rect, scale, color );
@@ -6738,8 +6770,21 @@ static void UI_StopCinematic( int handle ) {
 }
 
 static void UI_DrawCinematic( int handle, float x, float y, float w, float h ) {
-	//FIXME:MAN-AT-ARMS Scale this
-	trap_CIN_SetExtents( handle, x, y, w, h );
+	if ( ui_fixedAspect.integer ) {
+		// HACK HACK HACK - FIXME: x,y scaling
+		if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+			float scaledw = w * ( 480.0 / 640.0 );
+
+			trap_CIN_SetExtents( handle, 202, y, scaledw, h );
+		} else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+			float scaledh = h * ( 480.0 / 640.0 );
+
+			trap_CIN_SetExtents( handle, x, 190, w, scaledh );
+		} else {
+			trap_CIN_SetExtents( handle, x, y, w, h );
+		}
+	}
+	//trap_CIN_SetExtents( handle, x, y, w, h );
 	trap_CIN_DrawCinematic( handle );
 }
 
diff --git a/SP/code/cgame/cg_draw.c b/SP/code/cgame/cg_draw.c
index fac6979..06e4986 100644
--- a/SP/code/cgame/cg_draw.c
+++ b/SP/code/cgame/cg_draw.c
@@ -1830,8 +1830,8 @@ static void CG_DrawDisconnect( void ) {
 		CG_SetScreenPlacement(PLACE_RIGHT, PLACE_BOTTOM);
 	}
 
-	x = 640 - 48;
-	y = 480 - 48;
+	x = 640 - 52;
+	y = 480 - 240;
 
 	CG_DrawPic( x, y, 48, 48, trap_R_RegisterShader( "gfx/2d/net.tga" ) );
 }
@@ -1865,8 +1865,8 @@ static void CG_DrawLagometer( void ) {
 	//
 	// draw the graph
 	//
-	x = 640 - 48;
-	y = 480 - 48;
+	x = 640 - 52;
+	y = 480 - 240;
 
 	trap_R_SetColor( NULL );
 	CG_DrawPic( x, y, 48, 48, cgs.media.lagometerShader );

-- 
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