6 Instrument(prmX, prmY, prmXScale, prmYScale, prmBus, prmLogger, prmDevice, prmFonts)
11 noThreat =
new Sprite(
logger,
pDevice,
"Textures/Instruments/TCAS.png",
x,
y, 0.3f, 0, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
12 proximate =
new Sprite(
logger,
pDevice,
"Textures/Instruments/TCAS.png",
x,
y, 0.3f, 28, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
13 potentialThreat =
new Sprite(
logger,
pDevice,
"Textures/Instruments/TCAS.png",
x,
y, 0.3f, 56, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
14 collisionThreat =
new Sprite(
logger,
pDevice,
"Textures/Instruments/TCAS.png",
x,
y, 0.3f, 84, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
25 const auto drawTarget = [&](
Sprite* symbol,
int left,
int top,
float altitude,
const wchar_t* label,
DWORD color) {
29 DrawTextW(label, left -
x, top -
y + (altitude > 0 ? -10 : 10), 0.4f, DT_NOCLIP, color);
39 DrawTextW(L
"TCAS TEST", cx, top + 7, 0.4f, DT_CENTER | DT_NOCLIP, 0xFFFFFFFF);
43 const DWORD color = callout == 0 ? 0xFFFFAA00 : callout < 13 ? 0xFFFF0000 : 0xFFFFFFFF;
44 DrawTextW(
TcasAudio::Callouts[callout].testInstruction, cx, top + 21, 0.4f, DT_CENTER | DT_NOCLIP, color);
45 DrawTextW(
TcasAudio::Callouts[callout].testDetail, cx, top + 34, 0.4f, DT_CENTER | DT_NOCLIP, color);
48 DrawTextW(L
"DISPLAY CHECK", cx, top + 21, 0.4f, DT_CENTER | DT_NOCLIP, 0xFFFFFFFF);
49 const int row =
y + top + 64;
50 drawTarget(
noThreat,
x + cx - 51, row, .5f, L
"05", 0xFF0088FF);
51 drawTarget(
proximate,
x + cx - 21, row, -.1f, L
"01", 0xFF0088FF);
53 drawTarget(
collisionThreat,
x + cx + 39, row, -.2f, L
"02\u2193", 0xFFFF0000);
58 const wchar_t* instruction = L
"MONITOR VERTICAL SPEED";
75 swprintf_s(text, L
"%ls%ls %+.0f FPM", instruction,
bus->
TCASCrossing ? L
" - CROSSING" : L
"",
77 DrawTextW(text, 10, 10, 0.4f, DT_NOCLIP, 0xFFFF0000);
79 for (UINT i = 0; i <
targets.size(); i++)
83 DWORD color = 0xFF0088FF;
94 drawTarget(symbol,
static_cast<int>(target.acc.x),
static_cast<int>(target.acc.y), target.acc.z, target.tcasOnly, color);
114 rotate += diff * fElapsed;
131 lookAtLH = lookAtLH * matrixRot;
133 for (UINT ii = 1; ii <
MAX_SCAN; ii++)
137 if (!target.active || !target.visible || !target.isOnScanner)
140 if (!target.logolight ||
142 target.groundvehicle ||
143 !target.transponder ||
146 target.distance >= 74.08f ||
147 target.altitudeDiffAbs >= 3.01752f ||
169 nextWaypoint.x =
static_cast<int>(nextWaypoint.x) -
iconOffsetX;
170 nextWaypoint.y =
static_cast<int>(nextWaypoint.y) -
iconOffsetY;
171 target.acc.x = nextWaypoint.x +
x;
172 target.acc.y = nextWaypoint.y +
y;
173 target.acc.z = -result1.z;
174 if (fabsf(target.acc.z) < 0.05f)
176 swprintf_s(target.tcasOnly, 16, L
"%02.0f", fabsf(target.acc.z) * 10.0f);
177 if (target.vsi > 0.001f)
178 wcscat_s(target.tcasOnly, 16, L
"\u2191");
179 else if (target.vsi < -0.001f)
180 wcscat_s(target.tcasOnly, 16, L
"\u2193");
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
SCRIPT_CONTROL SCRIPT_STATE const void DWORD
const RiseMath::Vector3 northpoleK
float MapScaleInnerRingKm
float TCASTargetVerticalSpeedKms
Rendering::RenderSprite * pSprite
Instrument(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
void AddToCallStack(const char *msg)
void SetLocation(int absoluteX, int absoluteY)
Sprite(Logger *prmLogger, DeviceObject *prmpDevice, std::string prmPathAndFilename, int prmX, int prmY, float prmZ, int prmTop, int prmLeft, int prmWidth, int prmHeight, DWORD prmColor, float scaleX=1.0f, float scaleY=1.0f)
void Draw(RiseMath::Color prmColor)
TCASOverlay(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font * > prmFonts)
std::vector< s_network_objects > targets
void FrameMove(float fElapsed) override
RiseMath::Vector2 relativeCenter
s_network_objects playerships[MAX_SCAN]
Vector3 * Vec3TransformCoord(Vector3 *out, const Vector3 *a, const Matrix *m)
float Vec2Length(const Vector2 *a)
Matrix * MatrixLookAtLH(Matrix *out, const Vector3 *eye, const Vector3 *at, const Vector3 *up)
Vector3 * Vec3Normalize(Vector3 *out, const Vector3 *a)
Matrix * MatrixRotationZ(Matrix *out, float value)
constexpr Callout Callouts[]