// // HUlib_drawMBg() // // Draws a background box which the message display review widget can // display over // // Passed position, width, height, and the background patches // Returns nothing // void HUlib_drawMBg ( int x, int y, int w, int h, const patch_t** bgp ) { int xs = bgp[0]->width; int ys = bgp[0]->height; int i,j; // CPhipps - patch drawing updated // top rows V_DrawMemPatch(x, y, FG, bgp[0], NULL, VPT_NONE); // ul for (j=x+xs; j<x+w-xs; j+=xs) // uc V_DrawMemPatch(j, y, FG, bgp[1], NULL, VPT_NONE); V_DrawMemPatch(j, y, FG, bgp[2], NULL, VPT_NONE); // ur // middle rows for (i=y+ys; i<y+h-ys; i+=ys) { V_DrawMemPatch(x, i, FG, bgp[3], NULL, VPT_NONE); // cl for (j=x+xs; j<x+w-xs; j+=xs) // cc V_DrawMemPatch(j, i, FG, bgp[4], NULL, VPT_NONE); V_DrawMemPatch(j, i, FG, bgp[5], NULL, VPT_NONE); // cr } // bottom row V_DrawMemPatch(x, i, FG, bgp[6], NULL, VPT_NONE); // ll for (j=x+xs; j<x+w-xs; j+=xs) // lc V_DrawMemPatch(j, i, FG, bgp[7], NULL, VPT_NONE); V_DrawMemPatch(j, i, FG, bgp[8], NULL, VPT_NONE); // lr }
// // HUlib_drawTextLine() // // Draws a hu_textline_t widget // // Passed the hu_textline_t and flag whether to draw a cursor // Returns nothing // void HUlib_drawTextLine ( hu_textline_t* l, boolean drawcursor ) { int i; int w; int x; unsigned char c; const char *oc = l->cr; //jff 2/17/98 remember default color int y = l->y; // killough 1/18/98 -- support multiple lines // draw the new stuff x = l->x; for (i=0; i<l->len; i++) { c = toupper(l->l[i]); //jff insure were not getting a cheap toupper conv. if (c=='\n') // killough 1/18/98 -- support multiple lines x=0,y+=8; else if (c=='\t') // killough 1/23/98 -- support tab stops x=x-x%80+80; else if (c=='\x1b') //jff 2/17/98 escape code for color change { //jff 3/26/98 changed to actual escape char if (++i<l->len) if (l->l[i]>='0' && l->l[i]<='9') l->cr = colrngs[l->l[i]-'0']; } else if (c != ' ' && c >= l->sc && c <= 127) { w = SHORT(l->f[c - l->sc]->width); if (x+w > SCREENWIDTH) break; // killough 1/18/98 -- support multiple lines: // CPhipps - patch drawing updated V_DrawMemPatch(x, y, FG, l->f[c - l->sc], l->cr, VPT_TRANS); x += w; } else { x += 4; if (x >= SCREENWIDTH) break; } } l->cr = oc; //jff 2/17/98 restore original color // draw the cursor if requested if (drawcursor && x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH) { // killough 1/18/98 -- support multiple lines // CPhipps - patch drawing updated V_DrawMemPatch(x, y, FG, l->f['_' - l->sc], NULL, VPT_NONE); } }
// // STlib_updateBinIcon() // // DInitialize a st_binicon_t widget, used for a multinumber display // like the status bar's weapons, that are present or not. // // Draw a st_binicon_t widget, used for a multinumber display // like the status bar's weapons that are present or not. Displays each // when the control flag changes or refresh is true // // Passed a st_binicon_t widget, and a refresh flag // Returns nothing. // void STlib_updateBinIcon ( st_binicon_t* bi, boolean refresh ) { int x; int y; int w; int h; if (*bi->on && (bi->oldval != *bi->val || refresh)) { x = bi->x - SHORT(bi->p->leftoffset); y = bi->y - SHORT(bi->p->topoffset); w = SHORT(bi->p->width); h = SHORT(bi->p->height); #ifdef RANGECHECK if (y - ST_Y < 0) I_Error("updateBinIcon: y - ST_Y < 0"); #endif if (*bi->val) V_DrawMemPatch(bi->x, bi->y, FG, bi->p, NULL, VPT_NONE); else V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG); bi->oldval = *bi->val; } }
// // STlib_updateMultIcon() // // Draw a st_multicon_t widget, used for a multigraphic display // like the status bar's keys. Displays each when the control // numbers change or refresh is true // // Passed a st_multicon_t widget, and a refresh flag // Returns nothing. // void STlib_updateMultIcon ( st_multicon_t* mi, boolean refresh ) { int w; int h; int x; int y; if (*mi->on && (mi->oldinum != *mi->inum || refresh)) { if (mi->oldinum != -1) { x = mi->x - SHORT(mi->p[mi->oldinum]->leftoffset); y = mi->y - SHORT(mi->p[mi->oldinum]->topoffset); w = SHORT(mi->p[mi->oldinum]->width); h = SHORT(mi->p[mi->oldinum]->height); #ifdef RANGECHECK if (y - ST_Y < 0) I_Error("updateMultIcon: y - ST_Y < 0"); #endif V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG); } if (*mi->inum != -1) // killough 2/16/98: redraw only if != -1 V_DrawMemPatch(mi->x, mi->y, FG, mi->p[*mi->inum], NULL, VPT_NONE); mi->oldinum = *mi->inum; } }
void F_TextWrite (void) { { // erase the entire screen to a tiled background const byte *src; // cph - const int x,y; int lump; // killough 4/17/98: src = W_CacheLumpNum(lump = firstflat + R_FlatNumForName(finaleflat)); V_DrawBlock(0, 0, 0, 64, 64, src, 0); for (y=0 ; y<SCREENHEIGHT ; y+=64) for (x=y ? 0 : 64; x<SCREENWIDTH ; x+=64) V_CopyRect(0, 0, 0, ((SCREENWIDTH-x) < 64) ? (SCREENWIDTH-x) : 64, ((SCREENHEIGHT-y) < 64) ? (SCREENHEIGHT-y) : 64, x, y, 0); W_UnlockLumpNum(lump); } V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); { // draw some of the text onto the screen int cx = 10; int cy = 10; const char* ch = finaletext; // CPhipps - const int count = (finalecount - 10)/Get_TextSpeed(); // phares int w; if (count < 0) count = 0; for ( ; count ; count-- ) { int c = *ch++; if (!c) break; if (c == '\n') { cx = 10; cy += 11; continue; } c = toupper(c) - HU_FONTSTART; if (c < 0 || c> HU_FONTSIZE) { cx += 4; continue; } w = SHORT (hu_font[c]->width); if (cx+w > SCREENWIDTH) break; // CPhipps - patch drawing updated V_DrawMemPatch(cx, cy, 0, hu_font[c], NULL, VPT_STRETCH); cx+=w; } } }
OVERLAY static void F_CastPrint (const char* text) // CPhipps - static, const char* { const char* ch; // CPhipps - const int c; int cx; int w; int width; // find width ch = text; width = 0; while (ch) { c = *ch++; if (!c) break; c = toupper(c) - HU_FONTSTART; if (c < 0 || c> HU_FONTSIZE) { width += 4; continue; } w = SHORT (hu_font[c]->width); width += w; } // draw it cx = 160-width/2; ch = text; while (ch) { c = *ch++; if (!c) break; c = toupper(c) - HU_FONTSTART; if (c < 0 || c> HU_FONTSIZE) { cx += 4; continue; } w = SHORT (hu_font[c]->width); // CPhipps - patch drawing updated V_DrawMemPatch(cx, 180, 0, hu_font[c], NULL, VPT_STRETCH); cx+=w; } }
void STlib_updatePercent ( st_percent_t* per, const byte *outrng, int refresh ) { if (*per->n.on && (refresh || (per->n.oldnum != *per->n.num))) { // killough 2/21/98: fix percents not updated; /* CPhipps - make %'s only be updated if number changed */ // CPhipps - patch drawing updated V_DrawMemPatch(per->n.x, per->n.y, FG, per->p, sts_pct_always_gray ? cr_gray : outrng, sts_always_red ? VPT_NONE : VPT_TRANS); } STlib_updateNum(&per->n, outrng, refresh); }
OVERLAY void ST_refreshBackground(void) { if (st_statusbaron) { // CPhipps - patch drawing updated V_DrawBlock(ST_X, 0, BG, sbar_width, sbar_height, sbar, VPT_NONE); // killough 3/7/98: make face background change with displayplayer if (netgame) { int whattrans = playernumtotrans[displayplayer]; V_DrawMemPatch(ST_FX, 0, BG, faceback, whattrans ? translationtables + 256*(whattrans-1) : NULL, whattrans ? VPT_TRANS : VPT_NONE); } V_CopyRect(ST_X, 0, BG, ST_WIDTH, ST_HEIGHT, ST_X, ST_Y, FG); } }
OVERLAY void F_TextWrite (void) { V_DrawBackground(finaleflat); { // draw some of the text onto the screen int cx = 10; int cy = 10; const char* ch = finaletext; // CPhipps - const int count = FixedDiv(((finalecount - 10) * FRACUNIT), Get_TextSpeed()) >> FRACBITS; int w; if (count < 0) count = 0; for ( ; count ; count-- ) { int c = *ch++; if (!c) break; if (c == '\n') { cx = 10; cy += 11; continue; } c = toupper(c) - HU_FONTSTART; if (c < 0 || c> HU_FONTSIZE) { cx += 4; continue; } w = SHORT (hu_font[c]->width); if (cx+w > SCREENWIDTH) break; // CPhipps - patch drawing updated V_DrawMemPatch(cx, cy, 0, hu_font[c], NULL, VPT_STRETCH); cx+=w; } } }
/* * STlib_drawNum() * * A fairly efficient way to draw a number based on differences from the * old number. * * Passed a st_number_t widget, a color range for output, and a flag * indicating whether refresh is needed. * Returns nothing * * jff 2/16/98 add color translation to digit output * cphipps 10/99 - const pointer to colour trans table, made function static */ static void STlib_drawNum ( st_number_t* n, const byte *outrng, boolean refresh ) { int numdigits = n->width; int num = *n->num; int w = SHORT(n->p[0]->width); int h = SHORT(n->p[0]->height); int x = n->x; int neg; // leban 1/20/99: // strange that somebody went through all the work to draw only the // differences, and then went and constantly redrew all the numbers. // return without drawing if the number didn't change and the bar // isn't refreshing. if(n->oldnum == num && !refresh) return; // CPhipps - compact some code, use num instead of *n->num if ((neg = (n->oldnum = num) < 0)) { if (numdigits == 2 && num < -9) num = -9; else if (numdigits == 3 && num < -99) num = -99; num = -num; } // clear the area x = n->x - numdigits*w; #ifdef RANGECHECK if (n->y - ST_Y < 0) I_Error("drawNum: n->y - ST_Y < 0"); #endif V_CopyRect(x, n->y - ST_Y, BG, w*numdigits, h, x, n->y, FG); // if non-number, do not draw it if (num == 1994) return; x = n->x; //jff 2/16/98 add color translation to digit output // in the special case of 0, you draw 0 if (!num) // CPhipps - patch drawing updated, reformatted V_DrawMemPatch(x - w, n->y, FG, n->p[0], outrng, (outrng && !sts_always_red) ? VPT_TRANS : VPT_NONE); // draw the new number //jff 2/16/98 add color translation to digit output while (num && numdigits--) { // CPhipps - patch drawing updated, reformatted x -= w; V_DrawMemPatch(x, n->y, FG, n->p[num % 10], outrng, (outrng && !sts_always_red) ? VPT_TRANS : VPT_NONE); num /= 10; } // draw a minus sign if necessary //jff 2/16/98 add color translation to digit output // cph - patch drawing updated, load by name instead of acquiring pointer earlier if (neg) V_DrawNamePatch(x - w, n->y, FG, "STTMINUS", outrng, (outrng && !sts_always_red) ? VPT_TRANS : VPT_NONE); }