?? client.cpp
字號:
cmd.exec(signal);
}
//========================================================================================
inline void drawPlayerEsp(int ax)
{
if( !vPlayers[ax].getPVS() ) { return; }
cl_entity_s* ent = vPlayers[ax].getEnt();
ColorEntry* color = PlayerColor(ax);
//// csg check
//if(cvar.info==6 && ax==gAimbot.target)
//{
// char* modelname = ent->model->name;
// if(!modelname) modelname = "NULL";
// DrawHudString(300,200,222,222,222,"%s",modelname);
// DrawHudString(300,180,222,222,222,"%x %x %x",ent->curstate.effects ,ent->baseline.effects ,ent->prevstate.effects );
// DrawHudString(300,160,222,222,222,"%x %x %x",ent->curstate.rendermode,ent->baseline.rendermode,ent->prevstate.rendermode );
// DrawHudString(300,140,222,222,222,"%x %x %x",ent->curstate.renderamt ,ent->baseline.renderamt ,ent->prevstate.renderamt );
//}
oglSubtractive = true;
switch(cvar.radar)
{
case 0: break;
case 1: drawRadarPoint(ent->origin,color->r,color->g,color->b); break;
case 2: if( isEnemy(ax)) drawRadarPoint(ent->origin,color->r,color->g,color->b); break;
case 3: if(!isEnemy(ax)) drawRadarPoint(ent->origin,color->r,color->g,color->b); break;
}
oglSubtractive = false;
float vecScreen[2];
if (!CalcScreen(ent->origin,vecScreen)){ return; }
// distance and boxradius also needed for esp offset
float distance = vPlayers[ax].distance/22.0f;
int boxradius = (300.0*90.0) / (distance*fCurrentFOV);
BOUND_VALUE(boxradius,1,200);
switch(cvar.box)
{
case 1:
gDrawBoxAtScreenXY(vecScreen[0],vecScreen[1],color->r,color->g,color->b,color->a,boxradius);
break;
case 2:
gDrawBoxAtScreenXY(vecScreen[0],vecScreen[1],color->r,color->g,color->b,color->a,10);
break;
}
// ====== TEXT ESP: ======
int old = cvar.text_background;
cvar.text_background = cvar.esp_background;
// ====== show visibility
const char* format_string;
const char* format_int;
if (vPlayers[ax].visible) { format_string="%s"; format_int="%i"; }
else { format_string="-%s-";format_int="-%i-"; }
// ===== prepare text esp:
enum{ CHAR_HEIGHT = 16 };
int text_dist = (int)(cvar.esp_offs*(double)boxradius);
int ystep = -CHAR_HEIGHT;
int x = vecScreen[0];
int y = vecScreen[1]-text_dist-CHAR_HEIGHT;
if( cvar.esp_wrap && y<0 )
{
ystep = CHAR_HEIGHT;
y = vecScreen[1]+text_dist;
}
if (cvar.esp_line)
{
if(ystep>0) // stack down
{
gEngfuncs.pfnFillRGBA(x,vecScreen[1],1,text_dist,color->r,color->g,color->b,255);
}
else
{
gEngfuncs.pfnFillRGBA(x,y+CHAR_HEIGHT,1,text_dist,color->r,color->g,color->b,255);
}
}
if (cvar.weapon)
{
if (cvar.reload && mod==MOD_CSTRIKE)
{
int seqinfo = Cstrike_SequenceInfo[ent->curstate.sequence];
if( seqinfo>1)
{
DrawHudStringCenter(x,y,100,255,100,Cstrike_infotext[seqinfo]);
}
else
{
DrawHudStringCenter(x,y,color->r,color->g,color->b,format_string,gGetWeaponName(ent->curstate.weaponmodel));
}
}
else
{
DrawHudStringCenter(x,y,color->r,color->g,color->b,format_string,gGetWeaponName(ent->curstate.weaponmodel));
}
y += ystep;
}
if (cvar.name )
{
char displayname[32];
int len = (cvar.name==1) ? 8 : cvar.name;
if(len<0 || len>30) { len = 30; }
strncpy(displayname,vPlayers[ax].entinfo.name,len);
displayname[len] = 0;
DrawHudStringCenter(x,y,color->r,color->g,color->b,format_string,displayname);
y += ystep;
}
if (cvar.distance)
{
DrawHudStringCenter(x,y,color->r,color->g,color->b,format_int, (short int)distance);
y += ystep;
}
//if(cvar.info==8 && ax==gAimbot.target)
//{
// PlayerInfo& r = vPlayers[ax];
// DrawHudString(300,200,222,222,122,"frags:%3d deaths:%3d ratio:%4.2f best:%d",r.frags,r.deaths,r.ratio,r.bestplayer);
// DrawHudString(300,180,222,222,122,"alive:%d tspots:%d",r.getAlive(),r.numTargetSpots);
// DrawHudString(300,160,222,222,122,"fovang:%6.2f dist:%6.2f",r.fovangle,r.distance);
// DrawHudString(300,140,222,222,122,"points:%f",r.points);
//}
cvar.text_background=old;
}
//========================================================================================
inline void drawEsp(int ab)
{
float vecScreen[2];
char weapon[64];
vec3_t EntViewOrg;
VectorCopy(vEntity[ab].ent->origin,EntViewOrg);
memset(&weapon,0,50);
if(!( vEntity[ab].ent
&& vEntity[ab].ent->model
&& vEntity[ab].ent->model->name )) { return; }
char* text = vEntity[ab].ent->model->name;
ColorEntry* color = colorList.get(9);
bool special = false;
int len = strlen(text);
if( len<8 ) { return; }
char* w_pos = strstr(text, "w_");
if (len>10 && w_pos)
{
// models/w_awp.mdl
strcpy(weapon,text+9);
if( (w_pos[2]=='c'&&w_pos[3]=='4')|| // "c4"
(w_pos[2]=='b'&&w_pos[3]=='a'&&w_pos[4]=='c') ) // "backpack"
{
color = colorList.get(3); special=true;
}
}
else
{
// models/scientist.mdl models/hostage.mdl
strcpy(weapon,text+7);
vec3_t forward,right,up;
gEngfuncs.pfnAngleVectors (vEntity[ab].ent->angles, forward, right, up);
EntViewOrg = EntViewOrg + up * 75;
color = colorList.get(3);
special = true;
}
if(cvar.radar&&special){ drawRadarPoint(EntViewOrg,color->r,color->g,color->b,special); }
if(cvar.esp && CalcScreen(EntViewOrg,vecScreen) && (!special||blinkPhase) )
{
weapon[strlen(weapon)-4]=(char)0;
DrawHudStringCenter(vecScreen[0],vecScreen[1],color->r,color->g,color->b,weapon);
}
}
//========================================================================================
void ogc_exec(const char* filename)
{
string file = getOgcDirFile(filename);
file += ".cfg";
cmd.execFile( file.c_str() );
}
//========================================================================================
void playerCalcExtraData(int ax, cl_entity_s* ent)
{
PlayerInfo& r = vPlayers[ax];
// entity trash filter
if( ent->curstate.effects&EF_NODRAW ) { r.clearPVS(); return; }
if( ent==me.ent ) { r.clearPVS(); return; }
switch(ent->curstate.rendermode)
{
case kRenderTransColor:
case kRenderTransTexture:
if( ent->curstate.renderamt<128 ) { r.clearPVS(); return; }
break;
case kRenderNormal:
break;
default:
r.clearPVS();
return;
}
if(!r.getPVS()) return; // dont calc data for non visible players
r.distance = GetDistanceFrom (ent->origin); if(r.distance<1) r.distance=1; // avoid division by zero
gAimbot.calcFovangleAndVisibility(ax);
r.points = 0;
// calc points
float points = 0.0;
bool aimingatme = IsAimingAtMe(ax);
int seqinfo = (mod==MOD_CSTRIKE) ? Cstrike_SequenceInfo[ent->curstate.sequence] : 0;
if(aimingatme)
{
if(seqinfo==SEQUENCE_SHOOT) points += pointSystem[0].points; // "shoot_at_me"
else points += pointSystem[1].points; // "aim_at_me"
}
if( r.visible ) points += pointSystem[2].points; // "visible"
if( r.bestplayer ) points += pointSystem[3].points; // "bestplayer"
if( seqinfo==SEQUENCE_ARM_C4 ) points += pointSystem[4].points; // "arm_c4"
if( r.fovangle > 180.0 ) points += pointSystem[5].points; // "behind_me"
points += pointSystem[6].points/r.distance; // r.distance cannot be 0 here (see above)
points += pointSystem[7].points*r.fovangle;
// add an awp bonus
if(aimingatme)
{
// see if he has an awp
model_s* mdl = IEngineStudio.GetModelByIndex( ent->curstate.weaponmodel );
if( mdl && mdl->name )
{
// "weapons/p_awp.mdl"
int len = strlen(mdl->name);
if(len>10 && mdl->name[len-7]=='a' && mdl->name[len-6]=='w' && mdl->name[len-5]=='p')
{
points += pointSystem[8].points; // "awp_bonus"
}
}
}
// store points
r.points = points;
}
//========================================================================================
void drawSound()
{
int old = cvar.confont;cvar.confont = 1;
for(int pri=0;pri<3;pri++)
for(int i=0;i<cvar.soundmax;i++)
{
SoundMarker& ref = vecSoundMarker[i];
if( ref.priority==pri && ref.timer.running() )
{
ColorEntry* clr = colorList.get(6);
if(cvar.sounddisplay==1)
{
float timeleft = ref.timer.timeleft();
int alpha = (int)( (255.0f/cvar.soundtime)*(timeleft) );
float distance = GetPseudoDistance(me.pmEyePos, ref.origin);
int boxradius = (int)(3000.0f/distance);
BOUND_VALUE(boxradius,2,40);
clr->compiled &= 0xFFFFFF00;
clr->compiled += alpha;
gDrawFilledBoxAtLocation( ref.origin, clr->compiled, boxradius );
} else if(cvar.sounddisplay==2) {
float vecScreen[2];
if (CalcScreen(ref.origin,vecScreen))
{
DrawHudStringCenter(vecScreen[0],vecScreen[1],ref.color->r,ref.color->g,ref.color->b,ref.description);
}
}
if(cvar.soundradar)
{
int screenx, screeny;
calcRadarPoint(ref.origin, screenx,screeny);
gEngfuncs.pfnFillRGBA(screenx,screeny,2,2,ref.color->r,ref.color->g,ref.color->b,255);
}
}
}
cvar.confont = old;
}
//=======================================================================================
void hudDrawInfoTexts()
{
int line_y = displayCenterY*2-180;
int line_x = 20;
#define DECREMENT_LINE_Y { line_y-=16; }
if (cvar.wa_title && winamp.title.size())
{
ColorEntry* clr=colorList.get(13);
int old = cvar.text_background; cvar.text_background = 1;
DrawHudString(line_x,line_y,clr->r,clr->g,clr->b, winamp.title.c_str() );
DECREMENT_LINE_Y
cvar.text_background = old;
}
if (cvar.info)
{
ColorEntry* clr=colorList.get(13);
if(gHudTimer.running())
{
DrawHudString(line_x,line_y,clr->r,clr->g,clr->b, gHudMessage );
DECREMENT_LINE_Y
}
if( gHudTimer2.running() )
{
DrawHudString(line_x,line_y,clr->r,clr->g,clr->b,gHudMessage2 );
DECREMENT_LINE_Y
}
if(cvar.saystats==3)
{
PlayerInfo& r = vPlayers[me.ent->index];
// calc fpm
static double fragcount_starttime=0;
if(r.frags==0) fragcount_starttime = ClientTime::current;
double fpm = 0.0;
double timepassed = ClientTime::current - fragcount_starttime;
if(timepassed>0) { fpm = r.frags / timepassed * 60; }
char tmp[128];
sprintf(tmp,"frags:%d, deaths:%d, headshots:%d (%4.1f ), fpm:%5.3f", r.frags,r.deaths,me.headshots,me.hspercent,fpm);
DrawHudString(line_x,line_y,clr->r,clr->g,clr->b,tmp);
DECREMENT_LINE_Y
}
}
if (bBombIsPlanted && cvar.bombtimer && blinkPhase)
{
int planted;
if (!iC4Timer) { planted = (ClientTime::current - fBombPlantedTime); }
else { planted = ((iC4Timer - (ClientTime::current - fBombPlantedTime))+1); }
int planted_sec = planted % 60;
int planted_min = planted / 60;
char tmbuf[32];
sprintf (tmbuf, "Bomb: %01d:%02d", planted_min, planted_sec);
ColorEntry* clr = colorList.get(7);
DrawHudString(line_x,line_y, clr->r, clr->g, clr->b, tmbuf);
DECREMENT_LINE_Y
}
if( cvar.death && deathInfos.active )
{
ColorEntry* color = colorList.get(16);
float vecScreen[2];
if (CalcScreen(deathInfos.from,vecScreen))
{
DrawHudStringCenter(vecScreen[0],vecScreen[1]-10,color->r,color->g,color->b,"%s",deathInfos.killerName.c_str());
DrawHudStringCenter(vecScreen[0],vecScreen[1]+10,color->r,color->g,color->b,"%s",deathInfos.weaponName.c_str());
}
}
if (cvar.systime)
{
SYSTEMTIME SysTime;
GetLocalTime(&SysTime);
if (SysTime.wHour>12) SysTime.wHour-=12;
ColorEntry* clr = colorList.get(8);
int xx = displayCenterX*2 - 50;
int yy = displayCenterY*2 - 95;
char* formatstring = (SysTime.wMinute<10) ? "%d:0%d" : "%d:%d";
DrawHudString(xx, yy, clr->r, clr->g, clr->b, formatstring, SysTime.wHour, SysTime.wMinute);
}
if ( cvar.speed>1 )
{
extern DWORD speed_ticks_left;
extern DWORD phase_ticks_left;
int x = displayCenterX*2 - 100;
int y = displayCenterY*2 - 195;
ColorEntry* clr=colorList.get(13);
if(speed_ticks_left) DrawHudString(x,y ,clr->r,clr->g,clr->b, "speed: %d",speed_ticks_left );
else DrawHudString(x,y-20,clr->r,clr->g,clr->b, "wait.. %d",phase_ticks_left );
}
}
//========================================================================================
static void gStopMovement()
{
bStopMovement = true;
//Con_Echo("&r- STOPMOVEMENT -");
//if( cvar.burstflags&BurstInfo::BURSTFLAG_STOP )
//{
// gEngfuncs.pfnClientCmd("-moveleft");
// gEngfuncs.pfnClientCmd("-moveright");
// gEngfuncs.pfnClientCmd("-forward");
// gEngfuncs.pfnClientCmd("-back");
//}
//
//if( cvar.burstflags&BurstInfo::BURSTFLAG_USE && !bPressedUse)
//{
// gEngfuncs.pfnClientCmd("+use");
// bPressedUse = true;
//}
}
//========================================================================================
static void gFreeMovement()
{
bStopMovement = false;
//Con_Echo("&r- FREEMOVEMENT -");
//if( bPressedUse )
//{
// gEngfuncs.pfnClientCmd("-use");
// bPressedUse = false;
//}
}
//========================================================================================
static void gAttackHandling()
{
static double timer=0;
if(!( me.alive && cvar.aim && cvar.shoot && me.iClip )){ return; }
if(cvar.burstflags & BurstInfo::BURSTFLAG_NOAIM)
{
bAttacking = false;
bFireCycle = true;
nFireSequence = FIRESEQ_INACTIVE;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -