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