Mercurial > mm7
annotate GUIWindow.cpp @ 1410:38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
stru167 -> TrailParticle
stru167warp -> TrailParticleGenerator
author | Nomad |
---|---|
date | Fri, 26 Jul 2013 22:19:29 +0200 |
parents | c9e3b93ec570 |
children | 2423bc2af692 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
0 | 5 #include "GUIWindow.h" |
6 #include "GUIFont.h" | |
7 #include "Party.h" | |
8 #include "LOD.h" | |
9 #include "Keyboard.h" | |
10 #include "IndoorCamera.h" | |
11 #include "Math.h" | |
12 #include "VideoPlayer.h" | |
13 #include "Allocator.h" | |
14 #include "MapInfo.h" | |
15 #include "Time.h" | |
16 #include "AudioPlayer.h" | |
17 #include "Mouse.h" | |
18 #include "Viewport.h" | |
19 #include "Render.h" | |
20 #include "PlayerFrameTable.h" | |
21 #include "SaveLoad.h" | |
22 #include "StorylineTextTable.h" | |
23 #include "Events2D.h" | |
1299 | 24 #include "UI\UIHouses.h" |
1310 | 25 #include "UI\UIBooks.h" |
189 | 26 #include "texts.h" |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
74
diff
changeset
|
27 #include "Autonotes.h" |
949 | 28 #include "Awards.h" |
1297 | 29 #include "Chest.h" |
0 | 30 |
31 | |
32 #include "mm7_data.h" | |
33 | |
1268 | 34 typedef struct _RGBColor |
35 { | |
36 unsigned char R; | |
37 unsigned char B; | |
38 unsigned char G; | |
39 }RGBColor; | |
0 | 40 |
41 | |
1268 | 42 std::array<RGBColor, 20> spell_tooltip_colors={{ |
43 {0x96, 0xD4, 0xFF}, | |
44 {0xFF, 0x80, 0x00}, | |
45 {0xFF, 0xFF, 0x9B}, | |
46 {0xE1, 0xE1, 0xE1}, | |
47 {0x80, 0x80, 0x80}, | |
48 {0x96, 0xD4, 0xFF}, | |
49 {0xFF, 0x55, 0x00}, | |
50 {0x96, 0xD4, 0xFF}, | |
51 {0xFF, 0x55, 0x00}, | |
52 {0xE1, 0xE1, 0xE1}, | |
53 {0xFF, 0x55, 0x00}, | |
54 {0x96, 0xD4, 0xFF}, | |
55 {0xEB, 0x0F, 0xFF}, | |
56 {0xFF, 0x80, 0x00}, | |
57 {0x96, 0xD4, 0xFF}, | |
58 {0x80, 0x80, 0x80}, | |
59 {0xFF, 0x55, 0x00}, | |
60 {0x00, 0x80, 0xFF}, | |
61 {0x00, 0x80, 0xFF}, | |
62 {0x96, 0xD4, 0xFF}}}; | |
63 | |
0 | 64 |
65 int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb | |
66 struct GUIWindow *pWindow_MainMenu; | |
1202 | 67 std::array<struct GUIWindow, 20> pWindowList; |
0 | 68 |
69 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; | |
1012 | 70 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue; |
0 | 71 |
1038 | 72 |
73 | |
74 | |
75 | |
76 | |
77 | |
78 //----- (004141CA) -------------------------------------------------------- | |
1268 | 79 void ModalWindow( const char *pStrHint, int a4 ) |
80 { | |
1038 | 81 pEventTimer->Pause(); |
82 dword_506F0C[0] = pCurrentScreen; | |
1268 | 83 ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, pStrHint); |
1038 | 84 pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE; |
85 } | |
86 // 4E28F8: using guessed type int pCurrentScreen; | |
87 | |
783 | 88 // inlined |
89 //----- (mm6c::00420520) -------------------------------------------------- | |
90 void GUIMessageQueue::Flush() | |
91 { | |
92 if (uNumMessages) | |
93 uNumMessages = pMessages[0].field_8 != 0; | |
94 } | |
95 | |
96 | |
0 | 97 //----- (004356B9) -------------------------------------------------------- |
98 void GUIMessageQueue::PopMessage(enum UIMessageType *pType, int *pParam, int *a4) | |
99 { | |
100 signed int v4; // edx@1 | |
101 GUIMessage *v5; // eax@2 | |
102 | |
103 v4 = 0; | |
104 if ( this->uNumMessages ) | |
105 { | |
106 v5 = this->pMessages; | |
107 *pType = this->pMessages[0].eType; | |
108 *pParam = this->pMessages[0].param; | |
109 *a4 = this->pMessages[0].field_8; | |
110 if ( (signed int)(this->uNumMessages - 1) > 0 ) | |
111 { | |
112 do | |
113 { | |
114 v5->eType = v5[1].eType; | |
115 v5->param = v5[1].param; | |
116 v5->field_8 = v5[1].field_8; | |
117 ++v4; | |
118 ++v5; | |
119 } | |
120 while ( v4 < (signed int)(this->uNumMessages - 1) ); | |
121 } | |
122 --this->uNumMessages; | |
123 } | |
124 } | |
125 | |
126 | |
127 | |
994 | 128 |
129 | |
130 | |
131 //----- (0041B4E1) -------------------------------------------------------- | |
132 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) | |
133 { | |
134 unsigned __int8 v3; // bl@1 | |
135 int result; // eax@1 | |
136 int i; // edx@2 | |
137 GUIButton *j; // ecx@3 | |
138 int k; // edx@7 | |
139 GUIButton *l; // ecx@8 | |
140 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 | |
141 char v10; // [sp+8h] [bp-4h]@1 | |
142 | |
143 v3 = uNewHotkey; | |
144 v10 = toupper(uOldHotkey); | |
145 result = toupper(v3); | |
146 v9 = result; | |
147 if ( bFirstCall ) | |
148 { | |
149 for ( i = uNumVisibleWindows; i >= 0; --i ) | |
150 { | |
151 result = 84 * pVisibleWindowsIdxs[i]; | |
152 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) | |
153 j->field_28 = 0; | |
154 } | |
155 } | |
156 for ( k = uNumVisibleWindows; k >= 0; --k ) | |
157 { | |
158 result = 84 * pVisibleWindowsIdxs[k]; | |
159 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) | |
160 { | |
161 LOBYTE(result) = v10; | |
162 if ( l->uHotkey == v10 ) | |
163 { | |
164 if ( !l->field_28 ) | |
165 { | |
166 LOBYTE(result) = v9; | |
167 l->field_28 = 1; | |
168 l->uHotkey = v9; | |
169 } | |
170 } | |
171 } | |
172 } | |
173 return result; | |
174 } | |
175 | |
176 | |
177 | |
178 | |
179 //----- (0041B438) -------------------------------------------------------- | |
180 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) | |
181 { | |
182 char v1; // al@1 | |
183 int v2; // esi@1 | |
184 char v3; // dl@1 | |
185 GUIWindow *v4; // ecx@2 | |
186 GUIButton *result; // eax@2 | |
187 //int v6; // edx@12 | |
188 | |
189 v1 = toupper(uHotkey); | |
190 v2 = uNumVisibleWindows; | |
191 v3 = v1; | |
1210 | 192 for( v2 = uNumVisibleWindows; v2 >= 0 && pVisibleWindowsIdxs[v2] > 0; v2-- ) |
994 | 193 { |
1210 | 194 v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; |
195 for ( result = v4->pControlsHead; result; result = result->pNext ) | |
196 { | |
197 if ( result->uHotkey == v3 ) | |
198 { | |
199 pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); | |
200 return result; | |
201 } | |
202 } | |
203 if ( !v4->uFrameX && !v4->uFrameY && (v4->uFrameWidth == 640 && v4->uFrameHeight == 480) ) | |
204 break; | |
994 | 205 } |
206 return 0; | |
207 } | |
208 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; | |
209 | |
0 | 210 //----- (0041D73D) -------------------------------------------------------- |
1006 | 211 void GUIWindow::_41D73D_draw_buff_tooltip() |
212 { | |
1268 | 213 |
214 __int64 remaing_time; // ST28_8@11 | |
215 unsigned short text_color; | |
216 int Y_pos; // esi@11 | |
217 int string_count; // [sp+20h] [bp-4h]@7 | |
218 | |
219 | |
220 string_count = 0; | |
221 for (int i=0; i<20; ++i) | |
222 if ( pParty->pPartyBuffs[i].uExpireTime > 0i64 ) | |
223 ++string_count; | |
0 | 224 |
1268 | 225 uFrameHeight = pFontArrus->uFontHeight + 72; |
226 uFrameHeight += (string_count - 1) * pFontArrus->uFontHeight; | |
227 uFrameZ = uFrameWidth + uFrameX - 1; | |
228 uFrameW = uFrameY + uFrameHeight - 1; | |
229 DrawMessageBox(0); | |
230 DrawTitleText(pFontArrus, 0, 12, 0, pGlobalTXT_LocalizationStrings[451], 3u); | |
231 if ( !string_count ) | |
232 DrawTitleText(pFontComic, 0, 40, 0, pGlobalTXT_LocalizationStrings[153], 3u); | |
233 | |
234 GetTickCount(); | |
235 string_count = 0; | |
236 for (int i=0; i<20; ++i) | |
0 | 237 { |
1268 | 238 if ( pParty->pPartyBuffs[i].uExpireTime>0i64 )//!!! |
239 { | |
240 remaing_time = pParty->pPartyBuffs[i].uExpireTime- pParty->uTimePlayed;//!!! | |
241 Y_pos = string_count * pFontComic->uFontHeight + 40; | |
242 text_color = TargetColor(spell_tooltip_colors[i].R, spell_tooltip_colors[i].G, spell_tooltip_colors[i].B); | |
243 DrawText(pFontComic, 52, Y_pos, text_color, aSpellNames[i], 0, 0, 0); | |
244 sub_41D20D_buff_remaining_time_string(Y_pos, this, remaing_time, pFontComic); | |
245 ++string_count; | |
246 } | |
0 | 247 } |
248 } | |
249 | |
250 | |
251 //----- (0041D08F) -------------------------------------------------------- | |
972 | 252 void GUIWindow::_41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5) |
0 | 253 { |
254 if ( a2 ) | |
255 { | |
256 this->pNumPresenceButton = a2; | |
257 this->field_30 = a3; | |
258 this->field_34 = a4; | |
259 this->pCurrentPosActiveItem = a5; | |
260 this->pStartingPosActiveItem = a5; | |
972 | 261 this->receives_keyboard_input = true; |
0 | 262 } |
263 else | |
264 { | |
265 this->pNumPresenceButton = 0; | |
266 this->field_30 = a3; | |
267 this->field_34 = a4; | |
268 this->pCurrentPosActiveItem = 0; | |
269 this->pStartingPosActiveItem = 0; | |
972 | 270 this->receives_keyboard_input = false; |
0 | 271 } |
272 } | |
273 | |
274 | |
275 //----- (0041C26A) -------------------------------------------------------- | |
276 void GUIWindow::Release() | |
277 { | |
961 | 278 //GUIWindow *v1; // esi@1 |
0 | 279 int i; // edi@20 |
961 | 280 //GUIButton *v8; // eax@26 |
281 GUIButton *pNextBtn; // edi@27 | |
282 //int v10; // esi@28 | |
283 //int v11; // ecx@28 | |
0 | 284 int v12; // edx@29 |
285 | |
961 | 286 //v1 = this; |
0 | 287 if ( !this ) |
288 return; | |
696 | 289 |
290 switch( this->eWindowType ) | |
0 | 291 { |
696 | 292 case WINDOW_GreetingNPC: |
293 { | |
1006 | 294 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 295 pCurrentScreen = pMainScreenNum; |
1038 | 296 pKeyActionMap->SetWindowInputStatus(3); |
696 | 297 break; |
298 } | |
299 case WINDOW_HouseInterior: | |
300 { | |
301 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
302 pDialogueNPCPortraits[i]->Release(); | |
303 uNumDialogueNPCPortraits = 0; | |
304 pTexture_Dialogue_Background->Release(); | |
0 | 305 |
1006 | 306 pIcons_LOD->SyncLoadedFilesCount(); |
1405
c0b273d33338
RemoveTexturesPackFromTextureList and RemoveTexturesFromTextureList
Ritor1
parents:
1404
diff
changeset
|
307 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
696 | 308 dword_5C35D4 = 0; |
309 if ( bFlipOnExit ) | |
310 { | |
311 pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi | |
312 + pIndoorCamera->sRotationY); | |
313 pParty->sRotationY = pIndoorCamera->sRotationY; | |
314 } | |
315 pParty->uFlags |= 2u; | |
316 break; | |
317 } | |
318 case WINDOW_Transition: | |
319 { | |
320 pVideoPlayer->Unload(); | |
321 pTexture_outside->Release(); | |
322 pTexture_Dialogue_Background->Release(); | |
1006 | 323 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 324 pCurrentScreen = pMainScreenNum; |
325 break; | |
326 } | |
327 case WINDOW_SpellBook: | |
328 { | |
1402 | 329 OnCloseSpellBookPage(); |
330 OnCloseSpellBook(); | |
696 | 331 break; |
332 } | |
333 case WINDOW_Book: | |
334 { | |
1402 | 335 OnCloseBook(); |
696 | 336 break; |
337 } | |
1402 | 338 case WINDOW_ChangeLocation: |
339 { | |
0 | 340 pTexture_outside->Release(); |
341 pTexture_Dialogue_Background->Release(); | |
1006 | 342 pIcons_LOD->SyncLoadedFilesCount(); |
11 | 343 pCurrentScreen = pMainScreenNum; |
696 | 344 break; |
345 } | |
346 case WINDOW_Dialogue: | |
347 { | |
348 if ( !dword_591084 ) | |
349 pDialogueNPCPortraits[0]->Release(); | |
350 uNumDialogueNPCPortraits = 0; | |
351 pTexture_Dialogue_Background->Release(); | |
352 | |
1006 | 353 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 354 pCurrentScreen = pMainScreenNum; |
355 } | |
356 default: | |
357 { | |
358 break; | |
359 } | |
0 | 360 } |
961 | 361 //v8 = this->pControlsHead; |
362 if ( this->pControlsHead ) | |
0 | 363 { |
364 do | |
365 { | |
961 | 366 pNextBtn = this->pControlsHead->pNext; |
367 pAllocator->FreeChunk(this->pControlsHead); | |
368 this->pControlsHead = pNextBtn; | |
0 | 369 } |
961 | 370 while ( pNextBtn ); |
0 | 371 } |
961 | 372 this->pControlsHead = 0; |
373 this->pControlsTail = 0; | |
374 this->uNumControls = 0; | |
375 this->eWindowType = WINDOW_null; | |
376 while ( this->numVisibleWindows < uNumVisibleWindows ) | |
0 | 377 { |
961 | 378 v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1]; |
379 pVisibleWindowsIdxs[this->numVisibleWindows] = v12; | |
962 | 380 --pWindowList[v12 - 1].numVisibleWindows; |
961 | 381 ++this->numVisibleWindows; |
0 | 382 } |
961 | 383 pVisibleWindowsIdxs[uNumVisibleWindows] = 0; |
384 uNumVisibleWindows = uNumVisibleWindows - 1; | |
0 | 385 } |
386 | |
387 | |
388 | |
389 | |
390 | |
391 | |
392 //----- (0041CD3B) -------------------------------------------------------- | |
393 GUIButton *GUIWindow::GetControl(unsigned int uID) | |
394 { | |
395 GUIButton *result; // eax@1 | |
396 unsigned int v3; // ecx@1 | |
397 | |
398 result = this->pControlsHead; | |
399 v3 = uID; | |
400 if ( (signed int)uID > 0 ) | |
401 { | |
402 do | |
403 { | |
404 result = result->pNext; | |
405 --v3; | |
406 } | |
407 while ( v3 ); | |
408 } | |
409 return result; | |
410 } | |
411 | |
412 //----- (00411BFC) -------------------------------------------------------- | |
413 void GUIWindow::InitializeBookView() | |
414 { | |
415 GUIWindow *v1; // ebp@1 | |
416 signed int v2; // ecx@8 | |
417 __int64 *v3; // ebp@9 | |
418 char *v4; // ecx@10 | |
419 char *v5; // eax@12 | |
420 int v6; // eax@12 | |
421 __int64 v7; // qax@12 | |
422 unsigned int v8; // esi@12 | |
423 GUIButton *v9; // eax@19 | |
424 signed int v10; // esi@19 | |
425 int v11; // eax@24 | |
426 int v12; // eax@27 | |
427 int i; // esi@28 | |
428 char *v14; // ebp@29 | |
429 int v15; // eax@31 | |
710 | 430 //unsigned int v16; // esi@35 |
0 | 431 Player *v17; // esi@38 |
432 unsigned __int16 v18; // ax@38 | |
433 unsigned int v19; // edi@43 | |
434 unsigned int v20; // edi@45 | |
435 void *v21; // esi@45 | |
1310 | 436 signed int max_beacons; // [sp+10h] [bp-5Ch]@38 |
0 | 437 char *v25; // [sp+14h] [bp-58h]@21 |
438 GUIWindow v26; // [sp+18h] [bp-54h]@8 | |
439 | |
440 v1 = this; | |
441 pAudioPlayer->StopChannels(-1, -1); | |
442 InitializeBookFonts(); | |
1310 | 443 v1->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close |
151 | 444 pCurrentScreen = SCREEN_BOOKS; |
949 | 445 num_achieved_awards_2 = 0; |
0 | 446 dword_506528 = 0; |
447 dword_50651C = 0; | |
949 | 448 num_achieved_awards = 0; |
688 | 449 switch (v1->par1C) |
450 { | |
961 | 451 case WINDOW_LloydsBeacon:{ |
688 | 452 byte_506360 = 0; |
948 | 453 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE); |
454 pTexture_LloydBeacons[0] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); | |
1310 | 455 pTexture_LloydBeacons[1] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); |
948 | 456 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); |
457 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
458 | |
961 | 459 pBtn_Book_1 = v1->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon |
460 pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon | |
948 | 461 |
688 | 462 v17 = &pParty->pPlayers[_506348_current_lloyd_playerid]; |
1310 | 463 |
464 max_beacons = 1; | |
465 v18 = v17->pActiveSkills[PLAYER_SKILL_WATER]; | |
466 if ( v18 & 0x100 || (v18 & 0x80) ) | |
467 max_beacons = 5; | |
468 else if ( v18 & 0x40 ) | |
469 max_beacons = 3; | |
470 | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1405
diff
changeset
|
471 |
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1405
diff
changeset
|
472 __debugbreak(); // warning C4700: uninitialized local variable 'v19' used |
1310 | 473 for (int i =0; i< max_beacons; ++i) |
474 CreateButton(pLloydsBeaconsPreviewXs[v19], pLloydsBeaconsPreviewYs[v19], | |
475 92, 68, 1, 180, UIMSG_InstallBeacon, i, 0, "", 0); | |
476 | |
477 for (int i =0; i< 5; ++i) | |
688 | 478 { |
1310 | 479 if (v17->pInstalledBeacons[i].uBeaconTime >= (signed __int64)pParty->uTimePlayed) |
480 LoadThumbnailLloydTexture(i, _506348_current_lloyd_playerid + 1); | |
481 else | |
482 memset(&v17->pInstalledBeacons[i], 0, sizeof(LloydBeacon)); | |
688 | 483 } |
1310 | 484 } |
688 | 485 break; |
710 | 486 |
487 case WINDOW_TownPortal: | |
488 { | |
948 | 489 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("townport", TEXTURE_16BIT_PALETTE); |
710 | 490 pTexture_TownPortalIcons[0] = pIcons_LOD->LoadTexturePtr("tpharmndy", TEXTURE_16BIT_PALETTE); |
491 pTexture_TownPortalIcons[1] = pIcons_LOD->LoadTexturePtr("tpelf", TEXTURE_16BIT_PALETTE); | |
492 pTexture_TownPortalIcons[2] = pIcons_LOD->LoadTexturePtr("tpwarlock", TEXTURE_16BIT_PALETTE); | |
493 pTexture_TownPortalIcons[3] = pIcons_LOD->LoadTexturePtr("tpisland", TEXTURE_16BIT_PALETTE); | |
494 pTexture_TownPortalIcons[4] = pIcons_LOD->LoadTexturePtr("tpheaven", TEXTURE_16BIT_PALETTE); | |
730 | 495 pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE); |
1393 | 496 |
497 static int pTownPortalBook_ws[6] = { 80, 66, 68, 72, 67, 74}; | |
498 static int pTownPortalBook_hs[6] = { 55, 56, 65, 67, 67, 59}; | |
710 | 499 for (uint i = 0; i < 6; ++i) |
961 | 500 v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr); |
1310 | 501 |
710 | 502 } |
503 break; | |
504 | |
505 case WINDOW_QuestBook: | |
948 | 506 { |
507 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE); | |
508 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr( "divbar", TEXTURE_16BIT_PALETTE); | |
509 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
510 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
511 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
512 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
513 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, | |
514 pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, | |
996 | 515 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" |
948 | 516 pTex_tab_an_6b__zoom_on, 0); |
517 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, | |
518 pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, | |
996 | 519 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" |
948 | 520 pTex_tab_an_7b__zoot_on, 0); |
949 | 521 num_achieved_awards = 0; |
1202 | 522 memset(achieved_awards.data(), 0, 4000); |
688 | 523 for ( i = dword_506528; i < 512; ++i ) |
524 { | |
1310 | 525 // v14 = (char *)pQuestTable[i];//(&dword_722F10)[4 * i]; |
526 if ( _449B57_test_bit(pParty->_quest_bits, i) && pQuestTable[i] ) | |
0 | 527 { |
1310 | 528 achieved_awards[num_achieved_awards] = (AwardType)i; |
529 ++num_achieved_awards; | |
0 | 530 } |
531 } | |
949 | 532 v12 = num_achieved_awards; |
533 num_achieved_awards = 0; | |
534 num_achieved_awards_2 = v12; | |
688 | 535 } |
536 break; | |
981 | 537 |
538 | |
710 | 539 case WINDOW_AutonotesBook: |
688 | 540 { |
948 | 541 pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE); |
542 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE); | |
543 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
544 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
545 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
546 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
547 pTexture_506394 = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE); | |
548 pTexture_506390 = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE); | |
549 pTexture_50638C = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE); | |
550 pTexture_506388 = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE); | |
551 pTexture_506384 = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE); | |
552 pTexture_506380 = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE); | |
553 pTexture_50637C = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE); | |
554 pTexture_506378 = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE); | |
555 pTexture_506374 = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE); | |
556 pTexture_506370 = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE); | |
557 pTexture_50636C = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE); | |
558 pTexture_506368 = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE); | |
559 | |
1310 | 560 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, |
561 UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0); | |
562 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, | |
563 UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0); | |
564 pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, | |
565 UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0); // "Potion Notes" | |
566 pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, | |
567 UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0); // "Fountain Notes" | |
568 pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, | |
569 UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0); // "Obelisk Notes" | |
570 pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, | |
571 UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0); // "Seer Notes" | |
572 pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, | |
573 UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes" | |
574 pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, | |
575 UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors" | |
948 | 576 |
949 | 577 num_achieved_awards = 0; |
1310 | 578 for ( i = dword_506528; i < 196; ++i ) |
579 if ( _506568_autonote_type == pAutonoteTxt[i].eType)//dword_72371C[2 * v10] ) | |
688 | 580 { |
1310 | 581 if ( i ) |
688 | 582 { |
1310 | 583 if ( _449B57_test_bit(pParty->_autonote_bits, i) && pAutonoteTxt[i].pText ) |
688 | 584 { |
1310 | 585 |
586 achieved_awards[num_achieved_awards] = (AwardType)i; | |
587 ++num_achieved_awards; | |
688 | 588 } |
589 } | |
590 } | |
1310 | 591 |
688 | 592 } |
593 break; | |
948 | 594 |
710 | 595 case WINDOW_MapsBook: |
948 | 596 { |
688 | 597 dword_506364 = 1; |
948 | 598 pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); |
599 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE); | |
600 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE); | |
601 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE); | |
602 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE); | |
603 pTexture_506394 = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE); | |
604 pTexture_506390 = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE); | |
605 pTexture_50638C = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE); | |
606 pTexture_506388 = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE); | |
607 pTexture_506384 = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE); | |
608 pTexture_506380 = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE); | |
609 pTexture_50637C = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE); | |
610 pTexture_506378 = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE); | |
611 | |
1310 | 612 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, |
613 UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In" | |
614 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, | |
615 UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out" | |
616 pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, | |
617 UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up | |
618 pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, | |
619 UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down | |
620 pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, | |
621 UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right" | |
622 pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, | |
623 UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left" | |
688 | 624 } |
625 break; | |
948 | 626 |
627 case WINDOW_CalendarBook: | |
628 { | |
629 pSpellBookPagesTextr_13 = pIcons_LOD->LoadTexturePtr("sbdate-time", TEXTURE_16BIT_PALETTE); | |
630 pTex_moon_new = pIcons_LOD->LoadTexturePtr("moon_new", TEXTURE_16BIT_PALETTE); | |
631 pTex_moon_4 = pIcons_LOD->LoadTexturePtr("moon_4", TEXTURE_16BIT_PALETTE); | |
632 pTex_moon_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); | |
633 pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); | |
634 pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE); | |
688 | 635 } |
636 break; | |
948 | 637 |
1004 | 638 case WINDOW_JournalBook: |
948 | 639 { |
640 pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE); | |
641 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
642 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
643 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
644 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
645 | |
1310 | 646 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, |
647 pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, | |
648 UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0); | |
649 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, | |
650 pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0, | |
651 pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); | |
948 | 652 |
949 | 653 num_achieved_awards = 0; |
688 | 654 v26.uFrameX = 48; |
655 v26.uFrameY = 70; | |
656 v26.uFrameWidth = 360; | |
657 v26.uFrameHeight = 264; | |
658 v2 = LOBYTE(pAutonoteFont->uFontHeight) - 3; | |
659 v26.uFrameZ = 407; | |
660 v26.uFrameHeight = v2 * 264 / v2; | |
661 v26.uFrameW = v26.uFrameHeight + 69; | |
949 | 662 memset(&achieved_awards, 0, 4000); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
663 memset(byte_5C6D50.data(), 0, 0x64u); |
688 | 664 if ( dword_506528 < 29 ) |
665 { | |
666 v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * dword_506528]; | |
667 for(int i=dword_506528+1;i<dword_506528+31;i++) | |
668 { | |
669 v4 = pStorylineText->StoreLine[i].pText; | |
670 if ( *v3 ) | |
671 { | |
672 if ( v4 ) | |
673 { | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1409
diff
changeset
|
674 v5 = BuildDialogueString(v4, uActiveCharacter - 1, 0, 0, 0, v3); |
688 | 675 v6 = pAutonoteFont->CalcTextHeight(v5, &v26, 1, 0); |
676 v7 = (v6 - 3) / (signed int)v26.uFrameHeight; | |
677 v8 = v7 + 1; | |
678 if ( (signed int)v7 + 1 > 0 ) | |
679 { | |
949 | 680 memset32((char *)&achieved_awards + 4 * num_achieved_awards , i, v8); |
688 | 681 do |
682 { | |
949 | 683 LODWORD(v7) = num_achieved_awards++; |
688 | 684 byte_5C6D50[(int)v7] = BYTE4(v7); |
685 ++HIDWORD(v7); | |
686 } | |
687 while ( SHIDWORD(v7) < (signed int)v8 ); | |
688 } | |
689 } | |
690 } | |
691 ++i; | |
692 ++v3; | |
693 } | |
694 } | |
695 | |
696 } | |
697 break; | |
698 } | |
699 | |
0 | 700 } |
701 | |
702 | |
703 | |
704 | |
705 //----- (00415551) -------------------------------------------------------- | |
706 void GUIWindow::DrawMessageBox(int arg0) | |
707 { | |
708 unsigned int v2; // edi@1 | |
709 GUIWindow *v3; // ebx@1 | |
710 signed int v4; // esi@2 | |
711 unsigned int v5; // eax@2 | |
712 unsigned int v6; // edx@4 | |
713 unsigned int v7; // ecx@6 | |
714 unsigned int v8; // eax@9 | |
715 __int32 v9; // eax@10 | |
716 unsigned int v10; // eax@18 | |
717 LONG v11; // ecx@18 | |
718 unsigned int v12; // edx@18 | |
719 unsigned int v13; // eax@18 | |
720 const char *v14; // ecx@18 | |
721 int v15; // eax@19 | |
722 unsigned int v16; // esi@19 | |
723 const char *v17; // ebx@25 | |
724 int v18; // eax@26 | |
725 GUIWindow v19; // [sp+Ch] [bp-60h]@18 | |
726 POINT a2; // [sp+60h] [bp-Ch]@8 | |
727 unsigned int v21; // [sp+68h] [bp-4h]@18 | |
728 unsigned int v22; // [sp+74h] [bp+8h]@2 | |
729 unsigned int v23; // [sp+74h] [bp+8h]@18 | |
730 | |
731 v2 = 0; | |
732 v3 = this; | |
733 if ( arg0 ) | |
734 { | |
693 | 735 v4 = pViewport->uViewportTL_X; |
736 v5 = pViewport->uViewportBR_X; | |
737 v2 = pViewport->uViewportTL_Y; | |
738 v22 = pViewport->uViewportBR_Y; | |
0 | 739 } |
740 else | |
741 { | |
742 v4 = 0; | |
743 v5 = 640; | |
744 v22 = 480; | |
745 } | |
746 v6 = this->uFrameX; | |
747 if ( (signed int)this->uFrameX >= v4 ) | |
748 { | |
749 v7 = this->uFrameWidth; | |
750 if ( (signed int)(v7 + v6) <= (signed int)v5 ) | |
751 goto LABEL_9; | |
752 v3->uFrameX = v5 - v7; | |
753 } | |
754 else | |
755 { | |
756 this->uFrameX = v4; | |
757 } | |
758 v3->uFrameY = pMouse->GetCursorPos(&a2)->y + 30; | |
759 LABEL_9: | |
760 v8 = v3->uFrameY; | |
761 if ( (signed int)v8 >= (signed int)v2 ) | |
762 { | |
763 if ( (signed int)(v8 + v3->uFrameHeight) <= (signed int)v22 ) | |
764 goto LABEL_14; | |
765 v9 = pMouse->GetCursorPos(&a2)->y - v3->uFrameHeight - 30; | |
766 } | |
767 else | |
768 { | |
769 v9 = pMouse->GetCursorPos(&a2)->y + 30; | |
770 } | |
771 v3->uFrameY = v9; | |
772 LABEL_14: | |
773 if ( (signed int)v3->uFrameY < (signed int)v2 ) | |
774 v3->uFrameY = v2; | |
775 if ( (signed int)v3->uFrameX < v4 ) | |
776 v3->uFrameX = v4; | |
777 v10 = v3->uFrameWidth; | |
778 v11 = v3->uFrameX; | |
779 v12 = v3->uFrameY; | |
780 v21 = v10; | |
781 a2.y = v11; | |
782 v3->uFrameZ = v10 + v11 - 1; | |
783 v13 = v3->uFrameHeight; | |
784 v3->uFrameW = v13 + v12 - 1; | |
785 memcpy(&v19, v3, sizeof(v19)); | |
786 v19.uFrameX += 12; | |
787 v19.uFrameWidth -= 24; | |
788 v19.uFrameY += 12; | |
789 v19.uFrameHeight -= 12; | |
790 v19.uFrameZ = v19.uFrameWidth + v19.uFrameX - 1; | |
791 v23 = v12; | |
792 v19.uFrameW = v19.uFrameHeight + v19.uFrameY - 1; | |
793 v14 = v3->Hint; | |
794 if ( v14 ) | |
795 { | |
796 v15 = pFontLucida->CalcTextHeight(v14, &v19, 0, 0); | |
797 v12 = v23; | |
798 v16 = v15 + 24; | |
799 } | |
800 else | |
801 { | |
802 v16 = v13; | |
803 } | |
804 if ( (signed int)v16 < 64 ) | |
805 v16 = 64; | |
806 if ( (signed int)(v16 + v12) > 479 ) | |
807 v16 = 479 - v12; | |
808 DrawPopupWindow(a2.y, v12, v21, v16); | |
809 v17 = v3->Hint; | |
810 if ( v17 ) | |
811 { | |
812 v18 = pFontLucida->CalcTextHeight(v17, &v19, 0, 0); | |
1004 | 813 v19.DrawTitleText(pFontLucida, 0, (signed int)(v16 - v18) / 2 - 14, 0, v17, 3); |
0 | 814 } |
815 } | |
816 | |
817 | |
818 | |
819 | |
820 //----- (00411B59) -------------------------------------------------------- | |
821 void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer) | |
822 { | |
823 unsigned int v2; // esi@1 | |
824 unsigned int v3; // edi@1 | |
825 FILE *v4; // ebx@1 | |
826 FILE *v5; // eax@2 | |
827 char pContainerName[64]; // [sp+Ch] [bp-44h]@1 | |
828 unsigned int v7; // [sp+4Ch] [bp-4h]@1 | |
829 | |
830 v2 = uSlot; | |
831 v7 = uPlayer; | |
832 v3 = uSlot + 1; | |
833 sprintf(pContainerName, "data\\lloyd%d%d.pcx", uPlayer, uSlot + 1); | |
834 v4 = fopen(pContainerName, "rb"); | |
835 if ( v4 ) | |
836 { | |
837 pSavegameThumbnails[v2].LoadFromFILE(v4, 0, 1u); | |
838 fclose(v4); | |
839 } | |
840 else | |
841 { | |
842 sprintf(pContainerName, "lloyd%d%d.pcx", v7, v3); | |
843 v5 = pNew_LOD->FindContainer(pContainerName, 1); | |
844 if ( v5 ) | |
845 pSavegameThumbnails[v2].LoadFromFILE(v5, 0, 0); | |
846 else | |
1206
ab6560001f5b
arrays to std::arrays phase 2 - some more arrays converted
Grumpy7
parents:
1205
diff
changeset
|
847 *((int *)&pSavegameThumbnails.data()->pPixels + 10 * v2) = 0; |
0 | 848 } |
849 } | |
850 | |
851 | |
852 //----- (00411621) -------------------------------------------------------- | |
198 | 853 void GUIWindow::OpenSpellBook() |
0 | 854 { |
11 | 855 Player *pPlayer; // edi@1 |
198 | 856 //GUIWindow *pWindow; // esi@1 |
857 //unsigned int v3; // ebp@1 | |
0 | 858 int v4; // eax@3 |
198 | 859 ///GUIButton *result; // eax@25 |
0 | 860 int a2; // [sp+10h] [bp-8h]@1 |
198 | 861 //int v7; // [sp+14h] [bp-4h]@1 |
0 | 862 |
11 | 863 pPlayer = pPlayers[uActiveCharacter]; |
198 | 864 //pWindow = this; |
865 LoadSpellbook(pPlayer->lastOpenedSpellbookPage); | |
866 //v3 = 0; | |
0 | 867 a2 = 0; |
198 | 868 |
869 auto chapter = &pPlayer->spellbook.pChapters[pPlayer->lastOpenedSpellbookPage]; | |
870 for (uint i = 0; i < 11; ++i) | |
0 | 871 { |
198 | 872 if (!chapter->bIsSpellAvailable[i]) |
873 continue; | |
363 | 874 v4= pPlayer->lastOpenedSpellbookPage; |
875 //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); | |
693 | 876 CreateButton(pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos, |
877 pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0 | |
1402 | 878 SBPageSSpellsTextureList[i + 1]->uTextureWidth, |
879 SBPageSSpellsTextureList[i + 1]->uTextureHeight, | |
832 | 880 1, 79, UIMSG_SelectSpell, i, 0, "", 0); |
0 | 881 ++a2; |
198 | 882 //++v3; |
0 | 883 } |
198 | 884 //while ( (signed int)v3 < 11 ); |
885 | |
1118 | 886 CreateButton(0, 0, 0, 0, 1, 0, UIMSG_SpellBook_PressTab, 0, '\t', "", 0); |
0 | 887 if ( a2 ) |
972 | 888 _41D08F_set_keyboard_control_group(a2, 0, 0, 0); |
948 | 889 |
890 if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE]) CreateButton(399, 10, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 0, 0, aSpellSchoolNames[0], 0); | |
891 if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR]) CreateButton(399, 46, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 1, 0, aSpellSchoolNames[1], 0); | |
892 if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) CreateButton(399, 83, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 2, 0, aSpellSchoolNames[2], 0); | |
893 if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH]) CreateButton(399, 121, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 3, 0, aSpellSchoolNames[3], 0); | |
894 if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT]) CreateButton(399, 158, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 4, 0, aSpellSchoolNames[4], 0); | |
895 if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) CreateButton(400, 196, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 5, 0, aSpellSchoolNames[5], 0); | |
896 if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) CreateButton(400, 234, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 6, 0, aSpellSchoolNames[6], 0); | |
897 if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0); | |
898 if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0); | |
899 | |
1402 | 900 CreateButton(476, 450, pSBClickQuickSpellBtnTextr->uTextureWidth, pSBClickQuickSpellBtnTextr->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0); |
901 pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pSBClickQuickSpellBtnTextr, 0); | |
902 CreateButton(561, 450, pSpellBookClickCloseBtnTextr->uTextureWidth, pSpellBookClickCloseBtnTextr->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); | |
903 pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pSpellBookClickCloseBtnTextr, 0); | |
0 | 904 } |
905 // 50640C: using guessed type int dword_50640C[]; | |
906 | |
907 //----- (004B3157) -------------------------------------------------------- | |
405 | 908 void GUIWindow::HouseDialogManager() |
0 | 909 { |
854 | 910 unsigned __int16 pWhiteColor; // di@2 |
911 const char *pHouseName; // edx@4 | |
0 | 912 signed int v3; // edx@5 |
913 char *v4; // edi@9 | |
854 | 914 int pTextHeight; // eax@45 |
0 | 915 int v6; // edi@45 |
916 char *v7; // eax@45 | |
917 int v8; // edi@46 | |
918 int v9; // eax@50 | |
919 unsigned int v10; // [sp-10h] [bp-C8h]@53 | |
873 | 920 char *pTitleText; // [sp-8h] [bp-C0h]@50 |
854 | 921 GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4 |
922 GUIWindow pWindow; // [sp+60h] [bp-58h]@2 | |
923 int pColor2; // [sp+B4h] [bp-4h]@2 | |
0 | 924 |
336 | 925 if ( !window_SpeakInHouse ) |
0 | 926 return; |
854 | 927 memcpy(&pWindow, this, sizeof(pWindow)); |
928 pWindow.uFrameWidth -= 18; | |
929 pWindow.uFrameZ -= 18; | |
949 | 930 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
931 pColor2 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 932 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); |
910 | 933 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); |
457 | 934 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic ) |
0 | 935 { |
854 | 936 pDialogWindow.uFrameWidth = 130; |
937 pDialogWindow.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight); | |
938 pHouseName = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName; | |
939 if ( pHouseName ) | |
0 | 940 { |
854 | 941 v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(pHouseName, &pDialogWindow, 0, 0); |
0 | 942 if ( v3 < 0 ) |
943 v3 = 0; | |
854 | 944 pWindow.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, pWhiteColor, |
0 | 945 //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C], |
336 | 946 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3); |
0 | 947 } |
948 } | |
854 | 949 pWindow.uFrameWidth += 8; |
950 pWindow.uFrameZ += 8; | |
457 | 951 if ( !pDialogueNPCCount ) |
0 | 952 { |
484 | 953 if ( in_current_building_type == BildingType_Jail ) |
0 | 954 { |
480 | 955 JailDialog(); |
854 | 956 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
957 { | |
958 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
959 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
960 } | |
961 else | |
962 { | |
963 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
964 } | |
965 return; | |
0 | 966 } |
827 | 967 if ( current_npc_text ) |
0 | 968 { |
854 | 969 pDialogWindow.uFrameWidth = 458; |
970 pDialogWindow.uFrameZ = 457; | |
971 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &pDialogWindow, 13, 0); | |
972 v6 = pTextHeight + 7; | |
973 pRenderer->_4A6A68(8, 352 - (pTextHeight + 7), &pIcons_LOD->pTextures[uTextureID_Leather], | |
974 pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (pTextHeight + 7)); | |
975 pRenderer->DrawTextureIndexed(8, 347 - v6, pTexture_591428); | |
976 v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0); | |
336 | 977 window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); |
0 | 978 } |
979 if ( uNumDialogueNPCPortraits <= 0 ) | |
854 | 980 { |
981 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
982 { | |
983 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
984 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
985 } | |
986 else | |
987 { | |
988 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
989 } | |
990 return; | |
991 } | |
873 | 992 for ( v8 = 0; v8 < uNumDialogueNPCPortraits; ++v8 ) |
0 | 993 { |
419 | 994 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4, |
874 | 995 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); |
419 | 996 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8], |
997 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8], pDialogueNPCPortraits[v8]); | |
0 | 998 if ( uNumDialogueNPCPortraits < 4 ) |
854 | 999 { |
873 | 1000 if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
854 | 1001 { |
873 | 1002 pTitleText = pMapStats->pInfos[uHouse_ExitPic].pName; |
1003 v9 = 94 * v8 + 113; | |
854 | 1004 } |
1005 else | |
1006 { | |
873 | 1007 if ( !v8 && dword_591080 ) |
1008 { | |
1009 pTitleText = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle; | |
1010 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, pTitleText, 3); | |
1011 continue; | |
1012 } | |
1211 | 1013 pTitleText = HouseNPCData[v8 +1 - (dword_591080 != 0)]->pName; |
1014 v9 = pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2; | |
854 | 1015 } |
873 | 1016 v10 = v9; |
1211 | 1017 pWindow.DrawTitleText(pFontCreate, 483, v10, pColor2, pTitleText, 3); |
854 | 1018 } |
874 | 1019 } |
873 | 1020 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 1021 { |
873 | 1022 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); |
1023 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
0 | 1024 } |
873 | 1025 else |
1026 { | |
1027 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
1028 } | |
1029 return; | |
0 | 1030 } |
457 | 1031 v4 = (char *)pDialogueNPCCount - 1; |
419 | 1032 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); |
1033 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); | |
151 | 1034 if ( pCurrentScreen == SCREEN_E ) |
0 | 1035 { |
984 | 1036 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
854 | 1037 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
1038 { | |
1039 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
1040 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
1041 } | |
1042 else | |
1043 { | |
1044 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
1045 } | |
1046 return; | |
0 | 1047 } |
1048 if ( v4 || !dword_591080 ) | |
1049 { | |
445 | 1050 SimpleHouseAndBoatsDialog(); |
0 | 1051 } |
1052 else | |
1053 { | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1054 sprintfex( pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], |
336 | 1055 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName, |
1056 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1057 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf.data(), 3); |
484 | 1058 switch ( in_current_building_type ) |
0 | 1059 { |
480 | 1060 case BildingType_WeaponShop: |
405 | 1061 WeaponShopDialog(); |
0 | 1062 break; |
480 | 1063 case BildingType_ArmorShop: |
405 | 1064 ArmorShopDialog(); |
0 | 1065 break; |
480 | 1066 case BildingType_MagicShop: |
405 | 1067 MagicShopDialog(); |
0 | 1068 break; |
480 | 1069 case BildingType_AlchemistShop: |
405 | 1070 AlchemistDialog(); |
0 | 1071 break; |
480 | 1072 case BildingType_FireGuild: |
1073 case BildingType_AirGuild: | |
1074 case BildingType_WaterGuild: | |
1075 case BildingType_EarthGuild: | |
1076 case BildingType_SpiritGuild: | |
1077 case BildingType_MindGuild: | |
1078 case BildingType_BodyGuild: | |
1079 case BildingType_LightGuild: | |
495 | 1080 case BildingType_DarkGuild: |
480 | 1081 GuildDialog(); |
1082 break; | |
1083 case BildingType_18: | |
987 | 1084 __debugbreak(); //What over the dialog? |
480 | 1085 sub_4B6478(); |
1086 break; | |
1087 case BildingType_TownHall: | |
1088 TownHallDialog(); | |
1089 break; | |
1090 case BildingType_Tavern: | |
1091 TavernDialog(); | |
1092 break; | |
1093 case BildingType_Bank: | |
1094 BankDialog(); | |
1095 break; | |
481 | 1096 case BildingType_Temple: |
495 | 1097 TempleDialog(); |
480 | 1098 break; |
1099 case BildingType_Stables: | |
1100 TravelByTransport(); | |
1101 break; | |
1102 case BildingType_Training: | |
1103 TrainingDialog(); | |
1104 break; | |
1105 case BildingType_Jail: | |
1106 JailDialog(); | |
1107 break; | |
0 | 1108 default: |
987 | 1109 __debugbreak();//New BildingType |
0 | 1110 break; |
1111 } | |
1112 } | |
457 | 1113 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 1114 { |
370 | 1115 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); |
1116 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
0 | 1117 } |
1118 else | |
1119 { | |
526 | 1120 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); |
0 | 1121 } |
1122 } | |
1123 | |
1124 //----- (004B1854) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1125 void GUIWindow::DrawCurrentTime( __int64 a2 ) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1126 { |
0 | 1127 unsigned int v2; // edi@1 |
1128 unsigned int v3; // esi@1 | |
1129 unsigned int v4; // ebp@1 | |
1130 unsigned int v5; // ebx@1 | |
1131 signed __int64 v6; // ST2C_8@1 | |
1132 signed __int64 v7; // kr00_8@1 | |
1133 char *v8; // eax@2 | |
1134 char *v9; // eax@7 | |
1135 char *v10; // eax@13 | |
1136 char *v11; // eax@19 | |
1137 unsigned __int16 v12; // ST0C_2@22 | |
1138 int v13; // eax@22 | |
1139 GUIWindow *v15; // [sp+0h] [bp-1Ch]@1 | |
1140 signed __int64 v16; // [sp+Ch] [bp-10h]@1 | |
1141 signed __int64 v17; // [sp+14h] [bp-8h]@1 | |
1142 unsigned int v18; // [sp+20h] [bp+4h]@1 | |
1143 | |
1144 v15 = this; | |
1145 v2 = (unsigned __int64)(signed __int64)((double)a2 * 0.234375) >> 32; | |
1146 v3 = (signed __int64)((double)a2 * 0.234375); | |
1147 v4 = (unsigned __int64)((signed __int64)((double)a2 * 0.234375) / 60) >> 32; | |
1148 v5 = (signed __int64)((double)a2 * 0.234375) / 60; | |
1149 v6 = (signed __int64)((double)a2 * 0.234375) / 60 / 60; | |
1150 v18 = (unsigned int)v6 / 0x18; | |
1151 v17 = (signed __int64)__PAIR__(v2, v3) % 60; | |
1152 v16 = (signed __int64)__PAIR__(v4, v5) % 60; | |
1153 v7 = v6 % 24; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1154 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[532]); |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1155 if ( (unsigned int)v6 /24 ) |
0 | 1156 { |
1157 v8 = pGlobalTXT_LocalizationStrings[57]; | |
1158 if ( v18 <= 1 ) | |
1159 v8 = pGlobalTXT_LocalizationStrings[56]; | |
1394 | 1160 sprintfex(pTmpBuf2.data(), "%d %s ", v18, v8); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1161 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
0 | 1162 } |
1163 if ( v7 ) | |
1164 { | |
1165 if ( v7 <= 1 ) | |
1166 v9 = pGlobalTXT_LocalizationStrings[109]; | |
1167 else | |
1168 v9 = pGlobalTXT_LocalizationStrings[110]; | |
1394 | 1169 sprintfex(pTmpBuf2.data(), "%d %s ", v7, v9); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1170 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
0 | 1171 } |
1172 if ( v16 && !v18 ) | |
1173 { | |
1174 if ( v16 <= 1 ) | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1175 v10 = pGlobalTXT_LocalizationStrings[437];//"Minute" |
0 | 1176 else |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1177 v10 = pGlobalTXT_LocalizationStrings[436]; //"Minutes" |
1394 | 1178 sprintfex(pTmpBuf2.data(), "%d %s ", v16, v10); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1179 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
0 | 1180 } |
1181 if ( v17 && !v7 ) | |
1182 { | |
1183 if ( v17 <= 1 ) | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1184 v11 = pGlobalTXT_LocalizationStrings[439]; //"Second" |
0 | 1185 else |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1186 v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds" |
1394 | 1187 sprintfex(pTmpBuf2.data(), "%d %s ", v17, v11); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1188 strcat(pTmpBuf.data(), pTmpBuf2.data()); |
0 | 1189 } |
949 | 1190 v12 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1191 v13 = pFontArrus->CalcTextHeight(pTmpBuf.data(), v15, 0, 0); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1192 v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf.data(), 3u); |
0 | 1193 } |
1194 | |
1195 | |
1196 | |
1197 //----- (0044D406) -------------------------------------------------------- | |
1268 | 1198 void GUIWindow::DrawTitleText( GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, |
1199 const char *pInString, unsigned int uLineSpacing ) | |
762 | 1200 { |
0 | 1201 GUIWindow *pWindow; // esi@1 |
1202 unsigned int v8; // ebx@1 | |
1203 char *v9; // eax@1 | |
1204 unsigned int v11; // edi@1 | |
1205 signed int v12; // esi@1 | |
1206 int v13; // eax@2 | |
1207 GUIFont *pFont; // [sp+Ch] [bp-4h]@1 | |
1208 const char *Stra; // [sp+24h] [bp+14h]@5 | |
1209 | |
1210 pWindow = this; | |
1211 pFont = a2; | |
1212 v8 = this->uFrameWidth - uHorizontalMargin; | |
1213 ui_current_text_color = uDefaultColor; | |
1214 v9 = FitTextInAWindow(pInString, a2, this, uHorizontalMargin, 0); | |
762 | 1215 Stra = strtok(v9, "\n"); |
0 | 1216 v11 = uHorizontalMargin + pWindow->uFrameX; |
1217 v12 = uVerticalMargin + pWindow->uFrameY; | |
1218 while ( 1 ) | |
1219 { | |
762 | 1220 if ( !Stra ) |
0 | 1221 break; |
762 | 1222 v13 = (signed int)(v8 - pFont->GetLineWidth(Stra)) >> 1; |
0 | 1223 if ( v13 < 0 ) |
1224 v13 = 0; | |
1225 pFont->DrawTextLine(uDefaultColor, v11 + v13, v12, Stra, 640); | |
49 | 1226 v12 += pFont->uFontHeight - uLineSpacing; |
762 | 1227 Stra = strtok(0, "\n"); |
0 | 1228 } |
1229 } | |
1230 // 5C6DB4: using guessed type int ui_current_text_color; | |
1231 | |
1232 | |
1233 | |
1234 //----- (0044CE08) -------------------------------------------------------- | |
1006 | 1235 void GUIWindow::DrawText( GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor ) |
1236 { | |
0 | 1237 GUIWindow *v9; // edi@1 |
1238 GUIFont *v10; // ebx@1 | |
1239 int v11; // eax@2 | |
1240 signed int v12; // esi@9 | |
1241 signed int v13; // edi@9 | |
1242 int v14; // edx@9 | |
1243 int v15; // eax@25 | |
1244 unsigned int v16; // ecx@25 | |
1245 int v17; // eax@27 | |
1246 int v18; // edi@32 | |
1247 int v19; // esi@38 | |
1248 std::string v21; // [sp-18h] [bp-50h]@2 | |
1249 const char *v22; // [sp-8h] [bp-40h]@2 | |
1250 int v23; // [sp-4h] [bp-3Ch]@2 | |
1251 char Dest[6]; // [sp+Ch] [bp-2Ch]@32 | |
1252 //char v25; // [sp+Fh] [bp-29h]@32 | |
1253 //char v26; // [sp+11h] [bp-27h]@34 | |
1254 const char *v27; // [sp+20h] [bp-18h]@25 | |
1255 int v28; // [sp+24h] [bp-14h]@25 | |
1256 int v29; // [sp+28h] [bp-10h]@1 | |
1257 size_t v30; // [sp+2Ch] [bp-Ch]@4 | |
1258 GUIWindow *v31; // [sp+30h] [bp-8h]@1 | |
1259 const char *v32; // [sp+34h] [bp-4h]@7 | |
1260 size_t pInString; // [sp+4Ch] [bp+14h]@11 | |
1261 | |
1262 auto a1 = this; | |
1263 v29 = 0; | |
1264 v9 = a1; | |
1265 v10 = a2; | |
1266 v31 = a1; | |
1267 if ( !Str ) | |
1268 { | |
1269 MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0); | |
1006 | 1270 return; |
0 | 1271 } |
1272 v11 = strcmp(Str, "null"); | |
1273 if ( v11 ) | |
1274 { | |
1275 v30 = strlen(Str); | |
1276 LOBYTE(v11) = 0; | |
1277 if ( !uX ) | |
1278 uX = 12; | |
1279 if ( a8 ) | |
1280 { | |
1281 v32 = Str; | |
1282 } | |
1283 else | |
1284 { | |
1285 v11 = (int)FitTextInAWindow(Str, v10, v9, uX, 0); | |
1286 v32 = (const char *)v11; | |
1287 } | |
1288 v12 = uX + v9->uFrameX; | |
1289 v13 = uY + v9->uFrameY; | |
1290 v14 = 0; | |
1291 if ( !a8 || (v11 = v13 + LOBYTE(v10->uFontHeight), v11 <= a8) ) | |
1292 { | |
1293 pInString = 0; | |
1294 if ( (signed int)v30 > 0 ) | |
1295 { | |
1296 do | |
1297 { | |
1298 LOBYTE(v11) = v32[v14]; | |
1299 if ( (unsigned __int8)v11 >= v10->cFirstChar && (unsigned __int8)v11 <= v10->cLastChar | |
1300 || (char)v11 == 12 | |
1301 || (char)v11 == 13 | |
1302 || (char)v11 == 9 | |
1303 || (char)v11 == 10 ) | |
1304 { | |
1305 switch ( (unsigned __int8)v11 ) | |
1306 { | |
1307 case 9u: | |
1308 strncpy(Dest, &v32[v14 + 1], 3u); | |
1309 Dest[3] = 0; | |
1310 pInString += 3; | |
1311 v29 = atoi(Dest); | |
1312 v19 = atoi(Dest); | |
1313 LOBYTE(v11) = (char)v31; | |
1314 v12 = uX + v31->uFrameX + v19; | |
1315 break; | |
1316 case 0xAu: | |
1317 v11 = LOBYTE(v10->uFontHeight); | |
1318 uY = uY + v11 - 3; | |
1319 v13 = uY + v31->uFrameY; | |
1320 v12 = uX + v29 + v31->uFrameX; | |
1321 if ( a8 ) | |
1322 goto LABEL_36; | |
1323 break; | |
1324 case 0xCu: | |
1325 strncpy(Dest, &v32[v14 + 1], 5u); | |
1326 Dest[5] = 0; | |
1327 v11 = atoi(Dest); | |
1328 pInString += 5; | |
1329 uFontColor = v11; | |
1330 break; | |
1331 case 0xDu: | |
1332 strncpy(Dest, &v32[v14 + 1], 3u); | |
1333 Dest[3] = 0; | |
1334 pInString += 3; | |
1335 v18 = atoi(Dest); | |
1336 v11 = v10->GetLineWidth(&v32[pInString]); | |
1337 v12 = v31->uFrameZ - v11 - v18; | |
1338 v13 = uY + v31->uFrameY; | |
1339 if ( a8 ) | |
1340 { | |
1341 v11 = LOBYTE(v10->uFontHeight); | |
1342 LABEL_36: | |
1343 v11 = v11 + v13 - 3; | |
1344 if ( v11 > a8 ) | |
1006 | 1345 return; |
0 | 1346 break; |
1347 } | |
1348 break; | |
1349 default: | |
1350 if ( (char)v11 == 34 && v32[v14 + 1] == 34 ) | |
1351 { | |
1352 ++v14; | |
1353 pInString = v14; | |
1354 } | |
1355 v27 = &v32[v14]; | |
1356 v15 = (unsigned __int8)v32[v14]; | |
1357 v16 = *((int *)&v10->cFirstChar + 3 * v15 + 9); | |
1358 v28 = *((int *)&v10->cFirstChar + 3 * v15 + 9); | |
1359 if ( v14 > 0 ) | |
1360 v12 += v10->pMetrics[v15].uLeftSpacing; | |
1160 | 1361 v17 = (int)((char *)&v10[1] + v10->font_pixels_offset[v15]); |
0 | 1362 if ( (short)uFontColor ) |
1363 pRenderer->DrawText( | |
1364 v12, | |
1365 v13, | |
1366 (unsigned __int8 *)v17, | |
1367 v16, | |
1368 LOBYTE(v10->uFontHeight), | |
1369 v10->pFontPalettes[0], | |
1370 uFontColor, | |
1371 uFontShadowColor); | |
1372 else | |
1373 pRenderer->DrawTextPalette( | |
1374 v12, | |
1375 v13, | |
1268 | 1376 (unsigned char*)v17, |
0 | 1377 v16, |
1378 LOBYTE(v10->uFontHeight), | |
1379 v10->pFontPalettes[0], | |
1380 a7); | |
1381 LOBYTE(v11) = v30; | |
1382 v12 += v28; | |
1383 if ( (signed int)pInString < (signed int)v30 ) | |
1384 { | |
1385 LOBYTE(v11) = 3 * *v27; | |
1386 v12 += v10->pMetrics[(unsigned __int8)*v27].uRightSpacing; | |
1387 } | |
1388 break; | |
1389 } | |
1390 } | |
1391 v14 = pInString++ + 1; | |
1392 } | |
1393 while ( (signed int)pInString < (signed int)v30 ); | |
1394 } | |
1395 } | |
1396 } | |
1006 | 1397 return; |
0 | 1398 } |
1399 | |
1400 | |
1401 //----- (0044CB4F) -------------------------------------------------------- | |
1268 | 1402 int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text ) |
1403 { | |
1404 | |
24 | 1405 int pLineWidth; // ebx@1 |
1268 | 1406 int text_width; // esi@3 |
0 | 1407 unsigned __int8 v12; // cl@7 |
1408 signed int v13; // esi@19 | |
1409 signed int v14; // ebx@19 | |
1410 unsigned __int8 v15; // cl@21 | |
1411 int v16; // eax@22 | |
1412 int v17; // ecx@22 | |
1413 int v18; // ecx@23 | |
1414 int v19; // ecx@24 | |
1415 unsigned int v20; // ecx@26 | |
1268 | 1416 unsigned char* v21; // eax@28 |
0 | 1417 int v22; // ebx@34 |
1418 int v23; // eax@34 | |
1419 int v24; // ebx@36 | |
1268 | 1420 char Str[6]; // [sp+Ch] [bp-20h]@34 |
0 | 1421 char v26; // [sp+Fh] [bp-1Dh]@34 |
1422 char v27; // [sp+11h] [bp-1Bh]@35 | |
1423 int v28; // [sp+20h] [bp-Ch]@17 | |
1424 GUIWindow *pWindow; // [sp+24h] [bp-8h]@1 | |
24 | 1425 size_t pNumLen; // [sp+28h] [bp-4h]@1 |
0 | 1426 size_t Str1a; // [sp+40h] [bp+14h]@5 |
1427 size_t Str1b; // [sp+40h] [bp+14h]@19 | |
1428 const char *Sourcea; // [sp+44h] [bp+18h]@20 | |
1429 int v34; // [sp+48h] [bp+1Ch]@26 | |
1268 | 1430 int i; |
0 | 1431 |
1268 | 1432 |
0 | 1433 pWindow = this; |
1268 | 1434 pNumLen = strlen(text); |
1435 pLineWidth = pFont->GetLineWidth(text); | |
1436 if ( pLineWidth < rect_width ) | |
0 | 1437 { |
1268 | 1438 pWindow->DrawText(pFont, uX, uY, uColor, text, 0, 0, 0); |
24 | 1439 return pLineWidth; |
0 | 1440 } |
1268 | 1441 strcpy(pTmpBuf2.data(), text); |
1442 text_width = 0; | |
1443 if ( reverse_text ) | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1444 _strrev(pTmpBuf2.data()); |
0 | 1445 Str1a = 0; |
1268 | 1446 for (i=0; i<pNumLen; ++i) |
0 | 1447 { |
1268 | 1448 if ( text_width >= rect_width ) |
0 | 1449 break; |
1268 | 1450 v12 = pTmpBuf2[i]; |
1451 if ( pFont->IsCharValid(v12) ) | |
0 | 1452 { |
1268 | 1453 switch (v12) |
0 | 1454 { |
1268 | 1455 case '\t':// Horizontal tab 09 |
1456 case '\n': //Line Feed 0A 10 | |
1457 case '\r': //Form Feed, page eject 0C 12 | |
1458 break; | |
1459 case '\f': //Carriage Return 0D 13 | |
1460 i += 5; | |
1461 break; | |
1462 default: | |
1463 if ( i > 0 ) | |
1464 text_width += pFont->pMetrics[v12].uLeftSpacing; | |
1465 text_width += pFont->pMetrics[v12].uWidth; | |
1466 if ( i < pNumLen ) | |
1467 text_width += pFont->pMetrics[v12].uRightSpacing; | |
1468 } | |
0 | 1469 } |
1470 } | |
1268 | 1471 pTmpBuf2[i - 1] = 0; |
1472 | |
1473 | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1474 pNumLen = strlen(pTmpBuf2.data()); |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1475 v28 = pFont->GetLineWidth(pTmpBuf2.data()); |
1268 | 1476 if ( reverse_text ) |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1477 _strrev(pTmpBuf2.data()); |
1268 | 1478 |
0 | 1479 v13 = uX + pWindow->uFrameX; |
1480 v14 = uY + pWindow->uFrameY; | |
1268 | 1481 for (i=0; i<pNumLen; ++i) |
0 | 1482 { |
1268 | 1483 v15 = pTmpBuf2[i]; |
1484 if ( pFont->IsCharValid(v15) ) | |
0 | 1485 { |
1268 | 1486 switch (v12) |
1487 { | |
1488 case '\t':// Horizontal tab 09 | |
1489 { | |
1490 strncpy(Str, &pTmpBuf2[i+1], 3); | |
1491 Str[3] = 0; | |
1492 // atoi(Str); | |
1493 i += 3; | |
1494 break; | |
1495 } | |
1496 case '\n': //Line Feed 0A 10 | |
1497 { | |
1498 v24 = pFont->uFontHeight; | |
1499 v13 = uX; | |
1500 uY = uY + pFont->uFontHeight - 3; | |
1501 v14 = uY+pFont->uFontHeight - 3; | |
1502 break; | |
1503 } | |
1504 case '\r': //Form Feed, page eject 0C 12 | |
0 | 1505 { |
1268 | 1506 strncpy(Str, &pTmpBuf2[i+1], 5); |
1507 Str[5] = 0; | |
1508 i += 5; | |
1509 uColor = atoi(Str); | |
1510 break; | |
1511 } | |
1512 case '\f': //Carriage Return 0D 13 | |
1513 { | |
1514 strncpy(Str, &pTmpBuf2[i+1], 3); | |
1515 Str[3] = 0; | |
1516 i += 3; | |
1517 v23 = pFont->GetLineWidth(&pTmpBuf2[i]); | |
1518 v13 = pWindow->uFrameZ - v23 - atoi(Str); | |
1519 v14 = uY; | |
1520 break; | |
0 | 1521 } |
1268 | 1522 default: |
1523 v20 = pFont->pMetrics[v15].uWidth; | |
1524 if ( i > 0 ) | |
1525 v13 += pFont->pMetrics[v15].uLeftSpacing; | |
1526 v21 = &pFont->pFontData[pFont->font_pixels_offset[v15]]; | |
1527 if ( uColor ) | |
1528 pRenderer->DrawText(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], uColor, 0); | |
1529 else | |
1530 pRenderer->DrawTextPalette(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], 0); | |
1531 v13 += v20; | |
1532 if ( i < (signed int)pNumLen ) | |
1533 v13 += pFont->pMetrics[v15].uRightSpacing; | |
1534 } | |
0 | 1535 } |
1268 | 1536 |
1537 | |
0 | 1538 } |
1539 return v28; | |
1540 } | |
1541 | |
1542 //----- (0041D12F) -------------------------------------------------------- | |
189 | 1543 GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, |
832 | 1544 int a6, int a7, UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...) |
0 | 1545 { |
17 | 1546 GUIButton *pButton; // esi@1 |
0 | 1547 unsigned int v13; // eax@1 |
1548 unsigned int v14; // ebx@4 | |
1549 unsigned int v15; // eax@4 | |
189 | 1550 unsigned int TextureNum=0; // ebx@4 |
0 | 1551 unsigned int v17; // eax@4 |
1552 Texture *v18; // eax@4 | |
1553 Texture **v19; // ecx@5 | |
1554 Texture **v20; // edx@5 | |
1555 GUIButton *v21; // eax@7 | |
189 | 1556 va_list texturs_ptr; |
0 | 1557 |
17 | 1558 pButton = (GUIButton *)pAllocator->AllocNamedChunk(0, 0xBCu, "BUTTON"); |
1559 pButton->pParent = this; | |
1268 | 1560 pButton->uWidth = uWidth; |
17 | 1561 pButton->uHeight = uHeight; |
1268 | 1562 |
0 | 1563 if ( a6 == 2 && !uHeight ) |
17 | 1564 pButton->uHeight = uWidth; |
1268 | 1565 |
17 | 1566 pButton->uButtonType = a6; |
1268 | 1567 pButton->uX = uX + this->uFrameX; |
1568 pButton->uY = uY + this->uFrameY; | |
1569 pButton->uZ = pButton->uX + uWidth - 1; | |
1570 pButton->uW = pButton->uY + uHeight - 1; | |
271 | 1571 pButton->field_2C_is_pushed = 0; |
17 | 1572 pButton->field_1C = a7; |
832 | 1573 pButton->msg = msg; |
1574 pButton->msg_param = msg_param; | |
17 | 1575 pButton->uHotkey = uHotkey; |
1268 | 1576 //strlen(pName); |
17 | 1577 strcpy(pButton->pButtonName, pName); |
189 | 1578 va_start(texturs_ptr, pName); |
1579 while (NULL!=(pTextures=va_arg(texturs_ptr, Texture *))) | |
0 | 1580 { |
189 | 1581 pButton->pTextures[TextureNum]=pTextures; |
1582 ++TextureNum; | |
0 | 1583 } |
189 | 1584 va_end(texturs_ptr); |
1585 pButton->uNumTextures = TextureNum; | |
1586 if ( this->pControlsTail ) | |
1587 this->pControlsTail->pNext = pButton; | |
0 | 1588 else |
17 | 1589 this->pControlsHead = pButton; |
1590 pButton->pPrev = this->pControlsTail; | |
1591 this->pControlsTail = pButton; | |
1592 pButton->pNext = 0; | |
0 | 1593 ++this->uNumControls; |
17 | 1594 return pButton; |
0 | 1595 } |
1596 | |
1597 //----- (00459C2B) -------------------------------------------------------- | |
1268 | 1598 void GUIWindow::DrawFlashingInputCursor( signed int uX, int uY, struct GUIFont *a2 ) |
1599 { | |
0 | 1600 if ( GetTickCount() % 1000 > 500 ) |
1268 | 1601 DrawText(a2, uX, uY, 0, "_", 0, 0, 0); |
0 | 1602 } |
1603 | |
1604 //----- (0041C432) -------------------------------------------------------- | |
1268 | 1605 GUIWindow * GUIWindow::Create( unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eWindowType, int pButton, const char* hint ) |
1606 { | |
0 | 1607 unsigned int uNextFreeWindowID; // ebp@1 |
1608 //int *v8; // eax@1 | |
1609 //GUIWindow *pWindow; // esi@4 | |
962 | 1610 //int v10; // eax@4 |
0 | 1611 unsigned int v11; // ebx@15 |
423 | 1612 NPCData *speakingNPC; // ebp@15 |
1613 int v14; // eax@20 | |
1614 int v16; // eax@25 | |
1615 int v18; // eax@30 | |
1616 int v20; // eax@35 | |
1617 int v22; // eax@40 | |
1618 int v24; // eax@45 | |
0 | 1619 int v25; // eax@65 |
1620 unsigned int v26; // ebx@65 | |
1621 char *v27; // eax@71 | |
1622 const char *v29; // [sp-8h] [bp-18h]@68 | |
1623 char *v30; // [sp-4h] [bp-14h]@68 | |
1624 int uWidtha; // [sp+14h] [bp+4h]@66 | |
423 | 1625 int num_menu_buttons; // [sp+20h] [bp+10h]@15 |
0 | 1626 |
1627 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) | |
1628 { | |
1629 if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null) | |
1630 break; | |
1631 } | |
1632 | |
1633 auto pWindow = &pWindowList[uNextFreeWindowID]; | |
1634 pWindow->uFrameWidth = uWidth; | |
1268 | 1635 pWindow->uFrameHeight = uHeight; |
1636 | |
1637 pWindow->uFrameX = uX; | |
1638 pWindow->uFrameY = uY; | |
0 | 1639 pWindow->uFrameZ = uX + uWidth - 1; |
1640 pWindow->uFrameW = uY + uHeight - 1; | |
1268 | 1641 |
11 | 1642 pWindow->ptr_1C = (void *)pButton; |
1268 | 1643 pWindow->Hint = hint; |
1644 | |
0 | 1645 pWindow->eWindowType = eWindowType; |
972 | 1646 pWindow->receives_keyboard_input = false; |
496 | 1647 ++uNumVisibleWindows; |
1648 pWindow->numVisibleWindows = uNumVisibleWindows; | |
1649 pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1; | |
0 | 1650 if ( (signed int)eWindowType <= 20 ) |
1651 { | |
1652 if (eWindowType != WINDOW_Chest) | |
1653 { | |
1654 switch (eWindowType) | |
1655 { | |
1268 | 1656 case WINDOW_Book: { |
0 | 1657 pWindow->InitializeBookView(); |
1658 break; | |
1268 | 1659 } |
1660 case WINDOW_Dialogue: { | |
11 | 1661 pMainScreenNum = pCurrentScreen; |
151 | 1662 pCurrentScreen = SCREEN_NPC_DIALOGUE; |
832 | 1663 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" |
735 | 1664 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
496 | 1665 if ( pWindow->par1C != 1 ) |
0 | 1666 { |
423 | 1667 num_menu_buttons = 0; |
0 | 1668 v11 = LOBYTE(pFontArrus->uFontHeight) - 3; |
602 | 1669 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
827 | 1670 if ( GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1 )//QuestsNPC_greet |
0 | 1671 { |
423 | 1672 if ( speakingNPC->joins ) |
0 | 1673 { |
832 | 1674 pWindow->CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0); |
423 | 1675 num_menu_buttons = 1; |
0 | 1676 } |
423 | 1677 if ( speakingNPC->evt_A ) |
0 | 1678 { |
423 | 1679 if ( num_menu_buttons < 4 ) |
0 | 1680 { |
423 | 1681 v14 = NPC_EventProcessor(speakingNPC->evt_A); |
0 | 1682 if ( v14 == 1 || v14 == 2 ) |
832 | 1683 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0); |
0 | 1684 } |
1685 } | |
423 | 1686 if ( speakingNPC->evt_B ) |
0 | 1687 { |
423 | 1688 if ( num_menu_buttons < 4 ) |
0 | 1689 { |
423 | 1690 v16 = NPC_EventProcessor(speakingNPC->evt_B); |
0 | 1691 if ( v16 == 1 || v16 == 2 ) |
832 | 1692 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0); |
0 | 1693 } |
1694 } | |
423 | 1695 if ( speakingNPC->evt_C ) |
0 | 1696 { |
423 | 1697 if ( num_menu_buttons < 4 ) |
0 | 1698 { |
423 | 1699 v18 = NPC_EventProcessor(speakingNPC->evt_C); |
0 | 1700 if ( v18 == 1 || v18 == 2 ) |
832 | 1701 pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0); |
0 | 1702 } |
1703 } | |
423 | 1704 if ( speakingNPC->evt_D ) |
0 | 1705 { |
423 | 1706 if ( num_menu_buttons < 4 ) |
0 | 1707 { |
423 | 1708 v20 = NPC_EventProcessor(speakingNPC->evt_D); |
0 | 1709 if ( v20 == 1 || v20 == 2 ) |
832 | 1710 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0); |
0 | 1711 } |
1712 } | |
423 | 1713 if ( speakingNPC->evt_E ) |
0 | 1714 { |
423 | 1715 if ( num_menu_buttons < 4 ) |
0 | 1716 { |
423 | 1717 v22 = NPC_EventProcessor(speakingNPC->evt_E); |
0 | 1718 if ( v22 == 1 || v22 == 2 ) |
832 | 1719 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0); |
0 | 1720 } |
1721 } | |
423 | 1722 if (speakingNPC->evt_F ) |
0 | 1723 { |
423 | 1724 if ( num_menu_buttons < 4 ) |
0 | 1725 { |
423 | 1726 v24 = NPC_EventProcessor(speakingNPC->evt_F); |
0 | 1727 if ( v24 == 1 || v24 == 2 ) |
832 | 1728 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0); |
0 | 1729 } |
1730 } | |
1731 } | |
1732 else | |
1733 { | |
423 | 1734 if ( speakingNPC->joins ) |
0 | 1735 { |
832 | 1736 pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Ïîäðîáíåå |
423 | 1737 if (speakingNPC->Hired()) |
0 | 1738 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1739 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Îòïóñòèòü |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1740 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0); |
0 | 1741 } |
1742 else | |
1743 { | |
832 | 1744 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Íàíÿòü |
0 | 1745 } |
423 | 1746 num_menu_buttons = 2; |
0 | 1747 } |
1748 } | |
972 | 1749 pWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); |
0 | 1750 } |
1751 break; | |
1268 | 1752 } |
1753 case WINDOW_ChangeLocation: { | |
11 | 1754 pMainScreenNum = pCurrentScreen; |
151 | 1755 pCurrentScreen = SCREEN_CHANGE_LOCATION; |
987 | 1756 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 | 1757 pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
1758 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0); | |
1759 pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0); | |
0 | 1760 break; |
1268 | 1761 } |
1762 case WINDOW_SpellBook: {// îêíî êíèãè çàêëîâ | |
0 | 1763 InitializeBookTextures(); |
11 | 1764 pWindow->OpenSpellBook(); |
0 | 1765 break; |
1268 | 1766 } |
1767 case WINDOW_GreetingNPC: {// îêíî ïðèâåòñòâèÿ ÍÏÑ | |
11 | 1768 pMainScreenNum = pCurrentScreen; |
3 | 1769 pKeyActionMap->EnterText(0, 15, pWindow); |
151 | 1770 pCurrentScreen = SCREEN_BRANCHLESS_NPC_DIALOG; |
0 | 1771 break; |
1268 | 1772 } |
1773 | |
0 | 1774 } |
1775 return pWindow; | |
1776 } | |
11 | 1777 //LABEL_62: |
948 | 1778 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, '1', "", 0); |
1779 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, '2', "", 0); | |
1780 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, '3', "", 0); | |
1781 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, '4', "", 0); | |
832 | 1782 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0); |
0 | 1783 return pWindow; |
1784 } | |
1785 if (eWindowType == WINDOW_HouseInterior) | |
1786 { | |
151 | 1787 pCurrentScreen = SCREEN_HOUSE; |
1211 | 1788 pBtn_ExitCancel = pWindow->CreateButton(471, 445, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Âûéòè èç çäàíèÿ |
735 | 1789 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
1211 | 1790 |
873 | 1791 for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 ) |
0 | 1792 { |
1211 | 1793 if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 1794 { |
1795 v30 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
874 | 1796 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S]; |
0 | 1797 } |
1798 else | |
1799 { | |
1800 if ( v26 || !dword_591080 ) | |
1313 | 1801 v27 = HouseNPCData[v26 +1 - ((dword_591080 != 0)? 1:0)]->pName; |
0 | 1802 else |
1268 | 1803 v27 = (char*)p2DEvents[pButton - 1].pProprieterName; |
0 | 1804 v30 = v27; |
874 | 1805 v29 = (char*)pGlobalTXT_LocalizationStrings[435]; |
0 | 1806 } |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1807 sprintfex(byte_591180[v26].data(), v29, v30); |
1211 | 1808 dword_5913F4[v26] = pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], |
419 | 1809 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26], |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1810 0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0); |
0 | 1811 } |
1211 | 1812 |
1813 if ( uNumDialogueNPCPortraits == 1 ) | |
0 | 1814 { |
336 | 1815 window_SpeakInHouse = &pWindowList[uNextFreeWindowID]; |
0 | 1816 _4B4224_UpdateNPCTopics(0); |
1817 } | |
1818 } | |
1819 else | |
1820 { | |
158 | 1821 if (eWindowType == WINDOW_Transition) |
0 | 1822 { |
11 | 1823 pMainScreenNum = pCurrentScreen; |
151 | 1824 pCurrentScreen = SCREEN_INPUT_BLV; |
960 | 1825 pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Îòìåíà |
948 | 1826 pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
1827 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0); | |
1828 pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0); | |
0 | 1829 return pWindow; |
1830 } | |
961 | 1831 if (eWindowType == WINDOW_CastSpell) |
0 | 1832 { |
1833 pEventTimer->Pause(); | |
1834 pAudioPlayer->StopChannels(-1, -1); | |
1835 pMouse->SetCursorBitmap("MICON2"); | |
11 | 1836 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u);//Âûáåðèòå öåëü |
0 | 1837 return pWindow; |
1838 } | |
158 | 1839 if (eWindowType == WINDOW_Scroll) |
11 | 1840 { |
948 | 1841 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, '1', "", 0); |
1842 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, '2', "", 0); | |
1843 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, '3', "", 0); | |
1844 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, '4', "", 0); | |
1845 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
11 | 1846 return pWindow; |
1847 } | |
898 | 1848 if (eWindowType == WINDOW_CastSpell_InInventory) |
0 | 1849 { |
1850 pMouse->SetCursorBitmap("MICON2"); | |
832 | 1851 pBtn_ExitCancel = pWindow->CreateButton(0x188u, 0x13Eu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Îòìåíà |
945 | 1852 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); |
11 | 1853 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Âûáðàòü öåëü |
0 | 1854 ++pIcons_LOD->uTexturePacksCount; |
1855 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
151 | 1856 pCurrentScreen = SCREEN_CASTING; |
0 | 1857 if ( !pIcons_LOD->uNumPrevLoadedFiles ) |
1858 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1859 } | |
1860 } | |
1861 return pWindow; | |
1295 | 1862 } |
1863 //----- (004B3EF0) -------------------------------------------------------- | |
1864 void DrawJoinGuildWindow( int pEventCode ) | |
1865 { | |
1866 uDialogueType = 81;//enum JoinGuildDialog | |
1867 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; | |
1868 ContractSelectText(pEventCode); | |
1869 pDialogueWindow->Release(); | |
1870 pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); | |
1871 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel | |
1872 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | |
1873 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | |
1874 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); | |
1875 dialog_menu_id = HOUSE_DIALOGUE_OTHER; | |
1876 } | |
1877 //----- (0044603D) -------------------------------------------------------- | |
1878 void __cdecl DialogueEnding() | |
1879 { | |
1880 sDialogue_SpeakingActorNPC_ID = 0; | |
1881 pDialogueWindow->Release(); | |
1882 pDialogueWindow = 0; | |
1883 pMiscTimer->Resume(); | |
1884 pEventTimer->Resume(); | |
1297 | 1885 } |
1886 //----- (004156F0) -------------------------------------------------------- | |
1887 void GUI_UpdateWindows() | |
1888 { | |
1889 GUIWindow *pWindow; // esi@4 | |
1890 //unsigned int pWindowType; // eax@4 | |
1891 const char *pHint; // edx@66 | |
1892 GUIButton *pButtonPtr_1C; // ebp@79 | |
1893 char *pHint1; // edx@80 | |
1894 int v26; // eax@98 | |
1895 unsigned int v27; // ebp@106 | |
1896 GUIWindow *pGUIWindow2; // ecx@109 | |
1897 GUIFont *pGUIFont; // ST1C_4@115 | |
1898 int v31; // eax@115 | |
1899 GUIButton *pButton; // ebp@118 | |
1900 int v39; // eax@129 | |
1901 unsigned int pNumMessages; // eax@142 | |
1902 GUIButton *pGUIButton; // ebp@146 | |
1903 //unsigned int pX; // [sp-1Ch] [bp-124h]@17 | |
1904 //unsigned int pY; // [sp-18h] [bp-120h]@17 | |
1905 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17 | |
1906 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86 | |
1907 int i; // [sp+0h] [bp-108h]@3 | |
1908 ItemGen pItemGen; // [sp+4h] [bp-104h]@98 | |
1909 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133 | |
1910 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129 | |
1911 | |
1912 if (GetCurrentMenuID() != MENU_CREATEPARTY) | |
1913 UI_OnKeyDown(VK_NEXT); | |
1914 | |
1915 for ( i = 1; i <= uNumVisibleWindows; ++i ) | |
1916 { | |
1917 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; | |
1918 switch (pWindow->eWindowType) | |
1919 { | |
1920 case WINDOW_OptionsButtons: | |
1921 { | |
1922 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y, | |
1923 pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options)); | |
1924 viewparams->bRedrawGameUI = 1; | |
1925 continue; | |
1926 } | |
1927 case WINDOW_CharacterRecord: | |
1928 { | |
1929 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); | |
1930 continue; | |
1931 } | |
1932 case WINDOW_Options: | |
1933 { | |
1934 GameMenuUI_Options_Draw(); | |
1935 continue; | |
1936 } | |
1937 case WINDOW_Book: | |
1938 { | |
1939 BookUI_Draw((WindowType)(int)pWindow->ptr_1C); | |
1940 continue; | |
1941 } | |
1942 case WINDOW_Dialogue: | |
1943 { | |
1944 GameUI_DrawDialogue(); | |
1945 continue; | |
1946 } | |
1947 case WINDOW_QuickReference: | |
1948 { | |
1949 GameUI_QuickRef_Draw(); | |
1950 continue; | |
1951 } | |
1952 case WINDOW_Rest: | |
1953 { | |
1954 RestUI_Draw(); | |
1955 continue; | |
1956 } | |
1957 case WINDOW_ChangeLocation: | |
1958 { | |
1959 TravelUI_Draw(); | |
1960 continue; | |
1961 } | |
1962 case WINDOW_SpellBook: | |
1963 { | |
1964 DrawSpellBookContent(pPlayers[uActiveCharacter]); | |
1965 continue; | |
1966 } | |
1967 case WINDOW_GreetingNPC: | |
1968 { | |
1969 GameUI_DrawBranchlessDialogue(); | |
1970 continue; | |
1971 } | |
1972 case WINDOW_Chest: | |
1973 { | |
1974 if ( pCurrentScreen == SCREEN_CHEST ) | |
1975 { | |
1312 | 1976 Chest::DrawChestUI(pWindow->par1C); |
1297 | 1977 } |
1978 else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) | |
1979 { | |
1980 pRenderer->ClearZBuffer(0, 479); | |
1981 draw_leather(); | |
1982 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1983 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); | |
1984 } | |
1985 continue; | |
1986 } | |
1987 case WINDOW_SaveLoadButtons: | |
1988 { | |
1989 SaveUI_Draw(); | |
1990 continue; | |
1991 } | |
1992 case WINDOW_MainMenu_Load: | |
1993 { | |
1994 LoadUI_Draw(); | |
1995 continue; | |
1996 } | |
1997 case WINDOW_HouseInterior: | |
1998 { | |
1999 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); | |
2000 if ( !window_SpeakInHouse ) | |
2001 continue; | |
1312 | 2002 if ( window_SpeakInHouse->par1C >= 53 ) |
1297 | 2003 continue; |
1312 | 2004 if ( pParty->field_3C._shop_ban_times[window_SpeakInHouse->par1C] <=pParty->uTimePlayed ) |
1297 | 2005 { |
1312 | 2006 if ( window_SpeakInHouse->par1C < 53 ) |
1297 | 2007 { |
1312 | 2008 pParty->field_3C._shop_ban_times[window_SpeakInHouse->par1C] = 0; |
1297 | 2009 } |
2010 continue; | |
2011 } | |
2012 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
2013 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
2014 continue; | |
2015 } | |
2016 case WINDOW_Transition: | |
2017 { | |
2018 TransitionUI_Draw(); | |
2019 continue; | |
2020 } | |
2021 case WINDOW_Scroll: | |
2022 { | |
2023 CreateScrollWindow(); | |
2024 continue; | |
2025 } | |
2026 case WINDOW_CastSpell_InInventory: | |
2027 { | |
2028 pRenderer->ClearZBuffer(0, 479); | |
2029 draw_leather(); | |
2030 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
2031 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]); | |
2032 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); | |
2033 continue; | |
2034 } | |
2035 case WINDOW_FinalWindow: | |
2036 { | |
2037 sub_41420D_press_esc(); | |
2038 continue; | |
2039 } | |
2040 case WINDOW_50: | |
2041 { | |
2042 v27 = TargetColor(255, 255, 255); | |
2043 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
2044 { | |
2045 ptr_507BD0->DrawMessageBox(0); | |
2046 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
2047 v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); | |
2048 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate); | |
2049 continue; | |
2050 } | |
2051 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
2052 { | |
2053 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
2054 pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0); | |
2055 pEventTimer->Resume(); | |
2056 ptr_507BD0->Release(); | |
2057 pCurrentScreen = SCREEN_GAME; | |
2058 viewparams->bRedrawGameUI = true; | |
2059 continue; | |
2060 } | |
2061 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
2062 { | |
2063 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
2064 pEventTimer->Resume(); | |
2065 ptr_507BD0->Release(); | |
2066 continue; | |
2067 } | |
2068 } | |
2069 case WINDOW_59: | |
2070 { | |
2071 pWindow->DrawMessageBox(0); | |
2072 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
2073 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
2074 if ( !pKeyActionMap->field_204 ) | |
2075 { | |
2076 ItemGen2.Reset(); | |
2077 pWindow->Release(); | |
2078 pEventTimer->Resume(); | |
2079 pCurrentScreen = 0; | |
2080 viewparams->bRedrawGameUI = true; | |
2081 v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
2082 if ( v26 > 0 ) | |
2083 { | |
2084 if ( v26 < 800 ) | |
2085 { | |
2086 ItemGen2.uAttributes |= 1u; | |
2087 ItemGen2.uItemID = v26; | |
2088 if ( pItemsTable->pItems[v26].uEquipType == 12 ) | |
2089 { | |
2090 ItemGen2.uNumCharges = rand() % 6 + pItemsTable->pItems[ItemGen2.uItemID].uDamageMod + 1; | |
2091 ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges); | |
2092 } | |
2093 else | |
2094 { | |
2095 if ( v26 >= 221 && v26 < 271 ) | |
2096 ItemGen2.uEnchantmentType = rand() % 10 + 1; | |
2097 } | |
2098 pItemsTable->SetSpecialBonus(&ItemGen2); | |
2099 pParty->SetHoldingItem(&ItemGen2); | |
2100 } | |
2101 } | |
2102 } | |
2103 continue; | |
2104 } | |
2105 case WINDOW_PressedButton2: | |
2106 { | |
2107 if ( pWindow->Hint != (char *)1 ) | |
2108 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
2109 pButton = (GUIButton *)pWindow->ptr_1C; | |
2110 if ( pButton->uX >= 0 && pButton->uX <= 640 ) | |
2111 { | |
2112 if ( pButton->uY >= 0 && pButton->uY <= 480 ) | |
2113 { | |
2114 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
2115 viewparams->bRedrawGameUI = 1; | |
2116 if ( pWindow->Hint ) | |
2117 { | |
2118 if ( pWindow->Hint != (char *)1 ) | |
2119 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
2120 } | |
2121 pWindow->Release(); | |
2122 continue; | |
2123 } | |
2124 } | |
2125 viewparams->bRedrawGameUI = 1; | |
2126 if ( pWindow->Hint ) | |
2127 { | |
2128 if ( pWindow->Hint != (char *)1 ) | |
2129 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
2130 } | |
2131 pWindow->Release(); | |
2132 continue; | |
2133 } | |
2134 case WINDOW_CharactersPressedButton: | |
2135 { | |
2136 if ( pWindow->Hint != (char *)1 ) | |
2137 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
2138 pButton = (GUIButton *)pWindow->ptr_1C; | |
2139 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
2140 viewparams->bRedrawGameUI = 1; | |
2141 if ( pWindow->Hint ) | |
2142 { | |
2143 if ( pWindow->Hint != (char *)1 ) | |
2144 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
2145 } | |
2146 pWindow->Release(); | |
2147 continue; | |
2148 } | |
2149 case WINDOW_PressedButton: | |
2150 { | |
2151 if ( pWindow->Hint != (char *)1 ) | |
2152 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
2153 pButton = (GUIButton *)pWindow->ptr_1C; | |
2154 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
2155 viewparams->bRedrawGameUI = 1; | |
2156 if ( pWindow->Hint ) | |
2157 { | |
2158 if ( pWindow->Hint != (char *)1 ) | |
2159 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
2160 } | |
2161 pWindow->Release(); | |
2162 continue; | |
2163 } | |
2164 case WINDOW_5D: | |
2165 { | |
2166 if ( pWindow->Hint != (char *)1 ) | |
2167 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
2168 pButton = (GUIButton *)pWindow->ptr_1C; | |
2169 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
2170 viewparams->bRedrawGameUI = 1; | |
2171 pWindow->Release(); | |
2172 continue; | |
2173 } | |
2174 case WINDOW_SaveLoadBtn: | |
2175 { | |
2176 if (pWindow->Hint != (char *)1) | |
2177 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
2178 pButton = (GUIButton *)pWindow->ptr_1C; | |
2179 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
2180 pHint = pWindow->Hint; | |
2181 viewparams->bRedrawGameUI = 1; | |
2182 if ( pHint && pHint != (char *)1 ) | |
2183 pButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
2184 pWindow->Release(); | |
2185 if (pCurrentScreen == SCREEN_SAVEGAME) | |
2186 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); | |
2187 else | |
2188 pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0); | |
2189 continue; | |
2190 } | |
2191 case WINDOW_LoadGame_CancelBtn: | |
2192 { | |
2193 if ( pWindow->Hint != (char *)1 ) | |
2194 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); | |
2195 pButton = (GUIButton *)pWindow->ptr_1C; | |
2196 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
2197 viewparams->bRedrawGameUI = 1; | |
2198 if ( pWindow->Hint && pWindow->Hint != (char *)1 ) | |
2199 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
2200 pWindow->Release(); | |
2201 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
2202 continue; | |
2203 } | |
2204 case WINDOW_CloseRestWindowBtn: | |
2205 { | |
2206 if ( pWindow->Hint != (char *)1 ) | |
2207 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
2208 pGUIButton = (GUIButton *)pWindow->ptr_1C; | |
2209 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]); | |
2210 pHint = pWindow->Hint; | |
2211 viewparams->bRedrawGameUI = 1; | |
2212 if ( pHint && pHint != (char *)1 ) | |
2213 pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
2214 pWindow->Release(); | |
2215 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
2216 continue; | |
2217 } | |
2218 case WINDOW_ExitCharacterWindow: | |
2219 { | |
2220 if ( pWindow->Hint != (char *)1 ) | |
2221 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
2222 pButton = (GUIButton *)pWindow->ptr_1C; | |
2223 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
2224 pHint = pWindow->Hint; | |
2225 viewparams->bRedrawGameUI = 1; | |
2226 if ( pHint && pHint != (char *)1 ) | |
2227 pButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
2228 pWindow->Release(); | |
2229 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
2230 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); | |
2231 continue; | |
2232 } | |
2233 case WINDOW_RestWindow: | |
2234 { | |
2235 memset(&GUIButton2, 0, 0xBCu); | |
2236 GUIButton2.uZ = 197; | |
2237 GUIButton2.uW = 197; | |
2238 GUIButton2.uX = 27; | |
2239 GUIButton2.uY = 161; | |
2240 GUIButton2.uWidth = 171; | |
2241 GUIButton2.uHeight = 37; | |
2242 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; | |
2243 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); | |
2244 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); | |
2245 viewparams->bRedrawGameUI = 1; | |
2246 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Îòäûõ è ëå÷åíèå 8 ÷àñîâ | |
2247 GUIButton2.pParent = 0; | |
2248 pGUIWindow2 = pWindow; | |
2249 pGUIWindow2->Release(); | |
2250 continue; | |
2251 } | |
2252 case WINDOW_BooksWindow: | |
2253 { | |
2254 pButton = (GUIButton *)pWindow->ptr_1C; | |
2255 pRenderer->DrawTextureIndexed(pWindow->uFrameY, | |
2256 pWindow->uFrameX, pButton->pTextures[0]); | |
2257 viewparams->bRedrawGameUI = true; | |
2258 continue; | |
2259 } | |
2260 case WINDOW_CharacterWindow_Inventory: | |
2261 { | |
2262 pWindow->DrawMessageBox(0); | |
2263 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
2264 pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
2265 if ( !pKeyActionMap->field_204 ) | |
2266 { | |
2267 ItemGen2.Reset(); | |
2268 pWindow->Release(); | |
2269 pEventTimer->Resume(); | |
2270 pCurrentScreen = SCREEN_GAME; | |
2271 viewparams->bRedrawGameUI = 1; | |
2272 v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); | |
2273 if ( v39 > 0 ) | |
2274 { | |
2275 if ( v39 < 800 ) | |
2276 SpawnActor(v39); | |
2277 } | |
2278 } | |
2279 continue; | |
2280 } | |
2281 case WINDOW_KeyMappingOptions: | |
2282 { | |
2283 GameMenuUI_DrawKeyBindings(); | |
2284 continue; | |
2285 } | |
2286 case WINDOW_VideoOptions: | |
2287 { | |
2288 GameMenuUI_DrawVideoOptions(); | |
2289 continue; | |
2290 } | |
2291 default: | |
2292 { | |
2293 continue; | |
2294 } | |
2295 } | |
2296 } | |
2297 if ( GetCurrentMenuID() == -1 ) | |
2298 GameUI_DrawFoodAndGold(); | |
2299 if ( sub_4637E0_is_there_popup_onscreen() ) | |
2300 sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0); | |
2301 } | |
2302 //----- (00415485) -------------------------------------------------------- | |
2303 void DrawCopyrightWindow() | |
2304 { | |
2305 GUIWindow Dst; // [sp+8h] [bp-54h]@1 | |
2306 | |
2307 memset(&Dst, 0, 0x54u); | |
2308 Dst.uFrameWidth = 624; | |
2309 Dst.uFrameHeight = 256; | |
2310 Dst.uFrameX = 8; | |
2311 Dst.uFrameY = 30; // c 1999 The 3DO Company. | |
2312 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0) | |
2313 + 2 * LOBYTE(pFontSmallnum->uFontHeight) | |
2314 + 24; | |
2315 Dst.uFrameY = 470 - Dst.uFrameHeight; | |
2316 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
2317 Dst.uFrameW = 469; | |
2318 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef"; | |
2319 Dst.DrawMessageBox(0); | |
2320 | |
2321 Dst.uFrameWidth -= 24; | |
2322 Dst.uFrameX += 12; | |
2323 Dst.uFrameY += 12; | |
2324 Dst.uFrameHeight -= 12; | |
2325 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; | |
2326 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; | |
2327 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3); | |
2328 } | |
2329 //----- (0041420D) -------------------------------------------------------- | |
2330 void __cdecl sub_41420D_press_esc() | |
2331 { | |
2332 GUIWindow pWindow; // [sp+4h] [bp-54h]@1 | |
2333 | |
2334 sprintf(pTmpBuf2.data(), "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape | |
2335 pWindow.Hint = pTmpBuf2.data(); | |
2336 pWindow.uFrameWidth = 400; | |
2337 pWindow.uFrameHeight = 100; | |
2338 pWindow.uFrameX = 120; | |
2339 pWindow.uFrameY = 140; | |
2340 pWindow.uFrameZ = 519; | |
2341 pWindow.uFrameW = 239; | |
2342 pWindow.DrawMessageBox(0); | |
2343 } | |
2344 | |
2345 //----- (0041426F) -------------------------------------------------------- | |
2346 void __cdecl sub_41426F() | |
2347 { | |
2348 GUIWindow *pWindow; // ecx@1 | |
2349 | |
2350 pWindow = ptr_507BDC; | |
1312 | 2351 pMessageQueue_50CBD0->AddMessage((UIMessageType)ptr_507BDC->par1C, 0, 0); |
1297 | 2352 |
2353 pWindow->Release(); | |
2354 ptr_507BDC = 0; | |
2355 pCurrentScreen = dword_506F0C[0]; | |
2356 pEventTimer->Resume(); | |
2357 } | |
2358 | |
2359 //----- (00467FB6) -------------------------------------------------------- | |
2360 void CreateScrollWindow() | |
2361 { | |
2362 unsigned int v0; // eax@1 | |
2363 char *v1; // ST18_4@3 | |
2364 unsigned int v2; // eax@3 | |
2365 GUIWindow a1; // [sp+Ch] [bp-54h]@1 | |
2366 | |
2367 memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1)); | |
2368 a1.Hint = 0; | |
2369 a1.uFrameX = 1; | |
2370 a1.uFrameY = 1; | |
2371 a1.uFrameWidth = 468; | |
1312 | 2372 v0 = pFontSmallnum->CalcTextHeight(pScrolls[pGUIWindow_ScrollWindow->par1C], &a1, 0, 0) |
1297 | 2373 + 2 * LOBYTE(pFontCreate->uFontHeight) |
2374 + 24; | |
2375 a1.uFrameHeight = v0; | |
2376 if ( (signed int)(v0 + a1.uFrameY) > 479 ) | |
2377 { | |
2378 v0 = 479 - a1.uFrameY; | |
2379 a1.uFrameHeight = 479 - a1.uFrameY; | |
2380 } | |
2381 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; | |
2382 a1.uFrameW = v0 + a1.uFrameY - 1; | |
2383 a1.DrawMessageBox(0); | |
2384 a1.uFrameX += 12; | |
2385 a1.uFrameWidth -= 24; | |
2386 a1.uFrameY += 12; | |
2387 a1.uFrameHeight -= 12; | |
2388 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1; | |
2389 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1; | |
2390 v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName; | |
2391 v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu); | |
2392 sprintf(pTmpBuf.data(), format_4E2D80, v2, v1); | |
2393 a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u); | |
2394 a1.DrawText( | |
2395 pFontSmallnum, | |
2396 1, | |
2397 LOBYTE(pFontCreate->uFontHeight) - 3, | |
2398 0, | |
2399 pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], | |
2400 0, | |
2401 0, | |
2402 0); | |
2403 } | |
2404 //----- (00467F48) -------------------------------------------------------- | |
2405 void CreateMsgScrollWindow( signed int mscroll_id ) | |
2406 { | |
2407 signed int v1; // esi@1 | |
2408 | |
2409 v1 = mscroll_id; | |
2410 if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 ) | |
2411 { | |
2412 if ( mscroll_id <= 782 ) | |
2413 { | |
2414 uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE); | |
2415 pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Scroll, v1 - 700, 0); | |
2416 } | |
2417 } | |
2418 } | |
2419 //----- (00467F9F) -------------------------------------------------------- | |
2420 void __cdecl free_book_subwindow() | |
2421 { | |
2422 if ( pGUIWindow_ScrollWindow ) | |
2423 { | |
2424 pGUIWindow_ScrollWindow->Release(); | |
2425 pGUIWindow_ScrollWindow = 0; | |
2426 } | |
0 | 2427 } |