dman
24th July 2005, 04:32
Box ESP is a modified Range ESP function that does not display any thing inside a Box, with user defined dimensions. you must declare the dimensions (length and width), DimY and DimX, somewhere. I declared them globally so I could change them in game.
function DrawBoxESP(Canvas MyCanvas)
{
local Vector DiffLocation, X, Y, Z;
local int Distance;
local float PosX, PosY, StartX, StartY, BoxX, BoxY, extra;
extra = 5;
BoxX = DimX + (extra * 2);
BoxY = DimY + (extra * 2);
StartX = (MyCanvas.ClipX - BoxX) / 2;
StartY = (MyCanvas.ClipY - BoxY) / 2;
MyCanvas.SetDrawColor(230,230,0);
MyCanvas.SetPos(StartX, StartY);
MyCanvas.DrawBox(MyCanvas, BoxX, BoxY);
MyCanvas.SetPos(MyCanvas.ClipX / 2, StartY - 8);
MyCanvas.DrawTextClipped("|");
MyCanvas.SetPos(MyCanvas.ClipX / 2, StartY + BoxY);
MyCanvas.DrawTextClipped("|");
MyCanvas.SetPos(StartX - 5, MyCanvas.ClipY / 2);
MyCanvas.DrawTextClipped("-");
MyCanvas.SetPos(StartX + BoxX + 2, MyCanvas.ClipY / 2);
MyCanvas.DrawTextClipped("-");
for (i=0; i < MyController.GameReplicationInfo.PRIArray.Length; i++)
{
PRI = MyController.GameReplicationInfo.PRIArray[i];
DiffLocation = PRI.GetPawnLocation() - Me.Location;
Distance = int(VSize(DiffLocation) / 48);
GetAxes(Normalize(MyController.Pawn.GetViewRotatio n()),X,Y,Z);
if ( DiffLocation Dot X > 0.69999999 )
{
if ( !PRI.isDead() )
{
PosX = (MyCanvas.ClipX / 2) + ( (DiffLocation Dot Y)) * (MyCanvas.ClipX / 2) / Tan(MyController.FovAngle * Pi/360) / (DiffLocation Dot X);
PosY = (MyCanvas.ClipY / 2) + (-(DiffLocation Dot Z)) * (MyCanvas.ClipX / 2) / Tan(MyController.FovAngle * Pi/360) / (DiffLocation Dot X);
if (PRI.Team.TeamIndex != Me.PlayerReplicationInfo.Team.TeamIndex)
MyCanvas.SetDrawColor(255,0,0);
else
MyCanvas.SetDrawColor(0,255,0);
MyCanvas.Style = 1;
if (( PosX < StartX - 8 ) || ( PosX > StartX + BoxX + 2 ) || ( PosY < StartY - 8 ) || ( PosY > StartY + BoxY ))
{
MyCanvas.SetPos(PosX - 5, PosY - 8);
MyCanvas.DrawTextClipped("+ " $string(Distance));
}
else
{
MyCanvas.SetPos(PosX, StartY - 8);
MyCanvas.DrawTextClipped("v " $string(Distance));
MyCanvas.SetPos(PosX, StartY + BoxY);
MyCanvas.DrawTextClipped("^ " $string(Distance));
MyCanvas.SetPos(StartX - 5, PosY);
MyCanvas.DrawTextClipped("> " $string(Distance));
MyCanvas.SetPos(StartX + BoxX + 2, PosY);
MyCanvas.DrawTextClipped("< " $string(Distance));
}
}
}
}
}
variable extra gives extra spacing for the box.
those numbers added (positively or negatively) for position settings of the text are numbers I calculated from each text character size and appropriately placed them to match the box.
This is a little different from the one seen from DBOE (v1) source. the one on DBOE has room to expand, such as adding player name.
function DrawBoxESP(Canvas MyCanvas)
{
local Vector DiffLocation, X, Y, Z;
local int Distance;
local float PosX, PosY, StartX, StartY, BoxX, BoxY, extra;
extra = 5;
BoxX = DimX + (extra * 2);
BoxY = DimY + (extra * 2);
StartX = (MyCanvas.ClipX - BoxX) / 2;
StartY = (MyCanvas.ClipY - BoxY) / 2;
MyCanvas.SetDrawColor(230,230,0);
MyCanvas.SetPos(StartX, StartY);
MyCanvas.DrawBox(MyCanvas, BoxX, BoxY);
MyCanvas.SetPos(MyCanvas.ClipX / 2, StartY - 8);
MyCanvas.DrawTextClipped("|");
MyCanvas.SetPos(MyCanvas.ClipX / 2, StartY + BoxY);
MyCanvas.DrawTextClipped("|");
MyCanvas.SetPos(StartX - 5, MyCanvas.ClipY / 2);
MyCanvas.DrawTextClipped("-");
MyCanvas.SetPos(StartX + BoxX + 2, MyCanvas.ClipY / 2);
MyCanvas.DrawTextClipped("-");
for (i=0; i < MyController.GameReplicationInfo.PRIArray.Length; i++)
{
PRI = MyController.GameReplicationInfo.PRIArray[i];
DiffLocation = PRI.GetPawnLocation() - Me.Location;
Distance = int(VSize(DiffLocation) / 48);
GetAxes(Normalize(MyController.Pawn.GetViewRotatio n()),X,Y,Z);
if ( DiffLocation Dot X > 0.69999999 )
{
if ( !PRI.isDead() )
{
PosX = (MyCanvas.ClipX / 2) + ( (DiffLocation Dot Y)) * (MyCanvas.ClipX / 2) / Tan(MyController.FovAngle * Pi/360) / (DiffLocation Dot X);
PosY = (MyCanvas.ClipY / 2) + (-(DiffLocation Dot Z)) * (MyCanvas.ClipX / 2) / Tan(MyController.FovAngle * Pi/360) / (DiffLocation Dot X);
if (PRI.Team.TeamIndex != Me.PlayerReplicationInfo.Team.TeamIndex)
MyCanvas.SetDrawColor(255,0,0);
else
MyCanvas.SetDrawColor(0,255,0);
MyCanvas.Style = 1;
if (( PosX < StartX - 8 ) || ( PosX > StartX + BoxX + 2 ) || ( PosY < StartY - 8 ) || ( PosY > StartY + BoxY ))
{
MyCanvas.SetPos(PosX - 5, PosY - 8);
MyCanvas.DrawTextClipped("+ " $string(Distance));
}
else
{
MyCanvas.SetPos(PosX, StartY - 8);
MyCanvas.DrawTextClipped("v " $string(Distance));
MyCanvas.SetPos(PosX, StartY + BoxY);
MyCanvas.DrawTextClipped("^ " $string(Distance));
MyCanvas.SetPos(StartX - 5, PosY);
MyCanvas.DrawTextClipped("> " $string(Distance));
MyCanvas.SetPos(StartX + BoxX + 2, PosY);
MyCanvas.DrawTextClipped("< " $string(Distance));
}
}
}
}
}
variable extra gives extra spacing for the box.
those numbers added (positively or negatively) for position settings of the text are numbers I calculated from each text character size and appropriately placed them to match the box.
This is a little different from the one seen from DBOE (v1) source. the one on DBOE has room to expand, such as adding player name.