// // 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 // static void STlib_drawNum(st_number_t *n, byte *outrng, int alpha) { int numdigits = n->width; int num = n->num; int w = n->p[0]->width; int x; int neg; neg = num < 0; if(neg) { 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; // 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) { //jff 2/18/98 allow use of faster draw routine from config V_DrawPatchTL(x - w, n->y, &subscreen43, n->p[0], sts_always_red ? NULL : outrng, alpha); } // draw the new number //jff 2/16/98 add color translation to digit output while(num && numdigits--) { x -= w; //jff 2/18/98 allow use of faster draw routine from config V_DrawPatchTL(x, n->y, &subscreen43, n->p[ num % 10 ], sts_always_red ? NULL : outrng, alpha); num /= 10; } // draw a minus sign if necessary //jff 2/16/98 add color translation to digit output if(neg) { //jff 2/18/98 allow use of faster draw routine from config V_DrawPatchTL(x - 8, n->y, &subscreen43, sttminus, sts_always_red ? NULL : outrng, alpha); } }
// // HUDCrossHairWidget::drawer // // Draws the crosshair patch. // void HUDCrossHairWidget::drawer() { int drawx, drawy, h, w; byte *pal = color; // haleyjd 03/03/07: don't display while showing a center message if(!crosshairnum || crosshairs[crosshairnum - 1] == -1 || viewcamera || automapactive || centermessage_widget.cleartic > leveltime) return; patch = PatchLoader::CacheNum(wGlobalDir, crosshairs[crosshairnum - 1], PU_CACHE); // where to draw?? w = patch->width; h = patch->height; drawx = (SCREENWIDTH - w) / 2; // haleyjd 04/09/05: this kludge moves the crosshair to within // a tolerable distance of the player's true vertical aim when // the screen size is less than full. if(scaledwindow.height != SCREENHEIGHT) { // use 1/5 of the displayplayer's pitch angle in integer degrees int angle = players[displayplayer].pitch / (ANGLE_1*5); drawy = scaledwindow.y + (scaledwindow.height - h) / 2 + angle; } else drawy = scaledwindow.y + (scaledwindow.height - h) / 2; if(pal == notargetcolour) V_DrawPatchTL(drawx, drawy, &subscreen43, patch, pal, FTRANLEVEL); else V_DrawPatchTranslated(drawx, drawy, &subscreen43, patch, pal, false); }
// // HUDPatchWidget::drawer // // Default drawing function for patch widgets. All the logic for // deciding whether the patch is translucent and/or translated is // already implemented in V_DrawPatchTL via the generalized patch // drawing system. // void HUDPatchWidget::drawer() { // be sure the patch is loaded patch = PatchLoader::CacheName(wGlobalDir, patchname, PU_CACHE); V_DrawPatchTL(x, y, &subscreen43, patch, color, tl_level); }
// // 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, int alpha) { if(*mi->on) { // killough 2/16/98: redraw only if != -1 if(*mi->inum != -1) V_DrawPatchTL(mi->x, mi->y, &subscreen43, mi->p[*mi->inum], NULL, alpha); } }
// // STlib_updatePercent() // // Draws a number/percent conditionally based on the widget's enable // // Passed a precent widget, the output color range, and a refresh flag // Returns nothing // // jff 2/16/98 add color translation to digit output // void STlib_updatePercent(st_percent_t *per, byte *outrng, int alpha) { if(*per->n.on) // killough 2/21/98: fix percents not updated { byte *tlate = NULL; // jff 2/18/98 allow use of faster draw routine from config // also support gray-only percents if(!sts_always_red) tlate = sts_pct_always_gray ? cr_gray : outrng; V_DrawPatchTL(per->n.x, per->n.y, &subscreen43, per->p, tlate, alpha); } STlib_updateNum(&per->n, outrng, alpha); }