/* =============== Sbar_DrawFrags =============== */ void Sbar_DrawFrags (void) { int i, k, l; int top, bottom; int x, y, f; int xofs; char num[12]; scoreboard_t *s; if (cl.maxclients == 1) // mankrip return; // mankrip Sbar_SortFrags (); // draw the text l = scoreboardlines <= 4 ? scoreboardlines : 4; x = 23; xofs = 202; y = 200 - SBAR_HEIGHT + 23; // mankrip - edited for (i=0 ; i<l ; i++) { k = fragsort[i]; s = &cl.scores[k]; if (!s->name[0]) continue; // draw background top = s->colors & 0xf0; bottom = (s->colors & 15)<<4; top = Sbar_ColorForMap (top); bottom = Sbar_ColorForMap (bottom); //qb: fixme - needs its own special function for scalable hud... // M_Draw_Fill (xofs - (xofs *scr_2d_scale_h)/4 + 220, y - (y * scr_2d_scale_v)/2 + 228, 28, 4, top); //qb: adjust for scaling - mankrip - edited //M_Draw_Fill (xofs - (xofs *scr_2d_scale_h)/4 + 220, y - (y * scr_2d_scale_v)/2 + 232, 28, 3, bottom); //qb: adjust for scaling - mankrip - edited // draw number f = s->frags; sprintf (num, "%3i",f); Sbar_DrawCharacter ( (x+1)*8 , -24, num[0]); Sbar_DrawCharacter ( (x+2)*8 , -24, num[1]); Sbar_DrawCharacter ( (x+3)*8 , -24, num[2]); if (k == cl.viewentity - 1) { Sbar_DrawCharacter (x*8+2, -24, 16); Sbar_DrawCharacter ( (x+4)*8-4, -24, 17); } x+=4; } }
/* =============== Sbar_DrawFrags =============== */ void Sbar_DrawFrags(void) { int i, k, l; int top, bottom; int x, y, f; char num[12]; player_info_t *s; Sbar_SortFrags(false); // draw the text l = scoreboardlines <= 4 ? scoreboardlines : 4; x = 23; // xofs = (vid.width - 320)>>1; y = vid.height - SBAR_HEIGHT - 23; for (i = 0; i < l; i++) { k = fragsort[i]; s = &cl.players[k]; if (!s->name[0]) continue; if (s->spectator) continue; // draw background top = Sbar_ColorForMap(s->topcolor); bottom = Sbar_ColorForMap(s->bottomcolor); // Draw_Fill (xofs + x*8 + 10, y, 28, 4, top); // Draw_Fill (xofs + x*8 + 10, y+4, 28, 3, bottom); Draw_Fill(x * 8 + 10, y, 28, 4, top); Draw_Fill(x * 8 + 10, y + 4, 28, 3, bottom); // draw number f = s->frags; sprintf(num, "%3i", f); Sbar_DrawCharacter((x + 1) * 8, -24, num[0]); Sbar_DrawCharacter((x + 2) * 8, -24, num[1]); Sbar_DrawCharacter((x + 3) * 8, -24, num[2]); if (k == cl.playernum) { Sbar_DrawCharacter(x * 8 + 2, -24, 16); Sbar_DrawCharacter((x + 4) * 8 - 4, -24, 17); } x += 4; } }
/* =============== Sbar_DrawAmmoList =============== */ void Sbar_DrawAmmoList (int x, int y, int vertical) // default 0, -24, 0 { // existe uma diferença de 4 pixels pra direita ao se desenhar os números... int i; char num[12]; // mankrip - high values in the status bar - edited if (sbar.value > 3) if (!sb_showscores && !sbar_show_ammolist.value) return; for (i=0 ; i<4 ; i++) { sprintf (num, "%3i",cl.stats[STAT_SHELLS+i] ); if (vertical == 0) { if (num[0] != ' ') Sbar_DrawCharacter ( (6*i+1)*8 - 2 + x, y, 18 + num[0] - '0'); if (num[1] != ' ') Sbar_DrawCharacter ( (6*i+2)*8 - 2 + x, y, 18 + num[1] - '0'); if (num[2] != ' ') Sbar_DrawCharacter ( (6*i+3)*8 - 2 + x, y, 18 + num[2] - '0'); } else { if (num[0] != ' ') Sbar_DrawCharacter (x , y - i*8, 18 + num[0] - '0'); if (num[1] != ' ') Sbar_DrawCharacter (x + 8, y - i*8, 18 + num[1] - '0'); if (num[2] != ' ') Sbar_DrawCharacter (x + 16, y - i*8, 18 + num[2] - '0'); } /* (6 distância entre os valores, incluindo os números (ex: 100---200---) *i índice do valor (ex: shells=0, nails=1) +#) desloca o caracter na quantidade de espaços indicada pelo número *8 transforma a posição horizontal em quantidade de caracteres - 2 + x //*/ } }
/* =============== Sbar_DrawInventory =============== */ void Sbar_DrawInventory(void) { int i; char num[6]; float time; int flashon; qboolean headsup; qboolean hudswap; headsup = !(cl_sbar.value || scr_viewsize.value < 100); hudswap = cl_hudswap.value; // Get that nasty float out :) if (!headsup) Sbar_DrawPic(0, -24, sb_ibar); // weapons for (i = 0; i < 7; i++) { if (cl.stats[STAT_ITEMS] & (IT_SHOTGUN << i)) { time = cl.item_gettime[i]; flashon = qmax((int)((cl.time - time) * 10), 0); if (flashon >= 10) { if (cl.stats[STAT_ACTIVEWEAPON] == (IT_SHOTGUN << i)) flashon = 1; else flashon = 0; } else flashon = (flashon % 5) + 2; if (headsup) { if (i || vid.height > 200) Sbar_DrawSubPic((hudswap) ? 0 : (vid.width - 24), -68 - (7 - i) * 16, sb_weapons[flashon][i], 0, 0, 24, 16); } else Sbar_DrawPic(i * 24, -16, sb_weapons[flashon][i]); // Sbar_DrawSubPic (0,0,20,20,i*24, -16, sb_weapons[flashon][i]); if (flashon > 1) sb_updates = 0; // force update to remove flash } } // ammo counts for (i = 0; i < 4; i++) { sprintf(num, "%3i", cl.stats[STAT_SHELLS + i]); if (headsup) { // Sbar_DrawSubPic(3, -24, sb_ibar, 3, 0, 42,11); Sbar_DrawSubPic((hudswap) ? 0 : (vid.width - 42), -24 - (4 - i) * 11, sb_ibar, 3 + (i * 48), 0, 42, 11); if (num[0] != ' ') Sbar_DrawCharacter((hudswap) ? 3 : (vid.width - 39), -24 - (4 - i) * 11, 18 + num[0] - '0'); if (num[1] != ' ') Sbar_DrawCharacter((hudswap) ? 11 : (vid.width - 31), -24 - (4 - i) * 11, 18 + num[1] - '0'); if (num[2] != ' ') Sbar_DrawCharacter((hudswap) ? 19 : (vid.width - 23), -24 - (4 - i) * 11, 18 + num[2] - '0'); } else { if (num[0] != ' ') Sbar_DrawCharacter((6 * i + 1) * 8 - 2, -24, 18 + num[0] - '0'); if (num[1] != ' ') Sbar_DrawCharacter((6 * i + 2) * 8 - 2, -24, 18 + num[1] - '0'); if (num[2] != ' ') Sbar_DrawCharacter((6 * i + 3) * 8 - 2, -24, 18 + num[2] - '0'); } } flashon = 0; // items for (i = 0; i < 6; i++) if (cl.stats[STAT_ITEMS] & (1 << (17 + i))) { time = cl.item_gettime[17 + i]; if (time && time > cl.time - 2 && flashon) { // flash frame sb_updates = 0; } else Sbar_DrawPic(192 + i * 16, -16, sb_items[i]); if (time && time > cl.time - 2) sb_updates = 0; } // sigils for (i = 0; i < 4; i++) if (cl.stats[STAT_ITEMS] & (1 << (28 + i))) { time = cl.item_gettime[28 + i]; if (time && time > cl.time - 2 && flashon) { // flash frame sb_updates = 0; } else Sbar_DrawPic(320 - 32 + i * 8, -16, sb_sigil[i]); if (time && time > cl.time - 2) sb_updates = 0; } }
/* =============== Sbar_DrawFace =============== */ void Sbar_DrawFace (int x, int y) // default 112, 0 { int f, anim; // PGM 01/19/97 - team color drawing // PGM 03/02/97 - fixed so color swatch only appears in CTF modes if (rogue && (cl.maxclients != 1) && (teamplay.value>3) && (teamplay.value<7)) { int top, bottom; int xofs; char num[12]; scoreboard_t *s; s = &cl.scores[cl.viewentity - 1]; // draw background top = s->colors & 0xf0; bottom = (s->colors & 15)<<4; top = Sbar_ColorForMap (top); bottom = Sbar_ColorForMap (bottom); xofs = x + 2; // 113 mankrip - edited Sbar_DrawTransPic (x, 0, rsb_teambord); // 112 mankrip - edited M_Draw_Fill (xofs, 200 - SBAR_HEIGHT + 3, 20, 9, top ); // mankrip - edited M_Draw_Fill (xofs, 200 - SBAR_HEIGHT + 12, 20, 9, bottom); // mankrip - edited // draw number f = s->frags; sprintf (num, "%3i",f); if (top==8) { if (num[0] != ' ') Sbar_DrawCharacter(x - 3, 3, 18 + num[0] - '0'); // 109 mankrip - edited if (num[1] != ' ') Sbar_DrawCharacter(x + 4, 3, 18 + num[1] - '0'); // 116 mankrip - edited if (num[2] != ' ') Sbar_DrawCharacter(x + 11, 3, 18 + num[2] - '0'); // 123 mankrip - edited } else { Sbar_DrawCharacter ( x - 3, 3, num[0]); // 109 mankrip - edited Sbar_DrawCharacter ( x + 4, 3, num[1]); // 116 mankrip - edited Sbar_DrawCharacter ( x + 11, 3, num[2]); // 123 mankrip - edited } return; } // PGM 01/19/97 - team color drawing // mankrip - begin if (cl.stats[STAT_HEALTH] <= 0) { Sbar_DrawTransPic (x, y, sb_faces[0][0]); return; } // mankrip - end if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY)) == (IT_INVISIBILITY | IT_INVULNERABILITY) ) { Sbar_DrawTransPic (x, y, sb_face_invis_invuln); // mankrip - edited return; } if (cl.items & IT_QUAD) { Sbar_DrawTransPic (x, y, sb_face_quad ); // mankrip - edited return; } if (cl.items & IT_INVISIBILITY) { Sbar_DrawTransPic (x, y, sb_face_invis ); // mankrip - edited return; } if (cl.items & IT_INVULNERABILITY) { Sbar_DrawTransPic (x, y, sb_face_invuln); // mankrip - edited return; } if (cl.stats[STAT_HEALTH] >= 100) f = 4; else f = cl.stats[STAT_HEALTH] / 20; if (cl.time <= cl.faceanimtime) anim = 1; else anim = 0; Sbar_DrawTransPic (x, y, sb_faces[f][anim]); // mankrip - edited }