Rise
The Vieneo Province
Loading...
Searching...
No Matches
CommunicationsDialog.cpp
Go to the documentation of this file.
3#include "HudDiagnostics.h"
4
5
6#include "InformationDialog.h"
7#include "WaypointDialog.h"
9#include "../MathUtilities.h"
10#include "../StringUtilities.h"
13
15{
16 logger->AddToCallStack("CommunicationsDialog::ctor");
17 usesHUD = true;
18 HUD.Init(&gui->g_DialogResourceManager, true, L"Textures\\GUI\\dxutcontrols.png");
21
22 active = false;
24 if (FAILED(hr))
25 logger->Log("Could not create Communications transmit control", Logger::Fatal, hr);
28 if (FAILED(hr))
29 logger->Log("Could not create Communications tab edit control", Logger::Fatal, hr);
31 normalinterlace = true;
33 defaultwidth = 843; // Reference layout; shrinks to fit narrower viewports.
34 defaultheight = 5 * 16;
35 tabs = 1;
36 tabusedefaultlang[0] = 0; // this is updated by UpdateMenu
37 tabstr[0][0] = 0;
38
39 showfields = false;
40 fields = 2;
42 fieldwidth[0] = gui->FONT_WIDTH * 12; // handle
43 fieldcontent[0] = 0;
45 fieldwidth[1] = gui->FONT_WIDTH * 64;
46
48 actions = 8;
57 actionenabled[0] = true;
58 actionenabled[1] = false;
59 actionenabled[2] = true;
60 actionenabled[3] = false;
61 actionenabled[4] = true;
62 actionenabled[5] = true;
63 actionenabled[6] = false;
64 actionenabled[7] = true;
65 icon = 19;
67
68 ZeroMemory(&msgbarchannel, sizeof CHATCHANNEL);
69}
70
72{
73 logger->AddToCallStack("CommunicationsDialog::Update");
74
75 // keep docked window attached!
81
82 if (gui->IsAdmin)
83 swprintf_s(msgbartext, HELP_SIZE, L"Floorplan X %i Y %i", gui->game->bus->DebugFloorX, gui->game->bus->DebugFloorY);
84
85 if (gui->g_bLeftClick && editline != -1)
86 {
88 {
89#ifdef ChatEnter
90 HudDiagnostics::LogChatInput(*gui, "chat cleared by left click without transmit focus");
91#endif
92 ClearEdit();
93 }
94 }
95 else if (editfield != -1)
96 {
98#ifdef ChatEnter
100 reportedFocusFailure = false;
101 else if (!reportedFocusFailure)
102 {
103 reportedFocusFailure = true;
104 HudDiagnostics::LogChatInput(*gui, "chat update failed to acquire transmit focus");
105 }
106#endif
107 }
108
109 if (gui->g_bLeftClick && edittab != -1)
110 {
112 {
113#ifdef ChatEnter
114 HudDiagnostics::LogChatInput(*gui, "tab edit cleared by left click without focus");
115#endif
116 ClearEdit();
117 }
118 }
119
120 logger->AddToCallStack("CommunicationsDialog::Update END");
121}
122
123void CALLBACK CommunicationsDialog::DialogCallback(UINT nEvent, int nControlID, RiseControl* pControl, void* pUserContext)
124{
125 logger->AddToCallStack("CommunicationsDialog::DialogCallback");
126
127 CommunicationsDialog* cmd = static_cast<CommunicationsDialog*>(pUserContext);
128#ifdef ChatEnter
129 if (nEvent == EVENT_EDITBOX_STRING || nEvent == EVENT_EDITBOX_CANCEL)
130 {
131 char event[100];
132 sprintf_s(event, sizeof event, "communications callback event=%u control=%d", nEvent, nControlID);
133 HudDiagnostics::LogChatInput(*gui, event);
134 }
135#endif
136
137 switch (nControlID)
138 {
139 case IDC_TRANSMIT:
140 {
141 if ((((RiseEditBox*)pControl)->GetTextLength()) >= TRANSMIT_CHAT_SIZE)
142 {
143 WCHAR str[TRANSMIT_CHAT_SIZE];
144 swprintf_s(str, TRANSMIT_CHAT_SIZE, L"%.*s", TRANSMIT_CHAT_SIZE - 1, ((RiseEditBox*)pControl)->GetText());
145 ((RiseEditBox*)pControl)->SetText(str, false);
146 }
147
148 switch (nEvent)
149 {
151 {
152 WCHAR msg[TRANSMIT_CHAT_SIZE];
153 wcscpy_s(msg, TRANSMIT_CHAT_SIZE, ((RiseEditBox*)pControl)->GetText());
154 cmd->ClearEdit();
155 logger->Log("CommunicationsDialog::DialogCallback - We are sending a chat message!");
156 if (!IsNullOrWhitespace(msg)) // don't bother if it is blank or whitespace
157 {
158 // replace tabs?
159 //for (UINT i = 0; i < wcslen(msg); i++)
160 //{
161 // if (msg[i] == '\t')
162 // msg[i] = ' ';
163 //}
164
165 gui->flood += wcslen(msg) / 78; // old chat line size
166
167 // fix leading spaces
168 if (msg[0] == L' ')
169 {
170 for (unsigned short q = 1; q < wcslen(msg); q++)
171 {
172 if (msg[q] != L' ') // find first non-space
173 {
174 wcscpy_s(msg, TRANSMIT_CHAT_SIZE, &msg[q]);
175 break;
176 }
177 }
178 }
179
180 if (_wcsicmp(msg,L"000COMMANDADVIEW1")==0 || _wcsicmp(msg,L"000COMMANDADVIEW2")==0 || _wcsicmp(msg,L"000COMMANDADVIEW0")==0 || _wcsicmp(msg,L"000COMMANDADVIEWRESET")==0)
181 {
182 auto& diagnostic=gui->game->viewscreen->adDiagnostics;
183 if (_wcsicmp(msg,L"000COMMANDADVIEWRESET")==0)diagnostic.SetEnabled(false);
184 diagnostic.SetEnabled(_wcsicmp(msg,L"000COMMANDADVIEW0")!=0);
185 diagnostic.SetOverlayVisible(_wcsicmp(msg,L"000COMMANDADVIEW2")!=0);
186 if (_wcsicmp(msg,L"000COMMANDADVIEW1")==0 && !gui->minimized)
187 for (short icon=0;icon<=D_ENUMERATION;++icon)if (gui->icon[icon].dialog==-1)
188 {DialogBase::IconClick(icon);break;} // Same minimize/restore behavior as the toolbar.
189 msg[0]=0; // Local diagnostic command, consumed before network chat.
190 }
191 else if (_wcsicmp(msg, L"000DESTRUCT0") == 0)
192 {
193 if (!playerships[0].isSimulator)
194 {
195 deathinhibit = FLT_MAX;
197
198 SClientPacket outpacket;
199 outpacket.type = 15; // Death report
200 outpacket.f_x = 0.0f; // NULL
201 outpacket.f_y = 0.0f; // NULL
202 outpacket.f_z = 0.0f; // NULL
203 outpacket.f_w = 5.0f; // Autodestruct
204 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
205
207 gui->sound->GlobalAttenuate(0.5f, 1.5f, 6.0f, SOUND_EXPLODERING, 0.5f, 1.5f, 6.0f);
208 gui->sound->PlayEx(SOUND_EXPLODERING, true, 0.0f);
209 }
210 }
211 else if (_wcsicmp(msg, L"000COMMANDSIM0") == 0 && gui->IsAdmin)
212 {
214 if (playerships[0].isSimulator)
215 {
223 }
225 SClientPacket outpacket;
226 outpacket.type = 33; // AdministrativeAction
227 outpacket.f_x = 0.0f; // SIM
228 outpacket.f_y = playerships[0].isSimulator ? 1.0f : 0.0f;
229 outpacket.f_z = 0.0f; // NULL
230 outpacket.f_w = 0.0f; // NULL
231 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
232 }
233 else if (_wcsicmp(msg,L"000COMMANDCLOUDBOLT1")==0 || _wcsicmp(msg,L"000COMMANDCLOUDBOLT0")==0)
234 {
235 auto* view=gui->game->viewscreen.get();
236 const bool start=_wcsicmp(msg,L"000COMMANDCLOUDBOLT1")==0;
237 if(!gui->IsAdmin)logger->Log("CLOUDBOLT: admin access required.");
238 else if(!start)
239 {
240 view->cloudVolume.SetLightningDiagnostic(false);
241 logger->Log("CLOUDBOLT: local cloud-flash test stopped.");
242 }
243 else if(playerships[0].isSimulator || !view->VolumeCloudsEnabled()
245 logger->Log("CLOUDBOLT: test requires real flight above the highest cloud layer.");
246 else if(view->cloudVolume.SetLightningDiagnostic(true))
247 logger->Log("CLOUDBOLT: 30 real-second local test, 2 chained cloud events/sec within 100 km beneath ship; live cloud shape, forced storm-strength events. CLOUDBOLT0 stops.");
248 else logger->Log("CLOUDBOLT: waiting for the cloud renderer and global weather map.");
249 msg[0]=0; // Never send diagnostic flashes or commands to the server.
250 }
251 else if (_wcsicmp(msg, L"000COMMANDBOLT") == 0 && gui->IsAdmin)
252 {
253 SClientPacket outpacket{};
255
256 outpacket.type = 33; // AdministrativeAction
257 outpacket.f_x = 1.0f; // BOLT
258 outpacket.f_y = 0.0f;
259 outpacket.f_z = 0.0f; // NULL
260 outpacket.f_w = 0.0f; // NULL
261 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
262 }
263 else if (_wcsicmp(msg, L"000COMMANDRADIO") == 0 && gui->IsAdmin)
264 {
266 SClientPacket outpacket;
267 outpacket.type = 33; // AdministrativeAction
268 outpacket.f_x = 2.0f; // RADIO
269 outpacket.f_y = ourcockpit.radioEquipped ? 1.0f : 0.0f;
270 outpacket.f_z = 0.0f; // NULL
271 outpacket.f_w = 0.0f; // NULL
272 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
273
274 if (playerships[0].reference != REF_BUILDING && playerships[0].reference != REF_WINDOWLESS)
275 {
277 {
278 for (short t = 0; t < MAX_AVIOPERSHIP; t++)
279 {
280 if (ourcockpit.vdat.avionictype[t] == 0)
281 {
284 break;
285 }
286 }
287 }
288 else
289 {
290 for (short t = 0; t < MAX_AVIOPERSHIP; t++)
291 {
292 if (ourcockpit.vdat.avionictype[t] == 3)
293 {
295 break;
296 }
297 }
298 }
299 }
300 }
301 else if (_wcsicmp(msg, L"000COMMANDNVG") == 0 && gui->IsAdmin)
302 {
304 {
307 }
308 else
309 {
311 ourcockpit.inventoryItemInUseSubType = 0; // KitType::None
312 }
313 }
314 else if (gui->IsAdmin && _wcsnicmp(msg, L"000COMMANDSUN", 13) == 0)
315 {
316 float value;
317 if (WeatherOverrides::ParseValue(msg + 13, 0.f, 1.f, value))
318 {
320 SClientPacket outpacket{};
321 outpacket.type = 33; // AdministrativeAction
322 outpacket.f_x = 3.0f; // SUN
323 outpacket.f_y = value;
324 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
325 }
326 else
327 {
328 logger->Log("SUN: use 000COMMANDSUN0..1 (0 below, 0.5 horizon, 1 overhead), or 000COMMANDSUN-1 to restore the orbit.");
329 msg[0] = 0; // Invalid diagnostics must not become network chat.
330 }
331 }
332 else if (gui->IsAdmin && _wcsnicmp(msg, L"000COMMANDVIS", 13) == 0)
333 {
334 float value;
335 if (WeatherOverrides::ParseValue(msg + 13, .010f, 168.64f, value))
337 else
338 wcscpy_s(msg, TRANSMIT_CHAT_SIZE,
339 L"Use 000COMMANDVIS0.010..168.64 (km), or 000COMMANDVIS-1 to restore live weather.");
340 }
341 else if (gui->IsAdmin && (_wcsnicmp(msg, L"000COMMANDRAIN", 14) == 0
342 || _wcsnicmp(msg, L"000COMMANDBCL", 13) == 0))
343 {
344 const bool rain = _wcsnicmp(msg, L"000COMMANDRAIN", 14) == 0;
345 float value;
346 if (!WeatherOverrides::ParseValue(msg + (rain ? 14 : 13), rain ? 2.f : 0.f,
347 rain ? 16.f : cloudTopsMslC, value))
348 {
349 wcscpy_s(msg, TRANSMIT_CHAT_SIZE, rain
350 ? L"Use 000COMMANDRAIN2..16 (decimals allowed), or 000COMMANDRAIN-1 to reset."
351 : L"Use 000COMMANDBCL0..10 (km above ground, decimals allowed), or 000COMMANDBCL-1 to reset.");
352 }
353 else if (rain)
354 {
356 SClientPacket outpacket;
357 outpacket.type = 33; // AdministrativeAction
358 outpacket.f_x = 11.0f; // Precip
359 outpacket.f_y = value;
360 outpacket.f_z = 0.0f; // NULL
361 outpacket.f_w = 0.0f; // NULL
362 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
363 }
364 else
366 }
367 else if (_wcsicmp(msg, L"000COMMANDALPHA-1") == 0 && gui->IsAdmin)
368 {
370 SClientPacket outpacket;
371 outpacket.type = 33; // AdministrativeAction
372 outpacket.f_x = 4.0f; // ALPHA
374 outpacket.f_z = 0.0f; // NULL
375 outpacket.f_w = 0.0f; // NULL
376 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
377 }
378 else if (_wcsicmp(msg, L"000COMMANDALPHA0") == 0 && gui->IsAdmin)
379 {
381 SClientPacket outpacket;
382 outpacket.type = 33; // AdministrativeAction
383 outpacket.f_x = 4.0f; // ALPHA
385 outpacket.f_z = 0.0f; // NULL
386 outpacket.f_w = 0.0f; // NULL
387 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
388 }
389 else if (_wcsicmp(msg, L"000COMMANDALPHA1") == 0 && gui->IsAdmin)
390 {
392 SClientPacket outpacket;
393 outpacket.type = 33; // AdministrativeAction
394 outpacket.f_x = 4.0f; // ALPHA
396 outpacket.f_z = 0.0f; // NULL
397 outpacket.f_w = 0.0f; // NULL
398 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
399 }
400 else if (gui->IsAdmin && _wcsnicmp(msg, L"000COMMANDGAMMA", 15) == 0)
401 {
402 if (playerships[0].isSimulator)
403 {
404 // Discard every preview suffix before updates or server forwarding.
405 msg[0] = 0;
410 }
411 else
412 {
413 float value;
414 if (!WeatherOverrides::ParseValue(msg + 15, 0.f, 1.f, value))
415 {
416 msg[0] = 0; // Invalid commands leave the current override untouched.
417 break;
418 }
420 // Apply now so chat arriving before the next frame uses the new setting.
424 SClientPacket outpacket;
425 outpacket.type = 33; // AdministrativeAction
426 outpacket.f_x = 5.0f; // GAMMA
427 outpacket.f_y = value;
428 outpacket.f_z = 0.0f; // NULL
429 outpacket.f_w = 0.0f; // NULL
430 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
431 }
432 }
433 else if (_wcsicmp(msg, L"000COMMANDELMO0") == 0 && gui->IsAdmin)
434 {
436 SClientPacket outpacket;
437 outpacket.type = 33; // AdministrativeAction
438 outpacket.f_x = 6.0f; // ELMO
439 outpacket.f_y = gui->game->viewscreen->ptrWeather->elmoOverride ? 1.0f : 0.0f;
440 outpacket.f_z = 0.0f; // NULL
441 outpacket.f_w = 0.0f; // NULL
442 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
443 }
444 else if (_wcsicmp(msg, L"000COMMANDELMO1") == 0 && gui->IsAdmin)
445 {
447 SClientPacket outpacket;
448 outpacket.type = 33; // AdministrativeAction
449 outpacket.f_x = 6.0f; // ELMO
450 outpacket.f_y = gui->game->viewscreen->ptrWeather->elmoOverride ? 1.0f : 0.0f;
451 outpacket.f_z = 0.0f; // NULL
452 outpacket.f_w = 0.0f; // NULL
453 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
454 }
455 else if (_wcsicmp(msg, L"000COMMANDACL0") == 0 && gui->IsAdmin)
456 {
458 RiseMath::Vec3Normalize(&norm, &playerships[0].position);
459 RiseMath::Vec3Scale(&playerships[0].position, &norm, radiusC + 14.0f);
460 playerships[0].precisionx = static_cast<double>(playerships[0].position.x);
461 playerships[0].precisiony = static_cast<double>(playerships[0].position.y);
462 playerships[0].precisionz = static_cast<double>(playerships[0].position.z);
464 gui->game->viewscreen->ResetHeadAccelerationEffects("altitude-command");
465 SClientPacket outpacket;
466 outpacket.type = 33; // AdministrativeAction
467 outpacket.f_x = 7.0f; // ACL
468 outpacket.f_y = 0.0f;
469 outpacket.f_z = 0.0f; // NULL
470 outpacket.f_w = 0.0f; // NULL
471 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
472 deathinhibit = 5;
473 }
474 else if (_wcsicmp(msg, L"000COMMANDW0") == 0 && gui->IsAdmin)
475 {
476 if (gui->game->bus->WPtargetC < 0 || gui->game->bus->WPtargetC >= static_cast<long>(gui->game->bus->waypoint.size()))
477 {
478 char msg[199];
479 sprintf_s(msg, sizeof msg, "Trying to reposition to a waypoint that doesn't exist in collection: %i (%zu)", gui->game->bus->WPtargetC, gui->game->bus->waypoint.size());
481 gui->game->bus->WPtargetC = 0;
482 }
483
484 RiseMath::Vector3 location = gui->game->bus->waypoint.at(gui->game->bus->WPtargetC).location;
485 if (location == RiseMath::Vector3(0, 0, 0))
486 break;
487 float msl = RiseMath::Vec3Length(&location) - radiusC;
488
489 playerships[0].position = location;
490 playerships[0].precisionx = static_cast<double>(playerships[0].position.x);
491 playerships[0].precisiony = static_cast<double>(playerships[0].position.y);
492 playerships[0].precisionz = static_cast<double>(playerships[0].position.z);
494
495 RiseMath::Vector3 gthrust;
496 float radius;
498
499 // Force fresh destination terrain and a one-shot weather reset.
502 gui->game->viewscreen->ResetHeadAccelerationEffects("waypoint-command", true);
503
505 char msg[99];
506 sprintf_s(msg, sizeof msg, "Set the cabin pressure and static pressure to the destination: %.0f mB", gui->game->bus->StaticAirPressureMb);
507 logger->Log(msg);
508
509 gui->game->viewscreen->ptrPropulsion->SendTelemetryUpstream(1); // server needs this before we send old weather data again
510
511 SClientPacket outpacket;
512 outpacket.type = 33; // AdministrativeAction
513 outpacket.f_x = 8.0f; // REPOSITION
514 outpacket.f_y = static_cast<float>(gui->game->bus->waypoint.at(gui->game->bus->WPtargetC).id);
515 outpacket.f_z = 0.0f; // NULL
516 outpacket.f_w = 0.0f; // NULL
517 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
518 deathinhibit = 5;
519 }
520 else if (_wcsicmp(msg, L"000COMMANDO0") == 0 && gui->IsAdmin && ourcockpit.spaceCapable)
521 {
522 // Keep multiple thousands of deaths from occurring
523 // Rana's Naughty House
524 //playerships[0].position = RiseMath::Vector3(2676.417f, 1198.615f, -277.6426f);
525 RiseMath::Vec3Normalize(&playerships[0].position, &playerships[0].position);
526 RiseMath::Vec3Scale(&playerships[0].position, &playerships[0].position, radiusC + 500.0f);
527 // Arbitrary point 2000km over Rana's Naughty House
528 //RiseMath::Vector3 offset = RiseMath::Vector3(RandomFloat(), RandomFloat(), RandomFloat());
529 //RiseMath::Vec3Normalize(&offset, &offset);
530 //RiseMath::Vec3Scale(&offset, &offset, 15.0f);
531 //playerships[0].position += offset;
532 playerships[0].precisionx = static_cast<double>(playerships[0].position.x);
533 playerships[0].precisiony = static_cast<double>(playerships[0].position.y);
534 playerships[0].precisionz = static_cast<double>(playerships[0].position.z);
535
536
537 //playerships[0].velocity.x = playerships[0].velocity.y = playerships[0].velocity.z = 0.0f;
538
540 RiseMath::Vector3 location, tempvelocity, cross;
541 RiseMath::Vec3Normalize(&location, &playerships[0].position); // Turn into a vector
542 RiseMath::Vec3Normalize(&tempvelocity, &playerships[0].velocity); // Turn into a vector
543 const float radius = RiseMath::Vec3Length(&playerships[0].position) / radiusC; // Radii from CM, could be stolen from earlier
544 RiseMath::Vec3Cross(&cross, &location, &tempvelocity); // Find perpendicular vector
545 const float angle = RiseMath::Vec3Dot(&location, &tempvelocity); // Find our trajectory to the surface
546 float f_temp = -acosf(angle) - RiseMath::HalfPi;
547 RiseMath::MatrixRotationAxis(&dor, &cross, f_temp); // Set up a matrix
548 RiseMath::Vec3TransformNormal(&playerships[0].velocity, &tempvelocity, &dor); // Use DOR to fix trajectory
549 RiseMath::Vec3Normalize(&playerships[0].velocity, &playerships[0].velocity); // Make it into a vector
550 RiseMath::Vec3Scale(&playerships[0].velocity, &playerships[0].velocity, -sqrtf(gravityKmssC * radiusC / radius));
551
552
553
555
558
560 // Discard the previous terrain clearance using the existing out-of-range value.
562
563 SClientPacket outpacket;
564 outpacket.type = 33; // AdministrativeAction
565 outpacket.f_x = 9.0f; // ORBIT
566 outpacket.f_y = 0.0f;
567 outpacket.f_z = 0.0f; // NULL
568 outpacket.f_w = 0.0f; // NULL
569 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
570 }
571 else if (_wcsicmp(msg, L"000COMMANDD0") == 0 && gui->IsAdmin && gui->game->bus->targetC < -1 && ourcockpit.spaceCapable)
572 {
573 // half a kilometer from the station roughly
574 playerships[0].dockoffset.x = RandomFloat() - 0.5f;
575 playerships[0].dockoffset.y = RandomFloat() - 0.5f;
576 playerships[0].dockoffset.z = RandomFloat() - 0.5f;
579 // 8 is CPOC, 9 is TAC, 10 is YSP
580 playerships[0].reference = static_cast<char>(REF_DOCKENUMCPOC - gui->game->bus->targetC - 2);
582 playerships[0].precisionx = static_cast<double>(playerships[0].position.x);
583 playerships[0].precisiony = static_cast<double>(playerships[0].position.y);
584 playerships[0].precisionz = static_cast<double>(playerships[0].position.z);
586 RiseMath::Vector3 gthrust;
587 float radius;
588 playerships[0].barycentric = Viewscreen::CalculateBarycentric(&playerships[0].position, &gthrust, &radius);
590 playerships[0].orientation.x = 0.28f;
592
594 // Discard the previous terrain clearance using the existing out-of-range value.
596
597 SClientPacket outpacket;
598 outpacket.type = 33; // AdministrativeAction
599 outpacket.f_x = 10.0f; // DOCK
600 outpacket.f_y = static_cast<float>(gui->game->bus->targetC);
601 outpacket.f_z = 0.0f; // NULL
602 outpacket.f_w = 0.0f; // NULL
603 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
604 }
605 else if (wcsncmp(msg, L"000WEIGHT", 9) == 0 && (gui->IsAdmin || playerships[0].isSimulator))
606 {
607 int percent;
608 if (swscanf_s(msg, L"000WEIGHT%i", &percent)!=1)
609 break;
610
611 const float pounds = (ourcockpit.maxGrossLbs - ourcockpit.emptyWeightLbs) * static_cast<float>(percent) / 100.0f;
612
613 // fill fuel first then payload
614 fuel = RiseMath::Max(ourcockpit.fuelmax * 0.02f, pounds);
615 payload = 0;
616 if (fuel > ourcockpit.fuelmax)
617 {
620 }
621
623 }
624 else
625 {
626 // garble based on blackout
629 WCHAR garbled[TRANSMIT_CHAT_SIZE];
630 wcscpy_s(garbled, TRANSMIT_CHAT_SIZE, msg);
631 gui->GarbleChat(garbled);
632
633 // send it
634 gui->networking->SendChatMessage(static_cast<unsigned char>(gui->chatchannel[cmd->activetab].channel), static_cast<unsigned char>(gui->ourplayerC), garbled);
635 }
636
637 if (!msg[0])
638 {
639 logger->Log("CommunicationsDialog::DialogCallback - Message was empty after processing, skipped!");
640 break;
641 }
642
643 gui->chatchannel[cmd->activetab].chatline.emplace_back(msg);
645
646 char str[299]; // TRANSMIT_CHAT_SIZE + a buffer for callsign, brackets, colon, space
647 sprintf_s(str, 299, "[%s]: %S", gui->player[gui->ourplayerC].callsign, msg);
648 logger->Log(str);
649
650 cmd->UpdateMenu(cmd->activetab);
651 }
652 else
653 {
654 logger->Log("CommunicationsDialog::DialogCallback - Message was empty, skipped!");
655 }
656 }
657 break;
658 }
659 }
660 break;
661 case IDC_TABEDIT:
662 {
663 if ((((RiseEditBox*)pControl)->GetTextLength()) >= (MAX_TAB_CHARS - 5 - 1))
664 {
665 WCHAR str[MAX_TAB_CHARS - 5];
666 swprintf_s(str, MAX_TAB_CHARS - 5, L"%.*s", MAX_TAB_CHARS - 5 - 1, ((RiseEditBox*)pControl)->GetText());
667 ((RiseEditBox*)pControl)->SetText(str, false);
668 }
669 if (nEvent == EVENT_EDITBOX_STRING)
670 {
671 short t = D_COMMUNICATIONS;
672 wcscpy_s(gui->chatchannel[cmd->edittab].title, MAX_TAB_CHARS - 5, ((RiseEditBox*)pControl)->GetText());
673 _wcsupr_s(gui->chatchannel[cmd->edittab].title, MAX_TAB_CHARS - 5);
674 gui->chatchannel[cmd->edittab].title[MAX_TAB_CHARS - 5 - 1] = 0; // truncate
675
676 SPacketBig outpacket;
677 outpacket.type = 22;
678 outpacket.array = gui->chatchannel[cmd->edittab].channel;
679 sprintf_s(outpacket.msg, MAX_TAB_CHARS - 5, "%S", gui->chatchannel[cmd->edittab].title);
680 gui->networking->SendToServer(&outpacket, sizeof(SPacketBig), true);
681
682 cmd->ClearEdit();
683 cmd->UpdateMenu(-1); // content changed
684 }
685 }
686 break;
687 }
688
689 logger->AddToCallStack("CommunicationsDialog::DialogCallback END");
690}
691
693{
694 logger->AddToCallStack("CommunicationsDialog::UpdateMenu");
695
696 if (!active)
697 return;
698
700
701 if (tabs > MAX_TAB)
702 {
703 logger->Log("tabs is higher than MAX_TAB", Logger::Level::Error);
704 tabs = MAX_TAB;
705 }
706
707 // always update tabs
708 for (short t = 0; t < tabs; t++)
709 {
710 if (t == 0)
711 swprintf_s(tabstr[t], MAX_TAB_CHARS, L"%s (%i)", gui->strings[L_TAB_GLOBAL].c_str(), gui->chatchannel[t].players);
712 else if (gui->chatchannel[t].title[0] == 0)
713 swprintf_s(tabstr[t], MAX_TAB_CHARS, L"%s (%i)", gui->strings[L_TAB_UNNAMED].c_str(), gui->chatchannel[t].players);
714 else
715 swprintf_s(tabstr[t], MAX_TAB_CHARS, L"%s (%i)", gui->chatchannel[t].title, gui->chatchannel[t].players);
716 }
717
718 if (tab == -1)
719 tab = activetab; // determine channel from activetab
720 else if (tab != activetab) // if not the one we are in right now
721 return;
722
723 bool keepatbottom = false;
725 keepatbottom = true;
726
727 // This is pretty ridiculous, should have been an "erase" but throws exceptions with std::wstring?
728 while (gui->chatchannel[tab].chatline.size() > FORMAT_LINES)
729 {
730 for (size_t i = 0; i < gui->chatchannel[tab].chatline.size() - 1; i++)
731 {
732 gui->chatchannel[tab].chatline[i] = gui->chatchannel[tab].chatline[i + 1];
734 }
735 gui->chatchannel[tab].chatline.pop_back();
736 gui->chatchannel[tab].chatlineplayer.pop_back();
737 }
738
739 if (fieldeffectivewidth[1])
740 {
741 logger->AddToCallStack("CHATCHANNEL::RefreshChat");
743 logger->AddToCallStack("CHATCHANNEL::RefreshChat DONE!");
744 }
745 linetot = gui->chatchannel[tab].formatchatline.size();
746
747 if (keepatbottom)
748 linetop = 9999;
749
750 if ((linetot - linetop) < linedsp) // 8-3 is 5 OK, 8-4 is 4 NO, needs to be 5
752 if (linetop < 0)
753 linetop = 0;
754
755 if (lineact > linetot)
756 lineact = 0;
757
758 if (tabs < MAX_TAB) // room to create one
759 {
760 bool allow = gui->isInjected;
761 for (short s = 1; s < tabs; s++)
762 {
763 if (gui->chatchannel[s].owner == gui->ourplayerC && gui->chatchannel[s].players == 1)
764 allow = false;
765 }
766 actionenabled[0] = allow; // create
767 }
768 else
769 actionenabled[0] = false; // create
770
771 actionenabled[1] = false; // DND
772
773 actionenabled[2] = tab != 0; // close channel only when not on global
774
775 actionenabled[3] = msgbarchannel.channel; // accept invite
776
777 actionenabled[4] = !gui->chatchannel[tab].chatline.empty(); // shred if there is a backlog
778
779 actionenabled[5] = true; // transmit
780
781 actionenabled[6] = linecursel != -1;
782
783 actiontoggle[0] = false;
784 actiontoggle[1] = gui->chatchannel[tab].dnd;
785 actiontoggle[2] = false;
786 actiontoggle[3] = false;
787 actiontoggle[4] = false;
788 actiontoggle[5] = false;
789 actiontoggle[6] = false;
790
791
792 if (linedsp > MAX_LINES)
793 {
794 logger->Log("linedsp is higher than MAX_LINES", Logger::Level::Error);
796 }
797
798 for (long t = 0; t < linedsp; t++)
799 {
800 const long visibleline = linetop + t;
801 if (visibleline >= linetot)
802 {
803 fieldline[t][0][0] = 0;
804 fieldline[t][1][0] = 32767;
805 }
806 else
807 {
808 if (gui->chatchannel[tab].formatchatline.at(visibleline).c_str()[0] != 32767)
809 swprintf_s(fieldline[t][0], HELP_SIZE, L"%S", gui->chatchannel[tab].formatchatlineplayer.at(visibleline).c_str());
810 else
811 fieldline[t][0][0] = 0;
812
813 wcscpy_s(fieldline[t][1], HELP_SIZE, gui->chatchannel[tab].formatchatline.at(visibleline).c_str());
814 }
815 }
816
817 CheckWidth(dialogid); // if content changes (tabs, received text) we have to adjust fit
819
821
822 logger->AddToCallStack("CommunicationsDialog::UpdateMenu DONE");
823}
824
825void CommunicationsDialog::TabClick(short clicked_tab)
826{
827 logger->AddToCallStack("CommunicationsDialog::TabClick");
828
829 if (clicked_tab != activetab) // if tab wasn't the active one, make it active
830 {
831 activetab = clicked_tab;
832 // clearedit=true;
833 ActiveTab();
834 }
835 else // otherwise it was already the active tab, edit it
836 {
837 if (clicked_tab != 0 && gui->chatchannel[clicked_tab].owner == gui->ourplayerC && edittab == -1 && editline == -1)
838 {
839 edittab = clicked_tab;
840 HUD.GetEditBox(IDC_TABEDIT)->SetLocation(static_cast<int>((tabx[clicked_tab] - windowlocation.x - 8.0f) * gui->game->displayscale), static_cast<int>(-30.0f * gui->game->displayscale));
841 HUD.GetEditBox(IDC_TABEDIT)->SetSize(static_cast<int>((tabwidth[clicked_tab] + 20.0f) * gui->game->displayscale), static_cast<int>(32.0f * gui->game->displayscale));
842 HUD.GetEditBox(IDC_TABEDIT)->SetText(gui->chatchannel[clicked_tab].title, false);
844 HUD.GetEditBox(IDC_TABEDIT)->HandleMouse(WM_LBUTTONDOWN, gui->ptClick, 0, 0);
845 gui->Editing = true;
846 }
847 }
848
849 logger->AddToCallStack("CommunicationsDialog::TabClick END");
850}
851
853{
854 logger->AddToCallStack("CommunicationsDialog::ActiveTab");
855
856 HUD.SetFont(0, L"DejaVu Sans Mono", static_cast<long>(12.0f * gui->game->displayscale), FW_THIN);
857
859
860 linetop = 9999; // make sure it is at the bottom
863
864 logger->AddToCallStack("CommunicationsDialog::ActiveTab END");
865}
866
868{
869 char msg[99];
870 sprintf_s(msg, sizeof msg, "CommunicationsDialog::ActionIconClick (%i)", icon_id);
872
873 if (actionenabled[icon_id])
874 {
875 if (action[icon_id] == (L_ACTION_ADD_FOLDER - L_ACTION_MARK) && tabs < MAX_TAB) // add folder
876 {
877 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_ADD_FOLDER");
878
879 tabusedefaultlang[tabs] = 0; // user config
880 tabstr[tabs][0] = 0; // unnamed
881 tabs++;
883 }
884 else if (action[icon_id] == (L_ACTION_REMOVE_FOLDER - L_ACTION_MARK) && tabs > 1) // remove folder
885 {
886 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_REMOVE_FOLDER");
887
888 // ian wants it to go through and remove group associations for records and delete
889 for (short s = activetab; s < (tabs - 1); s++)
890 {
891 tabflash[s] = tabflash[s + 1];
892 wcscpy_s(tabstr[s], MAX_TAB_CHARS, tabstr[s + 1]);
894 }
895 tabs--;
896 if (activetab >= tabs)
897 activetab = tabs - 1;
898 ActiveTab();
899 }
900 else if (action[icon_id] == (L_ACTION_ACCEPT_INVITE - L_ACTION_MARK)) // accept invitation
901 {
902 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_ACCEPT_INVITE");
903
904 actionenabled[icon_id] = false;
905
906 if (tabs < MAX_TAB)
907 {
908 // join
909 msgbartext[0] = 0;
910 msgbarcolor = 0; // normal
911
912 // add tab
913 tabusedefaultlang[tabs] = 0; // user config
914 activetab = tabs;
915 tabs++;
917
918 // copy temp channel data
920 ZeroMemory(&msgbarchannel, sizeof CHATCHANNEL);
921
922 // add ourselves to the list
924 ActiveTab();
925
926 // send join request to server
927 SClientPacket outpacket;
928 outpacket.type = 29; // channel control
929 outpacket.f_x = (float)activetab;
930 outpacket.f_y = (float)gui->chatchannel[activetab].channel;
931 outpacket.f_z = 3.0f; // join
932 outpacket.f_w = 0.0f; // NULL
933 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
934 }
935 else
936 {
937 // sorry
939 msgbarcolor = 2; // amber
940 }
941 }
942 else if (action[icon_id] == (L_ACTION_DISCORD - L_ACTION_MARK)) // join discord
943 {
944 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_DISCORD");
945 ShellExecuteW(nullptr, nullptr, L"https://discord.gg/BH6zvaw", nullptr, nullptr, SW_SHOW);
946 }
947 if (editline == -1)
948 {
949 if (action[icon_id] == (L_ACTION_TRANSMIT - L_ACTION_MARK) && width >= 32)
950 {
951 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_TRANSMIT");
952
954 editline = editfield = 1;
955 gui->Editing = true;
956
957 HUD.GetEditBox(IDC_TRANSMIT)->SetLocation(static_cast<int>(15.0f * gui->game->displayscale), static_cast<int>(height * gui->game->displayscale));
958 HUD.GetEditBox(IDC_TRANSMIT)->SetSize(static_cast<int>(static_cast<float>(width - 32) * gui->game->displayscale), static_cast<int>(32.0f * gui->game->displayscale));
959 HUD.GetEditBox(IDC_TRANSMIT)->SetText(L"", false);
961 HUD.GetEditBox(IDC_TRANSMIT)->HandleMouse(WM_LBUTTONDOWN, gui->ptClick, 0, 0);
962 }
963 else if (action[icon_id] == (L_ACTION_CLEAR_BACKLOG - L_ACTION_MARK))
964 {
965 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_CLEAR_BACKLOG");
966
969 linecursel = -1;
971 }
972 else if (action[icon_id] == (L_ACTION_NEW_CHANNEL - L_ACTION_MARK))
973 {
974 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_NEW_CHANNEL");
975
976 tabusedefaultlang[tabs] = 0; // user config
977 activetab = tabs;
978 tabs++;
980 // add ourselves to the list
986 gui->chatchannel[activetab].dnd = false;
987 gui->chatchannel[activetab].title[0] = 0; // UNNAMED
988 ActiveTab();
989 // we have to transmit the new channel and get the actual channel #
990 // 29=channelctrl, x=tab, y=channel, z=(0=closereq 1=addreq 2=invite 3=joinreq 4=plyrleft 5=newowner), w=ownerslot, array=tempplayer
991 SClientPacket outpacket;
992 outpacket.type = 29;
993 outpacket.f_x = (float)activetab; // tab
994 outpacket.f_y = 0.0f; // waiting for this information
995 outpacket.f_z = 1.0f; // add/new
996 outpacket.f_w = (float)gui->ourplayerC;
997 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
998 UpdateMenu(-1);
999 char msg[99];
1000 sprintf_s(msg, sizeof msg, "Requesting new channel for tab %i", activetab);
1001 logger->Log(msg);
1002 }
1003 else if (action[icon_id] == (L_ACTION_CLOSE_CHANNEL - L_ACTION_MARK))
1004 {
1005 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_CLOSE_CHANNEL");
1006
1007 // transmit that we left the channel
1008 SClientPacket outpacket;
1009 outpacket.type = 29;
1010 outpacket.f_x = static_cast<float>(activetab); // tab
1011 outpacket.f_y = static_cast<float>(gui->chatchannel[activetab].channel);
1012 outpacket.f_z = 0.0f; // close/leave
1013 outpacket.f_w = static_cast<float>(gui->chatchannel[activetab].owner);
1014 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
1015
1020
1021 for (short s = activetab; s < (tabs - 1); s++)
1022 {
1023 wcscpy_s(tabstr[s], MAX_TAB_CHARS, tabstr[s + 1]);
1025 gui->chatchannel[s] = gui->chatchannel[s + 1];
1026 }
1027 tabs--;
1029 activetab--;
1030 ActiveTab();
1031 }
1032 else if (action[icon_id] == (L_ACTION_OFF_HOOK - L_ACTION_MARK))
1033 {
1034 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_OFF_HOOK");
1035
1038 }
1039 else if (action[icon_id] == (L_ACTION_COPY - L_ACTION_MARK))
1040 {
1041 logger->AddToCallStack("CommunicationsDialog::ActionIconClick L_ACTION_COPY");
1042
1044 {
1045 sprintf_s(msg, sizeof msg, "Ha! This is where we were crapping out on linecursel: %i", linecursel);
1047 }
1048 else
1049 {
1050 const wchar_t* str = gui->chatchannel[dialogs[D_COMMUNICATIONS]->activetab].formatchatline.at(linecursel).c_str();
1051
1052 const size_t strLen = wcslen(str);
1053 const HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, (strLen + 1) * sizeof(wchar_t));
1054 if (hMem != nullptr)
1055 {
1056 memcpy(GlobalLock(hMem), str, (strLen + 1) * sizeof(wchar_t));
1057 GlobalUnlock(hMem);
1058
1059 OpenClipboard(nullptr);
1060 EmptyClipboard();
1061 SetClipboardData(CF_UNICODETEXT, hMem);
1062 CloseClipboard();
1063 }
1064 }
1065
1066 linecursel = -1;
1067 actionenabled[6] = false;
1069 }
1070 }
1071 }
1072
1073 logger->AddToCallStack("CommunicationsDialog::ActionIconClick END");
1074}
1075
1076void CommunicationsDialog::ChannelInvite(char* msg, unsigned char whoinvited, unsigned char channel, unsigned char players)
1077{
1078 logger->AddToCallStack("CommunicationsDialog::ChannelInvite");
1079
1080 msgbarchannel.channel = channel;
1081 msgbarchannel.chatline.clear();
1084 msgbarchannel.dnd = false;
1085 msgbarchannel.owner = whoinvited;
1086 swprintf_s(msgbarchannel.title, MAX_TAB_CHARS - 5, L"%S", msg);
1087 if (msgbarchannel.title[0] == 0)
1088 swprintf_s(msgbartext, HELP_SIZE, gui->strings[L_MESSAGE_CHANNELINVITE].c_str(), gui->player[whoinvited].callsign, gui->strings[L_TAB_UNNAMED].c_str(), players);
1089 else
1090 swprintf_s(msgbartext, HELP_SIZE, gui->strings[L_MESSAGE_CHANNELINVITE].c_str(), gui->player[whoinvited].callsign, msgbarchannel.title, players);
1091
1092 actionenabled[3] = true;
1093
1094 logger->AddToCallStack("CommunicationsDialog::ChannelInvite END");
1095}
1096
1098{
1099 logger->AddToCallStack("CommunicationsDialog::DragDropItem");
1100
1101 if (gui->dragt == DD_COMMUNICATIONS) // from player to a chat channel s (tab)
1102 {
1103 // use f_x to receive the target player
1104 SClientPacket outpacket;
1105 outpacket.type = 29;
1106 outpacket.f_x = (float)gui->chatchannel[activetab].seqplayer[gui->dragline]; // used for target player
1107 outpacket.f_y = (float)gui->chatchannel[s].channel;
1108 outpacket.f_z = 2.0f; // invite
1109 outpacket.f_w = (float)gui->chatchannel[s].players;
1110 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
1113 msgbarcolor = 0; // nominal
1114 }
1115 else if (gui->dragt == D_WAYPOINTMANAGER) // from waypoints
1116 {
1117 // tokenized waypoint transmission
1118 if (gui->dragline < 0 || gui->dragline >= (long)gui->waypointDialog->filteredWaypoints.size())
1119 {
1120 char msg[99];
1121 sprintf_s(msg, sizeof msg, "Trying to drag a waypoint that doesn't exist in collection: %i", gui->dragline);
1123 }
1124
1126
1127 // serialize!
1128 WCHAR csv[TRANSMIT_CHAT_SIZE];
1129 swprintf_s(csv, TRANSMIT_CHAT_SIZE, L"TC_WAYPOINT,%i,%f,%f,%f,%ls",
1130 tempwaypoint.uniqueid, tempwaypoint.location.x, tempwaypoint.location.y, tempwaypoint.location.z, tempwaypoint.text);
1132
1133 gui->chatchannel[activetab].chatline.emplace_back(csv);
1135
1137 }
1138
1139 logger->AddToCallStack("CommunicationsDialog::DragDropItem END");
1140}
1141
1143{
1144 logger->AddToCallStack("CommunicationsDialog::ClearEdit");
1145#ifdef ChatEnter
1146 reportedFocusFailure = false;
1147 if (editfield != -1 || editline != -1 || edittab != -1)
1148 HudDiagnostics::LogChatInput(*gui, "communications ClearEdit");
1149#endif
1150
1151 if (editfield != -1 || editline != -1)
1152 {
1153 editfield = editline = -1;
1155 gui->Editing = false;
1156 actionoffset = 0;
1157 }
1158 if (edittab != -1)
1159 {
1160 edittab = -1;
1162 gui->Editing = false;
1163 }
1164
1165 logger->AddToCallStack("CommunicationsDialog::ClearEdit END");
1166}
1167
1169{
1170#ifdef ChatEnter
1171 HudDiagnostics::LogChatInput(*gui, minimize ? "communications minimized" : "communications closed");
1172#endif
1173 active = false;
1174 minimized = minimize;
1176 dialogs[DD_COMMUNICATIONS]->minimized = minimize;
1178}
@ HowToUseJVCAudio
Definition ActiveHelp.h:435
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
#define EVENT_EDITBOX_STRING
Definition Controls.h:27
#define EVENT_EDITBOX_CANCEL
Definition Controls.h:31
@ DD_COMMUNICATIONS
Definition DialogBase.h:7
@ D_WAYPOINTMANAGER
Definition DialogBase.h:6
@ D_COMMUNICATIONS
Definition DialogBase.h:12
@ D_ENUMERATION
Definition DialogBase.h:15
float RandomFloat()
#define TRANSMIT_CHAT_SIZE
#define MAX_AVIOPERSHIP
#define MAX_TAB
#define MAX_TAB_CHARS
@ NightVision
@ REF_BUILDING
Definition ServerTypes.h:46
@ REF_ACLMODE
Definition ServerTypes.h:44
@ REF_DOCKENUMCPOC
Definition ServerTypes.h:53
@ REF_ONGROUND
Definition ServerTypes.h:43
@ REF_WINDOWLESS
Definition ServerTypes.h:50
@ SOUND_EXPLODERING
Definition Sound.h:303
@ SOUND_PEOPLEDEATH
Definition Sound.h:275
bool IsNullOrWhitespace(const WCHAR *string)
#define FORMAT_LINES
Definition chat.h:8
float StaticAirPressureMb
Definition Bus.h:406
float PayloadWeightLbs
Definition Bus.h:464
int DebugFloorY
Definition Bus.h:567
float CabinPressureMb
Definition Bus.h:403
short targetC
Definition Bus.h:480
double SimulatorTimeOffset
Definition Bus.h:475
std::vector< Swaypoint > waypoint
Definition Bus.h:500
float RadioAltitudeKm
Definition Bus.h:157
int WPtargetC
Definition Bus.h:499
int DebugFloorX
Definition Bus.h:566
std::vector< std::wstring > formatchatline
Definition chat.h:61
std::vector< std::string > chatlineplayer
Definition chat.h:54
unsigned char seqplayer[MAX_ONLINEPLAYERS]
Definition chat.h:13
short players
Definition chat.h:15
std::vector< std::string > formatchatlineplayer
Definition chat.h:62
std::vector< std::wstring > chatline
Definition chat.h:53
unsigned char owner
Definition chat.h:63
void RefreshChat(long columnWidth, int fontWidth)
Definition chat.h:67
unsigned char channel
Definition chat.h:63
WCHAR title[MAX_TAB_CHARS - 5]
Definition chat.h:65
void AddPlayer(unsigned char tempplayer)
Definition chat.h:17
bool dnd
Definition chat.h:64
void UpdateMenu(short tab) override
static void CALLBACK DialogCallback(UINT nEvent, int nControlID, RiseControl *pControl, void *pUserContext)
void TabClick(short clicked_tab) override
void ChannelInvite(char *msg, unsigned char whoinvited, unsigned char channel, unsigned char tab)
void Close(bool minimize) override
void DragDropItem(short s) override
void ActionIconClick(long icon_id) override
static HMI * gui
Definition DialogBase.h:42
short fieldcontent[MAX_FIELDS]
Definition DialogBase.h:50
bool actiontoggle[MAX_ACTION]
Definition DialogBase.h:79
virtual void ClearEdit()
Definition DialogBase.h:117
short linedsp
Definition DialogBase.h:74
short actionoffset
Definition DialogBase.h:78
short icon
Definition DialogBase.h:55
bool active
Definition DialogBase.h:73
RiseMath::Vector3 windowseeklocation
Definition DialogBase.h:70
short activetab
Definition DialogBase.h:64
short text
Definition DialogBase.h:71
bool showfields
Definition DialogBase.h:47
static Logger * logger
Definition DialogBase.h:43
short tabs
Definition DialogBase.h:64
short fieldtype[MAX_FIELDS]
Definition DialogBase.h:49
short tabx[MAX_TAB]
Definition DialogBase.h:91
short fieldeffectivewidth[MAX_FIELDS]
Definition DialogBase.h:95
short defaultwidth
Definition DialogBase.h:53
short dialogid
Definition DialogBase.h:102
static DialogBase * dialogs[D_ENUMERATION]
Definition DialogBase.h:41
short height
Definition DialogBase.h:62
static void UpdateScrollBar(short t)
long editfield
Definition DialogBase.h:81
WCHAR fieldline[MAX_LINES][MAX_FIELDS][HELP_SIZE]
Definition DialogBase.h:96
WCHAR tabstr[MAX_TAB][MAX_TAB_CHARS]
Definition DialogBase.h:65
static void IconClick(short icon_id)
bool actionenabled[MAX_ACTION]
Definition DialogBase.h:79
short dockedto
Definition DialogBase.h:57
bool minimized
Definition DialogBase.h:104
static void CheckMoved(short t)
WCHAR msgbartext[HELP_SIZE]
Definition DialogBase.h:84
short tabusedefaultlang[MAX_TAB]
Definition DialogBase.h:52
short width
Definition DialogBase.h:62
RiseMath::Vector3 windowdefaultlocation
Definition DialogBase.h:54
RiseMath::Vector3 windowlocation
Definition DialogBase.h:61
long edittab
Definition DialogBase.h:81
long editline
Definition DialogBase.h:81
RiseDialog HUD
Definition DialogBase.h:100
short tabflash[MAX_TAB]
Definition DialogBase.h:90
static short CheckWidth(short dialogid)
bool usesHUD
Definition DialogBase.h:58
bool normalinterlace
Definition DialogBase.h:56
short action[MAX_ACTION]
Definition DialogBase.h:51
virtual void UpdateMenu(short tab)
Definition DialogBase.h:114
short actions
Definition DialogBase.h:51
short fieldwidth[MAX_FIELDS]
Definition DialogBase.h:48
short fields
Definition DialogBase.h:46
DialogBase(short id)
int linecursel
Definition DialogBase.h:75
virtual void ActiveTab()
char msgbarcolor
Definition DialogBase.h:83
short tabwidth[MAX_TAB]
Definition DialogBase.h:91
short defaultheight
Definition DialogBase.h:53
std::unique_ptr< Bus > bus
Definition GameClass.h:108
void UseOrDisuseInventoryItemType(int itemtype, int itemsubtype, int itemId, int vehicleId) const
std::unique_ptr< Viewscreen > viewscreen
Definition GameClass.h:107
float displayscale
Definition GameClass.h:130
bool isInjected
Definition gui.h:1108
WaypointDialog * waypointDialog
Definition gui.h:1121
GameClass * game
Definition gui.h:1213
short dragt
Definition gui.h:1041
SPlayerData player[MAX_ONLINEPLAYERS]
Definition gui.h:1093
std::wstring strings[L_ENUMERATION]
Definition gui.h:1076
InformationDialog * informationDialog
Definition gui.h:1120
bool Editing
Definition gui.h:1109
float flood
Definition gui.h:1095
unsigned char ourplayerC
Definition gui.h:1094
long dragline
Definition gui.h:1042
bool minimized
Definition gui.h:1113
POINT ptClick
Definition gui.h:1049
void GarbleChat(wchar_t *str) const
Definition gui.cpp:3267
RiseDialogResourceManager g_DialogResourceManager
Definition gui.h:1079
Networking * networking
Definition gui.h:1211
CHATCHANNEL chatchannel[MAX_TAB]
Definition gui.h:1096
short FONT_WIDTH
Definition gui.h:1038
bool g_bLeftClick
Definition gui.h:1039
Sicons icon[D_ENUMERATION+1]
Definition gui.h:1078
short cursoroverwindow
Definition gui.h:1038
Sound * sound
Definition gui.h:1212
bool IsAdmin
Definition gui.h:1108
bool PopUpHelp(short helpId, bool allowDismiss=true, bool isLearnMore=false)
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
@ Fatal
Definition Logger.h:29
@ Error
Definition Logger.h:28
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
void SendChatMessage(unsigned char channel, unsigned char player, const WCHAR *message) const
void RecordChat(const wchar_t *message, unsigned channel)
static FrameProfiler11 & Get()
void SetLocation(int x, int y)
Definition Controls.h:606
bool m_bHasFocus
Definition Controls.h:645
void SetSize(int width, int height)
Definition Controls.h:610
virtual void SetVisible(bool bVisible)
Definition Controls.h:583
RiseEditBox * GetEditBox(int ID)
Definition Controls.h:196
void Init(RiseDialogResourceManager *pManager, bool bRegisterDialog=true)
Definition Controls.cpp:176
void EnableKeyboardInput(bool bEnable)
Definition Controls.h:320
void RequestFocus(RiseControl *pControl)
HRESULT SetFont(UINT index, LPCWSTR strFaceName, LONG height, LONG weight)
Definition Controls.cpp:709
void SetCallback(UICallback pCallback, void *pUserContext=NULL)
Definition Controls.cpp:212
virtual bool HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
void SetText(LPCWSTR wszText, bool bSelected=false)
float Play(SOUNDS soundEnum, float volume=1.0f)
Definition Sound.cpp:802
void PlayEx(SOUNDS soundEnum, bool loop, float volume=1.0f, float frequencyMod=1.0f, float pan=0.0f, bool restart=true, bool fromOutside=false, bool partOfHull=false)
Definition Sound.cpp:1006
void GlobalAttenuate(float prmGaTimeToFadeOut, float prmGaTimeToHold, float prmGaTimeToFadeIn, SOUNDS soundEnum, float prmExTimeToFadeIn, float prmExTimeToHold, float prmExTimeToFadeOut, float volumeAdj=1.0f)
Definition Sound.cpp:536
ReentryEnvelope::State reentryState
Definition Viewscreen.h:399
std::unique_ptr< propulsion > ptrPropulsion
Definition Viewscreen.h:432
RiseMath::Vector3 reentryWindward
Definition Viewscreen.h:400
std::unique_ptr< weather > ptrWeather
Definition Viewscreen.h:434
std::unique_ptr< grid > ptrGrid
Definition Viewscreen.h:426
void SetProjectionMatrices()
Rendering::AdDiagnostics11 adDiagnostics
Definition Viewscreen.h:401
static RiseMath::Vector3 CalculateBarycentric(RiseMath::Vector3 *position, RiseMath::Vector3 *gthrust, float *radius)
float radioBlackout
Definition Viewscreen.h:104
void ResetHeadAccelerationEffects(const char *reason, bool waitForTerrain=false)
std::vector< Swaypoint > filteredWaypoints
void PrepareForReposition()
Definition grid.cpp:271
float tat_mod_qz_x
Definition propulsion.h:92
void SendTelemetryUpstream(float fElapsedTime)
float alphascreenOverride
Definition weather.h:224
float daylightOverride
Definition weather.h:223
void QueuePlotWeatherReset()
Definition weather.cpp:1060
void SetCloudCeilingOverrideKm(float value)
Definition weather.cpp:911
bool TriggerForwardLightning()
Definition weather.cpp:1161
bool elmoOverride
Definition weather.h:226
void SetPrecipOverride(float value)
Definition weather.cpp:905
void SetVisibilityOverrideKm(float value)
Definition weather.cpp:918
float gammascreenOverride
Definition weather.h:225
float fuel
Definition globals.cpp:90
DeathType dead
Definition globals.cpp:37
float f_AGL
Definition globals.cpp:9
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
float deathinhibit
Definition globals.cpp:39
s_universe_object allobjects[maxstarC]
Definition globals.cpp:108
Scockpit ourcockpit
Definition globals.cpp:114
float payload
Definition globals.cpp:92
#define ScaleHeightC
Definition globals.h:98
#define radiusC
Definition globals.h:87
#define SeaLevelPressureMb
Definition globals.h:102
@ AutoDestruct
Definition globals.h:155
#define cloudTopsMslC
Definition globals.h:110
#define gravityKmssC
Definition globals.h:88
#define OneAtmosphereMb
Definition globals.h:104
#define MAX_LINES
Definition gui.h:24
@ L_ACTION_CLEAR_BACKLOG
Definition gui.h:116
@ L_ACTION_OFF_HOOK
Definition gui.h:114
@ L_ACTION_DISCORD
Definition gui.h:137
@ L_ACTION_COPY
Definition gui.h:130
@ L_ACTION_ADD_FOLDER
Definition gui.h:111
@ L_ACTION_CLOSE_CHANNEL
Definition gui.h:115
@ L_TAB_GLOBAL
Definition gui.h:148
@ L_ACTION_MARK
Definition gui.h:107
@ L_MESSAGE_INVITATIONSENT
Definition gui.h:171
@ L_DIALOG_COMMUNICATIONS
Definition gui.h:72
@ L_ACTION_TRANSMIT
Definition gui.h:120
@ L_TAB_UNNAMED
Definition gui.h:139
@ L_ACTION_REMOVE_FOLDER
Definition gui.h:110
@ L_MESSAGE_CHANNELINVITE
Definition gui.h:170
@ L_MESSAGE_NOFREECHANNELS
Definition gui.h:169
@ L_ACTION_ACCEPT_INVITE
Definition gui.h:121
@ L_ACTION_NEW_CHANNEL
Definition gui.h:113
@ IDC_TABEDIT
Definition gui.h:973
@ IDC_TRANSMIT
Definition gui.h:974
#define HELP_SIZE
Definition gui.h:21
@ FIELD_MULTILINECHAT
Definition gui.h:45
@ FIELD_FIXEDTEXT
Definition gui.h:44
constexpr float MaxTopRiseKm
Definition CloudVolume.h:23
HRESULT AddEditBox(RiseDialog &hud, int dialogId, int controlId, bool isDefault, Logger &logger)
float UpdateBlackout(float thermalLoad, float &gammaOverride, bool simulator)
float Vec3Length(const Vector3 *a)
Definition ClientMath.h:95
Vector3 * Vec3Cross(Vector3 *out, const Vector3 *a, const Vector3 *b)
Definition ClientMath.h:105
Vector3 * Vec3TransformNormal(Vector3 *out, const Vector3 *a, const Matrix *m)
Definition ClientMath.h:107
Quaternion * QuaternionIdentity(Quaternion *out)
Definition ClientMath.h:164
Matrix * MatrixRotationAxis(Matrix *out, const Vector3 *axis, float angle)
Definition ClientMath.h:129
float Vec3Dot(const Vector3 *a, const Vector3 *b)
Definition ClientMath.h:93
Vector3 * Vec3Normalize(Vector3 *out, const Vector3 *a)
Definition ClientMath.h:103
Vector3 * Vec3Scale(Vector3 *out, const Vector3 *a, float scale)
Definition ClientMath.h:98
constexpr auto Max(A first, B second)
Definition ClientMath.h:16
constexpr float HalfPi
Definition ClientMath.h:12
bool ParseValue(const wchar_t *text, float minimum, float maximum, float &value)
unsigned char type
unsigned char array
unsigned char type
char callsign[13]
char avionictype[MAX_AVIOPERSHIP]
int inventoryItemInUseSubType
Definition globals.h:700
float maxGrossLbs
Definition globals.h:634
float fuelmax
Definition globals.h:647
float emptyWeightLbs
Definition globals.h:633
SVesselDC vdat
Definition globals.h:664
bool radioEquipped
Definition globals.h:669
bool spaceCapable
Definition globals.h:596
int inventoryItemInUseType
Definition globals.h:699
short dialog
Definition gui.h:664
RiseMath::Vector3 location
WCHAR text[64]
RiseMath::Vector3 barycentric
Definition globals.h:500
RiseMath::Quaternion orientation
Definition globals.h:521
RiseMath::Vector3 dockingvel
Definition globals.h:500
RiseMath::Vector3 position
Definition globals.h:511
double precisionz
Definition globals.h:512
RiseMath::Vector3 dockoffset
Definition globals.h:511
double precisiony
Definition globals.h:512
RiseMath::Vector3 velocity
Definition globals.h:500
float rollRadPerSec
Definition globals.h:523
double precisionx
Definition globals.h:512
RiseMath::Vector3 velocity
Definition globals.h:461
RiseMath::Vector3 position
Definition globals.h:454