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