1.打开client.cpp,
在HUD_Redraw函数的下面,加上:
void hjBox(int x, int y)
{
hjRGB(x,y,1,15,255,255,255,255);
hjRGB(x+15,y,1,15,255,255,255,255);
hjRGB(x,y,15,1,255,255,255,255);
hjRGB(x,y+15,16,1,255,255,255,255);
}
void hjLOO(int x,int y)
{
hjRGB(x,y,1,1,255,255,255,255);
hjRGB(x-1,y+1,1,1,255,255,255,255);
hjRGB(x+1,y+1,1,1,255,255,255,255);
hjRGB(x-1,y+6,1,1,255,255,255,255);
hjRGB(x+1,y+6,1,1,255,255,255,255);
hjRGB(x,y+7,1,1,255,255,255,255);
}
void OgcConsole::draw(int N, int H, int M, int Y)
{
if(!active && !curHeight ) return;
int nscroll = scrollEventCounter.get();
for(int i=0;i<nscroll;i++)
{
if( active ){
if(curHeight!=Y)
{
curHeight += 200;
if(curHeight>Y) curHeight=Y;
}
} else {
curHeight -= 200;
if(curHeight<=0) { curHeight=0; return; }
}
}
ColorEntry* color = colorList.get(17);
oglSubtractive = true;
hjRGB(N,H+25,cvar.con_w,curHeight+35,51,51,204,125);
hjYZ(N,H+25,cvar.con_w,curHeight+35,0);
oglSubtractive = false;
int x = N+3;
int y = H+curHeight-14;
int curHeight1=curHeight+25;
int H1=H+28;
if(H+5+curHeight1-40-hjScro-14 < H1+5) hjScro = curHeight1-40-14;
if(hjScro<0) hjScro = 0;
hjRGB(N+(cvar.con_w-16),H1+5,1,curHeight1-28 , 255, 255, 255, 200 );
hjRGB(N+(cvar.con_w-16),H1+5,11,1 , 255, 255, 255, 200 );
hjRGB(N+(cvar.con_w-16),H1+Y,12,1 , 0, 0, 0, 200 );
hjRGB(N+(cvar.con_w-5),H1+5,1,curHeight1-28 , 0, 0, 0, 200 );
hjRGB(N+(cvar.con_w-17),H1+5+curHeight1-40-hjScro-13,14,14,0, 0, 0,255);
hjBox(N+(cvar.con_w-18),H1+5+curHeight1-40-hjScro-14);
hjLOO(N+(cvar.con_w-11),H1+5+curHeight1-40-hjScro-10);
if(blinkTimer.expired())
{
blink = !blink;
if(blink) { blinkTimer.countdown(0.2); }
else { blinkTimer.countdown(0.2); }
}
if(blink)
{
int length, height, ch_length;
char save;
save = cursorpos[0]; cursorpos[0]=0;
gEngfuncs.pfnDrawConsoleStringLen( editbuf, &length, &height );
cursorpos[0]=save;
save = cursorpos[1]; cursorpos[1]=0;
gEngfuncs.pfnDrawConsoleStringLen( cursorpos, &ch_length, &height );
cursorpos[1]=save;
if(!*cursorpos) ch_length=5;
gEngfuncs.pfnDrawSetTextColor(1,1,1);
gEngfuncs.pfnDrawConsoleString((x+length+5),y+50,"!");//!是控制台闪烁图标
}
color = colorList.get(20);
gEngfuncs.pfnDrawSetTextColor(color->onebased_r,color->onebased_g,color->onebased_b);
oglSubtractive = true;
hjYZ(x+5,y+50,cvar.con_w-15,16,1);
hjYZ(x+5,H+30,cvar.con_w-30,curHeight-3,1);
oglSubtractive = false;
gEngfuncs.pfnDrawConsoleString(x+5,y+50,editbuf);
lines.reset();
for(int fag=0;fag<hjScro;fag++)
lines.prev();
for(;;)
{
y-=14;
if(y<H) break;
string& curLine = lines.read();
lines.prev();
drawConsoleLine(curLine,x+6,y+40);
}
}
//================================================================================================================
2 在void drawMenu的static OgcCommandMenu::Menu* curMenu = ogcMenu.baseMenu;上方,加上:
void hjRGB(GLfloat x, GLfloat y, int w, int h, UCHAR r, UCHAR g, UCHAR b, UCHAR a)
{
glPushMatrix();
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4ub(r,g,b,a);
glBegin(GL_QUADS);
glVertex2f(x,y);
glVertex2f(x+w,y);
glVertex2f(x+w,y+h);
glVertex2f(x,y+h);
glEnd();
glDisable(GL_BLEND);
glPopMatrix();
glEnable(GL_TEXTURE_2D);
}
void hjYZ( int x, int y, int width, int height, int reversed )
{
if(reversed)
{
hjRGB(x, y, 1, height + 1, 0, 0, 0, 255);
hjRGB(x, y, width + 1, 1, 0, 0, 0, 255);
hjRGB(x, y + height, width, 1, 140, 140, 140, 255);
hjRGB(x + width, y, 1, height + 1, 140, 140, 104, 255);
}
else
{
hjRGB(x, y, 1, height + 1, 120, 120, 120, 255);
hjRGB(x, y, width + 1, 1, 120, 120, 120, 255);
hjRGB(x, y + height, width, 1, 0, 0, 0, 255);
hjRGB(x + width, y, 1, height + 1, 0, 0, 0, 255);
}
}
//====================================================================================================================
3 打开Console.h,在class OgcConsole中的void setcolortag(unsigned char ch, int r, int g, int b);下面加上:
int hjScro;
在OgcConsole : editline(editbuf+1) , hist_direction(DIR_BACK)中的colorTags['x'-'a'] = *colorList.get(19);下面加上:
hjScro = 0;
//====================================================================================================================
4 打开Console.cpp,把void OgcConsole::draw(int con_x, int con_y, int con_w, int con_h)函数全部删除。
//===================================================================================================================
5 注册:(如果有了就可以省下这步)
int con_x;
int con_y;
int con_w;
int con_h;
REGISTER_CVAR_INT( con_x ,500);
REGISTER_CVAR_INT( con_y ,0);
REGISTER_CVAR_INT( con_w ,570);
REGISTER_CVAR_INT( con_h ,500);