mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 23:02:01 +00:00
Make Team Arena UI aspect correct in widescreen
This commit is contained in:
parent
d9c2e91919
commit
21eeaee9c8
2 changed files with 25 additions and 21 deletions
|
@ -420,18 +420,10 @@ Adjusted for resolution and screen aspect ratio
|
||||||
*/
|
*/
|
||||||
void UI_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
void UI_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
// expect valid pointers
|
// expect valid pointers
|
||||||
#if 0
|
*x = *x * uiInfo.uiDC.xscale + uiInfo.uiDC.bias;
|
||||||
*x = *x * uiInfo.uiDC.scale + uiInfo.uiDC.bias;
|
|
||||||
*y *= uiInfo.uiDC.scale;
|
|
||||||
*w *= uiInfo.uiDC.scale;
|
|
||||||
*h *= uiInfo.uiDC.scale;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*x *= uiInfo.uiDC.xscale;
|
|
||||||
*y *= uiInfo.uiDC.yscale;
|
*y *= uiInfo.uiDC.yscale;
|
||||||
*w *= uiInfo.uiDC.xscale;
|
*w *= uiInfo.uiDC.xscale;
|
||||||
*h *= uiInfo.uiDC.yscale;
|
*h *= uiInfo.uiDC.yscale;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname ) {
|
void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname ) {
|
||||||
|
|
|
@ -129,6 +129,7 @@ static void UI_ParseTeamInfo(const char *teamFile);
|
||||||
static const char *UI_SelectedMap(int index, int *actual);
|
static const char *UI_SelectedMap(int index, int *actual);
|
||||||
static const char *UI_SelectedHead(int index, int *actual);
|
static const char *UI_SelectedHead(int index, int *actual);
|
||||||
static int UI_GetIndexFromSelection(int actual);
|
static int UI_GetIndexFromSelection(int actual);
|
||||||
|
static void UI_DrawCinematic(int handle, float x, float y, float w, float h);
|
||||||
|
|
||||||
int ProcessNewUI( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 );
|
int ProcessNewUI( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 );
|
||||||
|
|
||||||
|
@ -1110,8 +1111,7 @@ static void UI_DrawClanCinematic(rectDef_t *rect, float scale, vec4_t color) {
|
||||||
}
|
}
|
||||||
if (uiInfo.teamList[i].cinematic >= 0) {
|
if (uiInfo.teamList[i].cinematic >= 0) {
|
||||||
trap_CIN_RunCinematic(uiInfo.teamList[i].cinematic);
|
trap_CIN_RunCinematic(uiInfo.teamList[i].cinematic);
|
||||||
trap_CIN_SetExtents(uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h);
|
UI_DrawCinematic(uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h);
|
||||||
trap_CIN_DrawCinematic(uiInfo.teamList[i].cinematic);
|
|
||||||
} else {
|
} else {
|
||||||
trap_R_SetColor( color );
|
trap_R_SetColor( color );
|
||||||
UI_DrawHandlePic( rect->x, rect->y, rect->w, rect->h, uiInfo.teamList[i].teamIcon_Metal);
|
UI_DrawHandlePic( rect->x, rect->y, rect->w, rect->h, uiInfo.teamList[i].teamIcon_Metal);
|
||||||
|
@ -1132,8 +1132,7 @@ 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) );
|
uiInfo.previewMovie = trap_CIN_PlayCinematic(va("%s.roq", uiInfo.movieList[uiInfo.movieIndex]), 0, 0, 0, 0, (CIN_loop | CIN_silent) );
|
||||||
if (uiInfo.previewMovie >= 0) {
|
if (uiInfo.previewMovie >= 0) {
|
||||||
trap_CIN_RunCinematic(uiInfo.previewMovie);
|
trap_CIN_RunCinematic(uiInfo.previewMovie);
|
||||||
trap_CIN_SetExtents(uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h);
|
UI_DrawCinematic(uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h);
|
||||||
trap_CIN_DrawCinematic(uiInfo.previewMovie);
|
|
||||||
} else {
|
} else {
|
||||||
uiInfo.previewMovie = -2;
|
uiInfo.previewMovie = -2;
|
||||||
}
|
}
|
||||||
|
@ -1256,8 +1255,7 @@ static void UI_DrawMapCinematic(rectDef_t *rect, float scale, vec4_t color, qboo
|
||||||
}
|
}
|
||||||
if (uiInfo.mapList[map].cinematic >= 0) {
|
if (uiInfo.mapList[map].cinematic >= 0) {
|
||||||
trap_CIN_RunCinematic(uiInfo.mapList[map].cinematic);
|
trap_CIN_RunCinematic(uiInfo.mapList[map].cinematic);
|
||||||
trap_CIN_SetExtents(uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h);
|
UI_DrawCinematic(uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h);
|
||||||
trap_CIN_DrawCinematic(uiInfo.mapList[map].cinematic);
|
|
||||||
} else {
|
} else {
|
||||||
uiInfo.mapList[map].cinematic = -2;
|
uiInfo.mapList[map].cinematic = -2;
|
||||||
}
|
}
|
||||||
|
@ -1337,8 +1335,7 @@ static void UI_DrawNetMapCinematic(rectDef_t *rect, float scale, vec4_t color) {
|
||||||
|
|
||||||
if (uiInfo.serverStatus.currentServerCinematic >= 0) {
|
if (uiInfo.serverStatus.currentServerCinematic >= 0) {
|
||||||
trap_CIN_RunCinematic(uiInfo.serverStatus.currentServerCinematic);
|
trap_CIN_RunCinematic(uiInfo.serverStatus.currentServerCinematic);
|
||||||
trap_CIN_SetExtents(uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h);
|
UI_DrawCinematic(uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h);
|
||||||
trap_CIN_DrawCinematic(uiInfo.serverStatus.currentServerCinematic);
|
|
||||||
} else {
|
} else {
|
||||||
UI_DrawNetMapPreview(rect, scale, color);
|
UI_DrawNetMapPreview(rect, scale, color);
|
||||||
}
|
}
|
||||||
|
@ -4974,6 +4971,15 @@ static void UI_StopCinematic(int handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UI_DrawCinematic(int handle, float x, float y, float w, float h) {
|
static void UI_DrawCinematic(int handle, float x, float y, float w, float h) {
|
||||||
|
// adjust coords to get correct placement in wide screen
|
||||||
|
UI_AdjustFrom640( &x, &y, &w, &h );
|
||||||
|
|
||||||
|
// CIN_SetExtents takes stretched 640x480 virtualized coords
|
||||||
|
x *= SCREEN_WIDTH / (float)uiInfo.uiDC.glconfig.vidWidth;
|
||||||
|
w *= SCREEN_WIDTH / (float)uiInfo.uiDC.glconfig.vidWidth;
|
||||||
|
y *= SCREEN_HEIGHT / (float)uiInfo.uiDC.glconfig.vidHeight;
|
||||||
|
h *= SCREEN_HEIGHT / (float)uiInfo.uiDC.glconfig.vidHeight;
|
||||||
|
|
||||||
trap_CIN_SetExtents(handle, x, y, w, h);
|
trap_CIN_SetExtents(handle, x, y, w, h);
|
||||||
trap_CIN_DrawCinematic(handle);
|
trap_CIN_DrawCinematic(handle);
|
||||||
}
|
}
|
||||||
|
@ -5077,6 +5083,7 @@ void _UI_Init( qboolean inGameLoad ) {
|
||||||
if ( uiInfo.uiDC.glconfig.vidWidth * 480 > uiInfo.uiDC.glconfig.vidHeight * 640 ) {
|
if ( uiInfo.uiDC.glconfig.vidWidth * 480 > uiInfo.uiDC.glconfig.vidHeight * 640 ) {
|
||||||
// wide screen
|
// wide screen
|
||||||
uiInfo.uiDC.bias = 0.5 * ( uiInfo.uiDC.glconfig.vidWidth - ( uiInfo.uiDC.glconfig.vidHeight * (640.0/480.0) ) );
|
uiInfo.uiDC.bias = 0.5 * ( uiInfo.uiDC.glconfig.vidWidth - ( uiInfo.uiDC.glconfig.vidHeight * (640.0/480.0) ) );
|
||||||
|
uiInfo.uiDC.xscale = uiInfo.uiDC.yscale;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// no wide screen
|
// no wide screen
|
||||||
|
@ -5234,12 +5241,17 @@ UI_MouseEvent
|
||||||
*/
|
*/
|
||||||
void _UI_MouseEvent( int dx, int dy )
|
void _UI_MouseEvent( int dx, int dy )
|
||||||
{
|
{
|
||||||
|
int bias;
|
||||||
|
|
||||||
|
// convert X bias to 640 coords
|
||||||
|
bias = uiInfo.uiDC.bias / uiInfo.uiDC.xscale;
|
||||||
|
|
||||||
// update mouse screen position
|
// update mouse screen position
|
||||||
uiInfo.uiDC.cursorx += dx;
|
uiInfo.uiDC.cursorx += dx;
|
||||||
if (uiInfo.uiDC.cursorx < 0)
|
if (uiInfo.uiDC.cursorx < -bias)
|
||||||
uiInfo.uiDC.cursorx = 0;
|
uiInfo.uiDC.cursorx = -bias;
|
||||||
else if (uiInfo.uiDC.cursorx > SCREEN_WIDTH)
|
else if (uiInfo.uiDC.cursorx > SCREEN_WIDTH+bias)
|
||||||
uiInfo.uiDC.cursorx = SCREEN_WIDTH;
|
uiInfo.uiDC.cursorx = SCREEN_WIDTH+bias;
|
||||||
|
|
||||||
uiInfo.uiDC.cursory += dy;
|
uiInfo.uiDC.cursory += dy;
|
||||||
if (uiInfo.uiDC.cursory < 0)
|
if (uiInfo.uiDC.cursory < 0)
|
||||||
|
|
Loading…
Reference in a new issue