@@ -124,6 +124,14 @@ void CG_Text_PaintChar(float x, float y, float width, float height, float scale,
124124 trap_R_DrawStretchPic (x , y , w , h , s , t , s2 , t2 , hShader );
125125}
126126
127+
128+ void CG_Text_PaintCharNoAdjust (float x , float y , float width , float height , float scale , float s , float t , float s2 , float t2 , qhandle_t hShader ) {
129+ float w , h ;
130+ w = width * scale ;
131+ h = height * scale ;
132+ trap_R_DrawStretchPic (x , y , w , h , s , t , s2 , t2 , hShader );
133+ }
134+
127135void CG_Text_Paint (float x , float y , float scale , vec4_t color , const char * text , float adjust , int limit , int style ) {
128136 int len , count ;
129137 vec4_t newColor ;
@@ -191,6 +199,75 @@ void CG_Text_Paint(float x, float y, float scale, vec4_t color, const char *text
191199}
192200
193201
202+
203+ void CG_Text_Paint_3D (float x , float y , float scale , vec4_t color , const char * text , float adjust , int limit , int style ) {
204+ int len , count ;
205+ vec4_t newColor ;
206+ glyphInfo_t * glyph ;
207+ float useScale ;
208+ fontInfo_t * font = & cgDC .Assets .textFont ;
209+ if (scale <= cg_smallFont .value ) {
210+ font = & cgDC .Assets .smallFont ;
211+ } else if (scale > cg_bigFont .value ) {
212+ font = & cgDC .Assets .bigFont ;
213+ }
214+ useScale = scale * font -> glyphScale ;
215+ if (text ) {
216+ const char * s = text ;
217+ trap_R_SetColor (color );
218+ memcpy (& newColor [0 ], & color [0 ], sizeof (vec4_t ));
219+ len = strlen (text );
220+ if (limit > 0 && len > limit ) {
221+ len = limit ;
222+ }
223+ count = 0 ;
224+ while (s && * s && count < len ) {
225+ glyph = & font -> glyphs [* s & 255 ];
226+ if (Q_IsColorString (s )) {
227+ memcpy (newColor , g_color_table [ColorIndex (* (s + 1 ))], sizeof ( newColor ));
228+ newColor [3 ] = color [3 ];
229+ trap_R_SetColor (newColor );
230+ s += 2 ;
231+ continue ;
232+ } else {
233+ float yadj = useScale * glyph -> top ;
234+ if (style == ITEM_TEXTSTYLE_SHADOWED || style == ITEM_TEXTSTYLE_SHADOWEDMORE ) {
235+ int ofs = style == ITEM_TEXTSTYLE_SHADOWED ? 1 : 2 ;
236+ colorBlack [3 ] = newColor [3 ];
237+ trap_R_SetColor (colorBlack );
238+ CG_Text_PaintCharNoAdjust (x + ofs , y - yadj + ofs ,
239+ glyph -> imageWidth ,
240+ glyph -> imageHeight ,
241+ useScale ,
242+ glyph -> s ,
243+ glyph -> t ,
244+ glyph -> s2 ,
245+ glyph -> t2 ,
246+ glyph -> glyph );
247+ colorBlack [3 ] = 1.0 ;
248+ trap_R_SetColor (newColor );
249+ }
250+ CG_Text_PaintCharNoAdjust (x , y - yadj ,
251+ glyph -> imageWidth ,
252+ glyph -> imageHeight ,
253+ useScale ,
254+ glyph -> s ,
255+ glyph -> t ,
256+ glyph -> s2 ,
257+ glyph -> t2 ,
258+ glyph -> glyph );
259+ // CG_DrawPic(x, y - yadj, scale * cgDC.Assets.textFont.glyphs[text[i]].imageWidth, scale * cgDC.Assets.textFont.glyphs[text[i]].imageHeight, cgDC.Assets.textFont.glyphs[text[i]].glyph);
260+ x += (glyph -> xSkip * useScale ) + adjust ;
261+ s ++ ;
262+ count ++ ;
263+ }
264+ }
265+ trap_R_SetColor (NULL );
266+ }
267+ }
268+
269+
270+
194271#endif
195272
196273/*
@@ -1184,9 +1261,6 @@ static float CG_DrawCountdownTimer(float y) {
11841261 //msec = cg.time - cgs.levelStartTime;
11851262 if (cg .time > rst ) //We are started
11861263 {
1187- if (cgs .gametype == GT_DOUBLE_D ) {
1188- return y ;
1189- }
11901264 msec = cgs .roundtime * 1000 - (cg .time - rst );
11911265 if (msec <= 30 * 1000 - 1 ) //<= 30 seconds
11921266 memcpy (color , g_color_table [ColorIndex (COLOR_YELLOW )], sizeof (color ));
@@ -1449,7 +1523,7 @@ static float CG_DrawFollowMessage(float y) {
14491523 char * s ;
14501524 int w ;
14511525
1452- if (!(cg .snap -> ps .pm_flags & PMF_FOLLOW ) || ((cgs .elimflags & EF_NO_FREESPEC ) && CG_IsARoundBasedGametype (cgs .gametype ) && CG_IsATeamGametype ( cgs .gametype ))) {
1526+ if (!(cg .snap -> ps .pm_flags & PMF_FOLLOW ) || ((cgs .elimflags & EF_NO_FREESPEC ) && (cgs .gametype == GT_ELIMINATION || cgs .gametype == GT_CTF_ELIMINATION ))) {
14531527 return y ;
14541528 }
14551529
@@ -1588,7 +1662,7 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame) {
15881662
15891663 y = 0 ;
15901664
1591- if (CG_IsATeamGametype ( cgs .gametype ) && cg_drawTeamOverlay .integer == 1 ) {
1665+ if (cgs .gametype >= GT_TEAM && cgs . ffa_gt != 1 && cg_drawTeamOverlay .integer == 1 ) {
15921666 y = CG_DrawTeamOverlay (y , qtrue , qtrue );
15931667 }
15941668 /*if ( cgs.gametype == GT_DOUBLE_D ) {
@@ -1613,7 +1687,7 @@ static void CG_DrawUpperRight(stereoFrame_t stereoFrame) {
16131687 if (cg_drawFPS .integer && (stereoFrame == STEREO_CENTER || stereoFrame == STEREO_RIGHT )) {
16141688 y = CG_DrawFPS (y );
16151689 }
1616- if (CG_IsARoundBasedGametype ( cgs .gametype ) || cgs .gametype == GT_DOUBLE_D ) {
1690+ if (cgs .gametype == GT_ELIMINATION || cgs .gametype == GT_CTF_ELIMINATION || cgs . gametype == GT_LMS ) {
16171691 y = CG_DrawCountdownTimer (y );
16181692 /*if (cgs.clientinfo[ cg.clientNum ].isDead)
16191693 y = CG_DrawEliminationDeathMessage( y);*/
@@ -1671,7 +1745,7 @@ static float CG_DrawScores(float y) {
16711745 y1 = y ;
16721746
16731747 // draw from the right side to left
1674- if (CG_IsATeamGametype ( cgs .gametype ) ) {
1748+ if (cgs .gametype >= GT_TEAM && cgs . ffa_gt != 1 ) {
16751749 x = 640 ;
16761750 color [0 ] = 0.0f ;
16771751 color [1 ] = 0.0f ;
@@ -1686,7 +1760,7 @@ static float CG_DrawScores(float y) {
16861760 }
16871761 CG_DrawBigString (x + 4 , y , s , 1.0F );
16881762
1689- if (CG_UsesTeamFlags ( cgs .gametype ) && ! CG_UsesTheWhiteFlag ( cgs .gametype ) ) {
1763+ if (cgs .gametype == GT_CTF || cgs .gametype == GT_CTF_ELIMINATION ) {
16901764 // Display flag status
16911765 item = BG_FindItemForPowerup (PW_BLUEFLAG );
16921766
@@ -1720,7 +1794,7 @@ static float CG_DrawScores(float y) {
17201794 }
17211795 CG_DrawBigString (x + 4 , y , s , 1.0F );
17221796
1723- if (CG_UsesTeamFlags ( cgs .gametype ) && ! CG_UsesTheWhiteFlag ( cgs .gametype ) ) {
1797+ if (cgs .gametype == GT_CTF || cgs .gametype == GT_CTF_ELIMINATION ) {
17241798 // Display flag status
17251799 item = BG_FindItemForPowerup (PW_REDFLAG );
17261800
@@ -1756,7 +1830,9 @@ static float CG_DrawScores(float y) {
17561830 CG_DrawSmallString (x , y - 28 , s , 1.0F );
17571831 }
17581832
1759- if (CG_IsATeamGametype (cgs .gametype ) && cgs .gametype != GT_TEAM ) {
1833+
1834+
1835+ if (cgs .gametype >= GT_CTF && cgs .ffa_gt == 0 ) {
17601836 v = cgs .capturelimit ;
17611837 } else {
17621838 v = cgs .fraglimit ;
@@ -1959,7 +2035,7 @@ static void CG_DrawLowerRight(void) {
19592035
19602036 y = 472 - ICON_SIZE ;
19612037
1962- if (CG_IsATeamGametype ( cgs .gametype ) && cg_drawTeamOverlay .integer == 2 ) {
2038+ if (cgs .gametype >= GT_TEAM && cgs . ffa_gt != 1 && cg_drawTeamOverlay .integer == 2 ) {
19632039 y = CG_DrawTeamOverlay (y , qtrue , qfalse );
19642040 }
19652041
@@ -2014,7 +2090,7 @@ static void CG_DrawLowerLeft(void) {
20142090
20152091 y = 480 - ICON_SIZE ;
20162092
2017- if (CG_IsATeamGametype ( cgs .gametype ) && cg_drawTeamOverlay .integer == 3 ) {
2093+ if (cgs .gametype >= GT_TEAM && cgs . ffa_gt != 1 && cg_drawTeamOverlay .integer == 3 ) {
20182094 y = CG_DrawTeamOverlay (y , qfalse , qfalse );
20192095 }
20202096
@@ -2987,7 +3063,7 @@ static void CG_DrawSpectator(void) {
29873063 CG_DrawBigString (320 - 9 * 8 , 440 , "SPECTATOR" , 1.0F );
29883064 if (cgs .gametype == GT_TOURNAMENT ) {
29893065 CG_DrawBigString (320 - 15 * 8 , 460 , "waiting to play" , 1.0F );
2990- } else if (CG_IsATeamGametype ( cgs .gametype ) ) {
3066+ } else if (cgs .gametype >= GT_TEAM && cgs . ffa_gt != 1 ) {
29913067 CG_DrawBigString (320 - 39 * 8 , 460 , "press ESC and use the JOIN menu to play" , 1.0F );
29923068 }
29933069}
@@ -3102,7 +3178,7 @@ static qboolean CG_DrawScoreboard(void) {
31023178
31033179
31043180 if (menuScoreboard == NULL ) {
3105- if (CG_IsATeamGametype ( cgs .gametype ) ) {
3181+ if (cgs .gametype >= GT_TEAM && cgs . ffa_gt != 1 ) {
31063182 menuScoreboard = Menus_FindByName ("teamscore_menu" );
31073183 } else {
31083184 menuScoreboard = Menus_FindByName ("score_menu" );
@@ -3126,7 +3202,7 @@ static qboolean CG_DrawScoreboard(void) {
31263202#else
31273203 char * s ;
31283204 int w ;
3129- if (cg .respawnTime && cg .snap -> ps .persistant [PERS_TEAM ] != TEAM_SPECTATOR && (! CG_IsARoundBasedGametype ( cgs .gametype ) )) {
3205+ if (cg .respawnTime && cg .snap -> ps .persistant [PERS_TEAM ] != TEAM_SPECTATOR && (cgs .gametype < GT_ELIMINATION || cgs . gametype > GT_LMS )) {
31303206 if (cg .respawnTime > cg .time ) {
31313207 s = va ("Respawn in: %2.2f" , ((double ) cg .respawnTime - (double ) cg .time ) / 1000.0 );
31323208 w = CG_DrawStrlen (s ) * SMALLCHAR_WIDTH ;
@@ -3474,6 +3550,8 @@ void CG_DrawTimedMenus(void) {
34743550CG_Draw2D
34753551=================
34763552 */
3553+ void CG_PlayerSpritesOverWorld (centity_t * cent );
3554+
34773555static void CG_Draw2D (stereoFrame_t stereoFrame ) {
34783556#ifdef MISSIONPACK
34793557 if (cgs .orderPending && cg .time > cgs .orderTime ) {
@@ -3534,18 +3612,38 @@ static void CG_Draw2D(stereoFrame_t stereoFrame) {
35343612
35353613 CG_DrawReward ();
35363614 }
3537- }
3615+
3616+ if (cgs .gametype >= GT_TEAM && cgs .ffa_gt != 1 ) {
35383617#ifndef MISSIONPACK
3539- if (CG_IsATeamGametype (cgs .gametype )) {
3540- CG_DrawTeamInfo ();
3541- }
3618+ CG_DrawTeamInfo ();
35423619#endif
3620+ }
3621+ }
35433622
35443623 CG_DrawVote ();
35453624 CG_DrawTeamVote ();
35463625
35473626 CG_DrawLagometer ();
35483627
3628+ // leilei - draw the player's names
3629+ #ifdef MISSIONPACK
3630+ {
3631+ int f ;
3632+ centity_t * cent ;
3633+ vec3_t angles ;
3634+ vec3_t origin ;
3635+
3636+
3637+
3638+ for (f = 0 ;f < MAX_CLIENTS ;f ++ ){
3639+ cent = & cg .headent [f ];
3640+ if (cent );
3641+ CG_PlayerSpritesOverWorld (cent );
3642+ }
3643+
3644+ }
3645+ #endif
3646+
35493647#ifdef MISSIONPACK
35503648 if (!cg_paused .integer ) {
35513649 CG_DrawUpperRight (stereoFrame );
@@ -3571,11 +3669,13 @@ static void CG_Draw2D(stereoFrame_t stereoFrame) {
35713669 CG_DrawCenterDDString ();
35723670 CG_DrawCenter1FctfString ();
35733671 CG_DrawCenterString ();
3574- }
35753672
35763673 cg .accBoardShowing = CG_DrawAccboard ();
35773674}
35783675
3676+
3677+ }
3678+
35793679/*
35803680=====================
35813681CG_DrawActive
0 commit comments