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