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