diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_local.h b/Projects/Android/jni/OpenJK/code/cgame/cg_local.h index 76455f8..c918508 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_local.h +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_local.h @@ -820,7 +820,7 @@ void CG_CaptionTextStop( void ); // cg_text.c // void CG_DrawScrollText( void ); -void CG_DrawCaptionText( void ); +void CG_DrawCaptionText( bool inImmersiveCamera ); void CG_DrawCenterString( void ); diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp index a1b8282..d1141c4 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp @@ -2502,10 +2502,12 @@ static void CG_DrawAmmoWarning( void ) { //s = "LOW AMMO WARNING"; } - int tempX = 320 - w/2; + w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE); + int offset = w / 2; + int tempX = SCREEN_WIDTH / 2; int tempY = 64; CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL ); - cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE); + cgi_R_Font_DrawString(tempX - offset, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE); } //--------------------------------------- @@ -2728,9 +2730,7 @@ static void CG_Draw2D( void ) CG_DrawScrollText(); - if (!vr->immersive_cinematics) { - CG_DrawCaptionText(); - } + CG_DrawCaptionText( in_camera && vr->immersive_cinematics ); if ( in_camera ) {//still draw the saber clash flare, but nothing else @@ -2842,17 +2842,19 @@ static void CG_Draw2D( void ) cgi_SP_GetStringTextString( "INGAME_DATAPAD_UPDATED", text, sizeof(text) ); int x_pos = 0; + int offset = 0; y_pos = (SCREEN_HEIGHT/2)+80; if ( cg_missionInfoCentered.integer ) { w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE); - x_pos = (SCREEN_WIDTH/2)-(w/2); + offset = w / 2; + x_pos = SCREEN_WIDTH / 2; } int tempX = x_pos; int tempY = y_pos; CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL ); - cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE); + cgi_R_Font_DrawString(tempX - offset, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE); if (cg_updatedDataPadForcePower1.integer) { @@ -2861,13 +2863,14 @@ static void CG_Draw2D( void ) if ( cg_missionInfoCentered.integer ) { w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE); - x_pos = (SCREEN_WIDTH/2)-(w/2); + offset = w / 2; + x_pos = SCREEN_WIDTH / 2; } tempX = x_pos; tempY = y_pos; CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL ); - cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE); + cgi_R_Font_DrawString(tempX - offset, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE); } if (cg_updatedDataPadObjective.integer) @@ -2877,13 +2880,14 @@ static void CG_Draw2D( void ) if ( cg_missionInfoCentered.integer ) { w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE); - x_pos = (SCREEN_WIDTH/2)-(w/2); + offset = w / 2; + x_pos = SCREEN_WIDTH / 2; } tempX = x_pos; tempY = y_pos; CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL ); - cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE); + cgi_R_Font_DrawString(tempX - offset, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE); } // if (cent->gent->client->sess.missionObjectivesShown<3) diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp index cc227ae..865d057 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp @@ -27,7 +27,7 @@ along with this program; if not, see . void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) { - if (cg.drawingHUD && !vr->cin_camera && !vr->using_screen_layer) + if (cg.drawingHUD && (!vr->cin_camera || vr->immersive_cinematics) && !vr->using_screen_layer) { float screenXScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? cg_hudScale.value : 1.0f); float screenYScale = 1.0f / (cg.drawingHUD == CG_HUD_SCALED ? cg_hudScale.value : 1.25f); diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h index 2699444..5e1b85a 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h @@ -801,7 +801,7 @@ void CG_GameText(int y ); // cg_text.c // void CG_DrawScrollText( void ); -void CG_DrawCaptionText( void ); +void CG_DrawCaptionText( bool inImmersiveCamera ); void CG_DrawCenterString( void ); diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp index 8873650..f6b767e 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp @@ -259,7 +259,7 @@ void CG_CaptionText( const char *str, int sound) if (in_camera) { cg.captionTextY = SCREEN_HEIGHT - (client_camera.bar_height_dest/2); // ths is now a centre'd Y, not a start Y } else { //get above the hud - cg.captionTextY = (int) (0.88f*((float)SCREEN_HEIGHT - (float)fontHeight * 1.5f)); // do NOT move this, it has to fit in between the weapon HUD and the datapad update. + cg.captionTextY = (int) (0.84f*((float)SCREEN_HEIGHT - (float)fontHeight * 1.5f)); // do NOT move this, it has to fit in between the weapon HUD and the datapad update. } cg.captionTextCurrentLine = 0; @@ -385,7 +385,7 @@ void CG_CaptionText( const char *str, int sound) } -void CG_DrawCaptionText(void) +void CG_DrawCaptionText( bool inImmersiveCamera ) { int i; int x, y, w; @@ -438,22 +438,24 @@ void CG_DrawCaptionText(void) // Set Y of the first line (varies if only printing one line of text) // (this all works, please don't mess with it) - const int fontHeight = (int) ((cgi_Language_IsAsian() ? 1.4f : 1.0f) * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontSmall, fFontScale * FONT_SCALE)); + const int fontHeight = (int) (3.0f * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontSmall, fFontScale * FONT_SCALE)); const bool bPrinting2Lines = !!(cg.captionText[ cg.captionTextCurrentLine+1 ][0]); y = cg.captionTextY - ( (float)fontHeight * (bPrinting2Lines ? 1 : 0.5f)); // captionTextY was a centered Y pos, not a top one y -= cgi_Language_IsAsian() ? 0 : 4; + if (inImmersiveCamera) { + y -= 100; + } for (i= cg.captionTextCurrentLine;i< cg.captionTextCurrentLine + 2;++i) { w = cgi_R_Font_StrLenPixels(cg.captionText[i], cgs.media.qhFontSmall, fFontScale * FONT_SCALE); if (w) { - x = (SCREEN_WIDTH-w) / 2; - - int tempX = x; + int offset = w / 2; + int tempX = SCREEN_WIDTH / 2; int tempY = y; CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL ); - cgi_R_Font_DrawString(tempX, tempY, cg.captionText[i], textcolor_caption, cgs.media.qhFontSmall, -1, fFontScale * FONT_SCALE); + cgi_R_Font_DrawString(tempX - offset, tempY, cg.captionText[i], textcolor_caption, cgs.media.qhFontSmall, -1, fFontScale * FONT_SCALE); y += fontHeight; } } @@ -644,12 +646,11 @@ void CG_DrawScrollText(void) // w = cgi_R_Font_StrLenPixels(cg.printText[i], cgs.media.qhFontMedium, 1.0f); // if (w) { - x = (SCREEN_WIDTH - giScrollTextPixelWidth) / 2; - - int tempX = x; + int offset = giScrollTextPixelWidth / 2; + int tempX = SCREEN_WIDTH / 2; int tempY = y; CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL ); - cgi_R_Font_DrawString(tempX, tempY, cg.printText[i], textcolor_scroll, cgs.media.qhFontSmall, -1, FONT_SCALE); + cgi_R_Font_DrawString(tempX - offset, tempY, cg.printText[i], textcolor_scroll, cgs.media.qhFontSmall, -1, FONT_SCALE); y += fontHeight; } } @@ -769,12 +770,11 @@ void CG_DrawCenterString( void ) w = cgi_R_Font_StrLenPixels(linebuffer, cgs.media.qhFontSmall, FONT_SCALE); - x = ( SCREEN_WIDTH - w ) / 2; - - int tempX = x; + int offset = w / 2; + int tempX = SCREEN_WIDTH / 2; int tempY = y; CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL ); - cgi_R_Font_DrawString(tempX, tempY,linebuffer, textcolor_center, cgs.media.qhFontSmall, -1, FONT_SCALE); + cgi_R_Font_DrawString(tempX - offset, tempY,linebuffer, textcolor_center, cgs.media.qhFontSmall, -1, FONT_SCALE); y += fontHeight;