mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
Fixed zone offset being wrong for point 1 (#585)
This commit is contained in:
parent
271f2ea9ed
commit
757e9de8c6
@ -2275,7 +2275,7 @@ public Action Shotgun_Shot(const char[] te_name, const int[] Players, int numCli
|
||||
TE_WriteFloat("m_vecAngles[0]", TE_ReadFloat("m_vecAngles[0]"));
|
||||
TE_WriteFloat("m_vecAngles[1]", TE_ReadFloat("m_vecAngles[1]"));
|
||||
|
||||
if(gEV_Type == Engine_CSS)
|
||||
if(IsSource2013(gEV_Type))
|
||||
{
|
||||
TE_WriteNum("m_iWeaponID", TE_ReadNum("m_iWeaponID"));
|
||||
}
|
||||
|
||||
@ -2143,31 +2143,36 @@ void DrawZone(float points[8][3], int color[4], float life, float width, bool fl
|
||||
}
|
||||
}
|
||||
|
||||
// by blacky
|
||||
// original by blacky
|
||||
// creates 3d box from 2 points
|
||||
void CreateZonePoints(float point[8][3], float offset = 0.0)
|
||||
{
|
||||
float center[2];
|
||||
center[0] = ((point[0][0] + point[7][0]) / 2);
|
||||
center[1] = ((point[0][1] + point[7][1]) / 2);
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
// calculate all zone edges
|
||||
for(int i = 1; i < 7; i++)
|
||||
{
|
||||
for(int j = 0; j < 3; j++)
|
||||
{
|
||||
if(i > 0 && i < 7)
|
||||
{
|
||||
point[i][j] = point[((i >> (2 - j)) & 1) * 7][j];
|
||||
}
|
||||
point[i][j] = point[((i >> (2 - j)) & 1) * 7][j];
|
||||
}
|
||||
}
|
||||
|
||||
if(offset != 0.0 && j < 2)
|
||||
// apply beam offset
|
||||
if(offset != 0.0)
|
||||
{
|
||||
float center[2];
|
||||
center[0] = ((point[0][0] + point[7][0]) / 2);
|
||||
center[1] = ((point[0][1] + point[7][1]) / 2);
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
for(int j = 0; j < 2; j++)
|
||||
{
|
||||
if(point[i][j] < center[j])
|
||||
{
|
||||
point[i][j] += offset;
|
||||
}
|
||||
|
||||
else
|
||||
else if(point[i][j] > center[j])
|
||||
{
|
||||
point[i][j] -= offset;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user