8000 mint-arena: Fix drawing Team Arena team info for 'everyone' · Turtle-Arena/turtle-arena-code@f5b407f · GitHub
[go: up one dir, main page]

Skip to content

Commit f5b407f

Browse files
committed
mint-arena: Fix drawing Team Arena team info for 'everyone'
Text_Paint_Limit() used max X in global screen instead of current screen placement. This resulted in name and location in center screen placement Team Arena team info for list of players being completely cut off in widescreen.
1 parent 046d311 commit f5b407f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

code/cgame/cg_text.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ void Text_Paint_Limit( float *maxX, float x, float y, const fontInfo_t *font, fl
542542
vec4_t newColor;
543543
const glyphInfo_t *glyph;
544544
const char *s;
545-
float max;
545+
float start, max;
546546
float yadj, xadj;
547547
float useScaleX, useScaleY;
548548
float xscale, yscale;
@@ -553,10 +553,11 @@ void Text_Paint_Limit( float *maxX, float x, float y, const fontInfo_t *font, fl
553553

554554
xscale = 1.0f;
555555
yscale = 1.0f;
556+
start = 0.0f;
557+
max = *maxX;
556558
CG_AdjustFrom640( &x, &y, &xscale, &yscale );
557-
558-
max = *maxX * xscale;
559-
adjust *= xscale;
559+
CG_AdjustFrom640( &start, NULL, &adjust, NULL );
560+
CG_AdjustFrom640( &max, NULL, NULL, NULL );
560561

561562
useScaleX = scale * font->glyphScale * xscale;
562563
useScaleY = scale * font->glyphScale * yscale;
@@ -590,7 +591,7 @@ void Text_Paint_Limit( float *maxX, float x, float y, const fontInfo_t *font, fl
590591
glyph = Text_GetGlyph( font, Q_UTF8_CodePoint( &s ) );
591592

592593
if ( x + ( glyph->xSkip * useScaleX ) > max ) {
593-
*maxX = 0;
594+
x = start;
594595
break;
595596
}
596597

@@ -599,10 +600,12 @@ void Text_Paint_Limit( float *maxX, float x, float y, const fontInfo_t *font, fl
599600

600601
Text_PaintGlyph( x + xadj, y - yadj, glyph->imageWidth * useScaleX, glyph->imageHeight * useScaleY, glyph, NULL );
601602
x += ( glyph->xSkip * useScaleX ) + adjust;
602-
*maxX = x / xscale;
603603
count++;
604604
}
605605
trap_R_SetColor( NULL );
606+
607+
// convert X to 640 coords
608+
*maxX = ( x - start ) / xscale;
606609
}
607610

608611
#define MAX_WRAP_BYTES 1024

0 commit comments

Comments
 (0)
0