1 #include "../Instrument.h" 4 Instrument(prmX, prmY, prmXScale, prmYScale, prmBus, prmLogger, prmDevice, prmFonts)
9 noThreat =
new Sprite(
logger,
pDevice,
"Textures/Instruments/TCAS.png",
x,
y, 0.3f, 0, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
10 proximate =
new Sprite(
logger,
pDevice,
"Textures/Instruments/TCAS.png",
x,
y, 0.3f, 28, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
11 potentialThreat =
new Sprite(
logger,
pDevice,
"Textures/Instruments/TCAS.png",
x,
y, 0.3f, 56, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
12 collisionThreat =
new Sprite(
logger,
pDevice,
"Textures/Instruments/TCAS.png",
x,
y, 0.3f, 84, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
23 for (UINT i = 0; i <
targets.size(); i++)
27 DWORD color = 0xFF0088FF;
30 if (
bus->
TCAS == Bus::TcasEnum::Traffic_Advisory)
32 else if (
bus->
TCAS >= Bus::TcasEnum::RA_Climb)
36 if (color==0xFFFFAA00)
42 else if (color == 0xFFFF0000)
51 if (fabsf(target.
acc.z) <= 0.36576f)
66 DrawTextW(target.
tcasOnly, static_cast<int>(target.
acc.x) -
x, static_cast<int>(target.
acc.y) -
y - 10, 0.4f, DT_NOCLIP, color);
68 DrawTextW(target.
tcasOnly, static_cast<int>(target.
acc.x) -
x, static_cast<int>(target.
acc.y) -
y + 10, 0.4f, DT_NOCLIP, color);
80 else if (diff < -D3DX_PI)
95 D3DXVec3Normalize(&posnorml, &
playerships[0].position);
99 D3DXMatrixRotationZ(&matrixRot,
rotate);
100 lookAtLH = lookAtLH * matrixRot;
103 for (UINT ii = 1; ii < MAX_SCAN; ii++)
116 target.
type == VehicleType::FloatingMan ||
117 target.
type == VehicleType::BeishtKione)
122 D3DXVec3TransformCoord(&result1, &target.
position, &lookAtLH);
124 if (fabsf(result1.z) >= 3.0f)
128 D3DXVECTOR2 result2 = D3DXVECTOR2(result1.x, result1.y);
129 const float dist = D3DXVec2Length(&result2);
135 nextWaypoint.x =
static_cast<int>(nextWaypoint.x) -
iconOffsetX;
136 nextWaypoint.y =
static_cast<int>(nextWaypoint.y) -
iconOffsetY;
137 target.
acc.x = nextWaypoint.x +
x;
138 target.
acc.y = nextWaypoint.y +
y;
139 target.
acc.z = -result1.z;
140 if (fabsf(target.
acc.z) < 0.05f)
142 swprintf_s(target.
tcasOnly, 16, L
"%02.0f", fabsf(target.
acc.z) * 10.0f);
143 if (target.
vsi > 0.001f)
144 wcscat_s(target.
tcasOnly, 16, L
"\u2191");
145 else if (target.
vsi < -0.001f)
146 wcscat_s(target.
tcasOnly, 16, L
"\u2193");
void FrameMove(float fElapsed) override
void SetLocation(int absoluteX, int absoluteY)
s_network_objects playerships[MAX_SCAN]
TCASOverlay(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font *> prmFonts)
void Draw(D3DXCOLOR prmColor)
const D3DXVECTOR3 northpoleC
std::vector< s_network_objects > targets
float MapScaleInnerRingKm
D3DXVECTOR2 relativeCenter
void AddToCallStack(const char *msg)