// // F_Drawer // OVERLAY void F_Drawer (void) { if (finalestage == 2) { F_CastDrawer (); return; } if (!finalestage) F_TextWrite (); else { switch (gameepisode) { // CPhipps - patch drawing updated case 1: if ( gamemode == retail ) V_DrawNamePatch(0, 0, 0, "CREDIT", NULL, VPT_STRETCH); else V_DrawNamePatch(0, 0, 0, "HELP2", NULL, VPT_STRETCH); break; case 2: V_DrawNamePatch(0, 0, 0, "VICTORY2", NULL, VPT_STRETCH); break; case 3: F_BunnyScroll (); break; case 4: V_DrawNamePatch(0, 0, 0, "ENDPIC", NULL, VPT_STRETCH); break; } } }
// ==================================================================== // WI_drawStats // Purpose: Put the solo stats on the screen // Args: none // Returns: void // // proff/nicolas 09/20/98 -- changed for hi-res // CPhipps - patch drawing updated void WI_drawStats(void) { // line height int lh; lh = (3*num[0].height)/2; WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); WI_drawLF(); V_DrawNamePatch(SP_STATSX, SP_STATSY, FB, kills, CR_DEFAULT, VPT_STRETCH); if (cnt_kills) WI_drawPercent(320 - SP_STATSX, SP_STATSY, cnt_kills[0]); V_DrawNamePatch(SP_STATSX, SP_STATSY+lh, FB, items, CR_DEFAULT, VPT_STRETCH); if (cnt_items) WI_drawPercent(320 - SP_STATSX, SP_STATSY+lh, cnt_items[0]); V_DrawNamePatch(SP_STATSX, SP_STATSY+2*lh, FB, sp_secret, CR_DEFAULT, VPT_STRETCH); if (cnt_secret) WI_drawPercent(320 - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0]); WI_drawTimeStats(cnt_time, cnt_total_time, cnt_par); }
static void WI_drawTime(int x, int y, int t) { int n; if (t < 0) return; if (t < 100 * 60 * 60) for (;;) { n = t % 60; t /= 60; x = WI_drawNum(x, y, n, (t || n > 9) ? 2 : 1) - V_NamePatchWidth(colon); if (t) V_DrawNamePatch(x, y, FB, colon, CR_DEFAULT, VPT_STRETCH); else break; } else V_DrawNamePatch(x - V_NamePatchWidth(sucks), y, FB, sucks, CR_DEFAULT, VPT_STRETCH); }
static void WI_drawTimeStats(int cnt_time, int cnt_total_time, int cnt_par) { V_DrawNamePatch(SP_TIMEX, SP_TIMEY, FB, time1, CR_DEFAULT, VPT_STRETCH); WI_drawTime(320 / 2 - SP_TIMEX, SP_TIMEY, cnt_time); V_DrawNamePatch(SP_TIMEX, (SP_TIMEY + 200) / 2, FB, total, CR_DEFAULT, VPT_STRETCH); WI_drawTime(320 / 2 - SP_TIMEX, (SP_TIMEY + 200) / 2, cnt_total_time); }
static void WI_drawEL(void) { int y = WI_TITLEY; char lname[9]; WI_levelNameLump(wbs->epsd, wbs->next, lname); V_DrawNamePatch((320 - V_NamePatchWidth(entering)) / 2, y, FB, entering, CR_DEFAULT, VPT_STRETCH); y += (5 * V_NamePatchHeight(lname)) / 4; V_DrawNamePatch((320 - V_NamePatchWidth(lname)) / 2, y, FB, lname, CR_DEFAULT, VPT_STRETCH); }
static void WI_drawLF(void) { int y = WI_TITLEY; char lname[9]; WI_levelNameLump(wbs->epsd, wbs->last, lname); V_DrawNamePatch((320 - V_NamePatchWidth(lname)) / 2, y, FB, lname, CR_DEFAULT, VPT_STRETCH); y += (5 * V_NamePatchHeight(lname)) / 4; V_DrawNamePatch((320 - V_NamePatchWidth(finished)) / 2, y, FB, finished, CR_DEFAULT, VPT_STRETCH); }
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; }
static void WI_drawOnLnode(int n, const char *const c[]) { int i = 0; boolean fits = false; do { const rpatch_t *patch = R_CachePatchName(c[i]); int left = lnodes[wbs->epsd][n].x - patch->leftoffset; int top = lnodes[wbs->epsd][n].y - patch->topoffset; int right = left + patch->width; int bottom = top + patch->height; R_UnlockPatchName(c[i]); if (left >= 0 && right < 320 && top >= 0 && bottom < 200) fits = true; else i++; } while (!fits && i != 2); if (fits && i < 2) V_DrawNamePatch(lnodes[wbs->epsd][n].x, lnodes[wbs->epsd][n].y, FB, c[i], CR_DEFAULT, VPT_STRETCH); else I_Error("WI_drawOnLnode: Could not place patch on level %d", n + 1); }
// ==================================================================== // WI_drawPercent // Purpose: Draws a percentage, really just a call to WI_drawNum // after putting a percent sign out there // Args: x, y -- location // p -- the percentage value to be drawn, no negatives // Returns: void // CPhipps - static static void WI_drawPercent(int x, int y, int p) { if (p < 0) return; // CPhipps - patch drawing updated V_DrawNamePatch(x, y, FB, percent, CR_DEFAULT, VPT_STRETCH); WI_drawNum(x, y, p, -1); }
// ==================================================================== // WI_drawLF // Purpose: Draw the "Finished" level name before showing stats // Args: none // Returns: void // void WI_drawLF(void) { int y = WI_TITLEY; char lname[9]; // draw <LevelName> /* cph - get the graphic lump name and use it */ WI_levelNameLump(wbs->epsd, wbs->last, lname); // CPhipps - patch drawing updated V_DrawNamePatch((320 - V_NamePatchWidth(lname))/2, y, FB, lname, CR_DEFAULT, VPT_STRETCH); // draw "Finished!" y += (5*V_NamePatchHeight(lname))/4; // CPhipps - patch drawing updated V_DrawNamePatch((320 - V_NamePatchWidth(finished))/2, y, FB, finished, CR_DEFAULT, VPT_STRETCH); }
static void WI_drawPercent(int x, int y, int p) { if (p < 0) return; V_DrawNamePatch(x, y, FB, percent, CR_DEFAULT, VPT_STRETCH); WI_drawNum(x, y, p, -1); }
// ==================================================================== // WI_drawEL // Purpose: Draw introductory "Entering" and level name // Args: none // Returns: void // void WI_drawEL(void) { int y = WI_TITLEY; char lname[9]; /* cph - get the graphic lump name */ WI_levelNameLump(wbs->epsd, wbs->next, lname); // draw "Entering" // CPhipps - patch drawing updated V_DrawNamePatch((320 - V_NamePatchWidth(entering))/2, y, FB, entering, CR_DEFAULT, VPT_STRETCH); // draw level y += (5*V_NamePatchHeight(lname))/4; // CPhipps - patch drawing updated V_DrawNamePatch((320 - V_NamePatchWidth(lname))/2, y, FB, lname, CR_DEFAULT, VPT_STRETCH); }
// // D_PageDrawer // static void D_PageDrawer(void) { // proff/nicolas 09/14/98 -- now stretchs bitmaps to fullscreen! // CPhipps - updated for new patch drawing // proff - added M_DrawCredits if (pagename) { V_DrawNamePatch(0, 0, 0, pagename, CR_DEFAULT, VPT_STRETCH); } else M_DrawCredits(); }
// ==================================================================== // WI_slamBackground // Purpose: Put the full-screen background up prior to patches // Args: none // Returns: void // static void WI_slamBackground(void) { char name[9]; // limited to 8 characters if (gamemode == commercial || (gamemode == retail && wbs->epsd == 3)) strcpy(name, "INTERPIC"); else sprintf(name, "WIMAP%d", wbs->epsd); // background V_DrawNamePatch(0, 0, FB, name, CR_DEFAULT, VPT_STRETCH); }
static void WI_drawTimeStats(int cnt_time, int cnt_total_time, int cnt_par) { V_DrawNamePatch(SP_TIMEX, SP_TIMEY, FB, time1, CR_DEFAULT, VPT_STRETCH); WI_drawTime(320/2 - SP_TIMEX, SP_TIMEY, cnt_time); V_DrawNamePatch(SP_TIMEX, (SP_TIMEY+200)/2, FB, total, CR_DEFAULT, VPT_STRETCH); WI_drawTime(320/2 - SP_TIMEX, (SP_TIMEY+200)/2, cnt_total_time); // Ty 04/11/98: redid logic: should skip only if with pwad but // without deh patch // killough 2/22/98: skip drawing par times on pwads // Ty 03/17/98: unless pars changed with deh patch if (!(modifiedgame && !deh_pars)) { if (wbs->epsd < 3) { V_DrawNamePatch(320/2 + SP_TIMEX, SP_TIMEY, FB, par, CR_DEFAULT, VPT_STRETCH); WI_drawTime(320 - SP_TIMEX, SP_TIMEY, cnt_par); } } }
// ==================================================================== // 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 WI_drawTime(int x, int y, int t) { int n; if (t<0) return; if (t < 100*60*60) for(;;) { n = t % 60; t /= 60; x = WI_drawNum(x, y, n, (t || n>9) ? 2 : 1) - V_NamePatchWidth(colon); // draw if (t) // CPhipps - patch drawing updated V_DrawNamePatch(x, y, FB, colon, CR_DEFAULT, VPT_STRETCH); else break; } else // "sucks" (maybe should be "addicted", even I've never had a 100 hour game ;) V_DrawNamePatch(x - V_NamePatchWidth(sucks), y, FB, sucks, CR_DEFAULT, VPT_STRETCH); }
/* ==================================================================== * WI_drawOnLnode * Purpose: Draw patches at a location based on episode/map * Args: n -- index to map# within episode * c[] -- array of names of patches to be drawn * Returns: void */ void WI_drawOnLnode // draw stuff at a location by episode/map# ( int n, const char* const c[] ) { int i; bool fits = false; i = 0; do { int left; int top; int right; int bottom; const rpatch_t* patch = R_CachePatchName(c[i]); left = lnodes[wbs->epsd][n].x - patch->leftoffset; top = lnodes[wbs->epsd][n].y - patch->topoffset; right = left + patch->width; bottom = top + patch->height; R_UnlockPatchName(c[i]); if (left >= 0 && right < 320 && top >= 0 && bottom < 200) { fits = true; } else { i++; } } while (!fits && i!=2); if (fits && i<2) { // CPhipps - patch drawing updated V_DrawNamePatch(lnodes[wbs->epsd][n].x, lnodes[wbs->epsd][n].y, FB, c[i], CR_DEFAULT, VPT_STRETCH); } else { // DEBUG //jff 8/3/98 use logical output routine lprintf(LO_DEBUG,"Could not place patch on level %d", n+1); } }
OVERLAY static void F_BunnyScroll (void) { char name[10]; int stage; static int laststage; V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); { int scrolled = (finalecount-230)/2; if (scrolled <= 0) { V_DrawNamePatch(0, 0, 0, pfub2, NULL, VPT_STRETCH); } else if (scrolled >= 320) { V_DrawNamePatch(0, 0, 0, pfub1, NULL, VPT_STRETCH); } else { #define SCRN 2 int realscrolled = (SCREENWIDTH * scrolled) / 320; V_AllocScreen(SCRN); V_DrawNamePatch(0, 0, SCRN, pfub2, NULL, VPT_STRETCH); V_CopyRect(realscrolled, 0, SCRN, SCREENWIDTH-realscrolled, SCREENHEIGHT, 0, 0, 0); V_DrawNamePatch(0, 0, SCRN, pfub1, NULL, VPT_STRETCH); V_CopyRect(0, 0, SCRN, realscrolled, SCREENHEIGHT, SCREENWIDTH-realscrolled, 0, 0); V_FreeScreen(SCRN); } } if (finalecount < 1130) return; if (finalecount < 1180) { // CPhipps - patch drawing updated V_DrawNamePatch((320-13*8)/2, (200-8*8)/2,0, "END0", NULL, VPT_STRETCH); laststage = 0; return; } stage = (finalecount-1180) / 5; if (stage > 6) stage = 6; if (stage > laststage) { S_StartSound (NULL, sfx_pistol); laststage = stage; } sprintf (name,"END%i",stage); // CPhipps - patch drawing updated V_DrawNamePatch((320-13*8)/2, (200-8*8)/2, 0, name, NULL, 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))); }
static void F_BunnyScroll (void) { char name[10]; int stage; static int laststage; { int scrolled = 320 - (FinaleCount-230)/2; if (scrolled <= 0) { V_DrawNamePatch(0, 0, 0, pfub2, CR_DEFAULT, VPT_STRETCH); } else if (scrolled >= 320) { V_DrawNamePatch(0, 0, 0, pfub1, CR_DEFAULT, VPT_STRETCH); } else { V_DrawNamePatch(320-scrolled, 0, 0, pfub1, CR_DEFAULT, VPT_STRETCH); V_DrawNamePatch(-scrolled, 0, 0, pfub2, CR_DEFAULT, VPT_STRETCH); } } if (FinaleCount < 1130) return; if (FinaleCount < 1180) { // CPhipps - patch drawing updated V_DrawNamePatch((320-13*8)/2, (200-8*8)/2,0, "END0", CR_DEFAULT, VPT_STRETCH); laststage = 0; return; } stage = (FinaleCount-1180) / 5; if (stage > 6) stage = 6; if (stage > laststage) { S_StartSound (NULL, sfx_pistol); laststage = stage; } sprintf (name,"END%i",stage); // CPhipps - patch drawing updated V_DrawNamePatch((320-13*8)/2, (200-8*8)/2, 0, name, CR_DEFAULT, VPT_STRETCH); }
void D_Display (void) { static boolean isborderstate IDATA_ATTR= false; static boolean borderwillneedredraw IDATA_ATTR= false; static gamestate_t oldgamestate IDATA_ATTR= -1; boolean wipe; boolean viewactive = false, isborder = false; if (nodrawers) // for comparative timing / profiling return; // save the current screen if about to wipe if ((wipe = gamestate != wipegamestate)) wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); if (gamestate != GS_LEVEL) { // Not a level switch (oldgamestate) { case (gamestate_t)-1: case GS_LEVEL: V_SetPalette(0); // cph - use default (basic) palette default: break; } switch (gamestate) { case GS_INTERMISSION: WI_Drawer(); break; case GS_FINALE: F_Drawer(); break; case GS_DEMOSCREEN: D_PageDrawer(); break; default: break; } } else if (gametic != basetic) { // In a level boolean redrawborderstuff; HU_Erase(); if (setsizeneeded) { // change the view size if needed R_ExecuteSetViewSize(); oldgamestate = -1; // force background redraw } // Work out if the player view is visible, and if there is a border viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens; isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active)); if (oldgamestate != GS_LEVEL) { R_FillBackScreen (); // draw the pattern into the back screen redrawborderstuff = isborder; } else { // CPhipps - // If there is a border, and either there was no border last time, // or the border might need refreshing, then redraw it. redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw); // The border may need redrawing next time if the border surrounds the screen, // and there is a menu being displayed borderwillneedredraw = menuactive && isborder && viewactive && (viewwidth != SCREENWIDTH); } if (redrawborderstuff) R_DrawViewBorder(); // Now do the drawing if (viewactive) R_RenderPlayerView (&players[displayplayer]); if (automapmode & am_active) AM_Drawer(); ST_Drawer((viewheight != SCREENHEIGHT) || ((automapmode & am_active) && !(automapmode & am_overlay)), redrawborderstuff); R_DrawViewBorder(); HU_Drawer(); } isborderstate = isborder; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused) { static int x; if (!x) { // Cache results of x pos calc int lump = W_GetNumForName("M_PAUSE"); const patch_t* p = W_CacheLumpNum(lump); x = (320 - SHORT(p->width))/2; W_UnlockLumpNum(lump); } // CPhipps - updated for new patch drawing V_DrawNamePatch(x, (!(automapmode & am_active) || (automapmode & am_overlay)) ? 4+(viewwindowy*200/SCREENHEIGHT) : 4, // cph - Must un-stretch viewwindowy 0, "M_PAUSE", CR_DEFAULT, VPT_STRETCH); } // menus go directly to the screen M_Drawer(); // menu is drawn even on top of everything D_BuildNewTiccmds(); // normal update if (!wipe) I_FinishUpdate (); // page flip or blit buffer else { // wipe update wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); D_Wipe(); } }
void D_Display (void) { static boolean inhelpscreensstate = false; static boolean isborderstate = false; static boolean borderwillneedredraw = false; static gamestate_t oldgamestate = -1; boolean wipe; boolean viewactive = false, isborder = false; if (nodrawers) // for comparative timing / profiling return; if (!I_StartDisplay()) return; // save the current screen if about to wipe if ((wipe = gamestate != wipegamestate) && (V_GetMode() != VID_MODEGL)) wipe_StartScreen(); if (gamestate != GS_LEVEL) { // Not a level switch (oldgamestate) { case -1: case GS_LEVEL: V_SetPalette(0); // cph - use default (basic) palette default: break; } switch (gamestate) { case GS_INTERMISSION: WI_Drawer(); break; case GS_FINALE: F_Drawer(); break; case GS_DEMOSCREEN: D_PageDrawer(); break; default: break; } } else if (gametic != basetic) { // In a level boolean redrawborderstuff; HU_Erase(); if (setsizeneeded) { // change the view size if needed R_ExecuteSetViewSize(); oldgamestate = -1; // force background redraw } // Work out if the player view is visible, and if there is a border viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens; isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active)); if (oldgamestate != GS_LEVEL) { R_FillBackScreen (); // draw the pattern into the back screen redrawborderstuff = isborder; } else { // CPhipps - // If there is a border, and either there was no border last time, // or the border might need refreshing, then redraw it. redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw); // The border may need redrawing next time if the border surrounds the screen, // and there is a menu being displayed borderwillneedredraw = menuactive && isborder && viewactive && (viewwidth != SCREENWIDTH); } if (redrawborderstuff || (V_GetMode() == VID_MODEGL)) R_DrawViewBorder(); // Now do the drawing if (viewactive) R_RenderPlayerView (&players[displayplayer]); if (automapmode & am_active) AM_Drawer(); ST_Drawer((viewheight != SCREENHEIGHT) || ((automapmode & am_active) && !(automapmode & am_overlay)), redrawborderstuff); if (V_GetMode() != VID_MODEGL) R_DrawViewBorder(); HU_Drawer(); } inhelpscreensstate = inhelpscreens; isborderstate = isborder; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused) { // Simplified the "logic" here and no need for x-coord caching - POPE V_DrawNamePatch((320 - V_NamePatchWidth("M_PAUSE"))/2, 4, 0, "M_PAUSE", CR_DEFAULT, VPT_STRETCH); } // menus go directly to the screen M_Drawer(); // menu is drawn even on top of everything #ifdef HAVE_NET NetUpdate(); // send out any new accumulation #else D_BuildNewTiccmds(); #endif // normal update if (!wipe || (V_GetMode() == VID_MODEGL)) I_FinishUpdate (); // page flip or blit buffer else { // wipe update wipe_EndScreen(); D_Wipe(); } I_EndDisplay(); //e6y: don't thrash cpu during pausing if (paused) { I_uSleep(1000); } }
// ==================================================================== // WI_drawDeathmatchStats // Purpose: Draw the stats on the screen in a matrix // Args: none // Returns: void // // proff/nicolas 09/20/98 -- changed for hi-res // CPhipps - patch drawing updated void WI_drawDeathmatchStats(void) { int i; int j; int x; int y; int w; int lh; // line height int halfface = V_NamePatchWidth(facebackp)/2; lh = WI_SPACINGY; WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); WI_drawLF(); // draw stat titles (top line) V_DrawNamePatch(DM_TOTALSX-V_NamePatchWidth(total)/2, DM_MATRIXY-WI_SPACINGY+10, FB, total, CR_DEFAULT, VPT_STRETCH); V_DrawNamePatch(DM_KILLERSX, DM_KILLERSY, FB, killers, CR_DEFAULT, VPT_STRETCH); V_DrawNamePatch(DM_VICTIMSX, DM_VICTIMSY, FB, victims, CR_DEFAULT, VPT_STRETCH); // draw P? x = DM_MATRIXX + DM_SPACINGX; y = DM_MATRIXY; for (i=0 ; i<MAXPLAYERS ; i++) { if (playeringame[i]) { //int trans = playernumtotrans[i]; V_DrawNamePatch(x-halfface, DM_MATRIXY - WI_SPACINGY, FB, facebackp, i ? CR_LIMIT+i : CR_DEFAULT, VPT_STRETCH | (i ? VPT_TRANS : 0)); V_DrawNamePatch(DM_MATRIXX-halfface, y, FB, facebackp, i ? CR_LIMIT+i : CR_DEFAULT, VPT_STRETCH | (i ? VPT_TRANS : 0)); if (i == me) { V_DrawNamePatch(x-halfface, DM_MATRIXY - WI_SPACINGY, FB, bstar, CR_DEFAULT, VPT_STRETCH); V_DrawNamePatch(DM_MATRIXX-halfface, y, FB, star, CR_DEFAULT, VPT_STRETCH); } } x += DM_SPACINGX; y += WI_SPACINGY; } // draw stats y = DM_MATRIXY+10; w = num[0].width; for (i=0 ; i<MAXPLAYERS ; i++) { x = DM_MATRIXX + DM_SPACINGX; if (playeringame[i]) { for (j=0 ; j<MAXPLAYERS ; j++) { if (playeringame[j]) WI_drawNum(x+w, y, dm_frags[i][j], 2); x += DM_SPACINGX; } WI_drawNum(DM_TOTALSX+w, y, dm_totals[i], 2); } y += WI_SPACINGY; } }
/* * 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); }
// ==================================================================== // WI_drawNetgameStats // Purpose: Put the coop stats on the screen // Args: none // Returns: void // // proff/nicolas 09/20/98 -- changed for hi-res // CPhipps - patch drawing updated void WI_drawNetgameStats(void) { int i; int x; int y; int pwidth = V_NamePatchWidth(percent); int fwidth = V_NamePatchWidth(facebackp); WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); WI_drawLF(); // draw stat titles (top line) V_DrawNamePatch(NG_STATSX+NG_SPACINGX-V_NamePatchWidth(kills), NG_STATSY, FB, kills, CR_DEFAULT, VPT_STRETCH); V_DrawNamePatch(NG_STATSX+2*NG_SPACINGX-V_NamePatchWidth(items), NG_STATSY, FB, items, CR_DEFAULT, VPT_STRETCH); V_DrawNamePatch(NG_STATSX+3*NG_SPACINGX-V_NamePatchWidth(secret), NG_STATSY, FB, secret, CR_DEFAULT, VPT_STRETCH); if (dofrags) V_DrawNamePatch(NG_STATSX+4*NG_SPACINGX-V_NamePatchWidth(frags), NG_STATSY, FB, frags, CR_DEFAULT, VPT_STRETCH); // draw stats y = NG_STATSY + V_NamePatchHeight(kills); for (i=0 ; i<MAXPLAYERS ; i++) { //int trans = playernumtotrans[i]; if (!playeringame[i]) continue; x = NG_STATSX; V_DrawNamePatch(x-fwidth, y, FB, facebackp, i ? CR_LIMIT+i : CR_DEFAULT, VPT_STRETCH | (i ? VPT_TRANS : 0)); if (i == me) V_DrawNamePatch(x-fwidth, y, FB, star, CR_DEFAULT, VPT_STRETCH); x += NG_SPACINGX; if (cnt_kills) WI_drawPercent(x-pwidth, y+10, cnt_kills[i]); x += NG_SPACINGX; if (cnt_items) WI_drawPercent(x-pwidth, y+10, cnt_items[i]); x += NG_SPACINGX; if (cnt_secret) WI_drawPercent(x-pwidth, y+10, cnt_secret[i]); x += NG_SPACINGX; if (dofrags && cnt_frags) WI_drawNum(x, y+10, cnt_frags[i], -1); y += WI_SPACINGY; } if (y <= SP_TIMEY) // cph - show times in coop on the entering screen WI_drawTimeStats(plrs[me].stime / TICRATE, wbs->totaltimes / TICRATE, wbs->partime / TICRATE); }
// // D_PageDrawer // void D_PageDrawer(void) { // CPhipps - updated for new patch drawing V_DrawNamePatch(0, 0, 0, pagename, CR_DEFAULT, VPT_STRETCH); }
void D_Display (void) { boolean wipe, viewactive, isborder; static boolean isborderstate = FALSE; static boolean borderwillneedredraw = FALSE; static gamestate_t oldgamestate = -1; // Reentrancy. if (in_d_wipe) { D_Wipe(); return; } if (!I_StartDisplay()) return; // save the current screen if about to wipe if ((wipe = gamestate != wipegamestate)) wipe_StartScreen(); if (gamestate != GS_LEVEL) { // Not a level switch (oldgamestate) { case -1: case GS_LEVEL: V_SetPalette(0); // cph - use default (basic) palette default: break; } switch (gamestate) { case GS_INTERMISSION: WI_Drawer(); break; case GS_FINALE: F_Drawer(); break; case GS_DEMOSCREEN: D_PageDrawer(); break; default: break; } } else if (gametic != basetic) { // In a level boolean redrawborderstuff; HU_Erase(); if (setsizeneeded) { // change the view size if needed R_ExecuteSetViewSize(); oldgamestate = -1; // force background redraw } // Work out if the player view is visible, and if there is a border viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens; isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active)); if (oldgamestate != GS_LEVEL) { redrawborderstuff = isborder; } else { // CPhipps - // If there is a border, and either there was no border last time, // or the border might need refreshing, then redraw it. redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw); // The border may need redrawing next time if the border surrounds the screen, // and there is a menu being displayed borderwillneedredraw = viewactive ? (menuactive && isborder) : (!inhelpscreens && menuactive == mnact_full); } // Now do the drawing if (viewactive) R_RenderPlayerView (&players[displayplayer]); if (automapmode & am_active) AM_Drawer(); ST_Drawer( ((viewheight != SCREENHEIGHT) || ((automapmode & am_active) && !(automapmode & am_overlay))), redrawborderstuff, (menuactive == mnact_full)); HU_Drawer(); } isborderstate = isborder; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused && (menuactive != mnact_full)) { // Simplified the "logic" here and no need for x-coord caching - POPE V_DrawNamePatch((320 - V_NamePatchWidth("M_PAUSE"))/2, 4, 0, "M_PAUSE", CR_DEFAULT, VPT_NONE); } // menus go directly to the screen M_Drawer(); // menu is drawn even on top of everything #ifdef HAVE_NET NetUpdate(); // send out any new accumulation #else D_BuildNewTiccmds(); #endif // normal update if (!wipe) I_FinishUpdate (); // page flip or blit buffer else { // wipe update wipe_EndScreen(); D_Wipe(); } I_EndDisplay(); }