Debian Codegraph @

code/cgame/cg_drawtools.c

raw symbols SCIP
1 /*
2 ===========================================================================
3 Copyright (C) 1999-2005 Id Software, Inc.
4
5 This file is part of Quake III Arena source code.
6
7 Quake III Arena source code is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the License,
10 or (at your option) any later version.
11
12 Quake III Arena source code is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Quake III Arena source code; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ===========================================================================
21 */
22 //
23 // cg_drawtools.c -- helper functions called by cg_draw, cg_scoreboard, cg_info, etc
24 #include "cg_local.h"
25
26 /*
27 ================
28 CG_AdjustFrom640
29
30 Adjusted for resolution and screen aspect ratio
31 ================
32 */
33 void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
34 #if 0
35 // adjust for wide screens
36 if ( cgs.glconfig.vidWidth * 480 > cgs.glconfig.vidHeight * 640 ) {
37 *x += 0.5 * ( cgs.glconfig.vidWidth - ( cgs.glconfig.vidHeight * 640 / 480 ) );
38 }
39 #endif
40 // scale for screen sizes
41 *x *= cgs.screenXScale;
42 *y *= cgs.screenYScale;
43 *w *= cgs.screenXScale;
44 *h *= cgs.screenYScale;
45 }
46
47 /*
48 ================
49 CG_FillRect
50
51 Coordinates are 640*480 virtual values
52 =================
53 */
54 void CG_FillRect( float x, float y, float width, float height, const float *color ) {
55 trap_R_SetColor( color );
56
57 CG_AdjustFrom640( &x, &y, &width, &height );
58 trap_R_DrawStretchPic( x, y, width, height, 0, 0, 0, 0, cgs.media.whiteShader );
59
60 trap_R_SetColor( NULL );
61 }
62
63 /*
64 ================
65 CG_DrawSides
66
67 Coords are virtual 640x480
68 ================
69 */
70 void CG_DrawSides(float x, float y, float w, float h, float size) {
71 CG_AdjustFrom640( &x, &y, &w, &h );
72 size *= cgs.screenXScale;
73 trap_R_DrawStretchPic( x, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );
74 trap_R_DrawStretchPic( x + w - size, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );
75 }
76
77 void CG_DrawTopBottom(float x, float y, float w, float h, float size) {
78 CG_AdjustFrom640( &x, &y, &w, &h );
79 size *= cgs.screenYScale;
80 trap_R_DrawStretchPic( x, y, w, size, 0, 0, 0, 0, cgs.media.whiteShader );
81 trap_R_DrawStretchPic( x, y + h - size, w, size, 0, 0, 0, 0, cgs.media.whiteShader );
82 }
83 /*
84 ================
85 UI_DrawRect
86
87 Coordinates are 640*480 virtual values
88 =================
89 */
90 void CG_DrawRect( float x, float y, float width, float height, float size, const float *color ) {
91 trap_R_SetColor( color );
92
93 CG_DrawTopBottom(x, y, width, height, size);
94 CG_DrawSides(x, y + size, width, height - size * 2, size);
95
96 trap_R_SetColor( NULL );
97 }
98
99
100
101 /*
102 ================
103 CG_DrawPic
104
105 Coordinates are 640*480 virtual values
106 =================
107 */
108 void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader ) {
109 CG_AdjustFrom640( &x, &y, &width, &height );
110 trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
111 }
112
113
114
115 /*
116 ===============
117 CG_DrawChar
118
119 Coordinates and size in 640*480 virtual screen size
120 ===============
121 */
122 void CG_DrawChar( int x, int y, int width, int height, int ch ) {
123 int row, col;
124 float frow, fcol;
125 float size;
126 float ax, ay, aw, ah;
127
128 ch &= 255;
129
130 if ( ch == ' ' ) {
131 return;
132 }
133
134 ax = x;
135 ay = y;
136 aw = width;
137 ah = height;
138 CG_AdjustFrom640( &ax, &ay, &aw, &ah );
139
140 row = ch>>4;
141 col = ch&15;
142
143 frow = row*0.0625;
144 fcol = col*0.0625;
145 size = 0.0625;
146
147 trap_R_DrawStretchPic( ax, ay, aw, ah,
148 fcol, frow,
149 fcol + size, frow + size,
150 cgs.media.charsetShader );
151 }
152
153
154 /*
155 ==================
156 CG_DrawStringExt
157
158 Draws a multi-colored string with a drop shadow, optionally forcing
159 to a fixed color.
160
161 Coordinates are at 640 by 480 virtual resolution
162 ==================
163 */
164 void CG_DrawStringExt( int x, int y, const char *string, const float *setColor,
165 qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars ) {
166 vec4_t color;
167 const char *s;
168 int xx;
169 int cnt;
170
171 if (maxChars <= 0)
172 maxChars = 32767; // do them all!
173
174 // draw the drop shadow
175 if (shadow) {
176 color[0] = color[1] = color[2] = 0;
177 color[3] = setColor[3];
178 trap_R_SetColor( color );
179 s = string;
180 xx = x;
181 cnt = 0;
182 while ( *s && cnt < maxChars) {
183 if ( Q_IsColorString( s ) ) {
184 s += 2;
185 continue;
186 }
187 CG_DrawChar( xx + 2, y + 2, charWidth, charHeight, *s );
188 cnt++;
189 xx += charWidth;
190 s++;
191 }
192 }
193
194 // draw the colored text
195 s = string;
196 xx = x;
197 cnt = 0;
198 trap_R_SetColor( setColor );
199 while ( *s && cnt < maxChars) {
200 if ( Q_IsColorString( s ) ) {
201 if ( !forceColor ) {
202 memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) );
203 color[3] = setColor[3];
204 trap_R_SetColor( color );
205 }
206 s += 2;
207 continue;
208 }
209 CG_DrawChar( xx, y, charWidth, charHeight, *s );
210 xx += charWidth;
211 cnt++;
212 s++;
213 }
214 trap_R_SetColor( NULL );
215 }
216
217 void CG_DrawBigString( int x, int y, const char *s, float alpha ) {
218 float color[4];
219
220 color[0] = color[1] = color[2] = 1.0;
221 color[3] = alpha;
222 CG_DrawStringExt( x, y, s, color, qfalse, qtrue, BIGCHAR_WIDTH, BIGCHAR_HEIGHT, 0 );
223 }
224
225 void CG_DrawBigStringColor( int x, int y, const char *s, vec4_t color ) {
226 CG_DrawStringExt( x, y, s, color, qtrue, qtrue, BIGCHAR_WIDTH, BIGCHAR_HEIGHT, 0 );
227 }
228
229 void CG_DrawSmallString( int x, int y, const char *s, float alpha ) {
230 float color[4];
231
232 color[0] = color[1] = color[2] = 1.0;
233 color[3] = alpha;
234 CG_DrawStringExt( x, y, s, color, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 );
235 }
236
237 void CG_DrawSmallStringColor( int x, int y, const char *s, vec4_t color ) {
238 CG_DrawStringExt( x, y, s, color, qtrue, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 );
239 }
240
241 /*
242 =================
243 CG_DrawStrlen
244
245 Returns character count, skiping color escape codes
246 =================
247 */
248 int CG_DrawStrlen( const char *str ) {
249 const char *s = str;
250 int count = 0;
251
252 while ( *s ) {
253 if ( Q_IsColorString( s ) ) {
254 s += 2;
255 } else {
256 count++;
257 s++;
258 }
259 }
260
261 return count;
262 }
263
264 /*
265 =============
266 CG_TileClearBox
267
268 This repeats a 64*64 tile graphic to fill the screen around a sized down
269 refresh window.
270 =============
271 */
272 static void CG_TileClearBox( int x, int y, int w, int h, qhandle_t hShader ) {
273 float s1, t1, s2, t2;
274
275 s1 = x/64.0;
276 t1 = y/64.0;
277 s2 = (x+w)/64.0;
278 t2 = (y+h)/64.0;
279 trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, hShader );
280 }
281
282
283
284 /*
285 ==============
286 CG_TileClear
287
288 Clear around a sized down screen
289 ==============
290 */
291 void CG_TileClear( void ) {
292 int top, bottom, left, right;
293 int w, h;
294
295 w = cgs.glconfig.vidWidth;
296 h = cgs.glconfig.vidHeight;
297
298 if ( cg.refdef.x == 0 && cg.refdef.y == 0 &&
299 cg.refdef.width == w && cg.refdef.height == h ) {
300 return; // full screen rendering
301 }
302
303 top = cg.refdef.y;
304 bottom = top + cg.refdef.height-1;
305 left = cg.refdef.x;
306 right = left + cg.refdef.width-1;
307
308 // clear above view screen
309 CG_TileClearBox( 0, 0, w, top, cgs.media.backTileShader );
310
311 // clear below view screen
312 CG_TileClearBox( 0, bottom, w, h - bottom, cgs.media.backTileShader );
313
314 // clear left of view screen
315 CG_TileClearBox( 0, top, left, bottom - top + 1, cgs.media.backTileShader );
316
317 // clear right of view screen
318 CG_TileClearBox( right, top, w - right, bottom - top + 1, cgs.media.backTileShader );
319 }
320
321
322
323 /*
324 ================
325 CG_FadeColor
326 ================
327 */
328 float *CG_FadeColor( int startMsec, int totalMsec ) {
329 static vec4_t color;
330 int t;
331
332 if ( startMsec == 0 ) {
333 return NULL;
334 }
335
336 t = cg.time - startMsec;
337
338 if ( t >= totalMsec ) {
339 return NULL;
340 }
341
342 // fade out
343 if ( totalMsec - t < FADE_TIME ) {
344 color[3] = ( totalMsec - t ) * 1.0/FADE_TIME;
345 } else {
346 color[3] = 1.0;
347 }
348 color[0] = color[1] = color[2] = 1;
349
350 return color;
351 }
352
353
354 /*
355 ================
356 CG_TeamColor
357 ================
358 */
359 float *CG_TeamColor( int team ) {
360 static vec4_t red = {1, 0.2f, 0.2f, 1};
361 static vec4_t blue = {0.2f, 0.2f, 1, 1};
362 static vec4_t other = {1, 1, 1, 1};
363 static vec4_t spectator = {0.7f, 0.7f, 0.7f, 1};
364
365 switch ( team ) {
366 case TEAM_RED:
367 return red;
368 case TEAM_BLUE:
369 return blue;
370 case TEAM_SPECTATOR:
371 return spectator;
372 default:
373 return other;
374 }
375 }
376
377
378
379 /*
380 =================
381 CG_GetColorForHealth
382 =================
383 */
384 void CG_GetColorForHealth( int health, int armor, vec4_t hcolor ) {
385 int count;
386 int max;
387
388 // calculate the total points of damage that can
389 // be sustained at the current health / armor level
390 if ( health <= 0 ) {
391 VectorClear( hcolor ); // black
392 hcolor[3] = 1;
393 return;
394 }
395 count = armor;
396 max = health * ARMOR_PROTECTION / ( 1.0 - ARMOR_PROTECTION );
397 if ( max < count ) {
398 count = max;
399 }
400 health += count;
401
402 // set the color based on health
403 hcolor[0] = 1.0;
404 hcolor[3] = 1.0;
405 if ( health >= 100 ) {
406 hcolor[2] = 1.0;
407 } else if ( health < 66 ) {
408 hcolor[2] = 0;
409 } else {
410 hcolor[2] = ( health - 66 ) / 33.0;
411 }
412
413 if ( health > 60 ) {
414 hcolor[1] = 1.0;
415 } else if ( health < 30 ) {
416 hcolor[1] = 0;
417 } else {
418 hcolor[1] = ( health - 30 ) / 30.0;
419 }
420 }
421
422 /*
423 =================
424 CG_ColorForHealth
425 =================
426 */
427 void CG_ColorForHealth( vec4_t hcolor ) {
428
429 CG_GetColorForHealth( cg.snap->ps.stats[STAT_HEALTH],
430 cg.snap->ps.stats[STAT_ARMOR], hcolor );
431 }
432
433
434 /*
435 =================
436 UI_DrawProportionalString2
437 =================
438 */
439 static int propMap[128][3] = {
440 {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1},
441 {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1},
442
443 {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1},
444 {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1}, {0, 0, -1},
445
446 {0, 0, PROP_SPACE_WIDTH}, // SPACE
447 {11, 122, 7}, // !
448 {154, 181, 14}, // "
449 {55, 122, 17}, // #
450 {79, 122, 18}, // $
451 {101, 122, 23}, // %
452 {153, 122, 18}, // &
453 {9, 93, 7}, // '
454 {207, 122, 8}, // (
455 {230, 122, 9}, // )
456 {177, 122, 18}, // *
457 {30, 152, 18}, // +
458 {85, 181, 7}, // ,
459 {34, 93, 11}, // -
460 {110, 181, 6}, // .
461 {130, 152, 14}, // /
462
463 {22, 64, 17}, // 0
464 {41, 64, 12}, // 1
465 {58, 64, 17}, // 2
466 {78, 64, 18}, // 3
467 {98, 64, 19}, // 4
468 {120, 64, 18}, // 5
469 {141, 64, 18}, // 6
470 {204, 64, 16}, // 7
471 {162, 64, 17}, // 8
472 {182, 64, 18}, // 9
473 {59, 181, 7}, // :
474 {35,181, 7}, // ;
475 {203, 152, 14}, // <
476 {56, 93, 14}, // =
477 {228, 152, 14}, // >
478 {177, 181, 18}, // ?
479
480 {28, 122, 22}, // @
481 {5, 4, 18}, // A
482 {27, 4, 18}, // B
483 {48, 4, 18}, // C
484 {69, 4, 17}, // D
485 {90, 4, 13}, // E
486 {106, 4, 13}, // F
487 {121, 4, 18}, // G
488 {143, 4, 17}, // H
489 {164, 4, 8}, // I
490 {175, 4, 16}, // J
491 {195, 4, 18}, // K
492 {216, 4, 12}, // L
493 {230, 4, 23}, // M
494 {6, 34, 18}, // N
495 {27, 34, 18}, // O
496
497 {48, 34, 18}, // P
498 {68, 34, 18}, // Q
499 {90, 34, 17}, // R
500 {110, 34, 18}, // S
501 {130, 34, 14}, // T
502 {146, 34, 18}, // U
503 {166, 34, 19}, // V
504 {185, 34, 29}, // W
505 {215, 34, 18}, // X
506 {234, 34, 18}, // Y
507 {5, 64, 14}, // Z
508 {60, 152, 7}, // [
509 {106, 151, 13}, // '\'
510 {83, 152, 7}, // ]
511 {128, 122, 17}, // ^
512 {4, 152, 21}, // _
513
514 {134, 181, 5}, // '
515 {5, 4, 18}, // A
516 {27, 4, 18}, // B
517 {48, 4, 18}, // C
518 {69, 4, 17}, // D
519 {90, 4, 13}, // E
520 {106, 4, 13}, // F
521 {121, 4, 18}, // G
522 {143, 4, 17}, // H
523 {164, 4, 8}, // I
524 {175, 4, 16}, // J
525 {195, 4, 18}, // K
526 {216, 4, 12}, // L
527 {230, 4, 23}, // M
528 {6, 34, 18}, // N
529 {27, 34, 18}, // O
530
531 {48, 34, 18}, // P
532 {68, 34, 18}, // Q
533 {90, 34, 17}, // R
534 {110, 34, 18}, // S
535 {130, 34, 14}, // T
536 {146, 34, 18}, // U
537 {166, 34, 19}, // V
538 {185, 34, 29}, // W
539 {215, 34, 18}, // X
540 {234, 34, 18}, // Y
541 {5, 64, 14}, // Z
542 {153, 152, 13}, // {
543 {11, 181, 5}, // |
544 {180, 152, 13}, // }
545 {79, 93, 17}, // ~
546 {0, 0, -1} // DEL
547 };
548
549 static int propMapB[26][3] = {
550 {11, 12, 33},
551 {49, 12, 31},
552 {85, 12, 31},
553 {120, 12, 30},
554 {156, 12, 21},
555 {183, 12, 21},
556 {207, 12, 32},
557
558 {13, 55, 30},
559 {49, 55, 13},
560 {66, 55, 29},
561 {101, 55, 31},
562 {135, 55, 21},
563 {158, 55, 40},
564 {204, 55, 32},
565
566 {12, 97, 31},
567 {48, 97, 31},
568 {82, 97, 30},
569 {118, 97, 30},
570 {153, 97, 30},
571 {185, 97, 25},
572 {213, 97, 30},
573
574 {11, 139, 32},
575 {42, 139, 51},
576 {93, 139, 32},
577 {126, 139, 31},
578 {158, 139, 25},
579 };
580
581 #define PROPB_GAP_WIDTH 4
582 #define PROPB_SPACE_WIDTH 12
583 #define PROPB_HEIGHT 36
584
585 /*
586 =================
587 UI_DrawBannerString
588 =================
589 */
590 static void UI_DrawBannerString2( int x, int y, const char* str, vec4_t color )
591 {
592 const char* s;
593 unsigned char ch;
594 float ax;
595 float ay;
596 float aw;
597 float ah;
598 float frow;
599 float fcol;
600 float fwidth;
601 float fheight;
602
603 // draw the colored text
604 trap_R_SetColor( color );
605
606 ax = x * cgs.screenXScale + cgs.screenXBias;
607 ay = y * cgs.screenYScale;
608
609 s = str;
610 while ( *s )
611 {
612 ch = *s & 127;
613 if ( ch == ' ' ) {
614 ax += ((float)PROPB_SPACE_WIDTH + (float)PROPB_GAP_WIDTH)* cgs.screenXScale;
615 }
616 else if ( ch >= 'A' && ch <= 'Z' ) {
617 ch -= 'A';
618 fcol = (float)propMapB[ch][0] / 256.0f;
619 frow = (float)propMapB[ch][1] / 256.0f;
620 fwidth = (float)propMapB[ch][2] / 256.0f;
621 fheight = (float)PROPB_HEIGHT / 256.0f;
622 aw = (float)propMapB[ch][2] * cgs.screenXScale;
623 ah = (float)PROPB_HEIGHT * cgs.screenYScale;
624 trap_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol+fwidth, frow+fheight, cgs.media.charsetPropB );
625 ax += (aw + (float)PROPB_GAP_WIDTH * cgs.screenXScale);
626 }
627 s++;
628 }
629
630 trap_R_SetColor( NULL );
631 }
632
633 void UI_DrawBannerString( int x, int y, const char* str, int style, vec4_t color ) {
634 const char * s;
635 int ch;
636 int width;
637 vec4_t drawcolor;
638
639 // find the width of the drawn text
640 s = str;
641 width = 0;
642 while ( *s ) {
643 ch = *s;
644 if ( ch == ' ' ) {
645 width += PROPB_SPACE_WIDTH;
646 }
647 else if ( ch >= 'A' && ch <= 'Z' ) {
648 width += propMapB[ch - 'A'][2] + PROPB_GAP_WIDTH;
649 }
650 s++;
651 }
652 width -= PROPB_GAP_WIDTH;
653
654 switch( style & UI_FORMATMASK ) {
655 case UI_CENTER:
656 x -= width / 2;
657 break;
658
659 case UI_RIGHT:
660 x -= width;
661 break;
662
663 case UI_LEFT:
664 default:
665 break;
666 }
667
668 if ( style & UI_DROPSHADOW ) {
669 drawcolor[0] = drawcolor[1] = drawcolor[2] = 0;
670 drawcolor[3] = color[3];
671 UI_DrawBannerString2( x+2, y+2, str, drawcolor );
672 }
673
674 UI_DrawBannerString2( x, y, str, color );
675 }
676
677
678 int UI_ProportionalStringWidth( const char* str ) {
679 const char * s;
680 int ch;
681 int charWidth;
682 int width;
683
684 s = str;
685 width = 0;
686 while ( *s ) {
687 ch = *s & 127;
688 charWidth = propMap[ch][2];
689 if ( charWidth != -1 ) {
690 width += charWidth;
691 width += PROP_GAP_WIDTH;
692 }
693 s++;
694 }
695
696 width -= PROP_GAP_WIDTH;
697 return width;
698 }
699
700 static void UI_DrawProportionalString2( int x, int y, const char* str, vec4_t color, float sizeScale, qhandle_t charset )
701 {
702 const char* s;
703 unsigned char ch;
704 float ax;
705 float ay;
706 float aw;
707 float ah;
708 float frow;
709 float fcol;
710 float fwidth;
711 float fheight;
712
713 // draw the colored text
714 trap_R_SetColor( color );
715
716 ax = x * cgs.screenXScale + cgs.screenXBias;
717 ay = y * cgs.screenYScale;
718
719 s = str;
720 while ( *s )
721 {
722 ch = *s & 127;
723 if ( ch == ' ' ) {
724 aw = (float)PROP_SPACE_WIDTH * cgs.screenXScale * sizeScale;
725 } else if ( propMap[ch][2] != -1 ) {
726 fcol = (float)propMap[ch][0] / 256.0f;
727 frow = (float)propMap[ch][1] / 256.0f;
728 fwidth = (float)propMap[ch][2] / 256.0f;
729 fheight = (float)PROP_HEIGHT / 256.0f;
730 aw = (float)propMap[ch][2] * cgs.screenXScale * sizeScale;
731 ah = (float)PROP_HEIGHT * cgs.screenYScale * sizeScale;
732 trap_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol+fwidth, frow+fheight, charset );
733 } else {
734 aw = 0;
735 }
736
737 ax += (aw + (float)PROP_GAP_WIDTH * cgs.screenXScale * sizeScale);
738 s++;
739 }
740
741 trap_R_SetColor( NULL );
742 }
743
744 /*
745 =================
746 UI_ProportionalSizeScale
747 =================
748 */
749 float UI_ProportionalSizeScale( int style ) {
750 if( style & UI_SMALLFONT ) {
751 return 0.75;
752 }
753
754 return 1.00;
755 }
756
757
758 /*
759 =================
760 UI_DrawProportionalString
761 =================
762 */
763 void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color ) {
764 vec4_t drawcolor;
765 int width;
766 float sizeScale;
767
768 sizeScale = UI_ProportionalSizeScale( style );
769
770 switch( style & UI_FORMATMASK ) {
771 case UI_CENTER:
772 width = UI_ProportionalStringWidth( str ) * sizeScale;
773 x -= width / 2;
774 break;
775
776 case UI_RIGHT:
777 width = UI_ProportionalStringWidth( str ) * sizeScale;
778 x -= width;
779 break;
780
781 case UI_LEFT:
782 default:
783 break;
784 }
785
786 if ( style & UI_DROPSHADOW ) {
787 drawcolor[0] = drawcolor[1] = drawcolor[2] = 0;
788 drawcolor[3] = color[3];
789 UI_DrawProportionalString2( x+2, y+2, str, drawcolor, sizeScale, cgs.media.charsetProp );
790 }
791
792 if ( style & UI_INVERSE ) {
793 drawcolor[0] = color[0] * 0.8;
794 drawcolor[1] = color[1] * 0.8;
795 drawcolor[2] = color[2] * 0.8;
796 drawcolor[3] = color[3];
797 UI_DrawProportionalString2( x, y, str, drawcolor, sizeScale, cgs.media.charsetProp );
798 return;
799 }
800
801 if ( style & UI_PULSE ) {
802 drawcolor[0] = color[0] * 0.8;
803 drawcolor[1] = color[1] * 0.8;
804 drawcolor[2] = color[2] * 0.8;
805 drawcolor[3] = color[3];
806 UI_DrawProportionalString2( x, y, str, color, sizeScale, cgs.media.charsetProp );
807
808 drawcolor[0] = color[0];
809 drawcolor[1] = color[1];
810 drawcolor[2] = color[2];
811 drawcolor[3] = 0.5 + 0.5 * sin( cg.time / PULSE_DIVISOR );
812 UI_DrawProportionalString2( x, y, str, drawcolor, sizeScale, cgs.media.charsetPropGlow );
813 return;
814 }
815
816 UI_DrawProportionalString2( x, y, str, color, sizeScale, cgs.media.charsetProp );
817 }