1 #include "../Instrument.h" 4 Instrument(prmX, prmY, prmXScale, prmYScale, prmBus, prmLogger, prmDevice, prmFonts)
10 compass =
new Sprite(
logger,
pDevice,
"Textures/Instruments/CompassLarge.png",
x,
y, 0.2f, 0, 0, 530, 530, 0xFFFFFFFF,
xScale,
yScale);
11 headingBug =
new Sprite(
logger,
pDevice,
"Textures/Instruments/HeadingBug.png",
x - 6,
y - 6, 0.8f, 0, 0, 556, 556, 0xFFFF00FF,
xScale,
yScale);
12 bearingBug =
new Sprite(
logger,
pDevice,
"Textures/Instruments/HeadingBug.png",
x - 6,
y - 6, 0.8f, 0, 0, 556, 556, 0xFF00FF00,
xScale,
yScale);
14 flyoverFix =
new Sprite(
logger,
pDevice,
"Textures/Instruments/Waypoints.png",
x,
y, 0.3f, 0, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
15 malteseFix =
new Sprite(
logger,
pDevice,
"Textures/Instruments/Waypoints.png",
x,
y, 0.3f, 28, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
16 touchdown =
new Sprite(
logger,
pDevice,
"Textures/Instruments/Waypoints.png",
x,
y, 0.3f, 56, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
17 userPin =
new Sprite(
logger,
pDevice,
"Textures/Instruments/Waypoints.png",
x,
y, 0.3f, 84, 0, 28, 28, 0xFFFFFFFF,
xScale,
yScale);
20 assay =
new Sprite(
logger,
pDevice,
"Textures/Instruments/assayBox.png",
x,
y, 0.1f, 0, 0, 32, 32, 0xFFFFFFFF,
xScale,
yScale);
52 for (UINT i = 0; i <
waypoints.size(); i++)
54 const Swaypoint waypoint =
waypoints.at(i);
63 switch (waypoint.type)
66 userPin->
SetLocation(static_cast<int>(waypoint.location.x), static_cast<int>(waypoint.location.y));
72 malteseFix->
SetLocation(static_cast<int>(waypoint.location.x), static_cast<int>(waypoint.location.y));
77 swprintf_s(msg, 99, L
"%S", waypoint.text);
78 DrawTextW(msg, static_cast<int>(waypoint.location.x +
iconOffsetX) + 6 -
x, static_cast<int>(waypoint.location.y) -
y, 0.3f, DT_NOCLIP, color);
83 touchdown->
SetLocation(static_cast<int>(waypoint.location.x + 7.5f), static_cast<int>(waypoint.location.y));
92 flyoverFix->
SetLocation(static_cast<int>(waypoint.location.x), static_cast<int>(waypoint.location.y));
97 swprintf_s(msg, 99, L
"%S", waypoint.text);
98 DrawTextW(msg, static_cast<int>(waypoint.location.x +
iconOffsetX) + 6 -
x, static_cast<int>(waypoint.location.y) -
y, 0.3f, DT_NOCLIP, color);
129 for (
int i = 0; i < 21; i++)
140 for (
int i = 0; i < 21; i++)
144 assay->
Draw(D3DCOLOR_ARGB(255, i * 10, i * 10, i * 10));
158 else if (diff < -D3DX_PI)
167 else if (diff < -D3DX_PI)
179 D3DXVECTOR3 posnorml;
180 D3DXVec3Normalize(&posnorml, &
playerships[0].position);
183 D3DXMATRIX matrixRot;
185 lookAtLH = lookAtLH * matrixRot;
193 if (i == 0 && waypoint.location.x == 0.0f)
198 D3DXVec3TransformCoord(&result1, &waypoint.location, &lookAtLH);
202 D3DXVECTOR2 result2 = D3DXVECTOR2(result1.x, result1.y);
203 const float dist = D3DXVec2Length(&result2);
209 nextWaypoint.x =
static_cast<int>(nextWaypoint.x) -
iconOffsetX;
210 nextWaypoint.y =
static_cast<int>(nextWaypoint.y) -
iconOffsetY;
212 Swaypoint newWaypoint;
213 newWaypoint.type = waypoint.type;
214 newWaypoint.location.x = nextWaypoint.x +
x;
215 newWaypoint.location.y = nextWaypoint.y +
y;
217 newWaypoint.heading = waypoint.heading;
218 newWaypoint.length = waypoint.length;
219 strcpy_s(newWaypoint.text, 80, waypoint.text);
229 float vertexWidth = 2.0f;
230 float vertexHeight = 2.0f;
232 D3DXMatrixInverse(&matrixRot,
nullptr, &matrixRot);
233 D3DXVECTOR3 test, result;
236 for (
int xx = 0; xx < 5; xx++)
238 for (
int yy = 0; yy < 5; yy++)
240 if ((xx == 0 && yy == 0) || (xx == 4 && yy == 0) || (xx == 0 && yy == 4) || (xx == 4 && yy == 4))
244 D3DXVec3TransformCoord(&result, &test, &matrixRot);
247 assayGrid[index].u =
static_cast<short>(result.x);
248 assayGrid[index].v =
static_cast<short>(result.y);
void SetLocation(int absoluteX, int absoluteY)
s_network_objects playerships[MAX_SCAN]
void Draw(D3DXCOLOR prmColor)
const D3DXVECTOR3 northpoleC
void SetRotationCenter(D3DXVECTOR2 rotationCenter)
float MapScaleInnerRingKm
VECTOR2SHORT assayGrid[21]
MovingMap(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font *> prmFonts)
float DesiredHeadingRadians
std::vector< Swaypoint > waypoint
void AddToCallStack(const char *msg)
void FrameMove(float fElapsed) override
float HeadingMagneticDegrees
D3DXVECTOR2 relativeCenter