[iortcw] 476/497: All: Fix scaling for cinematics when using cg_fixedAspect
Simon McVittie
smcv at debian.org
Fri Sep 8 10:37:59 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 7529771cf7f8c31d154ea1953571589903fd60f5
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date: Sat Dec 12 18:05:26 2015 -0500
All: Fix scaling for cinematics when using cg_fixedAspect
---
MP/code/ui/ui_main.c | 67 +++++++++++++++++++++++------
SP/code/ui/ui_main.c | 119 ++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 166 insertions(+), 20 deletions(-)
diff --git a/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c
index c1add3e..1b8fa7f 100644
--- a/MP/code/ui/ui_main.c
+++ b/MP/code/ui/ui_main.c
@@ -1600,8 +1600,25 @@ static void UI_DrawClanCinematic( rectDef_t *rect, float scale, vec4_t color ) {
}
if ( uiInfo.teamList[i].cinematic >= 0 ) {
trap_CIN_RunCinematic( uiInfo.teamList[i].cinematic );
- //FIXME:MAN-AT-ARMS Scale this
- trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h );
+
+ if ( ui_fixedAspect.integer ) {
+ if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
+ float scaledw = rect->w * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, scaledx, rect->y, scaledw, rect->h );
+ } else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
+ float scaledh = rect->h * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, rect->x, scaledy, rect->w, scaledh );
+ } else {
+ trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h );
+ }
+ } else {
+ trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h );
+ }
+
trap_CIN_DrawCinematic( uiInfo.teamList[i].cinematic );
} else {
uiInfo.teamList[i].cinematic = -2;
@@ -1620,8 +1637,25 @@ static void UI_DrawPreviewCinematic( rectDef_t *rect, float scale, vec4_t color
uiInfo.previewMovie = trap_CIN_PlayCinematic( va( "%s.roq", uiInfo.movieList[uiInfo.movieIndex] ), 0, 0, 0, 0, ( CIN_loop | CIN_silent ) );
if ( uiInfo.previewMovie >= 0 ) {
trap_CIN_RunCinematic( uiInfo.previewMovie );
- //FIXME:MAN-AT-ARMS Scale this
- trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+
+ if ( ui_fixedAspect.integer ) {
+ if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
+ float scaledw = rect->w * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.previewMovie, scaledx, rect->y, scaledw, rect->h );
+ } else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
+ float scaledh = rect->h * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, scaledy, rect->w, scaledh );
+ } else {
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+ }
+ } else {
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+ }
+
trap_CIN_DrawCinematic( uiInfo.previewMovie );
} else {
uiInfo.previewMovie = -2;
@@ -1749,15 +1783,16 @@ static void UI_DrawMapCinematic( rectDef_t *rect, float scale, vec4_t color, qbo
trap_CIN_RunCinematic( uiInfo.mapList[map].cinematic );
if ( ui_fixedAspect.integer ) {
- // HACK HACK HACK - FIXME: x,y scaling
if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
float scaledw = rect->w * ( 480.0 / 640.0 );
- trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, 103, rect->y, scaledw, rect->h );
+ trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, scaledx, rect->y, scaledw, rect->h );
} else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
float scaledh = rect->h * ( 480.0 / 640.0 );
- trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, 163, rect->w, scaledh );
+ trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, scaledy, rect->w, scaledh );
} else {
trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h );
}
@@ -1893,15 +1928,16 @@ static void UI_DrawNetMapCinematic( rectDef_t *rect, float scale, vec4_t color )
trap_CIN_RunCinematic( uiInfo.serverStatus.currentServerCinematic );
if ( ui_fixedAspect.integer ) {
- // HACK HACK HACK - FIXME: x,y scaling
if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
float scaledw = rect->w * ( 480.0 / 640.0 );
- trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, 469, rect->y, scaledw, rect->h );
+ trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, scaledx, rect->y, scaledw, rect->h );
} else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
float scaledh = rect->h * ( 480.0 / 640.0 );
- trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, 150, rect->w, scaledh );
+ trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, scaledy, rect->w, scaledh );
} else {
trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h );
}
@@ -6771,20 +6807,23 @@ static void UI_StopCinematic( int handle ) {
static void UI_DrawCinematic( int handle, float x, float y, float w, float h ) {
if ( ui_fixedAspect.integer ) {
- // HACK HACK HACK - FIXME: x,y scaling
if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
float scaledw = w * ( 480.0 / 640.0 );
- trap_CIN_SetExtents( handle, 202, y, scaledw, h );
+ trap_CIN_SetExtents( handle, scaledx, y, scaledw, h );
} else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
float scaledh = h * ( 480.0 / 640.0 );
- trap_CIN_SetExtents( handle, x, 190, w, scaledh );
+ trap_CIN_SetExtents( handle, x, scaledy, w, scaledh );
} else {
trap_CIN_SetExtents( handle, x, y, w, h );
}
+ } 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/ui/ui_main.c b/SP/code/ui/ui_main.c
index 89f84b5..bc2f702 100644
--- a/SP/code/ui/ui_main.c
+++ b/SP/code/ui/ui_main.c
@@ -1369,7 +1369,25 @@ static void UI_DrawClanCinematic( rectDef_t *rect, float scale, vec4_t color ) {
}
if ( uiInfo.teamList[i].cinematic >= 0 ) {
trap_CIN_RunCinematic( uiInfo.teamList[i].cinematic );
- trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h );
+
+ if ( ui_fixedAspect.integer ) {
+ if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
+ float scaledw = rect->w * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, scaledx, rect->y, scaledw, rect->h );
+ } else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
+ float scaledh = rect->h * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, rect->x, scaledy, rect->w, scaledh );
+ } else {
+ trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h );
+ }
+ } else {
+ trap_CIN_SetExtents( uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h );
+ }
+
trap_CIN_DrawCinematic( uiInfo.teamList[i].cinematic );
} else {
uiInfo.teamList[i].cinematic = -2;
@@ -1389,7 +1407,25 @@ static void UI_DrawPregameCinematic( rectDef_t *rect, float scale, vec4_t color
uiInfo.previewMovie = trap_CIN_PlayCinematic( va( "%s.roq", "assault" ), 0, 0, 0, 0, ( CIN_loop | CIN_silent | CIN_system ) );
if ( uiInfo.previewMovie >= 0 ) {
trap_CIN_RunCinematic( uiInfo.previewMovie );
- trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+
+ if ( ui_fixedAspect.integer ) {
+ if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
+ float scaledw = rect->w * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.previewMovie, scaledx, rect->y, scaledw, rect->h );
+ } else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
+ float scaledh = rect->h * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, scaledy, rect->w, scaledh );
+ } else {
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+ }
+ } else {
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+ }
+
trap_CIN_DrawCinematic( uiInfo.previewMovie );
} else {
uiInfo.previewMovie = -2;
@@ -1403,7 +1439,25 @@ static void UI_DrawPreviewCinematic( rectDef_t *rect, float scale, vec4_t color
uiInfo.previewMovie = trap_CIN_PlayCinematic( va( "%s.roq", uiInfo.movieList[uiInfo.movieIndex] ), 0, 0, 0, 0, ( CIN_loop | CIN_silent ) );
if ( uiInfo.previewMovie >= 0 ) {
trap_CIN_RunCinematic( uiInfo.previewMovie );
- trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+
+ if ( ui_fixedAspect.integer ) {
+ if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
+ float scaledw = rect->w * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.previewMovie, scaledx, rect->y, scaledw, rect->h );
+ } else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
+ float scaledh = rect->h * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, scaledy, rect->w, scaledh );
+ } else {
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+ }
+ } else {
+ trap_CIN_SetExtents( uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h );
+ }
+
trap_CIN_DrawCinematic( uiInfo.previewMovie );
} else {
uiInfo.previewMovie = -2;
@@ -1715,7 +1769,25 @@ 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 );
- trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h );
+
+ if ( ui_fixedAspect.integer ) {
+ if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
+ float scaledw = rect->w * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, scaledx, rect->y, scaledw, rect->h );
+ } else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
+ float scaledh = rect->h * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.mapList[map].cinematic, rect->x, scaledy, 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;
@@ -1833,7 +1905,25 @@ static void UI_DrawNetMapCinematic( rectDef_t *rect, float scale, vec4_t color )
if ( uiInfo.serverStatus.currentServerCinematic >= 0 ) {
trap_CIN_RunCinematic( uiInfo.serverStatus.currentServerCinematic );
- trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h );
+
+ if ( ui_fixedAspect.integer ) {
+ if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = rect->x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
+ float scaledw = rect->w * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, scaledx, rect->y, scaledw, rect->h );
+ } else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = rect->y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
+ float scaledh = rect->h * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( uiInfo.serverStatus.currentServerCinematic, rect->x, scaledy, 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 );
@@ -6514,7 +6604,24 @@ static void UI_StopCinematic( int handle ) {
}
static void UI_DrawCinematic( int handle, float x, float y, float w, float h ) {
- trap_CIN_SetExtents( handle, x, y, w, h );
+ if ( ui_fixedAspect.integer ) {
+ if ( DC->glconfig.vidWidth * 480.0 > DC->glconfig.vidHeight * 640.0 ) {
+ float scaledx = x * ( 480.0 / 640.0 ) + ( DC->xBias / DC->xscaleStretch);
+ float scaledw = w * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( handle, scaledx, y, scaledw, h );
+ } else if ( DC->glconfig.vidWidth * 480.0 < DC->glconfig.vidHeight * 640.0 ) {
+ float scaledy = y * ( 480.0 / 640.0 ) + ( DC->yBias / DC->yscaleStretch);
+ float scaledh = h * ( 480.0 / 640.0 );
+
+ trap_CIN_SetExtents( handle, x, scaledy, w, scaledh );
+ } else {
+ trap_CIN_SetExtents( handle, x, y, w, h );
+ }
+ } else {
+ trap_CIN_SetExtents( handle, x, y, w, h );
+ }
+
trap_CIN_DrawCinematic( handle );
}
--
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