Rise
The Vieneo Province
Loading...
Searching...
No Matches
gui.cpp
Go to the documentation of this file.
1#include "gui.h"
2
14
15#include "GameClass.h"
16#include "Networking.h"
18
19#include <clocale> // For setlocale
20#include <fcntl.h> // For _O_RDWR, _O_BINARY, _O_RDONLY, O_TEXT
21#include <io.h> // For _open, _read, _close, _lseek, eof, _write
22#include <sys/stat.h> // For _S_IWRITE, _S_IREAD
23#include <KnownFolders.h>
24#include <ShlObj.h>
25#include <ctime>
26#include <sstream>
27
29#include "MathUtilities.h"
30#include "ImmigrationRules.h"
31#include "ActiveHelp.h"
32
33
34namespace
35{
36 constexpr short layoutDialogs[] = {D_PEOPLEMANAGER, D_WAYPOINTMANAGER, DD_COMMUNICATIONS,
38 static_assert(_countof(layoutDialogs) == DialogLayout::Count);
39 std::array<bool, DialogLayout::Count> defaultLayoutPending{};
40
41 short DefaultMinimumWidth(const DialogBase& dialog)
42 {
43 short minimum = RiseMath::Max(72 + static_cast<short>(wcslen(dialog.Title())) * DialogBase::gui->FONT_WIDTH,
44 dialog.fields * 30 + 16);
45 return RiseMath::Max(minimum, dialog.tabs * (4 * DialogBase::gui->FONT_WIDTH + 13));
46 }
47
48 void ApplyDefaultDialogLayout(bool animate)
49 {
50 if (std::none_of(defaultLayoutPending.begin(), defaultLayoutPending.end(), [](bool value) { return value; }))
51 return;
52 const auto* game = DialogBase::gui->game;
53 if (game->displayscale <= 0.0f)
54 return;
55
57 for (int i = 0; i < DialogLayout::Count; ++i)
58 {
59 const auto& dialog = *DialogBase::dialogs[layoutDialogs[i]];
60 sizes[i].width = static_cast<float>(RiseMath::Max(dialog.defaultwidth, DefaultMinimumWidth(dialog)));
61 sizes[i].height = static_cast<float>(dialog.defaultheight + (dialog.tabs ? 16 : 0) +
62 8 + (dialog.showfields ? 16 : 0) + (dialog.actions ? 32 : 0) + 32);
63 }
64 const auto layout = DialogLayout::Defaults(game->displayWidth / game->displayscale,
65 game->displayHeight / game->displayscale, sizes,
66 DefaultMinimumWidth(*DialogBase::dialogs[D_COMMUNICATIONS]));
67
68 // Assign all sizes/positions before refreshing the docked pair and controls.
69 for (int i = 0; i < DialogLayout::Count; ++i)
70 {
71 auto& dialog = *DialogBase::dialogs[layoutDialogs[i]];
72 dialog.windowdefaultlocation = RiseMath::Vector3(layout[i].x, layout[i].y, 0);
73 if (!defaultLayoutPending[i])
74 continue;
75 dialog.width = static_cast<short>(layout[i].width);
76 dialog.height = dialog.defaultheight;
78 if (!animate || !dialog.active)
79 {
81 dialog.windowseeklocation.z = -1.0f;
82 }
83 }
84 for (int i = 0; i < DialogLayout::Count; ++i)
85 {
86 if (!defaultLayoutPending[i])
87 continue;
88 DialogBase::CheckWidth(layoutDialogs[i]);
89 DialogBase::CheckHeight(layoutDialogs[i]);
90 }
91 defaultLayoutPending.fill(false);
93 }
94
95 void QueueDefaultDialogLayout(short dialogId)
96 {
97 // Controls also need valid provisional geometry during loading/device reset.
98 auto& dialog = *DialogBase::dialogs[dialogId];
101 dialog.ActiveTab();
102 DialogBase::CheckWidth(dialogId);
103 DialogBase::CheckHeight(dialogId);
104 dialog.UpdateMenu(-1);
105 for (int i = 0; i < DialogLayout::Count; ++i)
106 if (layoutDialogs[i] == dialogId)
107 defaultLayoutPending[i] = true;
108 }
109}
110
111void HMI::SexChangeOperation(char newsex, bool randomizeHeightWeight)
112{
113 for (short t = 1; t < humantextureC; t++)
114 {
115 if (game->graphics->m_pddsAvatar[t])
116 {
118 char msg[99];
119 sprintf_s(msg, sizeof(msg), "m_pddsAvatar[%i]", t);
121 }
122 }
123
124 if (newsex == 1) // man
125 {
126 if (tempobject.VB)
127 {
129 game->UpdateTrackedResource("tempobject.VB", 3);
130 }
131 tempobject = polyobj.LoadDAW("Meshes\\male1.DAW");
132 game->AddTrackedResource("tempobject.VB"); // managed
133
134
135 polyobj.LoadDIX("Meshes\\male1.DIX");
136
137
138 for (short t = 1; t < humantextureC; t++)
139 {
140 WCHAR hullfile[199];
141 hullfile[0] = 0;
143 switch (t)
144 {
145 case 1: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\BODY1.dds");
146 break;
147 //case 2: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\VECTOR.dds");
148 // break;
149 //case 3: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\EXO.dds");
150 // break;
151 //case 4: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\VICTOR.dds");
152 // break;
153 //case 5: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\SOCK.dds");
154 // break;
155 //case 6: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\FOCUS.dds");
156 // break;
157 case 7: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\ears1.dds");
158 break;
159 case 8: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\straight1.dds");
160 break;
161 case 9: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\HEAD1.dds");
162 break;
163 case 10: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\noses1.dds");
164 break;
165 case 11: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\HEAD2.dds");
166 break;
167 case 12: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\HEAD3.dds");
168 break;
169 case 13: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\flattop1.dds");
170 break;
171 case 14: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\HAMMONDS1.dds");
173 break;
174 default:
175 continue;
176 }
177 char msg[99];
178 sprintf_s(msg, sizeof(msg), "m_pddsAvatar[%i]", t);
179 game->LoadTexture(&game->graphics->m_pddsAvatar[t], msg, hullfile, format);
180 }
181
182 g_HUD.GetSlider(IDC_HEAD)->SetRange(151, 153);
183 g_HUD.GetSlider(IDC_NOSE)->SetRange(101, 104);
184 g_HUD.GetSlider(IDC_HAIRSTYLE)->SetRange(175, 179); // Sligo noted 8/11/2025 that 176 and 179 are the same polygon mesh with different texturing
188 g_HUD.GetSlider(IDC_EARS)->SetRange(226, 228);
189 //g_HUD.GetSlider(IDC_FEATURE)->SetRange(125, 127);
193
195 maxWeight = 155.0f; // kg
196 minWeight = 53.0f; // kg
197
199 maxHeight = 192.0f; // cm
200 minHeight = 156.0f; // cm
201 }
202 else if (newsex == 2) // woman
203 {
204 if (tempobject.VB)
205 {
207 game->UpdateTrackedResource("tempobject.VB", 3);
208 }
209 tempobject = polyobj.LoadDAW("Meshes\\female1.DAW");
210 game->AddTrackedResource("tempobject.VB"); // managed
211
212
213 polyobj.LoadDIX("Meshes\\female1.DIX");
214
215
216 for (short t = 1; t < humantextureC; t++)
217 {
218 WCHAR hullfile[199];
219 hullfile[0] = 0;
221 switch (t)
222 {
223 case 1: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\BODY1.dds");
224 break;
225 case 2: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\ears1.dds");
226 break;
227 case 3: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\HEAD2.dds");
228 break;
229 case 4: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\HEAD1.dds");
230 break;
231 case 5: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\noses1.dds");
232 break;
233 case 6: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\head3.dds");
234 break;
235 case 7: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\HAIR3-Chantal.dds");
236 break;
237 case 8: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\HAIR1-MARYMOORE.dds");
238 break;
239 case 9: wcscpy_s(hullfile, 199, L"textures\\People\\Female\\HAIR2-Suzette.dds");
240 break;
241 case 10: wcscpy_s(hullfile, 199, L"textures\\People\\Male\\HAMMONDS1.dds");
243 break;
244 default:
245 continue;
246 }
247 char msg[99];
248 sprintf_s(msg, sizeof(msg), "m_pddsAvatar[%i]", t);
249 game->LoadTexture(&game->graphics->m_pddsAvatar[t], msg, hullfile, format);
250 }
251
252 g_HUD.GetSlider(IDC_HEAD)->SetRange(151, 153);
253 g_HUD.GetSlider(IDC_NOSE)->SetRange(101, 103);
258 g_HUD.GetSlider(IDC_EARS)->SetRange(226, 227);
259 g_HUD.GetSlider(IDC_FEATURE)->SetVisible(false); // unsupported
262
264 maxWeight = 138.0f; // kg
265 minWeight = 44.0f; // kg
266
268 maxHeight = 177.0f; // cm
269 minHeight = 144.0f; // cm
270 }
271
272 WCHAR str[4];
273 swprintf_s(str, 4, L"%.3s", g_HUD.GetEditBox(IDC_WEIGHT)->GetText());
274 if (!str[0]) // blank
275 {
276 weight = 1.0f;
278 //float random = powf(RandomFloat(), 4.0f); // so 0-1 weighted at 0
279 //if (rand() % 2 == 0) random = -random;
280 //swprintf_s(str, 4, L"%.0f", weight + random);
281 //g_HUD.GetEditBox(IDC_WEIGHT)->SetText(str);
282 //g_HUD.GetEditBox(IDC_WEIGHT)->SetEnabled(true);
283 }
284
285 swprintf_s(str, 4, L"%.3s", g_HUD.GetEditBox(IDC_HEIGHT)->GetText());
286 if (!str[0]) // blank
287 {
288 height = 1.0f;
290 //float random = powf(RandomFloat(), 4.0f); // so 0-1 weighted at 0
291 //if (rand() % 2 == 0) random = -random;
292 //swprintf_s(str, 4, L"%.0f", height + random);
293 //g_HUD.GetEditBox(IDC_HEIGHT)->SetText(str);
294 }
295
296 if (randomizeHeightWeight)
297 {
298 WCHAR str[16];
299
301 swprintf_s(str, 16, L"%.0f", Lerp(minHeight, maxHeight, height));
303
305 swprintf_s(str, 16, L"%.0f", Lerp(minWeight, maxWeight, weight));
307 }
308
310
311 if (player[ourplayerC].voice)
312 {
313 if (newsex == 1)
314 g_HUD.GetComboBox(IDC_VOICE)->SetSelectedByIndex(player[ourplayerC].voice); // they start at 1, perfect
315 else if (newsex == 2)
316 g_HUD.GetComboBox(IDC_VOICE)->SetSelectedByIndex(player[ourplayerC].voice - 100); // they start at 101
317
319 }
320 else
321 {
323 }
324}
325
326void HMI::OnFrameMove(float fElapsedTime)
327{
328 logger->AddToCallStack("HMI::OnFrameMove");
331
332 if (isSteam)
334
335 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
336 // ReSharper disable once CppIncompleteSwitchStatement
337 switch (game->displaystage) // NOLINT
338 {
339#pragma region STATUS_CREATE
341 {
342 char newSex = 0;
344 newSex = 1;
346 newSex = 2;
347 if (newSex != oldSex)
348 {
349 if (newSex)
350 {
351 SexChangeOperation(newSex, false);
352 }
353 else
354 {
356 game->UpdateTrackedResource("pBuffer", 3);
357 if (tempobject.VB)
358 {
360 game->UpdateTrackedResource("tempobject.VB", 3);
361 }
362 }
363 oldSex = newSex;
364 }
365
366 const auto weightRange = ImmigrationRules::GetWeightRange(
367 static_cast<int>(minWeight), static_cast<int>(maxWeight),
368 player[ourplayerC].weightKg, player[ourplayerC].revisitImmigration);
369
371 {
372 WCHAR str[4];
373 swprintf_s(str, 4, L"%.3s", g_HUD.GetEditBox(IDC_WEIGHT)->GetText());
374 if (str[0]) // not blank
375 {
376 const int val = _wtoi(str);
377 const int newval = weightRange.Clamp(val);
378 swprintf_s(str, 4, L"%i", newval);
380 weight = static_cast<float>(newval) / ((maxWeight - minWeight) * 0.5f + minWeight);
381 }
382 }
383
385 {
386 WCHAR str[4];
387 swprintf_s(str, 4, L"%.3s", g_HUD.GetEditBox(IDC_HEIGHT)->GetText());
388 if (str[0]) // not blank
389 {
390 const int val = _wtoi(str);
391 int newval = RiseMath::Min((int)maxHeight, val);
392 newval = RiseMath::Max((int)minHeight, newval);
393 swprintf_s(str, 4, L"%i", newval);
395 // so the model we give them is 156 to 192 ... means model is 174
396 height = static_cast<float>(newval) / ((maxHeight - minHeight) * 0.5f + minHeight);
397 }
398 }
399
401 {
402 WCHAR str[4];
403 swprintf_s(str, 4, L"%.3s", g_HUD.GetEditBox(IDC_AGE)->GetText());
404 if (str[0]) // not blank
405 {
406 const int val = _wtoi(str);
407 int newval = RiseMath::Min((int)80, val);
408 newval = RiseMath::Max((int)18, newval);
409 swprintf_s(str, 4, L"%i", newval);
411 age = (static_cast<float>(newval) - 18.0f) / 62.0f;
412 }
413 }
414
415#pragma region Set Access
416 // snapshot
418 _wtoi(g_HUD.GetEditBox(IDC_AGE)->GetText()) >= 18 && _wtoi(g_HUD.GetEditBox(IDC_AGE)->GetText()) <= 80 &&
420 weightRange.Contains(_wtoi(g_HUD.GetEditBox(IDC_WEIGHT)->GetText())) &&
422 !pBuffer)
424 else
426
427 // void snapshot
430 else
432
433 // Sex
434 if (pBuffer ||
437 {
440 }
441 else
442 {
443 if (player[ourplayerC].sex)
444 {
447
450 }
451 else
452 {
455 }
456 }
457
458 // want to let them set it on create or if it somehow was removed
461 else
463
464 // Character Name and Suggest
466 !g_HUD.GetButton(IDC_CONFIRM)->GetEnabled() || charnameValid == 1) // charnameValid==1 means we are checking, please wait
467 {
469 }
470 else if (player[ourplayerC].characterName[0])
471 {
474 WCHAR str[99];
475 swprintf_s(str, 99, L"%S", player[ourplayerC].characterName);
478 }
479 else
480 {
483 }
484
485 // Handle
486 if (!g_HUD.GetButton(IDC_CONFIRM)->GetEnabled() || handleValid == 1) // handleValid==1 means it is checking
487 {
489 }
490 else if (player[ourplayerC].callsign[0])
491 {
493 WCHAR str[99];
494 swprintf_s(str, 99, L"%S", player[ourplayerC].callsign);
496 }
497 else
498 {
500 }
501
502 // passwords
504 {
507 }
508 else
509 {
512 }
513
514 // Don't let them change referral, need to bring over the wire to populate this
516 {
518 }
519 else if (player[ourplayerC].referrer[0])
520 {
522 WCHAR str[99];
523 swprintf_s(str, 99, L"%S", player[ourplayerC].referrer);
525 }
526 else
528
529 // Emphasis
530 //g_HUD.GetComboBox(IDC_EMPHASIS)->SetEnabled(false);
531
532 // age
534 {
536 }
537 else if (player[ourplayerC].age)
538 {
540 WCHAR str[99];
541 swprintf_s(str, 99, L"%i", player[ourplayerC].age);
543 age = (static_cast<float>(player[ourplayerC].age) - 18.0f) / 62.0f;
544 }
545 else
546 {
548 }
549
550 // height
552 {
554 }
555 else if (player[ourplayerC].heightCm)
556 {
558 WCHAR str[99];
559 swprintf_s(str, 99, L"%i", player[ourplayerC].heightCm);
561 }
562 else
563 {
565 }
566
567 // weight
568 if (pBuffer ||
570 {
572 }
573 else if (player[ourplayerC].weightKg && !player[ourplayerC].revisitImmigration)
574 {
576 WCHAR str[99];
577 swprintf_s(str, 99, L"%i", player[ourplayerC].weightKg);
579 }
580 else
581 {
583 }
584
585 // Email is independent of the avatar snapshot, but freezes during submission.
589 if (emailValidation.Expire(GetTickCount64()))
590 MessageBoxW(Rendering::ClientWindow(), L"Email validation is temporarily unavailable. Please try again.",
591 strings[L_MESSAGE_EMAIL].c_str(), MB_ICONEXCLAMATION | MB_OK);
592
593 // hair color
594 if (pBuffer ||
596 {
598 }
599 else if (player[ourplayerC].haircolor && !player[ourplayerC].revisitImmigration)
600 {
604 }
605 else
606 {
608 }
609
610 // eye color
611 if (pBuffer ||
613 {
615 }
616 else if (player[ourplayerC].eyecolor && !player[ourplayerC].revisitImmigration)
617 {
621 }
622 else
623 {
625 }
626
627 // Base skin color (hemoglobin) remains locked after creation.
628 if (pBuffer ||
630 {
632 }
633 else if (player[ourplayerC].skincolor)
634 {
637 }
638 else
639 {
641 }
642
643 // Melanin may change at an annual revisit.
644 if (pBuffer ||
646 {
648 }
649 else if (player[ourplayerC].skintone && !player[ourplayerC].revisitImmigration)
650 {
653 }
654 else
655 {
657 }
658
659 // stubble/freckle
660 if (pBuffer ||
662 {
664 }
665 else if (player[ourplayerC].stubbleFreckle != -1 && !player[ourplayerC].revisitImmigration)
666 {
669 }
670 else
671 {
673 }
674
675 // vision
677 {
681 }
682 else if (player[ourplayerC].vision > 0 && player[ourplayerC].vision < 4 && !player[ourplayerC].revisitImmigration)
683 {
687
688 if (player[ourplayerC].vision == 1) // normal
689 {
692
693 }
694 else if (player[ourplayerC].vision == 2) // implants
695 {
698 }
699 else if (player[ourplayerC].vision == 3) // frames
700 {
702 //g_HUD.GetSlider(IDC_FRAMETYPE)->SetVisible(true); // Sligo noticed you can't actually adjust this on 8/11/2025 so it is set invisible until we add more! Two spots
703 }
704 }
705 else
706 {
710 }
711
712 // frames slider
713 if (pBuffer ||
716 {
718 }
719 else if (player[ourplayerC].framegroup && !player[ourplayerC].revisitImmigration)
720 {
723 }
724 else
725 {
727 }
728
729 // head
730 if (pBuffer ||
732 {
734 }
735 else if (player[ourplayerC].headgroup)
736 {
739 }
740 else
741 {
743 }
744
745 // nose
746 if (pBuffer ||
748 {
750 }
751 else if (player[ourplayerC].nosegroup && !player[ourplayerC].revisitImmigration)
752 {
755 }
756 else
757 {
759 }
760
761 // hairstyle
762 if (pBuffer ||
764 {
766 }
767 else if (player[ourplayerC].hairgroup && !player[ourplayerC].revisitImmigration)
768 {
771 }
772 else
773 {
775 }
776
777 // jawline
778 if (pBuffer ||
780 {
782 }
783 else if (player[ourplayerC].jawline)
784 {
787 }
788 else
789 {
791 }
792
793 // ears
794 if (pBuffer ||
796 {
798 }
799 else if (player[ourplayerC].eargroup)
800 {
803 }
804 else
805 {
807 }
808
809 // feature
810 if (pBuffer ||
812 {
814 }
815 else if (player[ourplayerC].facialhair && !player[ourplayerC].revisitImmigration)
816 {
819 }
820 else
821 {
823 }
824#pragma endregion
825
826#pragma region Validators
827 int newfocus = -1;
829 newfocus = IDC_HANDLE;
831 newfocus = IDC_REFERRAL;
833 newfocus = IDC_CHARNAME;
835 newfocus = IDC_EMAILADDRESS;
836 if (oldfocus != newfocus)
837 {
838 if (oldfocus == IDC_HANDLE)
839 {
840 // fire validator
841 SPacketBig datapacket = SPacketBig();
842 datapacket.type = 24;
843 sprintf_s(datapacket.msg, sizeof(datapacket.msg), "%S", g_HUD.GetEditBox(IDC_HANDLE)->GetText());
844 datapacket.array = 0;
845 if (datapacket.msg[0])
846 {
847 networking->SendToServer(&datapacket, sizeof(SPacketBig), true);
848 txbuffer += sizeof(SPacketBig);
849 handleValid = 1; // checking
850 }
851 }
852 else if (oldfocus == IDC_REFERRAL)
853 {
854 // fire validator2
855 SPacketBig datapacket = SPacketBig();
856 datapacket.type = 24;
857 sprintf_s(datapacket.msg, sizeof(datapacket.msg), "%S", g_HUD.GetEditBox(IDC_REFERRAL)->GetText());
858 datapacket.array = 1;
859 if (datapacket.msg[0])
860 {
861 networking->SendToServer(&datapacket, sizeof(SPacketBig), true);
862 txbuffer += sizeof(SPacketBig);
863 referralValid = 1; // checking
864 }
865 else
866 referralValid = 2; // blank is ok
867 }
868 else if (oldfocus == IDC_CHARNAME)
869 {
870 // fire validator
871 SPacketBig datapacket = SPacketBig();
872 datapacket.type = 24;
873 sprintf_s(datapacket.msg, sizeof(datapacket.msg), "%S", g_HUD.GetEditBox(IDC_CHARNAME)->GetText());
874 datapacket.array = 2;
875 if (datapacket.msg[0])
876 {
877 networking->SendToServer(&datapacket, sizeof(SPacketBig), true);
878 txbuffer += sizeof(SPacketBig);
879 charnameValid = 1; // checking
880 }
881 }
882 else if (oldfocus == IDC_EMAILADDRESS)
884 oldfocus = newfocus;
885 }
886#pragma endregion
887 }
888 break;
889#pragma endregion
890#pragma region STATUS_LOADING
892 {
893 // Initialize dialogs (HMI::OnFrameMove only calls once?)
894 logger->Log("Special OnFrameMove(STATUS_LOADING) called!");
895 //No longer needed because we are only doing full-screen otherwise we have to call
896 // something to lose and reset the device
897 // SetWindowLong(Rendering::ClientWindow(), GWL_STYLE, WS_MINIMIZEBOX | WS_SYSMENU | WS_CAPTION | WS_OVERLAPPED);
898 }
899 break;
900#pragma endregion
901#pragma region STATUS_GAME
903
904 GetCursorPos(&ptCursor);
906 ptCursor.x = static_cast<LONG>(ptCursor.x / game->displayscale);
907 ptCursor.y = static_cast<LONG>(ptCursor.y / game->displayscale);
908
909 if (abs(ptCursor.x - oldptCursor.x) > 2 ||
910 abs(ptCursor.y - oldptCursor.y) > 2)
913
914
915 g_fMouseLastMoveTime += fElapsedTime;
916 if (g_bLeftDown)
917 {
918 g_fLeftDownTime += fElapsedTime * 2.0f;
919 if (g_fLeftDownTime > 20.0f)
920 g_fLeftDownTime = 20.0f;
921 g_fDownCounterTime += g_fLeftDownTime * fElapsedTime;
922 }
923 else
924 g_fDownCounterTime = 0.0f;
925
926 if (g_bDragging ||
927 (g_bLeftDown && ((abs(ptClick.x - ptCursor.x) > 2 || abs(ptClick.y - ptCursor.y) > 2) && cursoroverwindow > -1))) // moved so we are dragging
928 g_bDragging = true;
929 else
930 g_bDragging = false;
931
932 // these are things like animations and etc that don't matter first layer hit
933 g_fTabFlashTime += fElapsedTime;
934 if (g_fTabFlashTime > 0.5f)
935 {
936 g_fTabFlashTime = 0.0f;
938 }
939
940 helpboxlang = -1;
941
942
943 ApplyDefaultDialogLayout(false); // First game frame has the actual viewport, not the login window.
944 DialogBase::UpdateAllActiveDialogs(fElapsedTime); // calls "Update" not "FrameMove" or "UpdateMenu"
945 informationDialog->FrameMove(fElapsedTime);
946 // 0000702: Sort not continuously updating
948
949
950 // slide up slide away 0 to 32 pixels bottom menu chits
951 if (!autoHideChits ||
953 (ptCursor.y >= static_cast<long>(game->displayHeight / game->displayscale - (32.0f - m_fSlide)) &&
954 ptCursor.x >= 0 && ptCursor.x < static_cast<long>(game->displayWidth / game->displayscale)))
955 {
956 // slide in (starts at 27 to 0) so 16*20 320 to 1*20 20 per second
957 m_fSlide -= powf(m_fSlide / 27.0f + 1.0f, 4.0f) * fElapsedTime * 20.0f;
958 if (m_fSlide < 0.0f)
959 m_fSlide = 0.0f;
960 }
961 else
962 { // want it to be 3
963 m_fSlide += powf((27.0f - m_fSlide) / 27.0f + 1.0f, 4.0f) * fElapsedTime * 20.0f;
964 if (g_fMouseLastMoveTime > 5.0f)
965 {
966 if (m_fSlide > 32.0f)
967 m_fSlide = 32.0f;
968 }
969 else
970 {
971 if (m_fSlide > 27.0f)
972 m_fSlide = 27.0f;
973 }
974 }
975
976 cursoroverwindow = -1;
977
978 for (short t = 0; t < (D_ENUMERATION + 1); t++) // bottom bar
979 {
980 // bottom bar
981 if (ptCursor.x >= icon[t].iconlocation.x && ptCursor.x < (icon[t].iconlocation.x + 32) &&
982 ptCursor.y >= (game->displayHeight / game->displayscale - 32 + m_fSlide) && ptCursor.y <= static_cast<long>(game->displayHeight / game->displayscale))
983 {
984 if (!icon[t].mouseover)
985 {
986 icon[t].mouseover = true;
987 if (icon[t].dialog < 0 || DialogBase::dialogs[icon[t].dialog]->enabled)
989 }
990 cursoroverwindow = -2;
991 }
992 else
993 icon[t].mouseover = false;
994 if (icon[t].mouseover && g_bLeftClick && !g_bDragging)
995 {
997 }
998 }
999
1000 // actual windows (dialogs)
1001 // my theory here is that we go through all the items (iconlocation, windowlocation) in order of their
1002 // depth and see if there is a mouse over, mouse click, mouse drag, etc...
1003
1004 //Check if the mouse is in one of the dialogs and handle it
1006
1007 //MARTY's MARKER !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1008
1009 // catchall
1011 if (!g_bDragging && !g_bLeftDown)
1012 {
1013 dragt = -1;
1014 dragline = -1;
1015 }
1016
1017 // DialogBase::SortDialogs();
1018
1019 if (grippy)
1020 {
1021 SetCursor(LoadCursor(nullptr, IDC_SIZENWSE));
1022 currentCursor = IDC_SIZENWSE;
1023 }
1024
1025 if (g_fMouseLastMoveTime > 5.0f)
1026 {
1027 if (cursorVisible)
1028 {
1029 ShowCursor(false);
1030 cursorVisible = false;
1031 }
1032 }
1033 else if (!cursorVisible)
1034 {
1035 ShowCursor(true);
1036 cursorVisible = true;
1037 }
1038
1039
1040 break;
1041#pragma endregion
1042 }
1043
1044 logger->AddToCallStack("HMI::OnFrameMove DONE");
1045}
1046
1048{
1050 game->UpdateTrackedResource("externalCameraOverlay.labelFont", 2);
1051 game->UpdateTrackedResource("externalCameraOverlay.valueFont", 2);
1053 game->UpdateTrackedResource("keyboardChart.font", 2);
1054 char msg[99];
1055 sprintf_s(msg, sizeof(msg), "HMI::OnResetDevice() @ displaystage=%i", game->displaystage);
1056 logger->Log(msg);
1057 logger->AddToCallStack(msg);
1058
1059 logger->AddToCallStack("HMI::OnResetDevice() g_pTextSprite");
1060 if (g_pTextSprite)
1061 {
1063 game->UpdateTrackedResource("g_pTextSprite", 2);
1064 }
1065
1066 logger->Log("HMI::OnResetDevice() g_DialogResourceManager");
1067 logger->AddToCallStack("HMI::OnResetDevice() g_DialogResourceManager");
1069 game->UpdateTrackedResource("g_DialogResourceManager", 2);
1070
1071 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1073 {
1074 logger->Log("HMI::OnResetDevice() g_pFont");
1075 logger->AddToCallStack("HMI::OnResetDevice() g_pFont");
1076 if (g_pFont)
1077 {
1079 game->UpdateTrackedResource("g_pFont", 2);
1080 }
1081 logger->Log("HMI::OnResetDevice() g_pChatFont");
1082 logger->AddToCallStack("HMI::OnResetDevice() g_pChatFont");
1083 if (g_pChatFont)
1084 {
1086 game->UpdateTrackedResource("g_pChatFont", 2);
1087 }
1088 logger->Log("HMI::OnResetDevice() g_pSubtitleFont");
1089 logger->AddToCallStack("HMI::OnResetDevice() g_pSubtitleFont");
1090 if (g_pSubtitleFont)
1091 {
1093 game->UpdateTrackedResource("g_pSubtitleFont", 2);
1094 }
1095
1096 logger->Log("HMI::OnResetDevice() OnDeviceReset");
1097 logger->AddToCallStack("HMI::OnResetDevice() OnDeviceReset");
1099 }
1100
1101 logger->Log("HMI::OnResetDevice() done!");
1102 logger->AddToCallStack("HMI::OnResetDevice() done!");
1103}
1104
1105bool HMI::MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
1106{
1107 logger->AddToCallStack("HMI::MsgProc");
1108#ifdef ChatEnter
1109 const bool traceEnter = HudDiagnostics::IsEnterMessage(uMsg, wParam);
1110#endif
1111
1112 // Always allow dialog resource manager calls to handle global messages
1113 // so GUI state is updated correctly
1114
1115 // If you look at this function it just returns false!
1116// bool pbNoFurtherProcessing = g_DialogResourceManager.MsgProc( hWnd, uMsg, wParam, lParam );
1117 // if( pbNoFurtherProcessing )
1118 // return true;
1119
1121 {
1122 for (short t = 0; t < D_ENUMERATION; t++)
1123 {
1124 if (DialogBase::dialogs[t] && DialogBase::dialogs[t]->active && DialogBase::dialogs[t]->usesHUD)
1125 {
1126 if (cursoroverwindow == t || cursoroverwindow == -1 || t == D_COMMUNICATIONS || t == D_INTERMEDIA) // always process communications because of global chat
1127 {
1128#ifdef ChatEnter
1129 if (traceEnter)
1130 HudDiagnostics::LogChatInput(*this, "offered to dialog HUD", t);
1131#endif
1132 if (DialogBase::dialogs[t]->HUD.MsgProc(hWnd, uMsg, wParam, lParam))
1133 {
1134#ifdef ChatEnter
1135 if (traceEnter)
1136 HudDiagnostics::LogChatInput(*this, "consumed by dialog HUD", t);
1137#endif
1138 return true;
1139 }
1140 }
1141 }
1142 }
1143 }
1144
1145 logger->AddToCallStack("HMI::MsgProc (Past Dialog Iteration)");
1146
1147 if (uMsg == WM_CHAR)
1148 {
1149 if (LOWORD(wParam) == VK_RETURN && game->displaystage == GameState::STATUS_GAME)
1150 {
1151 if (DialogBase::OnEnter())
1152 {
1153#ifdef ChatEnter
1154 HudDiagnostics::LogChatInput(*this, "handled by global OnEnter");
1155#endif
1156 return true;
1157 }
1158#ifdef ChatEnter
1159 HudDiagnostics::LogChatInput(*this, "global OnEnter declined");
1160#endif
1161 }
1162 }
1163
1164 logger->AddToCallStack("HMI::MsgProc (Past WM_CHAR Handler)");
1165
1166 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
1167 switch (uMsg)
1168 {
1169 case WM_LBUTTONDBLCLK:
1170 g_bLeftDouble = true;
1171 break;
1172 case WM_LBUTTONDOWN:
1173 g_bLeftDown = true;
1174 g_bLeftClick = true;
1175 ptClick = ptCursor;
1176 g_fLeftDownTime = 5.0f;
1177 g_fDownCounterTime = 0.0f;
1178 break;
1179 case WM_LBUTTONUP:
1180 if (g_bDragging)
1181 g_bDropped = true;
1182 g_bLeftDown = false;
1183 g_bDragging = false;
1184 break;
1185 case WM_MOUSEWHEEL:
1186 if (cursoroverwindow > -1)
1187 {
1188 DialogBase::dialogs[cursoroverwindow]->linetop -= GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
1195 //else if (cursoroverwindow == D_MESSAGECENTER)
1196 // DialogBase::dialogs[cursoroverwindow]->UpdateMenu(-1);
1199 if (DialogBase::dialogs[cursoroverwindow]->allowscroll)
1202 }
1203 else// if (player[ourplayerC].frame == REF_INANOTHER) // only in vehicles
1204 {
1205 game->viewscreen->targetZoom = Clamp(game->viewscreen->targetZoom + static_cast<float>(GET_WHEEL_DELTA_WPARAM(wParam)) * 0.001f, 1, 2);
1206 }
1207 break;
1208 }
1209
1210 logger->AddToCallStack("HMI::MsgProc (Past uMsg Switch)");
1211
1212 return false;
1213}
1214
1216{
1217 if (player[ourplayerC].sex == 1)
1218 {
1219 game->sound->LoadCockpitSound(SOUND_PEOPLEGRUNT1, "Sounds\\People\\pain1.wav", false, &game->config.soundConfigLegacy);
1220 game->sound->LoadCockpitSound(SOUND_PEOPLEGRUNT2, "Sounds\\People\\pain2.wav", false, &game->config.soundConfigLegacy);
1221 game->sound->LoadCockpitSound(SOUND_PEOPLEGRUNT3, "Sounds\\People\\pain3.wav", false, &game->config.soundConfigLegacy);
1222 }
1223 else
1224 {
1225 game->sound->LoadCockpitSound(SOUND_PEOPLEGRUNT1, "Sounds\\People\\femalepain1.wav", false, &game->config.soundConfigLegacy);
1226 game->sound->LoadCockpitSound(SOUND_PEOPLEGRUNT2, "Sounds\\People\\femalepain2.wav", false, &game->config.soundConfigLegacy);
1227 game->sound->LoadCockpitSound(SOUND_PEOPLEGRUNT3, "Sounds\\People\\femalepain3.wav", false, &game->config.soundConfigLegacy);
1228 }
1229}
1230
1232{
1233 HRESULT hr;
1234
1237
1239 game->AddTrackedResource("g_DialogResourceManager", Rendering::ResourcePool::Device);
1240
1241 // Initialize the fonts
1242 V_RETURN(Rendering::CreateFontW(pd3dDevice, 12, 6, FW_LIGHT, 1, false, DEFAULT_CHARSET,
1243 OUT_TT_ONLY_PRECIS, ANTIALIASED_QUALITY, FIXED_PITCH | FF_DONTCARE,
1244 L"DejaVu Sans Mono", &g_pFont));
1246
1247 V_RETURN(Rendering::CreateFontW(pd3dDevice, 16, 6, FW_LIGHT, 1, false, DEFAULT_CHARSET,
1248 OUT_TT_ONLY_PRECIS, ANTIALIASED_QUALITY, FIXED_PITCH | FF_DONTCARE,
1249 L"DejaVu Sans Mono", &g_pChatFont));
1251
1252 V_RETURN(Rendering::CreateFontW(pd3dDevice, 30, 24, FW_LIGHT, 1, false, DEFAULT_CHARSET,
1253 OUT_TT_ONLY_PRECIS, ANTIALIASED_QUALITY, FIXED_PITCH | FF_DONTCARE,
1254 L"Arial Narrow", &g_pSubtitleFont));
1257 game->AddTrackedResource("externalCameraOverlay.labelFont", Rendering::ResourcePool::Device);
1258 game->AddTrackedResource("externalCameraOverlay.valueFont", Rendering::ResourcePool::Device);
1261 game->AddTrackedResource("keyboardChart.blankKeyboard");
1262
1264 {
1265 logger->Log("OnCreateDevice called with displaystage between LOGIN and LOADING", Logger::Level::Debug);
1266 constexpr short preloadedTextureStages = 20;
1267 for (short i = 0; i < preloadedTextureStages; i++)
1269 if (game->displaystage == GameState::STATUS_LOGIN && game->loadstage < preloadedTextureStages)
1270 game->loadstage = preloadedTextureStages;
1271 }
1273 {
1274 logger->Log("OnCreateDevice called with displaystage GAME", Logger::Level::Debug);
1276 }
1277
1278 return S_OK;
1279}
1280
1302
1303void HMI::AddToast(const WCHAR* message, ActiveHelp activeHelp)
1304{
1305 if (toasts.size() >= 10)
1306 {
1307 logger->Log("Somehow they are trying to show more than 10 toasts!", Logger::Level::Debug);
1308 return;
1309 }
1310
1311 HRESULT hr;
1312 Toast newToast;
1313
1314 size_t startOfLine = 0;
1315 size_t lastGoodSpaceIndex = 0;
1316 for (size_t i = 0; i < wcslen(message) - startOfLine; i++)
1317 {
1318 size_t i1 = wcslen(message) - startOfLine - 1;
1319 // taking substring from startOfLine for X characters
1320 WCHAR tempStr[510];
1321 wcscpy_s(tempStr, 510, &message[startOfLine]);
1322 // truncate
1323 tempStr[i + 1] = 0;
1324 // render and calculate
1325 RECT rect = RECT();
1326 try
1327 {
1328 V(game->GUI->g_pFont->DrawTextW(game->GUI->g_pTextSprite, tempStr, -1, &rect, DT_CALCRECT, 0xFFFFFFFF));
1329 }
1330 catch (...)
1331 {
1332 // apparently we get an exception trying to calculate "\n "?
1333 }
1334 // evaluate
1335 if (rect.right < 147 && i != i1)
1336 {
1337 if (tempStr[i] == L' ' || tempStr[i] == L'\xff01' || tempStr[i] == L'\x3002' || tempStr[i] == L'\xff0c')
1338 lastGoodSpaceIndex = i;
1339 }
1340 else
1341 {
1342 // back up to lastGoodSpaceIndex and push
1343 if (lastGoodSpaceIndex != 0 && i != i1)
1344 {
1345 if (tempStr[lastGoodSpaceIndex] == L' ')
1346 tempStr[lastGoodSpaceIndex] = 0;
1347 else
1348 tempStr[lastGoodSpaceIndex + 1] = 0;
1349 }
1350 newToast.text.emplace_back(tempStr);
1351 if (i == i1)
1352 break;
1353 if (lastGoodSpaceIndex != 0)
1354 startOfLine += lastGoodSpaceIndex + 1;
1355 else
1356 startOfLine += wcslen(tempStr) + 1;
1357 i = 0;
1358 lastGoodSpaceIndex = 0;
1359 }
1360 }
1361
1362 // so if it is 1 then it should be at line 2 ... 2 is at 1.5 ... 3 is at 1 ... 4 is at 0.5 ... 5 is at 0
1363 newToast.y = (5 - newToast.text.size()) * 6;
1364 newToast.time = 10.0f;
1365 newToast.id = activeHelp;
1366 switch (newToast.id)
1367 {
1376 newToast.icon = 13; // information
1377 break;
1380 {
1381 Command command;
1382 command.name = "AuralCargoBay";
1383 game->bus->commandStream.emplace_back(command);
1385 newToast.icon = 13; // information
1386 }
1387 break;
1391 newToast.icon = 12; // scanner
1392 break;
1408 newToast.icon = 11; // construction
1409 break;
1412 newToast.icon = 9; // news flash
1413 break;
1417 newToast.icon = 7; // repair
1418 break;
1420 sound->Play(SOUND_NEWMSG); // @todo new sound
1421 newToast.icon = 6; // car
1422 break;
1424 case ActiveHelp::LoadedCargo: // @todo could be commodity icon
1425 case ActiveHelp::UnloadedCargo: // @todo could be commodity icon
1426 sound->Play(SOUND_NEWMSG); // @todo new sound
1427 newToast.icon = 5; // container
1428 break;
1484 newToast.icon = 4; // success
1485 break;
1493 newToast.icon = 14; // fuel
1494 break;
1499 newToast.icon = 10; // gold star
1500 break;
1502 sound->Play(SOUND_SUCCESS); // @todo could do "ahhhh" sound
1503 newToast.icon = 8; // healing
1504 break;
1507 newToast.icon = 3; // passenger
1508 break;
1514 newToast.icon = 3; // passenger
1515 break;
1521 newToast.icon = 2; // contract
1522 break;
1531 newToast.icon = 1; // cha-ching
1532 break;
1535 newToast.icon = 0; // caution
1536 break;
1537 default:
1539 newToast.icon = 0; // caution
1540 break;
1541 }
1542
1543 toasts.emplace_back(newToast);
1544}
1545
1547{
1548 // need to clear it
1549 HUD->GetComboBox(controlId)->RemoveAllItems();
1550 HUD->GetComboBox(controlId)->AddItem(L"", nullptr); // 0
1551
1552 if (HUD->GetRadioButton(IDC_MALE)->GetChecked())
1553 {
1554 // need to add all the voices for the sex selected
1555 HUD->GetComboBox(controlId)->AddItem(L"Daniel", nullptr); // 1
1556 HUD->GetComboBox(controlId)->AddItem(L"Dave", nullptr);
1557 HUD->GetComboBox(controlId)->AddItem(L"Kerem", nullptr);
1558 HUD->GetComboBox(controlId)->AddItem(L"Simon", nullptr);
1559 HUD->GetComboBox(controlId)->AddItem(L"Steven", nullptr);
1560 HUD->GetComboBox(controlId)->AddItem(L"Tom", nullptr);
1561 HUD->GetComboBox(controlId)->AddItem(L"Heinz", nullptr);
1562 HUD->GetComboBox(controlId)->AddItem(L"Prashant", nullptr);
1563 HUD->GetComboBox(controlId)->AddItem(L"Antoine", nullptr);
1564 HUD->GetComboBox(controlId)->AddItem(L"Tiago", nullptr);
1565 HUD->GetComboBox(controlId)->AddItem(L"Chia-hao", nullptr);
1566 HUD->GetComboBox(controlId)->AddItem(L"Chan", nullptr);
1567 HUD->GetComboBox(controlId)->AddItem(L"Kaito", nullptr);
1568 HUD->GetComboBox(controlId)->AddItem(L"Karan", nullptr);
1569 HUD->GetComboBox(controlId)->AddItem(L"Gaspard", nullptr);
1570 HUD->GetComboBox(controlId)->AddItem(L"Datu", nullptr);
1571 HUD->GetComboBox(controlId)->AddItem(L"Allesandro", nullptr);
1572 HUD->GetComboBox(controlId)->AddItem(L"Bintang", nullptr);
1573 HUD->GetComboBox(controlId)->AddItem(L"Giorgos", nullptr);
1574 HUD->GetComboBox(controlId)->AddItem(L"Gustav", nullptr);
1575 HUD->GetComboBox(controlId)->AddItem(L"Dirk", nullptr);
1576 HUD->GetComboBox(controlId)->AddItem(L"Wojciech", nullptr);
1577 HUD->GetComboBox(controlId)->AddItem(L"Eymen", nullptr);
1578 HUD->GetComboBox(controlId)->AddItem(L"Erik", nullptr);
1579 HUD->GetComboBox(controlId)->AddItem(L"Lars", nullptr);
1580 HUD->GetComboBox(controlId)->AddItem(L"Phuong", nullptr);
1581 HUD->GetComboBox(controlId)->AddItem(L"Oliver", nullptr);
1582 HUD->GetComboBox(controlId)->AddItem(L"Jamil", nullptr);
1583 HUD->GetComboBox(controlId)->AddItem(L"Laszlo", nullptr);
1584 HUD->GetComboBox(controlId)->AddItem(L"Rafael", nullptr);
1585 HUD->GetComboBox(controlId)->AddItem(L"Paul", nullptr);
1586 HUD->GetComboBox(controlId)->AddItem(L"Hugh", nullptr);
1587 HUD->GetComboBox(controlId)->AddItem(L"Francisco", nullptr);
1588 HUD->GetComboBox(controlId)->AddItem(L"Leo", nullptr);
1589 HUD->GetComboBox(controlId)->AddItem(L"Liang", nullptr);
1590 HUD->GetComboBox(controlId)->AddItem(L"Qiang", nullptr);
1591 HUD->GetComboBox(controlId)->AddItem(L"Kaho", nullptr);
1592 HUD->GetComboBox(controlId)->AddItem(L"Show", nullptr);
1593 HUD->GetComboBox(controlId)->AddItem(L"Junwoo", nullptr);
1594 HUD->GetComboBox(controlId)->AddItem(L"Sarawut", nullptr);
1595 HUD->GetComboBox(controlId)->AddItem(L"Manuel", nullptr);
1596 HUD->GetComboBox(controlId)->AddItem(L"Tim", nullptr);
1597 HUD->GetComboBox(controlId)->AddItem(L"Louis", nullptr);
1598 HUD->GetComboBox(controlId)->AddItem(L"Roberto", nullptr);
1599 HUD->GetComboBox(controlId)->AddItem(L"Ryo", nullptr);
1600 HUD->GetComboBox(controlId)->AddItem(L"Takeru", nullptr);
1601 HUD->GetComboBox(controlId)->AddItem(L"Jihun", nullptr);
1602 HUD->GetComboBox(controlId)->AddItem(L"Jamal", nullptr);
1603 HUD->GetComboBox(controlId)->AddItem(L"Maged", nullptr);
1604 HUD->GetComboBox(controlId)->AddItem(L"Tarik", nullptr);
1605 HUD->GetComboBox(controlId)->AddItem(L"Jordi", nullptr);
1606 HUD->GetComboBox(controlId)->AddItem(L"Magnus", nullptr);
1607 HUD->GetComboBox(controlId)->AddItem(L"Willem", nullptr);
1608 HUD->GetComboBox(controlId)->AddItem(L"Xander", nullptr);
1609 HUD->GetComboBox(controlId)->AddItem(L"Ludoviko", nullptr);
1610 HUD->GetComboBox(controlId)->AddItem(L"Marko", nullptr);
1611 HUD->GetComboBox(controlId)->AddItem(L"Mikko", nullptr);
1612 HUD->GetComboBox(controlId)->AddItem(L"Bernard", nullptr);
1613 HUD->GetComboBox(controlId)->AddItem(L"Felix", nullptr);
1614 HUD->GetComboBox(controlId)->AddItem(L"Olivier", nullptr);
1615 HUD->GetComboBox(controlId)->AddItem(L"Sebastien", nullptr);
1616 HUD->GetComboBox(controlId)->AddItem(L"Thomas", nullptr);
1617 HUD->GetComboBox(controlId)->AddItem(L"Stefan", nullptr);
1618 HUD->GetComboBox(controlId)->AddItem(L"Yannick", nullptr);
1619 HUD->GetComboBox(controlId)->AddItem(L"Alexandros", nullptr);
1620 HUD->GetComboBox(controlId)->AddItem(L"Nikos", nullptr);
1621 HUD->GetComboBox(controlId)->AddItem(L"Luca", nullptr);
1622 HUD->GetComboBox(controlId)->AddItem(L"Marcello", nullptr);
1623 HUD->GetComboBox(controlId)->AddItem(L"Matteo", nullptr);
1624 HUD->GetComboBox(controlId)->AddItem(L"Paolo", nullptr);
1625 HUD->GetComboBox(controlId)->AddItem(L"Raffaele", nullptr);
1626 HUD->GetComboBox(controlId)->AddItem(L"Henrik", nullptr);
1627 HUD->GetComboBox(controlId)->AddItem(L"Krzysztof", nullptr);
1628 HUD->GetComboBox(controlId)->AddItem(L"Dmitri", nullptr);
1629 HUD->GetComboBox(controlId)->AddItem(L"Carlos", nullptr);
1630 HUD->GetComboBox(controlId)->AddItem(L"Diego", nullptr);
1631 HUD->GetComboBox(controlId)->AddItem(L"Duardo", nullptr);
1632 HUD->GetComboBox(controlId)->AddItem(L"Javier", nullptr);
1633 HUD->GetComboBox(controlId)->AddItem(L"Jorge", nullptr);
1634 HUD->GetComboBox(controlId)->AddItem(L"Juan", nullptr);
1635 HUD->GetComboBox(controlId)->AddItem(L"Oskar", nullptr);
1636 HUD->GetComboBox(controlId)->AddItem(L"Sven", nullptr);
1637 HUD->GetComboBox(controlId)->AddItem(L"Alan", nullptr);
1638
1639 HUD->GetComboBox(IDC_VOICE)->SetDropHeight(RiseMath::Min(35, HUD->GetComboBox(IDC_VOICE)->GetNumItems()) * 14, static_cast<int>(14.0f * game->displayscale));
1640 }
1641 else if (HUD->GetRadioButton(IDC_FEMALE)->GetChecked())
1642 {
1643 // need to add all the voices for the sex selected
1644 HUD->GetComboBox(controlId)->AddItem(L"Elizabeth", nullptr); // 101
1645 HUD->GetComboBox(controlId)->AddItem(L"Fiona", nullptr);
1646 HUD->GetComboBox(controlId)->AddItem(L"Grace", nullptr);
1647 HUD->GetComboBox(controlId)->AddItem(L"Jill", nullptr);
1648 HUD->GetComboBox(controlId)->AddItem(L"Karen", nullptr);
1649 HUD->GetComboBox(controlId)->AddItem(L"Moira", nullptr);
1650 HUD->GetComboBox(controlId)->AddItem(L"Samantha", nullptr);
1651 HUD->GetComboBox(controlId)->AddItem(L"Sangeeta", nullptr);
1652 HUD->GetComboBox(controlId)->AddItem(L"Hilda", nullptr);
1653 HUD->GetComboBox(controlId)->AddItem(L"Beatrice", nullptr);
1654 HUD->GetComboBox(controlId)->AddItem(L"Eliska", nullptr);
1655 HUD->GetComboBox(controlId)->AddItem(L"Vira", nullptr);
1656 HUD->GetComboBox(controlId)->AddItem(L"Nguyet", nullptr);
1657 HUD->GetComboBox(controlId)->AddItem(L"Olivia", nullptr);
1658 HUD->GetComboBox(controlId)->AddItem(L"Matilda", nullptr);
1659 HUD->GetComboBox(controlId)->AddItem(L"Leoni", nullptr);
1660 HUD->GetComboBox(controlId)->AddItem(L"Ana", nullptr);
1661 HUD->GetComboBox(controlId)->AddItem(L"Bianca", nullptr);
1662 HUD->GetComboBox(controlId)->AddItem(L"Himari", nullptr);
1663 HUD->GetComboBox(controlId)->AddItem(L"Lakshmi", nullptr);
1664 HUD->GetComboBox(controlId)->AddItem(L"Putri", nullptr);
1665 HUD->GetComboBox(controlId)->AddItem(L"Eleni", nullptr);
1666 HUD->GetComboBox(controlId)->AddItem(L"Astrid", nullptr);
1667 HUD->GetComboBox(controlId)->AddItem(L"Chai-ling", nullptr);
1668 HUD->GetComboBox(controlId)->AddItem(L"Yan", nullptr);
1669 HUD->GetComboBox(controlId)->AddItem(L"Famke", nullptr);
1670 HUD->GetComboBox(controlId)->AddItem(L"Danota", nullptr);
1671 HUD->GetComboBox(controlId)->AddItem(L"Leonar", nullptr);
1672 HUD->GetComboBox(controlId)->AddItem(L"Zehra", nullptr);
1673 HUD->GetComboBox(controlId)->AddItem(L"Flora", nullptr);
1674 HUD->GetComboBox(controlId)->AddItem(L"Dagny", nullptr);
1675 HUD->GetComboBox(controlId)->AddItem(L"Dagrun", nullptr);
1676 HUD->GetComboBox(controlId)->AddItem(L"Pavla", nullptr);
1677 HUD->GetComboBox(controlId)->AddItem(L"Sanna", nullptr);
1678 HUD->GetComboBox(controlId)->AddItem(L"Amina", nullptr);
1679 HUD->GetComboBox(controlId)->AddItem(L"Mayumi", nullptr);
1680 HUD->GetComboBox(controlId)->AddItem(L"Kate", nullptr);
1681 HUD->GetComboBox(controlId)->AddItem(L"Bridget", nullptr);
1682 HUD->GetComboBox(controlId)->AddItem(L"Ashley", nullptr);
1683 HUD->GetComboBox(controlId)->AddItem(L"Beth", nullptr);
1684 HUD->GetComboBox(controlId)->AddItem(L"Violeta", nullptr);
1685 HUD->GetComboBox(controlId)->AddItem(L"Gloria", nullptr);
1686 HUD->GetComboBox(controlId)->AddItem(L"Lola", nullptr);
1687 HUD->GetComboBox(controlId)->AddItem(L"Lena", nullptr);
1688 HUD->GetComboBox(controlId)->AddItem(L"Chloe", nullptr);
1689 HUD->GetComboBox(controlId)->AddItem(L"Roxane", nullptr);
1690 HUD->GetComboBox(controlId)->AddItem(L"Helena", nullptr);
1691 HUD->GetComboBox(controlId)->AddItem(L"Elisa", nullptr);
1692 HUD->GetComboBox(controlId)->AddItem(L"Lily", nullptr);
1693 HUD->GetComboBox(controlId)->AddItem(L"Hui", nullptr);
1694 HUD->GetComboBox(controlId)->AddItem(L"Kayan", nullptr);
1695 HUD->GetComboBox(controlId)->AddItem(L"Yafrang", nullptr);
1696 HUD->GetComboBox(controlId)->AddItem(L"Misaki", nullptr);
1697 HUD->GetComboBox(controlId)->AddItem(L"Sayaka", nullptr);
1698 HUD->GetComboBox(controlId)->AddItem(L"Hikari", nullptr);
1699 HUD->GetComboBox(controlId)->AddItem(L"Haruka", nullptr);
1700 HUD->GetComboBox(controlId)->AddItem(L"Yumi", nullptr);
1701 HUD->GetComboBox(controlId)->AddItem(L"Hyeryun", nullptr);
1702 HUD->GetComboBox(controlId)->AddItem(L"Jimin", nullptr);
1703 HUD->GetComboBox(controlId)->AddItem(L"Sena", nullptr);
1704 HUD->GetComboBox(controlId)->AddItem(L"Hyuna", nullptr);
1705 HUD->GetComboBox(controlId)->AddItem(L"Yura", nullptr);
1706 HUD->GetComboBox(controlId)->AddItem(L"Somsi", nullptr);
1707 HUD->GetComboBox(controlId)->AddItem(L"Sarena", nullptr);
1708 HUD->GetComboBox(controlId)->AddItem(L"Susan", nullptr);
1709 HUD->GetComboBox(controlId)->AddItem(L"Tessa", nullptr);
1710 HUD->GetComboBox(controlId)->AddItem(L"Laila", nullptr);
1711 HUD->GetComboBox(controlId)->AddItem(L"Arantxa", nullptr);
1712 HUD->GetComboBox(controlId)->AddItem(L"Empar", nullptr);
1713 HUD->GetComboBox(controlId)->AddItem(L"Montserrat", nullptr);
1714 HUD->GetComboBox(controlId)->AddItem(L"Nuria", nullptr);
1715 HUD->GetComboBox(controlId)->AddItem(L"Linlin", nullptr);
1716 HUD->GetComboBox(controlId)->AddItem(L"Lisheng", nullptr);
1717 HUD->GetComboBox(controlId)->AddItem(L"Sin-Ji", nullptr);
1718 HUD->GetComboBox(controlId)->AddItem(L"Ting-Ting", nullptr);
1719 HUD->GetComboBox(controlId)->AddItem(L"Ya-Ling", nullptr);
1720 HUD->GetComboBox(controlId)->AddItem(L"Zuzana", nullptr);
1721 HUD->GetComboBox(controlId)->AddItem(L"Frida", nullptr);
1722 HUD->GetComboBox(controlId)->AddItem(L"Ida", nullptr);
1723 HUD->GetComboBox(controlId)->AddItem(L"Claire", nullptr);
1724 HUD->GetComboBox(controlId)->AddItem(L"Ellen", nullptr);
1725 HUD->GetComboBox(controlId)->AddItem(L"Saskia", nullptr);
1726 HUD->GetComboBox(controlId)->AddItem(L"Milla", nullptr);
1727 HUD->GetComboBox(controlId)->AddItem(L"Beatrice", nullptr);
1728 HUD->GetComboBox(controlId)->AddItem(L"Charlotte", nullptr);
1729 HUD->GetComboBox(controlId)->AddItem(L"Florence", nullptr);
1730 HUD->GetComboBox(controlId)->AddItem(L"Jolie", nullptr);
1731 HUD->GetComboBox(controlId)->AddItem(L"Julie", nullptr);
1732 HUD->GetComboBox(controlId)->AddItem(L"Virginie", nullptr);
1733 HUD->GetComboBox(controlId)->AddItem(L"Carmela", nullptr);
1734 HUD->GetComboBox(controlId)->AddItem(L"Anna", nullptr);
1735 HUD->GetComboBox(controlId)->AddItem(L"Hilda", nullptr);
1736 HUD->GetComboBox(controlId)->AddItem(L"Katrin", nullptr);
1737 HUD->GetComboBox(controlId)->AddItem(L"Steffi", nullptr);
1738 HUD->GetComboBox(controlId)->AddItem(L"Afroditi", nullptr);
1739 HUD->GetComboBox(controlId)->AddItem(L"Lekha", nullptr);
1740 HUD->GetComboBox(controlId)->AddItem(L"Eszter", nullptr);
1741 HUD->GetComboBox(controlId)->AddItem(L"Damayanti", nullptr);
1742 HUD->GetComboBox(controlId)->AddItem(L"Federica", nullptr);
1743 HUD->GetComboBox(controlId)->AddItem(L"Giulia", nullptr);
1744 HUD->GetComboBox(controlId)->AddItem(L"Paola", nullptr);
1745 HUD->GetComboBox(controlId)->AddItem(L"Silvana", nullptr);
1746 HUD->GetComboBox(controlId)->AddItem(L"Silvia", nullptr);
1747 HUD->GetComboBox(controlId)->AddItem(L"Valentina", nullptr);
1748 HUD->GetComboBox(controlId)->AddItem(L"Kyoko", nullptr);
1749 HUD->GetComboBox(controlId)->AddItem(L"Narae", nullptr);
1750 HUD->GetComboBox(controlId)->AddItem(L"Stine", nullptr);
1751 HUD->GetComboBox(controlId)->AddItem(L"Vilde", nullptr);
1752 HUD->GetComboBox(controlId)->AddItem(L"Agata", nullptr);
1753 HUD->GetComboBox(controlId)->AddItem(L"Zosia", nullptr);
1754 HUD->GetComboBox(controlId)->AddItem(L"Joana", nullptr);
1755 HUD->GetComboBox(controlId)->AddItem(L"Raquel", nullptr);
1756 HUD->GetComboBox(controlId)->AddItem(L"Ioana", nullptr);
1757 HUD->GetComboBox(controlId)->AddItem(L"Simona", nullptr);
1758 HUD->GetComboBox(controlId)->AddItem(L"Milena", nullptr);
1759 HUD->GetComboBox(controlId)->AddItem(L"Olga", nullptr);
1760 HUD->GetComboBox(controlId)->AddItem(L"Eliska", nullptr);
1761 HUD->GetComboBox(controlId)->AddItem(L"Nadeja", nullptr);
1762 HUD->GetComboBox(controlId)->AddItem(L"Carmen", nullptr);
1763 HUD->GetComboBox(controlId)->AddItem(L"Esperanza", nullptr);
1764 HUD->GetComboBox(controlId)->AddItem(L"Francisca", nullptr);
1765 HUD->GetComboBox(controlId)->AddItem(L"Leonor", nullptr);
1766 HUD->GetComboBox(controlId)->AddItem(L"Monica", nullptr);
1767 HUD->GetComboBox(controlId)->AddItem(L"Paulina", nullptr);
1768 HUD->GetComboBox(controlId)->AddItem(L"Soledad", nullptr);
1769 HUD->GetComboBox(controlId)->AddItem(L"Ximena", nullptr);
1770 HUD->GetComboBox(controlId)->AddItem(L"Annika", nullptr);
1771 HUD->GetComboBox(controlId)->AddItem(L"Narisa", nullptr);
1772 HUD->GetComboBox(controlId)->AddItem(L"Aylin", nullptr);
1773 HUD->GetComboBox(controlId)->AddItem(L"Selin", nullptr);
1774 HUD->GetComboBox(controlId)->AddItem(L"Zeynep", nullptr);
1775 HUD->GetComboBox(controlId)->AddItem(L"Vira", nullptr);
1776 HUD->GetComboBox(controlId)->AddItem(L"Nguyet", nullptr);
1777 HUD->GetComboBox(controlId)->AddItem(L"Allison", nullptr);
1778 HUD->GetComboBox(controlId)->AddItem(L"Alva", nullptr);
1779
1780 HUD->GetComboBox(IDC_VOICE)->SetDropHeight(RiseMath::Min(35, HUD->GetComboBox(IDC_VOICE)->GetNumItems()) * 14, static_cast<int>(14.0f * game->displayscale));
1781 }
1782}
1783
1785{
1786 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_ENGLISH].c_str(), nullptr);
1787 // skip east asian if not supported
1788 if (eastasian)
1789 {
1790 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_CHINESE].c_str(), nullptr);
1791 }
1792 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_DUTCH].c_str(), nullptr);
1793 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_FRENCH].c_str(), nullptr);
1794 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_GERMAN].c_str(), nullptr);
1795 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_GREEK].c_str(), nullptr);
1796 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_ITALIAN].c_str(), nullptr);
1797 // skip east asian if not supported
1798 if (eastasian)
1799 {
1800 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_JAPANESE].c_str(), nullptr);
1801 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_KOREAN].c_str(), nullptr);
1802 }
1803 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_PORTUGUESE].c_str(), nullptr);
1804 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_RUSSIAN].c_str(), nullptr);
1805 HUD->GetComboBox(controlId)->AddItem(strings[L_LANGUAGE_SPANISH].c_str(), nullptr);
1806 unsigned char templang = game->config.language;
1807 if (!eastasian)
1808 {
1809 if (templang >= 1)
1810 templang--;
1811 if (templang >= 7)
1812 templang -= 2;
1813 }
1814 HUD->GetComboBox(controlId)->SetSelectedByIndex(templang);
1815}
1816
1817void HMI::SetLocale() const
1818{
1819 switch (game->config.language)
1820 {
1821 case 1: setlocale(LC_ALL, "Chinese_China.936"); break;
1822 case 2: setlocale(LC_ALL, "Dutch_Netherlands.1252"); break;
1823 case 3: setlocale(LC_ALL, "French_France.1252"); break;
1824 case 4: setlocale(LC_ALL, "German_Germany.1252"); break;
1825 case 5: setlocale(LC_ALL, "Greek_Greece.1253"); break;
1826 case 6: setlocale(LC_ALL, "Italian_Italy.1252"); break;
1827 case 7: setlocale(LC_ALL, "Japanese_Japan.932"); break;
1828 case 8: setlocale(LC_ALL, "Korean_Korea.949"); break;
1829 case 9: setlocale(LC_ALL, "Portuguese_Brazil.1252"); break;
1830 case 10: setlocale(LC_ALL, "Russian_Russia.1251"); break;
1831 case 11: setlocale(LC_ALL, "Spanish_Spain.1252"); break;
1832 default: setlocale(LC_ALL, "English_United States.1252"); break;
1833 }
1834}
1835
1836void HMI::AddSubtitles(std::wstring const& str) const
1837{
1838 WCHAR msg[99];
1839
1840 if (prosody == 0.5f)
1841 {
1842 // construct a stream from the string
1843 std::wstringstream ss(str);
1844 std::wstring s;
1845
1846 while (std::getline(ss, s, L' '))
1847 {
1848 swprintf_s(msg, 99, L"%s", s.c_str());
1849 _wcsupr_s(msg, 99);
1850 game->GUI->pendingSubtitles.emplace_back(msg);
1851 }
1852 }
1853 else
1854 {
1855 for (unsigned i = 0; i < str.length(); i++)
1856 {
1857 swprintf_s(msg, 99, L"%c", str.c_str()[i]);
1858 _wcsupr_s(msg, 99);
1859 game->GUI->pendingSubtitles.emplace_back(msg);
1860 }
1861 }
1862}
1863
1864void HMI::AddSubtitle(const WCHAR* msg) const
1865{
1866 if (game->GUI->subtitles.empty() ||
1867 game->GUI->subtitles.at(game->GUI->subtitles.size() - 1).length() + wcslen(msg) > subtitleCharLimitC)
1868 game->GUI->subtitles.emplace_back(msg);
1869 else
1870 game->GUI->subtitles.at(game->GUI->subtitles.size() - 1) += msg;
1871 game->GUI->subtitles.at(game->GUI->subtitles.size() - 1) += L" ";
1872 game->GUI->subtitleTimer = 0.0f;
1873 if (game->GUI->subtitles.size() > 4)
1874 game->GUI->subtitles.erase(game->GUI->subtitles.begin());
1875}
1876
1878{
1879 char msg[199];
1880 sprintf_s(msg, sizeof(msg), "LoadLanguage() language %i (east asian support %i)", game->config.language, eastasian ? 1 : 0);
1881 logger->Log(msg);
1882 logger->AddToCallStack(msg);
1883
1884 FILE* file;
1885 FONT_WIDTH = 6;
1886 prosody = 0.5f;
1887
1889 {
1891
1892 char steamLanguage[99];
1893 strcpy_s(steamLanguage, 99, SteamApps()->GetCurrentGameLanguage());
1894 // ReSharper disable once StringLiteralTypo
1895 if (_strcmpi(steamLanguage, "schinese") == 0) game->config.language = 1;
1896 else if (_strcmpi(steamLanguage, "tchinese") == 0) game->config.language = 1;
1897 else if (_strcmpi(steamLanguage, "dutch") == 0) game->config.language = 2;
1898 else if (_strcmpi(steamLanguage, "french") == 0) game->config.language = 3;
1899 else if (_strcmpi(steamLanguage, "german") == 0) game->config.language = 4;
1900 else if (_strcmpi(steamLanguage, "greek") == 0) game->config.language = 5;
1901 else if (_strcmpi(steamLanguage, "italian") == 0) game->config.language = 6;
1902 else if (_strcmpi(steamLanguage, "japanese") == 0) game->config.language = 7;
1903 // ReSharper disable once StringLiteralTypo
1904 else if (_strcmpi(steamLanguage, "koreana") == 0) game->config.language = 8;
1905 else if (_strcmpi(steamLanguage, "portuguese") == 0) game->config.language = 9;
1906 else if (_strcmpi(steamLanguage, "brazilian") == 0) game->config.language = 9;
1907 else if (_strcmpi(steamLanguage, "russian") == 0) game->config.language = 10;
1908 else if (_strcmpi(steamLanguage, "spanish") == 0) game->config.language = 11;
1909 else
1910 game->config.language = 0; // english
1911
1912 if (game->config.language != 0)
1914
1915 sprintf_s(msg, sizeof(msg), "LoadLanguage() language %i (Steam override '%s')", game->config.language, steamLanguage);
1917
1918 game->config.Save();
1919 }
1920
1921 SetLocale();
1922
1923 switch (game->config.language)
1924 {
1925 case 0: fopen_s(&file, "Languages\\english.txt", "rt, ccs=UTF-8");
1926 break;
1927 case 1: fopen_s(&file, "Languages\\chinese.txt", "rt, ccs=UNICODE"); FONT_WIDTH = 14; prosody = 0.2f;
1928 break;
1929 case 2: fopen_s(&file, "Languages\\dutch.txt", "rt, ccs=UTF-8");
1930 break;
1931 case 3: fopen_s(&file, "Languages\\french.txt", "rt, ccs=UTF-8");
1932 break;
1933 case 4: fopen_s(&file, "Languages\\german.txt", "rt, ccs=UTF-8");
1934 break;
1935 case 5: fopen_s(&file, "Languages\\greek.txt", "rt, ccs=UTF-8");
1936 break;
1937 case 6: fopen_s(&file, "Languages\\italian.txt", "rt, ccs=UTF-8");
1938 break;
1939 case 7: fopen_s(&file, "Languages\\japanese.txt", "rt, ccs=UNICODE"); FONT_WIDTH = 14; prosody = 0.2f;
1940 break;
1941 case 8: fopen_s(&file, "Languages\\korean.txt", "rt, ccs=UNICODE"); FONT_WIDTH = 12;
1942 break;
1943 case 9: fopen_s(&file, "Languages\\portuguese.txt", "rt, ccs=UTF-8");
1944 break;
1945 case 10: fopen_s(&file, "Languages\\russian.txt", "rt, ccs=UTF-8");
1946 break;
1947 case 11: fopen_s(&file, "Languages\\spanish.txt", "rt, ccs=UTF-8");
1948 break;
1949 default:
1950 file = nullptr; break;
1951 }
1952 if (!file)
1953 {
1954 sprintf_s(msg, sizeof(msg), "Could not open language file %i!", game->config.language);
1956 }
1957
1958 WCHAR str[512];
1959 fwscanf_s(file, L"%[^\n]\n", str, 512); // attribution
1960 for (short t = 0; t < L_ENUMERATION; t++)
1961 {
1962 if (feof(file))
1963 {
1964 strings[t] = L"EOF";
1965 sprintf_s(msg, sizeof(msg), "Reached EOF prematurely on language file %i (%i)!", game->config.language, t);
1967 }
1968 else
1969 {
1970 fwscanf_s(file, L"%[^\n]\n", str, 512);
1971 if (!str[0])
1972 {
1973 sprintf_s(msg, sizeof(msg), "Reached EOL prematurely on language file %i (%i)!", game->config.language, t);
1975 }
1976
1977 const auto wcslen1 = static_cast<short>(wcslen(str));
1978 for (short q = 1; q < wcslen1; q++)
1979 {
1980 if (str[q] == '/' && (q + 1) < wcslen1 && str[q + 1] == '/') // truncate
1981 {
1982 if (q > 0 && str[q - 1] == ' ')
1983 str[q - 1] = 0;
1984 else
1985 str[q] = 0;
1986 }
1987 else if (str[q] == '\\' && (q + 1) < wcslen1 && str[q + 1] == 'n') // LF
1988 {
1989 str[q] = '\r';
1990 str[q + 1] = '\n';
1991 }
1992 else if (str[q] == '\\' && (q + 1) < wcslen1 && str[q + 1] == 't') // tab
1993 {
1994 str[q] = '\t';
1995 str[q + 1] = '\r';
1996 }
1997 }
1999 str[MAX_TAB_CHARS - 1] = 0; // truncate for tabs in case the file is off
2000 strings[t] = str;
2001 }
2002 }
2003
2004 fclose(file);
2005
2006 if (strings[L_TAB_GLOBAL].length() >= (MAX_TAB_CHARS - 5))
2007 {
2008 sprintf_s(msg, sizeof(msg), "Error in language file %i at L_TAB_GLOBAL", game->config.language);
2010 }
2011 if (strings[L_TAB_UNNAMED].length() >= (MAX_TAB_CHARS - 5))
2012 {
2013 sprintf_s(msg, sizeof(msg), "Error in language file %i at L_TAB_UNNAMED", game->config.language);
2015 }
2016
2017 for (short t = 0; t < D_ENUMERATION; t++)
2018 {
2019 if (DialogBase::dialogs[t])
2020 {
2021 DialogBase::dialogs[t]->ActiveTab(); // for content, width changes because of language change
2022 DialogBase::CheckWidth(t); // for fields, width changes because of language change
2024 }
2025 }
2028
2029 logger->Log("LoadLanguage() successful!");
2030 logger->AddToCallStack("LoadLanguage() DONE");
2031}
2032
2033void HMI::ShowHelpBubble(const WCHAR* msg) const
2034{
2035 adUnmeasuredUi = "help tooltip";
2036 // 56 letters
2037 RECT rect;
2038 const long bubblewidth = FONT_WIDTH * static_cast<long>(wcslen(msg)) + 1;
2039 if (ptCursor.x >= static_cast<long>(designedWidthC / 2)) // right half
2040 rect.left = ptCursor.x - bubblewidth;
2041 else
2042 rect.left = ptCursor.x + 1;
2043 if (ptCursor.y > static_cast<long>(designedHeightC / 2))
2044 rect.top = ptCursor.y - 12; // bottom half
2045 else
2046 {
2047 rect.top = ptCursor.y + 4; // top half
2048 if (ptCursor.x <= static_cast<long>(designedWidthC / 2)) // left half
2049 rect.left += 12;
2050 else
2051 rect.left -= 2;
2052 }
2053 rect.top -= 2;
2054 rect.right = rect.left + bubblewidth;
2055 rect.bottom = rect.top + 12;
2056 rect.top += 2;
2057
2058 RiseMath::Vector3 tempvec;
2059 tempvec.x = static_cast<float>(rect.left) - 1;
2060 tempvec.y = static_cast<float>(rect.top) - 4;
2061 tempvec.z = 0.0f;
2062 RECT rect2;
2063 rect2.left = 62;
2064 rect2.right = rect2.left + bubblewidth + 3;
2065 rect2.top = 0; rect2.bottom = 16;
2066 g_pTextSprite->Draw(m_pddsGUILateral, &rect2, nullptr, &tempvec, 0xFFFFFFFF);
2067 tempvec.x = static_cast<float>(rect.right);
2068 tempvec.y = static_cast<float>(rect.top) - 4;
2069 tempvec.z = 0.0f;
2070 rect2.left = 59; rect2.right = 61;
2071 rect2.top = 0; rect2.bottom = 16;
2072 g_pTextSprite->Draw(m_pddsGUILateral, &rect2, nullptr, &tempvec, 0xFFFFFFFF);
2073
2074
2075 rect.top = rect.top - 2; // doxygen did NOT like this when it was a -=2;
2076 g_pFont->DrawTextW(g_pTextSprite, msg, -1, &rect, DT_LEFT | DT_NOCLIP, 0xFF000000);
2077}
2078
2080{
2081 logger->Log("InitApp() entry...");
2082
2083 ptClick.x = ptClick.y = -1;
2084
2085 // Docked communications shares the main communications button; the last two are commands.
2086 constexpr short toolbarDialogs[] = {D_PEOPLEMANAGER, D_WAYPOINTMANAGER, D_COMMUNICATIONS,
2088 static_assert(_countof(toolbarDialogs) == D_ENUMERATION + 1);
2089 for (short t = 0; t < (D_ENUMERATION + 1); t++)
2090 {
2092 icon[t].iconsource.top = 32;
2093 icon[t].iconsource.bottom = 64;
2094 icon[t].dialog = toolbarDialogs[t];
2095 const short sourceDialog = icon[t].dialog == D_COMMUNICATIONS ? DD_COMMUNICATIONS : icon[t].dialog;
2096 icon[t].iconsource.left = 32 * (sourceDialog >= 0 ? DialogBase::dialogs[sourceDialog]->icon :
2097 (icon[t].dialog == -1 ? 15 : 16));
2098 icon[t].iconsource.right = icon[t].iconsource.left + 32;
2099 }
2100}
2101
2103{
2104 defaultLayoutPending.fill(false);
2105 int menudat = -1;
2106 _sopen_s(&menudat, "Save\\gui.cfg", _O_BINARY | _O_RDONLY, _SH_DENYNO, _S_IWRITE);
2107 if (menudat == -1)
2108 {
2109 // create
2110 logger->Log(R"(File not yet created: "Save\gui.cfg")");
2111 for (short t = 0; t < D_ENUMERATION; t++)
2112 {
2113 QueueDefaultDialogLayout(t);
2114 }
2115 return;
2116 }
2117
2118 // load from gui.cfg
2119 logger->Log(R"(Loading file: "Save\gui.cfg")");
2120
2121 int version, unused;
2122 _read(menudat, &version, 4);
2124 _read(menudat, &unused, 4);
2125
2126 for (long t = 0; t < D_ENUMERATION; t++)
2127 {
2128 // Older configurations have no slot for dialogs added after they were saved.
2129 if (_filelength(menudat) < (t + 1L) * 512L + 256L + MAX_TAB * MAX_TAB_CHARS * 2)
2130 {
2131 QueueDefaultDialogLayout(static_cast<short>(t));
2132 continue;
2133 }
2134 _lseek(menudat, (t + 1L) * 512L, SEEK_SET);
2135 _read(menudat, &DialogBase::dialogs[t]->windowlocation, 12); // 0
2136 if (DialogBase::dialogs[t]->allowresize)
2137 {
2138 _read(menudat, &DialogBase::dialogs[t]->width, 2); // 12
2139 _read(menudat, &DialogBase::dialogs[t]->height, 2); // 14
2140 }
2141 else
2142 {
2143 _lseek(menudat, 4, SEEK_CUR);
2144 }
2145 _read(menudat, &DialogBase::dialogs[t]->tabs, 2); // 16
2146 if (t == D_COMMUNICATIONS)
2147 DialogBase::dialogs[t]->tabs = 1;
2148 _read(menudat, &DialogBase::dialogs[t]->activetab, 2); // 18
2149 _read(menudat, &DialogBase::dialogs[t]->sortfield, 2); // 20
2150 _read(menudat, &DialogBase::dialogs[t]->sortdirection, 1); // 22
2151 if (version >= 2 && t != D_INFORMATION && t != D_EXTERNALCAMERA)
2152 _read(menudat, &DialogBase::dialogs[t]->active, 1); // 24
2153 else
2154 _lseek(menudat, 1, SEEK_CUR);
2155 // 25-255 unused
2156 _lseek(menudat, (t + 1L) * 512L + 256L, SEEK_SET);
2157 _read(menudat, DialogBase::dialogs[t]->tabstr, MAX_TAB * MAX_TAB_CHARS * 2); // 256-480
2158 // 480-511 unused
2159 if (t == D_WAYPOINTMANAGER)
2160 {
2161 // Stable server group IDs accompany this dialog's existing folder labels.
2162 // The tagged extension uses spare bytes in the same gui.cfg record.
2163 _lseek(menudat, (t + 1L) * 512L + 32L, SEEK_SET);
2165 _read(menudat, saved.data(), static_cast<unsigned>(saved.size()));
2168 }
2169
2171 DialogBase::dialogs[t]->ActiveTab(); // for content, width changes because of language change
2172 DialogBase::CheckWidth(static_cast<short>(t)); // for fields, width changes because of language change
2173 DialogBase::CheckHeight(static_cast<short>(t)); // for fields, width changes because of language change
2175 }
2176
2177 _close(menudat);
2178}
2179
2181{
2182 int menudat = -1;
2183 _sopen_s(&menudat, "Save\\gui.cfg", _O_BINARY | _O_CREAT | _O_WRONLY, _SH_DENYNO, _S_IWRITE);
2184 if (menudat == -1)
2185 logger->Log(R"(SaveConfiguration() could not open or create file: "Save\gui.cfg")", Logger::Level::Warn);
2186 else
2187 logger->Log(R"(Saving file: "Save\gui.cfg")");
2188
2189 int version = 2, unused = 0;
2190 _write(menudat, &version, 4); //0
2191 _write(menudat, &unused, 4); //4
2192
2193 for (long t = 0; t < D_ENUMERATION; t++)
2194 {
2195 _lseek(menudat, (t + 1L) * 512L, SEEK_SET);
2196 _write(menudat, &DialogBase::dialogs[t]->windowlocation, 12); // 0
2197 _write(menudat, &DialogBase::dialogs[t]->width, 2); // 12
2198 _write(menudat, &DialogBase::dialogs[t]->height, 2); // 14
2199 _write(menudat, &DialogBase::dialogs[t]->tabs, 2); // 16
2200 _write(menudat, &DialogBase::dialogs[t]->activetab, 2); // 18
2201 _write(menudat, &DialogBase::dialogs[t]->sortfield, 2); // 20
2202 _write(menudat, &DialogBase::dialogs[t]->sortdirection, 1); // 22
2203 _write(menudat, &DialogBase::dialogs[t]->active, 1); // 24
2204 // 25-255 unused
2205 _lseek(menudat, (t + 1L) * 512L + 256L, SEEK_SET);
2206 _write(menudat, DialogBase::dialogs[t]->tabstr, MAX_TAB * MAX_TAB_CHARS * 2); // 256-480
2207 // 480-511 unused
2208 if (t == D_WAYPOINTMANAGER)
2209 {
2210 _lseek(menudat, (t + 1L) * 512L + 32L, SEEK_SET);
2211 const auto saved = waypointDialog->folderOrder.Save();
2212 _write(menudat, saved.data(), static_cast<unsigned>(saved.size()));
2213 }
2214 }
2215
2216 _close(menudat);
2217}
2218
2219void HMI::GetVersionText(WCHAR* str, int size) const
2220{
2221#ifdef _DEBUG
2222 constexpr auto buildType = L"Debug";
2223#else
2224 constexpr auto buildType = L"Release";
2225#endif
2226 const auto distribution = isSteam ? L_SPLASH_STEAM : isLocal ? L_SPLASH_LOCAL : L_SPLASH_DIRECT;
2227 swprintf_s(str, size, L"%i.%i.%i.%i (%s, %s)", major, minor, build, revision, strings[distribution].c_str(), buildType);
2228}
2229
2231{
2232 defaultLayoutPending.fill(true);
2233 ApplyDefaultDialogLayout(true);
2234}
2235
2237{
2238 if (callsignFocus && !g_HUD.GetControl(IDC_CALLSIGN)->m_bHasFocus) // lost focus
2239 {
2240 callsignFocus = false;
2241 g_HUD.GetControl(IDC_CALLSIGN)->GetElement(0)->dwTextFormat = DT_RIGHT | DT_VCENTER;
2242 if (!game->config.defaultuser[0])
2244 }
2245 else if (!callsignFocus && g_HUD.GetControl(IDC_CALLSIGN)->m_bHasFocus) // gained focus
2246 {
2247 callsignFocus = true;
2248 if (!game->config.defaultuser[0])
2250 g_HUD.GetControl(IDC_CALLSIGN)->GetElement(0)->dwTextFormat = DT_LEFT | DT_VCENTER;
2251 }
2252 if (callsignFocus)
2253 {
2254 sprintf_s(game->config.defaultuser, 13, "%.12S", g_HUD.GetEditBox(IDC_CALLSIGN)->GetText());
2255 WCHAR tempuser[13];
2256 swprintf_s(tempuser, 13, L"%S", game->config.defaultuser);
2258 }
2259}
2260
2262{
2264 {
2265 passwordfocus = false;
2266 if (!game->config.defaultpass[0])
2268 }
2270 {
2271 passwordfocus = true;
2272 if (!game->config.defaultpass[0])
2274 }
2275 if (passwordfocus)
2276 sprintf_s(game->config.defaultpass, 16, "%.15S", g_HUD.GetEditBox(IDC_PASSWORD)->GetText());
2277}
2278
2280{
2281 if (!game->config.defaultuser[0] || !game->config.defaultpass[0])
2282 {
2285 }
2286 else
2287 {
2290 }
2291}
2292
2293void HMI::DisplaySnow(Rendering::RenderDevice* pd3dDevice, float fade, float fElapsed)
2294{
2295 fTime += fElapsed;
2296
2297 if (tm_time.tm_mon != 11) // not december
2298 return;
2299
2300 pd3dDevice->SetFVF(RISE_FVF_INSTRUMENT);
2304
2305 //pd3dDevice->SetRenderState(Rendering::RenderState::ZFUNC, Rendering::Compare::ALWAYS);
2307
2308 Rendering::RenderBuffer* m_avSnow = nullptr;
2309
2310 // ReSharper disable once CppEntityAssignedButNoRead
2311 HRESULT hr;
2313
2315 // Lock the vertex buffer
2316 V(m_avSnow->Lock(0, 0, reinterpret_cast<void**>(&vtxs), Rendering::LockFlags::DISCARD));
2317
2318 vtxs->x = 700.0f * game->displayscale; vtxs->y = 0.0f; vtxs->z = 1.0f; vtxs->w = 2.0f;
2319 vtxs->tu = 1; vtxs->tv = 0;
2320 vtxs++;
2321 vtxs->x = 0.0f; vtxs->y = 0.0f; vtxs->z = 1.0f; vtxs->w = 2.0f;
2322 vtxs->tu = 0; vtxs->tv = 0;
2323 vtxs++;
2324 vtxs->x = 700.0f * game->displayscale; vtxs->y = 500.0f * game->displayscale; vtxs->z = 1.0f; vtxs->w = 2.0f;
2325 vtxs->tu = 1; vtxs->tv = 1;
2326 vtxs++;
2327 vtxs->x = 0.0f; vtxs->y = 500.0f * game->displayscale; vtxs->z = 1.0f; vtxs->w = 2.0f;
2328 vtxs->tu = 0; vtxs->tv = 1;
2329
2330 V(m_avSnow->Unlock());
2331
2332 V(pd3dDevice->SetStreamSource(0, m_avSnow, 0, sizeof RiseInstrumentVertex));
2333
2334 RiseMath::Vector4 ambient;
2335 ambient.x = fTime;
2336 ambient.y = fade;
2337 ambient.z = 0.0f; // unused
2338 ambient.w = 0.0f; // unused
2339 V(game->graphics->g_pEffect->SetVector("ambient", &ambient));
2340
2341 V(game->graphics->g_pEffect->Begin(nullptr, 0));
2342 V(game->graphics->g_pEffect->BeginPass(12)); // snow
2343
2345
2347 V(game->graphics->g_pEffect->End());
2348
2350 V(pd3dDevice->SetFVF(RISE_FVF_VERTEX));
2352
2353 SAFE_RELEASE(m_avSnow);
2354}
2355
2356void HMI::OnRender(float fElapsedTime, Rendering::RenderDevice* pd3dDevice)
2357{
2358 adUnmeasuredUi = g_bDragging ? "dragged UI" : nullptr;
2360 HRESULT hr;
2361
2362 char msg[99];
2363 sprintf_s(msg, sizeof(msg), "HMI::OnRender @ displaystage=%i steam=%i", game->displaystage, isSteam ? 1 : 0);
2364 logger->AddToCallStack(msg);
2365
2366 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
2367 // ReSharper disable once CppIncompleteSwitchStatement
2368 switch (game->displaystage) // NOLINT
2369 {
2370#pragma region STATUS_SPLASH
2372 {
2373 //sprintf_s(msg, sizeof(msg), "-- Displayscale %f", game->displayscale);
2374 //logger->AddToCallStack(msg);
2375 RiseMath::Matrix matScale;
2376 RiseMath::MatrixScaling(&matScale, game->displayscale, game->displayscale, 1.0f); // both use Y due to locked 7x5 aspect
2377 //logger->AddToCallStack("-- SetTransform...");
2378 V(g_pTextSprite->SetTransform(&matScale));
2379 //logger->AddToCallStack("-- Begin...");
2380 V(g_pTextSprite->Begin(0));
2381 //logger->AddToCallStack("-- m_pddsGUIRanks...");
2382 if (m_pddsGUIRanks)
2383 {
2384 V(g_pTextSprite->Draw(m_pddsGUIRanks, nullptr, nullptr, nullptr,
2385 Rendering::ColorARGB(static_cast<short>(255.0f * fade * (1.0f - RiseMath::Max(lightningabove[1].intensity * lightningabove[1].
2386 distance, lightningabove[3].intensity * lightningabove[3].distance))), 255, 255, 255)));
2387 }
2388 //logger->AddToCallStack("-- m_pddsLightningAndBackground[1]...");
2390 {
2391 V(g_pTextSprite->Draw(game->graphics->m_pddsLightningAndBackground[1], nullptr, nullptr, nullptr,
2393 lightningabove[3].intensity * lightningabove[3].distance)), 255, 255, 255)));
2394 }
2395 //logger->AddToCallStack("-- m_pddsGUIScrollButton...");
2397 {
2398 V(g_pTextSprite->Draw(m_pddsGUIScrollButton, nullptr, nullptr, nullptr,
2399 Rendering::ColorARGB(static_cast<short>(255.0f * fade * (1.0f - lightningabove[3].intensity * lightningabove[3
2400 ].distance)), 255, 255, 255)));
2401 }
2402 //logger->AddToCallStack("-- m_pddsLightningAndBackground[0]...");
2404 {
2405 V(g_pTextSprite->Draw(game->graphics->m_pddsLightningAndBackground[0], nullptr, nullptr, nullptr, Rendering::ColorARGB(static_cast<short>(255.0f * fade * lightningabove[3].intensity * lightningabove[3].distance), 255, 255, 255)));
2406 }
2407
2408 RiseMath::Vector3 bill = RiseMath::Vector3(123.0f, 73.0f, 0.0f);
2409 //logger->AddToCallStack("-- m_pddsGUIScroll...");
2410 if (m_pddsGUIScroll)
2411 {
2412 V(g_pTextSprite->Draw(m_pddsGUIScroll, nullptr, nullptr, &bill, Rendering::ColorARGB(static_cast<short>(255.0f * fade), 255, 255, 255)));
2413 }
2414
2415 if (fade == 1.0f)
2416 {
2417 //logger->AddToCallStack("-- fade... m_pddsGUIParts... ");
2418 if (m_pddsGUIParts)
2419 {
2420 bill = RiseMath::Vector3(234.0f, 207.0f, 0.0f);
2421 V(g_pTextSprite->Draw(m_pddsGUIParts, nullptr, nullptr, &bill, 0xFFFFFFFF));
2422 }
2423
2424 RECT rect;
2425 rect.left = 245; rect.top = 219; rect.right = rect.bottom = -1;
2427 {
2428 //logger->AddToCallStack("-- >= CONNECT_CONNECTING... ");
2429 g_pFont->DrawTextW(g_pTextSprite, strings[L_SPLASH_CONNECTING].c_str(), -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2430 rect.top += 12;
2432 {
2433 WCHAR tempstr[99];
2434 swprintf_s(tempstr, 99, L"%s (%i)...", strings[L_SPLASH_RETRYING].c_str(), networking->retryconnect);
2435 g_pFont->DrawTextW(g_pTextSprite, tempstr, -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2436 rect.top += 12;
2437 }
2438 }
2440 {
2441 //logger->AddToCallStack("-- >= CONNECT_CONNECTED... ");
2442 g_pFont->DrawTextW(g_pTextSprite, strings[L_SPLASH_CONNECTED].c_str(), -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2443 rect.top += 12;
2444 }
2445
2447 {
2448 //logger->AddToCallStack("-- >= CONNECT_PATCHING... ");
2449 if (game->config.patchdate[0])
2450 g_pFont->DrawTextW(g_pTextSprite, strings[L_SPLASH_CHECKINGFORUPDATES].c_str(), -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2451 else
2452 g_pFont->DrawTextW(g_pTextSprite, strings[L_SPLASH_VALIDATINGINSTALL].c_str(), -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2453 rect.top += 12;
2454
2456 {
2457 WCHAR tempstr[99];
2458 const float f_temp = static_cast<float>(networking->rcvdbytes) / static_cast<float>(networking->patchbytes) * 100.0f;
2459 if (f_temp >= 100.0f)
2460 {
2461 if (game->config.patchdate[0])
2462 swprintf_s(tempstr, 99, strings[L_SPLASH_PATCHING].c_str());
2463 else
2464 swprintf_s(tempstr, 99, strings[L_SPLASH_INSTALLING].c_str());
2465 }
2466 else
2467 {
2468 swprintf_s(tempstr, 99, L"%s (%.0f%%)", strings[L_SPLASH_DOWNLOADING].c_str(), f_temp);
2469 }
2470 g_pFont->DrawTextW(g_pTextSprite, tempstr, -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2471 rect.top += 12;
2472 }
2473 }
2474
2476 {
2477 //logger->AddToCallStack("-- >= CONNECT_PATCHED... ");
2478 if (isSteam)
2479 g_pFont->DrawTextW(g_pTextSprite, strings[L_SPLASH_STEAMUPDATES].c_str(), -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2480 else if (game->config.patchdate[0])
2481 g_pFont->DrawTextW(g_pTextSprite, strings[L_SPLASH_UPTODATE].c_str(), -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2482 else
2483 g_pFont->DrawTextW(g_pTextSprite, strings[L_SPLASH_VALIDATED].c_str(), -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2484 rect.top += 12;
2485 }
2486
2488 {
2489 //logger->AddToCallStack("-- == CONNECT_CONNECTED... ");
2490 if (isSteam)
2491 {
2492 // steam version info
2493 SPacketBig outpacket = SPacketBig();
2494 outpacket.type = 30;
2495 if (!SteamUser())
2496 logger->Log("You must be logged in on Steam and using Proton 8.0-2 or higher!", Logger::Fatal);
2497 uint64 steamId = SteamUser()->GetSteamID().ConvertToUint64();
2498 sprintf_s(outpacket.msg, sizeof(outpacket.msg), "%s,%i,%i,%i,%i,%llu", game->config.patchdate, major, minor, build, revision, steamId);
2499 networking->SendToServer(&outpacket, sizeof(SPacketBig), true);
2500
2502 }
2503 else
2504 {
2505 // request patch
2506 SPacketBig outpacket = SPacketBig();
2507 outpacket.type = 29;
2508 sprintf_s(outpacket.msg, sizeof(outpacket.msg), "%s,%i,%i,%i,%i", game->config.patchdate, major, minor, build, revision);
2509 networking->SendToServer(&outpacket, sizeof(SPacketBig), true);
2510
2512
2513 if (game->config.patchdate[0])
2514 {
2515 int last = strlen(game->config.patchdate) - 1;
2516 if (game->config.patchdate[last] == '\n')
2517 game->config.patchdate[last] = 0;
2518 sprintf_s(msg, sizeof(msg), "Patchdate was %s...", game->config.patchdate);
2519 logger->Log(msg);
2520 }
2521 else
2522 {
2523 logger->Log("Validating installation...");
2524 }
2525 }
2526 }
2527 }
2528
2529 //logger->AddToCallStack("-- Version...");
2530 RECT rect;
2531 rect.left = 10; rect.top = 480; rect.right = rect.bottom = 0;
2532 WCHAR str[99];
2533 GetVersionText(str, 99);
2534 g_pChatFont->DrawTextW(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
2535
2536 //logger->AddToCallStack("-- End...");
2537 V(g_pTextSprite->End());
2538
2539 //logger->AddToCallStack("-- DisplaySnow...");
2540 DisplaySnow(pd3dDevice, 1.0f, fElapsedTime);
2541 }
2542 break;
2543#pragma endregion
2544#pragma region STATUS_LOGIN
2546 {
2547 const float adjfade = RiseMath::Max(fade - 0.4f, 0.0f) * 1.6666666666666666666666666666667f;
2548 RiseMath::Matrix matScale;
2549 RiseMath::MatrixScaling(&matScale, game->displayscale, game->displayscale, 1.0f); // both use Y due to locked 7x5 aspect
2550 V(g_pTextSprite->SetTransform(&matScale));
2552
2553 if (m_pddsGUIRanks)
2554 {
2555 V(g_pTextSprite->Draw(m_pddsGUIRanks, nullptr, nullptr, nullptr, Rendering::ColorARGB(static_cast<short>(255.0f * (1.0f - adjfade)), 255, 255, 255)));
2556 }
2557
2558 RiseMath::Vector3 bill;
2559
2560 // city
2562 {
2563 bill = RiseMath::Vector3(0.0f, 500.0f * adjfade * adjfade, 0.0f);
2564 V(g_pTextSprite->Draw(m_pddsGUIScrollButton, nullptr, nullptr, &bill, Rendering::ColorARGB(static_cast<short>(255.0f * (1.0f - adjfade)), 255, 255, 255)));
2565 }
2566
2567 RECT rect;
2568
2570 {
2571 cloudmotion += fElapsedTime * 6.0f;
2572 if (cloudmotion > 2048.0f)
2573 cloudmotion -= 2048.0f;
2574 rect.left = static_cast<long>(cloudmotion); rect.top = 512 - 500 / 2; rect.right = 700 + static_cast<long>(cloudmotion); rect.bottom = 512 + 500 / 2;
2576 V(g_pTextSprite->Draw(game->graphics->m_pddsCloudBaseMapAndNetwork, &rect, nullptr, nullptr, Rendering::ColorARGB(static_cast<short>(255.0f * adjfade), 100, 100, 100)));
2577 V(g_pTextSprite->Flush());
2579 }
2580
2581 for (short s = 0; s < ACLlightningguiC; s++)
2582 {
2584 {
2585 RiseMath::Vector3 tempvec = RiseMath::Vector3(lightningabove[s].panelx -= fElapsedTime * 6.0f, lightningabove[s].panely, 0.0f);
2586 RiseMath::Matrix matTemp, matTemp2;
2587 RiseMath::MatrixScaling(&matTemp, 0.5f, 0.5f, 1.0f);
2588 RiseMath::MatrixRotationZ(&matTemp2, lightningabove[s].rotate);
2589 matTemp = matTemp * matTemp2;
2590 V(g_pTextSprite->SetTransform(&matTemp));
2591 V(g_pTextSprite->Draw(game->graphics->m_pddsLightningAndBackground[lightningabove[s].texture], nullptr, nullptr, &tempvec, Rendering::ColorARGB(static_cast<short>(255.0f * adjfade * lightningabove[s].intensity), 255, 255, 255)));
2592 V(g_pTextSprite->SetTransform(&matScale));
2593 }
2594 }
2595
2596 // Logo
2597 if (m_pddsGUIScroll)
2598 {
2599 bill = RiseMath::Vector3(123.0f, 73.0f, 0.0f);
2600 V(g_pTextSprite->Draw(m_pddsGUIScroll, nullptr, nullptr, &bill, 0xFFFFFFFF));
2601 }
2602 else
2603 {
2604 logger->Log("m_pddsGUIScroll (Logo.png) was null trying to render the STATUS_LOGIN page (it is loaded on STATUS_SPLASH)", Logger::Level::Debug);
2605 }
2606
2607 if (fade == 1.0f)
2608 {
2609 // MOTD glass
2610 if (m_pddsGUIParts)
2611 {
2612 bill = RiseMath::Vector3(9.0f, 405.0f, 0.0f);
2613 V(g_pTextSprite->Draw(m_pddsGUIParts, nullptr, nullptr, &bill, 0xFFFFFFFF));
2614
2615 // MOTD text
2616 for (size_t i = 0; i < motd.size(); i++)
2617 {
2618 rect.left = 19; rect.top = 417 + 12 * i; rect.right = rect.bottom = 0;
2619 g_pFont->DrawTextW(g_pTextSprite, motd.at(i).c_str(), -1, &rect, DT_LEFT | DT_NOCLIP, 0xFFFFFFFF);
2620 }
2621 }
2622
2623 // Callsign and Password Boxes (Login.png)
2625 {
2626 bill = RiseMath::Vector3(94.0f, 221.0f, 0.0f);
2627 V(g_pTextSprite->Draw(m_pddsGUIInterlace, nullptr, nullptr, &bill, Rendering::ColorARGB(255, 255, 255, 255)));
2628 }
2629
2630 if (makehud)
2631 {
2632 makehud = false;
2633 g_HUD.Init(&g_DialogResourceManager, true, L"Textures\\dxutcontrols.png");
2636 g_HUD.SetFont(0, L"DejaVu Sans Mono", static_cast<LONG>(12.0f * game->displayscale), FW_NORMAL);
2637 g_HUD.SetFont(1, L"EuroseWide Heavy", static_cast<LONG>(20.0f * game->displayscale), FW_NORMAL);
2638 if (game->config.defaultuser[0])
2639 {
2640 WCHAR str[99];
2641 swprintf_s(str, 99, L"%S", game->config.defaultuser);
2642 g_HUD.AddEditBox(IDC_CALLSIGN, str, static_cast<int>(248.0f * game->displayscale), static_cast<int>(230.0f * game->displayscale), static_cast<int>(96.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
2643 }
2644 else
2645 g_HUD.AddEditBox(IDC_CALLSIGN, strings[L_LOGIN_CALLSIGN].c_str(), static_cast<int>(248.0f * game->displayscale), static_cast<int>(230.0f * game->displayscale), static_cast<int>(96.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
2647 g_HUD.GetControl(IDC_CALLSIGN)->GetElement(0)->dwTextFormat = DT_RIGHT | DT_VCENTER;
2648 if (game->config.defaultpass[0])
2649 {
2650 WCHAR wstr[99];
2651 swprintf_s(wstr, 99, L"%S", game->config.defaultpass);
2652 g_HUD.AddEditBox(IDC_PASSWORD, wstr, static_cast<int>(356.0f * game->displayscale), static_cast<int>(230.0f * game->displayscale), static_cast<int>(96.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), false, true);
2653 }
2654 else
2655 g_HUD.AddEditBox(IDC_PASSWORD, strings[L_LOGIN_PASSWORD].c_str(), static_cast<int>(356.0f * game->displayscale), static_cast<int>(230.0f * game->displayscale), static_cast<int>(96.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), false, true);
2658
2659 g_HUD.AddButton(IDC_LOGIN, strings[L_LOGIN_AWAKEN].c_str(), static_cast<int>(275.0f * game->displayscale), static_cast<int>(291.0f * game->displayscale), static_cast<int>(152.0f * game->displayscale), static_cast<int>(37.0f * game->displayscale));
2662 g_HUD.AddButton(IDC_CREATE, strings[L_LOGIN_CREATE].c_str(), static_cast<int>(535.0f * game->displayscale), static_cast<int>(409.0f * game->displayscale), static_cast<int>(152.0f * game->displayscale), static_cast<int>(37.0f * game->displayscale));
2665 if (game->config.defaultuser[0])
2667 g_HUD.AddButton(IDC_EULA, strings[L_LOGIN_EULA].c_str(), static_cast<int>(535.0f * game->displayscale), static_cast<int>(451.0f * game->displayscale), static_cast<int>(152.0f * game->displayscale), static_cast<int>(37.0f * game->displayscale));
2670 }
2671
2675
2679
2681 {
2683 if (loginstr[0])
2684 {
2685 rect.left = 275; rect.top = 291 + 37; rect.right = 275 + 152; rect.bottom = 291 + 37 + 20;
2686 g_pFont->DrawText(g_pTextSprite, loginstr, -1, &rect, DT_CENTER, 0xFFFF0000);
2687 }
2688 }
2689 else if (sound->musicleft != 0.0f)
2690 {
2691 // draw text and bargraph
2692 const float width = 100.0f;
2693 float percent = RiseMath::Min(sound->musicdone / sound->musicleft, 1.0f);
2694 if (percent < 0 || _isnan(percent) || isinf(percent))
2695 {
2696 sprintf_s(msg, sizeof msg, "Found it... musicdone percent was %f", percent);
2698 percent = 0.0f;
2699 }
2700
2701 rect.left = 62; rect.top = 32; rect.right = 62 + static_cast<long>(width * percent); rect.bottom = 40;
2702 bill = RiseMath::Vector3(300.0f, 315.0f, 0.0f);
2703 V(g_pTextSprite->Draw(m_pddsGUILateral, &rect, nullptr, &bill, 0xFFFFFFFF));
2704 rect.left = 62; rect.top = 40; rect.right = 62 + static_cast<long>(width * (1.0f - percent)); rect.bottom = 48;
2705 bill = RiseMath::Vector3(300.0f + static_cast<long>(width * percent), 315.0f, 0.0f);
2706 V(g_pTextSprite->Draw(m_pddsGUILateral, &rect, nullptr, &bill, 0xFFFFFFFF));
2707 rect.left = 299; rect.top = 300; rect.right = 300 + static_cast<long>(width); rect.bottom = 325;
2708 g_pFont->DrawTextW(g_pTextSprite, strings[L_LOGIN_AUTHENTICATING].c_str(), -1, &rect, DT_CENTER, 0xFFFFFFFF);
2709 sound->musicdone += fElapsedTime;
2710 }
2711 }
2712
2713 V(g_pTextSprite->End());
2714
2715 if (fade == 1.0f)
2716 g_HUD.OnRender(fElapsedTime);
2717
2718 DisplaySnow(pd3dDevice, 1.0f - fade, fElapsedTime);
2719 }
2720 break;
2721#pragma endregion
2722#pragma region STATUS_LOADING
2724 {
2726 {
2727 logger->Log("None of the STATUS_LOADING textures are available!", Logger::Debug);
2728 break;
2729 }
2730
2731 // Catch up after loading work before drawing, then hold the original final scale.
2733 //436,338 is center, start with 46x32 (-23 -16) and works to 512,365
2734 const float tempvar = (18.9565f - 18.1537f * sqrtf(eyemotion)) * game->displayscale;
2735
2736 RiseMath::Vector3 bill = RiseMath::Vector3(436.0f, 311.5f, 0.0f);
2737
2738 logger->AddToCallStack("Drawing m_pddsGUIActions");
2739
2740 // going from .04 to .68 or .64 over time OR 25 to 0.68 over time
2741 RiseMath::Matrix matTemp, matTemp2;
2742 RiseMath::MatrixScaling(&matTemp, tempvar, tempvar, 1.0f);
2743 RiseMath::MatrixTranslation(&matTemp2, 350.0f * game->displayscale, 250.0f * game->displayscale, 0.0f);
2744 matTemp = matTemp * matTemp2;
2745 V(g_pTextSprite->SetTransform(&matTemp));
2746
2748
2749 if (m_pddsGUIActions)
2750 {
2751 // Draw all 872 x 623 pixels; cropping the last row exposes the bottom edge at full zoom-out.
2752 V(g_pTextSprite->Draw(m_pddsGUIActions, nullptr, &bill, nullptr, Rendering::ColorARGB(static_cast<short>(255.0f * (0.5f - furtherdelay) / 0.5f), 255, 255, 255)));
2753 }
2754
2755 logger->AddToCallStack("Drawing m_pddsCloudBaseMapAndNetwork");
2756
2757 RiseMath::Matrix matScale;
2758 RiseMath::MatrixScaling(&matScale, game->displayscale, game->displayscale, 1.0f); // both use Y due to locked 7x5 aspect
2759 V(g_pTextSprite->SetTransform(&matScale));
2760 cloudmotion += fElapsedTime * 6.0f;
2761 RECT rect;
2762 rect.left = static_cast<long>(cloudmotion); rect.top = 512 - 500 / 2; rect.right = 700 + static_cast<long>(cloudmotion); rect.bottom = 512 + 500 / 2;
2764 {
2765 V(g_pTextSprite->Draw(game->graphics->m_pddsCloudBaseMapAndNetwork, &rect, nullptr, nullptr, Rendering::ColorARGB(static_cast<short>(255.0f * (1.0f - fade)), 100, 100, 100)));
2766 }
2767
2768 // g_pTextSprite is not null because we just called it above
2769 // bill gets initialized to real numbers, further delay could be NAN?
2770 if (_isnan(furtherdelay) || isinf(furtherdelay)) // can't imagine this is it since we use it above
2771 {
2772 logger->Log("furtherdelay is NAN or INF!? WTH", Logger::Level::Debug);
2773 V(g_pTextSprite->End());
2774 break;
2775 }
2776 if (furtherdelay > 0.5f || furtherdelay < 0.0f) // can't imagine this is it since we use it above
2777 {
2778 logger->Log("furtherdelay is OOB!? WTH", Logger::Level::Debug);
2779 V(g_pTextSprite->End());
2780 break;
2781 }
2782
2783 if (m_pddsGUIScroll)
2784 {
2785 logger->AddToCallStack("Drawing m_pddsGUIScroll");
2786
2787 bill = RiseMath::Vector3(123.0f, 73.0f, 0.0f);
2788 if (fade == 1.0f) // fade out logo when fading to white at end of loading
2789 {
2790 V(g_pTextSprite->Draw(m_pddsGUIScroll, nullptr, nullptr, &bill, Rendering::ColorARGB(static_cast<short>(255.0f * (0.5f - furtherdelay) / 0.5f), 255, 255, 255)));
2791 }
2792 else
2793 {
2794 V(g_pTextSprite->Draw(m_pddsGUIScroll, nullptr, nullptr, &bill, 0xFFFFFFFF));
2795 }
2796 }
2797
2798 logger->AddToCallStack("g_pTextSprite->End()");
2799
2800 try
2801 {
2802 V(g_pTextSprite->End());
2803 }
2804 catch (...)
2805 {
2806 logger->Log("Untyped exception caught calling g_pTextSprite->End() ... calling g_pTextSprite->OnResetDevice()", Logger::Level::Debug);
2807 sprintf_s(msg, sizeof msg, "g_pTextSprite %p", g_pTextSprite);
2809 sprintf_s(msg, sizeof msg, "m_pddsGUIActions %p", m_pddsGUIActions);
2811 sprintf_s(msg, sizeof msg, "m_pddsCloudBaseMapAndNetwork %p", game->graphics->m_pddsCloudBaseMapAndNetwork);
2813 sprintf_s(msg, sizeof msg, "m_pddsGUIScroll %p", m_pddsGUIScroll);
2816 }
2817 }
2818 break;
2819#pragma endregion
2820#pragma region STATUS_GAME
2822 if (!dead || playerships[0].isSimulator)
2823 {
2824 RiseMath::Matrix matScale;
2826 V(g_pTextSprite->SetTransform(&matScale));
2827
2829
2830 V(g_pTextSprite->Begin(0));
2831
2832
2833 // Bottom Bar
2834 RECT source;
2835 source.top = 96;
2836 source.right = 0;
2837 source.left = -static_cast<long>(game->displayWidth / game->displayscale);
2838 source.bottom = 128;
2839 RiseMath::Vector3 tempvec;
2840
2841 tempvec.x = 0.0f; tempvec.y = game->displayHeight / game->displayscale - 32.0f + m_fSlide; tempvec.z = 0.0f;
2842 V(g_pTextSprite->Draw(m_pddsGUILateral, &source, nullptr, &tempvec, 0xFFFFFFFF));
2843
2844 // Bottom icons
2845 const wchar_t* dialogHelp = nullptr;
2846 for (short t = 0; t < (D_ENUMERATION + 1); t++)
2847 {
2848 DWORD tempcolor;
2849 if (icon[t].mouseover && (icon[t].dialog < 0 || DialogBase::dialogs[icon[t].dialog]->enabled))
2850 tempcolor = 0xFFFFFFFF; // bright
2851 else
2852 tempcolor = 0xFFA0A0A0; // dim
2853
2854 icon[t].iconlocation.x = (game->displayWidth / game->displayscale - (D_ENUMERATION + 1) * 32) / 2 + t * 32;
2856 tempvec = icon[t].iconlocation;
2857 tempvec.y += m_fSlide;
2858 RECT rect = icon[t].iconsource;
2859 if (icon[t].dialog > -1 && !DialogBase::dialogs[icon[t].dialog]->enabled)
2860 {
2861 rect.top -= 32; rect.bottom -= 32;
2862 V(g_pTextSprite->Draw(m_pddsGUIParts, &rect, nullptr, &tempvec, 0xFFFFFFFF));
2863 }
2864 else if (icon[t].dialog < 0 || !DialogBase::dialogs[icon[t].dialog]->active)
2865 {
2866 V(g_pTextSprite->Draw(m_pddsGUIParts, &rect, nullptr, &tempvec, tempcolor));
2867 }
2868 else
2869 {
2870 rect.top += 32; rect.bottom += 32;
2871 V(g_pTextSprite->Draw(m_pddsGUIParts, &rect, nullptr, &tempvec, tempcolor));
2872 }
2873
2874 // Help
2875 if (icon[t].mouseover)
2876 {
2877 if (icon[t].dialog == -1) // minimize all
2878 {
2879 if (!minimized)
2881 else
2883 }
2884 else if (icon[t].dialog == -2) // exit
2886 else
2887 dialogHelp = DialogBase::dialogs[icon[t].dialog]->Title();
2888 }
2889 }
2890
2891 // Draw Dialogs
2893
2894 // Help Bubble
2895 if (helpboxlang != -1 && g_fMouseLastMoveTime > 0.5f)
2897 else if (dialogHelp && g_fMouseLastMoveTime > 0.5f)
2898 ShowHelpBubble(dialogHelp);
2899
2900 // Toasts
2901 for (size_t j = 0; j < toasts.size(); j++)
2902 {
2903 toasts.at(j).time -= fElapsedTime;
2904 if (toasts.at(j).time <= 0.0f)
2905 {
2906 toasts.erase(toasts.begin() + j);
2907 j--;
2908 continue;
2909 }
2910
2911 adUnmeasuredUi = "toast overlay";
2912 Toast toast = toasts.at(j);
2914 V(g_pTextSprite->SetTransform(&matScale));
2915
2916 tempvec.x = designedWidthC - 240.0f;
2917 tempvec.y = designedHeightC - 98.0f * (j + 1);
2918 tempvec.z = 0.0f;
2919 RECT rect;
2920 rect.top = 0; rect.bottom = 98;
2921 rect.left = 0;
2922 rect.right = 240;
2923 V(g_pTextSprite->Draw(m_pddsToast, &rect, nullptr, &tempvec, 0xFFFFFFFF));
2924
2925 // Icon at 483 x 424
2926 tempvec.x = designedWidthC - 240.0f + 23.0f;
2927 tempvec.y = designedHeightC - 98.0f * (j + 1) + 23.0f;
2928 tempvec.z = 0.0f;
2929 rect.top = 0; rect.bottom = 32;
2930 rect.left = toast.icon * 32;
2931 rect.right = rect.left + 32;
2932 V(g_pTextSprite->Draw(m_pddsToastIcons, &rect, nullptr, &tempvec, 0xFFFFFFFF));
2933
2934 // Text at 530 x 404 to 677 x 476
2935 for (size_t i = 0; i < toast.text.size(); i++)
2936 {
2937 rect.left = static_cast<LONG>(designedWidthC) - 171;
2938 rect.top = static_cast<LONG>(designedHeightC) - 98 * (j + 1) + 8 + toast.y + i * 12;
2939 rect.right = rect.bottom = 0;
2940 g_pFont->DrawTextW(g_pTextSprite, toast.text.at(i).c_str(), -1, &rect, DT_LEFT | DT_NOCLIP, 0xFFa6aab1);
2941 }
2942
2943 if (IsAdmin)
2944 {
2945 // Text at 530 x 404 to 677 x 476
2946 rect.left = static_cast<LONG>(designedWidthC) - 171;
2947 rect.top = static_cast<LONG>(designedHeightC) - 98 * (j + 1) + 80;
2948 rect.right = rect.bottom = 0;
2949 WCHAR verbiage[99];
2950 swprintf_s(verbiage, 99, L"Toast ID: %i", -toast.id);
2951 g_pFont->DrawText(g_pTextSprite, verbiage, -1, &rect, DT_LEFT | DT_NOCLIP, 0xFFa6aab1);
2952 }
2953 }
2954
2955 // Current keyboard bindings for the active player context.
2957 {
2958 char profile = ProfileFlags::GLOBAL;
2959 int profileName = L_CONFIG_PROFILEINTERIOR;
2960 if (player[ourplayerC].frame != REF_INANOTHER)
2961 profile |= ProfileFlags::INTERIOR;
2962 else if (playerships[0].groundvehicle)
2963 {
2964 profile |= ProfileFlags::GV;
2965 profileName = L_CONFIG_PROFILEGROUND;
2966 }
2967 else
2968 {
2969 profile |= ProfileFlags::AIRSPACE;
2970 profileName = L_CONFIG_PROFILEAIRSPACE;
2971 }
2972 const auto labels = Keychart::BuildLabels(game->config.keyBindings, profile, IsAdmin,
2973 [this](BindingEnum function)
2974 {
2975 const int index = L_BIND_ENGINE1_CYCLE + static_cast<int>(function) * 2;
2976 return Keychart::Label{strings[index], strings[index + 1]};
2977 });
2979 strings[L_BIND_BINDINGSMAP] + L" - " + strings[profileName],
2980 static_cast<int>(game->displayWidth), static_cast<int>(game->displayHeight));
2981 }
2982
2983 if (!game->timeLapse)
2984 {
2985 if (!pendingSubtitles.empty() && (subtitles.empty() || subtitleTimer > prosody))
2986 {
2987 AddSubtitle(pendingSubtitles.at(0).c_str());
2988 pendingSubtitles.erase(pendingSubtitles.begin());
2989 }
2990
2991 if (!subtitles.empty())
2992 {
2993 subtitleTimer += fElapsedTime;
2994 if (subtitleTimer > 5.0f)
2995 subtitles.clear();
2997 {
2998 adUnmeasuredUi = "closed captions";
3000 V(g_pTextSprite->SetTransform(&matScale));
3001
3002 for (size_t i = 0; i < subtitles.size(); i++)
3003 {
3004 // 15 rows, 32 columns
3005 // so height is 1050*.8 ... 840 ... divided by 15 rows ... 56 pixels ... so we will try 48 font height
3006 // width is 1680, display area 1344 ... 42 pixels wide per column
3007
3008 RECT rect;
3009 rect.top = static_cast<long>((designedHeightC - designedHeightC * 0.1f)) - 56 * subtitles.size() + 56 * i; // margin from bottom 787 + 30 * i;
3010 rect.left = static_cast<long>((designedWidthC / 133.33f * 13.33f)); // margin from left
3011 g_pSubtitleFont->DrawTextW(g_pTextSprite, subtitles.at(i).c_str(), -1, &rect, DT_CALCRECT, 0XFFFFFFFF);
3012
3013 RiseMath::Vector3 pos = RiseMath::Vector3(static_cast<float>(rect.left), static_cast<float>(rect.top), 0);
3014 RECT rect2 = rect;
3015 rect2.bottom -= rect.top;
3016 rect2.top = 0;
3017 rect2.right -= rect.left;
3018 rect2.left = 0;
3019 V(g_pTextSprite->Draw(m_pddsGUIInterlace, &rect2, nullptr, &pos, Rendering::ColorARGB(192, 0, 0, 0)));
3020
3021 g_pSubtitleFont->DrawTextW(g_pTextSprite, subtitles.at(i).c_str(), -1, &rect, DT_NOCLIP, 0XFFFFFFFF);
3022 }
3023 }
3024 }
3025
3026
3027 }
3028
3029 V(g_pTextSprite->End());
3030 }
3031 break;
3032#pragma endregion
3033 }
3034
3035 logger->AddToCallStack("HMI::OnRender DONE");
3036}
3037
3039{
3040 if ((dead && !playerships[0].isSimulator) || game->timeLapse || game->showKeymapOverlay ||
3042 return;
3043
3044 const SCamera& camera = *game->viewscreen->camera;
3047 readout.tiltRadians = camera.currentTilt;
3049 readout.zoom = camera.currentZoom;
3055 // Radio altitude is only refreshed while the local terrain is available.
3062
3064 position.y * game->displayscale, game->displayscale);
3065}
3066
3068{
3069 logger->Log("CreateDialogs()...");
3070
3071 for (short t = 0; t < D_ENUMERATION; t++)
3072 DialogBase::draworder[t] = t;
3073
3074 // Can't do these in the constructor because InitializeDialog is a static reference
3075 // This whole thing was architected poorly
3076
3079
3083
3086
3089
3092
3096
3099
3102
3105}
3106
3108{
3109 g->logger->Log("In HMI constructor...");
3110
3111 game = g;
3112 networking = n;
3113 sound = s;
3114 logger = g->logger.get();
3115
3116 time_t now = time(nullptr);
3117 _localtime64_s(&tm_time, &now);
3118
3119 maxWeight = maxHeight = 0.0f;
3120 eastasian = false;
3121 helpboxlang = -1;
3122 g_bRightDown = false;
3123 g_bRightClick = false;
3124 //g_bGVfilter = true;
3125 major = minor = build = revision = 0;
3126
3127 g_fMouseLastMoveTime = 0.0f;
3128 m_fSlide = 0.0f;
3129 g_fLeftDownTime = 0.0f;
3130 g_fDownCounterTime = 0.0f;
3131 g_fTabFlashTime = 0.0f;
3132 g_bTabLit = false;
3133 cursoroverwindow = -1;
3134 g_bDragging = false;
3135 g_bLeftClick = false;
3136 g_bLeftDown = false;
3137 g_bLeftDouble = false;
3138 FONT_WIDTH = 6;
3139 //sortwindows=false;
3140 g_bDropped = false;
3141 flood = 0.0f;
3142 pBuffer = nullptr;
3145 referralValid = 2;
3146 handleValid = 2;
3147 charnameValid = 2;
3149 rxlight = false;
3150 txlight = false;
3151 showerrors = 0;
3152 haserrors = false;
3153 age = 0.0f;
3154 stubbleFreckle = 0.0f;
3155 height = 0.0f;
3156 weight = 0.0f;
3157 rxbuffer = 0;
3158 txbuffer = 0;
3159 fade = 0.0f;
3160 furtherdelay = 0.0f;
3161 eyemotion = 0.0f;
3162 g_pTextSprite = nullptr;
3163 cloudmotion = 0.0f;
3164 makehud = true;
3165
3166
3167 for (short t = 0; t < MAX_ONLINEPLAYERS; t++)
3168 {
3169 ZeroMemory(&player[t], sizeof SPlayerData);
3170 player[t].stubbleFreckle = -1;
3171 }
3172
3173 for (short t = 0; t < MAX_TAB; t++)
3174 {
3175 ZeroMemory(&chatchannel[t], sizeof CHATCHANNEL);
3176 }
3177
3178 for (short t = 0; t < ACLlightningguiC; t++)
3179 {
3180 ZeroMemory(&lightningabove[t], sizeof LIGHTNINGABOVEGUI);
3181 }
3182
3183 ZeroMemory(&tempobject, sizeof s_polygon_object);
3184 polyobj = PolyObj(game);
3185
3186 dragt = -1;
3187 dragline = -1;
3188
3189 for (short t = 0; t < L_ENUMERATION; t++)
3190 {
3191 WCHAR temp[16];
3192 swprintf_s(temp, 16, L"[VERBIAGE_%i]", t);
3193 strings[t] = temp;
3194 }
3195
3197
3198 // check working directory ... if it is STEAM then we go straight to CONNECT_PATCHED
3199 PWSTR str;
3200 const HRESULT hr = SHGetKnownFolderPath(FOLDERID_ProgramData, KF_FLAG_DEFAULT, nullptr, &str);
3201 if (hr != S_OK)
3202 logger->Log("Could not SHGetKnownFolderPath for FOLDERID_ProgramData!", Logger::Fatal);
3203
3204 char programDataPath[MAX_PATH];
3205 sprintf_s(programDataPath, MAX_PATH, "%S", str);
3206 const std::string programDataFolder = programDataPath;
3207 char currentWorkingPath[MAX_PATH];
3208 if (!_getcwd(currentWorkingPath, MAX_PATH))
3209 logger->Log("Could not _getcwd!", Logger::Fatal);
3210
3211 std::string currentWorkingFolder = currentWorkingPath;
3212 isLocal = currentWorkingFolder.find("\\Rise\\CustomUI") == 2;
3213 const bool isSteamDeck = false;// SteamUtils()->IsSteamRunningOnSteamDeck();
3214 isSteam = (isSteamDeck || currentWorkingFolder.find(programDataFolder) != 0) && !isLocal;
3215//#if _DEBUG
3216// isSteam = true;
3217//#endif
3218
3219 if (isSteam)
3220 {
3222 {
3223 logger->Log("Working directory is a Steam Library folder but was not launched from Steam... restarting...", Logger::Fatal);
3224 }
3225
3226 if (!SteamAPI_Init())
3227 {
3228 Sleep(1000);
3229 if (!SteamAPI_Init())
3230 {
3231 logger->Log("The Steam Edition of Rise: The Vieneo Province must be launched from the Steam Client!", Logger::Fatal);
3232 }
3233 }
3234 }
3235
3237
3238 APPBARDATA ABData;
3239 ABData.cbSize = sizeof ABData;
3240 autoHideChits = !(SHAppBarMessage(ABM_GETSTATE, &ABData) & ABS_AUTOHIDE);
3241}
3242
3244{
3245 for (short t = 0; t < D_ENUMERATION; t++)
3247
3248 if (isSteam)
3250
3251 /*int count1 = 0, count2 = 0;
3252 for (int t = 0; t < 16384; t++)
3253 {
3254 if (buffer1[t]) count1++;
3255 if (buffer2[t]) count2++;
3256 }
3257 if (count1 || count2)
3258 {
3259 char msg[99];
3260 sprintf_s(msg, sizeof msg, "My suspicion was correct: %i %i", count1, count2);
3261 logger->Log(msg, Logger::Level::Error);
3262 }*/
3263
3265}
3266
3267void HMI::GarbleChat(wchar_t* str) const
3268{
3269 if (!playerships[0].isSimulator)
3270 ReentryRadio::Garble(str, game->viewscreen->radioBlackout, [] { return RandomFloat(); });
3271}
3272
3273//--------------------------------------------------------------------------------------
3274// Handles the GUI events
3275//--------------------------------------------------------------------------------------
3276void CALLBACK HMI::OnGUIEvent(UINT nEvent, int nControlID, RiseControl*, void* pUserContext)
3277{
3278 HMI* gui = static_cast<HMI*>(pUserContext);
3279
3280 char msg[99];
3281 sprintf_s(msg, sizeof(msg), "HMI::OnGUIEvent(%i) @ displaystage=%i", nControlID, gui->game->displaystage);
3282 gui->logger->Log(msg);
3283
3284 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3285 // ReSharper disable once CppIncompleteSwitchStatement
3286 switch (gui->game->displaystage) // NOLINT
3287 {
3289 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3290 switch (nControlID)
3291 {
3292 case IDC_LOGIN:
3293 {
3294 if (!gui->g_HUD.GetButton(IDC_LOGIN)->GetEnabled())
3295 break;
3296
3297 gui->sound->Play(SOUND_MOUSECLICK);
3298
3299 if (gui->sound->g_pSoundIntro)
3300 {
3301 // capture seconds remaining until song transition
3302 const QWORD bytesLeft = BASS_ChannelGetPosition(gui->sound->g_pSoundIntro, BASS_POS_BYTE);
3303 if (bytesLeft == -1) // NOLINT
3304 {
3305 sprintf_s(msg, sizeof(msg), "BASS_ChannelGetPosition: %i", BASS_ErrorGetCode());
3306 gui->logger->Log(msg, Logger::Level::Error);
3307 }
3308 else
3309 {
3310#ifndef NEWINTRO
3311 gui->sound->musicleft = 48.074f - static_cast<float>(BASS_ChannelBytes2Seconds(gui->sound->g_pSoundIntro, bytesLeft));
3312#else
3313 float secondsLeft = static_cast<float>(BASS_ChannelBytes2Seconds(gui->sound->g_pSoundIntro, bytesLeft));
3314 if (secondsLeft > 50.054f)
3315 gui->sound->musicleft = 0.0f;
3316 else if (secondsLeft > 33.366f)
3317 gui->sound->musicleft = 50.054f - secondsLeft;
3318 else
3319 gui->sound->musicleft = 33.366f - secondsLeft;
3320#endif
3321 }
3322 gui->sound->musicdone = 0.0f;
3323 }
3324
3325 gui->g_HUD.GetButton(IDC_LOGIN)->SetVisible(false);
3326 gui->g_HUD.GetEditBox(IDC_CALLSIGN)->SetEnabled(false);
3327 gui->g_HUD.GetEditBox(IDC_PASSWORD)->SetEnabled(false);
3328
3329 // This is where we do our new packet
3330 SPacketHuge outpacket;
3331 outpacket.type = 0;
3332 strcpy_s(outpacket.login.handle, sizeof(outpacket.login.handle), gui->game->config.defaultuser);
3333 strcpy_s(outpacket.login.password, sizeof(outpacket.login.password), gui->game->config.defaultpass);
3334 outpacket.login.unused1 = 0;
3335 outpacket.login.unused2 = 0;
3336 outpacket.login.unused3 = 0;
3337 outpacket.login.unused4 = 0;
3338 gui->networking->SendToServer(&outpacket, sizeof(SPacketHuge), true);
3339
3340 sprintf_s(msg, sizeof(msg), "Login packet transmitted: %s", gui->game->config.defaultuser);
3341 gui->logger->Log(msg);
3342 }
3343 break;
3344 case IDC_CALLSIGN:
3345 {
3346 gui->loginstr[0] = 0; // clear error text
3347 gui->ProcessCallsignBox();
3348 gui->UpdateLoginCreateButtons();
3349 }
3350 break;
3351 case IDC_PASSWORD:
3352 {
3353 gui->loginstr[0] = 0; // clear error text
3354 gui->ProcessPasswordBox();
3355 gui->UpdateLoginCreateButtons();
3356 }
3357 break;
3358 case IDC_CREATE:
3359 {
3360 gui->game->config.defaultpass[0] = 0;
3361 gui->sound->Play(SOUND_MOUSECLICK);
3362 gui->showerrors = 0; // no error boxes to start
3363 gui->createRoute = true;
3364 gui->DisplayImmigration(false);
3365 gui->game->sound->loopintro = true;
3366 }
3367 break;
3368 case IDC_EULA:
3369 gui->sound->Play(SOUND_MOUSECLICK);
3370 system("start eula.txt");
3371 gui->g_HUD.GetButton(IDC_EULA)->OnMouseLeave();
3372 break;
3373 }
3374
3375 break;
3377 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3378 switch (nControlID)
3379 {
3380 case IDC_LANGUAGE:
3382 {
3383 const unsigned char oldlang = gui->game->config.language;
3384 gui->game->config.language = static_cast<unsigned char>(gui->g_HUD.GetComboBox(IDC_LANGUAGE)->GetSelectedIndex());
3385
3386 if (!gui->eastasian)
3387 {
3388 if (gui->game->config.language >= 1)
3389 gui->game->config.language++;
3390 if (gui->game->config.language >= 7)
3391 gui->game->config.language += 2;
3392 }
3393
3394 if (oldlang != gui->game->config.language)
3395 {
3396 gui->LoadLanguage(); // do this first so if it fails it doesn't save it
3397 gui->game->config.Save();
3398 gui->networking->RequestVerbiage(0); // just changing language... same as ActiveHelp::MessageOfTheDay
3399 gui->DisplayImmigration(true);
3400 }
3401 }
3402 break;
3403 case IDC_VOICE:
3405 {
3406 int voice = gui->g_HUD.GetComboBox(IDC_VOICE)->GetSelectedIndex();
3407 if (voice == 0)
3408 break;
3409
3410 SClientPacket outpacket; // NOLINT
3411 outpacket.type = 43; // voice
3412 if (gui->g_HUD.GetRadioButton(IDC_MALE)->GetChecked())
3413 outpacket.f_x = static_cast<float>(voice);
3414 else if (gui->g_HUD.GetRadioButton(IDC_FEMALE)->GetChecked())
3415 outpacket.f_x = static_cast<float>(voice) + 100.0f;
3416 else
3417 break;
3418 outpacket.f_y = 0.0f; // NULL
3419 outpacket.f_z = 0.0f; // NULL
3420 outpacket.f_w = 0.0f; // NULL
3421 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
3422 gui->txbuffer += sizeof(SClientPacket);
3423 gui->changedVoice = true;
3424 }
3425 break;
3426 case IDC_PASSWORD:
3427 case IDC_PWVERIFY:
3428 {
3429 WCHAR str[16];
3430 swprintf_s(str, 16, L"%.15s", gui->g_HUD.GetEditBox(nControlID)->GetText());
3431 gui->g_HUD.GetEditBox(nControlID)->SetText(str);
3432 }
3433 break;
3434
3435 case IDC_SNAPSHOT:
3436 gui->sound->Play(SOUND_SNAPSHOT);
3437 // save picture to memory buffer
3438 SAFE_RELEASE(gui->pBuffer);
3439 gui->game->AddTrackedResource("pBuffer"); // managed
3440 Rendering::RenderSurface* pSurface;
3441 Rendering::ClientRenderer()->GetBackBuffer(0, 0, 0, &pSurface);
3442 RECT rect;
3443 rect.left = static_cast<LONG>(49.0f * gui->game->displayscale);
3444 rect.top = static_cast<LONG>(271.0f * gui->game->displayscale);
3445 rect.right = static_cast<LONG>(177.0f * gui->game->displayscale);
3446 rect.bottom = static_cast<LONG>(399.0f * gui->game->displayscale);
3447 Rendering::SaveSurfaceToMemory(&gui->pBuffer, Rendering::ImageFile::JPEG, pSurface, nullptr, &rect);
3448 SAFE_RELEASE(pSurface);
3449 break;
3450 case IDC_VOID:
3451 // Free memory buffer for new picture
3452 SAFE_RELEASE(gui->pBuffer);
3453 gui->game->UpdateTrackedResource("pBuffer", 3);
3454 break;
3455 case IDC_FRAMES:
3456 //gui->g_HUD.GetControl(IDC_FRAMETYPE)->SetVisible(true); // Sligo noticed you can't actually adjust this on 8/11/2025 so it is set invisible until we add more! Two spots
3457 gui->g_HUD.GetSlider(IDC_FRAMETYPE)->SetValue(451);
3458 break;
3459 case IDC_NORMAL:
3460 case IDC_IMPLANTS:
3461 gui->g_HUD.GetControl(IDC_FRAMETYPE)->SetVisible(false);
3462 gui->g_HUD.GetSlider(IDC_FRAMETYPE)->SetValue(451);
3463 break;
3464 /*case IDC_EMPHASIS:
3465 break;*/
3466 case IDC_HAIRCOLOR:
3467 gui->haircolor = gui->GetHairColorAtIndex(gui->g_HUD.GetComboBox(IDC_HAIRCOLOR)->GetSelectedIndex() + 1);
3468 break;
3469 case IDC_EYECOLOR:
3470 gui->eyecolor = gui->GetEyeColorAtIndex(gui->g_HUD.GetComboBox(IDC_EYECOLOR)->GetSelectedIndex() + 1);
3471 break;
3472 case IDC_CHARNAME:
3473 {
3474 WCHAR str[20];
3475 swprintf_s(str, 20, L"%.19s", gui->g_HUD.GetEditBox(IDC_CHARNAME)->GetText());
3476 if (str[0]) // not blank
3477 {
3478 _wcsupr_s(str, 20);
3479 gui->g_HUD.GetEditBox(IDC_CHARNAME)->SetText(str);
3480 }
3481 gui->g_HUD.GetEditBox(IDC_SIGNATUREHINT)->SetText(str);
3482 }
3483 break;
3484 case IDC_SIGNATURE:
3485 {
3486 WCHAR str[20];
3487 swprintf_s(str, 20, L"%.19s", gui->g_HUD.GetEditBox(IDC_SIGNATURE)->GetText());
3488 if (str[0]) // not blank
3489 {
3490 _wcsupr_s(str, 20);
3491 gui->g_HUD.GetEditBox(IDC_SIGNATURE)->SetText(str);
3492 }
3493 }
3494 break;
3495 case IDC_HANDLE:
3496 {
3497 WCHAR str[13];
3498 swprintf_s(str, 13, L"%.12s", gui->g_HUD.GetEditBox(IDC_HANDLE)->GetText());
3499 if (str[0]) // not blank
3500 {
3501 _wcslwr_s(str, 13);
3502 gui->g_HUD.GetEditBox(IDC_HANDLE)->SetText(str);
3503 }
3504 }
3505 break;
3506 case IDC_EMAILADDRESS:
3507 gui->emailValidation.Edit(gui->g_HUD.GetEditBox(IDC_EMAILADDRESS)->GetText());
3508 break;
3509 case IDC_REFERRAL:
3510 {
3511 WCHAR str[13];
3512 swprintf_s(str, 13, L"%.12s", gui->g_HUD.GetEditBox(IDC_REFERRAL)->GetText());
3513 if (str[0]) // not blank
3514 {
3515 _wcslwr_s(str, 13);
3516 gui->g_HUD.GetEditBox(IDC_REFERRAL)->SetText(str);
3517 }
3518 gui->referralValid = 2;
3519 }
3520 break;
3521 case IDC_AGE:
3522 {
3523 WCHAR str[3];
3524 swprintf_s(str, 3, L"%.2s", gui->g_HUD.GetEditBox(IDC_AGE)->GetText());
3525 if (str[0] && str[1]) // not blank
3526 {
3527 int val = _wtoi(str);
3528 val = RiseMath::Min(80, val);
3529 val = RiseMath::Max(18, val);
3530 gui->age = (static_cast<float>(val) - 18.0f) / 62.0f;
3531 gui->g_HUD.GetEditBox(IDC_AGE)->SetText(str);
3532 }
3533 }
3534 break;
3535 case IDC_HEIGHT:
3536 case IDC_WEIGHT:
3537 {
3538 WCHAR str[4];
3539 swprintf_s(str, 4, L"%.3s", gui->g_HUD.GetEditBox(nControlID)->GetText());
3540 gui->g_HUD.GetEditBox(nControlID)->SetText(str);
3541 }
3542 break;
3543 case IDC_STUBBLEFRECKLE:
3544 {
3545 const int val = gui->g_HUD.GetSlider(IDC_STUBBLEFRECKLE)->GetValue();
3546 gui->stubbleFreckle = static_cast<float>(val) * 0.01f;
3547 }
3548 break;
3549 case IDC_BACK:
3550 {
3551 // we don't allow them to go back if it is a re-visit to the form (already a player)
3552 if (wcscmp(gui->g_HUD.GetButton(IDC_BACK)->GetText(), gui->strings[L_IMMIGRATION_QUIT].c_str()) == 0)
3553 {
3554 PostQuitMessage(0);
3555 break;
3556 }
3557
3558 gui->sound->ChangeVolume(&gui->game->config.soundConfigLegacy, 1.0f);
3559 gui->sound->Play(SOUND_MOUSECLICK);
3560
3561 gui->game->loadstage = 0;
3562 gui->game->displaystage = GameState::STATUS_LOGIN;
3563 gui->logger->Log("Reversed to STATUS_LOGIN");
3564 gui->game->discord->UpdatePresence("Login Screen", "Waiting for credentials...", "login");
3565
3566 SAFE_RELEASE(gui->game->graphics->m_pddsCloudBaseMapAndNetwork);
3567 gui->game->UpdateTrackedResource("m_pddsCloudBaseMapAndNetwork", 3);
3568 SAFE_RELEASE(gui->game->graphics->m_pddsLightningAndBackground[2]);
3569 gui->game->UpdateTrackedResource("m_pddsLightningAndBackground[2]", 3);
3570 SAFE_RELEASE(gui->m_pddsGUILateral);
3571 gui->game->UpdateTrackedResource("m_pddsGUILateral", 3);
3572 SAFE_RELEASE(gui->m_pddsGUIInterlace);
3573 gui->game->UpdateTrackedResource("m_pddsGUIInterlace", 3);
3574
3575 // this fixes the window size after we leave immigration
3576 if (!GetWindowRect(Rendering::ClientWindow(), &rect))
3577 {
3578 sprintf_s(msg, sizeof msg, "Error in GetWindowRect: %d", GetLastError());
3579 gui->logger->Log(msg, Logger::Fatal);
3580 return;
3581 }
3582
3583 const int loginHeight = static_cast<int>(500.0f * gui->game->displayscale);
3584 const int loginY = (rect.top + rect.bottom - loginHeight) / 2;
3585 if (!MoveWindow(Rendering::ClientWindow(), rect.left, loginY, static_cast<int>(700.0f * gui->game->displayscale), loginHeight, true))
3586 {
3587 sprintf_s(msg, sizeof msg, "Error in MoveWindow: %d", GetLastError());
3588 gui->logger->Log(msg, Logger::Fatal);
3589 return;
3590 }
3591 //DXUTReset3DEnvironment();
3592
3593 gui->g_HUD.RemoveAllControls();
3594 gui->makehud = true;
3595 gui->fade = 1.0f;
3596 gui->game->loadstage = 0;
3597 gui->handleValid = 2;
3598 gui->referralValid = 2;
3599 gui->charnameValid = 2;
3600 gui->emailValidation.Reset(L"");
3601 }
3602 break;
3603 case IDC_SUGGEST:
3604 {
3605 gui->sound->Play(SOUND_MOUSECLICK);
3606 SClientPacket outpacket; // NOLINT
3607 outpacket.type = 9;
3608 if (gui->g_HUD.GetRadioButton(IDC_MALE)->GetChecked())
3609 outpacket.f_x = 1.0f;
3610 else if (gui->g_HUD.GetRadioButton(IDC_FEMALE)->GetChecked())
3611 outpacket.f_x = 2.0f;
3612 else
3613 outpacket.f_x = 0.0f;
3614 outpacket.f_y = 1.0f; // get a random callsign
3615 outpacket.f_z = 0.0f; // NULL
3616 outpacket.f_w = 0.0f; // NULL
3617 gui->networking->SendToServer(&outpacket, sizeof(SClientPacket), true);
3618 gui->txbuffer += sizeof(SClientPacket);
3619
3620 gui->g_HUD.GetButton(IDC_SUGGEST)->SetEnabled(false);
3621
3622 gui->g_HUD.GetSlider(IDC_SKINCOLOR)->SetValue(rand() % 255 + 1);
3623 gui->g_HUD.GetSlider(IDC_SKINTONE)->SetValue(rand() % 255 + 1);
3624 const int randomVision = rand() % 3 + 1;
3625 gui->g_HUD.GetRadioButton(IDC_NORMAL)->SetChecked(randomVision == 1);
3626 gui->g_HUD.GetRadioButton(IDC_IMPLANTS)->SetChecked(randomVision == 2);
3627 gui->g_HUD.GetRadioButton(IDC_FRAMES)->SetChecked(randomVision == 3);
3628 gui->g_HUD.GetSlider(IDC_HEAD)->SetValue(rand() % 5 + 150);
3629 gui->g_HUD.GetSlider(IDC_FRAMETYPE)->SetVisible(randomVision == 3);
3630 gui->g_HUD.GetSlider(IDC_JAWLINE)->SetValue(rand() % 5 + 676);
3631 gui->g_HUD.GetSlider(IDC_NOSE)->SetValue(rand() % 4 + 101);
3632 gui->g_HUD.GetSlider(IDC_EARS)->SetValue(rand() % 5 + 226);
3633 gui->g_HUD.GetSlider(IDC_HAIRSTYLE)->SetValue(rand() % 5 + 175);
3634 gui->g_HUD.GetSlider(IDC_FEATURE)->SetValue(rand() % 3 + 125);
3635 const int randomStubble = rand() % 101;
3636 gui->stubbleFreckle = static_cast<float>(randomStubble) * 0.01f;
3637 gui->g_HUD.GetSlider(IDC_STUBBLEFRECKLE)->SetValue(randomStubble);
3638
3639 gui->age = RandomFloat();
3640 WCHAR str[16];
3641 swprintf_s(str, 16, L"%.0f", gui->age * 62.0f + 18.0f);
3642 gui->g_HUD.GetEditBox(IDC_AGE)->SetText(str);
3643
3644 SAFE_RELEASE(gui->pBuffer);
3645 gui->game->UpdateTrackedResource("pBuffer", 3);
3646 }
3647 break;
3648 case IDC_CONFIRM:
3649 {
3650 if (gui->emailValidation.PendingSave()) break;
3651 gui->RequestEmailValidation(); // Also handles submit before the next focus-loss frame.
3652 gui->showerrors = 1; // switch to red highlights
3653 gui->DrawErrorBoxes(false); // recalculate without drawing during DXUT message dispatch
3654
3655 if (gui->haserrors)
3656 break;
3657
3658 unsigned char sex;
3659 if (gui->g_HUD.GetRadioButton(IDC_MALE)->GetChecked())
3660 sex = 1;
3661 else if (gui->g_HUD.GetRadioButton(IDC_FEMALE)->GetChecked())
3662 sex = 2;
3663 else
3664 break;
3665
3666 gui->game->config.g_bAutoLogin = true; // default
3667
3668 //short context = gui->g_HUD.GetComboBox(IDC_EMPHASIS)->GetSelectedIndex() - 1;
3669
3670 SPacketHuge outpacket;
3671 outpacket.type = 2; // subscribe to server
3672 sprintf_s(outpacket.subscribe.handle, sizeof(outpacket.subscribe.handle), "%.12S", gui->g_HUD.GetEditBox(IDC_HANDLE)->GetText());
3673 strcpy_s(gui->game->config.defaultuser, sizeof(gui->game->config.defaultuser), outpacket.subscribe.handle);
3674 sprintf_s(outpacket.subscribe.password, sizeof(outpacket.subscribe.password), "%.15S", gui->g_HUD.GetEditBox(IDC_PASSWORD)->GetText());
3675 strcpy_s(gui->game->config.defaultpass, sizeof(gui->game->config.defaultpass), outpacket.subscribe.password);
3676 sprintf_s(outpacket.subscribe.referrer, sizeof(outpacket.subscribe.referrer), "%.12S", gui->g_HUD.GetEditBox(IDC_REFERRAL)->GetText());
3677 sprintf_s(outpacket.subscribe.characterName, sizeof(outpacket.subscribe.characterName), "%.29S", gui->g_HUD.GetEditBox(IDC_CHARNAME)->GetText());
3678 if (!gui->GetImmigrationEmail(outpacket.subscribe.email)) break;
3679
3680 outpacket.subscribe.age = static_cast<unsigned char>(_wtoi(gui->g_HUD.GetEditBox(IDC_AGE)->GetText()));
3681 outpacket.subscribe.context = 0; // unsupported
3682 outpacket.subscribe.eargroup = static_cast<short>(gui->g_HUD.GetSlider(IDC_EARS)->GetValue());
3683 outpacket.subscribe.eyecolor = static_cast<unsigned char>(gui->g_HUD.GetComboBox(IDC_EYECOLOR)->GetSelectedIndex()) + 1;
3684 outpacket.subscribe.facialhair = static_cast<short>(gui->g_HUD.GetSlider(IDC_FEATURE)->GetValue());
3685 outpacket.subscribe.framegroup = static_cast<short>(gui->g_HUD.GetSlider(IDC_FRAMETYPE)->GetValue());
3686 outpacket.subscribe.haircolor = static_cast<unsigned char>(gui->g_HUD.GetComboBox(IDC_HAIRCOLOR)->GetSelectedIndex()) + 1;
3687 outpacket.subscribe.hairgroup = static_cast<short>(gui->g_HUD.GetSlider(IDC_HAIRSTYLE)->GetValue());
3688 outpacket.subscribe.headgroup = static_cast<short>(gui->g_HUD.GetSlider(IDC_HEAD)->GetValue());
3689 outpacket.subscribe.heightCm = static_cast<unsigned char>(_wtoi(gui->g_HUD.GetEditBox(IDC_HEIGHT)->GetText()));
3690 outpacket.subscribe.jawline = static_cast<short>(gui->g_HUD.GetSlider(IDC_JAWLINE)->GetValue());
3691 outpacket.subscribe.nosegroup = static_cast<short>(gui->g_HUD.GetSlider(IDC_NOSE)->GetValue());
3692 outpacket.subscribe.sex = sex;
3693 outpacket.subscribe.skincolor = static_cast<unsigned char>(gui->g_HUD.GetSlider(IDC_SKINCOLOR)->GetValue());
3694 outpacket.subscribe.skintone = static_cast<unsigned char>(gui->g_HUD.GetSlider(IDC_SKINTONE)->GetValue());
3695 outpacket.subscribe.stubbleFreckle = static_cast<unsigned char>(gui->g_HUD.GetSlider(IDC_STUBBLEFRECKLE)->GetValue());
3696 if (gui->g_HUD.GetRadioButton(IDC_NORMAL)->GetChecked())
3697 outpacket.subscribe.vision = 1;
3698 else if (gui->g_HUD.GetRadioButton(IDC_IMPLANTS)->GetChecked())
3699 outpacket.subscribe.vision = 2;
3700 else
3701 outpacket.subscribe.vision = 3;
3702 outpacket.subscribe.weight = static_cast<unsigned char>(_wtoi(gui->g_HUD.GetEditBox(IDC_WEIGHT)->GetText()));
3703 if (sex == 1)
3704 outpacket.subscribe.voice = static_cast<unsigned char>(gui->g_HUD.GetComboBox(IDC_VOICE)->GetSelectedIndex());
3705 else if (sex == 2)
3706 outpacket.subscribe.voice = static_cast<unsigned char>(gui->g_HUD.GetComboBox(IDC_VOICE)->GetSelectedIndex()) + 100;
3707
3708 // Final sanity checks
3709 if (!outpacket.subscribe.handle[0])
3710 {
3711 gui->logger->Log("User got here trying to submit a form with a blank handle!?", Logger::Level::Error);
3712 break;
3713 }
3714 if (!outpacket.subscribe.email[0])
3715 {
3716 gui->logger->Log("User got here trying to submit a form with a blank email!?", Logger::Level::Error);
3717 break;
3718 }
3719
3720
3721 if (!gui->emailValidation.BeginSave()) break;
3722 gui->g_HUD.GetEditBox(IDC_EMAILADDRESS)->SetEnabled(false);
3723 gui->g_HUD.GetComboBox(IDC_LANGUAGE)->SetEnabled(false);
3724 gui->g_HUD.GetButton(IDC_CONFIRM)->SetEnabled(false);
3725 gui->g_HUD.GetButton(IDC_BACK)->SetEnabled(false);
3726 gui->g_HUD.GetButton(IDC_SUGGEST)->SetEnabled(false);
3727
3728
3729 if (gui->player[gui->ourplayerC].serial) // has one
3730 outpacket.subscribe.addrequest = false; // update
3731 else
3732 {
3733 outpacket.subscribe.addrequest = true; // new player
3734 gui->game->config.Save(); // by default autoLogin is ON so we need to save
3735 }
3736
3737 gui->networking->SendToServer(&outpacket, sizeof(SPacketHuge), true);
3738 gui->txbuffer += sizeof(SPacketHuge);
3739
3740
3741 }
3742 break;
3743 }
3744 break;
3746 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3747 switch (nControlID)
3748 {
3749 case IDC_REJOINBTN:
3750 {
3751 // Check the deadline at the action boundary as well as disabling the
3752 // button, so a queued click or keyboard event cannot bypass the wait.
3753 if (!dead || playerships[0].isSimulator ||
3754 !gui->rejoinCountdown.Ready(Rendering::ClientTime()))
3755 break;
3756 gui->rejoinCountdown.Reset();
3757 gui->g_HUD.GetButton(IDC_REJOINBTN)->SetEnabled(false);
3758
3759 if (playerships[0].reference == REF_ONGROUND || playerships[0].reference == REF_APNMODE)
3760 {
3761 playerships[0].geardown = true;
3762 ourcockpit.gearextent = 1.0f; // gear down on ground
3763 gui->game->networking->SendEvent(EventType::EVENT_LANDINGGEAR_DOWN);
3764 gui->game->bus->flapSettingTE = 0;
3765 playerships[0].flapdown = ourcockpit.flapExtent = 0.0f; // flaps up on ground
3766 gui->game->networking->SendEvent(EventType::EVENT_FLAPSETTING, 0.0f);
3767 gui->game->bus->GroundSpoilerPositionScalar = 0.0f;
3768 gui->game->bus->FlightSpoilerPositionScalar = 0.0f;
3769 gui->game->networking->SendEvent(EventType::EVENT_SPOILERSETTING, 0.0f);
3770 }
3771
3772 playerships[0].baydoor = false;
3773 playerships[0].baydoorextent = 0.0f; // door closed by default
3774 gui->game->networking->SendEvent(EventType::EVENT_BAYDOOR_CLOSED);
3775
3776 ourcockpit.hitpoints = 255;
3777 gui->game->RepairVehicle();
3778
3779 //gui->game->bus->CabinPressureMb = OneAtmosphereMb; // Bill had me add this 11/30/2024
3780
3781 // Flip for them too
3782 if (fabsf(gui->game->bus->RollAttitudeRadians) > 1.5708f && playerships[0].reference == REF_ONGROUND)
3783 {
3784 RiseMath::Quaternion quaternionTemp;
3785 RiseMath::QuaternionRotationYawPitchRoll(&quaternionTemp, 0.0f, 0.0f, RiseMath::Pi);
3786 RiseMath::QuaternionMultiply(&playerships[0].orientation, &playerships[0].orientation, &quaternionTemp);
3787 }
3788
3789 gui->informationDialog->PopUpHelp(ActiveHelp::Resurrected);
3790
3792 deathinhibit = 10.0f; // give the player time to move clear of whatever killed them
3793
3794 gui->game->viewscreen->counteri = gui->game->viewscreen->counterj = gui->game->viewscreen->counterk = 0.0f;
3795
3796 // Only refuel if tank is empty
3797 if (fuel <= 0.0f)
3798 {
3799 const float toTop = Clamp(ourcockpit.fuelmax - fuel, 0.0f, ourcockpit.fuelmax - deathfuel);
3800 deathfuel += toTop;
3801 fuel += toTop;
3802 }
3803 }
3804 break;
3805 }
3806 break;
3807 }
3808}
3809
3810void HMI::LoadTextures(GameState displaystage, short loadstage)
3811{
3812 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3813 switch (displaystage)
3814 {
3816 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3817 switch (loadstage)
3818 {
3819 case 1:
3820 game->LoadTexture(&m_pddsGUIRanks, "m_pddsGUIRanks", L"Textures\\Splash.png", Rendering::ImageFormat::RGB8); // dark sky background, should be renamed to Sky.png
3821 break;
3822 case 2:
3823 game->LoadTexture(&m_pddsGUIScroll, "m_pddsGUIScroll", L"Textures\\Logo.png"); // Does NOT get released in STATUS_LOGIN
3824 break;
3825 case 3:
3826 game->LoadTexture(&m_pddsGUIScrollButton, "m_pddsGUIScrollButton", L"Textures\\City.png");
3827 break;
3828 case 4:
3829 game->LoadTexture(&game->graphics->m_pddsLightningAndBackground[0], "m_pddsLightningAndBackground[0]", L"Textures\\City-lit.png", Rendering::ImageFormat::RGB8);
3830 break;
3831 case 5:
3832 game->LoadTexture(&game->graphics->m_pddsLightningAndBackground[1], "m_pddsLightningAndBackground[1]", L"Textures\\Sky-lit.png", Rendering::ImageFormat::RGB8);
3833 break;
3834 case 6:
3835 game->LoadTexture(&m_pddsGUIParts, "m_pddsGUIParts", L"Textures\\Glass.png"); // Needed for the login patching window
3836 break;
3837 }
3838 break;
3840 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3841 switch (loadstage)
3842 {
3843 case 1:
3845 game->LoadTexture(&game->graphics->m_pddsCloudBaseMapAndNetwork, "m_pddsCloudBaseMapAndNetwork", L"Textures\\Clouds\\cloudbase.png", Rendering::ImageFormat::R8);
3846 break;
3847 case 2:
3849 game->UpdateTrackedResource("m_pddsLightningAndBackground[0]", 3);
3850 game->LoadTexture(&game->graphics->m_pddsLightningAndBackground[0], "m_pddsLightningAndBackground[0]", L"Textures\\Clouds\\lightningtoground.dds", Rendering::ImageFormat::BC2);
3851 break;
3852 case 3:
3854 game->UpdateTrackedResource("m_pddsLightningAndBackground[1]", 3);
3855 game->LoadTexture(&game->graphics->m_pddsLightningAndBackground[1], "m_pddsLightningAndBackground[1]", L"Textures\\Clouds\\lightningtosky.dds", Rendering::ImageFormat::BC2);
3856 break;
3857 case 4:
3859 game->LoadTexture(&game->graphics->m_pddsLightningAndBackground[2], "m_pddsLightningAndBackground[2]", L"Textures\\Clouds\\lightningincloud.dds", Rendering::ImageFormat::BC2);
3860 break;
3861 case 5:
3862 if (!m_pddsGUIInterlace)
3863 game->LoadTexture(&m_pddsGUIInterlace, "m_pddsGUIInterlace", L"Textures\\Login.png");
3864 break;
3865 case 6:
3866 if (!m_pddsGUILateral)
3867 game->LoadTexture(&m_pddsGUILateral, "m_pddsGUILateral", L"Textures\\GUI\\guilateral.png"); // needed for the login progress bar
3868 break;
3869 }
3870 break;
3872 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3873 switch (loadstage)
3874 {
3875 case 1:
3877 game->UpdateTrackedResource("m_pddsGUIInterlace", 3);
3878 game->LoadTexture(&m_pddsGUIInterlace, "m_pddsGUIInterlace", L"Textures\\Immigration.png", Rendering::ImageFormat::RGB8);
3879 break;
3880 case 2:
3882 game->UpdateTrackedResource("m_pddsCloudBaseMapAndNetwork", 3);
3883 game->LoadTexture(&game->graphics->m_pddsCloudBaseMapAndNetwork, "m_pddsCloudBaseMapAndNetwork", L"Textures\\Network.png");
3884 break;
3885 }
3886 break;
3888 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
3889 switch (loadstage)
3890 {
3891 case 1:
3892 if (!m_pddsGUIActions)
3893 game->LoadTexture(&m_pddsGUIActions, "m_pddsGUIActions", L"Textures\\eyezoomtest.png", Rendering::ImageFormat::RGB8);
3894 break;
3895 }
3896 break;
3898 {
3899 logger->Log("Loading GUI Textures (Managed)");
3900 if (!m_pddsGUIScroll)
3901 game->LoadTexture(&m_pddsGUIScroll, "m_pddsGUIScroll", L"Textures\\GUI\\scrollbar.png");
3903 game->LoadTexture(&m_pddsGUIScrollButton, "m_pddsGUIScrollButton", L"Textures\\GUI\\scrollbutton.png");
3904 if (!m_pddsGUIInterlace)
3905 game->LoadTexture(&m_pddsGUIInterlace, "m_pddsGUIInterlace", L"Textures\\GUI\\interlace.png");
3907 game->LoadTexture(&m_pddsGUIInterlace2, "m_pddsGUIInterlace2", L"Textures\\GUI\\smokescreen.png");
3908 if (!m_pddsGUIActions)
3909 game->LoadTexture(&m_pddsGUIActions, "m_pddsGUIActions", L"Textures\\GUI\\actions.png");
3910 if (!m_pddsGUIRanks)
3911 game->LoadTexture(&m_pddsGUIRanks, "m_pddsGUIRanks", L"Textures\\GUI\\ranks.png");
3912 if (!m_pddsGUIParts)
3913 game->LoadTexture(&m_pddsGUIParts, "m_pddsGUIParts", L"Textures\\GUI\\gui.png");
3914 if (!m_pddsToast)
3915 game->LoadTexture(&m_pddsToast, "m_pddsToast", L"Textures\\GUI\\toast.png", Rendering::ImageFormat::RGB8);
3916 if (!m_pddsToastIcons)
3917 game->LoadTexture(&m_pddsToastIcons, "m_pddsToastIcons", L"Textures\\GUI\\icons.png");
3918 if (!m_pddsEasydockAd)
3919 game->LoadTexture(&m_pddsEasydockAd, "m_pddsEasydockAd", L"Textures\\GUI\\EasydockAd.png", Rendering::ImageFormat::RGB8);
3920 if (!m_pddsBindings)
3921 game->LoadTexture(&m_pddsBindings, "m_pddsBindings", L"Textures\\GUI\\bindings.png", Rendering::ImageFormat::RGB8);
3922 if (!m_pddsGUILateral)
3923 game->LoadTexture(&m_pddsGUILateral, "m_pddsGUILateral", L"Textures\\GUI\\guilateral.png"); // for OnDestroyDevice
3924 }
3925 break;
3926 }
3927}
3928
3930{
3932 game->UpdateTrackedResource("externalCameraOverlay.labelFont", 3);
3933 game->UpdateTrackedResource("externalCameraOverlay.valueFont", 3);
3935 game->UpdateTrackedResource("keyboardChart.font", 3);
3936 game->UpdateTrackedResource("keyboardChart.blankKeyboard", 3);
3937 logger->Log("HMI::OnDestroyDevice");
3938 logger->AddToCallStack("HMI::OnDestroyDevice");
3939
3941 game->UpdateTrackedResource("g_DialogResourceManager", 3);
3942
3943 if (tempobject.VB)
3944 {
3946 game->UpdateTrackedResource("tempobject.VB", 3);
3947 }
3948
3950 game->UpdateTrackedResource("g_pTextSprite", 3);
3952 game->UpdateTrackedResource("g_pFont", 3);
3954 game->UpdateTrackedResource("g_pChatFont", 3);
3956 game->UpdateTrackedResource("g_pSubtitleFont", 3);
3957
3959 game->UpdateTrackedResource("m_pddsGUIParts", 3);
3961 game->UpdateTrackedResource("m_pddsGUILateral", 3);
3962
3964 game->UpdateTrackedResource("m_pddsGUIScroll", 3);
3965
3967 game->UpdateTrackedResource("m_pddsGUIScrollButton", 3);
3969 game->UpdateTrackedResource("m_pddsGUIInterlace", 3);
3971 game->UpdateTrackedResource("m_pddsGUIInterlace2", 3);
3973 game->UpdateTrackedResource("m_pddsGUIRanks", 3);
3975 game->UpdateTrackedResource("m_pddsGUIActions", 3);
3977 game->UpdateTrackedResource("m_pddsToast", 3);
3979 game->UpdateTrackedResource("m_pddsToastIcons", 3);
3981 game->UpdateTrackedResource("m_pddsEasydockAd", 3);
3983 game->UpdateTrackedResource("m_pddsBindings", 3);
3984
3985 logger->AddToCallStack("HMI::OnDestroyDevice DONE");
3986}
3987
3988void HMI::PlayerOffline(unsigned char arrayindex)
3989{
3990 if (player[arrayindex].online)
3991 {
3992 WCHAR str[199];
3993 swprintf_s(str, 199, L"Player logged off %S", player[arrayindex].extraText);
3994 chatchannel[0].chatline.emplace_back(str);
3995 chatchannel[0].chatlineplayer.emplace_back(player[arrayindex].callsign);
3996 chatchannel[0].RemovePlayer(arrayindex);
3997
3998 player[arrayindex].online = false;
3999 player[arrayindex].callsign[0] = 0;
4000
4002 {
4003 for (int t = 1; t < DialogBase::dialogs[D_COMMUNICATIONS]->tabs; t++)
4004 PlayerLeftChannel(t, arrayindex);
4006 if (!chatchannel[0].dnd)
4007 {
4008 if (DialogBase::dialogs[D_COMMUNICATIONS]->activetab != 0)
4011 }
4013 }
4014 }
4015 else
4016 {
4017 logger->Log("Could be this is the problem with blank callsignY2Y2?", Logger::Level::Debug);
4018 }
4019}
4020
4027
4028void HMI::PlayerJoinedChannel(short tab, unsigned char playerindex)
4029{
4030 chatchannel[tab].AddPlayer(playerindex);
4031 chatchannel[tab].chatline.emplace_back(L"Player joined channel");
4032 chatchannel[tab].chatlineplayer.emplace_back(player[playerindex].callsign);
4033
4035 {
4038 if (!chatchannel[tab].dnd)
4039 {
4040 if (DialogBase::dialogs[D_COMMUNICATIONS]->activetab != tab)
4043 }
4044 }
4045}
4046
4047void HMI::PlayerLeftChannel(short tab, unsigned char playerindex)
4048{
4049 chatchannel[tab].chatline.emplace_back(L"Player left channel");
4050 chatchannel[tab].chatlineplayer.emplace_back(player[playerindex].callsign);
4051 chatchannel[tab].RemovePlayer(playerindex);
4052
4054 {
4057 if (!chatchannel[tab].dnd)
4058 {
4059 if (DialogBase::dialogs[D_COMMUNICATIONS]->activetab != tab)
4062 }
4063 }
4064}
4065
4066void HMI::ChangeChannelOwner(short tab, unsigned char playerindex)
4067{
4068 char msg[99];
4069 sprintf_s(msg, sizeof(msg), "Got new owner %i for tab %i channel %i", playerindex, tab, chatchannel[tab].channel);
4070 logger->Log(msg);
4071
4072 chatchannel[tab].owner = playerindex;
4073
4076}
4077
4078void HMI::AddSupportChatMessage(const WCHAR* wmsg)
4079{
4080 constexpr WCHAR codexPrefix[] = L"[codex]: ";
4081 constexpr size_t codexPrefixLength = _countof(codexPrefix) - 1;
4082 const bool fromCodex = wcsncmp(wmsg, codexPrefix, codexPrefixLength) == 0;
4083 chatchannel[0].chatline.emplace_back(wmsg + (fromCodex ? codexPrefixLength : 0));
4084 chatchannel[0].chatlineplayer.emplace_back(fromCodex ? "codex" : "support");
4085
4087 {
4089 if (!chatchannel[0].dnd)
4090 {
4091 if (DialogBase::dialogs[D_COMMUNICATIONS]->activetab == 0)
4093 else
4095 }
4096 }
4097}
4098
4099void HMI::AddDiscordChatMessage(const WCHAR* msg)
4100{
4101 WCHAR wmsg[STORE_CHAT_SIZE];
4102 for (size_t i = 0; i < wcslen(msg); i++)
4103 {
4104 if (msg[i] == L']') // find first separator
4105 {
4106 wcscpy_s(wmsg, STORE_CHAT_SIZE, &msg[i + 1]);
4107 chatchannel[0].chatline.emplace_back(wmsg);
4108
4109 char callsign[13];
4110 sprintf_s(callsign, 13, "%.*S", static_cast<int>((std::min)(i, sizeof(callsign) - 1)), msg);
4111 chatchannel[0].chatlineplayer.emplace_back(callsign);
4112 break;
4113 }
4114 }
4115
4117 {
4119 if (!chatchannel[0].dnd)
4120 {
4121 if (DialogBase::dialogs[D_COMMUNICATIONS]->activetab == 0)
4123 else
4125 }
4126 }
4127}
4128
4129void HMI::AddChatMessage(WCHAR* msg, unsigned char playerindex, unsigned char channel)
4130{
4131 for (short t = 0; t < MAX_TAB; t++)
4132 {
4133 if (chatchannel[t].channel == channel) // channel
4134 {
4135 bool allow = true;
4136 if (playerindex < MAX_ONLINEPLAYERS) // reserved 254 from server, 255 from support
4137 {
4138 for (short s = 0; s < MAX_ONLINEPLAYERS; s++)
4139 {
4140 if (chatchannel[t].seqplayer[s] == playerindex) // from
4141 {
4142 if (chatchannel[t].dndplayer[s])
4143 {
4144 allow = false;
4145 logger->Log("AddChatMessage was disallowed due to DND");
4146 }
4148 }
4149 }
4150 }
4151 if (allow)
4152 {
4153 if (msg[0] != 0) // not a token, this is the 4th position in the array
4154 {
4155 GarbleChat(msg);
4156
4157 chatchannel[t].chatline.emplace_back(msg);
4158
4159 logger->Log("AddChatMessage was non-tokenized");
4160 }
4161 else
4162 {
4163 Swaypoint waypoint;
4164 memcpy_s(&waypoint, sizeof(Swaypoint), &msg[2], sizeof(Swaypoint));
4165 WCHAR tokenchatline[STORE_CHAT_SIZE];
4166 tokenchatline[0] = msg[0]; // tokenized
4167 tokenchatline[1] = msg[1]; // token type
4168 memcpy_s(&tokenchatline[2], STORE_CHAT_SIZE, &waypoint, sizeof(Swaypoint));
4169
4170 chatchannel[t].chatline.emplace_back(tokenchatline);
4171 logger->Log("AddChatMessage was tokenized");
4172 }
4173 if (playerindex == 254)
4174 chatchannel[t].chatlineplayer.emplace_back("SERVER");
4175 else if (playerindex == 255)
4176 chatchannel[t].chatlineplayer.emplace_back("SUPPORT");
4177 else
4178 chatchannel[t].chatlineplayer.emplace_back(player[playerindex].callsign);
4179
4180 char str[99];
4181 sprintf_s(str, 99, "AddChatMessage was from %s (Channel %i Line %zu)", chatchannel[t].chatlineplayer.at(chatchannel[t].chatlineplayer.size() - 1).c_str(), t, chatchannel[t].chatline.size());
4182 logger->Log(str);
4183 char charmsg[999];
4184 sprintf_s(charmsg, 999, "%S", msg);
4185 logger->Log(charmsg);
4186
4188 {
4190 if (!chatchannel[t].dnd)
4191 {
4192 if (DialogBase::dialogs[D_COMMUNICATIONS]->activetab == t)
4194 else
4196 }
4197 }
4198 }
4199 t = MAX_TAB; // stop loop
4200 }
4201 }
4202}
4203
4204void HMI::AddPlayer(char* msg, unsigned char playerindex)
4205{
4206 int sex, serial, rank, context, joined;
4207 const int count = sscanf_s(msg, "%d,%[^,],%d,%d,%d,%d,%[^\n,],%[^\n]",
4208 &sex,
4209 player[playerindex].callsign, static_cast<unsigned>(sizeof(player[playerindex].callsign)),
4210 &context,
4211 &rank,
4212 &serial,
4213 &joined,
4214 player[playerindex].characterName, static_cast<unsigned>(sizeof(player[playerindex].characterName)),
4215 player[playerindex].extraText, static_cast<unsigned>(sizeof player[playerindex].extraText));
4216 if (count == 7)
4217 player[playerindex].extraText[0] = 0;
4218
4219 player[playerindex].sex = static_cast<char>(sex);
4220 player[playerindex].context = static_cast<char>(context);
4221 player[playerindex].rank = static_cast<char>(rank);
4222 // this is 0 until initialized
4223 player[playerindex].serial = static_cast<unsigned short>(serial);
4224 player[playerindex].createdate = static_cast<time_t>(joined);
4225
4226 WCHAR str[199];
4227 if (!player[playerindex].online)
4228 {
4229 chatchannel[0].AddPlayer(playerindex);
4230 swprintf_s(str, 199, L"Player logged on %S", player[playerindex].extraText);
4231 chatchannel[0].chatline.emplace_back(str);
4232 chatchannel[0].chatlineplayer.emplace_back(player[playerindex].callsign);
4233
4235 {
4237 if (!chatchannel[0].dnd)
4238 {
4243 }
4244 }
4245
4246 player[playerindex].online = true;
4247 }
4248 else
4249 {
4250 logger->Log("Could be this is the problem with blank callsign?", Logger::Level::Debug);
4251 }
4252
4255}
4256
4257void HMI::SetPlayerAlignment(char* msg, unsigned char playerindex)
4258{
4259 int i_temp1, i_temp2, i_temp3, i_temp4, i_temp5, i_temp6;
4260 sscanf_s(msg, "%[^,],%d,%d,%d,%d,%d,%d",
4261 player[playerindex].allianceName, static_cast<unsigned>(sizeof player[playerindex].allianceName), &i_temp1, &i_temp2, &i_temp3, &i_temp4, &i_temp5, &i_temp6);
4262 player[playerindex].allianceHeadId = static_cast<unsigned short>(i_temp1);
4263 if (!player[playerindex].allianceHeadId)
4264 player[playerindex].allianceName[0] = 0;
4265 player[playerindex].alignment = static_cast<char>(i_temp3);
4266
4267 int t = people.ResidesLocally(player[playerindex].serial);
4268 if (t)
4269 {
4270 SPlayerData playerData = people.LoadPerson(t);
4271
4272 strcpy_s(playerData.allianceName, sizeof playerData.allianceName, player[playerindex].allianceName);
4273 playerData.allianceHeadId = player[playerindex].allianceHeadId;
4274
4275 if (playerData.alignment != player[playerindex].alignment)
4276 {
4277 playerData.alignment = player[playerindex].alignment;
4278 for (t = 0; t < MAX_SCAN; t++)
4279 {
4280 // we can only do this with vehicles that we know about
4281 if (playerships[t].active)
4282 {
4283 const Sscan scan = game->bus->Scanner.Get(playerships[t].vehicleId);
4284 if (scan.initialized && scan.scandata.modeAC.ownerId == t)
4285 playerships[t].align = player[playerindex].alignment;
4286 }
4287 }
4290 }
4291
4292 people.SavePerson(t, playerData);
4293
4296 }
4297}
4298
4299void HMI::ChangeChannelName(unsigned char channelId, char* title)
4300{
4301 char msg[99];
4302 sprintf_s(msg, sizeof(msg), "Got new title for channel %i: %s", channelId, title);
4303 logger->Log(msg);
4304 for (short t = 1; t < MAX_TAB; t++)
4305 {
4306 if (chatchannel[t].channel == channelId)
4307 {
4308 sprintf_s(msg, sizeof(msg), "Found tab %i for channel %i title change!", t, channelId);
4309 logger->Log(msg);
4310 swprintf_s(chatchannel[t].title, MAX_TAB_CHARS - 5, L"%S", title);
4312 {
4314 }
4315 }
4316 }
4317}
4318
4319void HMI::ChannelInvite(char* title, unsigned char whoinvited, unsigned char channel, unsigned char players) const
4320{
4321 char msg[99];
4322 sprintf_s(msg, sizeof(msg), "Got new invite for channel %i player %i: %s", channel, whoinvited, title);
4323 logger->Log(msg);
4324
4326 {
4327 dynamic_cast<CommunicationsDialog*>(DialogBase::dialogs[D_COMMUNICATIONS])->ChannelInvite(title, whoinvited, channel, players);
4328 }
4329}
4330
4332{
4333 strcpy_s(player[ourplayerC].characterName, 30, prop->characterName);
4334 strcpy_s(player[ourplayerC].email, 32, prop->email);
4336
4348 player[ourplayerC].vision = prop->vision;
4349 player[ourplayerC].age = prop->age;
4351 player[ourplayerC].sex = prop->sex;
4355 player[ourplayerC].voice = prop->voice;
4356
4357 strcpy_s(player[ourplayerC].referrer, 13, prop->referrer); // optional
4358
4359 showerrors = 2; // yellow to start
4360 createRoute = false;
4361 changedVoice = false;
4362
4363 DisplayImmigration(false);
4364}
4365
4366void HMI::DisplayImmigration(bool refresh)
4367{
4368 logger->Log("DisplayImmigration()...");
4369
4371 std::wstring editedEmail;
4372 if (refresh)
4373 editedEmail = g_HUD.GetEditBox(IDC_EMAILADDRESS)->GetText();
4374 else
4375 {
4376 WCHAR savedEmail[32];
4377 swprintf_s(savedEmail, 32, L"%S", d.email);
4378 editedEmail = savedEmail;
4379 emailValidation.Reset(editedEmail);
4380 }
4381 oldfocus = -1;
4382 std::wstring editedWeight;
4383 if (refresh && d.revisitImmigration)
4384 {
4385 // Preserve annual edits (and the appearance in an existing snapshot) on language changes.
4386 editedWeight = g_HUD.GetEditBox(IDC_WEIGHT)->GetText();
4387 d.haircolor = static_cast<unsigned char>(g_HUD.GetComboBox(IDC_HAIRCOLOR)->GetSelectedIndex() + 1);
4388 d.eyecolor = static_cast<unsigned char>(g_HUD.GetComboBox(IDC_EYECOLOR)->GetSelectedIndex() + 1);
4389 d.skintone = static_cast<unsigned char>(g_HUD.GetSlider(IDC_SKINTONE)->GetValue());
4390 d.stubbleFreckle = static_cast<char>(g_HUD.GetSlider(IDC_STUBBLEFRECKLE)->GetValue());
4392 (g_HUD.GetRadioButton(IDC_IMPLANTS)->GetChecked() ? 2 : 3);
4393 d.framegroup = static_cast<short>(g_HUD.GetSlider(IDC_FRAMETYPE)->GetValue());
4394 d.nosegroup = static_cast<short>(g_HUD.GetSlider(IDC_NOSE)->GetValue());
4395 d.hairgroup = static_cast<short>(g_HUD.GetSlider(IDC_HAIRSTYLE)->GetValue());
4396 d.facialhair = static_cast<short>(g_HUD.GetSlider(IDC_FEATURE)->GetValue());
4397 }
4398
4399 if (!refresh)
4400 {
4401 if (d.characterName[0] && d.email[0] && // d.context &&
4402 d.eargroup && d.eyecolor && d.facialhair && d.framegroup &&
4403 d.haircolor && d.hairgroup && d.headgroup && d.heightCm &&
4404 d.jawline && d.nosegroup && d.skincolor && d.skintone && d.voice &&
4405 d.vision && d.age && d.hasAvatar && d.sex && d.weightKg && d.stubbleFreckle != -1 && !d.revisitImmigration)
4406 {
4407 networking->connectstatus = CONNECT_LOGGEDIN; //Its really dirty to do it in here, should move it later
4408 sound->loopintro = false;
4410 game->config.Save(); // every subsequent login we will save if autoLogin is ON
4411 logger->Log("Leaving DisplayImmigration(): complete profile");
4412 return;
4413 }
4414
4415 game->loadstage = 0;
4417 logger->Log("Advancing displaystage: STATUS_CREATE");
4418 if (createRoute)
4419 game->discord->UpdatePresence("Immigration Form", "Creating character...", "immigration");
4420 else
4421 game->discord->UpdatePresence("Immigration Form", "Updating character...", "immigration");
4422 }
4423
4425 g_HUD.Init(&g_DialogResourceManager, true, L"Textures\\dxutcontrols-immigration.png");
4427 g_HUD.SetScale(1.0f);
4429 g_HUD.SetFont(0, L"Lucida Handwriting", static_cast<int>(21.0f * game->displayscale), FW_NORMAL);
4430 g_HUD.SetFont(1, L"DejaVu Sans Mono", static_cast<int>(10.0f * game->displayscale), FW_LIGHT);
4431 g_HUD.SetFont(2, L"DejaVu Sans Mono", static_cast<int>(13.0f * game->displayscale), FW_EXTRALIGHT);
4432
4433 g_HUD.AddStatic(IDC_REPUBLICTEXT, strings[L_IMMIGRATION_REPUBLIC].c_str(), static_cast<int>(102.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), static_cast<int>(561.0f * game->displayscale), static_cast<int>(90.0f * game->displayscale), false, nullptr, false);
4434 g_HUD.GetStatic(IDC_REPUBLICTEXT)->GetElement(0)->SetFont(1, 0xFF09518d, DT_LEFT);
4435 g_HUD.AddStatic(IDC_SYSTEMTEXT, strings[L_IMMIGRATION_SYSTEM].c_str(), static_cast<int>(102.0f * game->displayscale), static_cast<int>(53.0f * game->displayscale), static_cast<int>(561.0f * game->displayscale), static_cast<int>(90.0f * game->displayscale), false, nullptr, false);
4436 g_HUD.GetStatic(IDC_SYSTEMTEXT)->GetElement(0)->SetFont(1, 0xFF5585ab, DT_LEFT);
4437 g_HUD.AddStatic(IDC_PROVINCETEXT, strings[L_IMMIGRATION_PROVINCE].c_str(), static_cast<int>(102.0f * game->displayscale), static_cast<int>(63.0f * game->displayscale), static_cast<int>(561.0f * game->displayscale), static_cast<int>(90.0f * game->displayscale), false, nullptr, false);
4438 g_HUD.GetStatic(IDC_PROVINCETEXT)->GetElement(0)->SetFont(1, 0xFF5585ab, DT_LEFT);
4439
4440 g_HUD.AddStatic(IDC_DISCLAIMERTEXT, strings[L_IMMIGRATION_DISCLAIMER].c_str(), static_cast<int>(500.0f * game->displayscale), static_cast<int>(37.0f * game->displayscale), static_cast<int>(171.0f * game->displayscale), static_cast<int>(42.0f * game->displayscale), false, nullptr, false);
4441 g_HUD.GetStatic(IDC_DISCLAIMERTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_RIGHT | DT_WORDBREAK);
4442 g_HUD.AddStatic(IDC_DEPARTMENTTEXT, strings[L_IMMIGRATION_DEPARTMENT].c_str(), static_cast<int>(37.0f * game->displayscale), static_cast<int>(102.0f * game->displayscale), static_cast<int>(263.0f * game->displayscale), static_cast<int>(90.0f * game->displayscale), false, nullptr, false);
4443 g_HUD.GetStatic(IDC_DEPARTMENTTEXT)->GetElement(0)->SetFont(1, 0xFF000000, DT_LEFT);
4444 g_HUD.AddStatic(IDC_DIVISIONTEXT, strings[L_IMMIGRATION_DIVISION].c_str(), static_cast<int>(37.0f * game->displayscale), static_cast<int>(113.0f * game->displayscale), static_cast<int>(263.0f * game->displayscale), static_cast<int>(90.0f * game->displayscale), false, nullptr, false);
4445 g_HUD.GetStatic(IDC_DIVISIONTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4446
4447 g_HUD.AddStatic(IDC_FORMTEXT, strings[L_IMMIGRATION_FORM].c_str(), static_cast<int>(364.0f * game->displayscale), static_cast<int>(89.0f * game->displayscale), static_cast<int>(307.0f * game->displayscale), static_cast<int>(35.0f * game->displayscale), false, nullptr, false);
4448 g_HUD.GetStatic(IDC_FORMTEXT)->GetElement(0)->SetFont(2, 0xFF5f5f5d, DT_RIGHT | DT_WORDBREAK | DT_BOTTOM);
4449
4450 g_HUD.AddStatic(IDC_LANGUAGELABEL, strings[L_CONFIG_LANGUAGE].c_str(), static_cast<int>(35.0f * game->displayscale), static_cast<int>(146.0f * game->displayscale), static_cast<int>(156.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4451 g_HUD.GetStatic(IDC_LANGUAGELABEL)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4452 g_HUD.AddComboBox(IDC_LANGUAGE, static_cast<int>(36.0f * game->displayscale), static_cast<int>(156.0f * game->displayscale), static_cast<int>(146.0f * game->displayscale), static_cast<int>(19.0f * game->displayscale));
4454 g_HUD.GetComboBox(IDC_LANGUAGE)->SetTextColor(0xFF000000, 0xFF000000);
4456 g_HUD.GetComboBox(IDC_LANGUAGE)->GetElement(0)->FontColor.Init(0xFF000000, 0xFF000000);
4461
4462 g_HUD.AddStatic(IDC_VOICELABEL, strings[L_IMMIGRATION_VOICE].c_str(), static_cast<int>(35.0f * game->displayscale), static_cast<int>(178.0f * game->displayscale), static_cast<int>(156.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4463 g_HUD.GetStatic(IDC_VOICELABEL)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4464 g_HUD.AddComboBox(IDC_VOICE, static_cast<int>(36.0f * game->displayscale), static_cast<int>(188.0f * game->displayscale), static_cast<int>(146.0f * game->displayscale), static_cast<int>(19.0f * game->displayscale));
4466 g_HUD.GetComboBox(IDC_VOICE)->SetTextColor(0xFF000000, 0xFF000000);
4468 g_HUD.GetComboBox(IDC_VOICE)->GetElement(0)->FontColor.Init(0xFF000000, 0xFF000000);
4471
4472 g_HUD.AddStatic(IDC_SEX, strings[L_IMMIGRATION_GENDER].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(146.0f * game->displayscale), static_cast<int>(98.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4473 g_HUD.GetStatic(IDC_SEX)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4474
4475 g_HUD.AddStatic(IDC_MALETEXT, strings[L_IMMIGRATION_MALE].c_str(), static_cast<int>(210.0f * game->displayscale), static_cast<int>(161.0f * game->displayscale), static_cast<int>(38.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4476 g_HUD.GetStatic(IDC_MALETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4477 g_HUD.AddRadioButton(IDC_MALE, IDC_SEX, L"", static_cast<int>(192.0f * game->displayscale), static_cast<int>(155.0f * game->displayscale), static_cast<int>(38.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false);
4478
4479 g_HUD.AddStatic(IDC_FEMALETEXT, strings[L_IMMIGRATION_FEMALE].c_str(), static_cast<int>(257.0f * game->displayscale), static_cast<int>(161.0f * game->displayscale), static_cast<int>(38.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4480 g_HUD.GetStatic(IDC_FEMALETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4481 g_HUD.AddRadioButton(IDC_FEMALE, IDC_SEX, L"", static_cast<int>(239.0f * game->displayscale), static_cast<int>(155.0f * game->displayscale), static_cast<int>(55.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false);
4482
4483 g_HUD.AddStatic(IDC_CHARNAMETEXT, strings[L_IMMIGRATION_NAME].c_str(), static_cast<int>(301.0f * game->displayscale), static_cast<int>(145.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4484 g_HUD.GetStatic(IDC_CHARNAMETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4485 g_HUD.AddEditBox(IDC_CHARNAME, L"", static_cast<int>(293.0f * game->displayscale), static_cast<int>(145.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4486
4487 g_HUD.AddButton(IDC_SUGGEST, strings[L_IMMIGRATION_SUGGEST].c_str(), static_cast<int>(620.0f * game->displayscale), static_cast<int>(143.0f * game->displayscale), static_cast<int>(42.0f * game->displayscale), static_cast<int>(16.0f * game->displayscale));
4491
4492 g_HUD.AddStatic(IDC_HANDLETEXT, strings[L_IMMIGRATION_CALLSIGN].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(178.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4493 g_HUD.GetStatic(IDC_HANDLETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4494 g_HUD.AddEditBox(IDC_HANDLE, L"", static_cast<int>(188.0f * game->displayscale), static_cast<int>(178.0f * game->displayscale), static_cast<int>(152.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4495
4496 WCHAR str[99];
4497 swprintf_s(str, 99, L"%S", game->config.defaultpass);
4498 g_HUD.AddStatic(IDC_PASSWORDTEXT, strings[L_IMMIGRATION_PASSWORD].c_str(), static_cast<int>(352.0f * game->displayscale), static_cast<int>(178.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4499 g_HUD.GetStatic(IDC_PASSWORDTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4500 g_HUD.AddEditBox(IDC_PASSWORD, str, static_cast<int>(345.0f * game->displayscale), static_cast<int>(178.0f * game->displayscale), static_cast<int>(156.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), false, true);
4502 g_HUD.AddStatic(IDC_PWVERIFYTEXT, strings[L_IMMIGRATION_CONFIRM].c_str(), static_cast<int>(512.0f * game->displayscale), static_cast<int>(178.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4503 g_HUD.GetStatic(IDC_PWVERIFYTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4504 g_HUD.AddEditBox(IDC_PWVERIFY, str, static_cast<int>(505.0f * game->displayscale), static_cast<int>(178.0f * game->displayscale), static_cast<int>(159.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), false, true);
4506
4507 g_HUD.AddStatic(IDC_EMAILTEXT, strings[L_IMMIGRATION_EMAIL].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(210.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4508 g_HUD.GetStatic(IDC_EMAILTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4509 g_HUD.AddEditBox(IDC_EMAILADDRESS, editedEmail.c_str(), static_cast<int>(187.0f * game->displayscale), static_cast<int>(211.0f * game->displayscale), static_cast<int>(360.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4510
4511 g_HUD.AddStatic(IDC_AGETEXT, strings[L_IMMIGRATION_AGE].c_str(), static_cast<int>(545.0f * game->displayscale), static_cast<int>(210.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4512 g_HUD.GetStatic(IDC_AGETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4513 g_HUD.AddEditBox(IDC_AGE, L"", static_cast<int>(538.0f * game->displayscale), static_cast<int>(209.0f * game->displayscale), static_cast<int>(63.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4514
4515 g_HUD.AddStatic(IDC_WEIGHTTEXT, strings[L_IMMIGRATION_WEIGHT].c_str(), static_cast<int>(609.0f * game->displayscale), static_cast<int>(210.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4516 g_HUD.GetStatic(IDC_WEIGHTTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4517 g_HUD.AddEditBox(IDC_WEIGHT, L"", static_cast<int>(599.0f * game->displayscale), static_cast<int>(209.0f * game->displayscale), static_cast<int>(92.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4518
4519 g_HUD.AddStatic(IDC_HEIGHTTEXT, strings[L_IMMIGRATION_HEIGHT].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(242.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4520 g_HUD.GetStatic(IDC_HEIGHTTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4521 g_HUD.AddEditBox(IDC_HEIGHT, L"", static_cast<int>(186.0f * game->displayscale), static_cast<int>(241.0f * game->displayscale), static_cast<int>(64.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4522
4523 g_HUD.AddStatic(IDC_HAIRCOLORTEXT, strings[L_IMMIGRATION_HAIRCOLOR].c_str(), static_cast<int>(260.0f * game->displayscale), static_cast<int>(242.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4524 g_HUD.GetStatic(IDC_HAIRCOLORTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4525 g_HUD.AddComboBox(IDC_HAIRCOLOR, static_cast<int>(261.0f * game->displayscale), static_cast<int>(252.0f * game->displayscale), static_cast<int>(203.0f * game->displayscale), static_cast<int>(19.0f * game->displayscale));
4527 g_HUD.GetComboBox(IDC_HAIRCOLOR)->SetDropHeight(24 * 14, static_cast<int>(14.0f * game->displayscale));
4528 g_HUD.GetComboBox(IDC_HAIRCOLOR)->SetTextColor(0xFF000000, 0xFF000000);
4530 g_HUD.GetComboBox(IDC_HAIRCOLOR)->GetElement(0)->FontColor.Init(0xFF000000, 0xFF000000);
4533 for (int i = 0; i < 24; i++)
4535
4536 /*g_HUD.AddComboBox(IDC_EMPHASIS, static_cast<int>(353.0f * game->displayscaley), static_cast<int>(424.0f * game->displayscaley), static_cast<int>(202.0f * game->displayscaley), static_cast<int>(39.0f * game->displayscaley));
4537 g_HUD.GetComboBox(IDC_EMPHASIS)->SetDropHeight(static_cast<int>(24.0f, 14.0f * gui->game->displayscale));
4538 g_HUD.GetComboBox(IDC_EMPHASIS)->SetTextColor(0xFF000000, 0xFF000000);
4539 g_HUD.GetComboBox(IDC_EMPHASIS)->GetElement(0)->dwTextFormat = DT_LEFT | DT_BOTTOM;
4540 g_HUD.GetComboBox(IDC_EMPHASIS)->GetElement(2)->iFont = 1;
4541 g_HUD.GetComboBox(IDC_EMPHASIS)->GetElement(3)->iFont = 1;
4542 g_HUD.GetComboBox(IDC_EMPHASIS)->AddItem(L"", nullptr);
4543 g_HUD.GetComboBox(IDC_EMPHASIS)->AddItem(L"Military", nullptr);
4544 g_HUD.GetComboBox(IDC_EMPHASIS)->AddItem(L"Civilian", nullptr);
4545 g_HUD.GetComboBox(IDC_EMPHASIS)->AddItem(L"Business", nullptr);
4546 g_HUD.GetComboBox(IDC_EMPHASIS)->SetSelectedByIndex(1);*/
4547
4548 g_HUD.AddStatic(IDC_EYECOLORTEXT, strings[L_IMMIGRATION_EYECOLOR].c_str(), static_cast<int>(467.0f * game->displayscale), static_cast<int>(242.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4549 g_HUD.GetStatic(IDC_EYECOLORTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4550 g_HUD.AddComboBox(IDC_EYECOLOR, static_cast<int>(467.0f * game->displayscale), static_cast<int>(252.0f * game->displayscale), static_cast<int>(204.0f * game->displayscale), static_cast<int>(19.0f * game->displayscale));
4552 g_HUD.GetComboBox(IDC_EYECOLOR)->SetDropHeight(6 * 14, static_cast<int>(14.0f * game->displayscale));
4553 g_HUD.GetComboBox(IDC_EYECOLOR)->SetTextColor(0xFF000000, 0xFF000000);
4555 g_HUD.GetComboBox(IDC_EYECOLOR)->GetElement(0)->FontColor.Init(0xFF000000, 0xFF000000);
4558 for (int i = 0; i < 6; i++)
4560
4561 g_HUD.AddStatic(IDC_SKINCOLORTEXT, strings[L_IMMIGRATION_SKINCOLOR].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(274.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4562 g_HUD.GetStatic(IDC_SKINCOLORTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4563 g_HUD.AddSlider(IDC_SKINCOLOR, static_cast<int>(256.0f * game->displayscale), static_cast<int>(271.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 1, 255, rand() % 255 + 1);
4564
4565 g_HUD.AddStatic(IDC_SKINTONETEXT, strings[L_IMMIGRATION_SKINTONE].c_str(), static_cast<int>(435.0f * game->displayscale), static_cast<int>(274.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4566 g_HUD.GetStatic(IDC_SKINTONETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4567 g_HUD.AddSlider(IDC_SKINTONE, static_cast<int>(493.0f * game->displayscale), static_cast<int>(271.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 1, 255, rand() % 255 + 1);
4568
4569 g_HUD.AddStatic(IDC_VISION, strings[L_IMMIGRATION_VISION].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(306.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4570 g_HUD.GetStatic(IDC_VISION)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4571 const int randomVision = rand() % 3 + 1;
4572 g_HUD.AddStatic(IDC_VISION1TEXT, strings[L_IMMIGRATION_VISION1].c_str(), static_cast<int>(210.0f * game->displayscale), static_cast<int>(322.0f * game->displayscale), static_cast<int>(38.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4573 g_HUD.GetStatic(IDC_VISION1TEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4574 g_HUD.AddRadioButton(IDC_NORMAL, IDC_VISION, L"", static_cast<int>(192.0f * game->displayscale), static_cast<int>(316.0f * game->displayscale), static_cast<int>(45.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), randomVision == 1);
4575 g_HUD.AddStatic(IDC_VISION2TEXT, strings[L_IMMIGRATION_VISION2].c_str(), static_cast<int>(267.0f * game->displayscale), static_cast<int>(322.0f * game->displayscale), static_cast<int>(38.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4576 g_HUD.GetStatic(IDC_VISION2TEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4577 g_HUD.AddRadioButton(IDC_IMPLANTS, IDC_VISION, L"", static_cast<int>(249.0f * game->displayscale), static_cast<int>(316.0f * game->displayscale), static_cast<int>(55.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), randomVision == 2);
4578 g_HUD.AddStatic(IDC_VISION3TEXT, strings[L_IMMIGRATION_VISION3].c_str(), static_cast<int>(332.0f * game->displayscale), static_cast<int>(322.0f * game->displayscale), static_cast<int>(38.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4579 g_HUD.GetStatic(IDC_VISION3TEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4580 g_HUD.AddRadioButton(IDC_FRAMES, IDC_VISION, L"", static_cast<int>(314.0f * game->displayscale), static_cast<int>(316.0f * game->displayscale), static_cast<int>(55.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), randomVision == 3);
4581
4582 g_HUD.AddStatic(IDC_FRAMESTEXT, strings[L_IMMIGRATION_FRAMES].c_str(), static_cast<int>(435.0f * game->displayscale), static_cast<int>(306.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4583 g_HUD.GetStatic(IDC_FRAMESTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4584 g_HUD.AddSlider(IDC_FRAMETYPE, static_cast<int>(493.0f * game->displayscale), static_cast<int>(303.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 451, 453, 451);
4585 g_HUD.GetControl(IDC_FRAMETYPE)->SetVisible(randomVision == 3);
4586
4587 g_HUD.AddStatic(IDC_HEADTEXT, strings[L_IMMIGRATION_HEAD].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(338.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4588 g_HUD.GetStatic(IDC_HEADTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4589 g_HUD.AddSlider(IDC_HEAD, static_cast<int>(256.0f * game->displayscale), static_cast<int>(335.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 151, 153, rand() % 5 + 150);
4590
4591 g_HUD.AddStatic(IDC_JAWTEXT, strings[L_IMMIGRATION_JAW].c_str(), static_cast<int>(435.0f * game->displayscale), static_cast<int>(338.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4592 g_HUD.GetStatic(IDC_JAWTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4593 g_HUD.AddSlider(IDC_JAWLINE, static_cast<int>(493.0f * game->displayscale), static_cast<int>(335.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 676, 680, rand() % 5 + 676);
4594
4595 g_HUD.AddStatic(IDC_NOSETEXT, strings[L_IMMIGRATION_NOSE].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(370.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4596 g_HUD.GetStatic(IDC_NOSETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4597 g_HUD.AddSlider(IDC_NOSE, static_cast<int>(256.0f * game->displayscale), static_cast<int>(367.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 101, 104, rand() % 4 + 101);
4598
4599 g_HUD.AddStatic(IDC_EARSTEXT, strings[L_IMMIGRATION_EARS].c_str(), static_cast<int>(435.0f * game->displayscale), static_cast<int>(370.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4600 g_HUD.GetStatic(IDC_EARSTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4601 g_HUD.AddSlider(IDC_EARS, static_cast<int>(493.0f * game->displayscale), static_cast<int>(367.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 226, 228, rand() % 5 + 226);
4602
4603 g_HUD.AddStatic(IDC_HAIRSTYLETEXT, strings[L_IMMIGRATION_HAIRSTYLE].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(402.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4604 g_HUD.GetStatic(IDC_HAIRSTYLETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4605 g_HUD.AddSlider(IDC_HAIRSTYLE, static_cast<int>(256.0f * game->displayscale), static_cast<int>(399.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 175, 179, rand() % 5 + 175);
4606
4607 // Female is UNUSED, Freckles ... Men is Beard, Stubble
4608 g_HUD.AddStatic(IDC_FEATURETEXT, L"", static_cast<int>(435.0f * game->displayscale), static_cast<int>(402.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4609 g_HUD.GetStatic(IDC_FEATURETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4610 g_HUD.AddSlider(IDC_FEATURE, static_cast<int>(493.0f * game->displayscale), static_cast<int>(399.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 125, 127, rand() % 3 + 125);
4611
4612 g_HUD.AddStatic(IDC_STUBBLEFRECKLETEXT, L"", static_cast<int>(435.0f * game->displayscale), static_cast<int>(434.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4613 g_HUD.GetStatic(IDC_STUBBLEFRECKLETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4614 const int randomStubble = rand() % 101;
4615 stubbleFreckle = static_cast<float>(randomStubble) * 0.01f;
4616 g_HUD.AddSlider(IDC_STUBBLEFRECKLE, static_cast<int>(493.0f * game->displayscale), static_cast<int>(431.0f * game->displayscale), static_cast<int>(163.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), 0, 100, randomStubble);
4617
4618 g_HUD.AddStatic(IDC_REFERRALTEXT, strings[L_IMMIGRATION_REFERRAL].c_str(), static_cast<int>(196.0f * game->displayscale), static_cast<int>(434.0f * game->displayscale), static_cast<int>(321.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale), NULL, nullptr, false);
4619 g_HUD.GetStatic(IDC_REFERRALTEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4620 g_HUD.AddEditBox(IDC_REFERRAL, L"", static_cast<int>(187.0f * game->displayscale), static_cast<int>(435.0f * game->displayscale), static_cast<int>(152.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4621
4622 g_HUD.AddButton(IDC_SNAPSHOT, strings[L_IMMIGRATION_SNAPSHOT].c_str(), static_cast<int>(50.0f * game->displayscale), static_cast<int>(399.0f * game->displayscale), static_cast<int>(70.0f * game->displayscale), static_cast<int>(16.0f * game->displayscale));
4626
4627 g_HUD.AddButton(IDC_VOID, strings[L_IMMIGRATION_VOID].c_str(), static_cast<int>(131.0f * game->displayscale), static_cast<int>(399.0f * game->displayscale), static_cast<int>(42.0f * game->displayscale), static_cast<int>(16.0f * game->displayscale));
4628 g_HUD.GetButton(IDC_VOID)->SetTextColor(0xFF5F5F5F);
4632
4633 // Sligo noticed this on 8/11/2025 that we were doing the statement text twice!
4634 g_HUD.AddStatic(IDC_STATEMENTLABEL, strings[L_IMMIGRATION_STATEMENT].c_str(), static_cast<int>(35.0f * game->displayscale), static_cast<int>(530.0f * game->displayscale), static_cast<int>(156.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4635 g_HUD.GetStatic(IDC_STATEMENTLABEL)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4636 g_HUD.AddStatic(IDC_STATEMENTTEXT, strings[L_IMMIGRATION_STATEMENTTEXT].c_str(), static_cast<int>(72.0f * game->displayscale), static_cast<int>(550.0f * game->displayscale), static_cast<int>(561.0f * game->displayscale), static_cast<int>(90.0f * game->displayscale), false, nullptr, false);
4637 g_HUD.GetStatic(IDC_STATEMENTTEXT)->GetElement(0)->SetFont(2, 0xFF000000, DT_LEFT | DT_WORDBREAK);
4638
4639 g_HUD.AddStatic(IDC_PROOF, strings[L_IMMIGRATION_PROOF].c_str(), static_cast<int>(35.0f * game->displayscale), static_cast<int>(658.0f * game->displayscale), static_cast<int>(156.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4640 g_HUD.GetStatic(IDC_PROOF)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4641
4642 g_HUD.AddEditBox(IDC_SIGNATUREHINT, L"", static_cast<int>(25.0f * game->displayscale), static_cast<int>(657.0f * game->displayscale), static_cast<int>(575.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4645
4646 g_HUD.AddStatic(IDC_SIGNHERE, strings[L_IMMIGRATION_SIGNHERE].c_str(), static_cast<int>(368.0f * game->displayscale), static_cast<int>(665.0f * game->displayscale), static_cast<int>(89.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4647 g_HUD.GetStatic(IDC_SIGNHERE)->GetElement(0)->SetFont(2, 0xFF000000, DT_RIGHT);
4648
4649 g_HUD.AddEditBox(IDC_SIGNATURE, L"", static_cast<int>(25.0f * game->displayscale), static_cast<int>(657.0f * game->displayscale), static_cast<int>(575.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4650
4651 g_HUD.AddStatic(IDC_DATETEXT, strings[L_IMMIGRATION_DATE].c_str(), static_cast<int>(477.0f * game->displayscale), static_cast<int>(658.0f * game->displayscale), static_cast<int>(156.0f * game->displayscale), static_cast<int>(20.0f * game->displayscale), false, nullptr, false);
4652 g_HUD.GetStatic(IDC_DATETEXT)->GetElement(0)->SetFont(1, 0xFF5f5f5d, DT_LEFT);
4653 time_t ltime;
4654 time(&ltime);
4655 tm tm_time{};
4656 _localtime64_s(&tm_time, &ltime);
4657 swprintf_s(str, 99, L"%02i/%02i/%04i", tm_time.tm_mon + 1, tm_time.tm_mday, tm_time.tm_year + 1900 + 225);
4658 g_HUD.AddEditBox(IDC_DATE, str, static_cast<int>(466.0f * game->displayscale), static_cast<int>(657.0f * game->displayscale), static_cast<int>(130.0f * game->displayscale), static_cast<int>(39.0f * game->displayscale));
4660
4661 g_HUD.AddButton(IDC_CONFIRM, strings[L_IMMIGRATION_SUBMIT].c_str(), static_cast<int>(618.0f * game->displayscale), static_cast<int>(654.0f * game->displayscale), static_cast<int>(42.0f * game->displayscale), static_cast<int>(16.0f * game->displayscale));
4665
4666 if (createRoute)
4667 g_HUD.AddButton(IDC_BACK, strings[L_IMMIGRATION_CANCEL].c_str(), static_cast<int>(620.0f * game->displayscale), static_cast<int>(7.0f * game->displayscale), static_cast<int>(42.0f * game->displayscale), static_cast<int>(16.0f * game->displayscale));
4668 else
4669 g_HUD.AddButton(IDC_BACK, strings[L_IMMIGRATION_QUIT].c_str(), static_cast<int>(620.0f * game->displayscale), static_cast<int>(7.0f * game->displayscale), static_cast<int>(42.0f * game->displayscale), static_cast<int>(16.0f * game->displayscale));
4670 g_HUD.GetButton(IDC_BACK)->SetTextColor(0xFF5F5F5F);
4673
4674 if (!refresh)
4675 {
4676 // set up the window for immigration
4677 RECT rect;
4678 if (!GetWindowRect(Rendering::ClientWindow(), &rect))
4679 {
4680 char msg[99];
4681 sprintf_s(msg, sizeof msg, "Error in GetWindowRect: %d", GetLastError());
4682 logger->Log(msg, Logger::Fatal);
4683 return;
4684 }
4685
4686 // Match Immigration.png, including its bottom border and paper margin.
4687 const int width = static_cast<int>(700.0f * game->displayscale);
4688 const int windowHeight = static_cast<int>(721.0f * game->displayscale);
4689 const int y = (rect.top + rect.bottom - windowHeight) / 2;
4690 if (!MoveWindow(Rendering::ClientWindow(), rect.left, y, width, windowHeight, true))
4691 {
4692 char msg[99];
4693 sprintf_s(msg, sizeof msg, "Error in MoveWindow: %d", GetLastError());
4694 logger->Log(msg, Logger::Fatal);
4695 return;
4696 }
4697 //DXUTReset3DEnvironment();
4698 }
4699
4700 // Restore numeric fields before loading the model, also when a snapshot locks the form.
4701 if (d.age)
4702 {
4703 swprintf_s(str, 99, L"%i", d.age);
4705 age = (static_cast<float>(d.age) - 18.0f) / 62.0f;
4706 }
4707 if (d.heightCm)
4708 {
4709 swprintf_s(str, 99, L"%i", d.heightCm);
4711 }
4712 if (d.weightKg)
4713 {
4714 swprintf_s(str, 99, L"%i", d.weightKg);
4716 }
4717 if (refresh && d.revisitImmigration)
4718 g_HUD.GetEditBox(IDC_WEIGHT)->SetText(editedWeight.c_str());
4719
4720 // Establish sex-specific mesh ranges before applying saved selections, including on refresh.
4721 if (d.sex)
4722 {
4725 SexChangeOperation(d.sex, false);
4726 oldSex = d.sex;
4727 if (d.heightCm)
4728 height = static_cast<float>(d.heightCm) / ((maxHeight + minHeight) * 0.5f);
4729 if (_wtoi(g_HUD.GetEditBox(IDC_WEIGHT)->GetText()) > 0)
4730 weight = static_cast<float>(_wtoi(g_HUD.GetEditBox(IDC_WEIGHT)->GetText())) / ((maxWeight + minWeight) * 0.5f);
4731 }
4732 else
4733 oldSex = 0;
4734
4735 if (d.haircolor)
4737 if (d.eyecolor)
4744 stubbleFreckle = static_cast<float>(g_HUD.GetSlider(IDC_STUBBLEFRECKLE)->GetValue()) * 0.01f;
4745 if (d.vision >= 1 && d.vision <= 3)
4746 {
4750 }
4758
4761 {
4766 }
4767 logger->Log("DisplayImmigration() exit!");
4768}
4769
4771{
4772 logger->AddToCallStack("HMI::DrawRXTXLights");
4773
4774 if (rxlight)
4775 {
4776 RiseMath::Vector3 tempvec = RiseMath::Vector3(2, 2, 0);
4777 g_pTextSprite->Draw(*tex, nullptr, nullptr, &tempvec, 0xFFFFFFFF);
4778 }
4779 if (txlight)
4780 {
4781 RiseMath::Vector3 tempvec = RiseMath::Vector3(20, 2, 0);
4782 g_pTextSprite->Draw(*tex, nullptr, nullptr, &tempvec, 0xFFFFFFFF);
4783 }
4784
4785 logger->AddToCallStack("HMI::DrawRXTXLights DONE");
4786}
4787
4788bool HMI::GetImmigrationEmail(char (&email)[32])
4789{
4791 const auto& value = emailValidation.Value();
4792 BOOL substituted = FALSE;
4793 const bool utf8 = GetACP() == CP_UTF8;
4794 // Use the same complete byte string for validation and saving; never silently truncate it.
4795 const int size = WideCharToMultiByte(CP_ACP, utf8 ? WC_ERR_INVALID_CHARS : WC_NO_BEST_FIT_CHARS, value.c_str(), -1,
4796 email, 32, nullptr, utf8 ? nullptr : &substituted);
4797 if (!size || substituted || !email[0])
4798 {
4799 email[0] = 0;
4801 return false;
4802 }
4803 return true;
4804}
4805
4807{
4808 char email[32];
4809 if (!GetImmigrationEmail(email)) return;
4810 const int token = emailValidation.BeginCheck(GetTickCount64());
4811 if (!token) return;
4812 SPacketBig packet{};
4813 packet.type = 24;
4814 packet.array = 3;
4815 packet.vehicleId = token;
4816 strcpy_s(packet.msg, sizeof(packet.msg), email);
4817 networking->SendToServer(&packet, sizeof(packet), true);
4818 txbuffer += sizeof(packet);
4819}
4820
4821void HMI::ReceiveEmailValidation(float token, bool passed, float reason)
4822{
4823 // Observe text immediately too: packets can arrive before the next frame update.
4825 const auto reply = emailValidation.Receive(token, passed, reason == 9.0f);
4826 if (reply == ImmigrationEmail::State::Reply::Ignored) return;
4828 {
4831 g_HUD.GetButton(IDC_SUGGEST)->SetEnabled(!player[ourplayerC].characterName[0]);
4837 showerrors = 1;
4838 }
4839 if (!passed)
4840 {
4841 const WCHAR* message = reason == 3.0f ? strings[L_MESSAGE_DUPLICATE].c_str() :
4842 (reason == 8.0f ? strings[L_MESSAGE_INVALID].c_str() :
4843 L"Email validation is temporarily unavailable. Please try again.");
4844 MessageBoxW(Rendering::ClientWindow(), message, strings[L_MESSAGE_EMAIL].c_str(), MB_ICONEXCLAMATION | MB_OK);
4845 }
4846}
4847
4848void HMI::DrawErrorBoxes(bool draw)
4849{
4850 logger->AddToCallStack("HMI::DrawErrorBoxes");
4851
4852 RECT rect;
4853 // highlight boxes red (if showerrors==true and are bad) or gray if they are !enabled
4854 RiseMath::Vector3 tempvec;
4855 haserrors = false;
4856
4857 // sex
4858 DWORD tempcolor = 0;
4860 {
4861 if (showerrors == 1)
4862 tempcolor = 0xFFFF9A9C;
4863 else if (showerrors == 2)
4864 tempcolor = 0xFFFDFB43;
4865 haserrors = true;
4866 }
4867 if (draw && tempcolor)
4868 {
4869 rect.left = 194; rect.top = 144; rect.right = 298; rect.bottom = 175;
4870 tempvec = RiseMath::Vector3(194, 144, 0);
4871 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
4872 }
4873
4874 // charname
4875 tempcolor = 0;
4876 char playername[30];
4877 sprintf_s(playername, 30, "%.29S", g_HUD.GetEditBox(IDC_CHARNAME)->GetText());
4878 if (!playername[0] || charnameValid != 2)
4879 {
4880 if (charnameValid == 1) // checking
4881 tempcolor = 0xFF9B9A9C;
4882 else if (showerrors || charnameValid == 0)
4883 {
4884 if (showerrors == 1 || charnameValid == 0)
4885 tempcolor = 0xFFFF9A9C;
4886 else if (showerrors == 2)
4887 tempcolor = 0xFFFDFB43;
4888 }
4889 haserrors = true;
4890 }
4891 if (draw && tempcolor)
4892 {
4893 rect.left = 299; rect.top = 144; rect.right = 672; rect.bottom = 175;
4894 tempvec = RiseMath::Vector3(299, 144, 0);
4895 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
4896 }
4897
4898 // email
4899 tempcolor = 0;
4900 char email[32];
4901 const bool fitsEmailPacket = GetImmigrationEmail(email);
4902 const int emailValid = emailValidation.Status();
4903 if (!fitsEmailPacket || emailValid != ImmigrationEmail::State::Passed)
4904 {
4905 if (emailValid == 1) // checking
4906 tempcolor = 0xFF9B9A9C;
4907 else if (showerrors || emailValid == 0)
4908 {
4909 if (showerrors == 1 || emailValid == 0)
4910 tempcolor = 0xFFFF9A9C;
4911 else if (showerrors == 2)
4912 tempcolor = 0xFFFDFB43;
4913 }
4914 haserrors = true;
4915 }
4916 if (draw && tempcolor)
4917 {
4918 rect.left = 194; rect.top = 208; rect.right = 542; rect.bottom = 239;
4919 tempvec = RiseMath::Vector3(194, 208, 0);
4920 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
4921 }
4922
4923 // callsign
4924 tempcolor = 0;
4925 char callsign[16];
4926 sprintf_s(callsign, 16, "%.15S", g_HUD.GetEditBox(IDC_HANDLE)->GetText());
4927 if (strlen(callsign) < 2 || handleValid != 2)
4928 {
4929 if (handleValid == 1) // checking
4930 tempcolor = 0xFF9B9A9C;
4931 else if (showerrors || handleValid == 0)
4932 {
4933 if (showerrors == 1 || handleValid == 0)
4934 tempcolor = 0xFFFF9A9C;
4935 else if (showerrors == 2)
4936 tempcolor = 0xFFFDFB43;
4937 }
4938 haserrors = true;
4939 }
4940 if (draw && tempcolor)
4941 {
4942 rect.left = 194; rect.top = 176; rect.right = 349; rect.bottom = 207;
4943 tempvec = RiseMath::Vector3(194, 176, 0);
4944 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
4945 }
4946
4947 // password
4948 tempcolor = 0;
4949 char password[16];
4950 sprintf_s(password, 16, "%.15S", g_HUD.GetEditBox(IDC_PASSWORD)->GetText());
4951 if (!password[0])
4952 {
4953 if (showerrors == 1)
4954 tempcolor = 0xFFFF9A9C;
4955 else if (showerrors == 2)
4956 tempcolor = 0xFFFDFB43;
4957 haserrors = true;
4958 }
4959 if (draw && tempcolor)
4960 {
4961 rect.left = 350; rect.top = 176; rect.right = 509; rect.bottom = 207;
4962 tempvec = RiseMath::Vector3(350, 176, 0);
4963 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
4964 }
4965
4966 // confirmpassword
4967 tempcolor = 0;
4968 char confirm[16];
4969 sprintf_s(confirm, 16, "%.15S", g_HUD.GetEditBox(IDC_PWVERIFY)->GetText());
4970 if (_strcmpi(password, confirm) != 0 || !confirm[0])
4971 {
4972 if (showerrors)
4973 tempcolor = 0xFFFF9A9C;
4974 haserrors = true;
4975 }
4976 if (draw && tempcolor)
4977 {
4978 rect.left = 510; rect.top = 176; rect.right = 672; rect.bottom = 207;
4979 tempvec = RiseMath::Vector3(510, 176, 0);
4980 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
4981 }
4982
4983 // picture
4984 tempcolor = 0;
4985 if (!pBuffer)
4986 {
4987 if (showerrors == 1)
4988 tempcolor = 0xFFFF9A9C;
4989 else if (showerrors == 2)
4990 tempcolor = 0xFFFDFB43;
4991 haserrors = true;
4992 }
4993 if (draw && tempcolor)
4994 {
4995 rect.left = 33; rect.top = 255; rect.right = 193; rect.bottom = 415;
4996 tempvec = RiseMath::Vector3(33, 255, 0);
4997 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
4998 }
4999
5000 // referred by
5001 char referredby[13];
5002 sprintf_s(referredby, 13, "%.12S", g_HUD.GetEditBox(IDC_REFERRAL)->GetText());
5003 // have to do this client-side since server doesn't have both pieces
5004 if (referredby[0]) // referral has value
5005 {
5006 if (referredby[0] && _strcmpi(callsign, referredby) == 0) // can't be the same
5007 referralValid = 0;
5008 }
5009 else
5010 referralValid = 2;
5011
5012 tempcolor = 0;
5013 if (referralValid != 2) // checking or invalid
5014 {
5015 if (referralValid == 1) // checking
5016 tempcolor = 0xFF9B9A9C;
5017 else if (showerrors || referralValid == 0)
5018 {
5019 if (showerrors == 1 || referralValid == 0)
5020 tempcolor = 0xFFFF9A9C;
5021 else if (showerrors == 2)
5022 tempcolor = 0xFFFDFB43;
5023 }
5024 haserrors = true;
5025 }
5026 if (draw && tempcolor)
5027 {
5028 rect.left = 194; rect.top = 433; rect.right = 349; rect.bottom = 464;
5029 tempvec = RiseMath::Vector3(194, 433, 0);
5030 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
5031 }
5032
5034 //rect.left=350; rect.top=208; rect.right=509; rect.bottom=239;
5035 //tempvec = RiseMath::Vector3(350, 208, 0);
5036 //g_pTextSprite->Draw(GUI.m_pddsGUIInterlace, &rect, NULL, &tempvec, 0xFFFF8080);
5037
5038 // age
5039 tempcolor = 0;
5040 WCHAR wcdefault[4];
5041 swprintf_s(wcdefault, 4, L"%.2s", g_HUD.GetEditBox(IDC_AGE)->GetText());
5042 if (_wtoi(wcdefault) < 18 || _wtoi(wcdefault) > 80)
5043 {
5044 if (showerrors == 1)
5045 tempcolor = 0xFFFF9A9C;
5046 else if (showerrors == 2)
5047 tempcolor = 0xFFFDFB43;
5048 haserrors = true;
5049 }
5050 if (draw && tempcolor)
5051 {
5052 rect.left = 543; rect.top = 208; rect.right = 606; rect.bottom = 239;
5053 tempvec = RiseMath::Vector3(543, 208, 0);
5054 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
5055 }
5056
5057 // weight
5058 tempcolor = 0;
5059 swprintf_s(wcdefault, 4, L"%.3s", g_HUD.GetEditBox(IDC_WEIGHT)->GetText());
5060 const auto weightRange = ImmigrationRules::GetWeightRange(
5061 static_cast<int>(minWeight), static_cast<int>(maxWeight),
5062 player[ourplayerC].weightKg, player[ourplayerC].revisitImmigration);
5063 if (!minWeight || !weightRange.Contains(_wtoi(wcdefault)))
5064 {
5065 if (showerrors == 1)
5066 tempcolor = 0xFFFF9A9C;
5067 else if (showerrors == 2)
5068 tempcolor = 0xFFFDFB43;
5069 haserrors = true;
5070 }
5071 if (draw && tempcolor)
5072 {
5073 rect.left = 607; rect.top = 208; rect.right = 672; rect.bottom = 239;
5074 tempvec = RiseMath::Vector3(607, 208, 0);
5075 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
5076 }
5077
5078 // height
5079 tempcolor = 0;
5080 swprintf_s(wcdefault, 4, L"%.3s", g_HUD.GetEditBox(IDC_HEIGHT)->GetText());
5081 if (!minHeight || _wtoi(wcdefault) < minHeight || _wtoi(wcdefault) > maxHeight)
5082 {
5083 if (showerrors == 1)
5084 tempcolor = 0xFFFF9A9C;
5085 else if (showerrors == 2)
5086 tempcolor = 0xFFFDFB43;
5087 haserrors = true;
5088 }
5089 if (draw && tempcolor)
5090 {
5091 rect.left = 194; rect.top = 240; rect.right = 257; rect.bottom = 271;
5092 tempvec = RiseMath::Vector3(194, 240, 0);
5093 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
5094 }
5095
5096 // vision
5097 tempcolor = 0;
5101 {
5102 if (showerrors == 1)
5103 tempcolor = 0xFFFF9A9C;
5104 else if (showerrors == 2)
5105 tempcolor = 0xFFFDFB43;
5106 haserrors = true;
5107 }
5108 if (draw && tempcolor)
5109 {
5110 rect.left = 194; rect.top = 176 + 128; rect.right = 349 + 83; rect.bottom = 207 + 128;
5111 tempvec = RiseMath::Vector3(194, 176 + 128, 0);
5112 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
5113 }
5114
5115 // signature
5116 WCHAR wcdefault3[99], wcdefault4[99];
5117 tempcolor = 0;
5118 g_HUD.GetEditBox(IDC_SIGNATURE)->GetTextCopy(wcdefault3, 99);
5119 g_HUD.GetEditBox(IDC_CHARNAME)->GetTextCopy(wcdefault4, 99);
5120 if (wcscmp(wcdefault3, wcdefault4) != 0 || !wcdefault3[0] || !wcdefault4[0])
5121 {
5122 if (showerrors == 1)
5123 tempcolor = 0xFFFF9A9C;
5124 else if (showerrors == 2)
5125 tempcolor = 0xFFFDFB43;
5126 haserrors = true;
5127 }
5128 if (draw && tempcolor)
5129 {
5130 rect.left = 33; rect.top = 656; rect.right = 672; rect.bottom = 689;
5131 tempvec = RiseMath::Vector3(33, 656, 0);
5132 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
5133 }
5134
5135 // hair color
5136 const int hairindex = g_HUD.GetComboBox(IDC_HAIRCOLOR)->GetSelectedIndex() + 1;
5137 haircolor = GetHairColorAtIndex(hairindex);
5138
5139 // eye color
5140 const int eyeindex = g_HUD.GetComboBox(IDC_EYECOLOR)->GetSelectedIndex() + 1;
5141 eyecolor = GetEyeColorAtIndex(eyeindex);
5142
5143 // voice
5144 tempcolor = 0;
5145 const int voiceIndex = g_HUD.GetComboBox(IDC_VOICE)->GetSelectedIndex();
5146 if (voiceIndex == 0)
5147 {
5148 if (showerrors == 1 && (createRoute || voiceIndex == 0))
5149 tempcolor = 0xFFFF9A9C;
5150 else if (showerrors == 2)
5151 tempcolor = 0xFFFDFB43;
5152 if (createRoute || voiceIndex == 0)
5153 haserrors = true;
5154 }
5155 if (draw && tempcolor)
5156 {
5157 rect.left = 33; rect.top = 176; rect.right = 193; rect.bottom = 207;
5158 tempvec = RiseMath::Vector3(33, 176, 0);
5159 g_pTextSprite->Draw(m_pddsGUIInterlace, &rect, nullptr, &tempvec, tempcolor);
5160 }
5161
5162 if (!draw)
5163 {
5164 logger->AddToCallStack("HMI::DrawErrorBoxes DONE");
5165 return;
5166 }
5167
5168 // skin color and skin tone
5169 const int hemoglobin = g_HUD.GetSlider(IDC_SKINCOLOR)->GetValue();
5170 const int melanin = g_HUD.GetSlider(IDC_SKINTONE)->GetValue();
5171
5172 int skinColorFile;
5173 _sopen_s(&skinColorFile, "Textures\\People\\skincolors.bmp", _O_RDONLY | O_BINARY, _SH_DENYWR, _S_IWRITE);
5174 if (skinColorFile == -1)
5175 logger->Log("Could not find file: Textures\\People\\skincolors.bmp", Logger::Level::Fatal);
5176 unsigned char uch_tempR, uch_tempG, uch_tempB;
5177 unsigned long bpr = 256L * 3L;
5178 unsigned long k = 54L + melanin * 3L + (256L - hemoglobin - 1L) * bpr;
5179 _lseek(skinColorFile, k, SEEK_SET);
5180 _read(skinColorFile, &uch_tempB, 1);
5181 _read(skinColorFile, &uch_tempG, 1);
5182 _read(skinColorFile, &uch_tempR, 1);
5183 _close(skinColorFile);
5184 skintone = Rendering::ColorARGB(255, uch_tempR, uch_tempG, uch_tempB);
5185
5186 WCHAR str[99];
5187 swprintf_s(str, 99, L"%.2f", hemoglobin / 255.0f * 0.32f);
5188 rect.left = 211; rect.top = 285;
5189 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5190 swprintf_s(str, 99, L"%03i", g_HUD.GetSlider(IDC_HEAD)->GetValue());
5191 rect.left = 211; rect.top = 349;
5192 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5193 swprintf_s(str, 99, L"%03i", g_HUD.GetSlider(IDC_NOSE)->GetValue());
5194 rect.left = 211; rect.top = 381;
5195 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5196 swprintf_s(str, 99, L"%03i", g_HUD.GetSlider(IDC_HAIRSTYLE)->GetValue());
5197 rect.left = 211; rect.top = 413;
5198 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5199
5200 swprintf_s(str, 99, L"%.2f", melanin / 255.0f * 0.5f);
5201 rect.left = 449; rect.top = 285;
5202 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5204 swprintf_s(str, 99, L"%03i", g_HUD.GetSlider(IDC_FRAMETYPE)->GetValue());
5205 else
5206 swprintf_s(str, 99, L"%03i", 450);
5207 rect.left = 449; rect.top = 317;
5208 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5209 swprintf_s(str, 99, L"%03i", g_HUD.GetSlider(IDC_JAWLINE)->GetValue());
5210 rect.left = 449; rect.top = 349;
5211 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5212 swprintf_s(str, 99, L"%03i", g_HUD.GetSlider(IDC_EARS)->GetValue());
5213 rect.left = 449; rect.top = 381;
5214 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5215 swprintf_s(str, 99, L"%03i", g_HUD.GetSlider(IDC_FEATURE)->GetValue());
5216 rect.left = 449; rect.top = 413;
5217 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5218 swprintf_s(str, 99, L"%03i", g_HUD.GetSlider(IDC_STUBBLEFRECKLE)->GetValue());
5219 rect.left = 449; rect.top = 445;
5220 g_pFont->DrawText(g_pTextSprite, str, -1, &rect, DT_NOCLIP, 0xFF000000);
5221
5222 logger->AddToCallStack("HMI::DrawErrorBoxes DONE");
5223}
5224
5226{
5227 RiseMath::Color tempcolor;
5228 if (!index) // pick random
5229 {
5230 index = rand() % 24 + 1;
5232 }
5233 switch (index)
5234 {
5235 case 1: tempcolor = 0xFF090806; break; // Midnight Black
5236 case 2: tempcolor = 0xFF2C222B; break; // Off Black
5237 case 3: tempcolor = 0xFF3B3024; break; // Darkest Brown
5238 case 4: tempcolor = 0xFF4E433F; break; // Med. Dark Brown
5239 case 5: tempcolor = 0xFF504444; break; // Chestnut Brown
5240 case 6: tempcolor = 0xFF6A4E42; break; // Lt. Chestnut Brown
5241 case 7: tempcolor = 0xFF554838; break; // Dark Golden Brown
5242 case 8: tempcolor = 0xFFA7856A; break; // Lt. Golden Brown
5243 case 9: tempcolor = 0xFFB89778; break; // Dark Honey Blonde
5244 case 10: tempcolor = 0xFFDCD0BA; break; // Bleached Blonde
5245 case 11: tempcolor = 0xFFDEBC99; break; // Light Ash Blonde
5246 case 12: tempcolor = 0xFF977961; break; // Light Ash Brown
5247 case 13: tempcolor = 0xFFE6CEA8; break; // Lightest Blonde
5248 case 14: tempcolor = 0xFFE5C8A8; break; // Pale Golden Blonde
5249 case 15: tempcolor = 0xFFA56B46; break; // Strawberry Blonde
5250 case 16: tempcolor = 0xFF91553D; break; // Light Auburn
5251 case 17: tempcolor = 0xFF533D32; break; // Dark Auburn
5252 case 18: tempcolor = 0xFF71635A; break; // Darkest Gray
5253 case 19: tempcolor = 0xFFB7A69E; break; // Medium Gray
5254 case 20: tempcolor = 0xFFD6C4C2; break; // Lightest Gray
5255 case 21: tempcolor = 0xFFFFF5E1; break; // White Blonde
5256 case 22: tempcolor = 0xFFCABFB1; break; // Platinum Blonde
5257 case 23: tempcolor = 0xFF8D4A43; break; // Russet Red
5258 case 24: tempcolor = 0xFFB55239; break; // Terra Cotta
5259 default: tempcolor = RiseMath::Color(0, 0, 0, 0); break;
5260 }
5261 return tempcolor;
5262}
5263
5265{
5266 RiseMath::Color tempcolor;
5267 if (!index) // pick random
5268 {
5269 index = rand() % 6 + 1;
5271 }
5272 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
5273 switch (index)
5274 {
5275 case 1: tempcolor = 0xFFB98A32; break; // Brown
5276 case 2: tempcolor = 0xFF9E6C37; break; // Hazel
5277 case 3: tempcolor = 0xFFD0B42C; break; // Amber
5278 case 4: tempcolor = 0xFF5C932D; break; // Green
5279 case 5: tempcolor = 0xFF4C5596; break; // Blue
5280 case 6: tempcolor = 0xFF908293; break; // Gray
5281 }
5282 return tempcolor;
5283}
5284
5285void HMI::FadeIn(float f, float fElapsedTime)
5286{
5287 if (fade == 0.0f)
5288 fade = f / 6.0f;
5289 else
5290 {
5291 fade += fElapsedTime / 6.0f; // fade in over six seconds (with music)
5292 if (fade > 1.0f)
5293 fade = 1.0f;
5294 }
5295}
5296
5297void HMI::LightningCalculations(float fElapsedTime)
5298{
5299 // ReSharper disable once CppDefaultCaseNotHandledInSwitchStatement
5300 // ReSharper disable once CppIncompleteSwitchStatement
5301 switch (game->displaystage) // NOLINT
5302 {
5304 if (tm_time.tm_mon == 11) // not december (during snow)
5305 return;
5306 for (short s = 0; s < ACLlightningguiC; s++)
5307 {
5308 if (lightningabove[s].inuse)
5309 {
5310 lightningabove[s].timeleft -= fElapsedTime;
5311 if (lightningabove[s].trend)
5312 {
5313 lightningabove[s].intensity += RandomFloat() * fElapsedTime * 50.0f;
5314 if (lightningabove[s].intensity > 1.0f)
5315 {
5316 lightningabove[s].intensity = 1.0f;
5317 if (rand() > 16384)
5318 lightningabove[s].trend = false;
5319 }
5320 }
5321 else
5322 {
5323 lightningabove[s].intensity -= RandomFloat() * fElapsedTime * 50.0f;
5324 if (lightningabove[s].intensity < 0.0f)
5325 {
5326 lightningabove[s].intensity = 0.0f;
5327 if (rand() > 16384)
5328 lightningabove[s].trend = true;
5329 if (lightningabove[s].timeleft < 0.0f && lightningabove[s].trend)
5330 lightningabove[s].inuse = false;
5331 }
5332 }
5333 }
5334 else if ((rand() % 500) == 0) // !lightningabove[s].inuse
5335 {
5336 lightningabove[s].timeleft = RandomFloat() * 2.0f;
5337 lightningabove[s].trend = true;
5339
5340 lightningabove[s].inuse = true;
5341 lightningabove[s].intensity = RandomFloat(); // 1.0f is violent
5342
5343 if (s == 2) // not all of them trigger sounds
5344 {
5345 int newThunderFar = SOUND_THUNDER_FAR + rand() % 5;
5346 while (newThunderFar == sound->oldThunderFar)
5347 newThunderFar = SOUND_THUNDER_FAR + rand() % 5;
5348 sound->oldThunderFar = static_cast<SOUNDS>(newThunderFar);
5349 sound->PlayEx(static_cast<SOUNDS>(newThunderFar), false, lightningabove[s].intensity, 1, 0, true, true);
5350 }
5351 }
5352 }
5353 break;
5355 for (short s = 0; s < ACLlightningguiC; s++)
5356 {
5357 if (lightningabove[s].inuse)
5358 {
5359 lightningabove[s].timeleft -= fElapsedTime;
5360 if (lightningabove[s].trend)
5361 {
5362 lightningabove[s].intensity += RandomFloat() * fElapsedTime * 50.0f;
5363 if (lightningabove[s].intensity > 1.0f)
5364 {
5365 lightningabove[s].intensity = 1.0f;
5366 if (rand() > 16384)
5367 lightningabove[s].trend = false;
5368 }
5369 }
5370 else
5371 {
5372 lightningabove[s].intensity -= RandomFloat() * fElapsedTime * 50.0f;
5373 if (lightningabove[s].intensity < 0.0f)
5374 {
5375 lightningabove[s].intensity = 0.0f;
5376 if (rand() > 16384)
5377 lightningabove[s].trend = true;
5378 if (lightningabove[s].timeleft < 0.0f && lightningabove[s].trend)
5379 lightningabove[s].inuse = false;
5380 }
5381 }
5382 }
5383 else if (rand() % 5 == 0)
5384 {
5385 lightningabove[s].timeleft = RandomFloat() * 2.0f;
5386 lightningabove[s].trend = true;
5387 // they are 512x512, the canvas is 700x500 plus 512 either side 1724x1524 or -512,-512 to 1212,1012
5388 lightningabove[s].panelx = static_cast<float>(rand() % 1724);
5389 lightningabove[s].panely = static_cast<float>(rand() % 1524);
5391 lightningabove[s].panelx = floorf(lightningabove[s].panelx / 5.0f) * 5.0f / 0.5f - 512.0f; // 0 344 689 1034 1379 1724
5392 lightningabove[s].panely = floorf(lightningabove[s].panely / 4.42f) * 4.42f / 0.5f - 512.0f;
5393 lightningabove[s].texture = static_cast<short>(rand()) % 3;
5394
5395 lightningabove[s].inuse = true;
5396 lightningabove[s].intensity = RandomFloat(); // 1.0f is violent
5397 }
5398 }
5399 break;
5400 }
5401}
ActiveHelp
Definition ActiveHelp.h:4
@ ReloadAddedMunitionsContainer
Definition ActiveHelp.h:91
@ RefineryDemolition
Definition ActiveHelp.h:249
@ FeelRefreshed
Definition ActiveHelp.h:36
@ RepairedVehicle
Definition ActiveHelp.h:16
@ JettisonFuel
Definition ActiveHelp.h:29
@ BattleRoyaleYouAreWinner
Definition ActiveHelp.h:332
@ RentalExtended
Definition ActiveHelp.h:282
@ TownshipExpansion
Definition ActiveHelp.h:304
@ MiningDemolition
Definition ActiveHelp.h:301
@ NewsFlash
Definition ActiveHelp.h:8
@ RentalReturnedVehicle
Definition ActiveHelp.h:289
@ DisturbanceInTheCargoBay
Definition ActiveHelp.h:33
@ ColonyNameUpdated
Definition ActiveHelp.h:154
@ BonusesPlayerContributed
Definition ActiveHelp.h:311
@ BattleRoyaleWelcome
Definition ActiveHelp.h:329
@ LoadedCargo
Definition ActiveHelp.h:205
@ BankLoanApproved
Definition ActiveHelp.h:124
@ LoadedPeople
Definition ActiveHelp.h:50
@ BonusesPlayerEnrolled
Definition ActiveHelp.h:309
@ AbilitiesAssessmentIntelligence
Definition ActiveHelp.h:65
@ BattleRoyalePlayerEliminated
Definition ActiveHelp.h:331
@ MiningExpansion
Definition ActiveHelp.h:300
@ InventoryInstalled
Definition ActiveHelp.h:87
@ MoveAroundKeys
Definition ActiveHelp.h:386
@ ColonyInventoryInstalled
Definition ActiveHelp.h:255
@ HullRegistryCompleted
Definition ActiveHelp.h:59
@ Scanning
Definition ActiveHelp.h:14
@ LookAroundGamepad
Definition ActiveHelp.h:419
@ SearchSkillSuccess
Definition ActiveHelp.h:324
@ BankDepositSuccess
Definition ActiveHelp.h:176
@ ConfigJoystick
Definition ActiveHelp.h:387
@ TrimColorCompleted
Definition ActiveHelp.h:61
@ RentalPickupLocationApron
Definition ActiveHelp.h:294
@ InventoryTransferred
Definition ActiveHelp.h:328
@ VehicleLockTamper
Definition ActiveHelp.h:239
@ VehicleUnlocked
Definition ActiveHelp.h:237
@ LoadedProject
Definition ActiveHelp.h:266
@ SearchSkillBonus
Definition ActiveHelp.h:325
@ FarmingDemolition
Definition ActiveHelp.h:303
@ UnloadedFuel
Definition ActiveHelp.h:206
@ VehicleRemovedFromGarage
Definition ActiveHelp.h:111
@ CenterUp
Definition ActiveHelp.h:385
@ ScannerLostContact
Definition ActiveHelp.h:27
@ LoadedBed
Definition ActiveHelp.h:217
@ BattleRoyaleWinnerDeclared
Definition ActiveHelp.h:333
@ RestoredFlightStatus
Definition ActiveHelp.h:105
@ AuctionWinner
Definition ActiveHelp.h:165
@ DeploySuccess
Definition ActiveHelp.h:139
@ FarmingExpansion
Definition ActiveHelp.h:302
@ VehicleSalvageTitle
Definition ActiveHelp.h:151
@ BonusesYouContributed
Definition ActiveHelp.h:310
@ AuctionListedSuccess
Definition ActiveHelp.h:159
@ VehicleRegistrationCompleted
Definition ActiveHelp.h:153
@ AchievementUnlocked
Definition ActiveHelp.h:194
@ FuelTransferGave
Definition ActiveHelp.h:229
@ ModifierIncreased
Definition ActiveHelp.h:251
@ VehicleTitleTransferred
Definition ActiveHelp.h:150
@ WelcomeApt2
Definition ActiveHelp.h:383
@ SpendMoney
Definition ActiveHelp.h:258
@ LookAroundMouse
Definition ActiveHelp.h:384
@ RestoredReputation
Definition ActiveHelp.h:103
@ ReportWasEmailed
Definition ActiveHelp.h:40
@ BorrowingColonists
Definition ActiveHelp.h:32
@ UnloadedBed
Definition ActiveHelp.h:219
@ FireworksLaunched
Definition ActiveHelp.h:243
@ OptionsBought
Definition ActiveHelp.h:211
@ BankLoanPayment
Definition ActiveHelp.h:182
@ FuelTransferTook
Definition ActiveHelp.h:230
@ DisturbanceInTheCrewCabin
Definition ActiveHelp.h:34
@ PlotRegistrationSuccess
Definition ActiveHelp.h:143
@ BankAccountOpened
Definition ActiveHelp.h:131
@ LoadedFuel
Definition ActiveHelp.h:207
@ WaypointPurchase
Definition ActiveHelp.h:102
@ AuctionRelistedSuccess
Definition ActiveHelp.h:161
@ SkillsAssessmentAssay
Definition ActiveHelp.h:66
@ Tutorial
Definition ActiveHelp.h:382
@ RefineryExpansion
Definition ActiveHelp.h:345
@ DisplaceSuccess
Definition ActiveHelp.h:293
@ GruesomeDiscovery
Definition ActiveHelp.h:35
@ RentalPickupContainer
Definition ActiveHelp.h:295
@ CasinoSlotMachineWinner
Definition ActiveHelp.h:113
@ LoadedPassengers
Definition ActiveHelp.h:270
@ TaxiFare
Definition ActiveHelp.h:130
@ VehicleSerialTowCleared
Definition ActiveHelp.h:276
@ RestoredCredit
Definition ActiveHelp.h:104
@ CollectMoney
Definition ActiveHelp.h:257
@ Resurrected
Definition ActiveHelp.h:358
@ TownshipDemolition
Definition ActiveHelp.h:305
@ BankLoanOverpayment
Definition ActiveHelp.h:181
@ UnloadedBay
Definition ActiveHelp.h:218
@ PoliceReportSuccess
Definition ActiveHelp.h:292
@ AirfieldExpansion
Definition ActiveHelp.h:306
@ PlotRegistrationTransferred
Definition ActiveHelp.h:145
@ UpgradedE10ToE11
Definition ActiveHelp.h:94
@ MoveAroundJoy
Definition ActiveHelp.h:426
@ AchievementLevelUp
Definition ActiveHelp.h:201
@ ContainerPurchased
Definition ActiveHelp.h:265
@ DiplomacyResult
Definition ActiveHelp.h:263
@ InventoryAddedPerson
Definition ActiveHelp.h:92
@ UnloadedPeople
Definition ActiveHelp.h:52
@ RentalPickupAircraft
Definition ActiveHelp.h:296
@ BankWireTransferSuccess
Definition ActiveHelp.h:174
@ VehiclePurchased
Definition ActiveHelp.h:262
@ OptionsSold
Definition ActiveHelp.h:210
@ BankLoanPaidInFull
Definition ActiveHelp.h:180
@ FuelTransferReceived
Definition ActiveHelp.h:232
@ RentalBalanceSettled
Definition ActiveHelp.h:96
@ LoadedBay
Definition ActiveHelp.h:216
@ InventoryAddedVehicle
Definition ActiveHelp.h:93
@ CashTransferSent
Definition ActiveHelp.h:223
@ FuelTransferSent
Definition ActiveHelp.h:231
@ UnloadedCargo
Definition ActiveHelp.h:204
@ ReloadAddedLaunchers
Definition ActiveHelp.h:90
@ RentalReturnedContainer
Definition ActiveHelp.h:290
@ LoadedPeopleWithFamily
Definition ActiveHelp.h:51
@ BonusesYouEnrolled
Definition ActiveHelp.h:308
@ VehicleTransferSuccess
Definition ActiveHelp.h:256
@ RentalStarted
Definition ActiveHelp.h:284
@ BankWithdrawalSuccess
Definition ActiveHelp.h:179
@ CashTransferReceived
Definition ActiveHelp.h:224
@ RentalPickupGroundVehicle
Definition ActiveHelp.h:297
@ AirfieldDemolition
Definition ActiveHelp.h:307
#define V_RETURN(expression)
#define SAFE_RELEASE(value)
#define V(expression)
#define SAFE_DELETE(value)
#define WHEEL_DELTA
Definition Controls.cpp:24
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
#define WM_MOUSEWHEEL
Definition Controls.cpp:21
SCRIPT_CONTROL SCRIPT_STATE const void SCRIPT_CONTROL SCRIPT_STATE const int SCRIPT_TABDEF const BYTE SCRIPT_STRING_ANALYSIS BOOL
SCRIPT_CONTROL SCRIPT_STATE const void DWORD
#define EVENT_COMBOBOX_SELECTION_CHANGED
Definition Controls.h:23
@ D_BIOMETER
Definition DialogBase.h:8
@ DD_COMMUNICATIONS
Definition DialogBase.h:7
@ D_INFORMATION
Definition DialogBase.h:10
@ D_EXTERNALCAMERA
Definition DialogBase.h:13
@ D_WAYPOINTMANAGER
Definition DialogBase.h:6
@ D_COMMUNICATIONS
Definition DialogBase.h:12
@ D_CONFIGURATION
Definition DialogBase.h:11
@ D_PEOPLEMANAGER
Definition DialogBase.h:5
@ D_INTERMEDIA
Definition DialogBase.h:9
@ D_ENUMERATION
Definition DialogBase.h:15
#define designedHeightC
Definition GameClass.h:24
#define designedWidthC
Definition GameClass.h:23
GameState
Definition GameState.h:4
@ STATUS_LOADING
Definition GameState.h:8
@ STATUS_GAME
Definition GameState.h:9
@ STATUS_CREATE
Definition GameState.h:7
@ STATUS_LOGIN
Definition GameState.h:6
@ STATUS_SPLASH
Definition GameState.h:5
#define humantextureC
Definition Graphics.h:11
float Lerp(float val1, float val2, float lerp)
float RandomFloat()
constexpr auto Clamp(T1 val, T2 min, T3 max)
@ EVENT_SPOILERSETTING
Definition Networking.h:65
@ EVENT_LANDINGGEAR_DOWN
Definition Networking.h:44
@ EVENT_FLAPSETTING
Definition Networking.h:52
@ EVENT_BAYDOOR_CLOSED
Definition Networking.h:43
@ CONNECT_PATCHING
Definition Networking.h:30
@ CONNECT_CONNECTED
Definition Networking.h:29
@ CONNECT_CONNECTING
Definition Networking.h:28
@ CONNECT_LOGGEDIN
Definition Networking.h:33
@ CONNECT_PATCHED
Definition Networking.h:31
#define MAX_ONLINEPLAYERS
#define MAX_TAB
#define MAX_SCAN
#define MAX_TAB_CHARS
const RiseMath::Vector3 centerC
@ REF_BUILDING
Definition ServerTypes.h:46
@ REF_INANOTHER
Definition ServerTypes.h:45
@ REF_APNMODE
Definition ServerTypes.h:42
@ REF_ONGROUND
Definition ServerTypes.h:43
SOUNDS
Definition Sound.h:23
@ SOUND_PEOPLEGRUNT3
Definition Sound.h:118
@ SOUND_LOGOFF
Definition Sound.h:152
@ SOUND_TAXI
Definition Sound.h:163
@ SOUND_CONSTRUCTION
Definition Sound.h:161
@ SOUND_DISTURBANCE
Definition Sound.h:190
@ SOUND_THUNDER_FAR
Definition Sound.h:131
@ SOUND_MOUSECLICK
Definition Sound.h:148
@ SOUND_CHAT
Definition Sound.h:150
@ SOUND_MOUSEOVER
Definition Sound.h:147
@ SOUND_NEWMSG
Definition Sound.h:155
@ SOUND_CHANNELLEFT
Definition Sound.h:154
@ SOUND_SUCCESS
Definition Sound.h:162
@ SOUND_NEWSFLASH
Definition Sound.h:165
@ SOUND_INFORMATION
Definition Sound.h:160
@ SOUND_SCANNING
Definition Sound.h:164
@ SOUND_PEOPLEGRUNT1
Definition Sound.h:116
@ SOUND_CHACHING
Definition Sound.h:158
@ SOUND_EAP
Definition Sound.h:159
@ SOUND_SNAPSHOT
Definition Sound.h:149
@ SOUND_LOGON
Definition Sound.h:151
@ SOUND_REPAIR
Definition Sound.h:157
@ SOUND_PEOPLEGRUNT2
Definition Sound.h:117
@ SOUND_CHANNELJOIN
Definition Sound.h:153
BindingEnum
Definition binding.h:6
@ AIRSPACE
Definition binding.h:114
@ GV
Definition binding.h:113
@ INTERIOR
Definition binding.h:112
@ GLOBAL
Definition binding.h:111
#define STORE_CHAT_SIZE
Definition chat.h:7
BiometerDialog(short id)
scanDb Scanner
Definition Bus.h:484
float RollAttitudeRadians
Definition Bus.h:48
float PressureAltitudeKm
Definition Bus.h:31
float GroundSpeedKms
Definition Bus.h:179
float PitchAttitudeRadians
Definition Bus.h:47
float IndicatedAirspeedKms
Definition Bus.h:34
float HeadingTrueDegrees
Definition Bus.h:41
float RadioAltitudeKm
Definition Bus.h:157
float VerticalSpeedKms
Definition Bus.h:451
std::vector< Command > commandStream
Definition Bus.h:442
void RemovePlayer(short tempplayer)
Definition chat.h:27
std::vector< std::string > chatlineplayer
Definition chat.h:54
std::vector< std::wstring > chatline
Definition chat.h:53
unsigned char owner
Definition chat.h:63
void AddPlayer(unsigned char tempplayer)
Definition chat.h:17
uint64 ConvertToUint64() const
char defaultpass[16]
Definition config.h:22
SoundConfig soundConfigLegacy
Definition config.h:51
std::vector< KeyBinding > keyBindings
Definition config.h:54
InputConfig inputConfigLookLateral
Definition config.h:43
char defaultuser[13]
Definition config.h:21
InputConfig inputConfigLookVertical
Definition config.h:44
InputConfig inputConfigWalkVertical
Definition config.h:47
unsigned char language
Definition config.h:16
bool g_bClosedCaptioning
Definition config.h:30
void Save()
Definition config.cpp:648
bool g_bCheckSteamLanguage
Definition config.h:17
char patchdate[24]
Definition config.h:23
bool g_bAutoLogin
Definition config.h:19
static void Initialize(HMI *gui)
static HMI * gui
Definition DialogBase.h:42
virtual void ClearEdit()
Definition DialogBase.h:117
static void DrawAllActiveDialogs(float fElapsedTime)
short icon
Definition DialogBase.h:55
bool active
Definition DialogBase.h:73
RiseMath::Vector3 windowseeklocation
Definition DialogBase.h:70
static short draworder[D_ENUMERATION]
Definition DialogBase.h:106
static void CheckDialogMouse()
bool showfields
Definition DialogBase.h:47
short tabs
Definition DialogBase.h:64
short defaultwidth
Definition DialogBase.h:53
static bool OnEnter()
static DialogBase * dialogs[D_ENUMERATION]
Definition DialogBase.h:41
static void OnDeviceReset()
short height
Definition DialogBase.h:62
static void UpdateScrollBar(short t)
virtual const wchar_t * Title() const
static void IconClick(short icon_id)
static short CheckHeight(short t)
short width
Definition DialogBase.h:62
RiseMath::Vector3 windowdefaultlocation
Definition DialogBase.h:54
RiseMath::Vector3 windowlocation
Definition DialogBase.h:61
static void UpdateAllActiveDialogs(float fElapsedTime)
short tabflash[MAX_TAB]
Definition DialogBase.h:90
static short CheckWidth(short dialogid)
static void InitializeDialog(short t)
virtual void UpdateMenu(short tab)
Definition DialogBase.h:114
short actions
Definition DialogBase.h:51
short fields
Definition DialogBase.h:46
virtual void ActiveTab()
short defaultheight
Definition DialogBase.h:53
void UpdatePresence(const char *prmDetails, const char *prmState, const char *prmLargeImageKey)
HRESULT OnCreateDevice(Rendering::RenderDevice *device)
void Draw(Rendering::RenderSprite *sprite, const ExternalCamera::Readout &data, float left, float top, float scale)
GameState displaystage
Definition GameClass.h:118
void LoadTexture(Rendering::RenderTexture **resource, const std::string &pointerName, const WCHAR *file, Rendering::ImageFormat format=Rendering::ImageFormat::BGRA8)
std::unique_ptr< Bus > bus
Definition GameClass.h:108
Config config
Definition GameClass.h:100
void GetProgramVersion(int &major, int &minor, int &build, int &revision) const
std::unique_ptr< HMI > GUI
Definition GameClass.h:106
std::unique_ptr< Sound > sound
Definition GameClass.h:104
void AddTrackedResource(const char *name, Rendering::ResourcePool pool=Rendering::ResourcePool::Managed)
void UpdateTrackedResource(const char *name, int status)
bool showKeymapOverlay
Definition GameClass.h:133
bool timeLapse
Definition GameClass.h:134
std::unique_ptr< DiscordIntegration > discord
Definition GameClass.h:111
short loadstage
Definition GameClass.h:119
std::unique_ptr< Viewscreen > viewscreen
Definition GameClass.h:107
float displayscale
Definition GameClass.h:130
std::unique_ptr< Graphics > graphics
Definition GameClass.h:105
float displayWidth
Definition GameClass.h:131
std::unique_ptr< Logger > logger
Definition GameClass.h:109
float displayHeight
Definition GameClass.h:131
Rendering::RenderTexture * m_pddsCloudBaseMapAndNetwork
Definition Graphics.h:31
Rendering::RenderMaterial * g_pEffect
Definition Graphics.h:30
Rendering::RenderTexture * m_pddsAvatar[humantextureC]
Definition Graphics.h:33
Rendering::RenderTexture * m_pddsLightningAndBackground[3]
Definition Graphics.h:32
void OnResetDevice()
Definition gui.cpp:1047
WaypointDialog * waypointDialog
Definition gui.h:1121
void SetLocale() const
Definition gui.cpp:1817
GameClass * game
Definition gui.h:1213
Rendering::RenderFont * g_pSubtitleFont
Definition gui.h:1054
void AddLanguageOptions(UIControlIds controlId, RiseDialog *HUD) const
Definition gui.cpp:1784
bool GetImmigrationEmail(char(&email)[32])
Definition gui.cpp:4788
short dragt
Definition gui.h:1041
std::vector< Toast > toasts
Definition gui.h:1015
PEOPLE people
Definition gui.h:1097
float age
Definition gui.h:1082
HRESULT OnCreateDevice(Rendering::RenderDevice *pd3dDevice)
Definition gui.cpp:1231
bool g_bDropped
Definition gui.h:1040
void ChangePlayerProperties(SSubscribeData *prop)
Definition gui.cpp:4331
RejoinCountdown rejoinCountdown
Definition gui.h:1103
SPlayerData player[MAX_ONLINEPLAYERS]
Definition gui.h:1093
float g_fDownCounterTime
Definition gui.h:1036
LIGHTNINGABOVEGUI lightningabove[ACLlightningguiC]
Definition gui.h:1090
Rendering::RenderTexture * m_pddsGUIRanks
Definition gui.h:1066
short txbuffer
Definition gui.h:1100
Rendering::RenderFont * g_pChatFont
Definition gui.h:1053
LPWSTR currentCursor
Definition gui.h:1110
void TriggerWelcomeApt2() const
Definition gui.cpp:1281
float minWeight
Definition gui.h:1082
Rendering::RenderTexture * m_pddsGUIInterlace
Definition gui.h:1061
float furtherdelay
Definition gui.h:1085
void AddDiscordChatMessage(const WCHAR *msg)
Definition gui.cpp:4099
bool g_bLeftDown
Definition gui.h:1039
int build
Definition gui.h:1118
void ChannelInvite(char *title, unsigned char whoinvited, unsigned char channel, unsigned char players) const
Definition gui.cpp:4319
s_polygon_object tempobject
Definition gui.h:1105
float maxWeight
Definition gui.h:1082
Rendering::RenderTexture * m_pddsGUIActions
Definition gui.h:1065
float g_fLeftDownTime
Definition gui.h:1036
float g_fMouseLastMoveTime
Definition gui.h:1036
bool changedVoice
Definition gui.h:1104
bool isSteam
Definition gui.h:1114
POINT ptCursor
Definition gui.h:1049
bool MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition gui.cpp:1105
void LightningCalculations(float fElapsedTime)
Definition gui.cpp:5297
ExternalCameraOverlay externalCameraOverlay
Definition gui.h:1056
void AddSubtitles(std::wstring const &msg) const
Definition gui.cpp:1836
RiseDialog g_HUD
Definition gui.h:1031
void LoadPeopleSounds() const
Definition gui.cpp:1215
std::wstring strings[L_ENUMERATION]
Definition gui.h:1076
POINT oldptCursor
Definition gui.h:1022
Rendering::RenderTexture * m_pddsEasydockAd
Definition gui.h:1069
void OnFrameMove(float fElapsedTime)
Definition gui.cpp:326
void LoadLanguage()
Definition gui.cpp:1877
int major
Definition gui.h:1116
float minHeight
Definition gui.h:1082
RiseMath::Color GetEyeColorAtIndex(int index)
Definition gui.cpp:5264
void GetVersionText(WCHAR *, int size) const
Definition gui.cpp:2219
bool eastasian
Definition gui.h:1040
InformationDialog * informationDialog
Definition gui.h:1120
bool rxlight
Definition gui.h:1098
float fTime
Definition gui.h:1013
void PlayerJoinedChannel(short tab, unsigned char playerindex)
Definition gui.cpp:4028
void RenderExternalCameraOverlay(const RiseMath::Vector3 &position)
Definition gui.cpp:3038
Rendering::RenderTexture * m_pddsGUIInterlace2
Definition gui.h:1062
Rendering::RenderTexture * m_pddsGUIScrollButton
Definition gui.h:1064
char referralValid
Definition gui.h:1101
float g_fTabFlashTime
Definition gui.h:1036
float flood
Definition gui.h:1095
bool g_bRightClick
Definition gui.h:1045
const char * adUnmeasuredUi
Definition gui.h:1034
void SaveConfiguration() const
Definition gui.cpp:2180
float eyemotion
Definition gui.h:1083
void ReceiveEmailValidation(float token, bool passed, float reason)
Definition gui.cpp:4821
tm tm_time
Definition gui.h:1029
bool g_bLeftDouble
Definition gui.h:1040
void LoadConfiguration() const
Definition gui.cpp:2102
std::vector< std::wstring > pendingSubtitles
Definition gui.h:1125
static void CALLBACK OnGUIEvent(UINT nEvent, int nControlID, RiseControl *pControl, void *pUserContext)
Definition gui.cpp:3276
void SexChangeOperation(char newsex, bool randomizeHeightWeight)
Definition gui.cpp:111
void DisplaySnow(Rendering::RenderDevice *pd3dDevice, float fade, float fElapsed)
Definition gui.cpp:2293
char showerrors
Definition gui.h:1099
Rendering::RenderTexture * m_pddsToastIcons
Definition gui.h:1068
Logger * logger
Definition gui.h:1214
bool isLocal
Definition gui.h:1115
HMI(GameClass *g, Networking *n, Sound *s)
Definition gui.cpp:3107
void FadeIn(float f, float fElapsedTime)
Definition gui.cpp:5285
void DrawErrorBoxes(bool draw=true)
Definition gui.cpp:4848
bool createRoute
Definition gui.h:1017
unsigned char ourplayerC
Definition gui.h:1094
void SetPlayerAlignment(char *msg, unsigned char playerindex)
Definition gui.cpp:4257
int minor
Definition gui.h:1117
void ProcessPasswordBox()
Definition gui.cpp:2261
void AddSupportChatMessage(const WCHAR *wmsg)
Definition gui.cpp:4078
char handleValid
Definition gui.h:1101
void RequestEmailValidation()
Definition gui.cpp:4806
ImmigrationEmail::State emailValidation
Definition gui.h:1102
float m_fSlide
Definition gui.h:1036
Rendering::RenderTexture * m_pddsGUILateral
Definition gui.h:1060
char oldSex
Definition gui.h:1020
void CreateDialogs()
Definition gui.cpp:3067
long dragline
Definition gui.h:1042
RiseMath::Color GetHairColorAtIndex(int index)
Definition gui.cpp:5225
PolyObj polyobj
Definition gui.h:1106
bool oldmouseover
Definition gui.h:1025
Rendering::RenderTexture * m_pddsGUIScroll
Definition gui.h:1063
RiseMath::Color haircolor
Definition gui.h:1081
float prosody
Definition gui.h:1037
void DrawRXTXLights(Rendering::RenderTexture **tex) const
Definition gui.cpp:4770
void AddPlayer(char *msg, unsigned char playerindex)
Definition gui.cpp:4204
float fade
Definition gui.h:1086
void ChangeChannelOwner(short tab, unsigned char playerindex)
Definition gui.cpp:4066
void InitApp()
Definition gui.cpp:2079
KeyboardChart keyboardChart
Definition gui.h:1055
void UpdateLoginCreateButtons()
Definition gui.cpp:2279
void PlayerLeftChannel(short tab, unsigned char playerindex)
Definition gui.cpp:4047
void ChangeChannelName(unsigned char channelId, char *title)
Definition gui.cpp:4299
~HMI()
Definition gui.cpp:3243
int revision
Definition gui.h:1119
Rendering::ImageBuffer * pBuffer
Definition gui.h:1089
bool txlight
Definition gui.h:1098
static void RestoreDefaults()
Definition gui.cpp:2230
bool callsignFocus
Definition gui.h:1023
LoadingEyeReveal eyeReveal
Definition gui.h:1084
bool cursorVisible
Definition gui.h:1111
bool minimized
Definition gui.h:1113
float cloudmotion
Definition gui.h:1088
float stubbleFreckle
Definition gui.h:1082
bool g_bDragging
Definition gui.h:1039
void OnRender(float fElapsedTime, Rendering::RenderDevice *pd3dDevice)
Definition gui.cpp:2356
POINT ptClick
Definition gui.h:1049
Rendering::RenderFont * g_pFont
Definition gui.h:1052
float maxHeight
Definition gui.h:1082
void GarbleChat(wchar_t *str) const
Definition gui.cpp:3267
RiseMath::Color skintone
Definition gui.h:1081
bool grippy
Definition gui.h:1112
void OnDestroyDevice()
Definition gui.cpp:3929
bool autoHideChits
Definition gui.h:1018
void ProcessCallsignBox()
Definition gui.cpp:2236
void PlayerOffline(unsigned char arrayindex)
Definition gui.cpp:3988
void DisplayImmigration(bool refresh)
Definition gui.cpp:4366
std::vector< std::wstring > subtitles
Definition gui.h:1124
Rendering::RenderTexture * m_pddsBindings
Definition gui.h:1070
RiseDialogResourceManager g_DialogResourceManager
Definition gui.h:1079
short rxbuffer
Definition gui.h:1100
std::vector< std::wstring > motd
Definition gui.h:1073
RiseMath::Color eyecolor
Definition gui.h:1081
void AddChatMessage(WCHAR *msg, unsigned char playerindex, unsigned char channel)
Definition gui.cpp:4129
Networking * networking
Definition gui.h:1211
char charnameValid
Definition gui.h:1101
WCHAR loginstr[99]
Definition gui.h:1074
float subtitleTimer
Definition gui.h:1126
short helpboxlang
Definition gui.h:1038
void ResetLoginFields()
Definition gui.cpp:4021
CHATCHANNEL chatchannel[MAX_TAB]
Definition gui.h:1096
short FONT_WIDTH
Definition gui.h:1038
bool haserrors
Definition gui.h:1098
Rendering::RenderTexture * m_pddsGUIParts
Definition gui.h:1059
bool g_bLeftClick
Definition gui.h:1039
bool g_bRightDown
Definition gui.h:1045
void AddVoiceOptions(UIControlIds controlId, RiseDialog *HUD) const
Definition gui.cpp:1546
float weight
Definition gui.h:1082
void LoadTextures(GameState displaystage, short loadstage)
Definition gui.cpp:3810
void ShowHelpBubble(const WCHAR *msg) const
Definition gui.cpp:2033
Sicons icon[D_ENUMERATION+1]
Definition gui.h:1078
short cursoroverwindow
Definition gui.h:1038
Sound * sound
Definition gui.h:1212
void AddSubtitle(const WCHAR *msg) const
Definition gui.cpp:1864
Rendering::RenderTexture * m_pddsToast
Definition gui.h:1067
int oldfocus
Definition gui.h:1021
bool IsAdmin
Definition gui.h:1108
bool g_bTabLit
Definition gui.h:1040
bool makehud
Definition gui.h:1087
bool passwordfocus
Definition gui.h:1024
float height
Definition gui.h:1082
Rendering::RenderSprite * g_pTextSprite
Definition gui.h:1051
void AddToast(const WCHAR *message, ActiveHelp activeHelp)
Definition gui.cpp:1303
virtual CSteamID GetSteamID()=0
bool CanEdit(bool annual) const
bool Expire(std::uint64_t now)
const std::wstring & Value() const
void Reset(const std::wstring &saved)
void Edit(const std::wstring &text)
int BeginCheck(std::uint64_t now)
Reply Receive(float token, bool passed, bool unavailable)
void FrameMove(float fElapsedTime)
bool IsActive(ActiveHelp helpId) const
bool PopUpHelp(short helpId, bool allowDismiss=true, bool isLearnMore=false)
void Draw(Rendering::RenderSprite *sprite, const Keychart::Labels &labels, const std::wstring &title, int displayWidth, int displayHeight)
void Update(bool visible, float elapsedSeconds)
HRESULT OnCreateDevice(Rendering::RenderDevice *device)
float Progress(double now)
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
@ Debug
Definition Logger.h:27
@ Warn
Definition Logger.h:26
@ Fatal
Definition Logger.h:29
@ Error
Definition Logger.h:28
void SendToServer(void *pData, DWORD dwSize, bool bGuaranteed, PacketOrdering order=ORDERING_NONE) const
unsigned long rcvdbytes
Definition Networking.h:113
char connectstatus
Definition Networking.h:111
unsigned long patchbytes
Definition Networking.h:112
short retryconnect
Definition Networking.h:114
SPlayerData LoadPerson(long temprecord) const
Definition people.h:54
void SavePerson(long temprecord, SPlayerData tempperson) const
Definition people.h:94
long ResidesLocally(unsigned short serial) const
Definition people.h:166
void ReleaseComponents()
Definition polyobj.cpp:203
PolyObj()
Definition polyobj.h:16
void LoadDIX(const char *prmFilename)
Definition polyobj.cpp:92
s_polygon_object LoadDAW(const char *filename) const
Definition polyobj.cpp:21
void Update(bool realDeath, double now)
HRESULT Lock(UINT offset, UINT bytes, void **output, DWORD flags)
HRESULT DrawPrimitive(Primitive type, UINT first, UINT count)
HRESULT SetStreamSource(UINT stream, RenderBuffer *buffer, UINT offset, UINT stride)
HRESULT SetRenderState(DWORD state, DWORD value)
HRESULT SetFVF(DWORD value)
HRESULT CreateVertexBuffer(UINT bytes, DWORD usage, DWORD format, ResourcePool pool, RenderBuffer **result, void *shared)
HRESULT GetBackBuffer(UINT chain, UINT buffer, UINT type, RenderSurface **result)
HRESULT SetSamplerState(DWORD sampler, DWORD state, DWORD value)
INT DrawTextW(RenderSprite *sprite, const wchar_t *text, INT count, RECT *rectangle, DWORD flags, PackedColor color)
HRESULT SetVector(const char *name, const RiseMath::Vector4 *value)
HRESULT Begin(UINT *count, DWORD flags)
HRESULT BeginPass(UINT pass)
HRESULT Begin(DWORD flags)
HRESULT SetTransform(const RiseMath::Matrix *value)
HRESULT Draw(RenderTexture *image, const RECT *rectangle, const RiseMath::Vector3 *center, const RiseMath::Vector3 *position, PackedColor color)
bool GetChecked()
Definition Controls.h:766
virtual void SetTextColor(Rendering::PackedColor Color, Rendering::PackedColor DisabledColor=Rendering::ColorARGB(200, 128, 128, 128))
UINT GetNumItems()
Definition Controls.h:1049
HRESULT SetSelectedByIndex(UINT index)
void SetScrollBarWidth(int nWidth)
Definition Controls.h:1037
void RemoveAllItems()
HRESULT AddItem(const WCHAR *strText, void *pData)
void SetDropHeight(UINT nHeight, UINT fHeight)
Definition Controls.h:1029
int GetSelectedIndex() const
Definition Controls.h:1042
RiseElement * GetElement(UINT iElement)
Definition Controls.h:636
virtual bool GetEnabled()
Definition Controls.h:579
bool m_bHasFocus
Definition Controls.h:645
bool m_bMouseOver
Definition Controls.h:644
virtual void SetVisible(bool bVisible)
Definition Controls.h:583
virtual void SetEnabled(bool bEnabled)
Definition Controls.h:575
virtual void SetTextColor(Rendering::PackedColor Color)
RiseEditBox * GetEditBox(int ID)
Definition Controls.h:196
void Init(RiseDialogResourceManager *pManager, bool bRegisterDialog=true)
Definition Controls.cpp:176
HRESULT AddComboBox(int ID, int x, int y, int width, int height, UINT nHotKey=0, bool bIsDefault=false, RiseComboBox **ppCreated=NULL)
void RemoveAllControls()
Definition Controls.cpp:254
RiseComboBox * GetComboBox(int ID)
Definition Controls.h:188
void EnableKeyboardInput(bool bEnable)
Definition Controls.h:320
RiseRadioButton * GetRadioButton(int ID)
Definition Controls.h:184
RiseControl * GetControl(int ID)
HRESULT AddStatic(int ID, LPCWSTR strText, int x, int y, int width, int height, bool bIsDefault=false, RiseStatic **ppCreated=NULL, bool bShadow=true)
RiseStatic * GetStatic(int ID)
Definition Controls.h:172
HRESULT OnRender(float fElapsedTime)
Definition Controls.cpp:526
HRESULT AddEditBox(int ID, LPCWSTR strText, int x, int y, int width, int height, bool bIsDefault=false, bool bIsPassword=false, RiseEditBox **ppCreated=NULL)
void RequestFocus(RiseControl *pControl)
HRESULT AddRadioButton(int ID, UINT nButtonGroup, LPCWSTR strText, int x, int y, int width, int height, bool bChecked=false, UINT nHotkey=0, bool bIsDefault=false, RiseRadioButton **ppCreated=NULL)
void SetScale(float scale)
Definition Controls.h:298
RiseButton * GetButton(int ID)
Definition Controls.h:176
RiseSlider * GetSlider(int ID)
Definition Controls.h:192
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
HRESULT AddButton(int ID, LPCWSTR strText, int x, int y, int width, int height, UINT nHotkey=0, bool bIsDefault=false, RiseButton **ppCreated=NULL)
HRESULT AddSlider(int ID, int x, int y, int width, int height, int min=0, int max=100, int value=50, bool bIsDefault=false, RiseSlider **ppCreated=NULL)
HRESULT OnCreateDevice(Rendering::RenderDevice *pd3dDevice)
Definition Controls.cpp:306
void ClearText()
LPCWSTR GetText()
Definition Controls.h:1269
void SetText(LPCWSTR wszText, bool bSelected=false)
virtual void SetTextColor(Rendering::PackedColor Color)
Definition Controls.h:1280
HRESULT GetTextCopy(__out_ecount(bufferCount) LPWSTR strDest, UINT bufferCount)
void SetFont(UINT prmFont, Rendering::PackedColor defaultFontColor=Rendering::ColorARGB(255, 255, 255, 255), DWORD prmTextFormat=DT_CENTER|DT_VCENTER)
UIBlendColor FontColor
Definition Controls.h:123
DWORD dwTextFormat
Definition Controls.h:118
void SetChecked(bool bChecked, bool bClearGroup=true)
Definition Controls.h:800
int GetValue() const
Definition Controls.h:1106
void SetValue(int nValue)
Definition Controls.h:1102
void SetRange(int nMin, int nMax)
HRESULT SetText(LPCWSTR strText)
float currentPan
Definition Camera.h:12
float currentTilt
Definition Camera.h:13
bool outside
Definition Camera.h:17
float currentZoom
Definition Camera.h:21
Definition Sound.h:369
void PlayCabinAnnouncement(SOUNDS sound_enum)
Definition Sound.cpp:3456
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
float musicleft
Definition Sound.h:702
float musicdone
Definition Sound.h:702
bool loopintro
Definition Sound.h:700
SOUNDS oldThunderFar
Definition Sound.h:704
void LoadCockpitSound(SOUNDS soundEnum, const char *path, bool force, SoundConfig *device=nullptr)
Definition Sound.cpp:1536
Definition gui.h:1002
std::vector< std::wstring > text
Definition gui.h:1004
float time
Definition gui.h:1005
short icon
Definition gui.h:1006
int y
Definition gui.h:1007
ActiveHelp id
Definition gui.h:1008
float targetZoom
Definition Viewscreen.h:446
std::unique_ptr< grid > ptrGrid
Definition Viewscreen.h:426
float radioBlackout
Definition Viewscreen.h:104
RiseMath::Matrix matrixProj
Definition Viewscreen.h:345
SCamera * camera
Definition Viewscreen.h:137
WaypointProtocol::FolderOrder folderOrder
WaypointDialog(short id)
std::array< unsigned char, 4+MAX_TAB > SavedState
bool Load(const SavedState &saved)
bool dataReady
Definition grid.h:36
Sscan Get(USHORT vehicleId) const
Definition scanDb.cpp:111
float fuel
Definition globals.cpp:90
float deathfuel
Definition globals.cpp:91
DeathType dead
Definition globals.cpp:37
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
float deathinhibit
Definition globals.cpp:39
Scockpit ourcockpit
Definition globals.cpp:114
bool g_bAboveClouds
Definition globals.cpp:16
@ ImNotDeadYet
Definition globals.h:150
#define RISE_FVF_INSTRUMENT
Definition globals.h:127
#define RISE_FVF_VERTEX
Definition globals.h:118
#define ACLlightningguiC
Definition gui.h:999
@ L_SPLASH_CONNECTED
Definition gui.h:243
@ L_ENUMERATION
Definition gui.h:655
@ L_IMMIGRATION_HEIGHT
Definition gui.h:346
@ L_CONFIG_PROFILEAIRSPACE
Definition gui.h:317
@ L_LANGUAGE_FRENCH
Definition gui.h:55
@ L_IMMIGRATION_MALE
Definition gui.h:335
@ L_SPLASH_LOCAL
Definition gui.h:239
@ L_CONFIG_PROFILEGROUND
Definition gui.h:316
@ L_IMMIGRATION_REFERRAL
Definition gui.h:395
@ L_LANGUAGE_DUTCH
Definition gui.h:54
@ L_IMMIGRATION_SIGNHERE
Definition gui.h:401
@ L_IMMIGRATION_SKINCOLOR
Definition gui.h:379
@ L_LOGIN_EULA
Definition gui.h:254
@ L_LANGUAGE_PORTUGUESE
Definition gui.h:61
@ L_IMMIGRATION_SUGGEST
Definition gui.h:338
@ L_IMMIGRATION_FEMALE
Definition gui.h:336
@ L_LOGIN_CREATE
Definition gui.h:253
@ L_IMMIGRATION_EYECOLOR
Definition gui.h:372
@ L_IMMIGRATION_VISION3
Definition gui.h:384
@ L_SPLASH_PATCHING
Definition gui.h:246
@ L_IMMIGRATION_FRAMES
Definition gui.h:385
@ L_IMMIGRATION_SKINTONE
Definition gui.h:380
@ L_IMMIGRATION_EYECOLOR1
Definition gui.h:373
@ L_IMMIGRATION_FORM
Definition gui.h:333
@ L_IMMIGRATION_SNAPSHOT
Definition gui.h:396
@ L_IMMIGRATION_STATEMENTTEXT
Definition gui.h:399
@ L_IMMIGRATION_SYSTEM
Definition gui.h:326
@ L_IMMIGRATION_FEATUREFRECKLE
Definition gui.h:394
@ L_LOGIN_AWAKEN
Definition gui.h:252
@ L_LANGUAGE_JAPANESE
Definition gui.h:59
@ L_CONFIG_LANGUAGE
Definition gui.h:267
@ L_SPLASH_DIRECT
Definition gui.h:240
@ L_LANGUAGE_RUSSIAN
Definition gui.h:62
@ L_LANGUAGE_ENGLISH
Definition gui.h:52
@ L_LANGUAGE_GERMAN
Definition gui.h:56
@ L_IMMIGRATION_HAIRSTYLE
Definition gui.h:390
@ L_TAB_GLOBAL
Definition gui.h:148
@ L_LANGUAGE_SPANISH
Definition gui.h:63
@ L_DIALOG_RESTORE
Definition gui.h:81
@ L_IMMIGRATION_DEPARTMENT
Definition gui.h:331
@ L_LANGUAGE_GREEK
Definition gui.h:57
@ L_IMMIGRATION_SUBMIT
Definition gui.h:403
@ L_LOGIN_AUTHENTICATING
Definition gui.h:255
@ L_IMMIGRATION_DATE
Definition gui.h:402
@ L_MESSAGE_DUPLICATE
Definition gui.h:179
@ L_IMMIGRATION_CANCEL
Definition gui.h:328
@ L_IMMIGRATION_NAME
Definition gui.h:337
@ L_IMMIGRATION_HEAD
Definition gui.h:386
@ L_IMMIGRATION_CONFIRM
Definition gui.h:342
@ L_IMMIGRATION_DISCLAIMER
Definition gui.h:330
@ L_IMMIGRATION_FEATURESTUBBLE
Definition gui.h:392
@ L_DIALOG_EXIT
Definition gui.h:80
@ L_CONFIG_PROFILEINTERIOR
Definition gui.h:315
@ L_IMMIGRATION_FEATUREUNUSED
Definition gui.h:393
@ L_SPLASH_VALIDATED
Definition gui.h:237
@ L_IMMIGRATION_STATEMENT
Definition gui.h:398
@ L_IMMIGRATION_VOICE
Definition gui.h:339
@ L_BUTTON_RESTOREDEFAULTS
Definition gui.h:155
@ L_LANGUAGE_ITALIAN
Definition gui.h:58
@ L_IMMIGRATION_NOSE
Definition gui.h:388
@ L_IMMIGRATION_VISION1
Definition gui.h:382
@ L_IMMIGRATION_EARS
Definition gui.h:389
@ L_IMMIGRATION_CALLSIGN
Definition gui.h:340
@ L_SPLASH_VALIDATINGINSTALL
Definition gui.h:245
@ L_IMMIGRATION_FEATUREBEARD
Definition gui.h:391
@ L_TAB_UNNAMED
Definition gui.h:139
@ L_IMMIGRATION_REPUBLIC
Definition gui.h:325
@ L_SPLASH_CONNECTING
Definition gui.h:241
@ L_SPLASH_DOWNLOADING
Definition gui.h:248
@ L_IMMIGRATION_VOID
Definition gui.h:397
@ L_DIALOG_MINIMIZEALL
Definition gui.h:79
@ L_IMMIGRATION_AGE
Definition gui.h:344
@ L_LOGIN_CALLSIGN
Definition gui.h:250
@ L_IMMIGRATION_EMAIL
Definition gui.h:343
@ L_LANGUAGE_KOREAN
Definition gui.h:60
@ L_LANGUAGE_CHINESE
Definition gui.h:53
@ L_SPLASH_UPTODATE
Definition gui.h:236
@ L_IMMIGRATION_HAIRCOLOR
Definition gui.h:347
@ L_LOGIN_PASSWORD
Definition gui.h:251
@ L_MESSAGE_INVALID
Definition gui.h:187
@ L_IMMIGRATION_PROVINCE
Definition gui.h:327
@ L_IMMIGRATION_QUIT
Definition gui.h:329
@ L_IMMIGRATION_PASSWORD
Definition gui.h:341
@ L_IMMIGRATION_PROOF
Definition gui.h:400
@ L_SPLASH_STEAMUPDATES
Definition gui.h:235
@ L_IMMIGRATION_VISION
Definition gui.h:381
@ L_IMMIGRATION_GENDER
Definition gui.h:334
@ L_IMMIGRATION_HAIRCOLOR1
Definition gui.h:348
@ L_SPLASH_INSTALLING
Definition gui.h:247
@ L_IMMIGRATION_VISION2
Definition gui.h:383
@ L_IMMIGRATION_JAW
Definition gui.h:387
@ L_MESSAGE_EMAIL
Definition gui.h:186
@ L_SPLASH_STEAM
Definition gui.h:238
@ L_IMMIGRATION_WEIGHT
Definition gui.h:345
@ L_SPLASH_RETRYING
Definition gui.h:242
@ L_SPLASH_CHECKINGFORUPDATES
Definition gui.h:244
@ L_BIND_BINDINGSMAP
Definition gui.h:576
@ L_IMMIGRATION_DIVISION
Definition gui.h:332
#define subtitleCharLimitC
Definition gui.h:26
UIControlIds
Definition gui.h:668
@ IDC_REFERRAL
Definition gui.h:740
@ IDC_VOICE
Definition gui.h:756
@ IDC_SIGNATUREHINT
Definition gui.h:744
@ IDC_PROVINCETEXT
Definition gui.h:679
@ IDC_PASSWORD
Definition gui.h:672
@ IDC_HEIGHT
Definition gui.h:704
@ IDC_FEATURETEXT
Definition gui.h:734
@ IDC_HAIRSTYLE
Definition gui.h:725
@ IDC_FORMTEXT
Definition gui.h:683
@ IDC_HANDLETEXT
Definition gui.h:695
@ IDC_DIVISIONTEXT
Definition gui.h:682
@ IDC_STATEMENTLABEL
Definition gui.h:741
@ IDC_VISION2TEXT
Definition gui.h:714
@ IDC_HEAD
Definition gui.h:721
@ IDC_FRAMES
Definition gui.h:717
@ IDC_HAIRCOLORTEXT
Definition gui.h:705
@ IDC_AGE
Definition gui.h:700
@ IDC_CALLSIGN
Definition gui.h:671
@ IDC_EULA
Definition gui.h:673
@ IDC_MALE
Definition gui.h:686
@ IDC_STUBBLEFRECKLE
Definition gui.h:737
@ IDC_SKINCOLORTEXT
Definition gui.h:718
@ IDC_DISCLAIMERTEXT
Definition gui.h:680
@ IDC_NOSETEXT
Definition gui.h:722
@ IDC_FRAMETYPE
Definition gui.h:729
@ IDC_IMPLANTS
Definition gui.h:715
@ IDC_EARS
Definition gui.h:733
@ IDC_DATETEXT
Definition gui.h:749
@ IDC_SIGNATURE
Definition gui.h:745
@ IDC_SKINTONETEXT
Definition gui.h:726
@ IDC_PWVERIFY
Definition gui.h:694
@ IDC_WEIGHTTEXT
Definition gui.h:701
@ IDC_MALETEXT
Definition gui.h:685
@ IDC_PROOF
Definition gui.h:743
@ IDC_AGETEXT
Definition gui.h:699
@ IDC_VISION
Definition gui.h:711
@ IDC_FEMALE
Definition gui.h:688
@ IDC_WEIGHT
Definition gui.h:702
@ IDC_STATEMENTTEXT
Definition gui.h:742
@ IDC_SYSTEMTEXT
Definition gui.h:678
@ IDC_NOSE
Definition gui.h:723
@ IDC_LANGUAGE
Definition gui.h:754
@ IDC_JAWTEXT
Definition gui.h:730
@ IDC_DATE
Definition gui.h:750
@ IDC_VISION1TEXT
Definition gui.h:712
@ IDC_SIGNHERE
Definition gui.h:746
@ IDC_FEATURE
Definition gui.h:735
@ IDC_DEPARTMENTTEXT
Definition gui.h:681
@ IDC_CHARNAME
Definition gui.h:690
@ IDC_FRAMESTEXT
Definition gui.h:728
@ IDC_NORMAL
Definition gui.h:713
@ IDC_BACK
Definition gui.h:710
@ IDC_REFERRALTEXT
Definition gui.h:739
@ IDC_EYECOLOR
Definition gui.h:708
@ IDC_FEMALETEXT
Definition gui.h:687
@ IDC_STUBBLEFRECKLETEXT
Definition gui.h:736
@ IDC_VOICELABEL
Definition gui.h:755
@ IDC_CREATE
Definition gui.h:674
@ IDC_EMAILADDRESS
Definition gui.h:698
@ IDC_REPUBLICTEXT
Definition gui.h:677
@ IDC_LANGUAGELABEL
Definition gui.h:753
@ IDC_PWVERIFYTEXT
Definition gui.h:693
@ IDC_SKINCOLOR
Definition gui.h:719
@ IDC_HANDLE
Definition gui.h:696
@ IDC_EMAILTEXT
Definition gui.h:697
@ IDC_VISION3TEXT
Definition gui.h:716
@ IDC_SEX
Definition gui.h:684
@ IDC_HAIRSTYLETEXT
Definition gui.h:724
@ IDC_REJOINBTN
Definition gui.h:980
@ IDC_EYECOLORTEXT
Definition gui.h:707
@ IDC_SKINTONE
Definition gui.h:727
@ IDC_HEADTEXT
Definition gui.h:720
@ IDC_LOGIN
Definition gui.h:670
@ IDC_JAWLINE
Definition gui.h:731
@ IDC_VOID
Definition gui.h:748
@ IDC_SNAPSHOT
Definition gui.h:747
@ IDC_HAIRCOLOR
Definition gui.h:706
@ IDC_CHARNAMETEXT
Definition gui.h:689
@ IDC_CONFIRM
Definition gui.h:975
@ IDC_PASSWORDTEXT
Definition gui.h:692
@ IDC_EARSTEXT
Definition gui.h:732
@ IDC_SUGGEST
Definition gui.h:691
@ IDC_HEIGHTTEXT
Definition gui.h:703
ISteamApps * SteamApps()
ISteamUser * SteamUser()
Layout Defaults(float width, float height, Layout panels, float minimumChatWidth)
std::array< Panel, Count > Layout
float HorizontalFov(float projectionX, float zoom)
WeightRange GetWeightRange(int minimum, int maximum, int savedKg, bool revisit)
Labels BuildLabels(const std::vector< KeyBinding > &bindings, char profile, bool admin, Translate translate)
void Garble(wchar_t *text, float blackout, Random random)
constexpr uint32_t CLAMP
constexpr uint32_t WRAP
constexpr uint32_t SRCCOLOR
constexpr uint32_t INVSRCCOLOR
constexpr uint32_t WRITEONLY
constexpr uint32_t NONE
constexpr uint32_t CCW
constexpr uint32_t DISCARD
constexpr uint32_t SRCBLEND
constexpr uint32_t CULLMODE
constexpr uint32_t ALPHABLENDENABLE
constexpr uint32_t DESTBLEND
constexpr uint32_t ADDRESSU
constexpr uint32_t ADDRESSV
constexpr DWORD AlphaBlend
HWND ClientWindow()
HRESULT SaveSurfaceToMemory(ImageBuffer **result, ImageFile format, RenderSurface *surface, const void *, const RECT *crop)
HRESULT CreateFontW(RenderDevice *owner, INT height, UINT width, UINT weight, UINT mipLevels, BOOL italic, DWORD charset, DWORD precision, DWORD quality, DWORD pitch, const wchar_t *face, RenderFont **result)
double ClientTime()
HRESULT CreateSprite(RenderDevice *owner, RenderSprite **result)
double ClientAbsoluteTime()
RenderDevice * ClientRenderer()
constexpr PackedColor ColorARGB(unsigned a, unsigned r, unsigned g, unsigned b)
bool ClientWindowed()
constexpr float Pi
Definition ClientMath.h:12
constexpr auto Min(A first, B second)
Definition ClientMath.h:15
Quaternion * QuaternionMultiply(Quaternion *out, const Quaternion *a, const Quaternion *b)
Definition ClientMath.h:168
Quaternion * QuaternionRotationYawPitchRoll(Quaternion *out, float yaw, float pitch, float roll)
Definition ClientMath.h:169
constexpr float Tau
Definition ClientMath.h:12
Matrix * MatrixScaling(Matrix *out, float x, float y, float z)
Definition ClientMath.h:124
Matrix * MatrixRotationZ(Matrix *out, float value)
Definition ClientMath.h:128
constexpr auto Max(A first, B second)
Definition ClientMath.h:16
Matrix * MatrixTranslation(Matrix *out, float x, float y, float z)
Definition ClientMath.h:125
S_API bool S_CALLTYPE SteamAPI_RestartAppIfNecessary(uint32 unOwnAppID)
S_API void S_CALLTYPE SteamAPI_Shutdown()
bool SteamAPI_Init()
Definition steam_api.h:96
S_API void S_CALLTYPE SteamAPI_RunCallbacks()
unsigned long long uint64
Definition steamtypes.h:60
std::string name
Definition Command.h:11
LPDIRECTINPUTDEVICE8 g_pJoystick
Definition InputConfig.h:22
bool UsesMouse() const
Definition InputConfig.h:24
float timeleft
Definition gui.h:991
float panely
Definition gui.h:994
short texture
Definition gui.h:995
float panelx
Definition gui.h:994
float rotate
Definition gui.h:994
float intensity
Definition gui.h:992
float distance
Definition gui.h:996
unsigned char type
unsigned char array
unsigned char type
unsigned char type
char email[32]
unsigned char heightCm
unsigned char bldg
char extraText[99]
time_t createdate
unsigned char skintone
char characterName[30]
unsigned short allianceHeadId
bool revisitImmigration
unsigned char eyecolor
unsigned char weightKg
unsigned short serial
unsigned char skincolor
char stubbleFreckle
unsigned char age
unsigned char voice
unsigned char haircolor
char allianceName[30]
char callsign[13]
unsigned char skincolor
unsigned char weight
unsigned char heightCm
unsigned char sex
char characterName[30]
unsigned char age
bool revisitImmigration
unsigned char eyecolor
unsigned char haircolor
unsigned char skintone
unsigned char voice
char referrer[13]
short ourplyrC
Definition globals.h:682
float flapExtent
Definition globals.h:660
float fuelmax
Definition globals.h:647
float gearextent
Definition globals.h:617
unsigned char hitpoints
Definition globals.h:686
short dialog
Definition gui.h:664
bool mouseover
Definition gui.h:663
RiseMath::Vector3 iconlocation
Definition gui.h:662
RECT iconsource
Definition gui.h:661
int ownerId
Definition scanDb.h:22
Definition scanDb.h:47
bool initialized
Definition scanDb.h:48
Sscandata scandata
Definition scanDb.h:49
SmodeAC modeAC
Definition scanDb.h:41
void Init(Rendering::PackedColor defaultColor, Rendering::PackedColor disabledColor=Rendering::ColorARGB(200, 128, 128, 128), Rendering::PackedColor hiddenColor=0)
float baydoorextent
Definition globals.h:539
Rendering::RenderBuffer * VB
Definition globals.h:360