Skip to content

Commit 468c3aa

Browse files
committed
added an option to change scale of center string (cg_centerScale)
1 parent a1f2e4b commit 468c3aa

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

codemp/cgame/cg_draw.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4766,10 +4766,11 @@ qboolean BG_IsWhiteSpace( char c )
47664766
static void CG_DrawCenterString( void ) {
47674767
char *start;
47684768
int l, len;
4769-
int x, y, w;
4770-
int h;
4769+
float x, y;
4770+
int w, h;
47714771
float *color;
4772-
const float scale = 1.0; //0.5
4772+
const float scale = Q_max(cg_centerScale.value, 0.0f);
4773+
const float lineSpace = 6 * scale;
47734774

47744775
if ( !cg.centerPrintTime ) {
47754776
return;
@@ -4795,7 +4796,8 @@ static void CG_DrawCenterString( void ) {
47954796
if(strncmp(cg.centerPrint,sKilledStr,strlen(sKilledStr))!=0)return;
47964797
}
47974798

4798-
y = cg.centerPrintY - cg.centerPrintLines * BIGCHAR_HEIGHT / 2;
4799+
y = cg.centerPrintY - cg.centerPrintLines * BIGCHAR_HEIGHT / 2 + CG_Text_Height(0, 1.0f, FONT_MEDIUM);
4800+
y += (cg.centerPrintLines*CG_Text_Height(0, (1.0f-scale)*0.5f, FONT_MEDIUM) - (cg.centerPrintLines-1*lineSpace));
47994801

48004802
while ( 1 ) {
48014803
if (cg.centerPrintLines > 1) {
@@ -4834,8 +4836,8 @@ static void CG_DrawCenterString( void ) {
48344836
w = CG_Text_Width(linebuffer, scale, FONT_MEDIUM);
48354837
h = CG_Text_Height(linebuffer, scale, FONT_MEDIUM);
48364838
x = (SCREEN_WIDTH - w) / 2;
4837-
CG_Text_Paint(x, y + h, scale, color, linebuffer, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE, FONT_MEDIUM);
4838-
y += h + 6;
4839+
CG_Text_Paint(x, y, scale, color, linebuffer, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE, FONT_MEDIUM);
4840+
y += h + lineSpace;
48394841

48404842
//[BugFix19]
48414843
//this method of advancing to new line from the start of the array was causing long lines without
@@ -4869,8 +4871,8 @@ static void CG_DrawCenterString( void ) {
48694871
w = CG_Text_Width(linebuffer, scale, FONT_MEDIUM);
48704872
h = CG_Text_Height(linebuffer, scale, FONT_MEDIUM);
48714873
x = (SCREEN_WIDTH - w) / 2;
4872-
CG_Text_Paint(x, y + h, scale, color, linebuffer, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE, FONT_MEDIUM);
4873-
y += h + 6;
4874+
CG_Text_Paint(x, y, scale, color, linebuffer, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE, FONT_MEDIUM);
4875+
y += h + lineSpace;
48744876

48754877
while ( *start && ( *start != '\n' ) ) {
48764878
start++;

codemp/cgame/cg_xcvar.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ XCVAR_DEF( cg_bobUp, "0.005", NULL, CVAR_ARCHIVE )
2323
XCVAR_DEF( cg_cameraOrbit, "0", NULL, CVAR_CHEAT )
2424
XCVAR_DEF( cg_cameraOrbitDelay, "50", NULL, CVAR_ARCHIVE )
2525
XCVAR_DEF( cg_centerTime, "3", NULL, CVAR_ARCHIVE )
26+
XCVAR_DEF( cg_centerScale, "1.0", NULL, CVAR_ARCHIVE )
2627
XCVAR_DEF( cg_chatBox, "10000", NULL, CVAR_ARCHIVE )
2728
XCVAR_DEF( cg_chatBoxHeight, "350", NULL, CVAR_ARCHIVE )
2829
XCVAR_DEF( cg_commandSmooth, "2", NULL, CVAR_ARCHIVE )

0 commit comments

Comments
 (0)