Rise
The Vieneo Province
Loading...
Searching...
No Matches
DialogBase.cpp
Go to the documentation of this file.
1#include "DialogBase.h"
2
3#include <clocale>
4#include <cmath>
5
6#include "../gui.h"
7#include "../Sound.h"
8#include "../Networking.h"
9#include "../GameClass.h" // for trace
11#include "InformationDialog.h"
12#include "HudDiagnostics.h"
13
14HMI* DialogBase::gui = nullptr;
15Logger* DialogBase::logger = nullptr;
18
20{
21 logger->AddToCallStack("DialogBase::ctor");
22
23 dialogid = id;
24
25 //BASE CONSTRUCTOR (THIS ONE) ALWAYS GETS CALLED FIRST
26
27 //START DEFAULT INIT ----- NEEDS CLEANING AFTERWARDS
28 windowdefaultlocation = RiseMath::Vector3(static_cast<float>(rand() % 200), static_cast<float>(rand() % 200), 0);
29 defaultwidth = rand() % 256 + 52 + 16; // minimum is 52+16
30 defaultheight = (rand() % 30 + 2) * 16; // minimum is 2
31 tabs = rand() % 2; // this gets saved
32 for (short s = 0; s < MAX_TAB; s++)
33 tabusedefaultlang[s] = tabstr[s][0] = 0;
34 activetab = 0; // this gets saved
35 sortfield = -1; // this gets saved
36 sortdirection = 1; // default sort direction
37 linetop = 0;
38 linecursel = -1;
39 lineact = -1;
40 linedsp = 0;
41 linetot = 0L;
44
45 fields = 0;
46 ZeroMemory(&fieldline, MAX_LINES * MAX_FIELDS * HELP_SIZE);
48 ZeroMemory(&fieldx, sizeof(short) * MAX_FIELDS);
49 ZeroMemory(&fieldeffectivewidth, sizeof(short) * MAX_FIELDS);
50 for (int i = 0; i < MAX_FIELDS; i++)
51 fieldsortable[i] = true;
52 showfields = false;
53
54 allowresize = true;
55 allowscroll = true;
56 allowmove = true;
57 dockedto = -1;
58 usesHUD = false;
59 active = false;
60 allowclose = true;
61
62 editfield = -1;
63 editline = -1;
64 edittab = -1;
65
66 actions = 0;
68 actionslider = 0.0f; // init
69 actionoffset = 0;
70 ZeroMemory(&actionenabled, MAX_ACTION);
71 ZeroMemory(&actiontoggle, MAX_ACTION);
72
73 msgbarcolor = 0; // normal
74 msgbartext[0] = 0;
75
76 for (short s = 0; s < MAX_TAB; s++)
77 tabflash[s] = false;
78
79 icon = -1;
80 iconsource.top = 32;
81 iconsource.bottom = 64;
82
83 text = 0; // clear
84 normalinterlace = true;
85
86 logger->AddToCallStack("DialogBase::ctor DONE");
87}
88
90{
91 logger->AddToCallStack("DialogBase::InitializeDialog");
92
93 char msg[99];
94 sprintf_s(msg, sizeof msg, "DialogBase::InitializeDialog(%i)...", t);
95 logger->Log(msg);
96
97 //Gets called in the constructors of the dialogs
98 //Bit of generic initialisation, thats need to happen AFTER specific
99 //settings are set in the dialog specific contructor
100 dialogs[t]->iconsource.left = 32 * dialogs[t]->icon;
101 dialogs[t]->iconsource.right = dialogs[t]->iconsource.left + 32;
102
103 // locations are based on a 1280x768
106
108
109 dialogs[t]->layer = 1; // must not be 0
110
111 if (t != D_INFORMATION && t != D_EXTERNALCAMERA)
112 {
113 dialogs[t]->enabled = true;
114 }
115 else
116 {
117 dialogs[t]->enabled = false;
118 dialogs[t]->active = false;
119 }
120
121 // if it is active we need to do one update to get things going
122 dialogs[t]->UpdateMenu(-1);
123
124 logger->AddToCallStack("DialogBase::InitializeDialog DONE");
125}
126
128{
129 gui = g;
130 logger = g->game->logger.get();
131}
132
133const wchar_t* DialogBase::Title() const
134{
135 return gui->strings[text].c_str();
136}
137
139{
140 logger->AddToCallStack("DialogBase::UpdateAllActiveDialogs");
141
142 for (short t = 0; t < D_ENUMERATION; t++)
143 {
145 if (dialogs[t]->active)
146 {
148 {
152 CheckMoved(t);
153 }
154 else if ((dialogs[t]->windowlocation.x + dialogs[t]->width) * gui->game->displayscale < 100 * gui->game->displayscale)
155 {
159 CheckMoved(t);
160 }
161
163 {
167 CheckMoved(t);
168 }
169 else if ((dialogs[t]->windowlocation.y + dialogs[t]->width) * gui->game->displayscale < 100 * gui->game->displayscale)
170 {
174 CheckMoved(t);
175 }
176
177
178 if (dialogs[t]->windowseeklocation.z != -1.0f)
179 {
180 if (dialogs[t]->windowseeklocation.z >= 0.0f)
181 {
182 dialogs[t]->windowseeklocation.z = 0.0f;
185 if (RiseMath::Vec3Length(&diff) < 1.0f)
186 {
188 dialogs[t]->windowseeklocation.z = -1.0f;
189 }
190 }
191 else
192 dialogs[t]->windowseeklocation.z += fElapsedTime;
193
194 CheckMoved(t);
195 }
196
197 if (dialogs[t]->actionslider != static_cast<float>(dialogs[t]->actionoffset))
198 {
199 float speed = 4.0f * fElapsedTime;
200 if (speed > 1.0f)
201 speed = 1.0f;
202 dialogs[t]->actionslider += (static_cast<float>(dialogs[t]->actionoffset) - dialogs[t]->actionslider) * speed;
203 if (fabsf(dialogs[t]->actionslider - static_cast<float>(dialogs[t]->actionoffset)) < 0.03125f)
204 dialogs[t]->actionslider = static_cast<float>(dialogs[t]->actionoffset);
205 }
206 dialogs[t]->Update();
207 }
208 }
209
210 logger->AddToCallStack("DialogBase::UpdateAllActiveDialogs DONE");
211}
212
213void DialogBase::IconClick(short icon_id)
214{
215 logger->AddToCallStack("DialogBase::IconClick");
216
217 const short t = icon_id;
218 if (gui->icon[t].dialog > -1 && dialogs[gui->icon[t].dialog]->enabled)
219 {
221
222 if (dialogs[gui->icon[t].dialog]->dockedto != -1)
224 if (dialogs[gui->icon[t].dialog]->active) // now active
225 {
227
228 const short docked = dialogs[gui->icon[t].dialog]->dockedto;
229 if (docked != -1)
230 dialogs[docked]->UpdateMenu(-1);
231 dialogs[gui->icon[t].dialog]->UpdateMenu(-1);
232
234
235 if (gui->icon[t].dialog == D_CONFIGURATION)
237 }
238 else if (dialogs[gui->icon[t].dialog]->windowseeklocation.z != -1.0f)
240
242 gui->minimized = false;
243 }
244 else
245 {
246 if (gui->icon[t].dialog == -2) // exit L_DIALOG_EXIT
247 {
250 }
251 else if (gui->icon[t].dialog == -1) // minimize all L_DIALOG_MINIMIZEALL
252 {
254 if (!gui->minimized)
255 {
256 gui->minimized = true;
257
258 // gotta first clear out the status of all the windows because docked windows handle their own stuff
259 for (short s = 0; s < D_ENUMERATION; s++)
260 dialogs[s]->minimized = false;
261
262 for (short s = 0; s < D_ENUMERATION; s++)
263 {
264 if (s == D_INFORMATION)
265 continue;
266
267 if (dialogs[s]->active)
268 dialogs[s]->Close(true);
269 }
270 }
271 else
272 {
273 gui->minimized = false;
274 for (short s = 0; s < D_ENUMERATION; s++)
275 {
276 if (s == D_INFORMATION)
277 continue;
278
279 if (dialogs[s]->minimized && dialogs[s]->enabled)
280 {
281 dialogs[s]->active = true;
282 dialogs[s]->minimized = false;
283 dialogs[s]->UpdateMenu(-1);
284 }
285 }
286 }
287 }
288 }
289
290 gui->g_bLeftClick = false;
291
292 logger->AddToCallStack("DialogBase::IconClick DONE");
293}
294
295void DialogBase::ClickEditableField(short t, const int field)
296{
297 logger->AddToCallStack("DialogBase::ClickEditableField");
298
299 if (!dialogs[t]->canEditField(field))
300 return;
301
302 if (dialogs[t]->linecursel < 0)
303 return;
304
305 if (gui->ptCursor.x > dialogs[t]->fieldx[field] && gui->ptCursor.x <= (dialogs[t]->fieldx[field] + dialogs[t]->fieldeffectivewidth[field]))
306 {
308 dialogs[t]->editfield = field;
309 gui->Editing = true;
310 const auto topMargin = static_cast<int>(RiseMath::Max(0.0f, (32.0f - 32.0f * gui->game->displayscale)) * 0.5f); // so min is 32 so if it is 10 then 22 ... 11 top and bottom
313 static_cast<int>(((dialogs[t]->fieldx[field] - dialogs[t]->windowlocation.x) - 5) * gui->game->displayscale), static_cast<int>(((dialogs[t]->linecursel - dialogs[t]->linetop) * 16 - 7) * gui->game->displayscale - topMargin),
314 static_cast<int>((dialogs[t]->fieldeffectivewidth[field] + 20) * gui->game->displayscale), 32);
315 if (t == D_WAYPOINTMANAGER && (dialogs[t]->linecursel - dialogs[t]->linetop) == 0 && dialogs[t]->activetab == 0)
318 dialogs[t]->HUD.GetEditBox(IDC_FIELDEDIT)->HandleMouse(WM_LBUTTONDOWN, gui->ptClick, 0, 0);
319 gui->g_bLeftDown = false;
320 }
321
322 logger->AddToCallStack("DialogBase::ClickEditableField DONE");
323}
324
326{
327 logger->AddToCallStack("DialogBase::CheckDialogMouse");
328
329 bool hit = false;
330
331#pragma region Actual windows (dialogs)
332 for (short r = 0; r < D_ENUMERATION; r++) // top most to bottom
333 {
334 const short t = draworder[r];
335
336 if (dialogs[t]->active &&
337 gui->ptCursor.x >= dialogs[t]->windowlocation.x && gui->ptCursor.x < (dialogs[t]->windowlocation.x + dialogs[t]->width) &&
338 gui->ptCursor.y >= dialogs[t]->windowlocation.y && gui->ptCursor.y < (dialogs[t]->windowlocation.y + dialogs[t]->height + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + (dialogs[t]->actions ? 32 : 0) + 32))
339 {
340
341 // check tabs first (non-conforming to the box)
342 if (dialogs[t]->tabs && gui->ptCursor.y >= dialogs[t]->windowlocation.y && gui->ptCursor.y < (dialogs[t]->windowlocation.y + 16))
343 {
344 // tabs line
345 for (short s = 0; s < dialogs[t]->tabs; s++)
346 {
347 if (gui->ptCursor.x >= dialogs[t]->tabx[s] && gui->ptCursor.x < (dialogs[t]->tabx[s] + dialogs[t]->tabwidth[s]))
348 {
349 // mouse cursor on this tab
350 if (gui->cursoroverwindow == -1)
352
353 if (gui->g_bLeftClick && !hit)
354 {
355 //This means a tab is clicked :)
356 dialogs[t]->TabClick(s);
357
358 hit = true;
359 s = dialogs[t]->tabs; // done with loop
360 }
361 else if (gui->g_bDropped && !hit && gui->dragt > -1 && gui->dragline != -1) // was drug and dropped
362 {
363 if (DraggingItem(t, s)) // sets a cursor
364 dialogs[t]->DragDropItem(s);
365
366 SetCursor(LoadCursor(nullptr, IDC_ARROW));
367 gui->currentCursor = IDC_ARROW;
368
369 gui->helpboxlang = -1;
370 hit = true;
371 s = dialogs[t]->tabs;
372 gui->dragt = -1; gui->dragline = -1;
373 }
374 else if (gui->g_bDragging && !hit && gui->dragt > -1 && gui->dragline != -1) // item being drug
375 {
376 DraggingItem(t, s);
377 // no hit on dragging
378 hit = true;
379 }
381 hit = true;
382 }
383 }
384 }
385 else if (gui->ptCursor.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0)) && gui->ptCursor.y < (dialogs[t]->windowlocation.y + dialogs[t]->height + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + (dialogs[t]->actions ? 32 : 0) + 32))
386 {
387 // mouse cursor is in the square confines of the window... for mouseover and buttons only, no drag
388 if (gui->cursoroverwindow == -1)
390
391 if ((gui->g_bLeftClick || gui->g_bLeftDown || gui->g_bDropped || gui->g_bLeftDouble) && !hit)
392 {
393 if (dialogs[t]->actions && !gui->g_bDragging && gui->ptCursor.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height) && gui->ptCursor.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + 32))
394 {
395 // actions line
396 if (gui->ptCursor.x >= (dialogs[t]->windowlocation.x + dialogs[t]->width - 16) && gui->ptCursor.x < (dialogs[t]->windowlocation.x + dialogs[t]->width))
397 {
398 // scroll actions right
400 dialogs[t]->actionoffset++;
401 hit = true;
402 // clearedit=true;
403 }
404 else if (gui->ptCursor.x >= dialogs[t]->windowlocation.x && gui->ptCursor.x < (dialogs[t]->windowlocation.x + 16))
405 {
406 // scroll actions left
407 if (dialogs[t]->actionoffset > 0)
408 dialogs[t]->actionoffset--;
409 if (t == D_COMMUNICATIONS && dialogs[t]->editfield != -1) // stop input
410 dialogs[t]->actionoffset = 0;
411 hit = true;
412 // clearedit=true;
413 }
414 else if ((gui->g_bLeftClick || gui->g_bDropped) && gui->ptCursor.x >= (dialogs[t]->windowlocation.x + 17) && gui->ptCursor.x < (dialogs[t]->windowlocation.x + dialogs[t]->width - 17))
415 {
416 //Action Icon is clicked!
417 const long icon = (gui->ptCursor.x - (static_cast<long>(dialogs[t]->windowlocation.x) + 18) + static_cast<long>(dialogs[t]->actionslider * 32.0f)) / 32;
419 hit = true;
420 }
421 }
422 else if (gui->g_bLeftClick && dialogs[t]->showfields && gui->ptCursor.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8) && gui->ptCursor.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0)) && gui->ptCursor.x < (dialogs[t]->windowlocation.x + dialogs[t]->width - 16))
423 {
424 // field titles
425 for (short fie = 0; fie < dialogs[t]->fields; fie++)
426 {
427 if (dialogs[t]->fieldsortable[fie] && gui->ptCursor.x > dialogs[t]->fieldx[fie] && gui->ptCursor.x <= (dialogs[t]->fieldx[fie] + dialogs[t]->fieldeffectivewidth[fie]))
428 {
429 if (dialogs[t]->sortfield == fie)
431 else
432 {
433 dialogs[t]->sortfield = fie;
434 dialogs[t]->sortdirection = 1;
435 }
436 dialogs[t]->UpdateMenu(-1);
437 break;
438 }
439 }
440 hit = true;
441 }
442 else if (gui->ptCursor.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0)) && gui->ptCursor.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height))
443 {
444 // list area vertically
445 if (gui->ptCursor.x < (dialogs[t]->windowlocation.x + dialogs[t]->width - 16))
446 {
447 const long oldlinecursel = dialogs[t]->linecursel;
448 // list area horizontally
449 if (gui->g_bLeftClick)
450 {
451 dialogs[t]->linecursel = (gui->ptCursor.y - (dialogs[t]->tabs ? 16 : 0) - 8 - (dialogs[t]->showfields ? 16 : 0) - static_cast<long>(dialogs[t]->windowlocation.y)) / 16 + dialogs[t]->linetop;
452 if (dialogs[t]->linecursel >= dialogs[t]->linetot)
453 dialogs[t]->linecursel = -1;
454 dialogs[t]->ClearEdit();
455 dialogs[t]->UpdateMenu(-1);
456 }
457 else if (gui->g_bLeftDouble)
459
460
461 if (gui->g_bLeftDown && gui->dragt == -1 && gui->dragline == -1 && dialogs[t]->linecursel != -1 && (gui->ptCursor.x != gui->ptClick.x || gui->ptCursor.y != gui->ptClick.y))
462 {
463 // make sure we clicked here, not dragged nothingness to here and picked it up
464 if (gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0)) && gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height) &&
465 gui->ptClick.x >= dialogs[t]->windowlocation.x && gui->ptClick.x < (dialogs[t]->windowlocation.x + dialogs[t]->width - 16))
466 {
467 gui->dragt = t;
468 gui->dragline = dialogs[t]->linecursel; // includes linetop component
469 hit = true;
470 dialogs[t]->ClearEdit();
471 }
472 }
473 else if (gui->g_bLeftClick && !gui->g_bLeftDouble && // using clickup makes sure we are selecting to edit
474 dialogs[t]->linecursel == oldlinecursel && // must have selected previously
475 oldlinecursel != -1 && // must not be null/undefined/unselected
476 dialogs[t]->editline == -1) // not already editing
477 {
478 if (t == D_WAYPOINTMANAGER)
479 {
481
482 // description area
483 ClickEditableField(t, 1);
484 ClickEditableField(t, 2);
485 }
486 else if (t == D_PEOPLEMANAGER)
487 {
488 // description area
489 ClickEditableField(t, 7);
490 }
491 }
492 else if (gui->g_bLeftDouble && t == DD_COMMUNICATIONS && dialogs[t]->linecursel != -1)
493 {
494 // find this guy and center it on him in his folder
496 if (temptab != -1)
497 {
500 //ActiveTab(D_PEOPLEMANAGER);
501 }
507 //PopUpDialog(D_PEOPLEMANAGER);
508 }
509 else if (gui->g_bLeftDown && gui->dragt != t && gui->dragt > -1) // drug something from elsewhere
510 {
512 }
513 else if (gui->g_bDropped && gui->dragt != t && gui->dragt > -1)
514 {
515 if (DraggingItem(t, dialogs[t]->activetab))
517
518 SetCursor(LoadCursor(nullptr, IDC_ARROW));
519 gui->currentCursor = IDC_ARROW;
520
521 gui->helpboxlang = -1;
522 hit = true;
523 gui->dragt = -1;
524 gui->dragline = -1;
525 }
526 }
527 else if (dialogs[t]->scrollbarheight && gui->dragt == -1 && dialogs[t]->allowscroll)
528 {
529 // scroll bar area
530 if (gui->ptCursor.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0)) && gui->ptCursor.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + 16))
531 {
532 // scroll up button
533 const long oldlinetop = dialogs[t]->linetop;
534 if (gui->g_bLeftClick || gui->g_fDownCounterTime > 1.0f)
535 {
536 dialogs[t]->linetop--;
538 }
539 if (dialogs[t]->linetop < 0)
540 dialogs[t]->linetop = 0;
541 if (oldlinetop != dialogs[t]->linetop)
542 {
543 dialogs[t]->UpdateMenu(-1);
545 }
546 hit = true;
547 }
548 else if (gui->ptCursor.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height - 16) && gui->ptCursor.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height))
549 {
550 // scroll down button
551 const long oldlinetop = dialogs[t]->linetop;
552 if (gui->g_bLeftClick || gui->g_fDownCounterTime > 1.0f)
553 {
554 dialogs[t]->linetop++;
556 // WCHAR str[99];
557 // swprintf_s(str, 99, L"top %i dsp %i tot %i", dialog[t].linetop, dialog[t].linedsp, dialog[t].linetot);
558 // Rendering::TraceFailure(str, S_OK);
559 }
560 if ((dialogs[t]->linetop + dialogs[t]->linedsp) > dialogs[t]->linetot)
562 if (oldlinetop != dialogs[t]->linetop)
563 {
564 dialogs[t]->UpdateMenu(-1);
566 }
567 hit = true;
568 // clearedit=true;
569 }
570 else if (gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + 16 + dialogs[t]->scrollbartop) ||
571 gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + 16 + dialogs[t]->scrollbartop + dialogs[t]->scrollbarheight))
572 {
573 if (gui->g_bLeftClick)
574 {
575 // scroll bar rail itself (click, not drag)
576 const float scrollheight = static_cast<float>(dialogs[t]->height) - 32;
577 dialogs[t]->scrollbartop = static_cast<short>(gui->ptClick.y) - static_cast<short>(dialogs[t]->windowlocation.y) - (dialogs[t]->tabs ? 16 : 0) - 8 - (dialogs[t]->showfields ? 16 : 0) - 16 - dialogs[t]->scrollbarheight / 2;
578 if (dialogs[t]->scrollbartop < 0)
579 dialogs[t]->scrollbartop = 0;
580 if (dialogs[t]->scrollbartop > (scrollheight - dialogs[t]->scrollbarheight))
581 dialogs[t]->scrollbartop = static_cast<short>(scrollheight) - dialogs[t]->scrollbarheight;
582 const long oldlinetop = dialogs[t]->linetop;
583 dialogs[t]->linetop = static_cast<long>(static_cast<float>(dialogs[t]->scrollbartop) / scrollheight * static_cast<float>(dialogs[t]->linetot));
584 if (dialogs[t]->linetop != oldlinetop)
585 {
586 dialogs[t]->UpdateMenu(-1);
587 }
588 hit = true;
589 }
590 }
591 }
592 }
593 else if (gui->g_bLeftClick)
594 {
595 if (dialogs[t]->allowclose &&
596 gui->ptClick.x >= (dialogs[t]->windowlocation.x + dialogs[t]->width - 32 - 16) && gui->ptClick.x < (dialogs[t]->windowlocation.x + dialogs[t]->width - 32) &&
597 gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0) + 16) && gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0) + 32))
598 {
599 dialogs[t]->Close(false);
600 hit = true;
601 }
602 else if (dialogs[t]->allowresize &&
603 gui->ptClick.x >= (dialogs[t]->windowlocation.x + dialogs[t]->width - 32 - 16 - 16) && gui->ptClick.x < (dialogs[t]->windowlocation.x + dialogs[t]->width - 32 - 16) &&
604 gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0) + 16) && gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0) + 32))
605 {
606 // maximize
607 dialogs[t]->windowseeklocation = RiseMath::Vector3(0, designedHeightC * 0.5f - 32.0f - static_cast<float>(dialogs[t]->height + 8 + 32 + (dialogs[t]->actions ? 32 : 0) + (dialogs[t]->tabs ? 16 : 0) + (dialogs[t]->showfields ? 16 : 0)) * 0.5f, 0);
608 hit = true;
609 }
610 else
611 hit = true; // if there isn't an element described but we clicked it
612 }
613 else if (gui->g_bDropped)
614 {
615 gui->g_bDropped = false;
616 // was possibly resize resizinging, we don't want it adjusting even 16 pixel lines until we are done
617 if (dialogs[t]->allowresize && gui->ptClick.x >= (dialogs[t]->windowlocation.x + dialogs[t]->width - 32) && gui->ptClick.x < (dialogs[t]->windowlocation.x + dialogs[t]->width) &&
618 gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0)) && gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0) + 32))
619 {
620 CheckHeight(t);
621 if (t == D_COMMUNICATIONS)
622 {
624
626 }
627 CheckWidth(t);
628 hit = true;
629 }
630 }
631 // hit=true;
632 }
634 hit = true;
635 }
636 }
637 if (dialogs[t]->active && gui->g_bDragging)
638 {
639 // mouse was clicked in the confines of the window and dragged
640 if (dialogs[t]->allowresize &&
641 gui->ptClick.x >= (dialogs[t]->windowlocation.x + dialogs[t]->width - 32) && gui->ptClick.x < (dialogs[t]->windowlocation.x + dialogs[t]->width) &&
642 gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0)) && gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0) + 32))
643 {
644 // resize
645 if (t == DD_COMMUNICATIONS)
646 {
647 dialogs[D_COMMUNICATIONS]->height += static_cast<short>(gui->ptCursor.y - gui->ptClick.y);
649 }
650 else
651 {
652 dialogs[t]->height += static_cast<short>(gui->ptCursor.y - gui->ptClick.y);
653 gui->ptClick.y = gui->ptCursor.y + CheckHeight(t);
654 }
655
656 dialogs[t]->width += static_cast<short>(gui->ptCursor.x - gui->ptClick.x);
657 gui->ptClick.x = gui->ptCursor.x + CheckWidth(t);
658 if (t == D_COMMUNICATIONS)
659 {
660 dialogs[DD_COMMUNICATIONS]->width -= static_cast<short>(gui->ptCursor.x - gui->ptClick.x);
661 const short b = CheckWidth(DD_COMMUNICATIONS);
662 // dialog[t].width-=b;
663 gui->ptClick.x = gui->ptCursor.x + b;
664 }
665
666 if (t == D_COMMUNICATIONS)
667 {
669 }
670 hit = true;
671 gui->dragt = -1;
672 gui->dragline = -1;
673 }
674 else if (gui->ptClick.x >= dialogs[t]->windowlocation.x && gui->ptClick.x < (dialogs[t]->windowlocation.x + dialogs[t]->width) &&
675 ((gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0)) && gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8)) ||
676 (gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0)) &&
677 gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height + (dialogs[t]->actions ? 32 : 0) + 32))))
678 {
679 // move
680 if (dialogs[t]->allowmove)
681 {
682 if (t == DD_COMMUNICATIONS)
683 {
686 dialogs[D_COMMUNICATIONS]->windowseeklocation.z = -1.0f; // in case it is animated
688 }
689 else
690 {
691 dialogs[t]->windowlocation.x += gui->ptCursor.x - gui->ptClick.x;
692 dialogs[t]->windowlocation.y += gui->ptCursor.y - gui->ptClick.y;
693 dialogs[t]->windowseeklocation.z = -1.0f; // in case it is animated
694 }
695 gui->ptClick.x = gui->ptCursor.x;
696 gui->ptClick.y = gui->ptCursor.y;
697 CheckMoved(t);
698 }
699 hit = true;
700 gui->dragt = -1; gui->dragline = -1;
701 }
702 else if (gui->g_bLeftDown &&
703 gui->ptClick.x >= (dialogs[t]->windowlocation.x + dialogs[t]->width - 16) &&
704 gui->ptClick.x < (dialogs[t]->windowlocation.x + dialogs[t]->width) &&
705 gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0)) &&
706 gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + dialogs[t]->height))
707 {
708 if (dialogs[t]->scrollbarheight && gui->dragt < 0) // -1 or -2
709 {
710 gui->dragt = -2; // scrollbar dragging rail
711 if (gui->ptClick.y >= (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + 16 + dialogs[t]->scrollbartop) &&
712 gui->ptClick.y < (dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0) + 16 + dialogs[t]->scrollbartop + dialogs[t]->scrollbarheight))
713 {
714 char msg[999];
715 sprintf_s(msg, sizeof msg, "Dialog %i was ptClick.y %i ptCursor.y %i scrollbartop %i linetop %i",
717 logger->Log(msg);
718 // scroll bar itself
719 dialogs[t]->scrollbartop += static_cast<short>(gui->ptCursor.y - gui->ptClick.y); // reposition based on where they clicked first
720 gui->ptClick.y = gui->ptCursor.y; // follow where they drag it
721 if (dialogs[t]->scrollbartop < 0) // too far
722 {
724 dialogs[t]->scrollbartop = 0;
725 }
726 const float scrollheight = static_cast<float>(dialogs[t]->height) - 32; // minus the two buttons
727 const long oldlinetop = dialogs[t]->linetop;
728 if (dialogs[t]->scrollbartop > (scrollheight - dialogs[t]->scrollbarheight))
729 {
730 gui->ptClick.y -= dialogs[t]->scrollbartop - (static_cast<long>(scrollheight) - dialogs[t]->scrollbarheight);
731 dialogs[t]->scrollbartop = static_cast<short>(scrollheight) - dialogs[t]->scrollbarheight;
733 }
734 else
735 dialogs[t]->linetop = static_cast<long>(static_cast<float>(dialogs[t]->scrollbartop) / scrollheight * static_cast<float>(dialogs[t]->linetot));
736 if (dialogs[t]->linetop != oldlinetop)
737 dialogs[t]->UpdateMenu(-1);
738
739 dialogs[t]->ClearEdit();
740 sprintf_s(msg, sizeof msg, "Dialog %i now ptClick.y %i ptCursor.y %i scrollbartop %i linetop %i",
742 logger->Log(msg);
743 }
744 }
745 hit = true;
746 }
747 }
748
749 if (hit)
750 {
751 BringToFront(t);
752 break;
753 }
754 }
755#pragma endregion
756
757 logger->AddToCallStack("DialogBase::CheckDialogMouse DONE");
758}
759
760void DialogBase::TabClick(short clicked_tab)
761{
762 logger->AddToCallStack("DialogBase::TabClick");
763
764 if (clicked_tab != activetab) // if tab wasn't the active one, make it active
765 {
766 activetab = clicked_tab;
767 ClearEdit();
768 ActiveTab();
769 }
770
771 logger->AddToCallStack("DialogBase::TabClick DONE");
772}
773
774void DialogBase::DrawAllActiveDialogs(float fElapsedTime)
775{
776 logger->AddToCallStack("DialogBase::DrawAllActiveDialogs");
777 static bool missingResourcesReported = false;
778 if (!gui || !gui->g_pTextSprite || !gui->g_pFont || !gui->g_pChatFont)
779 {
780 logger->AddToCallStack("DialogBase::DrawAllActiveDialogs RESOURCES UNAVAILABLE");
781 if (!missingResourcesReported)
782 {
783 missingResourcesReported = true;
784 char msg[199];
785 sprintf_s(msg, sizeof msg, "DrawAllActiveDialogs skipped: gui %p sprite %p font %p chatfont %p",
786 static_cast<void*>(gui), gui ? static_cast<void*>(gui->g_pTextSprite) : nullptr,
787 gui ? static_cast<void*>(gui->g_pFont) : nullptr, gui ? static_cast<void*>(gui->g_pChatFont) : nullptr);
789 }
790 return;
791 }
792 missingResourcesReported = false;
793
794 gui->grippy = false;
795 static bool invalidDrawOrderReported[D_ENUMERATION] = {};
796 static bool invalidDialogStateReported[D_ENUMERATION] = {};
797
798 for (short runi = (D_ENUMERATION - 1); runi >= 0; runi--)
799 {
800 const short t = draworder[runi];
801 if (t < 0 || t >= D_ENUMERATION || !dialogs[t])
802 {
803 if (!invalidDrawOrderReported[runi])
804 {
805 invalidDrawOrderReported[runi] = true;
806 char msg[128];
807 sprintf_s(msg, sizeof msg, "DrawAllActiveDialogs rejected draw-order slot %i dialog %i", runi, t);
809 }
810 continue;
811 }
812 invalidDrawOrderReported[runi] = false;
813
814 DialogBase* dialog = dialogs[t];
815 const bool invalidDialogState = dialog->tabs < 0 || dialog->tabs > MAX_TAB ||
816 dialog->fields < 0 || dialog->fields > MAX_FIELDS || dialog->linedsp < 0 || dialog->linedsp > MAX_LINES ||
817 dialog->actions < 0 || dialog->actions > MAX_ACTION || dialog->actionsvisible < 0 ||
818 dialog->actionsvisible > dialog->actions || dialog->actionoffset < 0 || dialog->actionoffset > dialog->actions ||
819 !std::isfinite(dialog->actionslider) || dialog->actionslider < 0.0f || dialog->actionslider > dialog->actions ||
820 (dialog->tabs > 0 && (dialog->activetab < 0 || dialog->activetab >= dialog->tabs));
821 if (invalidDialogState)
822 {
823 if (!invalidDialogStateReported[t])
824 {
825 invalidDialogStateReported[t] = true;
826 char msg[199];
827 sprintf_s(msg, sizeof msg, "DrawAllActiveDialogs clamped dialog %i: tabs %i active %i fields %i lines %i actions %i visible %i offset %i",
828 t, dialog->tabs, dialog->activetab, dialog->fields, dialog->linedsp, dialog->actions, dialog->actionsvisible, dialog->actionoffset);
830 }
831 dialog->tabs = RiseMath::Min(RiseMath::Max(dialog->tabs, static_cast<short>(0)), static_cast<short>(MAX_TAB));
832 dialog->fields = RiseMath::Min(RiseMath::Max(dialog->fields, static_cast<short>(0)), static_cast<short>(MAX_FIELDS));
833 dialog->linedsp = RiseMath::Min(RiseMath::Max(dialog->linedsp, static_cast<short>(0)), static_cast<short>(MAX_LINES));
834 dialog->actions = RiseMath::Min(RiseMath::Max(dialog->actions, static_cast<short>(0)), static_cast<short>(MAX_ACTION));
835 dialog->actionsvisible = RiseMath::Min(RiseMath::Max(dialog->actionsvisible, static_cast<short>(0)), dialog->actions);
836 dialog->actionoffset = RiseMath::Min(RiseMath::Max(dialog->actionoffset, static_cast<short>(0)), dialog->actions);
837 if (!std::isfinite(dialog->actionslider) || dialog->actionslider < 0.0f || dialog->actionslider > dialog->actions)
838 dialog->actionslider = static_cast<float>(dialog->actionoffset);
839 if (dialog->tabs == 0 || dialog->activetab < 0 || dialog->activetab >= dialog->tabs)
840 dialog->activetab = 0;
841 }
842 else
843 invalidDialogStateReported[t] = false;
844
845 // window
846 if (dialog->active)
847 {
848 char stackMsg[80];
849 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Dialog %i", t);
850 logger->AddToCallStack(stackMsg);
851
852 RiseMath::Vector3 floorlocation;
853 floorlocation.x = floorf(dialogs[t]->windowlocation.x);
854 floorlocation.y = floorf(dialogs[t]->windowlocation.y);
855 floorlocation.z = floorf(dialogs[t]->windowlocation.z);
856 RECT rect;
857 RiseMath::Vector3 tracked = floorlocation;
858 if (dialogs[t]->tabs)
859 {
860 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Tabs %i", t);
861 logger->AddToCallStack(stackMsg);
862 DWORD temptextcolor, tempcolor;
863 // TABS are 16 tall
864 for (short q = 0; q < dialogs[t]->tabs; q++)
865 {
866 long fonty = static_cast<long>(tracked.y) + 2;
867 rect.left = 9 - dialogs[t]->tabwidth[q];
868 rect.right = 9;
869 if (q != dialogs[t]->activetab)
870 {
871 // inactive flashing tab
872 if (gui->g_bTabLit && dialogs[t]->tabflash[q])
873 {
874 rect.top = 48;
875 rect.bottom = 64;
876 temptextcolor = 0xFF000000;
877 }
878 else // inactive tab not flashing
879 {
880 rect.top = 16;
881 rect.bottom = 32;
882 temptextcolor = 0xFF778589;
883 }
884 tempcolor = 0xFFC0E8FF;
885 }
886 else
887 {
888 // active tab
889 rect.top = 0;
890 rect.bottom = 16;
891 temptextcolor = 0xFFC0C0C0;
892 tempcolor = 0xFFBCE6FF;
893 fonty++;
894 }
895
896 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, tempcolor);
897 rect.left = static_cast<long>(tracked.x) + 2;
898 rect.top = fonty;
899 rect.right = rect.bottom = -1;
900 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->tabeffectivestr[q], -1, &rect, DT_NOCLIP, temptextcolor);
901 dialogs[t]->tabx[q] = static_cast<short>(tracked.x);
902 tracked.x += dialogs[t]->tabwidth[q];
903 }
904 tracked.x = floorlocation.x;
905 tracked.y += 16;
906 }
907
908 // header is 8 tall
909 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Header %i", t);
910 logger->AddToCallStack(stackMsg);
911 rect.top = 32;
912 rect.left = 62;
913 rect.right = rect.left + dialogs[t]->width;
914 rect.bottom = 40;
915 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
916 tracked.y += 8;
917
918 // fields are 16 tall
919 if (dialogs[t]->fields)
920 {
921 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Fields %i", t);
922 logger->AddToCallStack(stackMsg);
923 if (dialogs[t]->showfields)
924 {
925 // background
926 rect.top = 32 + 8;
927 rect.left = 62;
928 rect.right = rect.left + dialogs[t]->width;
929 rect.bottom = 56;
930 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
931 }
932
933 for (short q = 0; q < dialogs[t]->fields; q++)
934 {
935 dialogs[t]->fieldx[q] = static_cast<short>(tracked.x);
936
937 if (dialogs[t]->showfields &&
938 dialogs[t]->fieldtype[q] != FIELD_ICON &&
939 dialogs[t]->fieldtype[q] != FIELD_RANKICON &&
940 dialogs[t]->fieldtype[q] != FIELD_ALLIANCEICON) // not a logo
941 {
942 // text
943 rect.top = static_cast<long>(tracked.y) + 2;
944 rect.left = static_cast<long>(tracked.x) + 5;
945 rect.right = rect.bottom = -1;
946 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->fieldeffectivetitle[q], -1, &rect, DT_NOCLIP, 0xFF808080);
947 }
948
949 tracked.x += dialogs[t]->fieldeffectivewidth[q];
950 }
951
952 tracked.x = floorlocation.x;
953 if (dialogs[t]->showfields)
954 tracked.y += 16;
955 }
956
957 // list is height tall
958 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Background %i", t);
959 logger->AddToCallStack(stackMsg);
960 rect.left = rect.top = 0;
961 rect.right = dialogs[t]->width - (dialogs[t]->allowscroll ? 16 : 0);
962 rect.bottom = dialogs[t]->height;
963 if (dialogs[t]->normalinterlace)
964 gui->g_pTextSprite->Draw(gui->m_pddsGUIInterlace, &rect, nullptr, &tracked, 0xFFFFFFFF);
965 else
966 gui->g_pTextSprite->Draw(gui->m_pddsGUIInterlace2, &rect, nullptr, &tracked, 0xFFFFFFFF);
967
968 // some of these (like network statistics) override the Draw method
969 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Draw %i", t);
970 logger->AddToCallStack(stackMsg);
971 dialogs[t]->Draw(&tracked);
972 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Draw DONE %i", t);
973 logger->AddToCallStack(stackMsg);
974 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::PostDraw %i", t);
975 logger->AddToCallStack(stackMsg);
976
977 // Highlighted list item background
978 if ((gui->dragt == -1 || gui->dragt != t) && dialogs[t]->linecursel != -1 && (dialogs[t]->linecursel - dialogs[t]->linetop) > -1 && (dialogs[t]->linecursel - dialogs[t]->linetop) < dialogs[t]->linedsp)
979 {
980 RECT temprect;
981 temprect.top = 16; temprect.left = 63; temprect.right = temprect.left + dialogs[t]->width - 16; temprect.bottom = 32;
982 RiseMath::Vector3 temptracked = RiseMath::Vector3(tracked.x + 1, tracked.y + 16 * (dialogs[t]->linecursel - dialogs[t]->linetop), 0.0f);
983 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &temprect, nullptr, &temptracked, 0xFFFFFFFF);
984 }
985
986 // list items
987 for (short q = 0; q < dialogs[t]->fields; q++) // these are fields
988 {
989 for (short pn = 0; pn < dialogs[t]->linedsp; pn++) // these are the lines
990 {
991 if (dialogs[t]->fieldtype[q] == FIELD_VARTEXT || dialogs[t]->fieldtype[q] == FIELD_FIXEDTEXT) // fixed/variable text
992 {
993 rect.top = static_cast<long>(tracked.y) + 2 + 16 * pn;
994 rect.left = static_cast<long>(tracked.x) + 5;
995 rect.right = rect.bottom = -1;
996 if (gui->dragt != t || gui->dragline != (dialogs[t]->linetop + pn))
997 {
998 if (dialogs[t]->lineact == (dialogs[t]->linetop + pn))
999 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->fieldeffectiveline[pn][q], -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
1000 else
1001 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->fieldeffectiveline[pn][q], -1, &rect, DT_NOCLIP, 0xFFAEAEAE);
1002 }
1003 else // floating
1004 {
1005 rect.top += -gui->ptClick.y + gui->ptCursor.y;
1006 rect.left += -gui->ptClick.x + gui->ptCursor.x;
1007 if (dialogs[t]->lineact == (dialogs[t]->linetop + pn))
1008 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->fieldeffectiveline[pn][q], -1, &rect, DT_NOCLIP, 0x80FFFFFF);
1009 else
1010 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->fieldeffectiveline[pn][q], -1, &rect, DT_NOCLIP, 0x80AEAEAE);
1011 }
1012 }
1013 else if (dialogs[t]->fieldtype[q] == FIELD_MULTILINECHAT) // multilinechat
1014 {
1015 if (dialogs[t]->fieldline[pn][q][0] != 32767)
1016 {
1017 if (wcsncmp(dialogs[t]->fieldline[pn][q], L"TC_WAYPOINT,", 12) != 0) // chat
1018 {
1019 rect.top = static_cast<long>(tracked.y) + 16 * pn;
1020 rect.left = static_cast<long>(tracked.x) + 5; // 5 is margin
1021 rect.right = rect.left + dialogs[t]->fieldeffectivewidth[q] - 5; // 5 is margin
1022 rect.bottom = static_cast<long>(floorlocation.y) + 16 + 8 + dialogs[t]->height;
1023 if (gui->dragt != t || gui->dragline != (dialogs[t]->linetop + pn))
1024 {
1025 gui->g_pChatFont->DrawText(gui->g_pTextSprite, dialogs[t]->fieldline[pn][q], -1, &rect, DT_WORDBREAK, 0xFFAEAEAE);
1026 }
1027 else // floating
1028 {
1029 rect.top += -gui->ptClick.y + gui->ptCursor.y;
1030 rect.left += -gui->ptClick.x + gui->ptCursor.x;
1031 rect.right += -gui->ptClick.x + gui->ptCursor.x;
1032 rect.bottom += -gui->ptClick.y + gui->ptCursor.y;
1033 gui->g_pChatFont->DrawText(gui->g_pTextSprite, dialogs[t]->fieldline[pn][q], -1, &rect, DT_WORDBREAK, 0x80AEAEAE);
1034 }
1035 }
1036 else // tokenized
1037 {
1038 RECT textrect;
1039 textrect.top = static_cast<long>(tracked.y) + 16 * pn;
1040 textrect.left = static_cast<long>(tracked.x) + 5 + 16 + 5; // 5 is margin and 16 is the icon with another margin
1041 textrect.right = rect.left + dialogs[t]->fieldeffectivewidth[q] - 5;// 5 is margins +(long)dialogs[t]->windowlocation.x - (long)dialogs[t]->fieldx[q];
1042 textrect.bottom = static_cast<long>(floorlocation.y) + 16 + 8 + dialogs[t]->height;
1043 WCHAR str[99];
1044
1045 RiseMath::Vector3 tempvec;
1046 tempvec.x = tracked.x + 5;
1047 tempvec.y = tracked.y + 1 + 16 * pn;
1048 tempvec.z = 0.0f; // line, field, text
1049
1050 // Deserialize
1051 Swaypoint tempwaypoint;
1052 WCHAR waypointName[64] = {};
1053 setlocale(LC_ALL, "English_United States.1252");
1054 swscanf_s(dialogs[t]->fieldline[pn][q], L"TC_WAYPOINT,%i,%f,%f,%f,%63[^\n]", &tempwaypoint.uniqueid, &tempwaypoint.location.x, &tempwaypoint.location.y, &tempwaypoint.location.z, waypointName, static_cast<unsigned>(_countof(waypointName)));
1055 gui->SetLocale();
1056 wcscpy_s(str, 99, waypointName);
1057
1058 rect.left = 225; rect.right = 239;
1059 rect.top = 97; rect.bottom = 111;
1060 if (dialogs[t]->lineact == (dialogs[t]->linetop + pn))
1061 {
1062 rect.top += 16; rect.bottom += 16;
1063 }
1064 if (gui->dragt != t || gui->dragline != (dialogs[t]->linetop + pn))
1065 {
1066 gui->g_pChatFont->DrawTextW(gui->g_pTextSprite, str, -1, &textrect, DT_WORDBREAK, 0xFFAEAEAE);
1067 }
1068 else // floating
1069 {
1070 tempvec.x += -gui->ptClick.x + gui->ptCursor.x;
1071 tempvec.y += -gui->ptClick.y + gui->ptCursor.y;
1072 textrect.top += -gui->ptClick.y + gui->ptCursor.y;
1073 textrect.left += -gui->ptClick.x + gui->ptCursor.x;
1074 textrect.right += -gui->ptClick.x + gui->ptCursor.x;
1075 textrect.bottom += -gui->ptClick.y + gui->ptCursor.y;
1076 gui->g_pChatFont->DrawText(gui->g_pTextSprite, str, -1, &textrect, DT_WORDBREAK, 0xFFAEAEAE);
1077
1078 }
1079 gui->g_pTextSprite->Draw(gui->m_pddsGUIActions, &rect, nullptr, &tempvec, 0xFFFFFFFF);
1080 }
1081 }
1082 }
1083 else if (dialogs[t]->fieldtype[q] == FIELD_ICON && dialogs[t]->fieldline[pn][q][0] != 0) // must be a logo, check that there is an icon
1084 {
1085 rect.top = 96;
1086 rect.bottom = 112;
1087 if (dialogs[t]->linecursel == (dialogs[t]->linetop + pn))
1088 {
1089 rect.top += 16;
1090 rect.bottom += 16;
1091 }
1092 rect.left = (dialogs[t]->fieldline[pn][q][0] - 1) * 16;
1093 rect.right = rect.left + 16;
1094 RiseMath::Vector3 tempvec = RiseMath::Vector3(tracked.x + 7, tracked.y + 16 * pn, tracked.z);
1095 if (gui->dragt != t || gui->dragline != (dialogs[t]->linetop + pn))
1096 gui->g_pTextSprite->Draw(gui->m_pddsGUIActions, &rect, nullptr, &tempvec, 0xFFFFFFFF);
1097 else
1098 {
1099 tempvec.x += static_cast<float>(gui->ptCursor.x - gui->ptClick.x);
1100 tempvec.y += static_cast<float>(gui->ptCursor.y - gui->ptClick.y);
1101 gui->g_pTextSprite->Draw(gui->m_pddsGUIActions, &rect, nullptr, &tempvec, 0xFFFFFFFF);
1102 }
1103 if (!gui->g_bDragging && // if we click the icon to drag the row we don't need it's helpboxlang
1104 gui->ptCursor.x >= tempvec.x && gui->ptCursor.x < (tempvec.x + 16) && gui->ptCursor.y >= tempvec.y && gui->ptCursor.y < (tempvec.y + 16))
1105 gui->helpboxlang = L_ICON_MARKED + dialogs[t]->fieldline[pn][q][0] - 1;
1106 }
1107 else if (dialogs[t]->fieldtype[q] == FIELD_RANKICON && dialogs[t]->fieldline[pn][q][1])
1108 {
1109 rect.top = dialogs[t]->fieldline[pn][q][0] * 32;
1110 rect.bottom = rect.top + 16;
1111 if (dialogs[t]->linecursel == (dialogs[t]->linetop + pn))
1112 {
1113 rect.top += 16; // highlight
1114 rect.bottom += 16;
1115 }
1116 rect.left = (dialogs[t]->fieldline[pn][q][1] - 1) * 32; // ranks start at 1
1117 rect.right = rect.left + 32;
1118 RiseMath::Vector3 tempvec = RiseMath::Vector3(tracked.x + 7, tracked.y + 16 * pn, tracked.z);
1119 if (gui->dragt != t || gui->dragline != (dialogs[t]->linetop + pn))
1120 gui->g_pTextSprite->Draw(gui->m_pddsGUIRanks, &rect, nullptr, &tempvec, 0xFFFFFFFF);
1121 else
1122 {
1123 tempvec.x += static_cast<float>(gui->ptCursor.x - gui->ptClick.x);
1124 tempvec.y += static_cast<float>(gui->ptCursor.y - gui->ptClick.y);
1125 gui->g_pTextSprite->Draw(gui->m_pddsGUIRanks, &rect, nullptr, &tempvec, 0xFFFFFFFF);
1126 }
1127 if (!gui->g_bDragging &&
1128 gui->ptCursor.x >= tempvec.x && gui->ptCursor.x < (tempvec.x + 16) && gui->ptCursor.y >= tempvec.y && gui->ptCursor.y < (tempvec.y + 16))
1129 gui->helpboxlang = L_RANKICONMILITARY1 + 12 * dialogs[t]->fieldline[pn][q][0] + dialogs[t]->fieldline[pn][q][1] - 1;
1130 }
1131 }
1132 tracked.x += dialogs[t]->fieldeffectivewidth[q];
1133 }
1134 tracked.x = floorlocation.x + dialogs[t]->width - (dialogs[t]->allowscroll ? 16 : 0);
1135
1136 if (dialogs[t]->allowscroll)
1137 {
1138 // scroll up
1139 rect.left = 40;
1140 rect.top = 96;
1141 rect.right = 56;
1142 rect.bottom = 112;
1143 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1144 tracked.y += 16;
1145
1146 // scroll rail
1147 rect.left = 0;
1148 rect.top = 0;
1149 rect.right = 16;
1150 rect.bottom = dialogs[t]->height - 32;
1151 gui->g_pTextSprite->Draw(gui->m_pddsGUIScroll, &rect, nullptr, &tracked, 0xFFFFFFFF);
1152 tracked.y += dialogs[t]->scrollbartop;
1153
1154 // scroll button top
1155 rect.left = 24;
1156 rect.top = 109;
1157 rect.right = 40;
1158 rect.bottom = 111;
1159 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1160 tracked.y += 2;
1161
1162 // scroll bar vertical repeat (guts)
1163 rect.left = 0;
1164 rect.top = 0;
1165 rect.right = 16;
1166 rect.bottom = dialogs[t]->scrollbarheight - 4;
1167 gui->g_pTextSprite->Draw(gui->m_pddsGUIScrollButton, &rect, nullptr, &tracked, 0xFFFFFFFF);
1168 tracked.y += dialogs[t]->scrollbarheight - 4;
1169
1170 // scroll button button
1171 rect.left = 24;
1172 rect.top = 113;
1173 rect.right = 40;
1174 rect.bottom = 115;
1175 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1176 tracked.y += 2;
1177 tracked.y += dialogs[t]->height - 32 - dialogs[t]->scrollbarheight - dialogs[t]->scrollbartop;
1178
1179 // scroll down
1180 rect.left = 40;
1181 rect.top = 112;
1182 rect.right = 56;
1183 rect.bottom = 128;
1184 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1185 tracked.y += 16;
1186 }
1187 else
1188 {
1189 // Match the full content height advanced by the scrollbar path.
1190 tracked.y += dialogs[t]->height;
1191 }
1192
1193 tracked.x = floorlocation.x;
1194
1195 if (dialogs[t]->actions)
1196 {
1197 // action bar left
1198 if (dialogs[t]->actionoffset == 0) // diabled
1199 {
1200 rect.left = 16;
1201 rect.right = 32;
1202 }
1203 else if (gui->cursoroverwindow == t && gui->ptCursor.x >= tracked.x && gui->ptCursor.x < (tracked.x + 16) &&
1204 gui->ptCursor.y >= tracked.y && gui->ptCursor.y < (tracked.y + 32))
1205 {
1206 // mouseover
1207 rect.left = 48;
1208 rect.right = 64;
1209 }
1210 else // available
1211 {
1212 rect.left = 32;
1213 rect.right = 48;
1214 }
1215 rect.top = 96;
1216 rect.bottom = 128;
1217 gui->g_pTextSprite->Draw(gui->m_pddsGUIParts, &rect, nullptr, &tracked, 0xFFFFFFFF);
1218 tracked.x += 16;
1219
1220 // action bar background
1221 rect.left = 63;
1222 rect.top = 96;
1223 rect.right = 63 + dialogs[t]->width - 32;
1224 rect.bottom = 128;
1225 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1226 tracked.x += dialogs[t]->width - 32;
1227
1228 // action bar right
1229 if (dialogs[t]->actionoffset >= (dialogs[t]->actions - dialogs[t]->actionsvisible)) // disabled
1230 {
1231 rect.left = 480;
1232 rect.right = 496;
1233 }
1234 else if (gui->cursoroverwindow == t && gui->ptCursor.x >= tracked.x && gui->ptCursor.x < (tracked.x + 16) &&
1235 gui->ptCursor.y >= tracked.y && gui->ptCursor.y < (tracked.y + 32))
1236 {
1237 // mouseover
1238 rect.left = 448;
1239 rect.right = 464;
1240 }
1241 else // available
1242 {
1243 rect.left = 464;
1244 rect.right = 480;
1245 }
1246 rect.top = 96;
1247 rect.bottom = 128;
1248 gui->g_pTextSprite->Draw(gui->m_pddsGUIParts, &rect, nullptr, &tracked, 0xFFFFFFFF);
1249
1250 // actions
1251 tracked.x = floorlocation.x + 18 - 32 * fmodf(dialogs[t]->actionslider, 1.0f);
1252 short mouseover = -1;
1253 const short farthestrightvisibleaction = RiseMath::Min(dialogs[t]->actionsvisible, dialogs[t]->actions);
1254 for (short r = 0; r < (farthestrightvisibleaction + 2); r++)
1255 {
1256 long leftadjust = 0, rightadjust = 0;
1257 if (tracked.x < (floorlocation.x + 18))
1258 {
1259 leftadjust = (static_cast<long>(floorlocation.x) + 18) - static_cast<long>(tracked.x);
1260 tracked.x += leftadjust;
1261 }
1262 if ((tracked.x + 16) > (static_cast<long>(floorlocation.x) + dialogs[t]->width - 34))
1263 rightadjust = (static_cast<long>(tracked.x) + 16) - (static_cast<long>(floorlocation.x) + dialogs[t]->width - 34);
1264
1265 const short s = r + static_cast<short>(dialogs[t]->actionslider);
1266 if (s < 0 || s >= dialogs[t]->actions || s >= MAX_ACTION)
1267 {
1268 tracked.x += 32 - leftadjust;
1269 continue;
1270 }
1271 if (gui->cursoroverwindow == t && s < dialogs[t]->actions && gui->ptCursor.x >= tracked.x && gui->ptCursor.x < (tracked.x + 32 - rightadjust) &&
1272 gui->ptCursor.y >= tracked.y && gui->ptCursor.y < (tracked.y + 32))
1273 {
1274 mouseover = s;
1276 }
1277 rect.left = 32 * dialogs[t]->action[s] + leftadjust;
1278 if (!dialogs[t]->actionenabled[s])
1279 {
1280 rect.top = 0;
1281 rect.bottom = 32;
1282 }
1283 else
1284 {
1285 if (mouseover != s) // active
1286 {
1287 rect.top = 32;
1288 rect.bottom = 64;
1289 }
1290 else // mouseover
1291 {
1292 rect.top = 64;
1293 rect.bottom = 96;
1294 }
1295 }
1296 rect.right = 32 * dialogs[t]->action[s] + 32 - rightadjust;
1297 if (rect.right > rect.left && s < dialogs[t]->actions)
1298 {
1299 gui->g_pTextSprite->Draw(gui->m_pddsGUIActions, &rect, nullptr, &tracked, 0xFFFFFFFF);
1300 if (dialogs[t]->actiontoggle[s])
1301 {
1302 RECT temprect;
1303 temprect.left = 64; temprect.right = 96;
1304 temprect.top = 96; temprect.bottom = 128;
1305 gui->g_pTextSprite->Draw(gui->m_pddsGUIParts, &temprect, nullptr, &tracked, 0xFFFFFFFF);
1306 }
1307 }
1308 tracked.x += 32 - leftadjust;
1309 }
1310
1311 tracked.x = floorlocation.x;
1312 tracked.y += 32;
1313 }
1314
1315 // footer confirmation and/or messages bar
1316 rect.left = 63;
1317 rect.top = 64;
1318 rect.right = rect.left + dialogs[t]->width - 32;
1319 rect.bottom = 80;
1320 if (dialogs[t]->msgbarcolor == 1) // green
1321 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFF00FF00);
1322 else if (dialogs[t]->msgbarcolor == 2) // amber
1323 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFF00);
1324 else if (dialogs[t]->msgbarcolor == 3) // red
1325 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFF0000);
1326 else
1327 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFF6F7F84);
1328
1329 if (dialogs[t]->msgbartext[0])
1330 {
1331 rect.left = static_cast<long>(tracked.x) + 3;
1332 rect.top = static_cast<long>(tracked.y) + 3;
1333 rect.right = rect.left + dialogs[t]->width - 6;
1334 rect.bottom = rect.top + 16;
1335 if (dialogs[t]->msgbarcolor == 1) // green
1336 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->msgbartext, -1, &rect, 0, 0xFFFFFFFF);
1337 else if (dialogs[t]->msgbarcolor == 2) // amber
1338 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->msgbartext, -1, &rect, 0, 0xFF000000);
1339 else if (dialogs[t]->msgbarcolor == 3) // red
1340 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->msgbartext, -1, &rect, 0, 0xFFFFFFFF);
1341 else
1342 gui->g_pFont->DrawTextW(gui->g_pTextSprite, dialogs[t]->msgbartext, -1, &rect, 0, 0xFFA0A0A0);
1343 }
1344 tracked.x += dialogs[t]->width - 32;
1345
1346 // icon
1347 rect = dialogs[t]->iconsource;
1348 rect.top += 32; rect.bottom += 32;
1349 gui->g_pTextSprite->Draw(gui->m_pddsGUIParts, &rect, nullptr, &tracked, 0xFFFFFFFF);
1350 if (dialogs[t]->allowresize && gui->cursoroverwindow == t && gui->ptCursor.x >= tracked.x && gui->ptCursor.x < (tracked.x + 32) &&
1351 gui->ptCursor.y >= tracked.y && gui->ptCursor.y < (tracked.y + 32))
1352 gui->grippy = true;
1353
1354 tracked.x = floorlocation.x;
1355 tracked.y += 16;
1356
1357 // footer left bottom bar
1358 rect.top = 80;
1359 rect.left = 62;
1360 rect.right = rect.left + dialogs[t]->width - 34 - 32;
1361 if (!dialogs[t]->allowresize)
1362 rect.right += 16;
1363 if (!dialogs[t]->allowclose)
1364 rect.right += 16;
1365 rect.bottom = 96;
1366 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1367
1368 // window title
1369 rect.top = static_cast<long>(tracked.y) + 2;
1370 rect.left = static_cast<long>(tracked.x) + 3;
1371 rect.bottom = rect.right = -1;
1372 WCHAR uprmsg[HELP_SIZE];
1373 wcscpy_s(uprmsg, HELP_SIZE, dialogs[t]->Title());
1374 _wcsupr_s(uprmsg, HELP_SIZE);
1375 gui->g_pFont->DrawTextW(gui->g_pTextSprite, uprmsg, -1, &rect, DT_NOCLIP, 0xFFFFFFFF);
1376 tracked.x += dialogs[t]->width - 34 - 32;
1377 if (!dialogs[t]->allowresize)
1378 tracked.x += 16;
1379 if (!dialogs[t]->allowclose)
1380 tracked.x += 16;
1381
1382 // footer right
1383 rect.left = 0;
1384 rect.top = 80;
1385 rect.right = 2;
1386 rect.bottom = 96;
1387 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1388 tracked.x += 2;
1389
1390 // minimize/maximize
1391 if (dialogs[t]->allowresize)
1392 {
1393 rect.left = 24;
1394 rect.right = 40;
1395 if (gui->cursoroverwindow == t &&
1396 gui->ptCursor.x >= tracked.x && gui->ptCursor.x < (tracked.x + 16) &&
1397 gui->ptCursor.y >= tracked.y && gui->ptCursor.y < (tracked.y + 16))
1398 {
1399 rect.top = 80;
1400 rect.bottom = 96;
1401 }
1402 else
1403 {
1404 rect.top = 64;
1405 rect.bottom = 80;
1406 }
1407 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1408 tracked.x += 16;
1409 }
1410
1411 // close
1412 if (dialogs[t]->allowclose)
1413 {
1414 rect.left = 40;
1415 rect.right = 56;
1416 if (gui->cursoroverwindow == t && gui->ptCursor.x >= tracked.x && gui->ptCursor.x < (tracked.x + 16) &&
1417 gui->ptCursor.y >= tracked.y && gui->ptCursor.y < (tracked.y + 16))
1418 {
1419 rect.top = 80;
1420 rect.bottom = 96;
1421 }
1422 else
1423 {
1424 rect.top = 64;
1425 rect.bottom = 80;
1426 }
1427 gui->g_pTextSprite->Draw(gui->m_pddsGUILateral, &rect, nullptr, &tracked, 0xFFFFFFFF);
1428 }
1429
1430 HRESULT hr;
1431 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Flush %i", t);
1432 logger->AddToCallStack(stackMsg);
1433 V(gui->g_pTextSprite->Flush());
1434 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::Flush DONE %i", t);
1435 logger->AddToCallStack(stackMsg);
1436 if (dialogs[t]->usesHUD)
1437 {
1438 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::HUD %i", t);
1439 logger->AddToCallStack(stackMsg);
1440 V(HudDiagnostics::Render(dialogs[t]->HUD, fElapsedTime, t, *logger));
1441 sprintf_s(stackMsg, sizeof stackMsg, "DrawAllActiveDialogs::HUD DONE %i", t);
1442 logger->AddToCallStack(stackMsg);
1443 }
1444 }
1445 }
1446
1447 logger->AddToCallStack("DialogBase::DrawAllActiveDialogs DONE");
1448}
1449
1451{
1452 logger->AddToCallStack("DialogBase::CheckWidth");
1453
1454 short cursoradj = 0;
1455 short minimum = RiseMath::Max(72 + (short)wcslen(dialogs[dialogid]->Title()) * gui->FONT_WIDTH, dialogs[dialogid]->fields * 30 + 16);
1456 minimum = RiseMath::Max(minimum, dialogs[dialogid]->tabs * (4 * gui->FONT_WIDTH + 13)); // 4 characters plus the 13 framing
1457 if (dialogs[dialogid]->width < minimum)
1458 {
1459 cursoradj = static_cast<short>(minimum - dialogs[dialogid]->width);
1460 gui->ptClick.x = gui->ptCursor.x + cursoradj;//minimum-dialog[t].width;
1461 dialogs[dialogid]->width = minimum;
1462 }
1463
1465 {
1466 // actions
1467 if (dialogs[dialogid]->actions)
1468 {
1469 const short oldactionsvisible = dialogs[dialogid]->actionsvisible;
1470 dialogs[dialogid]->actionsvisible = (static_cast<short>(dialogs[dialogid]->width) - 32 - 2) / 32;
1471 if (dialogs[dialogid]->actionsvisible > oldactionsvisible && dialogs[dialogid]->actionoffset > 0)
1473 }
1474 }
1475
1476 // tabs
1477 short extraspacereq = 0;
1478 for (short q = 0; q < dialogs[dialogid]->tabs; q++)
1479 {
1480 if (dialogs[dialogid]->tabusedefaultlang[q]) // default tab
1481 extraspacereq += RiseMath::Max(0, (short)wcslen(gui->strings[dialogs[dialogid]->tabusedefaultlang[q]].c_str()) - 4);
1482 else if (dialogs[dialogid]->tabstr[q][0] == 0)
1483 extraspacereq += RiseMath::Max(0, (short)wcslen(gui->strings[L_TAB_UNNAMED].c_str()) - 4);
1484 else
1485 extraspacereq += RiseMath::Max(0, (short)wcslen(dialogs[dialogid]->tabstr[q]) - 4);
1486 }
1487 const float mag = (static_cast<float>(dialogs[dialogid]->width) - static_cast<float>(dialogs[dialogid]->tabs) * (4 * static_cast<float>(gui->FONT_WIDTH) + 13)) / (static_cast<float>(extraspacereq) * static_cast<float>(gui->FONT_WIDTH));
1488 for (short q = 0; q < dialogs[dialogid]->tabs; q++)
1489 {
1490 short addcharsreq;
1491 if (dialogs[dialogid]->tabusedefaultlang[q]) // default tab
1492 addcharsreq = RiseMath::Max(0, (short)wcslen(gui->strings[dialogs[dialogid]->tabusedefaultlang[q]].c_str()) - 4);
1493 else if (dialogs[dialogid]->tabstr[q][0] == 0)
1494 addcharsreq = RiseMath::Max(0, (short)wcslen(gui->strings[L_TAB_UNNAMED].c_str()) - 4);
1495 else
1496 addcharsreq = RiseMath::Max(0, (short)wcslen(dialogs[dialogid]->tabstr[q]) - 4);
1497
1498 dialogs[dialogid]->tabwidth[q] = 4 * gui->FONT_WIDTH + 13 + static_cast<short>(static_cast<float>(addcharsreq) * static_cast<float>(gui->FONT_WIDTH) * mag);
1499 if (dialogs[dialogid]->tabwidth[q] > (4 + addcharsreq) * gui->FONT_WIDTH + 13)
1500 dialogs[dialogid]->tabwidth[q] = (4 + addcharsreq) * gui->FONT_WIDTH + 13;
1501
1502 if (dialogs[dialogid]->tabusedefaultlang[q]) // default tab
1504 else if (dialogs[dialogid]->tabstr[q][0] == 0)
1506 else
1508 const auto chars = static_cast<short>(static_cast<float>(dialogs[dialogid]->tabwidth[q] - 13) / static_cast<float>(gui->FONT_WIDTH));
1509 if (static_cast<short>(wcslen(dialogs[dialogid]->tabeffectivestr[q])) > chars)
1510 {
1511 dialogs[dialogid]->tabeffectivestr[q][chars] = 0;
1512 dialogs[dialogid]->tabeffectivestr[q][chars - 1] = '.';
1513 dialogs[dialogid]->tabeffectivestr[q][chars - 2] = '.';
1514 dialogs[dialogid]->tabeffectivestr[q][chars - 3] = '.';
1515 }
1516 if (dialogs[dialogid]->edittab == q && dialogs[dialogid]->tabwidth[q] >= -20)
1517 dialogs[dialogid]->HUD.GetEditBox(IDC_TABEDIT)->SetSize(static_cast<int>(dialogs[dialogid]->tabwidth[q]) + 20, 32);
1518 }
1519
1520 // fields
1521 long spaceavailable = dialogs[dialogid]->width - 16 - 3, spaceneeded = 0;
1522 for (short q = 0; q < dialogs[dialogid]->fields; q++)
1523 {
1524 if (dialogs[dialogid]->fieldtype[q] == FIELD_ICON ||
1526 dialogs[dialogid]->fieldtype[q] == FIELD_ALLIANCEICON) // fixed width icon
1527 spaceavailable -= dialogs[dialogid]->fieldwidth[q];
1528 else
1529 {
1530 spaceneeded += dialogs[dialogid]->fieldwidth[q];
1531 spaceavailable -= 5; // spacer between text fields
1532 }
1533 }
1534
1535 for (short q = 0; q < dialogs[dialogid]->fields; q++)
1536 {
1537 dialogs[dialogid]->fieldeffectivewidth[q] = static_cast<short>(static_cast<float>(spaceavailable) / static_cast<float>(spaceneeded) * static_cast<float>(dialogs[dialogid]->fieldwidth[q]));
1538
1540 {
1541 if (dialogs[dialogid]->sortfield == q)
1542 {
1543 // WCHAR str[HELP_SIZE];
1544 // wcscpy_s(str, HELP_SIZE, dialog[t].fieldeffectivetitle[q]);
1545 if (dialogs[dialogid]->sortdirection == 1) // down
1546 wcscpy_s(dialogs[dialogid]->fieldeffectivetitle[q], HELP_SIZE, L"â–¼ ");
1547 else // up
1548 wcscpy_s(dialogs[dialogid]->fieldeffectivetitle[q], HELP_SIZE, L"â–² ");
1549 }
1550 else
1552
1555 }
1556
1557 long effectivechars = static_cast<long>(floorf(static_cast<float>(dialogs[dialogid]->fieldeffectivewidth[q]) / static_cast<float>(gui->FONT_WIDTH)));
1558 if (effectivechars < 4)
1559 {
1560 effectivechars = 4;
1562 }
1563 else
1564 {
1566 }
1567
1568 if (static_cast<long>(wcslen(dialogs[dialogid]->fieldeffectivetitle[q])) > effectivechars)
1569 {
1570 dialogs[dialogid]->fieldeffectivetitle[q][effectivechars - 3] = '.';
1571 dialogs[dialogid]->fieldeffectivetitle[q][effectivechars - 2] = '.';
1572 dialogs[dialogid]->fieldeffectivetitle[q][effectivechars - 1] = '.';
1573 dialogs[dialogid]->fieldeffectivetitle[q][effectivechars] = 0;
1574 }
1575
1576 // do this for the list too?
1578 for (short r = 0; r < dialogs[dialogid]->linedsp; r++)
1579 {
1582 else
1583 dialogs[dialogid]->fieldeffectiveline[r][q][0] = 0;
1584 if (static_cast<long>(wcslen(dialogs[dialogid]->fieldeffectiveline[r][q])) > effectivechars)
1585 {
1586 dialogs[dialogid]->fieldeffectiveline[r][q][effectivechars - 3] = '.';
1587 dialogs[dialogid]->fieldeffectiveline[r][q][effectivechars - 2] = '.';
1588 dialogs[dialogid]->fieldeffectiveline[r][q][effectivechars - 1] = '.';
1589 dialogs[dialogid]->fieldeffectiveline[r][q][effectivechars] = 0;
1590 }
1591 }
1592
1593 if (dialogs[dialogid]->fieldtype[q] == FIELD_ICON ||
1595 dialogs[dialogid]->fieldtype[q] == FIELD_ALLIANCEICON) // not fixed, must be variable
1597
1598 if (1 == 0 && dialogs[dialogid]->editfield == q && dialogs[dialogid]->fieldeffectivewidth[q] >= -20 && dialogs[dialogid]->linecursel != -1)
1599 {
1601 if (cdxut_edit_box != nullptr)
1602 {
1603 const float topMargin = RiseMath::Max(0.0f, (32.0f - 32.0f * gui->game->displayscale)) * 0.5f; // so min is 32 so if it is 10 then 22 ... 11 top and bottom
1604 cdxut_edit_box->SetSize(static_cast<int>((dialogs[dialogid]->fieldeffectivewidth[q] + 20) * gui->game->displayscale), 32);
1605 cdxut_edit_box->SetLocation(static_cast<int>(((dialogs[dialogid]->fieldx[q] - dialogs[dialogid]->windowlocation.x) - 5) * gui->game->displayscale),
1606 static_cast<int>(((dialogs[dialogid]->linecursel - dialogs[dialogid]->linetop) * 16 - 7) * gui->game->displayscale - topMargin));
1607 }
1608 }
1609 }
1610
1612 {
1613 // if CONTENT changes we call UpdateCMMenu which in turn calls this function
1614 // if SIZE changes we call just this function
1615 // if SIZE changes we have to do a "refreshchat" as well
1616 if (dialogs[dialogid]->editfield != -1 && dialogs[dialogid]->width >= 32)
1617 dialogs[dialogid]->HUD.GetEditBox(IDC_TRANSMIT)->SetSize(static_cast<int>((dialogs[dialogid]->width - 32) * gui->game->displayscale), static_cast<int>(32 * gui->game->displayscale));
1618 }
1619
1620 logger->AddToCallStack("DialogBase::CheckWidth DONE");
1621
1622 return cursoradj;
1623}
1624
1626{
1627 logger->AddToCallStack("DialogBase::UpdateScrollBar");
1628
1629 const float scrollheight = static_cast<float>(dialogs[t]->height) - 32; // 32 is for the two arrows
1630 if (dialogs[t]->linetot <= dialogs[t]->linedsp || dialogs[t]->linedsp < 2) // was linetot==0 not <=linedsp
1631 dialogs[t]->scrollbarheight = 0;
1632 else
1633 {
1634 dialogs[t]->scrollbarheight = static_cast<short>(static_cast<float>(dialogs[t]->linedsp) / static_cast<float>(dialogs[t]->linetot) * scrollheight);
1635 if (dialogs[t]->scrollbarheight < 5)
1636 dialogs[t]->scrollbarheight = 5;
1637 dialogs[t]->scrollbartop = static_cast<short>(scrollheight * (static_cast<float>(dialogs[t]->linetop) / static_cast<float>(dialogs[t]->linetot)));
1638 if ((dialogs[t]->scrollbartop + dialogs[t]->scrollbarheight) > scrollheight)
1639 {
1640 dialogs[t]->scrollbartop = static_cast<short>(scrollheight) - dialogs[t]->scrollbarheight;
1641 if (dialogs[t]->scrollbartop < 0)
1642 dialogs[t]->scrollbartop = 0;
1643 }
1644 }
1645
1646 logger->AddToCallStack("DialogBase::UpdateScrollBar DONE");
1647}
1648
1650{
1651 logger->AddToCallStack("DialogBase::CheckMoved");
1652
1653 const auto x = static_cast<int>((dialogs[t]->windowlocation.x + 1.0f) * gui->game->displayscale);
1654 const auto y = static_cast<int>((dialogs[t]->windowlocation.y + (dialogs[t]->tabs ? 16 : 0) + 8 + (dialogs[t]->showfields ? 16 : 0)) *
1656 dialogs[t]->HUD.SetLocation(x, y);
1657
1658 logger->AddToCallStack("DialogBase::CheckMoved DONE!");
1659}
1660
1662{
1663 logger->AddToCallStack("DialogBase::BringToFront");
1664
1665 if (dialogs[t]->layer != 0)
1666 {
1667 for (short q = 0; q < D_ENUMERATION; q++)
1668 {
1669 if (q == t) continue;
1670 if (dialogs[q]->layer == 0)
1671 dialogs[q]->ClearEdit();
1672 dialogs[q]->layer++;
1673 }
1674
1675 dialogs[t]->layer = 0;
1676 if (dialogs[t]->dockedto != -1)
1677 dialogs[dialogs[t]->dockedto]->layer = 0;
1678
1679 SortDialogs();
1680 }
1681
1682 logger->AddToCallStack("DialogBase::BringToFront DONE");
1683}
1684
1685bool DialogBase::DraggingItem(short t, short s)
1686{
1687 logger->AddToCallStack("DialogBase::DraggingItem");
1688
1689 //TODO : Contents of this method could be moved to thier respectable dialog classes
1690 bool isok;
1691 if (t == D_COMMUNICATIONS && gui->dragt == DD_COMMUNICATIONS) // invite
1692 {
1693 if (s != 0 && gui->chatchannel[s].owner == gui->ourplayerC && gui->chatchannel[dialogs[D_COMMUNICATIONS]->activetab].seqplayer[gui->dragline] != gui->ourplayerC) // player to chat tab
1694 {
1695 bool allow = true;
1696 for (short p = 0; p < gui->chatchannel[s].players; p++)
1697 {
1698 // make sure they aren't already in there (compare target tab players with the player we brought
1700 allow = false;
1701 }
1702 if (allow)
1703 {
1705 isok = true;
1706 }
1707 else
1708 {
1710 isok = false;
1711 }
1712 }
1713 else
1714 {
1715 if (s == 0)
1717 else if (gui->chatchannel[s].owner != gui->ourplayerC)
1719 else
1720 gui->helpboxlang = L_DROP_ALREADYINCHANNEL; // trying to drag ourselves
1721 isok = false;
1722 }
1723 }
1724 else if (gui->dragt == DD_COMMUNICATIONS && t == D_PEOPLEMANAGER)
1725 {
1727 isok = true;
1728 }
1729 else if (gui->dragt == D_PEOPLEMANAGER && t == D_PEOPLEMANAGER) // move one folder to another
1730 {
1731 if (s == dialogs[D_PEOPLEMANAGER]->activetab) // same folder
1732 {
1734 isok = false;
1735 }
1736 else
1737 {
1739 isok = true;
1740 }
1741 }
1742 else if (t == D_COMMUNICATIONS && gui->dragt == D_WAYPOINTMANAGER && gui->dragline != 0) // transmit waypoint
1743 {
1745 isok = true;
1746 }
1747 else if (t == D_WAYPOINTMANAGER && gui->dragt == D_COMMUNICATIONS) // receive waypoint
1748 {
1750 isok = true;
1751 }
1752 else if (gui->dragt == D_WAYPOINTMANAGER && t == D_WAYPOINTMANAGER && (dialogs[D_WAYPOINTMANAGER]->activetab > 0 || dialogs[D_WAYPOINTMANAGER]->linecursel > 0)) // move one folder to another
1753 {
1754 if (s == dialogs[D_WAYPOINTMANAGER]->activetab) // same folder
1755 {
1757 isok = false;
1758 }
1759 else
1760 {
1762 isok = true;
1763 }
1764 }
1765 else
1766 {
1768 isok = false;
1769 }
1770
1771 if (isok)
1772 {
1773 SetCursor(LoadCursor(nullptr, IDC_CROSS));
1774 gui->currentCursor = IDC_CROSS;
1775 }
1776 else
1777 {
1778 SetCursor(LoadCursor(nullptr, IDC_NO));
1779 gui->currentCursor = IDC_NO;
1780 }
1781
1782 logger->AddToCallStack("DialogBase::DraggingItem DONE");
1783
1784 return isok;
1785}
1786
1788{
1789 if (active)
1790 return;
1791
1792 logger->AddToCallStack("DialogBase::PopUpDialog");
1793
1794 active = true;
1796 windowseeklocation.z = -0.9f; // .9 sec before move
1798
1799 if (dialogs[dialogid]->dockedto != -1)
1801 windowlocation = RiseMath::Vector3(designedWidthC * 0.5f - width * 0.5f, designedHeightC * 0.5f - (height + 80) * 0.5f, 0);
1803 {
1806 }
1808
1809 logger->AddToCallStack("DialogBase::PopUpDialog DONE");
1810}
1811
1813{
1814 if (!actionenabled[icon_id])
1815 return;
1816
1817 logger->AddToCallStack("DialogBase::ActionIconClick");
1818
1819 if (action[icon_id] == (L_ACTION_ADD_FOLDER - L_ACTION_MARK) && tabs < MAX_TAB) // add folder
1820 {
1821 tabusedefaultlang[tabs] = 0; // user config
1822 tabstr[tabs][0] = 0; // unnamed
1823 tabs++;
1825 }
1826 if (action[icon_id] == (L_ACTION_REMOVE_FOLDER - L_ACTION_MARK) && tabs > 1) // remove folder
1827 {
1828 // ian wants it to go through and remove group associations for records and delete
1829 for (short s = activetab; s < (tabs - 1); s++)
1830 {
1831 tabflash[s] = tabflash[s + 1];
1832 wcscpy_s(tabstr[s], MAX_TAB_CHARS, tabstr[s + 1]);
1834 }
1835 tabs--;
1836 if (activetab >= tabs)
1837 activetab = tabs - 1;
1838 ActiveTab();
1839 }
1840
1841 logger->AddToCallStack("DialogBase::ActionIconClick DONE");
1842}
1843
1844void DialogBase::Close(bool minimize)
1845{
1846 active = false;
1847 minimized = minimize;
1848}
1849
1851{
1852 if (!dialogs[t]->allowresize)
1853 return 0;
1854
1855 logger->AddToCallStack("DialogBase::CheckHeight");
1856
1857 short cursoradj = 0;
1858 if (dialogs[t]->height < (dialogs[t]->normalinterlace ? 32 : 48))
1859 {
1860 cursoradj += (dialogs[t]->normalinterlace ? 32 : 48) - static_cast<short>(dialogs[t]->height);
1861 dialogs[t]->height = (dialogs[t]->normalinterlace ? 32 : 48);
1862 }
1863 if (dialogs[t]->height > (MAX_LINES * (dialogs[t]->normalinterlace ? 16 : 12)))
1864 {
1865 cursoradj += (MAX_LINES * (dialogs[t]->normalinterlace ? 16 : 12)) - static_cast<short>(dialogs[t]->height);
1866 dialogs[t]->height = MAX_LINES * (dialogs[t]->normalinterlace ? 16 : 12);
1867 }
1868
1869 const short oldlinedsp = dialogs[t]->linedsp;
1870 dialogs[t]->linedsp = static_cast<short>(dialogs[t]->height) / (dialogs[t]->normalinterlace ? 16 : 12);
1871 if (oldlinedsp != dialogs[t]->linedsp)
1872 {
1873 if (t == D_WAYPOINTMANAGER)
1875 else if (t == D_COMMUNICATIONS)
1876 {
1877 if (dialogs[t]->linetop == (dialogs[t]->linetot - oldlinedsp))
1878 dialogs[t]->linetop = 9999;
1880 }
1881 else if (t == DD_COMMUNICATIONS)
1883 else if (t == D_PEOPLEMANAGER)
1885 }
1886
1887 if (dialogs[t]->allowscroll)
1888 UpdateScrollBar(t);
1889
1890 gui->ptClick.y = gui->ptCursor.y + cursoradj;
1891
1892 if (t == D_COMMUNICATIONS && dialogs[t]->editfield != -1)
1893 dialogs[t]->HUD.GetEditBox(IDC_TRANSMIT)->SetLocation(static_cast<int>(15 * gui->game->displayscale), static_cast<int>(dialogs[t]->height * gui->game->displayscale));
1894
1895 logger->AddToCallStack("DialogBase::CheckHeight DONE");
1896
1897 return cursoradj;
1898}
1899
1901{
1902 logger->AddToCallStack("DialogBase::SortDialogs");
1903
1904 bool sortwindows = true;
1905 while (sortwindows)
1906 {
1907 sortwindows = false;
1908 for (short t = 0; t < (D_ENUMERATION - 1); t++)
1909 {
1910 if (dialogs[draworder[t]]->layer > dialogs[draworder[t + 1]]->layer)
1911 {
1912 sortwindows = true;
1913 // swap
1914 const short tempdraworder = draworder[t];
1915 draworder[t] = draworder[t + 1];
1916 draworder[t + 1] = tempdraworder;
1917 }
1918 }
1919 }
1920
1921 logger->AddToCallStack("DialogBase::SortDialogs DONE");
1922}
1923
1925{
1926 logger->AddToCallStack("DialogBase::OnDeviceReset");
1927
1928 for (short t = 0; t < D_ENUMERATION; t++)
1929 {
1930 CheckMoved(t);
1931 dialogs[t]->UpdateMenu(-1);
1932 dialogs[t]->ActiveTab(); // some use activetab as opportunity to apply scale, most use updatemenu
1933 }
1934
1935 logger->AddToCallStack("DialogBase::OnDeviceReset DONE");
1936}
1937
1939{
1940 if (g_bTextInput)
1941 {
1942#ifdef ChatEnter
1943 HudDiagnostics::LogChatInput(*gui, "OnEnter deferred to active text mode");
1944#endif
1945 return false;
1946 }
1947
1948 logger->AddToCallStack("DialogBase::OnEnter");
1949
1952 {
1953#ifdef ChatEnter
1954 HudDiagnostics::LogChatInput(*gui, "OnEnter submits waypoint field", D_WAYPOINTMANAGER);
1955#endif
1957 return true;
1958 }
1959 if (dialogs[D_PEOPLEMANAGER]->editline != -1)
1960 {
1961#ifdef ChatEnter
1962 HudDiagnostics::LogChatInput(*gui, "OnEnter submits people field", D_PEOPLEMANAGER);
1963#endif
1965 return true;
1966 }
1967 if (dialogs[D_PEOPLEMANAGER]->edittab != -1)
1968 {
1969#ifdef ChatEnter
1970 HudDiagnostics::LogChatInput(*gui, "OnEnter submits people tab", D_PEOPLEMANAGER);
1971#endif
1973 return true;
1974 }
1975 if (dialogs[D_COMMUNICATIONS]->edittab != -1)
1976 {
1977#ifdef ChatEnter
1978 HudDiagnostics::LogChatInput(*gui, "OnEnter submits communications tab");
1979#endif
1981 return true;
1982 }
1983 if (dialogs[D_COMMUNICATIONS]->editfield == -1) // start a chat
1984 {
1985#ifdef ChatEnter
1986 HudDiagnostics::LogChatInput(*gui, "OnEnter opening/raising communications");
1987#endif
1990 else
1994 gui->Editing = true;
1995
1997 dialogs[D_COMMUNICATIONS]->HUD.GetEditBox(IDC_TRANSMIT)->SetSize(static_cast<int>((dialogs[D_COMMUNICATIONS]->width - 32.0f) * gui->game->displayscale), static_cast<int>(32.0f * gui->game->displayscale));
2000#ifdef ChatEnter
2001 HudDiagnostics::LogChatInput(*gui, "OnEnter chat shown; focus requested on next update");
2002#endif
2003
2004 return true;
2005 }
2006#ifdef ChatEnter
2007 HudDiagnostics::LogChatInput(*gui, "OnEnter chat already editing; no action");
2008#endif
2009 return false;
2010}
2011
2012// The rest of these can be overridden
2013void DialogBase::ActiveTab() // This method is called by derived classes
2014{
2015 logger->AddToCallStack("DialogBase::ActiveTab");
2016
2017 tabflash[activetab] = false;
2018 linecursel = -1;
2020
2021 logger->AddToCallStack("DialogBase::ActiveTab DONE");
2022}
@ ConfigJoystick
Definition ActiveHelp.h:387
#define V(expression)
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
SCRIPT_CONTROL SCRIPT_STATE const void DWORD
#define EVENT_EDITBOX_STRING
Definition Controls.h:27
@ 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_ENUMERATION
Definition DialogBase.h:15
#define designedHeightC
Definition GameClass.h:24
#define designedWidthC
Definition GameClass.h:23
#define MAX_TAB
#define MAX_TAB_CHARS
@ SOUND_MOUSECLICK
Definition Sound.h:148
unsigned char seqplayer[MAX_ONLINEPLAYERS]
Definition chat.h:13
short players
Definition chat.h:15
unsigned char owner
Definition chat.h:63
static void Initialize(HMI *gui)
static HMI * gui
Definition DialogBase.h:42
short fieldcontent[MAX_FIELDS]
Definition DialogBase.h:50
bool actiontoggle[MAX_ACTION]
Definition DialogBase.h:79
virtual void ClearEdit()
Definition DialogBase.h:117
short linedsp
Definition DialogBase.h:74
short actionoffset
Definition DialogBase.h:78
static void DrawAllActiveDialogs(float fElapsedTime)
short icon
Definition DialogBase.h:55
short sortfield
Definition DialogBase.h:66
static void ClickEditableField(short t, int field)
bool active
Definition DialogBase.h:73
RiseMath::Vector3 windowseeklocation
Definition DialogBase.h:70
bool allowmove
Definition DialogBase.h:47
short activetab
Definition DialogBase.h:64
virtual void TabClick(short clicked_tab)
static short draworder[D_ENUMERATION]
Definition DialogBase.h:106
short text
Definition DialogBase.h:71
static void CheckDialogMouse()
bool showfields
Definition DialogBase.h:47
static Logger * logger
Definition DialogBase.h:43
virtual void DoubleClickLine()
Definition DialogBase.h:115
short tabs
Definition DialogBase.h:64
short fieldtype[MAX_FIELDS]
Definition DialogBase.h:49
static void BringToFront(short t)
short tabx[MAX_TAB]
Definition DialogBase.h:91
short fieldeffectivewidth[MAX_FIELDS]
Definition DialogBase.h:95
short defaultwidth
Definition DialogBase.h:53
virtual void Draw(RiseMath::Vector3 *tracked)
Definition DialogBase.h:113
virtual bool canEditField(int field)
Definition DialogBase.h:33
WCHAR tabeffectivestr[MAX_TAB][MAX_TAB_CHARS]
Definition DialogBase.h:92
short dialogid
Definition DialogBase.h:102
static bool OnEnter()
static DialogBase * dialogs[D_ENUMERATION]
Definition DialogBase.h:41
WCHAR fieldeffectiveline[MAX_LINES][MAX_FIELDS][HELP_SIZE]
Definition DialogBase.h:97
float actionslider
Definition DialogBase.h:80
static void OnDeviceReset()
char sortdirection
Definition DialogBase.h:67
virtual void Update()
Definition DialogBase.h:110
virtual void Close(bool minimize)
unsigned short clipboardrecord
Definition DialogBase.h:86
short height
Definition DialogBase.h:62
static void UpdateScrollBar(short t)
long editfield
Definition DialogBase.h:81
virtual void DragDropItem(short s)
Definition DialogBase.h:116
WCHAR fieldline[MAX_LINES][MAX_FIELDS][HELP_SIZE]
Definition DialogBase.h:96
WCHAR tabstr[MAX_TAB][MAX_TAB_CHARS]
Definition DialogBase.h:65
RECT iconsource
Definition DialogBase.h:55
virtual const wchar_t * Title() const
static void IconClick(short icon_id)
bool actionenabled[MAX_ACTION]
Definition DialogBase.h:79
static void SortDialogs()
short actionsvisible
Definition DialogBase.h:77
short scrollbarheight
Definition DialogBase.h:76
bool allowclose
Definition DialogBase.h:47
short dockedto
Definition DialogBase.h:57
bool minimized
Definition DialogBase.h:104
static void CheckMoved(short t)
WCHAR msgbartext[HELP_SIZE]
Definition DialogBase.h:84
virtual void ActionIconClick(long icon_id)
static short CheckHeight(short t)
short tabusedefaultlang[MAX_TAB]
Definition DialogBase.h:52
short width
Definition DialogBase.h:62
short fieldx[MAX_FIELDS]
Definition DialogBase.h:95
RiseMath::Vector3 windowdefaultlocation
Definition DialogBase.h:54
RiseMath::Vector3 windowlocation
Definition DialogBase.h:61
long edittab
Definition DialogBase.h:81
void PopUpDialog()
long editline
Definition DialogBase.h:81
RiseDialog HUD
Definition DialogBase.h:100
static void UpdateAllActiveDialogs(float fElapsedTime)
short tabflash[MAX_TAB]
Definition DialogBase.h:90
static short CheckWidth(short dialogid)
WCHAR fieldeffectivetitle[MAX_FIELDS][HELP_SIZE]
Definition DialogBase.h:94
bool usesHUD
Definition DialogBase.h:58
bool allowresize
Definition DialogBase.h:47
bool normalinterlace
Definition DialogBase.h:56
short scrollbartop
Definition DialogBase.h:76
static void InitializeDialog(short t)
bool allowscroll
Definition DialogBase.h:47
static bool DraggingItem(short t, short s)
short action[MAX_ACTION]
Definition DialogBase.h:51
virtual void UpdateMenu(short tab)
Definition DialogBase.h:114
short actions
Definition DialogBase.h:51
bool fieldsortable[MAX_FIELDS]
Definition DialogBase.h:98
short fieldwidth[MAX_FIELDS]
Definition DialogBase.h:48
short fields
Definition DialogBase.h:46
DialogBase(short id)
int linecursel
Definition DialogBase.h:75
virtual void UpdateAvailability()
Definition DialogBase.h:111
virtual void ActiveTab()
bool enabled
Definition DialogBase.h:73
char msgbarcolor
Definition DialogBase.h:83
short tabwidth[MAX_TAB]
Definition DialogBase.h:91
short defaultheight
Definition DialogBase.h:53
void RequestClose() const
float displayscale
Definition GameClass.h:130
float displayWidth
Definition GameClass.h:131
std::unique_ptr< Logger > logger
Definition GameClass.h:109
float displayHeight
Definition GameClass.h:131
Definition gui.h:1012
void SetLocale() const
Definition gui.cpp:1817
GameClass * game
Definition gui.h:1213
short dragt
Definition gui.h:1041
PEOPLE people
Definition gui.h:1097
bool g_bDropped
Definition gui.h:1040
SPlayerData player[MAX_ONLINEPLAYERS]
Definition gui.h:1093
float g_fDownCounterTime
Definition gui.h:1036
Rendering::RenderTexture * m_pddsGUIRanks
Definition gui.h:1066
Rendering::RenderFont * g_pChatFont
Definition gui.h:1053
LPWSTR currentCursor
Definition gui.h:1110
Rendering::RenderTexture * m_pddsGUIInterlace
Definition gui.h:1061
bool g_bLeftDown
Definition gui.h:1039
Rendering::RenderTexture * m_pddsGUIActions
Definition gui.h:1065
POINT ptCursor
Definition gui.h:1049
std::wstring strings[L_ENUMERATION]
Definition gui.h:1076
InformationDialog * informationDialog
Definition gui.h:1120
bool Editing
Definition gui.h:1109
Rendering::RenderTexture * m_pddsGUIInterlace2
Definition gui.h:1062
Rendering::RenderTexture * m_pddsGUIScrollButton
Definition gui.h:1064
bool g_bLeftDouble
Definition gui.h:1040
unsigned char ourplayerC
Definition gui.h:1094
Rendering::RenderTexture * m_pddsGUILateral
Definition gui.h:1060
long dragline
Definition gui.h:1042
Rendering::RenderTexture * m_pddsGUIScroll
Definition gui.h:1063
bool minimized
Definition gui.h:1113
bool g_bDragging
Definition gui.h:1039
POINT ptClick
Definition gui.h:1049
Rendering::RenderFont * g_pFont
Definition gui.h:1052
bool grippy
Definition gui.h:1112
short helpboxlang
Definition gui.h:1038
CHATCHANNEL chatchannel[MAX_TAB]
Definition gui.h:1096
short FONT_WIDTH
Definition gui.h:1038
Rendering::RenderTexture * m_pddsGUIParts
Definition gui.h:1059
bool g_bLeftClick
Definition gui.h:1039
Sicons icon[D_ENUMERATION+1]
Definition gui.h:1078
short cursoroverwindow
Definition gui.h:1038
Sound * sound
Definition gui.h:1212
bool g_bTabLit
Definition gui.h:1040
Rendering::RenderSprite * g_pTextSprite
Definition gui.h:1051
bool DismissHelp(int helpId, int nControlID=GUI_UNDERSTOOD)
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
@ Warn
Definition Logger.h:26
char EarliestFolder(unsigned short serial) const
Definition people.h:178
long ResidesLocally(unsigned short serial) const
Definition people.h:166
INT DrawTextW(RenderSprite *sprite, const wchar_t *text, INT count, RECT *rectangle, DWORD flags, PackedColor color)
HRESULT Draw(RenderTexture *image, const RECT *rectangle, const RiseMath::Vector3 *center, const RiseMath::Vector3 *position, PackedColor color)
void SetLocation(int x, int y)
Definition Controls.h:606
void SetSize(int width, int height)
Definition Controls.h:610
virtual void SetVisible(bool bVisible)
Definition Controls.h:583
void RemoveControl(int ID)
Definition Controls.cpp:226
void SendEvent(UINT nEvent, bool bTriggeredByUser, RiseControl *pControl)
Definition Controls.cpp:655
RiseEditBox * GetEditBox(int ID)
Definition Controls.h:196
void SetLocation(int x, int y)
Definition Controls.h:281
HRESULT AddEditBox(int ID, LPCWSTR strText, int x, int y, int width, int height, bool bIsDefault=false, bool bIsPassword=false, RiseEditBox **ppCreated=NULL)
void ClearText()
virtual bool HandleMouse(UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam)
void SetText(LPCWSTR wszText, bool bSelected=false)
float Play(SOUNDS soundEnum, float volume=1.0f)
Definition Sound.cpp:802
char g_bTextInput
Definition globals.cpp:61
#define MAX_LINES
Definition gui.h:24
@ L_DROP_UNDEFINED
Definition gui.h:190
@ L_DROP_MOVETOFOLDER
Definition gui.h:194
@ L_DROP_RECEIVEWAYPOINT
Definition gui.h:199
@ L_DROP_ADDTOFOLDER
Definition gui.h:197
@ L_ICON_MARKED
Definition gui.h:201
@ L_RANKICONMILITARY1
Definition gui.h:222
@ L_DROP_ALREADYINCHANNEL
Definition gui.h:192
@ L_ACTION_ADD_FOLDER
Definition gui.h:111
@ L_DROP_INVITETOCHANNEL
Definition gui.h:191
@ L_ACTION_MARK
Definition gui.h:107
@ L_DROP_ALREADYINFOLDER
Definition gui.h:195
@ L_DROP_NOTCHANNELOWNER
Definition gui.h:193
@ L_TAB_UNNAMED
Definition gui.h:139
@ L_ACTION_REMOVE_FOLDER
Definition gui.h:110
@ L_DROP_TRANSMITWAYPOINT
Definition gui.h:198
#define MAX_FIELDS
Definition gui.h:22
#define MAX_ACTION
Definition gui.h:23
@ IDC_TABEDIT
Definition gui.h:973
@ IDC_FIELDEDIT
Definition gui.h:972
@ IDC_TRANSMIT
Definition gui.h:974
#define HELP_SIZE
Definition gui.h:21
@ FIELD_VARTEXT
Definition gui.h:43
@ FIELD_ICON
Definition gui.h:42
@ FIELD_ALLIANCEICON
Definition gui.h:47
@ FIELD_MULTILINECHAT
Definition gui.h:45
@ FIELD_RANKICON
Definition gui.h:46
@ FIELD_FIXEDTEXT
Definition gui.h:44
HRESULT Render(RiseDialog &hud, float elapsedTime, int dialogId, Logger &logger)
float Vec3Length(const Vector3 *a)
Definition ClientMath.h:95
constexpr auto Min(A first, B second)
Definition ClientMath.h:15
Vector3 * Vec3Lerp(Vector3 *out, const Vector3 *a, const Vector3 *b, float t)
Definition ClientMath.h:99
constexpr auto Max(A first, B second)
Definition ClientMath.h:16
unsigned short serial
short dialog
Definition gui.h:664
RiseMath::Vector3 location