5 #include "../MathUtilities.h" 65 HUD.SetFont(0, L
"DejaVu Sans Mono", 12, FW_NORMAL);
92 if (nEvent == EVENT_EDITBOX_STRING)
98 sprintf_s(msg, 199,
"Editing waypoint that doesn't exist in collection: %i (%i) %i", wpd->
linecursel, wpd->
ptrBus->
waypoint.size(), field);
101 logger->
Log(
"IDC_FIELDEDIT was visible!", Logger::Level::Debug);
103 logger->
Log(
"IDC_FIELDEDIT was NOT visible!", Logger::Level::Debug);
110 sprintf_s(wpd->
ptrBus->
waypoint.at(wpd->
linecursel).text, 80,
"%S",
dynamic_cast<CDXUTEditBox*
>(pControl)->GetText());
126 sprintf_s(input, 99,
"%S", dynamic_cast<CDXUTEditBox*>(pControl)->GetText());
127 int count = sscanf_s(input,
"%[NnSs ]%f%[EeWw ]%f", ns, 3, &nsdeg, ew, 4, &ewdeg);
130 float lattemp = D3DXToRadian(nsdeg);
131 float lngtemp = D3DXToRadian(ewdeg);
132 bool letfailed =
true;
133 if (ns[0] ==
'N' || ns[0] ==
'n')
137 else if (ns[0] ==
'S' || ns[0] ==
's')
145 if (ew[0] ==
'E' || ew[0] ==
'e')
149 else if (ew[0] ==
'W' || ew[0] ==
'w')
154 if (fabsf(nsdeg) > 90.0f || fabsf(ewdeg) > 180.0f)
160 result.y = cosf(-lngtemp)*cosf(lattemp);
161 result.x = sinf(-lngtemp)*cosf(lattemp);
162 result.z = sinf(lattemp);
163 D3DXVec3Normalize(&result, &result);
164 D3DXVec3Scale(&result, &result, -
radiusC);
177 if (strlen(input) > 3 && (input[2] ==
'n' || input[2] ==
'N')) index = 3;
178 if (strlen(input) > 4 && input[3] ==
' ') index = 4;
179 count = sscanf_s(&input[index],
"%4d%4d", &tcpu, &tcpv);
184 D3DXVec3Scale(&planar, &planar,
radiusC);
198 else if (nEvent == EVENT_EDITBOX_CANCEL)
259 for (
auto i = 5; i < 11; i++)
267 for (
auto i = 5; i < 11; i++)
269 const unsigned char actionLevel = i - 5;
275 actionenabled[i] = (actionLevel >= waypointLevel - 1) && actionLevel != waypointLevel && type == 0;
302 for (
int i = 5; i < 11; i++)
318 for (
long t = 0; t <
linedsp; t++)
331 throw std::exception(
"Trying to update menu with a waypoint that doesn't exist in collection!");
335 swprintf_s(
fieldline[t][1],
HELP_SIZE, L
"Unsaved waypoint, click here to rename and save!");
381 const float tlat = -D3DXToDegree(atanf(result.z / sqrtf(result.x*result.x + result.y*result.y)));
383 if (result.x <= 0 && result.y > 0)
384 tlng = -D3DXToDegree(atanf(result.x / result.y));
385 else if (result.x < 0 && result.y <= 0)
386 tlng = D3DXToDegree(atanf(result.y / result.x)) + 90.0f;
387 else if (result.x >= 0 && result.y < 0)
388 tlng = -D3DXToDegree(atanf(result.x / result.y)) - 180.0f;
389 else if (result.x > 0 && result.y >= 0)
390 tlng = D3DXToDegree(atanf(result.y / result.x)) - 90.0f;
391 WCHAR northsouth, eastwest;
401 swprintf_s(
fieldline[t][2],
HELP_SIZE, L
"%c %06.3f %c %07.3f", northsouth, fabsf(tlat), eastwest, fabsf(tlng));
402 if (f_temp > 10000.0f)
422 if (linecursel < 0 || linecursel >= static_cast<long>(
ptrBus->
waypoint.size()))
425 sprintf_s(msg, 99,
"Found the problem going to set WPtargetC (%i) and lineact (%i) to linecursel (%i) actionenabled %i",
440 sprintf_s(msg, 99,
"Found the problem WPtargetC %i because of lineact and linecursel!",
ptrBus->
WPtargetC);
446 float waypointId = 0.0f;
450 SClientPacket outpacket;
452 outpacket.f_x = 0.0f;
453 outpacket.f_y = waypointId;
454 outpacket.f_z = 0.0f;
455 outpacket.f_w = 0.0f;
477 if (linecursel < 0 || linecursel >= static_cast<long>(
ptrBus->
waypoint.size()))
478 throw std::exception(
"Trying to ActionIconClick a waypoint that doesn't exist in collection!");
507 SClientPacket outpacket;
509 outpacket.f_x = 3.0f;
511 outpacket.f_z = 0.0f;
512 outpacket.f_w = 0.0f;
521 SClientPacket outpacket;
523 outpacket.f_x = 3.0f;
525 outpacket.f_z = 1.0f;
526 outpacket.f_w = 0.0f;
535 SClientPacket outpacket;
537 outpacket.f_x = 3.0f;
539 outpacket.f_z = 2.0f;
540 outpacket.f_w = 0.0f;
549 SClientPacket outpacket;
551 outpacket.f_x = 3.0f;
553 outpacket.f_z = 3.0f;
554 outpacket.f_w = 0.0f;
563 SClientPacket outpacket;
565 outpacket.f_x = 3.0f;
567 outpacket.f_z = 4.0f;
568 outpacket.f_w = 0.0f;
577 SClientPacket outpacket;
579 outpacket.f_x = 3.0f;
581 outpacket.f_z = 5.0f;
582 outpacket.f_w = 0.0f;
614 sprintf_s(msg, 199,
"WaypointDialog::DragDropItem(%i): %i", destTab,
gui->
dragt);
621 sprintf_s(msg, 199,
"Ha! This is where we were crapping out on dragline: %i",
gui->
dragline);
628 if (wcsncmp(c_str, L
"TC_WAYPOINT,", 12) != 0)
return;
631 WCHAR waypointName[80];
633 float locationx, locationy, locationz;
634 setlocale(LC_ALL,
"English");
635 swscanf_s(c_str, L
"TC_WAYPOINT,%d,%f,%f,%f,%[^\n]", &uniqueId, &locationx, &locationy, &locationz, waypointName, 80);
637 Swaypoint tempwaypoint;
638 tempwaypoint.uniqueid = uniqueId;
639 tempwaypoint.location = D3DXVECTOR3(locationx, locationy, locationz);
640 sprintf_s(tempwaypoint.text,
sizeof tempwaypoint.text,
"%S", waypointName);
641 tempwaypoint.source = 3;
642 tempwaypoint.reference = -2;
643 tempwaypoint.group =
static_cast<unsigned char>(destTab);
644 tempwaypoint.protectionLevel = 5;
645 tempwaypoint.type = 0;
647 tempwaypoint.heading = -1;
648 tempwaypoint.latlng = D3DXVECTOR2(0, 0);
649 tempwaypoint.length = 0;
650 D3DXQuaternionIdentity(&tempwaypoint.orientation);
651 tempwaypoint.pairedwith = 0;
652 tempwaypoint.velocity =
centerC;
void DoubleClickLine() override
float GetArcDist(D3DXVECTOR3 from, D3DXVECTOR3 to, bool includeAltDiff)
D3DXQUATERNION orientation
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
std::vector< std::wstring > chatline
D3DXVECTOR2 CalculateLatLng(D3DXVECTOR3 position)
void Draw(D3DXVECTOR3 *tracked) override
InformationDialog * informationDialog
s_network_objects playerships[MAX_SCAN]
bool actionenabled[MAX_ACTION]
short fieldcontent[MAX_FIELDS]
void Upload(Swaypoint swaypoint) const
void DragDropItem(short destTab) override
void SendEvent(EventType eventType, float extent=0.0f) const
CDXUTDialogResourceManager g_DialogResourceManager
WCHAR fieldline[MAX_LINES][MAX_FIELDS][HELP_SIZE]
static DialogBase * dialogs[D_ENUMERATION]
short fieldwidth[MAX_FIELDS]
bool actiontoggle[MAX_ACTION]
short tabusedefaultlang[MAX_TAB]
D3DXVECTOR3 CalculatePlanar(short u, short v)
static short CheckWidth(short dialogid)
void Sort(short sortfield, char sortdirection, int *linecursel, int *lineact) const
bool fieldsortable[MAX_FIELDS]
void ClearEdit() override
const D3DXVECTOR3 centerC
CHATCHANNEL chatchannel[MAX_TAB]
void Log(const char *msg, Level level=Info, int errorCode=0)
void ActionIconClick(long icon_id) override
void UpdateMenu(short tab) override
float Play(int soundEnum)
std::vector< Snode > nodes
static void CALLBACK DialogCallback(UINT nEvent, int nControlID, CDXUTControl *pControl, void *pUserContext)
std::vector< Swaypoint > waypoint
D3DXVECTOR3 windowdefaultlocation
Viewscreen * ptrViewscreen
std::wstring strings[L_ENUMERATION]
void AddToCallStack(const char *msg)
void Delete(int index) const
short fieldtype[MAX_FIELDS]
D3DXVECTOR3 lastWaypointLocation