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