Mercurial > mm7
annotate GUIWindow.cpp @ 1251:7ef8ae7ce42a
Player::SetVariable cleanup - moved around some cases to group similar types together, some cases reordered according to enum values
author | Grumpy7 |
---|---|
date | Tue, 11 Jun 2013 15:24:05 +0200 |
parents | 746f7ef994cb |
children | 2929c4406d2c |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
0 | 5 #include "GUIWindow.h" |
6 #include "GUIFont.h" | |
7 #include "Party.h" | |
8 #include "LOD.h" | |
9 #include "Keyboard.h" | |
10 #include "IndoorCamera.h" | |
11 #include "Math.h" | |
12 #include "VideoPlayer.h" | |
13 #include "Allocator.h" | |
14 #include "MapInfo.h" | |
15 #include "Time.h" | |
16 #include "AudioPlayer.h" | |
17 #include "Mouse.h" | |
18 #include "Viewport.h" | |
19 #include "Render.h" | |
20 #include "PlayerFrameTable.h" | |
21 #include "SaveLoad.h" | |
22 #include "StorylineTextTable.h" | |
23 #include "Events2D.h" | |
629 | 24 #include "UIHouses.h" |
189 | 25 #include "texts.h" |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
74
diff
changeset
|
26 #include "Autonotes.h" |
949 | 27 #include "Awards.h" |
0 | 28 |
29 | |
30 #include "mm7_data.h" | |
31 | |
32 | |
33 | |
34 | |
35 int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb | |
36 struct GUIWindow *pWindow_MainMenu; | |
1202 | 37 std::array<struct GUIWindow, 20> pWindowList; |
0 | 38 |
39 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; | |
1012 | 40 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue; |
0 | 41 |
1038 | 42 |
43 | |
44 | |
45 | |
46 | |
47 | |
48 //----- (004141CA) -------------------------------------------------------- | |
49 void ModalWindow(const char *pStr, int a4) | |
50 { | |
51 pEventTimer->Pause(); | |
52 dword_506F0C[0] = pCurrentScreen; | |
53 ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, (int)pStr); | |
54 pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE; | |
55 } | |
56 // 4E28F8: using guessed type int pCurrentScreen; | |
57 | |
783 | 58 // inlined |
59 //----- (mm6c::00420520) -------------------------------------------------- | |
60 void GUIMessageQueue::Flush() | |
61 { | |
62 if (uNumMessages) | |
63 uNumMessages = pMessages[0].field_8 != 0; | |
64 } | |
65 | |
66 | |
0 | 67 //----- (004356B9) -------------------------------------------------------- |
68 void GUIMessageQueue::PopMessage(enum UIMessageType *pType, int *pParam, int *a4) | |
69 { | |
70 signed int v4; // edx@1 | |
71 GUIMessage *v5; // eax@2 | |
72 | |
73 v4 = 0; | |
74 if ( this->uNumMessages ) | |
75 { | |
76 v5 = this->pMessages; | |
77 *pType = this->pMessages[0].eType; | |
78 *pParam = this->pMessages[0].param; | |
79 *a4 = this->pMessages[0].field_8; | |
80 if ( (signed int)(this->uNumMessages - 1) > 0 ) | |
81 { | |
82 do | |
83 { | |
84 v5->eType = v5[1].eType; | |
85 v5->param = v5[1].param; | |
86 v5->field_8 = v5[1].field_8; | |
87 ++v4; | |
88 ++v5; | |
89 } | |
90 while ( v4 < (signed int)(this->uNumMessages - 1) ); | |
91 } | |
92 --this->uNumMessages; | |
93 } | |
94 } | |
95 | |
96 | |
97 | |
994 | 98 |
99 | |
100 | |
101 //----- (0041B4E1) -------------------------------------------------------- | |
102 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) | |
103 { | |
104 unsigned __int8 v3; // bl@1 | |
105 int result; // eax@1 | |
106 int i; // edx@2 | |
107 GUIButton *j; // ecx@3 | |
108 int k; // edx@7 | |
109 GUIButton *l; // ecx@8 | |
110 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 | |
111 char v10; // [sp+8h] [bp-4h]@1 | |
112 | |
113 v3 = uNewHotkey; | |
114 v10 = toupper(uOldHotkey); | |
115 result = toupper(v3); | |
116 v9 = result; | |
117 if ( bFirstCall ) | |
118 { | |
119 for ( i = uNumVisibleWindows; i >= 0; --i ) | |
120 { | |
121 result = 84 * pVisibleWindowsIdxs[i]; | |
122 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) | |
123 j->field_28 = 0; | |
124 } | |
125 } | |
126 for ( k = uNumVisibleWindows; k >= 0; --k ) | |
127 { | |
128 result = 84 * pVisibleWindowsIdxs[k]; | |
129 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) | |
130 { | |
131 LOBYTE(result) = v10; | |
132 if ( l->uHotkey == v10 ) | |
133 { | |
134 if ( !l->field_28 ) | |
135 { | |
136 LOBYTE(result) = v9; | |
137 l->field_28 = 1; | |
138 l->uHotkey = v9; | |
139 } | |
140 } | |
141 } | |
142 } | |
143 return result; | |
144 } | |
145 | |
146 | |
147 | |
148 | |
149 //----- (0041B438) -------------------------------------------------------- | |
150 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) | |
151 { | |
152 char v1; // al@1 | |
153 int v2; // esi@1 | |
154 char v3; // dl@1 | |
155 GUIWindow *v4; // ecx@2 | |
156 GUIButton *result; // eax@2 | |
157 //int v6; // edx@12 | |
158 | |
159 v1 = toupper(uHotkey); | |
160 v2 = uNumVisibleWindows; | |
161 v3 = v1; | |
1210 | 162 for( v2 = uNumVisibleWindows; v2 >= 0 && pVisibleWindowsIdxs[v2] > 0; v2-- ) |
994 | 163 { |
1210 | 164 v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; |
165 for ( result = v4->pControlsHead; result; result = result->pNext ) | |
166 { | |
167 if ( result->uHotkey == v3 ) | |
168 { | |
169 pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); | |
170 return result; | |
171 } | |
172 } | |
173 if ( !v4->uFrameX && !v4->uFrameY && (v4->uFrameWidth == 640 && v4->uFrameHeight == 480) ) | |
174 break; | |
994 | 175 } |
176 return 0; | |
177 } | |
178 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; | |
179 | |
0 | 180 //----- (0041D73D) -------------------------------------------------------- |
1006 | 181 void GUIWindow::_41D73D_draw_buff_tooltip() |
182 { | |
0 | 183 GUIFont *v1; // esi@1 |
184 GUIWindow *v2; // edi@1 | |
185 SpellBuff *v3; // eax@1 | |
186 unsigned int v4; // eax@5 | |
187 int v5; // ecx@5 | |
188 unsigned int v6; // eax@5 | |
189 unsigned int v7; // ecx@5 | |
190 char *v8; // ebx@7 | |
191 unsigned int v9; // eax@8 | |
192 unsigned int v10; // ecx@8 | |
193 __int64 v11; // ST28_8@11 | |
194 int v12; // esi@11 | |
195 const char *v13; // ST0C_4@11 | |
196 unsigned int v14; // eax@11 | |
197 char **v16; // [sp+14h] [bp-10h]@7 | |
198 GUIFont *a2; // [sp+18h] [bp-Ch]@1 | |
199 SpellBuff *v18; // [sp+1Ch] [bp-8h]@7 | |
200 int v19; // [sp+20h] [bp-4h]@1 | |
201 int v20; // [sp+20h] [bp-4h]@7 | |
202 | |
203 v1 = pFontComic; | |
204 v2 = this; | |
205 a2 = pFontComic; | |
206 v19 = 0; | |
207 v3 = pParty->pPartyBuffs; | |
208 do | |
209 { | |
210 if ( (signed __int64)v3->uExpireTime > 0 ) | |
211 ++v19; | |
212 ++v3; | |
213 } | |
214 while ( (signed int)v3 < (signed int)pParty->pPlayers ); | |
215 v4 = LOBYTE(pFontArrus->uFontHeight) + 72; | |
216 this->uFrameHeight = v4; | |
217 v5 = v4 + (v19 - 1) * LOBYTE(pFontArrus->uFontHeight); | |
218 v6 = v2->uFrameWidth; | |
219 v2->uFrameHeight = v5; | |
220 v7 = v2->uFrameHeight; | |
221 v2->uFrameZ = v6 + v2->uFrameX - 1; | |
222 v2->uFrameW = v2->uFrameY + v7 - 1; | |
223 v2->DrawMessageBox(0); | |
224 v2->DrawTitleText(pFontArrus, 0, 0xCu, 0, pGlobalTXT_LocalizationStrings[451], 3u); | |
225 if ( !v19 ) | |
226 v2->DrawTitleText(v1, 0, 0x28u, 0, pGlobalTXT_LocalizationStrings[153], 3u); | |
227 v20 = 0; | |
228 GetTickCount(); | |
229 v8 = &_4E2B21_buff_spell_tooltip_colors[1]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
230 v16 = aSpellNames.data(); |
0 | 231 v18 = pParty->pPartyBuffs; |
232 do | |
233 { | |
234 v9 = LODWORD(v18->uExpireTime); | |
235 v10 = HIDWORD(v18->uExpireTime); | |
17 | 236 if ( (v10 & 0x80000000u) == 0 && ((signed int)v10 > 0 || v9) )//!!! |
0 | 237 { |
17 | 238 v11 = __PAIR__(v10, v9) - pParty->uTimePlayed;//!!! |
0 | 239 v12 = v20 * LOBYTE(v1->uFontHeight) + 40; |
240 v13 = *v16; | |
241 ++v20; | |
949 | 242 v14 = TargetColor( |
0 | 243 (unsigned __int8)*(v8 - 1), |
244 (unsigned __int8)*v8, | |
245 (unsigned __int8)v8[1]); | |
246 v2->DrawText(a2, 52, v12, v14, v13, 0, 0, 0); | |
1006 | 247 sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2); |
0 | 248 v1 = a2; |
249 } | |
250 ++v18; | |
251 ++v16; | |
252 v8 += 3; | |
253 } | |
254 while ( (signed int)v18 < (signed int)pParty->pPlayers ); | |
1006 | 255 |
0 | 256 } |
257 | |
258 | |
259 //----- (0041D08F) -------------------------------------------------------- | |
972 | 260 void GUIWindow::_41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5) |
0 | 261 { |
262 if ( a2 ) | |
263 { | |
264 this->pNumPresenceButton = a2; | |
265 this->field_30 = a3; | |
266 this->field_34 = a4; | |
267 this->pCurrentPosActiveItem = a5; | |
268 this->pStartingPosActiveItem = a5; | |
972 | 269 this->receives_keyboard_input = true; |
0 | 270 } |
271 else | |
272 { | |
273 this->pNumPresenceButton = 0; | |
274 this->field_30 = a3; | |
275 this->field_34 = a4; | |
276 this->pCurrentPosActiveItem = 0; | |
277 this->pStartingPosActiveItem = 0; | |
972 | 278 this->receives_keyboard_input = false; |
0 | 279 } |
280 } | |
281 | |
282 | |
283 //----- (0041C26A) -------------------------------------------------------- | |
284 void GUIWindow::Release() | |
285 { | |
961 | 286 //GUIWindow *v1; // esi@1 |
0 | 287 int i; // edi@20 |
961 | 288 //GUIButton *v8; // eax@26 |
289 GUIButton *pNextBtn; // edi@27 | |
290 //int v10; // esi@28 | |
291 //int v11; // ecx@28 | |
0 | 292 int v12; // edx@29 |
293 | |
961 | 294 //v1 = this; |
0 | 295 if ( !this ) |
296 return; | |
696 | 297 |
298 switch( this->eWindowType ) | |
0 | 299 { |
696 | 300 case WINDOW_GreetingNPC: |
301 { | |
1006 | 302 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 303 pCurrentScreen = pMainScreenNum; |
1038 | 304 pKeyActionMap->SetWindowInputStatus(3); |
696 | 305 break; |
306 } | |
307 case WINDOW_HouseInterior: | |
308 { | |
309 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
310 pDialogueNPCPortraits[i]->Release(); | |
311 uNumDialogueNPCPortraits = 0; | |
312 pTexture_Dialogue_Background->Release(); | |
0 | 313 |
1006 | 314 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 315 pIcons_LOD->_4114F2(); |
316 dword_5C35D4 = 0; | |
317 if ( bFlipOnExit ) | |
318 { | |
319 pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi | |
320 + pIndoorCamera->sRotationY); | |
321 pParty->sRotationY = pIndoorCamera->sRotationY; | |
322 } | |
323 pParty->uFlags |= 2u; | |
324 break; | |
325 } | |
326 case WINDOW_Transition: | |
327 { | |
328 pVideoPlayer->Unload(); | |
329 pTexture_outside->Release(); | |
330 pTexture_Dialogue_Background->Release(); | |
1006 | 331 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 332 pCurrentScreen = pMainScreenNum; |
333 break; | |
334 } | |
335 case WINDOW_SpellBook: | |
336 { | |
337 sub_41140B(); | |
338 sub_411473(); | |
339 break; | |
340 } | |
341 case WINDOW_Book: | |
342 { | |
960 | 343 OnCloseSpellBook(); |
696 | 344 break; |
345 } | |
346 case WINDOW_ChangeLocation: | |
347 { | |
0 | 348 pTexture_outside->Release(); |
349 pTexture_Dialogue_Background->Release(); | |
1006 | 350 pIcons_LOD->SyncLoadedFilesCount(); |
11 | 351 pCurrentScreen = pMainScreenNum; |
696 | 352 break; |
353 } | |
354 case WINDOW_Dialogue: | |
355 { | |
356 if ( !dword_591084 ) | |
357 pDialogueNPCPortraits[0]->Release(); | |
358 uNumDialogueNPCPortraits = 0; | |
359 pTexture_Dialogue_Background->Release(); | |
360 | |
1006 | 361 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 362 pCurrentScreen = pMainScreenNum; |
363 } | |
364 default: | |
365 { | |
366 break; | |
367 } | |
0 | 368 } |
961 | 369 //v8 = this->pControlsHead; |
370 if ( this->pControlsHead ) | |
0 | 371 { |
372 do | |
373 { | |
961 | 374 pNextBtn = this->pControlsHead->pNext; |
375 pAllocator->FreeChunk(this->pControlsHead); | |
376 this->pControlsHead = pNextBtn; | |
0 | 377 } |
961 | 378 while ( pNextBtn ); |
0 | 379 } |
961 | 380 this->pControlsHead = 0; |
381 this->pControlsTail = 0; | |
382 this->uNumControls = 0; | |
383 this->eWindowType = WINDOW_null; | |
384 while ( this->numVisibleWindows < uNumVisibleWindows ) | |
0 | 385 { |
961 | 386 v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1]; |
387 pVisibleWindowsIdxs[this->numVisibleWindows] = v12; | |
962 | 388 --pWindowList[v12 - 1].numVisibleWindows; |
961 | 389 ++this->numVisibleWindows; |
0 | 390 } |
961 | 391 pVisibleWindowsIdxs[uNumVisibleWindows] = 0; |
392 uNumVisibleWindows = uNumVisibleWindows - 1; | |
0 | 393 } |
394 | |
395 | |
396 | |
397 | |
398 | |
399 | |
400 //----- (0041CD3B) -------------------------------------------------------- | |
401 GUIButton *GUIWindow::GetControl(unsigned int uID) | |
402 { | |
403 GUIButton *result; // eax@1 | |
404 unsigned int v3; // ecx@1 | |
405 | |
406 result = this->pControlsHead; | |
407 v3 = uID; | |
408 if ( (signed int)uID > 0 ) | |
409 { | |
410 do | |
411 { | |
412 result = result->pNext; | |
413 --v3; | |
414 } | |
415 while ( v3 ); | |
416 } | |
417 return result; | |
418 } | |
419 | |
420 //----- (00411BFC) -------------------------------------------------------- | |
421 void GUIWindow::InitializeBookView() | |
422 { | |
423 GUIWindow *v1; // ebp@1 | |
424 signed int v2; // ecx@8 | |
425 __int64 *v3; // ebp@9 | |
426 char *v4; // ecx@10 | |
427 char *v5; // eax@12 | |
428 int v6; // eax@12 | |
429 __int64 v7; // qax@12 | |
430 unsigned int v8; // esi@12 | |
431 GUIButton *v9; // eax@19 | |
432 signed int v10; // esi@19 | |
433 int v11; // eax@24 | |
434 int v12; // eax@27 | |
435 int i; // esi@28 | |
436 char *v14; // ebp@29 | |
437 int v15; // eax@31 | |
710 | 438 //unsigned int v16; // esi@35 |
0 | 439 Player *v17; // esi@38 |
440 unsigned __int16 v18; // ax@38 | |
441 unsigned int v19; // edi@43 | |
442 unsigned int v20; // edi@45 | |
443 void *v21; // esi@45 | |
444 signed int v23; // [sp+10h] [bp-5Ch]@38 | |
445 char *v25; // [sp+14h] [bp-58h]@21 | |
446 GUIWindow v26; // [sp+18h] [bp-54h]@8 | |
447 | |
448 v1 = this; | |
449 pAudioPlayer->StopChannels(-1, -1); | |
450 InitializeBookFonts(); | |
832 | 451 v1->CreateButton(0x1DBu, 0x1BDu, 0x9Eu, 0x22u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close |
151 | 452 pCurrentScreen = SCREEN_BOOKS; |
949 | 453 num_achieved_awards_2 = 0; |
0 | 454 dword_506528 = 0; |
455 dword_50651C = 0; | |
949 | 456 num_achieved_awards = 0; |
688 | 457 switch (v1->par1C) |
458 { | |
961 | 459 case WINDOW_LloydsBeacon:{ |
688 | 460 byte_506360 = 0; |
948 | 461 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE); |
462 pTexture_LloydBeacons[0] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); | |
463 pTexture_50635C = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); | |
464 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
465 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
466 | |
961 | 467 pBtn_Book_1 = v1->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon |
468 pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon | |
948 | 469 |
688 | 470 v17 = &pParty->pPlayers[_506348_current_lloyd_playerid]; |
471 v23 = 1; | |
472 v18 = v17->pActiveSkills[14]; | |
473 if ( HIBYTE(v18) & 1 || (v18 & 0x80u) != 0 ) | |
474 { | |
475 v23 = 5; | |
476 } | |
477 else | |
478 { | |
479 if ( v18 & 0x40 ) | |
480 v23 = 3; | |
481 } | |
482 v19 = 0; | |
483 if ( v23 > 0 ) | |
484 { | |
485 do | |
486 { | |
961 | 487 v1->CreateButton(pLloydsBeaconsPreviewXs[v19], pLloydsBeaconsPreviewYs[v19], 0x5Cu, 0x44u, 1, 180, UIMSG_InstallBeacon, v19, 0, "", 0); |
688 | 488 ++v19; |
489 } | |
490 while ( (signed int)v19 < v23 ); | |
491 } | |
492 v20 = 0; | |
493 v21 = v17->pInstalledBeacons; | |
0 | 494 do |
688 | 495 { |
496 if ( *(_QWORD *)v21 >= (signed __int64)pParty->uTimePlayed ) | |
497 LoadThumbnailLloydTexture(v20, _506348_current_lloyd_playerid + 1); | |
498 else | |
499 memset(v21, 0, 0x1Cu); | |
500 ++v20; | |
501 v21 = (char *)v21 + 28; | |
502 } | |
503 while ( (signed int)v20 < 5 ); | |
0 | 504 } |
688 | 505 break; |
710 | 506 |
507 case WINDOW_TownPortal: | |
508 { | |
948 | 509 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("townport", TEXTURE_16BIT_PALETTE); |
710 | 510 pTexture_TownPortalIcons[0] = pIcons_LOD->LoadTexturePtr("tpharmndy", TEXTURE_16BIT_PALETTE); |
511 pTexture_TownPortalIcons[1] = pIcons_LOD->LoadTexturePtr("tpelf", TEXTURE_16BIT_PALETTE); | |
512 pTexture_TownPortalIcons[2] = pIcons_LOD->LoadTexturePtr("tpwarlock", TEXTURE_16BIT_PALETTE); | |
513 pTexture_TownPortalIcons[3] = pIcons_LOD->LoadTexturePtr("tpisland", TEXTURE_16BIT_PALETTE); | |
514 pTexture_TownPortalIcons[4] = pIcons_LOD->LoadTexturePtr("tpheaven", TEXTURE_16BIT_PALETTE); | |
730 | 515 pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE); |
710 | 516 |
517 for (uint i = 0; i < 6; ++i) | |
961 | 518 v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr); |
710 | 519 /*v16 = 0; |
0 | 520 do |
688 | 521 { |
522 v1->CreateButton(pTownPortalBook_xs[v16], pTownPortalBook_ys[v16], pTownPortalBook_ws[v16], pTownPortalBook_hs[v16], 1, 182, 0xB7u, v16, 0, "", 0); | |
523 ++v16; | |
524 } | |
710 | 525 while ( (signed int)v16 < 6 );*/ |
526 } | |
527 break; | |
528 | |
529 case WINDOW_QuestBook: | |
948 | 530 { |
531 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE); | |
532 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr( "divbar", TEXTURE_16BIT_PALETTE); | |
533 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
534 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
535 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
536 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
537 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, | |
538 pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, | |
996 | 539 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" |
948 | 540 pTex_tab_an_6b__zoom_on, 0); |
541 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, | |
542 pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, | |
996 | 543 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" |
948 | 544 pTex_tab_an_7b__zoot_on, 0); |
949 | 545 num_achieved_awards = 0; |
1202 | 546 memset(achieved_awards.data(), 0, 4000); |
688 | 547 for ( i = dword_506528; i < 512; ++i ) |
548 { | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
74
diff
changeset
|
549 v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i]; |
521 | 550 if ( _449B57_test_bit(pParty->_quest_bits, i) && v14 ) |
0 | 551 { |
949 | 552 v15 = num_achieved_awards++; |
553 achieved_awards[v15] = (AwardType)i; | |
0 | 554 } |
555 } | |
949 | 556 v12 = num_achieved_awards; |
557 num_achieved_awards = 0; | |
558 num_achieved_awards_2 = v12; | |
688 | 559 } |
560 break; | |
981 | 561 |
562 | |
710 | 563 case WINDOW_AutonotesBook: |
688 | 564 { |
948 | 565 pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE); |
566 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE); | |
567 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
568 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
569 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
570 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
571 pTexture_506394 = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE); | |
572 pTexture_506390 = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE); | |
573 pTexture_50638C = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE); | |
574 pTexture_506388 = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE); | |
575 pTexture_506384 = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE); | |
576 pTexture_506380 = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE); | |
577 pTexture_50637C = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE); | |
578 pTexture_506378 = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE); | |
579 pTexture_506374 = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE); | |
580 pTexture_506370 = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE); | |
581 pTexture_50636C = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE); | |
582 pTexture_506368 = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE); | |
583 | |
996 | 584 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0); |
585 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0); | |
586 pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0); // "Potion Notes" | |
587 pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0); // "Fountain Notes" | |
588 pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0); // "Obelisk Notes" | |
589 pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0); // "Seer Notes" | |
590 pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes" | |
591 pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors" | |
948 | 592 |
593 v9 = pBtn_Autonotes_Instructors; | |
688 | 594 v10 = dword_506528; |
949 | 595 num_achieved_awards = 0; |
688 | 596 while ( v10 < 196 ) |
597 { | |
981 | 598 if ( _506568_autonote_type == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] ) |
688 | 599 { |
600 //v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10]; | |
601 v25 = (char *)pAutonoteTxt[v10-1].pText; | |
602 if ( (short)v10 ) | |
603 { | |
604 if ( _449B57_test_bit(pParty->_autonote_bits, v10) && v25 ) | |
605 { | |
949 | 606 v11 = num_achieved_awards++; |
607 achieved_awards[v11] = (AwardType)v10; | |
688 | 608 } |
609 } | |
610 } | |
611 ++v10; | |
612 } | |
613 } | |
614 break; | |
948 | 615 |
710 | 616 case WINDOW_MapsBook: |
948 | 617 { |
688 | 618 dword_506364 = 1; |
948 | 619 pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); |
620 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE); | |
621 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE); | |
622 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE); | |
623 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE); | |
624 pTexture_506394 = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE); | |
625 pTexture_506390 = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE); | |
626 pTexture_50638C = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE); | |
627 pTexture_506388 = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE); | |
628 pTexture_506384 = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE); | |
629 pTexture_506380 = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE); | |
630 pTexture_50637C = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE); | |
631 pTexture_506378 = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE); | |
632 | |
996 | 633 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In" |
634 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out" | |
635 pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up | |
636 pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down | |
637 pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right" | |
638 pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left" | |
688 | 639 } |
640 break; | |
948 | 641 |
642 case WINDOW_CalendarBook: | |
643 { | |
644 pSpellBookPagesTextr_13 = pIcons_LOD->LoadTexturePtr("sbdate-time", TEXTURE_16BIT_PALETTE); | |
645 pTex_moon_new = pIcons_LOD->LoadTexturePtr("moon_new", TEXTURE_16BIT_PALETTE); | |
646 pTex_moon_4 = pIcons_LOD->LoadTexturePtr("moon_4", TEXTURE_16BIT_PALETTE); | |
647 pTex_moon_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); | |
648 pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); | |
649 pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE); | |
688 | 650 } |
651 break; | |
948 | 652 |
1004 | 653 case WINDOW_JournalBook: |
948 | 654 { |
655 pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE); | |
656 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
657 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
658 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
659 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
660 | |
996 | 661 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0); |
662 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); | |
948 | 663 |
949 | 664 num_achieved_awards = 0; |
688 | 665 v26.uFrameX = 48; |
666 v26.uFrameY = 70; | |
667 v26.uFrameWidth = 360; | |
668 v26.uFrameHeight = 264; | |
669 v2 = LOBYTE(pAutonoteFont->uFontHeight) - 3; | |
670 v26.uFrameZ = 407; | |
671 v26.uFrameHeight = v2 * 264 / v2; | |
672 v26.uFrameW = v26.uFrameHeight + 69; | |
949 | 673 memset(&achieved_awards, 0, 4000); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
674 memset(byte_5C6D50.data(), 0, 0x64u); |
688 | 675 if ( dword_506528 < 29 ) |
676 { | |
677 v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * dword_506528]; | |
678 for(int i=dword_506528+1;i<dword_506528+31;i++) | |
679 { | |
680 v4 = pStorylineText->StoreLine[i].pText; | |
681 if ( *v3 ) | |
682 { | |
683 if ( v4 ) | |
684 { | |
685 v5 = BuilDialogueString(v4, uActiveCharacter - 1, 0, 0, 0, v3); | |
686 v6 = pAutonoteFont->CalcTextHeight(v5, &v26, 1, 0); | |
687 v7 = (v6 - 3) / (signed int)v26.uFrameHeight; | |
688 v8 = v7 + 1; | |
689 if ( (signed int)v7 + 1 > 0 ) | |
690 { | |
949 | 691 memset32((char *)&achieved_awards + 4 * num_achieved_awards , i, v8); |
688 | 692 do |
693 { | |
949 | 694 LODWORD(v7) = num_achieved_awards++; |
688 | 695 byte_5C6D50[(int)v7] = BYTE4(v7); |
696 ++HIDWORD(v7); | |
697 } | |
698 while ( SHIDWORD(v7) < (signed int)v8 ); | |
699 } | |
700 } | |
701 } | |
702 ++i; | |
703 ++v3; | |
704 } | |
705 } | |
706 | |
707 } | |
708 break; | |
709 } | |
710 | |
0 | 711 } |
712 | |
713 | |
714 | |
715 | |
716 //----- (00415551) -------------------------------------------------------- | |
717 void GUIWindow::DrawMessageBox(int arg0) | |
718 { | |
719 unsigned int v2; // edi@1 | |
720 GUIWindow *v3; // ebx@1 | |
721 signed int v4; // esi@2 | |
722 unsigned int v5; // eax@2 | |
723 unsigned int v6; // edx@4 | |
724 unsigned int v7; // ecx@6 | |
725 unsigned int v8; // eax@9 | |
726 __int32 v9; // eax@10 | |
727 unsigned int v10; // eax@18 | |
728 LONG v11; // ecx@18 | |
729 unsigned int v12; // edx@18 | |
730 unsigned int v13; // eax@18 | |
731 const char *v14; // ecx@18 | |
732 int v15; // eax@19 | |
733 unsigned int v16; // esi@19 | |
734 const char *v17; // ebx@25 | |
735 int v18; // eax@26 | |
736 GUIWindow v19; // [sp+Ch] [bp-60h]@18 | |
737 POINT a2; // [sp+60h] [bp-Ch]@8 | |
738 unsigned int v21; // [sp+68h] [bp-4h]@18 | |
739 unsigned int v22; // [sp+74h] [bp+8h]@2 | |
740 unsigned int v23; // [sp+74h] [bp+8h]@18 | |
741 | |
742 v2 = 0; | |
743 v3 = this; | |
744 if ( arg0 ) | |
745 { | |
693 | 746 v4 = pViewport->uViewportTL_X; |
747 v5 = pViewport->uViewportBR_X; | |
748 v2 = pViewport->uViewportTL_Y; | |
749 v22 = pViewport->uViewportBR_Y; | |
0 | 750 } |
751 else | |
752 { | |
753 v4 = 0; | |
754 v5 = 640; | |
755 v22 = 480; | |
756 } | |
757 v6 = this->uFrameX; | |
758 if ( (signed int)this->uFrameX >= v4 ) | |
759 { | |
760 v7 = this->uFrameWidth; | |
761 if ( (signed int)(v7 + v6) <= (signed int)v5 ) | |
762 goto LABEL_9; | |
763 v3->uFrameX = v5 - v7; | |
764 } | |
765 else | |
766 { | |
767 this->uFrameX = v4; | |
768 } | |
769 v3->uFrameY = pMouse->GetCursorPos(&a2)->y + 30; | |
770 LABEL_9: | |
771 v8 = v3->uFrameY; | |
772 if ( (signed int)v8 >= (signed int)v2 ) | |
773 { | |
774 if ( (signed int)(v8 + v3->uFrameHeight) <= (signed int)v22 ) | |
775 goto LABEL_14; | |
776 v9 = pMouse->GetCursorPos(&a2)->y - v3->uFrameHeight - 30; | |
777 } | |
778 else | |
779 { | |
780 v9 = pMouse->GetCursorPos(&a2)->y + 30; | |
781 } | |
782 v3->uFrameY = v9; | |
783 LABEL_14: | |
784 if ( (signed int)v3->uFrameY < (signed int)v2 ) | |
785 v3->uFrameY = v2; | |
786 if ( (signed int)v3->uFrameX < v4 ) | |
787 v3->uFrameX = v4; | |
788 v10 = v3->uFrameWidth; | |
789 v11 = v3->uFrameX; | |
790 v12 = v3->uFrameY; | |
791 v21 = v10; | |
792 a2.y = v11; | |
793 v3->uFrameZ = v10 + v11 - 1; | |
794 v13 = v3->uFrameHeight; | |
795 v3->uFrameW = v13 + v12 - 1; | |
796 memcpy(&v19, v3, sizeof(v19)); | |
797 v19.uFrameX += 12; | |
798 v19.uFrameWidth -= 24; | |
799 v19.uFrameY += 12; | |
800 v19.uFrameHeight -= 12; | |
801 v19.uFrameZ = v19.uFrameWidth + v19.uFrameX - 1; | |
802 v23 = v12; | |
803 v19.uFrameW = v19.uFrameHeight + v19.uFrameY - 1; | |
804 v14 = v3->Hint; | |
805 if ( v14 ) | |
806 { | |
807 v15 = pFontLucida->CalcTextHeight(v14, &v19, 0, 0); | |
808 v12 = v23; | |
809 v16 = v15 + 24; | |
810 } | |
811 else | |
812 { | |
813 v16 = v13; | |
814 } | |
815 if ( (signed int)v16 < 64 ) | |
816 v16 = 64; | |
817 if ( (signed int)(v16 + v12) > 479 ) | |
818 v16 = 479 - v12; | |
819 DrawPopupWindow(a2.y, v12, v21, v16); | |
820 v17 = v3->Hint; | |
821 if ( v17 ) | |
822 { | |
823 v18 = pFontLucida->CalcTextHeight(v17, &v19, 0, 0); | |
1004 | 824 v19.DrawTitleText(pFontLucida, 0, (signed int)(v16 - v18) / 2 - 14, 0, v17, 3); |
0 | 825 } |
826 } | |
827 | |
828 | |
829 | |
830 | |
831 //----- (00411B59) -------------------------------------------------------- | |
832 void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer) | |
833 { | |
834 unsigned int v2; // esi@1 | |
835 unsigned int v3; // edi@1 | |
836 FILE *v4; // ebx@1 | |
837 FILE *v5; // eax@2 | |
838 char pContainerName[64]; // [sp+Ch] [bp-44h]@1 | |
839 unsigned int v7; // [sp+4Ch] [bp-4h]@1 | |
840 | |
841 v2 = uSlot; | |
842 v7 = uPlayer; | |
843 v3 = uSlot + 1; | |
844 sprintf(pContainerName, "data\\lloyd%d%d.pcx", uPlayer, uSlot + 1); | |
845 v4 = fopen(pContainerName, "rb"); | |
846 if ( v4 ) | |
847 { | |
848 pSavegameThumbnails[v2].LoadFromFILE(v4, 0, 1u); | |
849 fclose(v4); | |
850 } | |
851 else | |
852 { | |
853 sprintf(pContainerName, "lloyd%d%d.pcx", v7, v3); | |
854 v5 = pNew_LOD->FindContainer(pContainerName, 1); | |
855 if ( v5 ) | |
856 pSavegameThumbnails[v2].LoadFromFILE(v5, 0, 0); | |
857 else | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
858 *((int *)&pSavegameThumbnails.data()->pPixels + 10 * v2) = 0; |
0 | 859 } |
860 } | |
861 | |
862 | |
863 //----- (00411621) -------------------------------------------------------- | |
198 | 864 void GUIWindow::OpenSpellBook() |
0 | 865 { |
11 | 866 Player *pPlayer; // edi@1 |
198 | 867 //GUIWindow *pWindow; // esi@1 |
868 //unsigned int v3; // ebp@1 | |
0 | 869 int v4; // eax@3 |
198 | 870 ///GUIButton *result; // eax@25 |
0 | 871 int a2; // [sp+10h] [bp-8h]@1 |
198 | 872 //int v7; // [sp+14h] [bp-4h]@1 |
0 | 873 |
11 | 874 pPlayer = pPlayers[uActiveCharacter]; |
198 | 875 //pWindow = this; |
876 LoadSpellbook(pPlayer->lastOpenedSpellbookPage); | |
877 //v3 = 0; | |
0 | 878 a2 = 0; |
198 | 879 |
880 auto chapter = &pPlayer->spellbook.pChapters[pPlayer->lastOpenedSpellbookPage]; | |
881 for (uint i = 0; i < 11; ++i) | |
0 | 882 { |
198 | 883 if (!chapter->bIsSpellAvailable[i]) |
884 continue; | |
363 | 885 v4= pPlayer->lastOpenedSpellbookPage; |
886 //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); | |
693 | 887 CreateButton(pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos, |
888 pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0 | |
198 | 889 dword_506408[i + 1]->uTextureWidth, |
890 dword_506408[i + 1]->uTextureHeight, | |
832 | 891 1, 79, UIMSG_SelectSpell, i, 0, "", 0); |
0 | 892 ++a2; |
198 | 893 //++v3; |
0 | 894 } |
198 | 895 //while ( (signed int)v3 < 11 ); |
896 | |
1118 | 897 CreateButton(0, 0, 0, 0, 1, 0, UIMSG_SpellBook_PressTab, 0, '\t', "", 0); |
0 | 898 if ( a2 ) |
972 | 899 _41D08F_set_keyboard_control_group(a2, 0, 0, 0); |
948 | 900 |
901 if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE]) CreateButton(399, 10, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 0, 0, aSpellSchoolNames[0], 0); | |
902 if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR]) CreateButton(399, 46, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 1, 0, aSpellSchoolNames[1], 0); | |
903 if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) CreateButton(399, 83, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 2, 0, aSpellSchoolNames[2], 0); | |
904 if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH]) CreateButton(399, 121, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 3, 0, aSpellSchoolNames[3], 0); | |
905 if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT]) CreateButton(399, 158, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 4, 0, aSpellSchoolNames[4], 0); | |
906 if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) CreateButton(400, 196, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 5, 0, aSpellSchoolNames[5], 0); | |
907 if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) CreateButton(400, 234, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 6, 0, aSpellSchoolNames[6], 0); | |
908 if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0); | |
909 if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0); | |
910 | |
960 | 911 CreateButton(476, 450, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0); |
912 pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pTexture_506444, 0); | |
948 | 913 CreateButton(561, 450, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); |
914 pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0); | |
0 | 915 } |
916 // 50640C: using guessed type int dword_50640C[]; | |
917 | |
918 //----- (004B3157) -------------------------------------------------------- | |
405 | 919 void GUIWindow::HouseDialogManager() |
0 | 920 { |
854 | 921 unsigned __int16 pWhiteColor; // di@2 |
922 const char *pHouseName; // edx@4 | |
0 | 923 signed int v3; // edx@5 |
924 char *v4; // edi@9 | |
854 | 925 int pTextHeight; // eax@45 |
0 | 926 int v6; // edi@45 |
927 char *v7; // eax@45 | |
928 int v8; // edi@46 | |
929 int v9; // eax@50 | |
930 unsigned int v10; // [sp-10h] [bp-C8h]@53 | |
873 | 931 char *pTitleText; // [sp-8h] [bp-C0h]@50 |
854 | 932 GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4 |
933 GUIWindow pWindow; // [sp+60h] [bp-58h]@2 | |
934 int pColor2; // [sp+B4h] [bp-4h]@2 | |
0 | 935 |
336 | 936 if ( !window_SpeakInHouse ) |
0 | 937 return; |
854 | 938 memcpy(&pWindow, this, sizeof(pWindow)); |
939 pWindow.uFrameWidth -= 18; | |
940 pWindow.uFrameZ -= 18; | |
949 | 941 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
942 pColor2 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 943 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); |
910 | 944 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); |
457 | 945 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic ) |
0 | 946 { |
854 | 947 pDialogWindow.uFrameWidth = 130; |
948 pDialogWindow.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight); | |
949 pHouseName = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName; | |
950 if ( pHouseName ) | |
0 | 951 { |
854 | 952 v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(pHouseName, &pDialogWindow, 0, 0); |
0 | 953 if ( v3 < 0 ) |
954 v3 = 0; | |
854 | 955 pWindow.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, pWhiteColor, |
0 | 956 //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C], |
336 | 957 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3); |
0 | 958 } |
959 } | |
854 | 960 pWindow.uFrameWidth += 8; |
961 pWindow.uFrameZ += 8; | |
457 | 962 if ( !pDialogueNPCCount ) |
0 | 963 { |
484 | 964 if ( in_current_building_type == BildingType_Jail ) |
0 | 965 { |
480 | 966 JailDialog(); |
854 | 967 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
968 { | |
969 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
970 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
971 } | |
972 else | |
973 { | |
974 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
975 } | |
976 return; | |
0 | 977 } |
827 | 978 if ( current_npc_text ) |
0 | 979 { |
854 | 980 pDialogWindow.uFrameWidth = 458; |
981 pDialogWindow.uFrameZ = 457; | |
982 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &pDialogWindow, 13, 0); | |
983 v6 = pTextHeight + 7; | |
984 pRenderer->_4A6A68(8, 352 - (pTextHeight + 7), &pIcons_LOD->pTextures[uTextureID_Leather], | |
985 pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (pTextHeight + 7)); | |
986 pRenderer->DrawTextureIndexed(8, 347 - v6, pTexture_591428); | |
987 v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0); | |
336 | 988 window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); |
0 | 989 } |
990 if ( uNumDialogueNPCPortraits <= 0 ) | |
854 | 991 { |
992 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
993 { | |
994 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
995 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
996 } | |
997 else | |
998 { | |
999 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
1000 } | |
1001 return; | |
1002 } | |
873 | 1003 for ( v8 = 0; v8 < uNumDialogueNPCPortraits; ++v8 ) |
0 | 1004 { |
419 | 1005 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4, |
874 | 1006 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); |
419 | 1007 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8], |
1008 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8], pDialogueNPCPortraits[v8]); | |
0 | 1009 if ( uNumDialogueNPCPortraits < 4 ) |
854 | 1010 { |
873 | 1011 if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
854 | 1012 { |
873 | 1013 pTitleText = pMapStats->pInfos[uHouse_ExitPic].pName; |
1014 v9 = 94 * v8 + 113; | |
854 | 1015 } |
1016 else | |
1017 { | |
873 | 1018 if ( !v8 && dword_591080 ) |
1019 { | |
1020 pTitleText = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle; | |
1021 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, pTitleText, 3); | |
1022 continue; | |
1023 } | |
1211 | 1024 pTitleText = HouseNPCData[v8 +1 - (dword_591080 != 0)]->pName; |
1025 v9 = pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2; | |
854 | 1026 } |
873 | 1027 v10 = v9; |
1211 | 1028 pWindow.DrawTitleText(pFontCreate, 483, v10, pColor2, pTitleText, 3); |
854 | 1029 } |
874 | 1030 } |
873 | 1031 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 1032 { |
873 | 1033 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); |
1034 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
0 | 1035 } |
873 | 1036 else |
1037 { | |
1038 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
1039 } | |
1040 return; | |
0 | 1041 } |
457 | 1042 v4 = (char *)pDialogueNPCCount - 1; |
419 | 1043 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); |
1044 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); | |
151 | 1045 if ( pCurrentScreen == SCREEN_E ) |
0 | 1046 { |
984 | 1047 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
854 | 1048 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
1049 { | |
1050 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
1051 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
1052 } | |
1053 else | |
1054 { | |
1055 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
1056 } | |
1057 return; | |
0 | 1058 } |
1059 if ( v4 || !dword_591080 ) | |
1060 { | |
445 | 1061 SimpleHouseAndBoatsDialog(); |
0 | 1062 } |
1063 else | |
1064 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1065 sprintfex( pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], |
336 | 1066 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName, |
1067 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1068 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf.data(), 3); |
484 | 1069 switch ( in_current_building_type ) |
0 | 1070 { |
480 | 1071 case BildingType_WeaponShop: |
405 | 1072 WeaponShopDialog(); |
0 | 1073 break; |
480 | 1074 case BildingType_ArmorShop: |
405 | 1075 ArmorShopDialog(); |
0 | 1076 break; |
480 | 1077 case BildingType_MagicShop: |
405 | 1078 MagicShopDialog(); |
0 | 1079 break; |
480 | 1080 case BildingType_AlchemistShop: |
405 | 1081 AlchemistDialog(); |
0 | 1082 break; |
480 | 1083 case BildingType_FireGuild: |
1084 case BildingType_AirGuild: | |
1085 case BildingType_WaterGuild: | |
1086 case BildingType_EarthGuild: | |
1087 case BildingType_SpiritGuild: | |
1088 case BildingType_MindGuild: | |
1089 case BildingType_BodyGuild: | |
1090 case BildingType_LightGuild: | |
495 | 1091 case BildingType_DarkGuild: |
480 | 1092 GuildDialog(); |
1093 break; | |
1094 case BildingType_18: | |
987 | 1095 __debugbreak(); //What over the dialog? |
480 | 1096 sub_4B6478(); |
1097 break; | |
1098 case BildingType_TownHall: | |
1099 TownHallDialog(); | |
1100 break; | |
1101 case BildingType_Tavern: | |
1102 TavernDialog(); | |
1103 break; | |
1104 case BildingType_Bank: | |
1105 BankDialog(); | |
1106 break; | |
481 | 1107 case BildingType_Temple: |
495 | 1108 TempleDialog(); |
480 | 1109 break; |
1110 case BildingType_Stables: | |
1111 TravelByTransport(); | |
1112 break; | |
1113 case BildingType_Training: | |
1114 TrainingDialog(); | |
1115 break; | |
1116 case BildingType_Jail: | |
1117 JailDialog(); | |
1118 break; | |
0 | 1119 default: |
987 | 1120 __debugbreak();//New BildingType |
0 | 1121 break; |
1122 } | |
1123 } | |
457 | 1124 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 1125 { |
370 | 1126 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); |
1127 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
0 | 1128 } |
1129 else | |
1130 { | |
526 | 1131 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); |
0 | 1132 } |
1133 } | |
1134 | |
1135 //----- (004B1854) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1136 void GUIWindow::DrawCurrentTime( __int64 a2 ) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1137 { |
0 | 1138 unsigned int v2; // edi@1 |
1139 unsigned int v3; // esi@1 | |
1140 unsigned int v4; // ebp@1 | |
1141 unsigned int v5; // ebx@1 | |
1142 signed __int64 v6; // ST2C_8@1 | |
1143 signed __int64 v7; // kr00_8@1 | |
1144 char *v8; // eax@2 | |
1145 char *v9; // eax@7 | |
1146 char *v10; // eax@13 | |
1147 char *v11; // eax@19 | |
1148 unsigned __int16 v12; // ST0C_2@22 | |
1149 int v13; // eax@22 | |
1150 GUIWindow *v15; // [sp+0h] [bp-1Ch]@1 | |
1151 signed __int64 v16; // [sp+Ch] [bp-10h]@1 | |
1152 signed __int64 v17; // [sp+14h] [bp-8h]@1 | |
1153 unsigned int v18; // [sp+20h] [bp+4h]@1 | |
1154 | |
1155 v15 = this; | |
1156 v2 = (unsigned __int64)(signed __int64)((double)a2 * 0.234375) >> 32; | |
1157 v3 = (signed __int64)((double)a2 * 0.234375); | |
1158 v4 = (unsigned __int64)((signed __int64)((double)a2 * 0.234375) / 60) >> 32; | |
1159 v5 = (signed __int64)((double)a2 * 0.234375) / 60; | |
1160 v6 = (signed __int64)((double)a2 * 0.234375) / 60 / 60; | |
1161 v18 = (unsigned int)v6 / 0x18; | |
1162 v17 = (signed __int64)__PAIR__(v2, v3) % 60; | |
1163 v16 = (signed __int64)__PAIR__(v4, v5) % 60; | |
1164 v7 = v6 % 24; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1165 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[532]); |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1166 if ( (unsigned int)v6 /24 ) |
0 | 1167 { |
1168 v8 = pGlobalTXT_LocalizationStrings[57]; | |
1169 if ( v18 <= 1 ) | |
1170 v8 = pGlobalTXT_LocalizationStrings[56]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1171 sprintf(pTmpBuf2.data(), "%d %s ", v18, v8); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1172 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
0 | 1173 } |
1174 if ( v7 ) | |
1175 { | |
1176 if ( v7 <= 1 ) | |
1177 v9 = pGlobalTXT_LocalizationStrings[109]; | |
1178 else | |
1179 v9 = pGlobalTXT_LocalizationStrings[110]; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1180 sprintf(pTmpBuf2.data(), "%d %s ", v7, v9); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1181 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
0 | 1182 } |
1183 if ( v16 && !v18 ) | |
1184 { | |
1185 if ( v16 <= 1 ) | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1186 v10 = pGlobalTXT_LocalizationStrings[437];//"Minute" |
0 | 1187 else |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1188 v10 = pGlobalTXT_LocalizationStrings[436]; //"Minutes" |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1189 sprintf(pTmpBuf2.data(), "%d %s ", v16, v10); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1190 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
0 | 1191 } |
1192 if ( v17 && !v7 ) | |
1193 { | |
1194 if ( v17 <= 1 ) | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1195 v11 = pGlobalTXT_LocalizationStrings[439]; //"Second" |
0 | 1196 else |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1197 v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds" |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1198 sprintf(pTmpBuf2.data(), "%d %s ", v17, v11); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1199 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
0 | 1200 } |
949 | 1201 v12 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1202 v13 = pFontArrus->CalcTextHeight(pTmpBuf.data(), v15, 0, 0); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1203 v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf.data(), 3u); |
0 | 1204 } |
1205 | |
1206 | |
1207 | |
1208 //----- (0044D406) -------------------------------------------------------- | |
762 | 1209 void GUIWindow::DrawTitleText( GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing ) |
1210 { | |
0 | 1211 GUIWindow *pWindow; // esi@1 |
1212 unsigned int v8; // ebx@1 | |
1213 char *v9; // eax@1 | |
1214 unsigned int v11; // edi@1 | |
1215 signed int v12; // esi@1 | |
1216 int v13; // eax@2 | |
1217 GUIFont *pFont; // [sp+Ch] [bp-4h]@1 | |
1218 const char *Stra; // [sp+24h] [bp+14h]@5 | |
1219 | |
1220 pWindow = this; | |
1221 pFont = a2; | |
1222 v8 = this->uFrameWidth - uHorizontalMargin; | |
1223 ui_current_text_color = uDefaultColor; | |
1224 v9 = FitTextInAWindow(pInString, a2, this, uHorizontalMargin, 0); | |
762 | 1225 Stra = strtok(v9, "\n"); |
0 | 1226 v11 = uHorizontalMargin + pWindow->uFrameX; |
1227 v12 = uVerticalMargin + pWindow->uFrameY; | |
1228 while ( 1 ) | |
1229 { | |
762 | 1230 if ( !Stra ) |
0 | 1231 break; |
762 | 1232 v13 = (signed int)(v8 - pFont->GetLineWidth(Stra)) >> 1; |
0 | 1233 if ( v13 < 0 ) |
1234 v13 = 0; | |
1235 pFont->DrawTextLine(uDefaultColor, v11 + v13, v12, Stra, 640); | |
49 | 1236 v12 += pFont->uFontHeight - uLineSpacing; |
762 | 1237 Stra = strtok(0, "\n"); |
0 | 1238 } |
1239 } | |
1240 // 5C6DB4: using guessed type int ui_current_text_color; | |
1241 | |
1242 | |
1243 | |
1244 //----- (0044CE08) -------------------------------------------------------- | |
1006 | 1245 void GUIWindow::DrawText( GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor ) |
1246 { | |
0 | 1247 GUIWindow *v9; // edi@1 |
1248 GUIFont *v10; // ebx@1 | |
1249 int v11; // eax@2 | |
1250 signed int v12; // esi@9 | |
1251 signed int v13; // edi@9 | |
1252 int v14; // edx@9 | |
1253 int v15; // eax@25 | |
1254 unsigned int v16; // ecx@25 | |
1255 int v17; // eax@27 | |
1256 int v18; // edi@32 | |
1257 int v19; // esi@38 | |
1258 std::string v21; // [sp-18h] [bp-50h]@2 | |
1259 const char *v22; // [sp-8h] [bp-40h]@2 | |
1260 int v23; // [sp-4h] [bp-3Ch]@2 | |
1261 char Dest[6]; // [sp+Ch] [bp-2Ch]@32 | |
1262 //char v25; // [sp+Fh] [bp-29h]@32 | |
1263 //char v26; // [sp+11h] [bp-27h]@34 | |
1264 const char *v27; // [sp+20h] [bp-18h]@25 | |
1265 int v28; // [sp+24h] [bp-14h]@25 | |
1266 int v29; // [sp+28h] [bp-10h]@1 | |
1267 size_t v30; // [sp+2Ch] [bp-Ch]@4 | |
1268 GUIWindow *v31; // [sp+30h] [bp-8h]@1 | |
1269 const char *v32; // [sp+34h] [bp-4h]@7 | |
1270 size_t pInString; // [sp+4Ch] [bp+14h]@11 | |
1271 | |
1272 auto a1 = this; | |
1273 v29 = 0; | |
1274 v9 = a1; | |
1275 v10 = a2; | |
1276 v31 = a1; | |
1277 if ( !Str ) | |
1278 { | |
1279 MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0); | |
1006 | 1280 return; |
0 | 1281 } |
1282 v11 = strcmp(Str, "null"); | |
1283 if ( v11 ) | |
1284 { | |
1285 v30 = strlen(Str); | |
1286 LOBYTE(v11) = 0; | |
1287 if ( !uX ) | |
1288 uX = 12; | |
1289 if ( a8 ) | |
1290 { | |
1291 v32 = Str; | |
1292 } | |
1293 else | |
1294 { | |
1295 v11 = (int)FitTextInAWindow(Str, v10, v9, uX, 0); | |
1296 v32 = (const char *)v11; | |
1297 } | |
1298 v12 = uX + v9->uFrameX; | |
1299 v13 = uY + v9->uFrameY; | |
1300 v14 = 0; | |
1301 if ( !a8 || (v11 = v13 + LOBYTE(v10->uFontHeight), v11 <= a8) ) | |
1302 { | |
1303 pInString = 0; | |
1304 if ( (signed int)v30 > 0 ) | |
1305 { | |
1306 do | |
1307 { | |
1308 LOBYTE(v11) = v32[v14]; | |
1309 if ( (unsigned __int8)v11 >= v10->cFirstChar && (unsigned __int8)v11 <= v10->cLastChar | |
1310 || (char)v11 == 12 | |
1311 || (char)v11 == 13 | |
1312 || (char)v11 == 9 | |
1313 || (char)v11 == 10 ) | |
1314 { | |
1315 switch ( (unsigned __int8)v11 ) | |
1316 { | |
1317 case 9u: | |
1318 strncpy(Dest, &v32[v14 + 1], 3u); | |
1319 Dest[3] = 0; | |
1320 pInString += 3; | |
1321 v29 = atoi(Dest); | |
1322 v19 = atoi(Dest); | |
1323 LOBYTE(v11) = (char)v31; | |
1324 v12 = uX + v31->uFrameX + v19; | |
1325 break; | |
1326 case 0xAu: | |
1327 v11 = LOBYTE(v10->uFontHeight); | |
1328 uY = uY + v11 - 3; | |
1329 v13 = uY + v31->uFrameY; | |
1330 v12 = uX + v29 + v31->uFrameX; | |
1331 if ( a8 ) | |
1332 goto LABEL_36; | |
1333 break; | |
1334 case 0xCu: | |
1335 strncpy(Dest, &v32[v14 + 1], 5u); | |
1336 Dest[5] = 0; | |
1337 v11 = atoi(Dest); | |
1338 pInString += 5; | |
1339 uFontColor = v11; | |
1340 break; | |
1341 case 0xDu: | |
1342 strncpy(Dest, &v32[v14 + 1], 3u); | |
1343 Dest[3] = 0; | |
1344 pInString += 3; | |
1345 v18 = atoi(Dest); | |
1346 v11 = v10->GetLineWidth(&v32[pInString]); | |
1347 v12 = v31->uFrameZ - v11 - v18; | |
1348 v13 = uY + v31->uFrameY; | |
1349 if ( a8 ) | |
1350 { | |
1351 v11 = LOBYTE(v10->uFontHeight); | |
1352 LABEL_36: | |
1353 v11 = v11 + v13 - 3; | |
1354 if ( v11 > a8 ) | |
1006 | 1355 return; |
0 | 1356 break; |
1357 } | |
1358 break; | |
1359 default: | |
1360 if ( (char)v11 == 34 && v32[v14 + 1] == 34 ) | |
1361 { | |
1362 ++v14; | |
1363 pInString = v14; | |
1364 } | |
1365 v27 = &v32[v14]; | |
1366 v15 = (unsigned __int8)v32[v14]; | |
1367 v16 = *((int *)&v10->cFirstChar + 3 * v15 + 9); | |
1368 v28 = *((int *)&v10->cFirstChar + 3 * v15 + 9); | |
1369 if ( v14 > 0 ) | |
1370 v12 += v10->pMetrics[v15].uLeftSpacing; | |
1160 | 1371 v17 = (int)((char *)&v10[1] + v10->font_pixels_offset[v15]); |
0 | 1372 if ( (short)uFontColor ) |
1373 pRenderer->DrawText( | |
1374 v12, | |
1375 v13, | |
1376 (unsigned __int8 *)v17, | |
1377 v16, | |
1378 LOBYTE(v10->uFontHeight), | |
1379 v10->pFontPalettes[0], | |
1380 uFontColor, | |
1381 uFontShadowColor); | |
1382 else | |
1383 pRenderer->DrawTextPalette( | |
1384 v12, | |
1385 v13, | |
1386 v17, | |
1387 v16, | |
1388 LOBYTE(v10->uFontHeight), | |
1389 v10->pFontPalettes[0], | |
1390 a7); | |
1391 LOBYTE(v11) = v30; | |
1392 v12 += v28; | |
1393 if ( (signed int)pInString < (signed int)v30 ) | |
1394 { | |
1395 LOBYTE(v11) = 3 * *v27; | |
1396 v12 += v10->pMetrics[(unsigned __int8)*v27].uRightSpacing; | |
1397 } | |
1398 break; | |
1399 } | |
1400 } | |
1401 v14 = pInString++ + 1; | |
1402 } | |
1403 while ( (signed int)pInString < (signed int)v30 ); | |
1404 } | |
1405 } | |
1406 } | |
1006 | 1407 return; |
0 | 1408 } |
1409 | |
1410 | |
1411 //----- (0044CB4F) -------------------------------------------------------- | |
1412 int GUIWindow::DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8) | |
1413 { | |
24 | 1414 GUIFont *pFont; // edi@1 |
1415 int pLineWidth; // ebx@1 | |
0 | 1416 int v11; // esi@3 |
1417 unsigned __int8 v12; // cl@7 | |
1418 signed int v13; // esi@19 | |
1419 signed int v14; // ebx@19 | |
1420 unsigned __int8 v15; // cl@21 | |
1421 int v16; // eax@22 | |
1422 int v17; // ecx@22 | |
1423 int v18; // ecx@23 | |
1424 int v19; // ecx@24 | |
1425 unsigned int v20; // ecx@26 | |
1426 int v21; // eax@28 | |
1427 int v22; // ebx@34 | |
1428 int v23; // eax@34 | |
1429 int v24; // ebx@36 | |
1430 char Str; // [sp+Ch] [bp-20h]@34 | |
1431 char v26; // [sp+Fh] [bp-1Dh]@34 | |
1432 char v27; // [sp+11h] [bp-1Bh]@35 | |
1433 int v28; // [sp+20h] [bp-Ch]@17 | |
1434 GUIWindow *pWindow; // [sp+24h] [bp-8h]@1 | |
24 | 1435 size_t pNumLen; // [sp+28h] [bp-4h]@1 |
0 | 1436 size_t Str1a; // [sp+40h] [bp+14h]@5 |
1437 size_t Str1b; // [sp+40h] [bp+14h]@19 | |
1438 const char *Sourcea; // [sp+44h] [bp+18h]@20 | |
1439 int v34; // [sp+48h] [bp+1Ch]@26 | |
1440 | |
24 | 1441 pFont = a2; |
0 | 1442 pWindow = this; |
24 | 1443 pNumLen = strlen(Str1); |
1444 pLineWidth = pFont->GetLineWidth(Str1); | |
1445 if ( pLineWidth < Source ) | |
0 | 1446 { |
24 | 1447 pWindow->DrawText(pFont, uX, uY, uColor, Str1, 0, 0, 0); |
1448 return pLineWidth; | |
0 | 1449 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1450 strcpy(pTmpBuf2.data(), Str1); |
0 | 1451 v11 = 0; |
1452 if ( a8 ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1453 _strrev(pTmpBuf2.data()); |
0 | 1454 Str1a = 0; |
24 | 1455 if ( (signed int)pNumLen > 0 ) |
0 | 1456 { |
1457 do | |
1458 { | |
1459 if ( v11 >= Source ) | |
1460 break; | |
24 | 1461 if ( pFont->IsCharValid(v12 = pTmpBuf2[Str1a]) ) |
0 | 1462 { |
1463 if ( v12 < 9u ) | |
24 | 1464 { |
1465 if ( (signed int)Str1a > 0 ) | |
1466 v11 += pFont->pMetrics[v12].uLeftSpacing; | |
1467 v11 += *((int *)&pFont->cFirstChar + 3 * v12 + 9); | |
1468 if ( (signed int)Str1a < (signed int)pNumLen ) | |
1469 v11 += pFont->pMetrics[v12].uRightSpacing; | |
1470 goto LABEL_16; | |
1471 } | |
1472 if ( v12 > 0xAu )//10 | |
0 | 1473 { |
1474 if ( v12 == 12 ) | |
1475 { | |
1476 Str1a += 5; | |
1477 } | |
1478 else | |
1479 { | |
1480 if ( v12 != 13 ) | |
1481 { | |
1482 if ( (signed int)Str1a > 0 ) | |
24 | 1483 v11 += pFont->pMetrics[v12].uLeftSpacing; |
1484 v11 += *((int *)&pFont->cFirstChar + 3 * v12 + 9); | |
1485 if ( (signed int)Str1a < (signed int)pNumLen ) | |
1486 v11 += pFont->pMetrics[v12].uRightSpacing; | |
0 | 1487 } |
1488 } | |
1489 } | |
1490 } | |
1491 LABEL_16: | |
1492 ++Str1a; | |
1493 } | |
24 | 1494 while ( (signed int)Str1a < (signed int)pNumLen ); |
0 | 1495 } |
566 | 1496 pTmpBuf2[Str1a - 1] = 0; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1497 pNumLen = strlen(pTmpBuf2.data()); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1498 v28 = pFont->GetLineWidth(pTmpBuf2.data()); |
0 | 1499 if ( a8 ) |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1500 _strrev(pTmpBuf2.data()); |
0 | 1501 Str1b = 0; |
1502 v13 = uX + pWindow->uFrameX; | |
1503 v14 = uY + pWindow->uFrameY; | |
24 | 1504 if ( (signed int)pNumLen > 0 ) |
0 | 1505 { |
1506 Sourcea = &pTmpBuf2[1]; | |
1507 do | |
1508 { | |
24 | 1509 if ( pFont->IsCharValid(v15 = pTmpBuf2[Str1b]) ) |
0 | 1510 { |
1511 v16 = v15; | |
1512 v17 = v15 - 9; | |
24 | 1513 if ( v17 )//>0 |
0 | 1514 { |
1515 v18 = v17 - 1; | |
24 | 1516 if ( v18 )//>0 |
0 | 1517 { |
1518 v19 = v18 - 2; | |
24 | 1519 if ( v19 )//>0 |
0 | 1520 { |
24 | 1521 if ( v19 == 1 )//v15 == 13 |
0 | 1522 { |
1523 strncpy(&Str, Sourcea, 3u); | |
1524 v26 = 0; | |
1525 Str1b += 3; | |
1526 Sourcea += 3; | |
1527 v22 = atoi(&Str); | |
24 | 1528 v23 = pFont->GetLineWidth(&pTmpBuf2[Str1b]); |
0 | 1529 v13 = pWindow->uFrameZ - v23 - v22; |
1530 v14 = uY; | |
1531 } | |
24 | 1532 else//v15 > 13 |
0 | 1533 { |
24 | 1534 v20 = *((int *)&pFont->cFirstChar + 3 * v16 + 9); |
1535 v34 = *((int *)&pFont->cFirstChar + 3 * v16 + 9); | |
0 | 1536 if ( (signed int)Str1b > 0 ) |
24 | 1537 v13 += pFont->pMetrics[v16].uLeftSpacing; |
1160 | 1538 v21 = (int)((char *)&pFont[1] + pFont->font_pixels_offset[v16]); |
0 | 1539 if ( (short)uColor ) |
24 | 1540 pRenderer->DrawText(v13, v14, (unsigned __int8 *)v21, v20, LOBYTE(pFont->uFontHeight), pFont->pFontPalettes[0], uColor, 0); |
0 | 1541 else |
24 | 1542 pRenderer->DrawTextPalette(v13, v14, v21, v20, LOBYTE(pFont->uFontHeight), pFont->pFontPalettes[0], 0); |
0 | 1543 v13 += v34; |
24 | 1544 if ( (signed int)Str1b < (signed int)pNumLen ) |
1545 v13 += pFont->pMetrics[(unsigned __int8)pTmpBuf2[Str1b]].uRightSpacing; | |
0 | 1546 } |
1547 } | |
24 | 1548 else//v15 == 12 |
0 | 1549 { |
1550 strncpy(&Str, Sourcea, 5u); | |
1551 v27 = 0; | |
1552 Str1b += 5; | |
1553 Sourcea += 5; | |
1554 uColor = atoi(&Str); | |
1555 } | |
1556 } | |
24 | 1557 else//v15 == 10 |
0 | 1558 { |
24 | 1559 v24 = LOBYTE(pFont->uFontHeight); |
0 | 1560 v13 = uX; |
1561 uY = uY + v24 - 3; | |
1562 v14 = v24 + uY - 3; | |
1563 } | |
1564 } | |
24 | 1565 else//v15 == 9 |
0 | 1566 { |
1567 strncpy(&Str, Sourcea, 3u); | |
1568 v26 = 0; | |
1569 atoi(&Str); | |
1570 Str1b += 3; | |
1571 Sourcea += 3; | |
1572 } | |
1573 } | |
1574 ++Str1b; | |
1575 ++Sourcea; | |
1576 } | |
24 | 1577 while ( (signed int)Str1b < (signed int)pNumLen ); |
0 | 1578 } |
1579 return v28; | |
1580 } | |
1581 | |
1582 //----- (0041D12F) -------------------------------------------------------- | |
189 | 1583 GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, |
832 | 1584 int a6, int a7, UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...) |
0 | 1585 { |
17 | 1586 GUIButton *pButton; // esi@1 |
0 | 1587 unsigned int v13; // eax@1 |
1588 unsigned int v14; // ebx@4 | |
1589 unsigned int v15; // eax@4 | |
189 | 1590 unsigned int TextureNum=0; // ebx@4 |
0 | 1591 unsigned int v17; // eax@4 |
1592 Texture *v18; // eax@4 | |
1593 Texture **v19; // ecx@5 | |
1594 Texture **v20; // edx@5 | |
1595 GUIButton *v21; // eax@7 | |
189 | 1596 va_list texturs_ptr; |
0 | 1597 |
17 | 1598 pButton = (GUIButton *)pAllocator->AllocNamedChunk(0, 0xBCu, "BUTTON"); |
1599 pButton->pParent = this; | |
1600 pButton->uX = uX + this->uFrameX; | |
0 | 1601 v13 = uY + this->uFrameY; |
17 | 1602 pButton->uHeight = uHeight; |
1603 pButton->uY = v13; | |
1604 pButton->uWidth = uWidth; | |
0 | 1605 if ( a6 == 2 && !uHeight ) |
17 | 1606 pButton->uHeight = uWidth; |
1607 v14 = pButton->uX; | |
1608 pButton->uButtonType = a6; | |
0 | 1609 v15 = v14 + uWidth - 1; |
17 | 1610 pButton->uZ = v15; |
1611 v17 = pButton->uY; | |
271 | 1612 pButton->field_2C_is_pushed = 0; |
17 | 1613 pButton->uW = v17 + uHeight - 1; |
1614 pButton->field_1C = a7; | |
832 | 1615 pButton->msg = msg; |
1616 pButton->msg_param = msg_param; | |
17 | 1617 pButton->uHotkey = uHotkey; |
0 | 1618 strlen(pName); |
17 | 1619 strcpy(pButton->pButtonName, pName); |
189 | 1620 va_start(texturs_ptr, pName); |
1621 while (NULL!=(pTextures=va_arg(texturs_ptr, Texture *))) | |
0 | 1622 { |
189 | 1623 pButton->pTextures[TextureNum]=pTextures; |
1624 ++TextureNum; | |
0 | 1625 } |
189 | 1626 va_end(texturs_ptr); |
1627 pButton->uNumTextures = TextureNum; | |
1628 if ( this->pControlsTail ) | |
1629 this->pControlsTail->pNext = pButton; | |
0 | 1630 else |
17 | 1631 this->pControlsHead = pButton; |
1632 pButton->pPrev = this->pControlsTail; | |
1633 this->pControlsTail = pButton; | |
1634 pButton->pNext = 0; | |
0 | 1635 ++this->uNumControls; |
17 | 1636 return pButton; |
0 | 1637 } |
1638 | |
1639 //----- (00459C2B) -------------------------------------------------------- | |
1640 void GUIWindow::DrawFlashingInputCursor(signed int a3, int a4, GUIFont *a2) | |
1641 { | |
1642 signed int v4; // esi@1 | |
1643 GUIWindow *v5; // edi@1 | |
1644 | |
1645 v4 = a3; | |
1646 v5 = this; | |
1647 if ( GetTickCount() % 1000 > 500 ) | |
1648 DrawText(a2, v4, a4, 0, "_", 0, 0, 0); | |
1649 } | |
1650 | |
1651 //----- (0041C432) -------------------------------------------------------- | |
11 | 1652 GUIWindow *GUIWindow::Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, WindowType eWindowType, int pButton, int a5) |
0 | 1653 { |
1654 unsigned int uNextFreeWindowID; // ebp@1 | |
1655 //int *v8; // eax@1 | |
1656 //GUIWindow *pWindow; // esi@4 | |
962 | 1657 //int v10; // eax@4 |
0 | 1658 unsigned int v11; // ebx@15 |
423 | 1659 NPCData *speakingNPC; // ebp@15 |
1660 int v14; // eax@20 | |
1661 int v16; // eax@25 | |
1662 int v18; // eax@30 | |
1663 int v20; // eax@35 | |
1664 int v22; // eax@40 | |
1665 int v24; // eax@45 | |
0 | 1666 int v25; // eax@65 |
1667 unsigned int v26; // ebx@65 | |
1668 char *v27; // eax@71 | |
1669 const char *v29; // [sp-8h] [bp-18h]@68 | |
1670 char *v30; // [sp-4h] [bp-14h]@68 | |
1671 int uWidtha; // [sp+14h] [bp+4h]@66 | |
423 | 1672 int num_menu_buttons; // [sp+20h] [bp+10h]@15 |
0 | 1673 |
1674 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) | |
1675 { | |
1676 if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null) | |
1677 break; | |
1678 } | |
1679 | |
1680 auto pWindow = &pWindowList[uNextFreeWindowID]; | |
1681 pWindow->uFrameWidth = uWidth; | |
1682 pWindow->uFrameZ = uX + uWidth - 1; | |
1683 pWindow->uFrameW = uY + uHeight - 1; | |
11 | 1684 pWindow->ptr_1C = (void *)pButton; |
0 | 1685 pWindow->Hint = (char *)a5; |
962 | 1686 //v10 = uNumVisibleWindows; |
0 | 1687 pWindow->uFrameX = uX; |
962 | 1688 //++v10; |
0 | 1689 pWindow->uFrameY = uY; |
1690 pWindow->uFrameHeight = uHeight; | |
1691 pWindow->eWindowType = eWindowType; | |
972 | 1692 pWindow->receives_keyboard_input = false; |
496 | 1693 ++uNumVisibleWindows; |
1694 pWindow->numVisibleWindows = uNumVisibleWindows; | |
1695 pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1; | |
0 | 1696 if ( (signed int)eWindowType <= 20 ) |
1697 { | |
1698 if (eWindowType != WINDOW_Chest) | |
1699 { | |
1700 switch (eWindowType) | |
1701 { | |
1702 case WINDOW_Book: | |
1703 pWindow->InitializeBookView(); | |
1704 break; | |
165 | 1705 case WINDOW_Dialogue: |
11 | 1706 pMainScreenNum = pCurrentScreen; |
151 | 1707 pCurrentScreen = SCREEN_NPC_DIALOGUE; |
832 | 1708 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" |
735 | 1709 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
496 | 1710 if ( pWindow->par1C != 1 ) |
0 | 1711 { |
423 | 1712 num_menu_buttons = 0; |
0 | 1713 v11 = LOBYTE(pFontArrus->uFontHeight) - 3; |
602 | 1714 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
827 | 1715 if ( GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1 )//QuestsNPC_greet |
0 | 1716 { |
423 | 1717 if ( speakingNPC->joins ) |
0 | 1718 { |
832 | 1719 pWindow->CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0); |
423 | 1720 num_menu_buttons = 1; |
0 | 1721 } |
423 | 1722 if ( speakingNPC->evt_A ) |
0 | 1723 { |
423 | 1724 if ( num_menu_buttons < 4 ) |
0 | 1725 { |
423 | 1726 v14 = NPC_EventProcessor(speakingNPC->evt_A); |
0 | 1727 if ( v14 == 1 || v14 == 2 ) |
832 | 1728 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0); |
0 | 1729 } |
1730 } | |
423 | 1731 if ( speakingNPC->evt_B ) |
0 | 1732 { |
423 | 1733 if ( num_menu_buttons < 4 ) |
0 | 1734 { |
423 | 1735 v16 = NPC_EventProcessor(speakingNPC->evt_B); |
0 | 1736 if ( v16 == 1 || v16 == 2 ) |
832 | 1737 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0); |
0 | 1738 } |
1739 } | |
423 | 1740 if ( speakingNPC->evt_C ) |
0 | 1741 { |
423 | 1742 if ( num_menu_buttons < 4 ) |
0 | 1743 { |
423 | 1744 v18 = NPC_EventProcessor(speakingNPC->evt_C); |
0 | 1745 if ( v18 == 1 || v18 == 2 ) |
832 | 1746 pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0); |
0 | 1747 } |
1748 } | |
423 | 1749 if ( speakingNPC->evt_D ) |
0 | 1750 { |
423 | 1751 if ( num_menu_buttons < 4 ) |
0 | 1752 { |
423 | 1753 v20 = NPC_EventProcessor(speakingNPC->evt_D); |
0 | 1754 if ( v20 == 1 || v20 == 2 ) |
832 | 1755 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0); |
0 | 1756 } |
1757 } | |
423 | 1758 if ( speakingNPC->evt_E ) |
0 | 1759 { |
423 | 1760 if ( num_menu_buttons < 4 ) |
0 | 1761 { |
423 | 1762 v22 = NPC_EventProcessor(speakingNPC->evt_E); |
0 | 1763 if ( v22 == 1 || v22 == 2 ) |
832 | 1764 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0); |
0 | 1765 } |
1766 } | |
423 | 1767 if (speakingNPC->evt_F ) |
0 | 1768 { |
423 | 1769 if ( num_menu_buttons < 4 ) |
0 | 1770 { |
423 | 1771 v24 = NPC_EventProcessor(speakingNPC->evt_F); |
0 | 1772 if ( v24 == 1 || v24 == 2 ) |
832 | 1773 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0); |
0 | 1774 } |
1775 } | |
1776 } | |
1777 else | |
1778 { | |
423 | 1779 if ( speakingNPC->joins ) |
0 | 1780 { |
832 | 1781 pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее |
423 | 1782 if (speakingNPC->Hired()) |
0 | 1783 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1784 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1785 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0); |
0 | 1786 } |
1787 else | |
1788 { | |
832 | 1789 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять |
0 | 1790 } |
423 | 1791 num_menu_buttons = 2; |
0 | 1792 } |
1793 } | |
972 | 1794 pWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); |
0 | 1795 } |
1796 break; | |
948 | 1797 |
11 | 1798 case WINDOW_ChangeLocation: |
1799 pMainScreenNum = pCurrentScreen; | |
151 | 1800 pCurrentScreen = SCREEN_CHANGE_LOCATION; |
987 | 1801 pBtn_ExitCancel = pWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Остаться в этой области |
948 | 1802 pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
1803 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0); | |
1804 pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0); | |
0 | 1805 break; |
948 | 1806 |
11 | 1807 case WINDOW_SpellBook: // окно книги заклов |
0 | 1808 InitializeBookTextures(); |
11 | 1809 pWindow->OpenSpellBook(); |
0 | 1810 break; |
11 | 1811 case WINDOW_GreetingNPC: // окно приветствия НПС |
1812 pMainScreenNum = pCurrentScreen; | |
3 | 1813 pKeyActionMap->EnterText(0, 15, pWindow); |
151 | 1814 pCurrentScreen = SCREEN_BRANCHLESS_NPC_DIALOG; |
0 | 1815 break; |
1816 } | |
1817 return pWindow; | |
1818 } | |
11 | 1819 //LABEL_62: |
948 | 1820 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, '1', "", 0); |
1821 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, '2', "", 0); | |
1822 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, '3', "", 0); | |
1823 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, '4', "", 0); | |
832 | 1824 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0); |
0 | 1825 return pWindow; |
1826 } | |
1827 if (eWindowType == WINDOW_HouseInterior) | |
1828 { | |
151 | 1829 pCurrentScreen = SCREEN_HOUSE; |
1211 | 1830 pBtn_ExitCancel = pWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания |
735 | 1831 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
1211 | 1832 |
873 | 1833 for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 ) |
0 | 1834 { |
1211 | 1835 if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 1836 { |
1837 v30 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
874 | 1838 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S]; |
0 | 1839 } |
1840 else | |
1841 { | |
1842 if ( v26 || !dword_591080 ) | |
1211 | 1843 v27 = HouseNPCData[v26 +1 - (dword_591080 != 0)]->pName; |
0 | 1844 else |
11 | 1845 v27 = (char *)p2DEvents[pButton - 1].pProprieterName; |
0 | 1846 v30 = v27; |
874 | 1847 v29 = (char*)pGlobalTXT_LocalizationStrings[435]; |
0 | 1848 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1849 sprintfex(byte_591180[v26].data(), v29, v30); |
1211 | 1850 dword_5913F4[v26] = pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], |
419 | 1851 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26], |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1852 0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0); |
0 | 1853 } |
1211 | 1854 |
1855 if ( uNumDialogueNPCPortraits == 1 ) | |
0 | 1856 { |
336 | 1857 window_SpeakInHouse = &pWindowList[uNextFreeWindowID]; |
0 | 1858 _4B4224_UpdateNPCTopics(0); |
1859 } | |
1860 } | |
1861 else | |
1862 { | |
158 | 1863 if (eWindowType == WINDOW_Transition) |
0 | 1864 { |
11 | 1865 pMainScreenNum = pCurrentScreen; |
151 | 1866 pCurrentScreen = SCREEN_INPUT_BLV; |
960 | 1867 pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Отмена |
948 | 1868 pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
1869 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0); | |
1870 pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0); | |
0 | 1871 return pWindow; |
1872 } | |
961 | 1873 if (eWindowType == WINDOW_CastSpell) |
0 | 1874 { |
1875 pEventTimer->Pause(); | |
1876 pAudioPlayer->StopChannels(-1, -1); | |
1877 pMouse->SetCursorBitmap("MICON2"); | |
11 | 1878 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u);//Выберите цель |
0 | 1879 return pWindow; |
1880 } | |
158 | 1881 if (eWindowType == WINDOW_Scroll) |
11 | 1882 //goto LABEL_62; |
1883 { | |
948 | 1884 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, '1', "", 0); |
1885 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, '2', "", 0); | |
1886 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, '3', "", 0); | |
1887 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, '4', "", 0); | |
1888 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
11 | 1889 return pWindow; |
1890 } | |
898 | 1891 if (eWindowType == WINDOW_CastSpell_InInventory) |
0 | 1892 { |
1893 pMouse->SetCursorBitmap("MICON2"); | |
832 | 1894 pBtn_ExitCancel = pWindow->CreateButton(0x188u, 0x13Eu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена |
945 | 1895 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); |
11 | 1896 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Выбрать цель |
0 | 1897 ++pIcons_LOD->uTexturePacksCount; |
1898 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
151 | 1899 pCurrentScreen = SCREEN_CASTING; |
0 | 1900 if ( !pIcons_LOD->uNumPrevLoadedFiles ) |
1901 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1902 } | |
1903 } | |
1904 return pWindow; | |
1905 } |