// // Display level completion time and par, // or "sucks" message if overflow. // void WI_drawTime ( int x, int y, int t ) { int div; int n; if (t<0) return; if (t <= 61*59) { div = 1; do { n = (t / div) % 60; x = WI_drawNum(x, y, n, 2) - SHORT(colon->width); div *= 60; // draw if (div==60 || t / div) V_DrawPatchDirect(x, y, FB, colon); } while (t / div); } else { // "sucks" V_DrawPatchDirect(x - SHORT(sucks->width), y, FB, sucks); } }
void M_DrawOptions(void) { V_DrawPatchDirect (108,15,0,(patch_t*)W_CacheLumpName("M_OPTTTL",PU_CACHE_SHARED)); //V_DrawPatchDirect (::g->OptionsDef.x + 175,::g->OptionsDef.y+LINEHEIGHT*detail,0, // (patch_t*)W_CacheLumpName(detailNames[::g->detailLevel],PU_CACHE_SHARED)); int fullscreenOnOff = r_fullscreen.GetInteger() >= 1 ? 1 : 0; V_DrawPatchDirect (::g->OptionsDef.x + 150,::g->OptionsDef.y+LINEHEIGHT*endgame,0, (patch_t*)W_CacheLumpName(msgNames[fullscreenOnOff],PU_CACHE_SHARED)); V_DrawPatchDirect (::g->OptionsDef.x + 120,::g->OptionsDef.y+LINEHEIGHT*scrnsize,0, (patch_t*)W_CacheLumpName(msgNames[in_useJoystick.GetInteger()],PU_CACHE_SHARED)); V_DrawPatchDirect (::g->OptionsDef.x + 120,::g->OptionsDef.y+LINEHEIGHT*messages,0, (patch_t*)W_CacheLumpName(msgNames[m_show_messages.GetInteger()],PU_CACHE_SHARED)); extern idCVar in_mouseSpeed; const int roundedMouseSpeed = M_GetMouseSpeedForMenu( in_mouseSpeed.GetFloat() ); M_DrawThermo( ::g->OptionsDef.x, ::g->OptionsDef.y + LINEHEIGHT * ( mousesens + 1 ), 16, roundedMouseSpeed ); //M_DrawThermo(::g->OptionsDef.x,::g->OptionsDef.y+LINEHEIGHT*(scrnsize+1), // 9,::g->screenSize); }
void WI_drawStats(void) { // line height int lh; lh = (3*SHORT(num[0]->height))/2; WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); WI_drawLF(); V_DrawPatchDirect(SP_STATSX, SP_STATSY, FB, kills); WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY, cnt_kills[0]); V_DrawPatchDirect(SP_STATSX, SP_STATSY+lh, FB, items); WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY+lh, cnt_items[0]); V_DrawPatchDirect(SP_STATSX, SP_STATSY+2*lh, FB, sp_secret); WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0]); V_DrawPatchDirect(SP_TIMEX, SP_TIMEY, FB, time); WI_drawTime(SCREENWIDTH/2 - SP_TIMEX, SP_TIMEY, cnt_time); if (wbs->epsd < 3) { V_DrawPatchDirect(SCREENWIDTH/2 + SP_TIMEX, SP_TIMEY, FB, par); WI_drawTime(SCREENWIDTH - SP_TIMEX, SP_TIMEY, cnt_par); } }
void M_DrawOptions(void) { V_DrawPatchDirect (108,15,0,W_CacheLumpNamePatch("M_OPTTTL",PU_CACHE)); V_DrawPatchDirect (OptionsDef.x + 175,OptionsDef.y+LINEHEIGHT*detail,0,W_CacheLumpNamePatch(detailNames[detailLevel],PU_CACHE)); V_DrawPatchDirect (OptionsDef.x + 120,OptionsDef.y+LINEHEIGHT*messages,0,W_CacheLumpNamePatch(msgNames[showMessages],PU_CACHE)); }
int WI_drawNum ( int x, int y, int n, int digits ) { int fontwidth = SHORT(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; V_DrawPatchDirect(x, y, FB, num[ n % 10 ]); n /= 10; } // draw a minus sign if necessary if (neg && wiminus) V_DrawPatchDirect(x-=8, y, FB, wiminus); return x; }
void HUlib_drawMBg(int x, int y, int w, int h, patch_t** bgp) { int xs = bgp[0]->width; int ys = bgp[0]->height; int i, j; // top rows V_DrawPatchDirect(x, y, FG, bgp[0]); // ul for (j = x + xs; j < x + w - xs; j += xs) // uc V_DrawPatchDirect(j, y, FG, bgp[1]); V_DrawPatchDirect(j, y, FG, bgp[2]); // ur // middle rows for (i = y + ys; i < y + h - ys; i += ys) { V_DrawPatchDirect(x, i, FG, bgp[3]); // cl for (j = x + xs; j < x + w - xs; j += xs) // cc V_DrawPatchDirect(j, i, FG, bgp[4]); V_DrawPatchDirect(j, i, FG, bgp[5]); // cr } // bottom row V_DrawPatchDirect(x, i, FG, bgp[6]); // ll for (j = x + xs; j < x + w - xs; j += xs) // lc V_DrawPatchDirect(j, i, FG, bgp[7]); V_DrawPatchDirect(j, i, FG, bgp[8]); // lr }
// // Draw border for the savegame description // void M_DrawSaveLoadBorder(int x,int y) { int i; V_DrawPatchDirect (x-8,y+7,0,W_CacheLumpNamePatch("M_LSLEFT",PU_CACHE)); for (i = 0;i < 24;i++) { V_DrawPatchDirect (x,y+7,0,W_CacheLumpNamePatch("M_LSCNTR",PU_CACHE)); x += 8; } V_DrawPatchDirect (x,y+7,0,W_CacheLumpNamePatch("M_LSRGHT",PU_CACHE)); }
// // Draw border for the savegame description // void M_DrawSaveLoadBorder(int x,int y) { int i; V_DrawPatchDirect (x-8,y+7,0,(patch_t*)W_CacheLumpName("M_LSLEFT",PU_CACHE_SHARED)); for (i = 0;i < 28;i++) { V_DrawPatchDirect (x,y+7,0,(patch_t*)W_CacheLumpName("M_LSCNTR",PU_CACHE_SHARED)); x += 8; } V_DrawPatchDirect (x,y+7,0,(patch_t*)W_CacheLumpName("M_LSRGHT",PU_CACHE_SHARED)); }
// Draws "<Levelname> Finished!" void WI_drawLF(void) { int y = WI_TITLEY; // draw <LevelName> V_DrawPatchDirect((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2, y, FB, lnames[wbs->last]); // draw "Finished!" y += (5*SHORT(lnames[wbs->last]->height))/4; V_DrawPatchDirect((SCREENWIDTH - SHORT(finished->width))/2, y, FB, finished); }
// Draws "Entering <LevelName>" void WI_drawEL(void) { int y = WI_TITLEY; // draw "Entering" V_DrawPatchDirect((SCREENWIDTH - SHORT(entering->width))/2, y, FB, entering); // draw level y += (5*SHORT(lnames[wbs->next]->height))/4; V_DrawPatchDirect((SCREENWIDTH - SHORT(lnames[wbs->next]->width))/2, y, FB, lnames[wbs->next]); }
int M_DrawText ( int x, int y, boolean direct, char* string ) { int c; int w; while (*string) { c = toupper(*string) - HU_FONTSTART; string++; if (c < 0 || c> HU_FONTSIZE) { x += 4; continue; } w = SHORT (hu_font[c]->width); if (x+w > SCREENWIDTH) break; if (direct) V_DrawPatchDirect(x, y, 0, hu_font[c]); else V_DrawPatch(x, y, 0, hu_font[c]); x+=w; } return x; }
void HUlib_drawTextLine ( hu_textline_t* l, boolean drawcursor ) { int i; int w; int x; unsigned char c; // draw the new stuff x = l->x; for (i=0;i<l->len;i++) { c = toupper(l->l[i]); if (c != ' ' && c >= l->sc && c <= '_') { w = SHORT(l->f[c - l->sc]->width); // if (x+w > SCREENWIDTH) // CHANGED FOR HIRES if (x+w > ORIGWIDTH) // CHANGED FOR HIRES break; V_DrawPatchDirect(x, l->y, l->f[c - l->sc]); x += w; } else { x += 4; // if (x >= SCREENWIDTH) // CHANGED FOR HIRES if (x >= ORIGWIDTH) // CHANGED FOR HIRES break; } } // draw the cursor if requested /* if (drawcursor // CHANGED FOR HIRES && x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH) // CHANGED FOR HIRES */ if (drawcursor // CHANGED FOR HIRES && x + SHORT(l->f['_' - l->sc]->width) <= ORIGWIDTH) // CHANGED FOR HIRES { V_DrawPatchDirect(x, l->y, l->f['_' - l->sc]); } }
void M_DrawSelCell ( menu_t* menu, int item ) { V_DrawPatchDirect (menu->x - 10, menu->y+item*LINEHEIGHT - 1, 0, (patch_t*)W_CacheLumpName("M_CELL2",PU_CACHE_SHARED)); }
// // Menu Functions // void M_DrawThermo ( int x, int y, int thermWidth, int thermDot ) { int xx; int i; xx = x; V_DrawPatchDirect(xx,y,0,W_CacheLumpNamePatch("M_THERML",PU_CACHE)); xx += 8; for (i=0;i<thermWidth;i++) { V_DrawPatchDirect(xx,y,0,W_CacheLumpNamePatch("M_THERMM",PU_CACHE)); xx += 8; } V_DrawPatchDirect(xx,y,0,W_CacheLumpNamePatch("M_THERMR",PU_CACHE)); V_DrawPatchDirect((x+8) + thermDot*8,y,0,W_CacheLumpNamePatch("M_THERMO",PU_CACHE)); }
// // Read This Menus // Had a "quick hack to fix romero bug" // void M_DrawReadThis1(void) { ::g->inhelpscreens = true; switch ( ::g->gamemode ) { case commercial: V_DrawPatchDirect (0,0,0,(patch_t*)W_CacheLumpName("HELP",PU_CACHE_SHARED)); break; case shareware: case registered: case retail: V_DrawPatchDirect (0,0,0,(patch_t*)W_CacheLumpName("HELP1",PU_CACHE_SHARED)); break; default: break; } return; }
// // Change Sfx & Music volumes // void M_DrawSound(void) { V_DrawPatchDirect (60,38,0,(patch_t*)W_CacheLumpName("M_SVOL",PU_CACHE_SHARED)); M_DrawThermo( ::g->SoundDef.x,::g->SoundDef.y+LINEHEIGHT*(sfx_vol+1), 16, s_volume_sound.GetInteger() ); M_DrawThermo(::g->SoundDef.x,::g->SoundDef.y+LINEHEIGHT*(music_vol+1), 16, s_volume_midi.GetInteger() ); }
// // Read This Menus - optional second page. // void M_DrawReadThis2(void) { ::g->inhelpscreens = true; switch ( ::g->gamemode ) { case retail: case commercial: // This hack keeps us from having to change menus. V_DrawPatchDirect (0,0,0,(patch_t*)W_CacheLumpName("CREDIT",PU_CACHE_SHARED)); break; case shareware: case registered: V_DrawPatchDirect (0,0,0,(patch_t*)W_CacheLumpName("HELP2",PU_CACHE_SHARED)); break; default: break; } return; }
// // Read This Menus // Had a "quick hack to fix romero bug" // void M_DrawReadThis1(void) { inhelpscreens = true; switch ( gamemode ) { case commercial: V_DrawPatchDirect (0,0,0,W_CacheLumpNamePatch("HELP",PU_CACHE)); break; case shareware: case registered: case retail: V_DrawPatchDirect (0,0,0,W_CacheLumpNamePatch("HELP1",PU_CACHE)); break; default: break; } return; }
// // M_LoadGame & Cie. // void M_DrawLoad(void) { int i; V_DrawPatchDirect (72,28,0,(patch_t*)W_CacheLumpName("M_LOADG",PU_CACHE_SHARED)); for (i = 0;i < load_end; i++) { M_DrawSaveLoadBorder(::g->LoadDef.x,::g->LoadDef.y+LINEHEIGHT*i); M_WriteText(::g->LoadDef.x,::g->LoadDef.y+LINEHEIGHT*i,::g->savegamestrings[i]); } }
void WI_drawPercent ( int x, int y, int p ) { if (p < 0) return; V_DrawPatchDirect(x, y, FB, percent); WI_drawNum(x, y, p, -1); }
void WI_drawNetgameStats(void) { int i; int x; int y; int pwidth = SHORT(percent->width); WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); WI_drawLF(); // draw stat titles (top line) V_DrawPatchDirect(NG_STATSX+NG_SPACINGX-SHORT(kills->width), NG_STATSY, FB, kills); V_DrawPatchDirect(NG_STATSX+2*NG_SPACINGX-SHORT(items->width), NG_STATSY, FB, items); V_DrawPatchDirect(NG_STATSX+3*NG_SPACINGX-SHORT(secret->width), NG_STATSY, FB, secret); if (dofrags) V_DrawPatchDirect(NG_STATSX+4*NG_SPACINGX-SHORT(frags->width), NG_STATSY, FB, frags); // draw stats y = NG_STATSY + SHORT(kills->height); for (i=0 ; i<MAXPLAYERS ; i++) { if (!playeringame[i]) continue; x = NG_STATSX; V_DrawPatchDirect(x-SHORT(p[i]->width), y, FB, p[i]); if (i == me) V_DrawPatchDirect(x-SHORT(p[i]->width), y, FB, star); x += NG_SPACINGX; WI_drawPercent(x-pwidth, y+10, cnt_kills[i]); x += NG_SPACINGX; WI_drawPercent(x-pwidth, y+10, cnt_items[i]); x += NG_SPACINGX; WI_drawPercent(x-pwidth, y+10, cnt_secret[i]); x += NG_SPACINGX; if (dofrags) WI_drawNum(x, y+10, cnt_frags[i], -1); y += WI_SPACINGY; } }
// // M_SaveGame & Cie. // void M_DrawSave(void) { int i; V_DrawPatchDirect (72,28,0,(patch_t*)W_CacheLumpName("M_SAVEG",PU_CACHE_SHARED)); for (i = 0;i < load_end; i++) { M_DrawSaveLoadBorder(::g->LoadDef.x,::g->LoadDef.y+LINEHEIGHT*i); M_WriteText(::g->LoadDef.x,::g->LoadDef.y+LINEHEIGHT*i,::g->savegamestrings[i]); } if (::g->saveStringEnter) { i = M_StringWidth(::g->savegamestrings[::g->saveSlot]); M_WriteText(::g->LoadDef.x + i,::g->LoadDef.y+LINEHEIGHT*::g->saveSlot,"_"); } }
void WI_drawOnLnode ( int n, patch_t* c[] ) { int i; int left; int top; int right; int bottom; boolean fits = false; i = 0; do { left = lnodes[wbs->epsd][n].x - SHORT(c[i]->leftoffset); top = lnodes[wbs->epsd][n].y - SHORT(c[i]->topoffset); right = left + SHORT(c[i]->width); bottom = top + SHORT(c[i]->height); if (left >= 0 && right < SCREENWIDTH && top >= 0 && bottom < SCREENHEIGHT) { fits = true; } else { i++; } } while (!fits && i!=2); if (fits && i<2) { V_DrawPatchDirect(lnodes[wbs->epsd][n].x, lnodes[wbs->epsd][n].y, FB, c[i]); } else { // DEBUG printf("Could not place patch on level %d", n+1); } }
// // Write a string using the ::g->hu_font // void M_WriteText ( int x, int y, const char* string) { int w; const char* ch; int c; int cx; int cy; ch = string; cx = x; cy = y; while(1) { c = *ch++; if (!c) break; if (c == '\n') { cx = x; cy += 12; continue; } c = toupper(c) - HU_FONTSTART; if (c < 0 || c>= HU_FONTSIZE) { cx += 4; continue; } w = SHORT (::g->hu_font[c]->width); if (cx+w > SCREENWIDTH) break; V_DrawPatchDirect(cx, cy, 0, ::g->hu_font[c]); cx+=w; } }
void WI_drawAnimatedBack(void) { int i; anim_t* a; if (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_DrawPatchDirect(a->loc.x, a->loc.y, FB, a->p[a->ctr]); } }
void HUlib_drawTextLine(hu_textline_t* l, boolean drawcursor) { int i, x = l->x, y = l->y; // killough 1/18/98 -- support multiple lines unsigned char c; char* oc = l->cr; //jff 2/17/98 remember default color // draw the new stuff 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 && l->l[i] >= '0' && l->l[i] <= '9') l->cr = colrngs[l->l[i] - '0']; } else if (c != ' ' && c >= l->sc && c <= 127) { int w = SwapShort(l->f[c - l->sc]->width); if (x + w > SCREENWIDTH) break; // killough 1/18/98 -- support multiple lines: V_DrawPatchTranslated(x, y, FG, l->f[c - l->sc], l->cr, 0); x += w; } else if ((x += 4) >= SCREENWIDTH) break; } l->cr = oc; //jff 2/17/98 restore original color // draw the cursor if requested // killough 1/18/98 -- support multiple lines if (drawcursor && x + SwapShort(l->f['_' - l->sc]->width) <= SCREENWIDTH) V_DrawPatchDirect(x, y, FG, l->f['_' - l->sc]); }
void D_Display (void) { static boolean viewactivestate = false; static boolean menuactivestate = false; static boolean inhelpscreensstate = false; static boolean fullscreen = false; static gamestate_t oldgamestate = -1; static int borderdrawcount; int nowtime; int tics; int wipestart; int y; boolean done; boolean wipe; boolean redrawsbar; if (nodrawers) return; // for comparative timing / profiling redrawsbar = false; // change the view size if needed if (setsizeneeded) { R_ExecuteSetViewSize (); oldgamestate = -1; // force background redraw borderdrawcount = 3; } // save the current screen if about to wipe if (gamestate != wipegamestate) { wipe = true; wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); } else wipe = false; if (gamestate == GS_LEVEL && gametic) HU_Erase(); // do buffered drawing switch (gamestate) { case GS_LEVEL: if (!gametic) break; if (automapactive) AM_Drawer (); if (wipe || (viewheight != 200 && fullscreen) ) redrawsbar = true; if (inhelpscreensstate && !inhelpscreens) redrawsbar = true; // just put away the help screen ST_Drawer (viewheight == 200, redrawsbar ); fullscreen = viewheight == 200; break; case GS_INTERMISSION: WI_Drawer (); break; case GS_FINALE: F_Drawer (); break; case GS_DEMOSCREEN: D_PageDrawer (); break; } // draw buffered stuff to screen I_UpdateNoBlit (); // draw the view directly if (gamestate == GS_LEVEL && !automapactive && gametic) R_RenderPlayerView (&players[displayplayer]); if (gamestate == GS_LEVEL && gametic) HU_Drawer (); // clean up border stuff if (gamestate != oldgamestate && gamestate != GS_LEVEL) I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE)); // see if the border needs to be initially drawn if (gamestate == GS_LEVEL && oldgamestate != GS_LEVEL) { viewactivestate = false; // view was not active R_FillBackScreen (); // draw the pattern into the back screen } // see if the border needs to be updated to the screen if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != 320) { if (menuactive || menuactivestate || !viewactivestate) borderdrawcount = 3; if (borderdrawcount) { R_DrawViewBorder (); // erase old menu stuff borderdrawcount--; } } menuactivestate = menuactive; viewactivestate = viewactive; inhelpscreensstate = inhelpscreens; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused) { if (automapactive) y = 4; else y = viewwindowy+4; V_DrawPatchDirect(viewwindowx+(scaledviewwidth-68)/2, y,0,W_CacheLumpName ("M_PAUSE", PU_CACHE)); } // menus go directly to the screen M_Drawer (); // menu is drawn even on top of everything NetUpdate (); // send out any new accumulation // normal update if (!wipe) { I_FinishUpdate (); // page flip or blit buffer return; } // wipe update wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); wipestart = I_GetTime () - 1; do { do { nowtime = I_GetTime (); tics = nowtime - wipestart; } while (!tics); wipestart = nowtime; done = wipe_ScreenWipe(wipe_Melt , 0, 0, SCREENWIDTH, SCREENHEIGHT, tics); I_UpdateNoBlit (); M_Drawer (); // menu is drawn even on top of wipes I_FinishUpdate (); // page flip or blit buffer } while (!done); }
// // P_DialogStart // // villsa [STRIFE] New function // void P_DialogStart(player_t *player) { int i = 0; int pic; int rnd = 0; char* byetext; int jumptoconv; if(menuactive || netgame) return; // are we facing towards our NPC? P_AimLineAttack(player->mo, player->mo->angle, (128*FRACUNIT)); if(!linetarget) { P_AimLineAttack(player->mo, player->mo->angle + (ANG90/16), (128*FRACUNIT)); if(!linetarget) P_AimLineAttack(player->mo, player->mo->angle - (ANG90/16), (128*FRACUNIT)); } if(!linetarget) return; // already in combat, can't talk to it if(linetarget->flags & MF_NODIALOG) return; // set pointer to the character talking dialogtalker = linetarget; // play a sound if(player == &players[consoleplayer]) S_StartSound(0, sfx_radio); linetarget->target = player->mo; // target the player dialogtalker->reactiontime = 2; // set reactiontime dialogtalkerangle = dialogtalker->angle; // remember original angle // face talker towards player A_FaceTarget(dialogtalker); // face towards NPC's direction player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, dialogtalker->x, dialogtalker->y); // set pointer to player talking dialogplayer = player; // haleyjd 09/08/10: get any stored dialog state from this object jumptoconv = linetarget->miscdata; // check item requirements while(1) { int i = 0; currentdialog = P_DialogFind(linetarget->type, jumptoconv); // dialog's jumptoconv equal to 0? There's nothing to jump to. if(currentdialog->jumptoconv == 0) break; // villsa 09/08/10: converted into for loop for(i = 0; i < MDLG_MAXITEMS; i++) { // if the item is non-zero, the player must have at least one in his // or her inventory if(currentdialog->checkitem[i] != 0 && P_PlayerHasItem(dialogplayer, currentdialog->checkitem[i]) < 1) break; } if(i < MDLG_MAXITEMS) // didn't find them all? this is our dialog! break; jumptoconv = currentdialog->jumptoconv; } M_DialogDimMsg(20, 28, currentdialog->text, false); dialogtext = P_DialogGetMsg(currentdialog->text); // get states dialogtalkerstates = P_DialogGetStates(linetarget->type); // have talker greet the player if(dialogtalkerstates->greet) P_SetMobjState(dialogtalker, dialogtalkerstates->greet); // get talker's name if(currentdialog->name[0]) dialogname = currentdialog->name; else { // use a fallback: if(mobjinfo[linetarget->type].name) dialogname = DEH_String(mobjinfo[linetarget->type].name); // mobjtype name else dialogname = DEH_String("Person"); // default name - like Joe in Doom 3 :P } // setup number of choices to choose from for(i = 0; i < MDLG_MAXCHOICES; i++) { if(!currentdialog->choices[i].giveitem) break; } // set number of choices to menu dialogmenu.numitems = i + 1; rnd = M_Random() % 3; // setup dialog menu M_StartControlPanel(); menupause = false; menuindialog = true; menupausetime = gametic + 17; currentMenu = &dialogmenu; if(i >= dialogmenu.lastOn) itemOn = dialogmenu.lastOn; else itemOn = 0; // get backdrop pic = W_CheckNumForName(currentdialog->backpic); dialogbgpiclumpnum = pic; if(pic != -1) V_DrawPatchDirect(0, 0, W_CacheLumpNum(pic, PU_CACHE)); // get voice I_StartVoice(currentdialog->voice); // get bye text switch(rnd) { case 2: byetext = DEH_String("BYE!"); break; case 1: byetext = DEH_String("Thanks, Bye!"); break; default: case 0: byetext = DEH_String("See you later!"); break; } DEH_snprintf(dialoglastmsgbuffer, sizeof(dialoglastmsgbuffer), "%d) %s", i + 1, byetext); }
// // P_DialogDrawer // // This function is set as the drawer callback for the dialog menu. // static void P_DialogDrawer(void) { angle_t angle; int y; int i; int height; int finaly; char choicetext[64]; char choicetext2[64]; // Run down bonuscount faster than usual so that flashes from being given // items are less obvious. if(dialogplayer->bonuscount) { dialogplayer->bonuscount -= 3; if(dialogplayer->bonuscount < 0) dialogplayer->bonuscount = 0; } angle = R_PointToAngle2(dialogplayer->mo->x, dialogplayer->mo->y, dialogtalker->x, dialogtalker->y); angle -= dialogplayer->mo->angle; // Dismiss the dialog if the player is out of alignment, or the thing he was // talking to is now engaged in battle. if ((angle > ANG45 && angle < (ANG270+ANG45)) || (dialogtalker->flags & MF_NODIALOG) != 0) { P_DialogDoChoice(dialogmenu.numitems - 1); } dialogtalker->reactiontime = 2; // draw background if(dialogbgpiclumpnum != -1) { patch_t *patch = W_CacheLumpNum(dialogbgpiclumpnum, PU_CACHE); V_DrawPatchDirect(0, 0, patch); } // if there's a valid background pic, delay drawing the rest of the menu // for a while; otherwise, it will appear immediately if(dialogbgpiclumpnum == -1 || menupausetime <= gametic) { if(menuindialog) { // time to pause the game? if(menupausetime + 3 < gametic) menupause = true; } // draw character name M_WriteText(12, 18, dialogname); y = 28; // show text (optional for dialogs with voices) if(dialogshowtext || currentdialog->voice[0] == '\0') y = M_WriteText(20, 28, dialogtext); height = 20 * dialogmenu.numitems; finaly = 175 - height; // preferred height if(y > finaly) finaly = 199 - height; // height it will bump down to if necessary. // draw divider M_WriteText(42, finaly - 6, DEH_String("______________________________")); dialogmenu.y = finaly + 6; y = 0; // draw the menu items for(i = 0; i < dialogmenu.numitems - 1; i++) { DEH_snprintf(choicetext, sizeof(choicetext), "%d) %s", i + 1, currentdialog->choices[i].text); // alternate text for items that need money if(currentdialog->choices[i].needamounts[0] > 0) { // haleyjd 20120401: necessary to avoid undefined behavior: M_StringCopy(choicetext2, choicetext, sizeof(choicetext2)); DEH_snprintf(choicetext, sizeof(choicetext), "%s for %d", choicetext2, currentdialog->choices[i].needamounts[0]); } M_WriteText(dialogmenu.x, dialogmenu.y + 3 + y, choicetext); y += 19; } // draw the final item for dismissing the dialog M_WriteText(dialogmenu.x, 19 * i + dialogmenu.y + 3, dialoglastmsgbuffer); } }
void WI_drawDeathmatchStats(void) { int i; int j; int x; int y; int w; int lh; // line height lh = WI_SPACINGY; WI_slamBackground(); // draw animated background WI_drawAnimatedBack(); WI_drawLF(); // draw stat titles (top line) V_DrawPatchDirect(DM_TOTALSX-SHORT(total->width)/2, DM_MATRIXY-WI_SPACINGY+10, FB, total); V_DrawPatchDirect(DM_KILLERSX, DM_KILLERSY, FB, killers); V_DrawPatchDirect(DM_VICTIMSX, DM_VICTIMSY, FB, victims); // draw P? x = DM_MATRIXX + DM_SPACINGX; y = DM_MATRIXY; for (i=0 ; i<MAXPLAYERS ; i++) { if (playeringame[i]) { V_DrawPatchDirect(x-SHORT(p[i]->width)/2, DM_MATRIXY - WI_SPACINGY, FB, p[i]); V_DrawPatchDirect(DM_MATRIXX-SHORT(p[i]->width)/2, y, FB, p[i]); if (i == me) { V_DrawPatchDirect(x-SHORT(p[i]->width)/2, DM_MATRIXY - WI_SPACINGY, FB, bstar); V_DrawPatchDirect(DM_MATRIXX-SHORT(p[i]->width)/2, y, FB, star); } } else { // V_DrawPatchDirect(x-SHORT(bp[i]->width)/2, // DM_MATRIXY - WI_SPACINGY, FB, bp[i]); // V_DrawPatchDirect(DM_MATRIXX-SHORT(bp[i]->width)/2, // y, FB, bp[i]); } x += DM_SPACINGX; y += WI_SPACINGY; } // draw stats y = DM_MATRIXY+10; w = SHORT(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; } }