// // 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 - bi->p->leftoffset; y = bi->y - bi->p->topoffset; w = bi->p->width; h = bi->p->height; #ifdef RANGECHECK if (y - ST_Y < 0) I_Error("STlib_updateBinIcon: y - ST_Y < 0"); #endif if (*bi->val) { V_DrawNumPatch(bi->x, bi->y, FG_L, bi->p->lumpnum, CR_DEFAULT, VPT_STRETCH); V_DrawNumPatch(bi->x, bi->y, FG_R, bi->p->lumpnum, CR_DEFAULT, VPT_STRETCH); } else { V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG_L, VPT_STRETCH); V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG_R, VPT_STRETCH); } 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 - mi->p[mi->oldinum].leftoffset; y = mi->y - mi->p[mi->oldinum].topoffset; w = mi->p[mi->oldinum].width; h = mi->p[mi->oldinum].height; #ifdef RANGECHECK if (y - ST_Y < 0) I_Error("STlib_updateMultIcon: y - ST_Y < 0"); #endif V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG_L, VPT_STRETCH); V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG_R, VPT_STRETCH); } if (*mi->inum != -1) { // killough 2/16/98: redraw only if != -1 V_DrawNumPatch(mi->x, mi->y, FG_L, mi->p[*mi->inum].lumpnum, CR_DEFAULT, VPT_STRETCH); V_DrawNumPatch(mi->x, mi->y, FG_R, mi->p[*mi->inum].lumpnum, CR_DEFAULT, VPT_STRETCH); } mi->oldinum = *mi->inum; } }
static void ST_refreshBackground(void) { int y = ST_Y; enum patch_translation_e flags = VPT_ALIGN_LEFT_TOP; if (st_statusbaron) { flags = VPT_ALIGN_BOTTOM; V_DrawNumPatch(ST_X, y, BG, stbarbg.lumpnum, CR_DEFAULT, flags); if (!deathmatch) { V_DrawNumPatch(ST_ARMSBGX, y, BG, armsbg.lumpnum, CR_DEFAULT, flags); } // killough 3/7/98: make face background change with displayplayer if (netgame) { V_DrawNumPatch(ST_FX, y, BG, faceback.lumpnum, displayplayer ? CR_LIMIT+displayplayer : CR_DEFAULT, displayplayer ? (VPT_TRANS | VPT_ALIGN_BOTTOM) : flags); } V_CopyRect(BG, FG, ST_X + wide_offsetx, SCREENHEIGHT - ST_SCALED_HEIGHT, ST_SCALED_WIDTH, ST_SCALED_HEIGHT, VPT_NONE); } }
// // 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 patchnum_t* bgp ) { int xs = bgp[0].width; int ys = bgp[0].height; int i,j; // CPhipps - patch drawing updated // top rows V_DrawNumPatch(x, y, FG, bgp[0].lumpnum, CR_DEFAULT, VPT_STRETCH); // ul for (j=x+xs;j<x+w-xs;j+=xs) // uc V_DrawNumPatch(j, y, FG, bgp[1].lumpnum, CR_DEFAULT, VPT_STRETCH); V_DrawNumPatch(j, y, FG, bgp[2].lumpnum, CR_DEFAULT, VPT_STRETCH); // ur // middle rows for (i=y+ys;i<y+h-ys;i+=ys) { V_DrawNumPatch(x, i, FG, bgp[3].lumpnum, CR_DEFAULT, VPT_STRETCH); // cl for (j=x+xs;j<x+w-xs;j+=xs) // cc V_DrawNumPatch(j, i, FG, bgp[4].lumpnum, CR_DEFAULT, VPT_STRETCH); V_DrawNumPatch(j, i, FG, bgp[5].lumpnum, CR_DEFAULT, VPT_STRETCH); // cr } // bottom row V_DrawNumPatch(x, i, FG, bgp[6].lumpnum, CR_DEFAULT, VPT_STRETCH); // ll for (j=x+xs;j<x+w-xs;j+=xs) // lc V_DrawNumPatch(j, i, FG, bgp[7].lumpnum, CR_DEFAULT, VPT_STRETCH); V_DrawNumPatch(j, i, FG, bgp[8].lumpnum, CR_DEFAULT, VPT_STRETCH); // 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; int oc = l->cm; //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->cm = l->l[i]-'0'; } else if (c != ' ' && c >= l->sc && c <= 127) { w = l->f[c - l->sc].width; if (x+w > BASE_WIDTH) break; // killough 1/18/98 -- support multiple lines: // CPhipps - patch drawing updated V_DrawNumPatch(x, y, FG, l->f[c - l->sc].lumpnum, l->cm, VPT_TRANS | VPT_STRETCH); x += w; } else { x += 4; if (x >= BASE_WIDTH) break; } } l->cm = oc; //jff 2/17/98 restore original color // draw the cursor if requested if (drawcursor && x + l->f['_' - l->sc].width <= BASE_WIDTH) { // killough 1/18/98 -- support multiple lines // CPhipps - patch drawing updated V_DrawNumPatch(x, y, FG, l->f['_' - l->sc].lumpnum, CR_DEFAULT, VPT_NONE | VPT_STRETCH); } }
// // 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 != (signed)*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("STlib_updateBinIcon: y - ST_Y < 0"); #endif if (*bi->val) V_DrawNumPatch(bi->x, bi->y, FG, bi->p->lumpnum, CR_DEFAULT, VPT_STRETCH); else V_CopyRect(x, y-ST_Y, BG, w, h, x, y, FG, VPT_STRETCH); bi->oldval = *bi->val; } }
static int WI_drawNum(int x, int y, int n, int digits) { int fontwidth = num[0].width; int neg; int temp; if (digits < 0) { if (!n) { digits = 1; } else { digits = 0; temp = n; while (temp) { temp /= 10; digits++; } } } neg = n < 0; if (neg) n = -n; if (n == 1994) return 0; while (digits--) { x -= fontwidth; V_DrawNumPatch(x, y, FB, num[n % 10].lumpnum, CR_DEFAULT, VPT_STRETCH); n /= 10; } if (neg) V_DrawNamePatch(x -= 8, y, FB, wiminus, CR_DEFAULT, VPT_STRETCH); return x; }
void STlib_updatePercent ( st_percent_t* per, int cm, 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_DrawNumPatch(per->n.x, per->n.y, FG_L, per->p->lumpnum, sts_pct_always_gray ? CR_GRAY : cm, (sts_always_red ? VPT_NONE : VPT_TRANS) | VPT_STRETCH); V_DrawNumPatch(per->n.x, per->n.y, FG_R, per->p->lumpnum, sts_pct_always_gray ? CR_GRAY : cm, (sts_always_red ? VPT_NONE : VPT_TRANS) | VPT_STRETCH); } STlib_updateNum(&per->n, cm, refresh); }
void R_DemoEx_ShowComment(void) { extern patchnum_t hu_font[]; int lump; int cx = 10; int cy = 10; const char* ch; int count; int w; if (!use_demoex_info) return; lump = W_CheckNumForName(DEMOEX_COMMENT_LUMPNAME); if (lump == -1) return; count = W_LumpLength(lump); if (count <= 0) return; ch = W_CacheLumpNum(lump); 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 = hu_font[c].width; if (cx + w > SCREENWIDTH) break; V_DrawNumPatch(cx, cy, 0, hu_font[c].lumpnum, CR_DEFAULT, VPT_STRETCH); cx += w; } W_UnlockLumpNum(lump); }
static void ST_refreshBackground(void) { int y=0; if (st_statusbaron) { // proff 05/17/2000: draw to the frontbuffer in OpenGL V_DrawNumPatch(ST_X, y, BG, stbarbg.lumpnum, CR_DEFAULT, VPT_STRETCH); if (st_armson) V_DrawNumPatch(ST_ARMSBGX, y, BG, armsbg.lumpnum, CR_DEFAULT, VPT_STRETCH); // killough 3/7/98: make face background change with displayplayer if (netgame) { V_DrawNumPatch(ST_FX, y, BG, faceback.lumpnum, displayplayer ? CR_LIMIT+displayplayer : CR_DEFAULT, displayplayer ? (VPT_TRANS | VPT_STRETCH) : VPT_STRETCH); } V_CopyRect(ST_X, y, BG, ST_SCALED_WIDTH, ST_SCALED_HEIGHT, ST_X, ST_SCALED_Y, FG, VPT_NONE); } }
// ==================================================================== // WI_drawNum // Purpose: Draws a number. If digits > 0, then use that many digits // minimum, otherwise only use as many as necessary // Args: x, y -- location // n -- the number to be drawn // digits -- number of digits minimum or zero // Returns: new x position after drawing (note we are going to the left) // CPhipps - static static int WI_drawNum (int x, int y, int n, int digits) { int fontwidth = num[0].width; int neg; int temp; if (digits < 0) { if (!n) { // make variable-length zeros 1 digit long digits = 1; } else { // figure out # of digits in # digits = 0; temp = n; while (temp) { temp /= 10; digits++; } } } neg = n < 0; if (neg) n = -n; // if non-number, do not draw it if (n == 1994) return 0; // draw the new number while (digits--) { x -= fontwidth; // CPhipps - patch drawing updated V_DrawNumPatch(x, y, FB, num[ n % 10 ].lumpnum, CR_DEFAULT, VPT_STRETCH); n /= 10; } // draw a minus sign if necessary if (neg) // CPhipps - patch drawing updated V_DrawNamePatch(x-=8, y, FB, wiminus, CR_DEFAULT, VPT_STRETCH); return x; }
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 = 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 = hu_font[c].width; // CPhipps - patch drawing updated V_DrawNumPatch(cx, 180, 0, hu_font[c].lumpnum, CR_DEFAULT, VPT_STRETCH); cx+=w; } }
// ==================================================================== // WI_drawAnimatedBack // Purpose: Actually do the animation (whew!) // Args: none // Returns: void // void WI_drawAnimatedBack(void) { int i; anim_t* a; if (gamemode==commercial) //jff 4/25/98 Someone forgot commercial an enum return; if (wbs->epsd > 2) return; for (i=0 ; i<NUMANIMS[wbs->epsd] ; i++) { a = &anims[wbs->epsd][i]; if (a->ctr >= 0) // CPhipps - patch drawing updated V_DrawNumPatch(a->loc.x, a->loc.y, FB, a->p[a->ctr].lumpnum, CR_DEFAULT, VPT_STRETCH); } }
static void F_TextWrite (void) { V_DrawBackground(finaleflat, 0); { // draw some of the text onto the screen int cx = 10; int cy = 10; const char* ch = finaletext; // CPhipps - const int count = (int)((float)(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 = hu_font[c].width; if (cx+w > SCREENWIDTH) break; // CPhipps - patch drawing updated V_DrawNumPatch(cx, cy, 0, hu_font[c].lumpnum, CR_DEFAULT, VPT_STRETCH); cx+=w; } } }
static void WI_drawAnimatedBack(void) { int i; anim_t *a; if (gamemode==commercial) return; if (wbs->epsd > 2) return; for (i = 0; i < NUMANIMS[wbs->epsd]; i++) { a = &anims[wbs->epsd][i]; if (a->ctr >= 0) V_DrawNumPatch(a->loc.x, a->loc.y, FB, a->p[a->ctr].lumpnum, CR_DEFAULT, VPT_STRETCH); } }
OVERLAY void F_CastDrawer (void) { spritedef_t* sprdef; spriteframe_t* sprframe; int lump; boolean flip; // erase the entire screen to a background // CPhipps - patch drawing updated V_DrawNamePatch(0,0,0, bgcastcall, NULL, VPT_STRETCH); // Ty 03/30/98 bg texture extern F_CastPrint (*(castorder[castnum].name)); // draw the current frame in the middle of the screen sprdef = &sprites[caststate->sprite]; sprframe = &sprdef->spriteframes[ caststate->frame & FF_FRAMEMASK]; lump = sprframe->lump[0]; flip = (boolean)sprframe->flip[0]; // CPhipps - patch drawing updated V_DrawNumPatch(160, 170, 0, lump+firstspritelump, NULL, (enum patch_translation_e)(VPT_STRETCH | (flip ? VPT_FLIP : 0))); }
/* * 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, int cm, dboolean refresh ) { int numdigits = n->width; int num = *n->num; int w = n->p[0].width; int h = 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("STlib_drawNum: n->y - ST_Y < 0"); #endif V_CopyRect(BG, FG, x, n->y, w * numdigits, h, VPT_STRETCH | VPT_ALIGN_BOTTOM); // 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_DrawNumPatch(x - w, n->y, FG, n->p[0].lumpnum, cm, (((cm!=CR_DEFAULT) && !sts_always_red) ? VPT_TRANS : VPT_NONE) | VPT_ALIGN_BOTTOM); // 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_DrawNumPatch(x, n->y, FG, n->p[num % 10].lumpnum, cm, (((cm!=CR_DEFAULT) && !sts_always_red) ? VPT_TRANS : VPT_NONE) | VPT_ALIGN_BOTTOM); 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", cm, (((cm!=CR_DEFAULT) && !sts_always_red) ? VPT_TRANS : VPT_NONE) | VPT_ALIGN_BOTTOM); }
void R_FillBackScreen (void) { int automap = ((automapmode & am_active) && !(automapmode & am_overlay)); if (grnrock.lumpnum == 0) return; // e6y: wide-res if (wide_ratio || wide_offsety) { extern int screenblocks; int only_stbar; #ifdef GL_DOOM if (V_GetMode() == VID_MODEGL) { only_stbar = (automap ? screenblocks >= 10 : screenblocks == 10); } else #endif { only_stbar = screenblocks >= 10; } if (only_stbar) { int stbar_top = SCREENHEIGHT - ST_SCALED_HEIGHT; V_FillFlat(grnrock.lumpnum, 1, 0, stbar_top, wide_offsetx, ST_SCALED_HEIGHT, VPT_NONE); V_FillFlat(grnrock.lumpnum, 1, SCREENWIDTH - wide_offsetx, stbar_top, wide_offsetx, ST_SCALED_HEIGHT, VPT_NONE); // line between view and status bar V_FillPatch(brdr_b.lumpnum, 1, 0, stbar_top, wide_offsetx, brdr_b.height, VPT_NONE); V_FillPatch(brdr_b.lumpnum, 1, SCREENWIDTH - wide_offsetx, stbar_top, wide_offsetx, brdr_b.height, VPT_NONE); return; } } if (scaledviewwidth == SCREENWIDTH) return; V_FillFlat(grnrock.lumpnum, 1, 0, 0, SCREENWIDTH, SCREENHEIGHT, VPT_NONE); // line between view and status bar if ((wide_ratio || wide_offsety) && (automap || scaledviewwidth == SCREENWIDTH)) { V_FillPatch(brdr_b.lumpnum, 1, 0, SCREENHEIGHT - ST_SCALED_HEIGHT, SCREENWIDTH, brdr_b.height, VPT_NONE); } V_FillPatch(brdr_t.lumpnum, 1, viewwindowx, viewwindowy-8, scaledviewwidth, brdr_t.height, VPT_NONE); V_FillPatch(brdr_b.lumpnum, 1, viewwindowx, viewwindowy+viewheight, scaledviewwidth, brdr_b.height, VPT_NONE); V_FillPatch(brdr_l.lumpnum, 1, viewwindowx-8, viewwindowy, brdr_l.width, viewheight, VPT_NONE); V_FillPatch(brdr_r.lumpnum, 1, viewwindowx+scaledviewwidth, viewwindowy, brdr_r.width, viewheight, VPT_NONE); // Draw beveled edge. V_DrawNumPatch(viewwindowx-8,viewwindowy-8,1,brdr_tl.lumpnum, CR_DEFAULT, VPT_NONE); V_DrawNumPatch(viewwindowx+scaledviewwidth,viewwindowy-8,1,brdr_tr.lumpnum, CR_DEFAULT, VPT_NONE); V_DrawNumPatch(viewwindowx-8,viewwindowy+viewheight,1,brdr_bl.lumpnum, CR_DEFAULT, VPT_NONE); V_DrawNumPatch(viewwindowx+scaledviewwidth,viewwindowy+viewheight,1,brdr_br.lumpnum, CR_DEFAULT, VPT_NONE); }