adding retart menu .txt

来自「* first open client.cpp and search for t」· 文本 代码 · 共 208 行

TXT
208
字号
//////////////////////////////////////////////////////////// 
1.Open Client.cpp 
2.Search for void drawMenu 
3.Highlight all the drawMenu function 
4.replace it with this code 

Code: 

void GlowStr(int x,int y,ColorEntry* clr,const char *fmt, ... ) 
{ 
    va_list va_alist; 
    char buf[256]; 

    va_start (va_alist, fmt); 
    _vsnprintf (buf, sizeof(buf), fmt, va_alist); 
    va_end (va_alist); 

    DrawHudString(x-2,  y,clr->r,clr->g,clr->b,buf);// Left 
    DrawHudString(x+2,  y,clr->r,clr->g,clr->b,buf);// Right 
    DrawHudString(  x,y+2,clr->r,clr->g,clr->b,buf);// Top 
    DrawHudString(  x,y-2,clr->r,clr->g,clr->b,buf);// Bottom 
    
    DrawHudString(x-1,y-1,clr->r,clr->g,clr->b,buf);// Left 
    DrawHudString(x+1,y+1,clr->r,clr->g,clr->b,buf);// Right 
    DrawHudString(x-1,y+1,clr->r,clr->g,clr->b,buf);// Top 
    DrawHudString(x+1,y-1,clr->r,clr->g,clr->b,buf);// Bottom 

    DrawHudString(x,y,255,255,255,buf); 
} 

void Border(int x,int y,int w,int h,int th,ColorEntry* clr) 
{ 
   oglSubtractive = true; 
   gEngfuncs.pfnFillRGBA( x-6, y-6, w+11, 1 , 0, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x-6, y-6, 1, h+12 , 0, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x+w+5, y-6, 1, h+12 , 0, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x-6, y+h+6, w+12, 1 , 0, 0, 0, 255 ); 

   gEngfuncs.pfnFillRGBA( x-1, y-1, w+2, 1 , 0, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x-1, y-1, 1, h+2 , 0, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x-1, y+h+1, w+2, 1 , 0, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x+w, y-1, 1, h+2 , 0, 0, 0, 255 ); 

   gEngfuncs.pfnFillRGBA( x-2, y-2, w+4, 1 , 255, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x-2, y-2, 1, h+4 , 255, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x-5, y+h+5, w+10, 1 , 255, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x+w+4, y-4, 1, h+10 , 255, 0, 0, 255 ); 

   gEngfuncs.pfnFillRGBA( x-4, y-4, w+8, 2 , 255, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x-4, y-4, 2, h+8 , 255, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x-4, y+h+3, w+8, 2 , 255, 0, 0, 255 ); 
   gEngfuncs.pfnFillRGBA( x+w+2, y-4, 2, h+9 , 255, 0, 0, 255 ); 

   oglSubtractive = false; 
   gEngfuncs.pfnFillRGBA( x-5, y-5, w+10, 1 , 255, 255, 255, 255 ); 
   gEngfuncs.pfnFillRGBA( x-5, y-5, 1, h+10 , 255, 255, 255, 255 ); 
   gEngfuncs.pfnFillRGBA( x-2, y+h+2, w+4, 1 , 255, 255, 255, 255 ); 
   gEngfuncs.pfnFillRGBA( x+w+1, y-1, 1, h+3 , 255, 255, 255, 255 ); 
} 

void MenuStr(int x, int y, ColorEntry* clr1, ColorEntry* clr2, const char *fmt, ... ) 
{ 
    va_list va_alist; 
    char buf[256]; 
    va_start (va_alist, fmt); 
    _vsnprintf(buf, sizeof(buf), fmt, va_alist); 
    va_end (va_alist); 
    
    GlowStr(x,y,clr2,buf); 
    
    int w = cvar.menu_w; 
    tintArea(x-w/7,y-3,w,20,colorList.get(21)); 
    Border(x-w/7-1,y-4,w,20,1,clr1); 
}    
void MenuSelStr(int x, int y, ColorEntry* clr1, ColorEntry* clr2, const char *fmt, ... ) 
{ 
    va_list va_alist; 
    char buf[256]; 
    va_start (va_alist, fmt); 
    _vsnprintf(buf, sizeof(buf), fmt, va_alist); 
    va_end (va_alist); 
    
    GlowStr(x,y,clr2,buf); 
    
    int w = cvar.menu_w; 
    tintArea(x-w/7,y-3,w,20,colorList.get(22)); 
    Border(x-w/7-1,y-4,w,20,3,clr1); 
} 


// ======================================================================================== 
//           Border1[white]45  Border2[red]38      Border3[blue]39 
void drawMenu(ColorEntry* clr1, ColorEntry* clr2, ColorEntry* clr3) 
{ 
   if(!menu_active) return; 
   if(!curMenu) { curMenu = ogcMenu.baseMenu; } 

   vector<OgcCommandMenu::MenuEntry>& items = curMenu->items; 
   if (!cvar.menu) 
   { 
   int x=cvar.menu_x, y=cvar.menu_y, w=cvar.menu_w; 
   enum{ TEXT_H = 20 }; 
   int title_h = TEXT_H+5; 
   int frame_y = cvar.menu_y - title_h; 
   int frame_h = items.size()*TEXT_H + title_h; 

   ColorEntry* clr1 = colorList.get(0); 
   ColorEntry* clr2 = colorList.get(2); 
   ColorEntry* clr3 = colorList.get(1); 

   // title background 
   if(cvar.menu==1) 
   { 
   tintArea(x,frame_y,w,title_h,colorList.get(21)); 

   // upper background 
   int h1 = curMenu->selection*TEXT_H; 
   if(h1) 
   { 
      tintArea(x,y,w,h1,colorList.get(21)); 
      y+=h1; 
   } 

   // selection background 
   tintArea(x,y,w,TEXT_H,colorList.get(22)); 
   y+=TEXT_H; 

   // lower background 
   int numItemsLeft = items.size() - curMenu->selection - 1; 
   if(numItemsLeft>0) 
   { 
      tintArea(x,y,w,numItemsLeft*TEXT_H,colorList.get(21)); 
   } 

   // draw frame 
   register int c = 200; 
   gEngfuncs.pfnFillRGBA(x,frame_y,w,1        ,c,c,c,c); 
   gEngfuncs.pfnFillRGBA(x,frame_y,1,frame_h  ,c,c,c,c); 
   gEngfuncs.pfnFillRGBA(x+w,frame_y,1,frame_h,c,c,c,c); 
   gEngfuncs.pfnFillRGBA(x,frame_y+frame_h,w,1,c,c,c,c); 
   gEngfuncs.pfnFillRGBA(x,cvar.menu_y,w+1,1  ,c,c,c,c); 

   // title text 
   //gEngfuncs.pfnDrawSetTextColor (255,255,0); 
   //gEngfuncs.pfnDrawConsoleString(cvar.menu_x+10,frame_y+5, const_cast<char*>(curMenu->name.c_str())); 
   DrawHudString(cvar.menu_x+10,frame_y+5,255,255,255,const_cast<char*>(curMenu->name.c_str())); 


   // draw text 
   y=cvar.menu_y+4; 
   x+=4; 
   for(int i=0;i<items.size();i++) 
   { 
      OgcCommandMenu::MenuEntry& item = items[i]; 

      ColorEntry* clr = colorList.get(23); // "menu_text" 
      gEngfuncs.pfnDrawSetTextColor(clr->onebased_r,clr->onebased_g,clr->onebased_b); 
      gEngfuncs.pfnDrawConsoleString(x,y,const_cast<char*>(item.name.c_str())); 
      y+=TEXT_H; 
   } 
   } 
   } 

if (cvar.menu==1) 
   { 
      int x=cvar.menu_x, y=cvar.menu_y, w=cvar.menu_w; 

      // title text 
      MenuSelStr(x,y-30,clr1,clr2,const_cast<char*>(curMenu->name.c_str())); 

      for(int i=0;i<items.size();i++) 
      { 
         OgcCommandMenu::MenuEntry& item=items[i]; 
         if(curMenu->selection == i) 
            MenuSelStr(x,y+(26*i),clr1,clr3,const_cast<char*>(item.name.c_str())); 
         else 
            MenuStr(x,y+(26*i),clr1,clr2,const_cast<char*>(item.name.c_str())); 
      } 
   } 
} 
 


5.Go in Hud_Redraw 
6.Add this anywhere really (into hud redraw): 

Code: 

if (menu_active)      { drawMenu(colorList.get(45),colorList.get(38),colorList.get(39)); } 
 


7.Create a cvar called menu (if you dunno how, then read a tutorial on c++ coding) 
8.Go in color.cpp and add these lines with the other lines that look the same as this code: 

Code: 

   add("glowselclr" ,0,0,255      ); // index:46 
   add("glowclr"    ,255,000,000      ); // index:47 
 


Okay now to avoid confusion i've left out one step that will give you an error (you should only get 1) which should be like either a redefinition or something involving curmenu....comment out that old command (not the new one we put in) and you should get no errors 

enjoy. 

if you get errors paste them in here, but you shouldnt (apart from that one to which you just have to delete the line (or comment it out if your not sure thats the one)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?