// // haleyjd: As above, but for the situation of a client waiting for the initial // startup info packet from the server. // void NET_RenderSteamServerStart(void) { const char *strConn = "Connecting Netgame"; const char *strWait = "Waiting for server..."; int strConnWidth = V_BigFontStringWidth(strConn); int strWaitWidth = M_StringWidth(strWait); if(use3drenderer) RB_ClearBuffer(GLCB_COLOR); V_DrawFilledBox(0, 0, SCREENWIDTH, SCREENHEIGHT, 0); V_WriteBigText(strConn, (SCREENWIDTH - strConnWidth)/2, 60); if(net_SteamNodeType != NET_STEAM_SERVER) M_WriteText((SCREENWIDTH - strWaitWidth)/2, 100, strWait); I_FinishUpdate(); }
// // Draw menu item description // static int FE_DrawDescription(femenuitem_t *item, int x, int y) { switch(item->font) { case FE_FONT_SMALL: item->w = M_StringWidth(item->description); item->h = 12; M_WriteText(x, y, item->description); break; case FE_FONT_BIG: item->w = V_BigFontStringWidth(item->description); item->h = 20; V_WriteBigText(item->description, x, y); break; default: item->w = item->h = 0; break; } return item->h; }
// // Draw lobby team value // static void FE_DrawLobbyTeamValue(femenuitem_t *item, int x, int y) { const char *text = FE_GetLobbyTeam(); item->valx = x; item->valy = y; switch(item->font) { case FE_FONT_SMALL: item->valw = M_StringWidth(text); item->valh = 12; M_WriteText(x, y, text); break; case FE_FONT_BIG: item->valw = V_BigFontStringWidth(text); item->valh = 20; V_WriteBigText(text, x, y); break; default: item->valw = item->valh = 0; break; } }
// // 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); } }
// Show map name and author. void R_DrawLevelTitle(void) { float alpha = 1; int y = 12; char *lname, *lauthor, *ptr; #if 0 char buf[80]; //int st = players[consoleplayer].plr->psprites[0].state; sprintf(buf, "p0:%p/%p p1:%p/%p", /*st==0? "bob" : st==1? "fire" : st==2? "down" : "up" */ players[0].psprites[0].state, players[0].psprites[1].state, players[1].psprites[0].state, players[1].psprites[1].state); /*sprintf(buf, "p%i r%i", players[consoleplayer].pendingweapon, players[consoleplayer].readyweapon); */ M_WriteText(10, 50, buf); #endif if(!cfg.levelTitle || actual_leveltime > 6 * 35) return; // Make the text a bit smaller. gl.MatrixMode(DGL_MODELVIEW); gl.PushMatrix(); gl.Translatef(160, y, 0); gl.Scalef(.7f, .7f, 1); gl.Translatef(-160, -y, 0); if(actual_leveltime < 35) alpha = actual_leveltime / 35.0f; if(actual_leveltime > 5 * 35) alpha = 1 - (actual_leveltime - 5 * 35) / 35.0f; lname = (char *) Get(DD_MAP_NAME); lauthor = (char *) Get(DD_MAP_AUTHOR); // Plutonia and TNT are special cases. if(gamemission == pack_plut) { lname = mapnamesp[gamemap - 1]; lauthor = PLUT_AUTHOR; } else if(gamemission == pack_tnt) { lname = mapnamest[gamemap - 1]; lauthor = TNT_AUTHOR; } gl.Color4f(1, 1, 1, alpha); if(lname) { ptr = strchr(lname, ':'); // Skip the E#M# or Level #. if(ptr) { lname = ptr + 1; while(*lname && isspace(*lname)) lname++; } M_WriteText2(160 - M_StringWidth(lname, hu_font_b) / 2, y, lname, hu_font_b, -1, -1, -1); y += 14; //9; } gl.Color4f(.5f, .5f, .5f, alpha); if(lauthor && (!cfg.hideAuthorIdSoft || stricmp(lauthor, "id software"))) { M_WriteText2(160 - M_StringWidth(lauthor, hu_font) / 2, y, lauthor, hu_font_a, -1, -1, -1); } gl.MatrixMode(DGL_MODELVIEW); gl.PopMatrix(); }
// // M_Drawer // Called after the view has been rendered, // but before it has been blitted. // void M_Drawer (void) { unsigned short i; short max; char string[40]; int start; ::g->inhelpscreens = false; // Horiz. & Vertically center string and print it. if (::g->messageToPrint) { start = 0; ::g->md_y = 100 - M_StringHeight(::g->messageString)/2; while(*(::g->messageString+start)) { for (i = 0;i < strlen(::g->messageString+start);i++) if (*(::g->messageString+start+i) == '\n') { memset(string,0,40); strncpy(string,::g->messageString+start,i); start += i+1; break; } if (i == strlen(::g->messageString+start)) { strcpy(string,::g->messageString+start); start += i; } ::g->md_x = 160 - M_StringWidth(string)/2; M_WriteText(::g->md_x,::g->md_y,string); ::g->md_y += SHORT(::g->hu_font[0]->height); } return; } if (!::g->menuactive) return; if (::g->currentMenu->routine) ::g->currentMenu->routine(); // call Draw routine // DRAW MENU ::g->md_x = ::g->currentMenu->x; ::g->md_y = ::g->currentMenu->y; max = ::g->currentMenu->numitems; for (i=0;i<max;i++) { if (::g->currentMenu->menuitems[i].name[0]) V_DrawPatchDirect (::g->md_x,::g->md_y,0, (patch_t*)W_CacheLumpName(::g->currentMenu->menuitems[i].name ,PU_CACHE_SHARED)); ::g->md_y += LINEHEIGHT; } // DRAW SKULL V_DrawPatchDirect(::g->md_x + SKULLXOFF,::g->currentMenu->y - 5 + ::g->itemOn*LINEHEIGHT, 0, (patch_t*)W_CacheLumpName(skullName[::g->whichSkull],PU_CACHE_SHARED)); }
// // M_Drawer // Called after the view has been rendered, // but before it has been blitted. // void M_Drawer (void) { static short x; static short y; short i; short max; char string[40]; int start; inhelpscreens = false; // Horiz. & Vertically center string and print it. if (messageToPrint) { start = 0; y = (short)(100 - M_StringHeight(messageString)/2); while(*(messageString+start)) { for (i = 0;i < CGDstrlen(messageString+start);i++) if (*(messageString+start+i) == '\n') { memset(string,0,40); CGDstrncpy(string,messageString+start,i); start += i+1; break; } if (i == CGDstrlen(messageString+start)) { CGDstrcpy(string,messageString+start); start += i; } x = (short)(160 - M_StringWidth(string)/2); M_WriteText(x,y,string); y = y + SHORT(hu_font[0]->height); } return; } if (!menuactive) return; if (currentMenu->routine) currentMenu->routine(); // call Draw routine // DRAW MENU x = currentMenu->x; y = currentMenu->y; max = currentMenu->numitems; for (i=0;i<max;i++) { if (currentMenu->menuitems[i].name[0]) V_DrawPatchDirect (x,y,0,W_CacheLumpNamePatch(currentMenu->menuitems[i].name ,PU_CACHE)); y += LINEHEIGHT; } // DRAW SKULL V_DrawPatchDirect(x + SKULLXOFF,currentMenu->y - 5 + itemOn*LINEHEIGHT, 0,W_CacheLumpNamePatch(skullName[whichSkull],PU_CACHE)); }
// // haleyjd 20141022: [SVE] Alternate waiting on Steam clients // void NET_WaitForSteamLaunch(void) { boolean isServer = (net_SteamNodeType == NET_STEAM_SERVER); const char *strConn = "Connecting Netgame"; char numConn[64]; char pressStr[64]; char pressStr2[64]; int strConnWidth, pressStrWidth, pressStrX, numConnWidth; const char *keyActivateName = GetNameForKey(key_menu_activate); const char *keyForwardName = GetNameForKey(key_menu_forward); if(!keyActivateName) keyActivateName = "key_menu_activate"; if(!keyForwardName) keyForwardName = "key_menu_forward"; M_snprintf(pressStr, sizeof(pressStr), "(Press %s to cancel%c", keyActivateName, isServer ? ',' : ')'); if(isServer) { M_snprintf(pressStr2, sizeof(pressStr2), "%s to start now)", keyForwardName); } strConnWidth = V_BigFontStringWidth(strConn); pressStrWidth = M_StringWidth(pressStr); pressStrX = (SCREENWIDTH - pressStrWidth) / 2; expected_nodes = net_SteamNumNodes; while(net_waiting_for_launch) { event_t *ev; CheckAutoLaunch(); I_StartTic(); while((ev = D_PopEvent())) { switch(ev->type) { case ev_keydown: if(ev->data1 == key_menu_activate) I_Quit(); if(ev->data1 == key_menu_forward && isServer) StartGame(NULL, NULL); break; default: break; } } if(use3drenderer) RB_ClearBuffer(GLCB_COLOR); M_snprintf(numConn, sizeof(numConn), "%d of %d nodes connected", NumConnected(), net_SteamNumNodes); numConnWidth = M_StringWidth(numConn); V_DrawFilledBox(0, 0, SCREENWIDTH, SCREENHEIGHT, 0); V_WriteBigText(strConn, (SCREENWIDTH - strConnWidth)/2, 60); M_WriteText((SCREENWIDTH - numConnWidth)/2, 100, numConn); M_WriteText(pressStrX, 112, pressStr); if(isServer) M_WriteText(pressStrX+12, 124, pressStr2); NET_CL_Run(); NET_SV_Run(); if(!net_client_connected) I_Error("Lost connection to server"); I_FinishUpdate(); I_Sleep(100); } }