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