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