From 80f4e9520af7aa7b68ca460b4cfddd861af3b645 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 7 Mar 2023 22:52:55 +0000 Subject: [PATCH] Improved font scaling --- Projects/Android/jni/OpenJK/code/cgame/cg_local.h | 4 ++-- Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp | 6 +++--- Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp | 4 +++- Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp | 2 +- Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h | 4 ++-- Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp | 2 +- Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp | 4 ++-- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_local.h b/Projects/Android/jni/OpenJK/code/cgame/cg_local.h index f6b7241..76455f8 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_local.h +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_local.h @@ -50,7 +50,7 @@ along with this program; if not, see . #define STEP_TIME 200 #define DUCK_TIME 100 #define PAIN_TWITCH_TIME 200 -#define WEAPON_SELECT_TIME 1400 +#define WEAPON_SELECT_TIME 1900 #define ITEM_SCALEUP_TIME 1000 // Zoom vars #define ZOOM_TIME 150 // not currently used? @@ -780,7 +780,7 @@ Ghoul2 Insert End #define CG_PULSE 0x00004000 -#define FONT_SCALE 0.5f +#define FONT_SCALE (1.0f / cg_hudScale.value) void CG_DrawRect( float x, float y, float width, float height, float size, const float *color ); void CG_FillRect( float x, float y, float width, float height, const float *color ); diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp index c8c34a3..b88f6fe 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp @@ -276,9 +276,9 @@ void CG_CaptionText( const char *str, int sound) s=(const char*)&text; // tai... -// s="Áɨô­ôº¸³Õ¤h¤w¸g¦w¥þ¤F¡A§Ú¤]§â©Ò¦³µo²{³ø§iµ¹¡u°Ó©±¡v¡C«Ü¤£©¯¦a¡A·ç¤hĵ§½¦³¨Ç¥Õèµo²{¤F¤@¨Çª¬ªp¡A·Ç³Æ¦b¾÷³õ¶e®·¨È¾ú¦è¡E¯Ç§J·ç±o¡C¥L°°¸Ë¦¨¥~¥æ¨Ï¸`¡A¬ï¹L¤F¼h¼h¨¾³Æ¡C²{¦b¥L´¤¦³¤H½è¡A¨Ã¥B«Â¯Ù­n´²¼½¯f¬r¡C®Ú¾Ú³Ì·sªº³ø§i¡A¯Ç§J·ç±o¥H¤Î¥LªºÄҦФw¸g§¹¥þ¦û¾Ú¤F¾÷³õ¡C§Ú¨ü©R¨Ó°l®·¯Ç§J·ç±o¥H¤Î±Ï¥X©Ò¦³¤H½è¡C³o¨Ã¤£®e©ö¡C"; +// s="�ɨ������դh�w�g�w���F�A�ڤ]��Ҧ��o�{���i���u�ө��v�C�ܤ����a�A��hĵ�����ǥ�è�o�{�F�@�Ǫ��p�A�dzƦb�����e���Ⱦ���E�ǧJ��o�C�L���˦��~��ϸ`�A��L�F�h�h���ơC�{�b�L�����H��A�åB�¯٭n�����f�r�C�ھڳ̷s�����i�A�ǧJ��o�H�ΥL���ҦФw�g�������ڤF�����C�ڨ��R�Ӱl���ǧJ��o�H�αϥX�Ҧ��H��C�o��e���C"; // kor... -// s="Wp:¼îŸÀÓÀÌ´Ù ¸Ö¸°. ±×µéÀÌ ¸»ÇÑ´ë·Î ³×°¡ ÀßÇÒÁö ±â´ëÇÏ°Ú´Ù.¼îŸÀÓÀÌ´Ù ¸Ö¸°. ±×µéÀÌ ¸»ÇÑ´ë·Î ³×°¡ ÀßÇÒÁö ±â´ëÇÏ°Ú´Ù."; +// s="Wp:��Ÿ���̴� �ָ�. �׵��� ���Ѵ�� �װ� ������ ����ϰڴ�.��Ÿ���̴� �ָ�. �׵��� ���Ѵ�� �װ� ������ ����ϰڴ�."; holds = s; int iPlayingTimeMS = cgi_S_GetSampleLength(sound); @@ -733,7 +733,7 @@ void CG_DrawCenterString( void ) return; } - color = CG_FadeColor( cg.centerPrintTime, 1000 * 3 ); + color = CG_FadeColor( cg.centerPrintTime, 1000 * 2 ); if ( !color ) { return; } diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp index c410c08..2e7bf87 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp @@ -2212,7 +2212,9 @@ void CG_DrawWeaponSelect( void ) { int w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f); int x = ( SCREEN_WIDTH - w ) / 2; - cgi_R_Font_DrawString(x, (SCREEN_HEIGHT - 24)+yOffset, text, textColor, cgs.media.qhFontSmall, -1, 1.0f); + int y = (SCREEN_HEIGHT - 24); + CG_AdjustFrom640Int(&x, &y, NULL, NULL); + cgi_R_Font_DrawString(x, y, text, textColor, cgs.media.qhFontSmall, -1, FONT_SCALE); } } diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp index 798229d..cc227ae 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp @@ -568,5 +568,5 @@ void CG_DrawProportionalString( int x, int y, const char* str, int style, vec4_t { //assert(!style);//call this directly if you need style (OR it into the font handle) CG_AdjustFrom640Int(&x, &y, NULL, NULL); - cgi_R_Font_DrawString (x, y, str, color, cgs.media.qhFontMedium, -1, 1.0f); + cgi_R_Font_DrawString (x, y, str, color, cgs.media.qhFontMedium, -1, FONT_SCALE); } \ No newline at end of file diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h index abf19fc..2699444 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h @@ -50,7 +50,7 @@ along with this program; if not, see . #define STEP_TIME 200 #define DUCK_TIME 100 #define PAIN_TWITCH_TIME 200 -#define WEAPON_SELECT_TIME 1400 +#define WEAPON_SELECT_TIME 1900 #define ITEM_SCALEUP_TIME 1000 // Zoom vars #define ZOOM_TIME 150 // not currently used? @@ -760,7 +760,7 @@ Ghoul2 Insert End #define CG_UNDERLINE 0x00008000 #define CG_TINYFONT 0x00010000 -#define FONT_SCALE 0.5f +#define FONT_SCALE (1.0f / cg_hudScale.value) void CG_FillRect( float x, float y, float width, float height, const float *color ); void CG_Scissor( float x, float y, float width, float height); diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp index 5e763cc..8873650 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp @@ -727,7 +727,7 @@ void CG_DrawCenterString( void ) return; } - color = CG_FadeColor( cg.centerPrintTime, 1000 * 3 ); + color = CG_FadeColor( cg.centerPrintTime, 1000 * 2 ); if ( !color ) { return; } diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp index 078c4fc..bb5e124 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp @@ -811,7 +811,7 @@ static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origi int w = cgi_R_Font_StrLenPixels(vr->test_name, cgs.media.qhFontSmall, 1.0f); int x = ( SCREEN_WIDTH - w ) / 2; - cgi_R_Font_DrawString(x, (SCREEN_HEIGHT / 2), vr->test_name, colorTable[CT_ICON_BLUE], cgs.media.qhFontSmall, -1, 1.0f); + cgi_R_Font_DrawString(x, (SCREEN_HEIGHT / 2), vr->test_name, colorTable[CT_ICON_BLUE], cgs.media.qhFontSmall, -1, FONT_SCALE); } else { if (ps->weapon != 0) { @@ -2181,7 +2181,7 @@ void CG_DrawWeaponSelect( void ) int x = ( SCREEN_WIDTH - w ) / 2; int y = (SCREEN_HEIGHT - 24); CG_AdjustFrom640Int(&x, &y, NULL, NULL); - cgi_R_Font_DrawString(x, y, text, textColor, cgs.media.qhFontSmall, -1, 1.0f); + cgi_R_Font_DrawString(x, y, text, textColor, cgs.media.qhFontSmall, -1, FONT_SCALE); } }