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