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