-
关注Ta
-
- 注册时间 2004-07-09
- 最后登录 2008-01-25
-
- 发帖1257
- 在线1135小时
- 精华8
- DB29513
- 威望2067
- 保证金0
- 桃子0
- 鲜花0
- 鸡蛋0
-
访问TA的空间加好友用道具
|
this is noob proof becuase i figured out how to add it wrote this tut and i dont want alot of noob coders just adding this without trying, this took me awhile to get right so im repaying the favour!
So you want to add overview radar eh? well its very simple really, just so you dont fuck up ill post the code as a whole in the different parts its in
first in client after vector<hostage_info> vEntity;
add this
Code: | void overview_draw() void overview_calcRadarPoint(const float *origin,int &screenx,int &screeny) void overview_loadcurrent() extern int ov_box_y(int number) |
this should be above float mainViewAngles_SinYaw; for safety
ok search for drawRadarPoint
and replace that with
Code: | void drawRadarPoint(float* origin,int r,int g,int b,bool blink=false) { int screenx=screeninfo.iWidth/2, screeny=screeninfo.iHeight/2; overview_calcRadarPoint(origin,screenx,screeny); if(!blink || blinkPhase){ gEngfuncs.pfnFillRGBA(screenx,screeny,22,22,r,g,b,255);} } |
now seach for void DrawRadarFrame
and replace that with
Code: | int ov_box_y(int number) // y axis correction :) { return (screeninfo.iHeight - number); }
extern void APIENTRY pglViewport( GLint x,GLint y,GLsizei width,GLsizei height ); void DrawRadarFrame() { int size = cvar.radar_size; int x = cvar.radar_x-size; int y = cvar.radar_y-size; window.WinDowDraw(x-1,y-1,2*size+2,2*size+2,"radar-x"); int radar_x = cvar.radar_x; int radar_y = cvar.radar_y; glViewport(radar_x-cvar.radar_size, ov_box_y(radar_y+cvar.radar_size+1), 2*cvar.radar_size, 2*cvar.radar_size); overview_draw(); oglSubtractive = true; // drawSound2(); for(int ax=0;ax<vEntity.size();ax++) { cl_entity_s* ent = vPlayers[ax].getEnt(); drawRadarPoint(ent->origin,(2-vPlayers[ax].team)*255,70,(vPlayers[ax].team-1)*255); } vEntity.clear(); oglSubtractive = false; glViewport(0,0,screeninfo.iWidth,screeninfo.iHeight); gEngfuncs.pfnFillRGBA(cvar.radar_x,cvar.radar_y-size,1,2*size,60,60,60,255); gEngfuncs.pfnFillRGBA(cvar.radar_x-size,cvar.radar_y,2*size,1,60,60,60,255); //} |
now search for drawsound, and under cvar.sounddisplay add this
Code: | if(!cvar.ov_box && me.alive) { int screenx, screeny; overview_calcRadarPoint(ref.origin, screenx,screeny); gEngfuncs.pfnFillRGBA(screenx,screeny,25,25,ref.color->r,ref.color->g,ref.color->b,255); //} //} //} //} //} cvar.confont = old; //}
void drawSound2() { for(int pri=0;pri<3;pri++) for(int i=0;i<cvar.soundmax;i++) { SoundMarker& ref = vecSoundMarker; if( ref.priority==pri && ref.timer.running() ) { if(cvar.ov_box && me.alive) { int screenx=screeninfo.iWidth/2, screeny=screeninfo.iHeight/2; overview_calcRadarPoint(ref.origin, screenx,screeny); gEngfuncs.pfnFillRGBA(screenx,screeny,20,20,ref.color->r,ref.color->g,ref.color->b,255); // } // } // } }
|
now in PostV_CalcRefdef add this at the top in the staement though
Code: | float ov_yaw; me.ent = gEngfuncs.GetLocalPlayer(); if (me.ent && me.ent->curstate.solid) ov_yaw = pparams->viewangles[1]*(3.14/180.0); mainViewAngles_SinYaw = sin(ov_yaw); mainViewAngles_CosYaw = cos(ov_yaw); |
now in hud_redraw add this
Code: | if (cvar.ov_radar) { DrawRadarFrame (); }
|
now the cvars!
in cpp
Code: | REGISTER_CVAR_FLOAT( ov_zoom ,4.40) REGISTER_CVAR_FLOAT( ov_alpha ,1.00) REGISTER_CVAR_INT( ov_radar ,1) REGISTER_CVAR_INT( ov_blend ,0) REGISTER_CVAR_INT( ov_box ,1)
|
in .h
Code: | float ov_zoom; float ov_alpha; int ov_radar; int ov_blend; int ov_box;
|
Do no give out with $oulless's Permission
Credits: OGC for Code $oulless For Tutorial
P.S this has been noob proofed but easy to find You Will Get one linking error to work out! i also encourage you not to ask me unless your seriously fucked, and others that can add it don't answer any questions posted, thnks $oulless > ALL! <3
|