2502
|
1 #define _CRTDBG_MAP_ALLOC
|
|
2 #include <stdlib.h>
|
|
3 #include <crtdbg.h>
|
|
4
|
|
5 #define _CRT_SECURE_NO_WARNINGS
|
2541
|
6 #include "Engine/Engine.h"
|
2502
|
7
|
|
8 #include "GUIWindow.h"
|
|
9 #include "GUIFont.h"
|
|
10 #include "Engine/Party.h"
|
|
11 #include "Engine/LOD.h"
|
|
12 #include "IO/Keyboard.h"
|
|
13 #include "Engine/OurMath.h"
|
|
14 #include "Engine/Timer.h"
|
|
15 #include "Media/Audio/AudioPlayer.h"
|
|
16 #include "IO/Mouse.h"
|
|
17 #include "Engine/Graphics/Viewport.h"
|
|
18 #include "Engine/Tables/StorylineTextTable.h"
|
|
19 #include "GUI\UI\UIHouses.h"
|
|
20 #include "GUI\UI\UIBooks.h"
|
|
21 #include "Engine/texts.h"
|
|
22 #include "Engine/Autonotes.h"
|
|
23 #include "Engine/Awards.h"
|
|
24 #include "Engine/Objects/Chest.h"
|
|
25 #include "Engine/Graphics/Outdoor.h"
|
|
26 #include "Engine/Tables/IconFrameTable.h"
|
|
27 #include "Engine/Objects/Actor.h"
|
|
28
|
|
29 #include "GUI\UI\UIArena.h"
|
|
30 #include "Engine/Events.h"
|
|
31 #include "Engine/Graphics/Level\Decoration.h"
|
|
32
|
|
33 typedef struct _RGBColor
|
|
34 {
|
|
35 unsigned char R;
|
|
36 unsigned char B;
|
|
37 unsigned char G;
|
|
38 }RGBColor;
|
|
39
|
|
40
|
|
41 std::array<RGBColor, 20> spell_tooltip_colors={{
|
|
42 {0x96, 0xD4, 0xFF},
|
|
43 {0xFF, 0x80, 0x00},
|
|
44 {0xFF, 0xFF, 0x9B},
|
|
45 {0xE1, 0xE1, 0xE1},
|
|
46 {0x80, 0x80, 0x80},
|
|
47 {0x96, 0xD4, 0xFF},
|
|
48 {0xFF, 0x55, 0x00},
|
|
49 {0x96, 0xD4, 0xFF},
|
|
50 {0xFF, 0x55, 0x00},
|
|
51 {0xE1, 0xE1, 0xE1},
|
|
52 {0xFF, 0x55, 0x00},
|
|
53 {0x96, 0xD4, 0xFF},
|
|
54 {0xEB, 0x0F, 0xFF},
|
|
55 {0xFF, 0x80, 0x00},
|
|
56 {0x96, 0xD4, 0xFF},
|
|
57 {0x80, 0x80, 0x80},
|
|
58 {0xFF, 0x55, 0x00},
|
|
59 {0x00, 0x80, 0xFF},
|
|
60 {0x00, 0x80, 0xFF},
|
|
61 {0x96, 0xD4, 0xFF}}};
|
|
62
|
|
63
|
|
64 int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb
|
|
65 struct GUIWindow *pWindow_MMT_MainMenu;
|
|
66 struct GUIWindow *pWindow_MainMenu;
|
|
67 std::array<struct GUIWindow, 20> pWindowList;
|
|
68
|
|
69 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue;
|
|
70 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue;
|
|
71
|
|
72
|
|
73
|
|
74
|
|
75
|
|
76
|
|
77 // inlined
|
|
78 //----- (mm6c::00420520) --------------------------------------------------
|
|
79 void GUIMessageQueue::Flush()
|
|
80 {
|
|
81 if (uNumMessages)
|
|
82 uNumMessages = pMessages[0].field_8 != 0;
|
|
83 }
|
|
84
|
|
85 //----- (004356B9) --------------------------------------------------------
|
|
86 void GUIMessageQueue::PopMessage(enum UIMessageType *pType, int *pParam, int *a4)
|
|
87 {
|
|
88 if ( this->uNumMessages )
|
|
89 {
|
|
90 *pType = this->pMessages[0].eType;
|
|
91 *pParam = this->pMessages[0].param;
|
|
92 *a4 = this->pMessages[0].field_8;
|
|
93 if ( (signed int)(this->uNumMessages - 1) > 0 )
|
|
94 {
|
|
95 for ( uint i = 0; i < (signed int)(this->uNumMessages - 1); ++i )
|
|
96 {
|
|
97 this->pMessages[i].eType = this->pMessages[i + 1].eType;
|
|
98 this->pMessages[i].param = this->pMessages[i + 1].param;
|
|
99 this->pMessages[i].field_8 = this->pMessages[i + 1].field_8;
|
|
100 }
|
|
101 }
|
|
102 --this->uNumMessages;
|
|
103 }
|
|
104 }
|
|
105
|
|
106 //----- (0041B4E1) --------------------------------------------------------
|
|
107 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall)
|
|
108 {
|
|
109 int result; // eax@1
|
|
110 int i; // edx@2
|
|
111 GUIButton *j; // ecx@3
|
|
112 int k; // edx@7
|
|
113 GUIButton *l; // ecx@8
|
|
114 unsigned __int8 v9; // [sp+4h] [bp-8h]@1
|
|
115 char old_hot_key; // [sp+8h] [bp-4h]@1
|
|
116
|
|
117 //v3 = uNewHotkey;
|
|
118 old_hot_key = toupper(uOldHotkey);
|
|
119 result = toupper(uNewHotkey);
|
|
120 v9 = result;
|
|
121 if ( bFirstCall )
|
|
122 {
|
|
123 for ( i = uNumVisibleWindows; i >= 0; --i )
|
|
124 {
|
|
125 result = 84 * pVisibleWindowsIdxs[i];
|
|
126 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext )
|
|
127 j->field_28 = 0;
|
|
128 }
|
|
129 }
|
|
130 for ( k = uNumVisibleWindows; k >= 0; --k )
|
|
131 {
|
|
132 result = 84 * pVisibleWindowsIdxs[k];
|
|
133 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext )
|
|
134 {
|
|
135 LOBYTE(result) = old_hot_key;
|
|
136 if ( l->uHotkey == old_hot_key )
|
|
137 {
|
|
138 if ( !l->field_28 )
|
|
139 {
|
|
140 LOBYTE(result) = v9;
|
|
141 l->field_28 = 1;
|
|
142 l->uHotkey = v9;
|
|
143 }
|
|
144 }
|
|
145 }
|
|
146 }
|
|
147 return result;
|
|
148 }
|
|
149
|
|
150 //----- (0041B438) --------------------------------------------------------
|
|
151 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey)
|
|
152 {
|
|
153 char Hot_key_num; // al@1
|
|
154 GUIWindow *current_window; // ecx@2
|
|
155 GUIButton *result; // eax@2
|
|
156
|
|
157 Hot_key_num = toupper(uHotkey);
|
|
158 for( int i = uNumVisibleWindows; i >= 0 && pVisibleWindowsIdxs[i] > 0; i-- )
|
|
159 {
|
|
160 current_window = &pWindowList[pVisibleWindowsIdxs[i] - 1];
|
|
161 for ( result = current_window->pControlsHead; result; result = result->pNext )
|
|
162 {
|
|
163 if ( result->uHotkey == Hot_key_num )
|
|
164 {
|
|
165 pMessageQueue_50CBD0->AddGUIMessage(result->msg, result->msg_param, 0);
|
|
166 return result;
|
|
167 }
|
|
168 }
|
|
169 if ( !current_window->uFrameX && !current_window->uFrameY
|
|
170 && (current_window->uFrameWidth == window->GetWidth() && current_window->uFrameHeight == window->GetWidth()) )
|
|
171 break;
|
|
172 }
|
|
173 return 0;
|
|
174 }
|
|
175 // 5075E0: using guessed type int pVisibleWindowsIdxs[20];
|
|
176
|
|
177 //----- (0041D73D) --------------------------------------------------------
|
|
178 void GUIWindow::_41D73D_draw_buff_tooltip()
|
|
179 {
|
|
180 __int64 remaing_time; // ST28_8@11
|
|
181 unsigned short text_color;
|
|
182 int Y_pos; // esi@11
|
|
183 int string_count; // [sp+20h] [bp-4h]@7
|
|
184
|
|
185 string_count = 0;
|
|
186 for (int i=0; i<20; ++i)
|
|
187 if ( pParty->pPartyBuffs[i].uExpireTime > 0i64 )
|
|
188 ++string_count;
|
|
189
|
|
190 uFrameHeight = pFontArrus->uFontHeight + 72;
|
|
191 uFrameHeight += (string_count - 1) * pFontArrus->uFontHeight;
|
|
192 uFrameZ = uFrameWidth + uFrameX - 1;
|
|
193 uFrameW = uFrameY + uFrameHeight - 1;
|
|
194 DrawMessageBox(0);
|
|
195 DrawTitleText(pFontArrus, 0, 12, 0, pGlobalTXT_LocalizationStrings[451], 3);
|
|
196 if ( !string_count )
|
|
197 DrawTitleText(pFontComic, 0, 40, 0, pGlobalTXT_LocalizationStrings[153], 3);
|
|
198
|
|
199 GetTickCount();
|
|
200 string_count = 0;
|
|
201 for (int i=0; i<20; ++i)
|
|
202 {
|
|
203 if ( pParty->pPartyBuffs[i].uExpireTime>0i64 )//!!!
|
|
204 {
|
|
205 remaing_time = pParty->pPartyBuffs[i].uExpireTime- pParty->uTimePlayed;//!!!
|
|
206 Y_pos = string_count * pFontComic->uFontHeight + 40;
|
|
207 text_color = Color16(spell_tooltip_colors[i].R, spell_tooltip_colors[i].G, spell_tooltip_colors[i].B);
|
|
208 DrawText(pFontComic, 52, Y_pos, text_color, aSpellNames[i], 0, 0, 0);
|
|
209 DrawBuff_remaining_time_string(Y_pos, this, remaing_time, pFontComic);
|
|
210 ++string_count;
|
|
211 }
|
|
212 }
|
|
213 }
|
|
214
|
|
215
|
|
216 //----- (0041D08F) --------------------------------------------------------
|
|
217 void GUIWindow::_41D08F_set_keyboard_control_group(int num_buttons, int a3, int a4, int a5)
|
|
218 {
|
|
219 if (num_buttons)
|
|
220 {
|
|
221 this->pNumPresenceButton = num_buttons;
|
|
222 this->field_30 = a3;
|
|
223 this->field_34 = a4;
|
|
224 this->pCurrentPosActiveItem = a5;
|
|
225 this->pStartingPosActiveItem = a5;
|
|
226 this->receives_keyboard_input = true;
|
|
227 }
|
|
228 else
|
|
229 {
|
|
230 this->pNumPresenceButton = 0;
|
|
231 this->field_30 = a3;
|
|
232 this->field_34 = a4;
|
|
233 this->pCurrentPosActiveItem = 0;
|
|
234 this->pStartingPosActiveItem = 0;
|
|
235 this->receives_keyboard_input = false;
|
|
236 }
|
|
237 }
|
|
238
|
|
239
|
|
240 //----- (0041C26A) --------------------------------------------------------
|
|
241 void GUIWindow::Release()
|
|
242 {
|
|
243 //GUIWindow *v1; // esi@1
|
|
244 int i; // edi@20
|
|
245 //GUIButton *v8; // eax@26
|
|
246 GUIButton *pNextBtn; // edi@27
|
|
247 //int v10; // esi@28
|
|
248 //int v11; // ecx@28
|
|
249 int v12; // edx@29
|
|
250
|
|
251 //v1 = this;
|
|
252 if ( !this )
|
|
253 return;
|
|
254
|
|
255 switch( this->eWindowType )
|
|
256 {
|
|
257 case WINDOW_GreetingNPC:
|
|
258 {
|
|
259 pIcons_LOD->SyncLoadedFilesCount();
|
2541
|
260 current_screen_type = prev_screen_type;
|
2502
|
261 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
|
|
262 break;
|
|
263 }
|
|
264 case WINDOW_HouseInterior:
|
|
265 {
|
|
266 for ( i = 0; i < uNumDialogueNPCPortraits; ++i )
|
|
267 pDialogueNPCPortraits[i]->Release();
|
|
268 uNumDialogueNPCPortraits = 0;
|
|
269 pTexture_Dialogue_Background->Release();
|
|
270
|
|
271 pIcons_LOD->SyncLoadedFilesCount();
|
|
272 pIcons_LOD->RemoveTexturesPackFromTextureList();
|
|
273 dword_5C35D4 = 0;
|
|
274 if ( bFlipOnExit )
|
|
275 {
|
|
276 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + pParty->sRotationY);
|
2543
|
277 pIndoorCameraD3D->sRotationY = pParty->sRotationY;
|
2502
|
278 }
|
|
279 pParty->uFlags |= 2u;
|
|
280 break;
|
|
281 }
|
|
282 case WINDOW_Transition:
|
|
283 {
|
|
284 //pVideoPlayer->Unload();
|
|
285 pTexture_outside->Release();
|
|
286 pTexture_Dialogue_Background->Release();
|
|
287 pIcons_LOD->SyncLoadedFilesCount();
|
2541
|
288 current_screen_type = prev_screen_type;
|
2502
|
289 break;
|
|
290 }
|
|
291 case WINDOW_SpellBook:
|
|
292 {
|
|
293 OnCloseSpellBookPage();
|
|
294 OnCloseSpellBook();
|
|
295 break;
|
|
296 }
|
|
297 case WINDOW_Book:
|
|
298 {
|
|
299 OnCloseBook();
|
|
300 break;
|
|
301 }
|
|
302 case WINDOW_ChangeLocation:
|
|
303 {
|
|
304 pTexture_outside->Release();
|
|
305 pTexture_Dialogue_Background->Release();
|
|
306 pIcons_LOD->SyncLoadedFilesCount();
|
2541
|
307 current_screen_type = prev_screen_type;
|
2502
|
308 break;
|
|
309 }
|
|
310 case WINDOW_Dialogue:
|
|
311 {
|
|
312 if ( !dword_591084 )
|
|
313 pDialogueNPCPortraits[0]->Release();
|
|
314 uNumDialogueNPCPortraits = 0;
|
|
315 pTexture_Dialogue_Background->Release();
|
|
316
|
|
317 pIcons_LOD->SyncLoadedFilesCount();
|
2541
|
318 current_screen_type = prev_screen_type;
|
2502
|
319 break;
|
|
320 }
|
|
321 case WINDOW_null:
|
|
322 return;
|
|
323 default:
|
|
324 break;
|
|
325 }
|
|
326 //v8 = this->pControlsHead;
|
|
327 if ( this->pControlsHead )
|
|
328 {
|
|
329 do
|
|
330 {
|
|
331 pNextBtn = this->pControlsHead->pNext;
|
|
332 free(this->pControlsHead);
|
|
333 this->pControlsHead = pNextBtn;
|
|
334 }
|
|
335 while ( pNextBtn );
|
|
336 }
|
|
337 this->pControlsHead = 0;
|
|
338 this->pControlsTail = 0;
|
|
339 this->uNumControls = 0;
|
|
340 this->eWindowType = WINDOW_null;
|
|
341 while ( this->numVisibleWindows < uNumVisibleWindows )
|
|
342 {
|
|
343 v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1];
|
|
344 pVisibleWindowsIdxs[this->numVisibleWindows] = v12;
|
|
345 --pWindowList[v12 - 1].numVisibleWindows;
|
|
346 ++this->numVisibleWindows;
|
|
347 }
|
|
348 pVisibleWindowsIdxs[uNumVisibleWindows] = 0;
|
|
349 uNumVisibleWindows = uNumVisibleWindows - 1;
|
|
350 }
|
|
351
|
|
352 //----- (0041CD3B) --------------------------------------------------------
|
|
353 GUIButton *GUIWindow::GetControl(unsigned int uID)
|
|
354 {
|
|
355 GUIButton *result; // eax@1
|
|
356
|
|
357 result = this->pControlsHead;
|
|
358 for ( uID; uID; --uID )
|
|
359 result = result->pNext;
|
|
360 return result;
|
|
361 }
|
|
362
|
|
363 //----- (00411BFC) --------------------------------------------------------
|
|
364 void GUIWindow::InitializeBookView()
|
|
365 {
|
|
366 char *pString; // eax@12
|
|
367 int pTextHeight; // eax@12
|
|
368 //__int64 page_count; // qax@12
|
|
369 unsigned int page_count; // esi@12
|
|
370 unsigned __int16 v18; // ax@38
|
|
371 signed int max_beacons; // [sp+10h] [bp-5Ch]@38
|
|
372 GUIWindow journal_window; // [sp+18h] [bp-54h]@8
|
|
373
|
|
374 pAudioPlayer->StopChannels(-1, -1);
|
|
375 InitializeBookFonts();
|
|
376 this->CreateButton(475, 445, 158, 34, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close
|
2541
|
377 current_screen_type = SCREEN_BOOKS;
|
2502
|
378 full_num_items_in_book = 0;
|
|
379 books_primary_item_per_page = 0;
|
|
380 books_page_number = 0;
|
|
381 num_achieved_awards = 0;
|
|
382 switch (this->par1C)
|
|
383 {
|
|
384 case WINDOW_LloydsBeacon:
|
|
385 {
|
|
386 byte_506360 = 0;
|
|
387 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE);
|
|
388 pTexture_LloydBeacons[0] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
|
|
389 pTexture_LloydBeacons[1] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
|
|
390 pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
|
|
391 pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
|
|
392
|
|
393 pBtn_Book_1 = this->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon
|
|
394 pBtn_Book_2 = this->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon
|
|
395
|
|
396 max_beacons = 1;
|
|
397 v18 = pParty->pPlayers[_506348_current_lloyd_playerid].pActiveSkills[PLAYER_SKILL_WATER];
|
|
398 if ( v18 & 0x100 || (v18 & 0x80) )
|
|
399 max_beacons = 5;
|
|
400 else if ( v18 & 0x40 )
|
|
401 max_beacons = 3;
|
|
402
|
|
403 for ( int i = 0; i < max_beacons; ++i )
|
|
404 CreateButton(pLloydsBeaconsPreviewXs[i], pLloydsBeaconsPreviewYs[i],
|
|
405 92, 68, 1, 180, UIMSG_InstallBeacon, i, 0, "", 0);
|
|
406
|
|
407 for ( int i = 0; i < 5; ++i )
|
|
408 {
|
|
409 if (pParty->pPlayers[_506348_current_lloyd_playerid].pInstalledBeacons[i].uBeaconTime >= (signed __int64)pParty->uTimePlayed)
|
|
410 LoadThumbnailLloydTexture(i, _506348_current_lloyd_playerid + 1);
|
|
411 else
|
|
412 memset(&pParty->pPlayers[_506348_current_lloyd_playerid].pInstalledBeacons[i], 0, sizeof(LloydBeacon));
|
|
413 }
|
|
414 }
|
|
415 break;
|
|
416
|
|
417 case WINDOW_TownPortal:
|
|
418 {
|
|
419 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("townport", TEXTURE_16BIT_PALETTE);
|
|
420 pTexture_TownPortalIcons[0] = pIcons_LOD->LoadTexturePtr("tpharmndy", TEXTURE_16BIT_PALETTE);
|
|
421 pTexture_TownPortalIcons[1] = pIcons_LOD->LoadTexturePtr("tpelf", TEXTURE_16BIT_PALETTE);
|
|
422 pTexture_TownPortalIcons[2] = pIcons_LOD->LoadTexturePtr("tpwarlock", TEXTURE_16BIT_PALETTE);
|
|
423 pTexture_TownPortalIcons[3] = pIcons_LOD->LoadTexturePtr("tpisland", TEXTURE_16BIT_PALETTE);
|
|
424 pTexture_TownPortalIcons[4] = pIcons_LOD->LoadTexturePtr("tpheaven", TEXTURE_16BIT_PALETTE);
|
|
425 pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE);
|
|
426
|
|
427 static int pTownPortalBook_ws[6] = { 80, 66, 68, 72, 67, 74};
|
|
428 static int pTownPortalBook_hs[6] = { 55, 56, 65, 67, 67, 59};
|
|
429 for ( uint i = 0; i < 6; ++i )
|
|
430 this->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr);
|
|
431
|
|
432 }
|
|
433 break;
|
|
434
|
|
435 case WINDOW_QuestBook:
|
|
436 {
|
|
437 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE);
|
|
438 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr( "divbar", TEXTURE_16BIT_PALETTE);
|
|
439 pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
|
|
440 pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
|
|
441 pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
|
|
442 pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
|
|
443 pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1,
|
|
444 pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight,
|
|
445 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up"
|
|
446 pTex_book_button1_on, 0);
|
|
447 pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38,
|
|
448 pTex_book_button2_on->uTextureHeight, pTex_book_button2_on->uTextureHeight,
|
|
449 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down"
|
|
450 pTex_book_button2_on, 0);
|
|
451 num_achieved_awards = 0;
|
|
452 memset(achieved_awards.data(), 0, 4000);
|
|
453 for ( uint i = books_primary_item_per_page; i < 512; ++i )
|
|
454 {
|
|
455 if ( _449B57_test_bit(pParty->_quest_bits, i) && pQuestTable[i] )
|
|
456 {
|
|
457 achieved_awards[num_achieved_awards] = (AwardType)i;
|
|
458 ++num_achieved_awards;
|
|
459 }
|
|
460 }
|
|
461 full_num_items_in_book = num_achieved_awards;
|
|
462 num_achieved_awards = 0;
|
|
463 }
|
|
464 break;
|
|
465
|
|
466 case WINDOW_AutonotesBook:
|
|
467 {
|
|
468 pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE);
|
|
469 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE);
|
|
470 pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
|
|
471 pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
|
|
472 pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
|
|
473 pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
|
|
474 pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE);
|
|
475 pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE);
|
|
476 pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE);
|
|
477 pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE);
|
|
478 pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE);
|
|
479 pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE);
|
|
480 pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE);
|
|
481 pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE);
|
|
482 pTex_book_button7_on = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE);
|
|
483 pTex_book_button7_off = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE);
|
|
484 pTex_book_button8_on = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE);
|
|
485 pTex_book_button8_off = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE);
|
|
486
|
|
487 pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0,
|
|
488 UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_book_button1_on, 0);
|
|
489 pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0,
|
|
490 UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button2_on, 0);
|
|
491 pBtn_Book_3 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0,
|
|
492 UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTex_book_button3_on, 0); // "Potion Notes"
|
|
493 pBtn_Book_4 = this->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0,
|
|
494 UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTex_book_button4_on, 0); // "Fountain Notes"
|
|
495 pBtn_Book_5 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0,
|
|
496 UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTex_book_button5_on, 0); // "Obelisk Notes"
|
|
497 pBtn_Book_6 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0,
|
|
498 UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTex_book_button6_on, 0); // "Seer Notes"
|
|
499 pBtn_Autonotes_Misc = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0,
|
|
500 UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTex_book_button7_on, 0); // "Miscellaneous Notes"
|
|
501 pBtn_Autonotes_Instructors = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0,
|
|
502 UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTex_book_button8_on, 0); // "Instructors"
|
|
503
|
|
504 num_achieved_awards = 0;
|
|
505 for ( uint i = books_primary_item_per_page; i < 196; ++i )
|
|
506 {
|
|
507 if ( _506568_autonote_type == pAutonoteTxt[i].eType)//dword_72371C[2 * v10] )
|
|
508 {
|
|
509 if ( i )
|
|
510 {
|
|
511 if ( _449B57_test_bit(pParty->_autonote_bits, i) && pAutonoteTxt[i].pText )
|
|
512 {
|
|
513 achieved_awards[num_achieved_awards] = (AwardType)i;
|
|
514 ++num_achieved_awards;
|
|
515 }
|
|
516 }
|
|
517 }
|
|
518 }
|
|
519 full_num_items_in_book = num_achieved_awards;
|
|
520 num_achieved_awards = 0;
|
|
521 }
|
|
522 break;
|
|
523
|
|
524 case WINDOW_MapsBook:
|
|
525 {
|
|
526 dword_506364 = 1;
|
|
527 pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE);
|
|
528 pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE);
|
|
529 pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE);
|
|
530 pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE);
|
|
531 pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE);
|
|
532 pTex_book_button3_on = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE);
|
|
533 pTex_book_button3_off = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE);
|
|
534 pTex_book_button4_on = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE);
|
|
535 pTex_book_button4_off = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE);
|
|
536 pTex_book_button5_on = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE);
|
|
537 pTex_book_button5_off = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE);
|
|
538 pTex_book_button6_on = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE);
|
|
539 pTex_book_button6_off = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE);
|
|
540
|
|
541 pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0,
|
|
542 UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_book_button1_on, 0);// "Zoom In"
|
|
543 pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0,
|
|
544 UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_book_button2_on, 0);// "Zoom Out"
|
|
545 pBtn_Book_3 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0,
|
|
546 UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up
|
|
547 pBtn_Book_4 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0,
|
|
548 UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down
|
|
549 pBtn_Book_5 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0,
|
|
550 UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right"
|
|
551 pBtn_Book_6 = this->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0,
|
|
552 UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left"
|
|
553 }
|
|
554 break;
|
|
555
|
|
556 case WINDOW_CalendarBook:
|
|
557 {
|
|
558 pSpellBookPagesTextr_13 = pIcons_LOD->LoadTexturePtr("sbdate-time", TEXTURE_16BIT_PALETTE);
|
|
559 pTex_moon_new = pIcons_LOD->LoadTexturePtr("moon_new", TEXTURE_16BIT_PALETTE);
|
|
560 pTex_moon_4 = pIcons_LOD->LoadTexturePtr("moon_4", TEXTURE_16BIT_PALETTE);
|
|
561 pTex_moon_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE);
|
|
562 pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE);
|
|
563 pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE);
|
|
564 }
|
|
565 break;
|
|
566
|
|
567 case WINDOW_JournalBook:
|
|
568 {
|
|
569 pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE);
|
|
570 pTex_book_button1_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE);
|
|
571 pTex_book_button2_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE);
|
|
572 pTex_book_button1_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE);
|
|
573 pTex_book_button2_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE);
|
|
574
|
|
575 pBtn_Book_1 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1,
|
|
576 pTex_book_button1_on->uTextureWidth, pTex_book_button1_on->uTextureHeight, 1, 0,
|
|
577 UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_book_button1_on, 0);
|
|
578 pBtn_Book_2 = this->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_book_button2_on->uTextureHeight,
|
|
579 pTex_book_button2_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0,
|
|
580 pGlobalTXT_LocalizationStrings[193], pTex_book_button2_on, 0);
|
|
581
|
|
582 num_achieved_awards = 0;
|
|
583 journal_window.uFrameX = 48;
|
|
584 journal_window.uFrameY = 70;
|
|
585 journal_window.uFrameWidth = 360;
|
|
586 journal_window.uFrameHeight = 264;
|
|
587 journal_window.uFrameZ = 407;
|
|
588 journal_window.uFrameHeight = (LOBYTE(pAutonoteFont->uFontHeight) - 3) * 264 / LOBYTE(pAutonoteFont->uFontHeight) - 3;
|
|
589 journal_window.uFrameW = journal_window.uFrameHeight + 69;
|
|
590 memset(&achieved_awards, 0, 4000);
|
|
591 memset(Journal_limitation_factor.data(), 0, 100);
|
|
592 if ( books_primary_item_per_page < 29 )
|
|
593 {
|
|
594 for ( int i = books_primary_item_per_page; i < books_primary_item_per_page + 29; i++ )
|
|
595 {
|
|
596 if ( pParty->PartyTimes.HistoryEventTimes[i] > 0 )
|
|
597 {
|
|
598 if ( pStorylineText->StoreLine[i + 1].pText )
|
|
599 {
|
|
600 pString = BuildDialogueString(pStorylineText->StoreLine[i + 1].pText, uActiveCharacter - 1, 0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[i]);
|
|
601 pTextHeight = pAutonoteFont->CalcTextHeight(pString, &journal_window, 1, 0);
|
|
602 page_count = ((pTextHeight - (pAutonoteFont->uFontHeight - 3)) / (signed int)journal_window.uFrameHeight) + 1;
|
|
603 memset32((char *)&achieved_awards[num_achieved_awards] , i + 1, page_count);
|
|
604 for ( uint j = 0; j <= page_count - 1; ++j )
|
|
605 Journal_limitation_factor[num_achieved_awards++] = j;
|
|
606 }
|
|
607 }
|
|
608 }
|
|
609 }
|
|
610 full_num_items_in_book = num_achieved_awards;
|
|
611 num_achieved_awards = 0;
|
|
612 }
|
|
613 break;
|
|
614 }
|
|
615 }
|
|
616
|
|
617 //----- (00415551) --------------------------------------------------------
|
|
618 void GUIWindow::DrawMessageBox(int arg0)
|
|
619 {
|
|
620 unsigned int v2; // edi@1
|
|
621 signed int v4; // esi@2
|
|
622 unsigned int v5; // eax@2
|
|
623 unsigned int v16; // esi@19
|
|
624 GUIWindow current_window; // [sp+Ch] [bp-60h]@18
|
|
625 POINT cursor; // [sp+60h] [bp-Ch]@8
|
|
626 unsigned int v22; // [sp+74h] [bp+8h]@2
|
|
627
|
|
628 v2 = 0;
|
|
629 if ( arg0 )
|
|
630 {
|
|
631 v4 = pViewport->uViewportTL_X;
|
|
632 v5 = pViewport->uViewportBR_X;
|
|
633 v2 = pViewport->uViewportTL_Y;
|
|
634 v22 = pViewport->uViewportBR_Y;
|
|
635 }
|
|
636 else
|
|
637 {
|
|
638 v4 = 0;
|
|
639 v5 = window->GetWidth();
|
|
640 v22 = window->GetHeight();
|
|
641 }
|
|
642 pMouse->GetCursorPos(&cursor);
|
|
643 if ( (signed int)this->uFrameX >= v4 )
|
|
644 {
|
|
645 if ( (signed int)(this->uFrameWidth + this->uFrameX) > (signed int)v5 )
|
|
646 {
|
|
647 this->uFrameX = v5 - this->uFrameWidth;
|
|
648 this->uFrameY = cursor.y + 30;
|
|
649 }
|
|
650 }
|
|
651 else
|
|
652 {
|
|
653 this->uFrameX = v4;
|
|
654 this->uFrameY = cursor.y + 30;
|
|
655 }
|
|
656
|
|
657 if ( (signed int)this->uFrameY >= (signed int)v2 )
|
|
658 {
|
|
659 if ( (signed int)(this->uFrameY + this->uFrameHeight) > (signed int)v22 )
|
|
660 this->uFrameY = cursor.y - this->uFrameHeight - 30;
|
|
661 }
|
|
662 else
|
|
663 this->uFrameY = cursor.y + 30;
|
|
664 if ( (signed int)this->uFrameY < (signed int)v2 )
|
|
665 this->uFrameY = v2;
|
|
666 if ( (signed int)this->uFrameX < v4 )
|
|
667 this->uFrameX = v4;
|
|
668 this->uFrameZ = this->uFrameWidth + this->uFrameX - 1;
|
|
669 this->uFrameW = this->uFrameHeight + this->uFrameY - 1;
|
|
670 memcpy(¤t_window, this, sizeof(current_window));
|
|
671 current_window.uFrameX += 12;
|
|
672 current_window.uFrameWidth -= 24;
|
|
673 current_window.uFrameY += 12;
|
|
674 current_window.uFrameHeight -= 12;
|
|
675 current_window.uFrameZ = current_window.uFrameWidth + current_window.uFrameX - 1;
|
|
676 current_window.uFrameW = current_window.uFrameHeight + current_window.uFrameY - 1;
|
|
677 if ( this->Hint )
|
|
678 v16 = pFontLucida->CalcTextHeight(this->Hint, ¤t_window, 0, 0) + 24;
|
|
679 else
|
|
680 v16 = this->uFrameHeight;
|
|
681 if ( (signed int)v16 < 64 )
|
|
682 v16 = 64;
|
|
683 if ( (signed int)(v16 + this->uFrameY) > 479 )
|
|
684 v16 = 479 - this->uFrameY;
|
|
685 DrawPopupWindow(this->uFrameX, this->uFrameY, this->uFrameWidth, v16);
|
|
686 if ( this->Hint )
|
|
687 current_window.DrawTitleText(pFontLucida, 0, (signed int)(v16 - pFontLucida->CalcTextHeight(this->Hint, ¤t_window, 0, 0)) / 2 - 14, 0, this->Hint, 3);
|
|
688 }
|
|
689
|
|
690 //----- (00411B59) --------------------------------------------------------
|
|
691 void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer)
|
|
692 {
|
|
693 //unsigned int v2; // esi@1
|
|
694 //unsigned int v3; // edi@1
|
|
695 FILE *v4; // ebx@1
|
|
696 FILE *v5; // eax@2
|
|
697 char pContainerName[64]; // [sp+Ch] [bp-44h]@1
|
|
698 //unsigned int v7; // [sp+4Ch] [bp-4h]@1
|
|
699
|
|
700 //v2 = uSlot;
|
|
701 //v7 = uPlayer;
|
|
702 //v3 = uSlot + 1;
|
|
703 sprintf(pContainerName, "data\\lloyd%d%d.pcx", uPlayer, uSlot + 1);
|
|
704 v4 = fopen(pContainerName, "rb");
|
|
705 if ( v4 )
|
|
706 {
|
|
707 pSavegameThumbnails[uSlot].LoadFromFILE(v4, 0, 1);
|
|
708 fclose(v4);
|
|
709 }
|
|
710 else
|
|
711 {
|
|
712 sprintf(pContainerName, "lloyd%d%d.pcx", uPlayer, uSlot + 1);
|
|
713 v5 = pNew_LOD->FindContainer(pContainerName, 1);
|
|
714 if ( v5 )
|
|
715 pSavegameThumbnails[uSlot].LoadFromFILE(v5, 0, 0);
|
|
716 else
|
|
717 *((int *)&pSavegameThumbnails.data()->pPixels + 10 * uSlot) = 0;
|
|
718 }
|
|
719 }
|
|
720
|
|
721
|
|
722 //----- (00411621) --------------------------------------------------------
|
|
723 void GUIWindow::OpenSpellBook()
|
|
724 {
|
|
725 Player *pPlayer; // edi@1
|
|
726 //GUIWindow *pWindow; // esi@1
|
|
727 //unsigned int v3; // ebp@1
|
|
728 int v4; // eax@3
|
|
729 ///GUIButton *result; // eax@25
|
|
730 int a2; // [sp+10h] [bp-8h]@1
|
|
731 //int v7; // [sp+14h] [bp-4h]@1
|
|
732
|
|
733 pPlayer = pPlayers[uActiveCharacter];
|
|
734 //pWindow = this;
|
|
735 LoadSpellbook(pPlayer->lastOpenedSpellbookPage);
|
|
736 //v3 = 0;
|
|
737 a2 = 0;
|
|
738
|
|
739 PlayerSpellbookChapter* chapter = &pPlayer->spellbook.pChapters[pPlayer->lastOpenedSpellbookPage];
|
|
740 for (uint i = 0; i < 11; ++i)
|
|
741 {
|
|
742 if (!chapter->bIsSpellAvailable[i])
|
|
743 continue;
|
|
744 v4= pPlayer->lastOpenedSpellbookPage;
|
|
745 //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]);
|
|
746 CreateButton(pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos,
|
|
747 pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0
|
|
748 SBPageSSpellsTextureList[i + 1]->uTextureWidth,
|
|
749 SBPageSSpellsTextureList[i + 1]->uTextureHeight,
|
|
750 1, 79, UIMSG_SelectSpell, i, 0, "", 0);
|
|
751 ++a2;
|
|
752 //++v3;
|
|
753 }
|
|
754 //while ( (signed int)v3 < 11 );
|
|
755
|
|
756 CreateButton(0, 0, 0, 0, 1, 0, UIMSG_SpellBook_PressTab, 0, '\t', "", 0);
|
|
757 if ( a2 )
|
|
758 _41D08F_set_keyboard_control_group(a2, 0, 0, 0);
|
|
759
|
|
760 if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE]) CreateButton(399, 10, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 0, 0, aSpellSchoolNames[0], 0);
|
|
761 if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR]) CreateButton(399, 46, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 1, 0, aSpellSchoolNames[1], 0);
|
|
762 if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) CreateButton(399, 83, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 2, 0, aSpellSchoolNames[2], 0);
|
|
763 if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH]) CreateButton(399, 121, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 3, 0, aSpellSchoolNames[3], 0);
|
|
764 if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT]) CreateButton(399, 158, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 4, 0, aSpellSchoolNames[4], 0);
|
|
765 if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) CreateButton(400, 196, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 5, 0, aSpellSchoolNames[5], 0);
|
|
766 if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) CreateButton(400, 234, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 6, 0, aSpellSchoolNames[6], 0);
|
|
767 if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0);
|
|
768 if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0);
|
|
769
|
|
770 CreateButton(476, 450, pSBClickQuickSpellBtnTextr->uTextureWidth, pSBClickQuickSpellBtnTextr->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0);
|
|
771 pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pSBClickQuickSpellBtnTextr, 0);
|
|
772 CreateButton(561, 450, pSpellBookClickCloseBtnTextr->uTextureWidth, pSpellBookClickCloseBtnTextr->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0);
|
|
773 pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pSpellBookClickCloseBtnTextr, 0);
|
|
774 }
|
|
775 // 50640C: using guessed type int dword_50640C[];
|
|
776
|
|
777 //----- (004B3157) --------------------------------------------------------
|
|
778 void GUIWindow::HouseDialogManager()
|
|
779 {
|
|
780 unsigned __int16 pWhiteColor; // di@2
|
|
781 const char *pHouseName; // edx@4
|
|
782 signed int v3; // edx@5
|
|
783 char *v4; // edi@9
|
|
784 int pTextHeight; // eax@45
|
|
785 int v6; // edi@45
|
|
786 char *v7; // eax@45
|
|
787 int v8; // edi@46
|
|
788 int v9; // eax@50
|
|
789 unsigned int v10; // [sp-10h] [bp-C8h]@53
|
|
790 char *pTitleText; // [sp-8h] [bp-C0h]@50
|
|
791 GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4
|
|
792 GUIWindow pWindow; // [sp+60h] [bp-58h]@2
|
|
793 int pColor2; // [sp+B4h] [bp-4h]@2
|
|
794
|
|
795 if ( !window_SpeakInHouse )
|
|
796 return;
|
|
797 memcpy(&pWindow, this, sizeof(pWindow));
|
|
798 pWindow.uFrameWidth -= 18;
|
|
799 pWindow.uFrameZ -= 18;
|
|
800 pWhiteColor = Color16(0xFFu, 0xFFu, 0xFFu);
|
|
801 pColor2 = Color16(0x15u, 0x99u, 0xE9u);
|
|
802 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
|
2524
|
803 pRenderer->DrawTextureIndexedAlpha(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]);
|
2502
|
804 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic )
|
|
805 {
|
|
806 pDialogWindow.uFrameWidth = 130;
|
|
807 pDialogWindow.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight);
|
|
808 pHouseName = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName;
|
|
809 if ( pHouseName )
|
|
810 {
|
|
811 v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(pHouseName, &pDialogWindow, 0, 0);
|
|
812 if ( v3 < 0 )
|
|
813 v3 = 0;
|
|
814 pWindow.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, pWhiteColor,
|
|
815 //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C],
|
|
816 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3);
|
|
817 }
|
|
818 }
|
|
819 pWindow.uFrameWidth += 8;
|
|
820 pWindow.uFrameZ += 8;
|
|
821 if ( !pDialogueNPCCount )
|
|
822 {
|
|
823 if ( in_current_building_type == BuildingType_Jail )
|
|
824 {
|
|
825 JailDialog();
|
|
826 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
827 {
|
|
828 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
|
|
829 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
|
|
830 }
|
|
831 else
|
|
832 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
|
|
833 return;
|
|
834 }
|
|
835 if ( current_npc_text )
|
|
836 {
|
|
837 pDialogWindow.uFrameWidth = 458;
|
|
838 pDialogWindow.uFrameZ = 457;
|
|
839 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &pDialogWindow, 13, 0);
|
|
840 v6 = pTextHeight + 7;
|
|
841 pRenderer->GetLeather(8, 352 - (pTextHeight + 7), &pIcons_LOD->pTextures[uTextureID_Leather],
|
|
842 pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (pTextHeight + 7));
|
|
843 pRenderer->DrawTextureIndexed(8, 347 - v6, pTexture_591428);
|
|
844 v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0);
|
|
845 window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0);
|
|
846 }
|
|
847 if ( uNumDialogueNPCPortraits <= 0 )
|
|
848 {
|
|
849 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
850 {
|
|
851 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
|
|
852 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
|
|
853 }
|
|
854 else
|
|
855 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
|
|
856 return;
|
|
857 }
|
|
858 for ( v8 = 0; v8 < uNumDialogueNPCPortraits; ++v8 )
|
|
859 {
|
|
860 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4,
|
|
861 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]);
|
|
862 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8],
|
|
863 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8], pDialogueNPCPortraits[v8]);
|
|
864 if ( uNumDialogueNPCPortraits < 4 )
|
|
865 {
|
|
866 if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
867 {
|
|
868 pTitleText = pMapStats->pInfos[uHouse_ExitPic].pName;
|
|
869 v9 = 94 * v8 + 113;
|
|
870 }
|
|
871 else
|
|
872 {
|
|
873 if ( !v8 && dword_591080 )
|
|
874 {
|
|
875 pTitleText = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle;
|
|
876 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, pTitleText, 3);
|
|
877 continue;
|
|
878 }
|
|
879 pTitleText = HouseNPCData[v8 +1 - (dword_591080 != 0)]->pName;
|
|
880 v9 = pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2;
|
|
881 }
|
|
882 v10 = v9;
|
|
883 pWindow.DrawTitleText(pFontCreate, 483, v10, pColor2, pTitleText, 3);
|
|
884 }
|
|
885 }
|
|
886 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
887 {
|
|
888 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
|
|
889 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
|
|
890 }
|
|
891 else
|
|
892 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
|
|
893 return;
|
|
894 }
|
|
895 v4 = (char *)pDialogueNPCCount - 1;
|
|
896 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]);
|
|
897 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]);
|
2541
|
898 if ( current_screen_type == SCREEN_E )
|
2502
|
899 {
|
|
900 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
901 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
902 {
|
|
903 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
|
|
904 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
|
|
905 }
|
|
906 else
|
|
907 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
|
|
908 return;
|
|
909 }
|
|
910 if ( v4 || !dword_591080 )//на изумрудном острове заходит на корабле пока не выполнены квесты
|
|
911 SimpleHouseDialog();
|
|
912 else
|
|
913 {
|
|
914 sprintfex( pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429],
|
|
915 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName,
|
|
916 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle);
|
|
917 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf.data(), 3);
|
|
918 switch ( in_current_building_type )
|
|
919 {
|
|
920 case BuildingType_WeaponShop:
|
|
921 WeaponShopDialog();
|
|
922 break;
|
|
923 case BuildingType_ArmorShop:
|
|
924 ArmorShopDialog();
|
|
925 break;
|
|
926 case BuildingType_MagicShop:
|
|
927 MagicShopDialog();
|
|
928 break;
|
|
929 case BuildingType_AlchemistShop:
|
|
930 AlchemistDialog();
|
|
931 break;
|
|
932 case BuildingType_FireGuild:
|
|
933 case BuildingType_AirGuild:
|
|
934 case BuildingType_WaterGuild:
|
|
935 case BuildingType_EarthGuild:
|
|
936 case BuildingType_SpiritGuild:
|
|
937 case BuildingType_MindGuild:
|
|
938 case BuildingType_BodyGuild:
|
|
939 case BuildingType_LightGuild:
|
|
940 case BuildingType_DarkGuild:
|
|
941 GuildDialog();
|
|
942 break;
|
|
943 case BuildingType_18:
|
|
944 __debugbreak(); //What over the dialog?
|
|
945 sub_4B6478();
|
|
946 break;
|
|
947 case BuildingType_TownHall:
|
|
948 TownHallDialog();
|
|
949 break;
|
|
950 case BuildingType_Tavern:
|
|
951 TavernDialog();
|
|
952 break;
|
|
953 case BuildingType_Bank:
|
|
954 BankDialog();
|
|
955 break;
|
|
956 case BuildingType_Temple:
|
|
957 TempleDialog();
|
|
958 break;
|
|
959 case BuildingType_Stables:
|
|
960 case BuildingType_Boats:
|
|
961 TravelByTransport();
|
|
962 break;
|
|
963 case BuildingType_Training:
|
|
964 TrainingDialog();
|
|
965 break;
|
|
966 case BuildingType_Jail:
|
|
967 JailDialog();
|
|
968 break;
|
|
969 default:
|
|
970 //__debugbreak();//New BuildingType (if enter Boat)
|
|
971 break;
|
|
972 }
|
|
973 }
|
|
974 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
975 {
|
|
976 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
|
|
977 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]);
|
|
978 }
|
|
979 else
|
|
980 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]);
|
|
981 }
|
|
982
|
|
983 //----- (004B1854) --------------------------------------------------------
|
|
984 void GUIWindow::DrawShops_next_generation_time_string( __int64 next_generation_time )
|
|
985 {
|
|
986 unsigned int full_time; // esi@1
|
|
987 signed __int64 hours; // kr00_8@1
|
|
988 const char *text; // eax@2
|
|
989 signed __int64 minutes; // [sp+Ch] [bp-10h]@1
|
|
990 signed __int64 seconds; // [sp+14h] [bp-8h]@1
|
|
991 unsigned int days; // [sp+20h] [bp+4h]@1
|
|
992
|
|
993 full_time = (signed __int64)((double)next_generation_time * 0.234375);
|
|
994 seconds = (signed __int64)full_time % 60;
|
|
995 minutes = (signed __int64)(full_time / 60) % 60;
|
|
996 hours = ((full_time / 60) / 60) % 24;
|
|
997 days = (unsigned int)((full_time / 60) / 60) / 24;
|
|
998 strcpy(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[532]);
|
|
999 if ( days )
|
|
1000 {
|
|
1001 text = pGlobalTXT_LocalizationStrings[57];//Days
|
|
1002 if ( days <= 1 )
|
|
1003 text = pGlobalTXT_LocalizationStrings[56];//Day
|
|
1004 sprintfex(pTmpBuf2.data(), "%d %s ", days, text);
|
|
1005 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
1006 }
|
|
1007 if ( hours )
|
|
1008 {
|
|
1009 if ( hours <= 1 )
|
|
1010 text = pGlobalTXT_LocalizationStrings[109];//Hour
|
|
1011 else
|
|
1012 text = pGlobalTXT_LocalizationStrings[110];//Hours
|
|
1013 sprintfex(pTmpBuf2.data(), "%d %s ", (int)hours, text);
|
|
1014 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
1015 }
|
|
1016 if ( minutes && !days )
|
|
1017 {
|
|
1018 if ( minutes <= 1 )
|
|
1019 text = pGlobalTXT_LocalizationStrings[437];//"Minute"
|
|
1020 else
|
|
1021 text = pGlobalTXT_LocalizationStrings[436]; //"Minutes"
|
|
1022 sprintfex(pTmpBuf2.data(), "%d %s ", (int)minutes, text);
|
|
1023 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
1024 }
|
|
1025 if ( seconds && !hours )
|
|
1026 {
|
|
1027 if ( seconds <= 1 )
|
|
1028 text = pGlobalTXT_LocalizationStrings[439]; //"Second"
|
|
1029 else
|
|
1030 text = pGlobalTXT_LocalizationStrings[438]; //"Seconds"
|
|
1031 sprintfex(pTmpBuf2.data(), "%d %s ", (int)seconds, text);
|
|
1032 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
1033 }
|
|
1034 this->DrawTitleText(pFontArrus, 0, (212 - pFontArrus->CalcTextHeight(pTmpBuf.data(), this, 0, 0)) / 2 + 101, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
|
|
1035 }
|
|
1036
|
|
1037 //----- (0044D406) --------------------------------------------------------
|
|
1038 void GUIWindow::DrawTitleText( GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor,
|
|
1039 const char *pInString, unsigned int uLineSpacing )
|
|
1040 {
|
|
1041 //GUIWindow *pWindow; // esi@1
|
|
1042 unsigned int v8; // ebx@1
|
|
1043 char *v9; // eax@1
|
|
1044 unsigned int v11; // edi@1
|
|
1045 signed int v12; // esi@1
|
|
1046 int v13; // eax@2
|
|
1047 GUIFont *pFont; // [sp+Ch] [bp-4h]@1
|
|
1048 const char *Stra; // [sp+24h] [bp+14h]@5
|
|
1049
|
|
1050 //pWindow = this;
|
|
1051 pFont = a2;
|
|
1052 v8 = this->uFrameWidth - uHorizontalMargin;
|
|
1053 ui_current_text_color = uDefaultColor;
|
|
1054 v9 = FitTextInAWindow(pInString, a2, this, uHorizontalMargin, 0);
|
|
1055 Stra = strtok(v9, "\n");
|
|
1056 v11 = uHorizontalMargin + this->uFrameX;
|
|
1057 v12 = uVerticalMargin + this->uFrameY;
|
|
1058 while ( 1 )
|
|
1059 {
|
|
1060 if ( !Stra )
|
|
1061 break;
|
|
1062 v13 = (signed int)(v8 - pFont->GetLineWidth(Stra)) >> 1;
|
|
1063 if ( v13 < 0 )
|
|
1064 v13 = 0;
|
|
1065 pFont->DrawTextLine(uDefaultColor, v11 + v13, v12, Stra, window->GetWidth());
|
|
1066 v12 += pFont->uFontHeight - uLineSpacing;
|
|
1067 Stra = strtok(0, "\n");
|
|
1068 }
|
|
1069 }
|
|
1070 // 5C6DB4: using guessed type int ui_current_text_color;
|
|
1071
|
|
1072 //----- (0044CE08) --------------------------------------------------------
|
2529
|
1073 void GUIWindow::DrawText(GUIFont *font, signed int uX, int uY, unsigned short uFontColor, const char *Str, bool present_time_transparency, int max_text_height, signed int uFontShadowColor )
|
2532
|
1074 {
|
2502
|
1075 int v14; // edx@9
|
|
1076 char Dest[6]; // [sp+Ch] [bp-2Ch]@32
|
|
1077 size_t v30; // [sp+2Ch] [bp-Ch]@4
|
2528
|
1078
|
2529
|
1079 int left_margin = 0;
|
2502
|
1080 if ( !Str )
|
|
1081 {
|
|
1082 MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0);
|
|
1083 return;
|
|
1084 }
|
2528
|
1085 if (!strcmp(Str, "null"))
|
|
1086 return;
|
|
1087
|
2532
|
1088 v30 = strlen(Str);
|
|
1089 if ( !uX )
|
|
1090 uX = 12;
|
2528
|
1091
|
2532
|
1092 const char *string_begin = Str;
|
|
1093 if ( max_text_height == 0 )
|
|
1094 string_begin = FitTextInAWindow(Str, font, this, uX, 0);
|
|
1095 auto string_end = string_begin;
|
|
1096 auto string_base = string_begin;
|
2528
|
1097
|
2532
|
1098 int out_x = uX + uFrameX;
|
|
1099 int out_y = uY + uFrameY;
|
|
1100 v14 = 0;
|
|
1101
|
|
1102 if (max_text_height != 0 && out_y + LOBYTE(font->uFontHeight) > max_text_height)
|
|
1103 return;
|
2528
|
1104
|
2532
|
1105 if ( (signed int)v30 > 0 )
|
|
1106 {
|
|
1107 do
|
|
1108 {
|
|
1109 unsigned char c = string_base[v14];
|
|
1110 if ( c >= font->cFirstChar && c <= font->cLastChar
|
|
1111 || c == '\f'
|
|
1112 || c == '\r'
|
|
1113 || c == '\t'
|
|
1114 || c == '\n' )
|
2502
|
1115 {
|
2532
|
1116 switch ( c )
|
2502
|
1117 {
|
2532
|
1118 case '\t':
|
|
1119 strncpy(Dest, &string_base[v14 + 1], 3);
|
|
1120 Dest[3] = 0;
|
|
1121 v14 += 3;
|
|
1122 left_margin = atoi(Dest);
|
|
1123 out_x = uX + uFrameX + left_margin;
|
|
1124 break;
|
|
1125 case '\n':
|
|
1126 uY = uY + LOBYTE(font->uFontHeight) - 3;
|
|
1127 out_y = uY + uFrameY;
|
|
1128 out_x = uX + uFrameX + left_margin;
|
|
1129 if ( max_text_height != 0 )
|
2502
|
1130 {
|
2532
|
1131 if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height )
|
|
1132 return;
|
|
1133 }
|
|
1134 break;
|
|
1135 case '\f':
|
|
1136 strncpy(Dest, &string_base[v14 + 1], 5);
|
|
1137 Dest[5] = 0;
|
|
1138 uFontColor = atoi(Dest);
|
|
1139 v14 += 5;
|
|
1140 break;
|
|
1141 case '\r':
|
|
1142 strncpy(Dest, &string_base[v14 + 1], 3);
|
|
1143 Dest[3] = 0;
|
|
1144 v14 += 3;
|
|
1145 left_margin = atoi(Dest);
|
|
1146 out_x = uFrameZ - font->GetLineWidth(&string_base[v14]) - left_margin;
|
|
1147 out_y = uY + uFrameY;
|
|
1148 if ( max_text_height != 0 )
|
|
1149 {
|
|
1150 if (LOBYTE(font->uFontHeight) + out_y - 3 > max_text_height )
|
|
1151 return;
|
|
1152 break;
|
|
1153 }
|
|
1154 break;
|
2529
|
1155
|
2532
|
1156 default:
|
|
1157 if (c == '\"' && string_base[v14 + 1] == '\"')
|
|
1158 ++v14;
|
2529
|
1159
|
2532
|
1160 c = (unsigned __int8)string_base[v14];
|
|
1161 if ( v14 > 0 )
|
|
1162 out_x += font->pMetrics[c].uLeftSpacing;
|
2529
|
1163
|
2532
|
1164 unsigned char *letter_pixels = &font->pFontData[font->font_pixels_offset[c]];
|
|
1165 if ( uFontColor )
|
|
1166 pRenderer->DrawText(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight),
|
|
1167 font->pFontPalettes[0], uFontColor, uFontShadowColor);
|
|
1168 else
|
|
1169 pRenderer->DrawTextAlpha(out_x, out_y, letter_pixels, font->pMetrics[c].uWidth, LOBYTE(font->uFontHeight),
|
|
1170 font->pFontPalettes[0], present_time_transparency);
|
2529
|
1171
|
2532
|
1172 out_x += font->pMetrics[c].uWidth;
|
|
1173 if ( (signed int)v14 < (signed int)v30 )
|
|
1174 out_x += font->pMetrics[c].uRightSpacing;
|
|
1175 break;
|
2502
|
1176 }
|
|
1177 }
|
|
1178 }
|
2532
|
1179 while ( (signed int)++v14 < (signed int)v30 );
|
|
1180 }
|
2502
|
1181 }
|
|
1182
|
|
1183 //----- (0044CB4F) --------------------------------------------------------
|
|
1184 int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text )
|
|
1185 {
|
|
1186 int pLineWidth; // ebx@1
|
|
1187 int text_width; // esi@3
|
|
1188 unsigned __int8 v12; // cl@7
|
|
1189 signed int v13; // esi@19
|
|
1190 signed int v14; // ebx@19
|
|
1191 unsigned __int8 v15; // cl@21
|
|
1192 // int v16; // eax@22
|
|
1193 // int v17; // ecx@22
|
|
1194 // int v18; // ecx@23
|
|
1195 // int v19; // ecx@24
|
|
1196 unsigned int v20; // ecx@26
|
|
1197 unsigned char* v21; // eax@28
|
|
1198 // int v22; // ebx@34
|
|
1199 int v23; // eax@34
|
|
1200 int v24; // ebx@36
|
|
1201 char Str[6]; // [sp+Ch] [bp-20h]@34
|
|
1202 // char v26; // [sp+Fh] [bp-1Dh]@34
|
|
1203 // char v27; // [sp+11h] [bp-1Bh]@35
|
|
1204 int v28; // [sp+20h] [bp-Ch]@17
|
|
1205 GUIWindow *pWindow; // [sp+24h] [bp-8h]@1
|
|
1206 size_t pNumLen; // [sp+28h] [bp-4h]@1
|
|
1207 size_t Str1a; // [sp+40h] [bp+14h]@5
|
|
1208 // size_t Str1b; // [sp+40h] [bp+14h]@19
|
|
1209 // const char *Sourcea; // [sp+44h] [bp+18h]@20
|
|
1210 // int v34; // [sp+48h] [bp+1Ch]@26
|
|
1211 int i;
|
|
1212
|
|
1213
|
|
1214 pWindow = this;
|
|
1215 pNumLen = strlen(text);
|
|
1216 pLineWidth = pFont->GetLineWidth(text);
|
|
1217 if ( pLineWidth < rect_width )
|
|
1218 {
|
|
1219 pWindow->DrawText(pFont, uX, uY, uColor, text, 0, 0, 0);
|
|
1220 return pLineWidth;
|
|
1221 }
|
|
1222 strcpy(pTmpBuf2.data(), text);
|
|
1223 text_width = 0;
|
|
1224 if ( reverse_text )
|
|
1225 _strrev(pTmpBuf2.data());
|
|
1226 Str1a = 0;
|
|
1227 for ( i = 0; i < pNumLen; ++i )
|
|
1228 {
|
|
1229 if ( text_width >= rect_width )
|
|
1230 break;
|
|
1231 v12 = pTmpBuf2[i];
|
|
1232 if ( pFont->IsCharValid(v12) )
|
|
1233 {
|
|
1234 switch (v12)
|
|
1235 {
|
|
1236 case '\t':// Horizontal tab 09
|
|
1237 case '\n': //Line Feed 0A 10
|
|
1238 case '\r': //Form Feed, page eject 0C 12
|
|
1239 break;
|
|
1240 case '\f': //Carriage Return 0D 13
|
|
1241 i += 5;
|
|
1242 break;
|
|
1243 default:
|
|
1244 if ( i > 0 )
|
|
1245 text_width += pFont->pMetrics[v12].uLeftSpacing;
|
|
1246 text_width += pFont->pMetrics[v12].uWidth;
|
|
1247 if ( i < pNumLen )
|
|
1248 text_width += pFont->pMetrics[v12].uRightSpacing;
|
|
1249 }
|
|
1250 }
|
|
1251 }
|
|
1252 pTmpBuf2[i - 1] = 0;
|
|
1253
|
|
1254
|
|
1255 pNumLen = strlen(pTmpBuf2.data());
|
|
1256 v28 = pFont->GetLineWidth(pTmpBuf2.data());
|
|
1257 if ( reverse_text )
|
|
1258 _strrev(pTmpBuf2.data());
|
|
1259
|
|
1260 v13 = uX + pWindow->uFrameX;
|
|
1261 v14 = uY + pWindow->uFrameY;
|
|
1262 for (i=0; i<pNumLen; ++i)
|
|
1263 {
|
|
1264 v15 = pTmpBuf2[i];
|
|
1265 if ( pFont->IsCharValid(v15) )
|
|
1266 {
|
|
1267 switch (v12)
|
|
1268 {
|
|
1269 case '\t':// Horizontal tab 09
|
|
1270 {
|
|
1271 strncpy(Str, &pTmpBuf2[i+1], 3);
|
|
1272 Str[3] = 0;
|
|
1273 // atoi(Str);
|
|
1274 i += 3;
|
|
1275 break;
|
|
1276 }
|
|
1277 case '\n': //Line Feed 0A 10
|
|
1278 {
|
|
1279 v24 = pFont->uFontHeight;
|
|
1280 v13 = uX;
|
|
1281 uY = uY + pFont->uFontHeight - 3;
|
|
1282 v14 = uY+pFont->uFontHeight - 3;
|
|
1283 break;
|
|
1284 }
|
|
1285 case '\r': //Form Feed, page eject 0C 12
|
|
1286 {
|
|
1287 strncpy(Str, &pTmpBuf2[i+1], 5);
|
|
1288 Str[5] = 0;
|
|
1289 i += 5;
|
|
1290 uColor = atoi(Str);
|
|
1291 break;
|
|
1292 }
|
|
1293 case '\f': //Carriage Return 0D 13
|
|
1294 {
|
|
1295 strncpy(Str, &pTmpBuf2[i+1], 3);
|
|
1296 Str[3] = 0;
|
|
1297 i += 3;
|
|
1298 v23 = pFont->GetLineWidth(&pTmpBuf2[i]);
|
|
1299 v13 = pWindow->uFrameZ - v23 - atoi(Str);
|
|
1300 v14 = uY;
|
|
1301 break;
|
|
1302 }
|
|
1303 default:
|
|
1304 v20 = pFont->pMetrics[v15].uWidth;
|
|
1305 if ( i > 0 )
|
|
1306 v13 += pFont->pMetrics[v15].uLeftSpacing;
|
|
1307 v21 = &pFont->pFontData[pFont->font_pixels_offset[v15]];
|
|
1308 if ( uColor )
|
|
1309 pRenderer->DrawText(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], uColor, 0);
|
|
1310 else
|
2525
|
1311 pRenderer->DrawTextAlpha(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], false);
|
2502
|
1312 v13 += v20;
|
|
1313 if ( i < (signed int)pNumLen )
|
|
1314 v13 += pFont->pMetrics[v15].uRightSpacing;
|
|
1315 }
|
|
1316 }
|
|
1317 }
|
|
1318 return v28;
|
|
1319 }
|
|
1320
|
|
1321 //----- (0041D12F) --------------------------------------------------------
|
|
1322 GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight,
|
|
1323 int a6, int a7, UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...)
|
|
1324 {
|
|
1325 GUIButton *pButton; // esi@1
|
|
1326 // unsigned int v13; // eax@1
|
|
1327 // unsigned int v14; // ebx@4
|
|
1328 // unsigned int v15; // eax@4
|
|
1329 unsigned int TextureNum=0; // ebx@4
|
|
1330 // unsigned int v17; // eax@4
|
|
1331 // Texture *v18; // eax@4
|
|
1332 // Texture **v19; // ecx@5
|
|
1333 // Texture **v20; // edx@5
|
|
1334 // GUIButton *v21; // eax@7
|
|
1335 va_list texturs_ptr;
|
|
1336
|
|
1337 pButton = (GUIButton *)malloc(0xBC);
|
|
1338 pButton->pParent = this;
|
|
1339 pButton->uWidth = uWidth;
|
|
1340 pButton->uHeight = uHeight;
|
|
1341
|
|
1342 if ( a6 == 2 && !uHeight )
|
|
1343 pButton->uHeight = uWidth;
|
|
1344
|
|
1345 pButton->uButtonType = a6;
|
|
1346 pButton->uX = uX + this->uFrameX;
|
|
1347 pButton->uY = uY + this->uFrameY;
|
|
1348 pButton->uZ = pButton->uX + uWidth - 1;
|
|
1349 pButton->uW = pButton->uY + uHeight - 1;
|
|
1350 pButton->field_2C_is_pushed = 0;
|
|
1351 pButton->field_1C = a7;
|
|
1352 pButton->msg = msg;
|
|
1353 pButton->msg_param = msg_param;
|
|
1354 pButton->uHotkey = uHotkey;
|
|
1355 //strlen(pName);
|
|
1356 strcpy(pButton->pButtonName, pName);
|
|
1357 va_start(texturs_ptr, pName);
|
|
1358 while (NULL!=(pTextures=va_arg(texturs_ptr, Texture *)))
|
|
1359 {
|
|
1360 pButton->pTextures[TextureNum]=pTextures;
|
|
1361 ++TextureNum;
|
|
1362 }
|
|
1363 va_end(texturs_ptr);
|
|
1364 pButton->uNumTextures = TextureNum;
|
|
1365 if ( this->pControlsTail )
|
|
1366 this->pControlsTail->pNext = pButton;
|
|
1367 else
|
|
1368 this->pControlsHead = pButton;
|
|
1369 pButton->pPrev = this->pControlsTail;
|
|
1370 this->pControlsTail = pButton;
|
|
1371 pButton->pNext = 0;
|
|
1372 ++this->uNumControls;
|
|
1373 return pButton;
|
|
1374 }
|
|
1375
|
|
1376 //----- (00459C2B) --------------------------------------------------------
|
|
1377 void GUIWindow::DrawFlashingInputCursor( signed int uX, int uY, struct GUIFont *a2 )
|
|
1378 {
|
|
1379 if ( GetTickCount() % 1000 > 500 )
|
|
1380 DrawText(a2, uX, uY, 0, "_", 0, 0, 0);
|
|
1381 }
|
|
1382
|
|
1383 //----- (0041C432) --------------------------------------------------------
|
|
1384 GUIWindow * GUIWindow::Create( unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eWindowType, int pButton, const char* hint )
|
|
1385 {
|
|
1386 unsigned int uNextFreeWindowID; // ebp@1
|
|
1387 //int *v8; // eax@1
|
|
1388 //GUIWindow *pWindow; // esi@4
|
|
1389 //int v10; // eax@4
|
|
1390 unsigned int v11; // ebx@15
|
|
1391 NPCData *speakingNPC; // ebp@15
|
|
1392 int v14; // eax@20
|
|
1393 int v16; // eax@25
|
|
1394 int v18; // eax@30
|
|
1395 int v20; // eax@35
|
|
1396 int v22; // eax@40
|
|
1397 int v24; // eax@45
|
|
1398 // int v25; // eax@65
|
|
1399 unsigned int v26; // ebx@65
|
|
1400 char *v27; // eax@71
|
|
1401 const char *v29; // [sp-8h] [bp-18h]@68
|
|
1402 char *v30; // [sp-4h] [bp-14h]@68
|
|
1403 // int uWidtha; // [sp+14h] [bp+4h]@66
|
|
1404 int num_menu_buttons; // [sp+20h] [bp+10h]@15
|
|
1405
|
|
1406 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID)
|
|
1407 {
|
|
1408 if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null)
|
|
1409 break;
|
|
1410 }
|
|
1411
|
|
1412 GUIWindow* pWindow = &pWindowList[uNextFreeWindowID];
|
|
1413 pWindow->uFrameWidth = uWidth;
|
|
1414 pWindow->uFrameHeight = uHeight;
|
|
1415
|
|
1416 pWindow->uFrameX = uX;
|
|
1417 pWindow->uFrameY = uY;
|
|
1418 pWindow->uFrameZ = uX + uWidth - 1;
|
|
1419 pWindow->uFrameW = uY + uHeight - 1;
|
|
1420
|
|
1421 pWindow->ptr_1C = (void *)pButton;
|
|
1422 pWindow->Hint = hint;
|
|
1423
|
|
1424 pWindow->eWindowType = eWindowType;
|
|
1425 pWindow->receives_keyboard_input = false;
|
|
1426 ++uNumVisibleWindows;
|
|
1427 pWindow->numVisibleWindows = uNumVisibleWindows;
|
|
1428 pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1;
|
|
1429 if ( (signed int)eWindowType <= 20 )
|
|
1430 {
|
|
1431 if (eWindowType != WINDOW_Chest)
|
|
1432 {
|
|
1433 switch (eWindowType)
|
|
1434 {
|
|
1435 case WINDOW_Book: {
|
|
1436 pWindow->InitializeBookView();
|
|
1437 break;
|
|
1438 }
|
|
1439 case WINDOW_Dialogue: {
|
2541
|
1440 prev_screen_type = current_screen_type;
|
|
1441 current_screen_type = SCREEN_NPC_DIALOGUE;
|
2502
|
1442 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit"
|
|
1443 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
1444 if ( pWindow->par1C != 1 )
|
|
1445 {
|
|
1446 num_menu_buttons = 0;
|
|
1447 v11 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
|
1448 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
|
|
1449 if ( GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1 )//QuestsNPC_greet
|
|
1450 {
|
|
1451 if ( speakingNPC->joins )
|
|
1452 {
|
|
1453 pWindow->CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0);
|
|
1454 num_menu_buttons = 1;
|
|
1455 }
|
|
1456 if ( speakingNPC->evt_A )
|
|
1457 {
|
|
1458 if ( num_menu_buttons < 4 )
|
|
1459 {
|
|
1460 v14 = NPC_EventProcessor(speakingNPC->evt_A);
|
|
1461 if ( v14 == 1 || v14 == 2 )
|
|
1462 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0);
|
|
1463 }
|
|
1464 }
|
|
1465 if ( speakingNPC->evt_B )
|
|
1466 {
|
|
1467 if ( num_menu_buttons < 4 )
|
|
1468 {
|
|
1469 v16 = NPC_EventProcessor(speakingNPC->evt_B);
|
|
1470 if ( v16 == 1 || v16 == 2 )
|
|
1471 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0);
|
|
1472 }
|
|
1473 }
|
|
1474 if ( speakingNPC->evt_C )
|
|
1475 {
|
|
1476 if ( num_menu_buttons < 4 )
|
|
1477 {
|
|
1478 v18 = NPC_EventProcessor(speakingNPC->evt_C);
|
|
1479 if ( v18 == 1 || v18 == 2 )
|
|
1480 pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0);
|
|
1481 }
|
|
1482 }
|
|
1483 if ( speakingNPC->evt_D )
|
|
1484 {
|
|
1485 if ( num_menu_buttons < 4 )
|
|
1486 {
|
|
1487 v20 = NPC_EventProcessor(speakingNPC->evt_D);
|
|
1488 if ( v20 == 1 || v20 == 2 )
|
|
1489 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0);
|
|
1490 }
|
|
1491 }
|
|
1492 if ( speakingNPC->evt_E )
|
|
1493 {
|
|
1494 if ( num_menu_buttons < 4 )
|
|
1495 {
|
|
1496 v22 = NPC_EventProcessor(speakingNPC->evt_E);
|
|
1497 if ( v22 == 1 || v22 == 2 )
|
|
1498 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0);
|
|
1499 }
|
|
1500 }
|
|
1501 if (speakingNPC->evt_F )
|
|
1502 {
|
|
1503 if ( num_menu_buttons < 4 )
|
|
1504 {
|
|
1505 v24 = NPC_EventProcessor(speakingNPC->evt_F);
|
|
1506 if ( v24 == 1 || v24 == 2 )
|
|
1507 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0);
|
|
1508 }
|
|
1509 }
|
|
1510 }
|
|
1511 else
|
|
1512 {
|
|
1513 if ( speakingNPC->joins )
|
|
1514 {
|
|
1515 pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее
|
|
1516 if (speakingNPC->Hired())
|
|
1517 {
|
|
1518 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить
|
|
1519 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0);
|
|
1520 }
|
|
1521 else
|
|
1522 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять
|
|
1523 num_menu_buttons = 2;
|
|
1524 }
|
|
1525 }
|
|
1526 pWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1);
|
|
1527 }
|
|
1528 break;
|
|
1529 }
|
|
1530 case WINDOW_ChangeLocation:
|
|
1531 {
|
2541
|
1532 prev_screen_type = current_screen_type;
|
|
1533 current_screen_type = SCREEN_CHANGE_LOCATION;
|
2502
|
1534 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);//Остаться в этой области
|
|
1535 pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
|
|
1536 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0);
|
|
1537 pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0);
|
|
1538 break;
|
|
1539 }
|
|
1540 case WINDOW_SpellBook: {// окно книги заклов
|
|
1541 InitializeBookTextures();
|
|
1542 pWindow->OpenSpellBook();
|
|
1543 break;
|
|
1544 }
|
|
1545 case WINDOW_GreetingNPC: {// окно приветствия НПС
|
2541
|
1546 prev_screen_type = current_screen_type;
|
2502
|
1547 pKeyActionMap->EnterText(0, 15, pWindow);
|
2541
|
1548 current_screen_type = SCREEN_BRANCHLESS_NPC_DIALOG;
|
2502
|
1549 break;
|
|
1550 }
|
|
1551
|
|
1552 }
|
|
1553 return pWindow;
|
|
1554 }
|
|
1555 //LABEL_62:
|
|
1556 pWindow->CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
|
|
1557 pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
|
|
1558 pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
|
|
1559 pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
|
|
1560 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9, "", 0);
|
|
1561 return pWindow;
|
|
1562 }
|
|
1563 if (eWindowType == WINDOW_HouseInterior)
|
|
1564 {
|
2541
|
1565 current_screen_type = SCREEN_HOUSE;
|
2502
|
1566 pBtn_ExitCancel = pWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания
|
|
1567 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
1568 for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 )
|
|
1569 {
|
|
1570 if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
1571 {
|
|
1572 v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
|
|
1573 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];
|
|
1574 }
|
|
1575 else
|
|
1576 {
|
|
1577 if ( v26 || !dword_591080 )
|
|
1578 v27 = HouseNPCData[v26 +1 - ((dword_591080 != 0)? 1:0)]->pName;
|
|
1579 else
|
|
1580 v27 = (char*)p2DEvents[pButton - 1].pProprieterName;
|
|
1581 v30 = v27;
|
|
1582 v29 = (char*)pGlobalTXT_LocalizationStrings[435];
|
|
1583 }
|
|
1584 sprintfex(byte_591180[v26].data(), v29, v30);
|
|
1585 HouseNPCPortraitsButtonsList[v26] = pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
|
|
1586 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26],
|
|
1587 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0);
|
|
1588 }
|
|
1589 if ( uNumDialogueNPCPortraits == 1 )
|
|
1590 {
|
|
1591 window_SpeakInHouse = &pWindowList[uNextFreeWindowID];
|
|
1592 _4B4224_UpdateNPCTopics(0);
|
|
1593 }
|
|
1594 }
|
|
1595 else
|
|
1596 {
|
|
1597 if (eWindowType == WINDOW_Transition)
|
|
1598 {
|
2541
|
1599 prev_screen_type = current_screen_type;
|
|
1600 current_screen_type = SCREEN_INPUT_BLV;
|
2502
|
1601 pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Отмена
|
|
1602 pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
|
|
1603 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0);
|
|
1604 pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0);
|
|
1605 return pWindow;
|
|
1606 }
|
|
1607 if (eWindowType == WINDOW_CastSpell)
|
|
1608 {
|
|
1609 pEventTimer->Pause();
|
|
1610 pAudioPlayer->StopChannels(-1, -1);
|
|
1611 pMouse->SetCursorBitmap("MICON2");
|
|
1612 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u);//Выберите цель
|
|
1613 return pWindow;
|
|
1614 }
|
|
1615 if (eWindowType == WINDOW_Scroll)
|
|
1616 {
|
|
1617 pWindow->CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
|
|
1618 pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
|
|
1619 pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
|
|
1620 pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
|
|
1621 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0);
|
|
1622 return pWindow;
|
|
1623 }
|
|
1624 if (eWindowType == WINDOW_CastSpell_InInventory)
|
|
1625 {
|
|
1626 pMouse->SetCursorBitmap("MICON2");
|
|
1627 pBtn_ExitCancel = pWindow->CreateButton(392, 318, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена
|
|
1628 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
|
|
1629 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Выбрать цель
|
|
1630 ++pIcons_LOD->uTexturePacksCount;
|
|
1631 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
|
2541
|
1632 current_screen_type = SCREEN_CASTING;
|
2502
|
1633 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
1634 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
1635 }
|
|
1636 }
|
|
1637 return pWindow;
|
|
1638 }
|
|
1639 //----- (004B3EF0) --------------------------------------------------------
|
|
1640 void DrawJoinGuildWindow( int pEventCode )
|
|
1641 {
|
|
1642 uDialogueType = 81;//enum JoinGuildDialog
|
|
1643 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText;
|
|
1644 ContractSelectText(pEventCode);
|
|
1645 pDialogueWindow->Release();
|
|
1646 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, pEventCode, 0);
|
|
1647 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel
|
|
1648 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
|
|
1649 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
|
|
1650 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
|
|
1651 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
|
|
1652 }
|
|
1653 //----- (0044603D) --------------------------------------------------------
|
|
1654 void DialogueEnding()
|
|
1655 {
|
|
1656 sDialogue_SpeakingActorNPC_ID = 0;
|
|
1657 pDialogueWindow->Release();
|
|
1658 pDialogueWindow = 0;
|
|
1659 pMiscTimer->Resume();
|
|
1660 pEventTimer->Resume();
|
|
1661 }
|
|
1662 //----- (004156F0) --------------------------------------------------------
|
|
1663 void GUI_UpdateWindows()
|
|
1664 {
|
|
1665 GUIWindow *pWindow; // esi@4
|
|
1666 //unsigned int pWindowType; // eax@4
|
|
1667 const char *pHint; // edx@66
|
|
1668 // GUIButton *pButtonPtr_1C; // ebp@79
|
|
1669 // char *pHint1; // edx@80
|
|
1670 int v26; // eax@98
|
|
1671 unsigned int v27; // ebp@106
|
|
1672 GUIWindow *pGUIWindow2; // ecx@109
|
|
1673 // GUIFont *pGUIFont; // ST1C_4@115
|
|
1674 int v31; // eax@115
|
|
1675 GUIButton *pButton; // ebp@118
|
|
1676 int v39; // eax@129
|
|
1677 unsigned int pNumMessages; // eax@142
|
|
1678 GUIButton *pGUIButton; // ebp@146
|
|
1679 //unsigned int pX; // [sp-1Ch] [bp-124h]@17
|
|
1680 //unsigned int pY; // [sp-18h] [bp-120h]@17
|
|
1681 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17
|
|
1682 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86
|
|
1683 int i; // [sp+0h] [bp-108h]@3
|
|
1684 // ItemGen pItemGen; // [sp+4h] [bp-104h]@98
|
|
1685 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133
|
|
1686 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129
|
|
1687
|
|
1688 if (GetCurrentMenuID() != MENU_CREATEPARTY)
|
|
1689 Mouse::UI_OnKeyDown(VK_NEXT);
|
|
1690
|
|
1691 for ( i = 1; i <= uNumVisibleWindows; ++i )
|
|
1692 {
|
|
1693 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
|
|
1694 switch (pWindow->eWindowType)
|
|
1695 {
|
2542
|
1696 case WINDOW_GameMenu:
|
2502
|
1697 {
|
|
1698 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y,
|
|
1699 pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options));
|
|
1700 viewparams->bRedrawGameUI = 1;
|
|
1701 continue;
|
|
1702 }
|
|
1703 case WINDOW_CharacterRecord:
|
|
1704 {
|
|
1705 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
|
|
1706 continue;
|
|
1707 }
|
|
1708 case WINDOW_Options:
|
|
1709 {
|
|
1710 GameMenuUI_Options_Draw();
|
|
1711 continue;
|
|
1712 }
|
|
1713 case WINDOW_Book:
|
|
1714 {
|
|
1715 BookUI_Draw((WindowType)(int)pWindow->ptr_1C);
|
|
1716 continue;
|
|
1717 }
|
|
1718 case WINDOW_Dialogue:
|
|
1719 {
|
|
1720 GameUI_DrawDialogue();
|
|
1721 continue;
|
|
1722 }
|
|
1723 case WINDOW_QuickReference:
|
|
1724 {
|
|
1725 GameUI_QuickRef_Draw();
|
|
1726 continue;
|
|
1727 }
|
|
1728 case WINDOW_Rest:
|
|
1729 {
|
|
1730 RestUI_Draw();
|
|
1731 continue;
|
|
1732 }
|
|
1733 case WINDOW_ChangeLocation:
|
|
1734 {
|
|
1735 TravelUI_Draw();
|
|
1736 continue;
|
|
1737 }
|
|
1738 case WINDOW_SpellBook:
|
|
1739 {
|
|
1740 DrawSpellBookContent(pPlayers[uActiveCharacter]);
|
|
1741 continue;
|
|
1742 }
|
|
1743 case WINDOW_GreetingNPC:
|
|
1744 {
|
|
1745 GameUI_DrawBranchlessDialogue();
|
|
1746 continue;
|
|
1747 }
|
|
1748 case WINDOW_Chest:
|
|
1749 {
|
2541
|
1750 if ( current_screen_type == SCREEN_CHEST )
|
2502
|
1751 {
|
|
1752 Chest::DrawChestUI(pWindow->par1C);
|
|
1753 }
|
2541
|
1754 else if ( current_screen_type == SCREEN_CHEST_INVENTORY )
|
2502
|
1755 {
|
|
1756 pRenderer->ClearZBuffer(0, 479);
|
|
1757 draw_leather();
|
|
1758 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
1759 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId));
|
|
1760 }
|
|
1761 continue;
|
|
1762 }
|
|
1763 case WINDOW_SaveLoadButtons:
|
|
1764 {
|
|
1765 SaveUI_Draw();
|
|
1766 continue;
|
|
1767 }
|
|
1768 case WINDOW_MainMenu_Load:
|
|
1769 {
|
|
1770 LoadUI_Draw();
|
|
1771 continue;
|
|
1772 }
|
|
1773 case WINDOW_HouseInterior:
|
|
1774 {
|
|
1775 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager();
|
|
1776 if ( !window_SpeakInHouse )
|
|
1777 continue;
|
|
1778 if ( window_SpeakInHouse->par1C >= 53 )
|
|
1779 continue;
|
|
1780 if ( pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] <=pParty->uTimePlayed )
|
|
1781 {
|
|
1782 if ( window_SpeakInHouse->par1C < 53 )
|
|
1783 pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] = 0;
|
|
1784 continue;
|
|
1785 }
|
|
1786 pNumMessages = pMessageQueue_50CBD0->uNumMessages;
|
|
1787 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
1788 continue;
|
|
1789 }
|
|
1790 case WINDOW_Transition:
|
|
1791 {
|
|
1792 TransitionUI_Draw();
|
|
1793 continue;
|
|
1794 }
|
|
1795 case WINDOW_Scroll:
|
|
1796 {
|
|
1797 CreateScrollWindow();
|
|
1798 continue;
|
|
1799 }
|
|
1800 case WINDOW_CastSpell_InInventory:
|
|
1801 {
|
|
1802 pRenderer->ClearZBuffer(0, 479);
|
|
1803 draw_leather();
|
|
1804 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
1805 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]);
|
2524
|
1806 pRenderer->DrawTextureIndexedAlpha(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u));
|
2502
|
1807 continue;
|
|
1808 }
|
|
1809 case WINDOW_ModalWindow:
|
|
1810 {
|
|
1811 ModalWindow_ShowHint();
|
|
1812 continue;
|
|
1813 }
|
|
1814 case WINDOW_50:
|
|
1815 {
|
|
1816 v27 = Color16(255, 255, 255);
|
|
1817 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
|
|
1818 {
|
|
1819 ptr_507BD0->DrawMessageBox(0);
|
|
1820 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
|
|
1821 v31 = pFontCreate->GetLineWidth(pKeyActionMap->pPressedKeysBuffer);
|
|
1822 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate);
|
|
1823 continue;
|
|
1824 }
|
|
1825 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
|
|
1826 {
|
|
1827 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
1828 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0);
|
|
1829 pEventTimer->Resume();
|
|
1830 ptr_507BD0->Release();
|
2541
|
1831 current_screen_type = SCREEN_GAME;
|
2502
|
1832 viewparams->bRedrawGameUI = true;
|
|
1833 continue;
|
|
1834 }
|
|
1835 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
|
|
1836 {
|
|
1837 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
1838 pEventTimer->Resume();
|
|
1839 ptr_507BD0->Release();
|
|
1840 continue;
|
|
1841 }
|
|
1842 }
|
|
1843 case WINDOW_59:
|
|
1844 {
|
|
1845 pWindow->DrawMessageBox(0);
|
|
1846 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
|
|
1847 pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
|
|
1848 if ( !pKeyActionMap->field_204 )
|
|
1849 {
|
|
1850 ItemGen2.Reset();
|
|
1851 pWindow->Release();
|
|
1852 pEventTimer->Resume();
|
2541
|
1853 current_screen_type = SCREEN_GAME;
|
2502
|
1854 viewparams->bRedrawGameUI = true;
|
|
1855 v26 = atoi(pKeyActionMap->pPressedKeysBuffer);
|
|
1856 if ( v26 > 0 )
|
|
1857 {
|
|
1858 if ( v26 < 800 )
|
|
1859 {
|
|
1860 ItemGen2.uAttributes |= 1;
|
|
1861 ItemGen2.uItemID = v26;
|
|
1862 if ( pItemsTable->pItems[v26].uEquipType == 12 )
|
|
1863 {
|
|
1864 ItemGen2.uNumCharges = rand() % 6 + ItemGen2.GetDamageMod() + 1;
|
|
1865 ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges);
|
|
1866 }
|
|
1867 else
|
|
1868 {
|
|
1869 if ( v26 >= 221 && v26 < 271 )
|
|
1870 ItemGen2.uEnchantmentType = rand() % 10 + 1;
|
|
1871 }
|
|
1872 pItemsTable->SetSpecialBonus(&ItemGen2);
|
|
1873 pParty->SetHoldingItem(&ItemGen2);
|
|
1874 }
|
|
1875 }
|
|
1876 }
|
|
1877 continue;
|
|
1878 }
|
|
1879 case WINDOW_PressedButton2:
|
|
1880 {
|
|
1881 if ( pWindow->Hint != (char *)1 )
|
2506
|
1882 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
1883 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1884 if ( pButton->uX >= 0 && pButton->uX <= window->GetWidth() )
|
|
1885 {
|
|
1886 if ( pButton->uY >= 0 && pButton->uY <= window->GetHeight() )
|
|
1887 {
|
|
1888 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
|
|
1889 viewparams->bRedrawGameUI = 1;
|
|
1890 if ( pWindow->Hint )
|
|
1891 {
|
|
1892 if ( pWindow->Hint != (char *)1 )
|
|
1893 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1894 }
|
|
1895 pWindow->Release();
|
|
1896 continue;
|
|
1897 }
|
|
1898 }
|
|
1899 viewparams->bRedrawGameUI = 1;
|
|
1900 if ( pWindow->Hint )
|
|
1901 {
|
|
1902 if ( pWindow->Hint != (char *)1 )
|
|
1903 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1904 }
|
|
1905 pWindow->Release();
|
|
1906 continue;
|
|
1907 }
|
|
1908 case WINDOW_CharactersPressedButton:
|
|
1909 {
|
|
1910 if ( pWindow->Hint != (char *)1 )
|
2506
|
1911 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
1912 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1913 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
|
|
1914 viewparams->bRedrawGameUI = 1;
|
|
1915 if ( pWindow->Hint )
|
|
1916 {
|
|
1917 if ( pWindow->Hint != (char *)1 )
|
|
1918 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1919 }
|
|
1920 pWindow->Release();
|
|
1921 continue;
|
|
1922 }
|
|
1923 case WINDOW_PressedButton:
|
|
1924 {
|
|
1925 if ( pWindow->Hint != (char *)1 )
|
2506
|
1926 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
1927 pButton = (GUIButton *)pWindow->ptr_1C;
|
2524
|
1928 pRenderer->DrawTextureIndexedAlpha(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
|
2502
|
1929 viewparams->bRedrawGameUI = 1;
|
|
1930 if ( pWindow->Hint )
|
|
1931 {
|
|
1932 if ( pWindow->Hint != (char *)1 )
|
|
1933 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1934 }
|
|
1935 pWindow->Release();
|
|
1936 continue;
|
|
1937 }
|
|
1938 case WINDOW_5D:
|
|
1939 {
|
|
1940 if ( pWindow->Hint != (char *)1 )
|
2506
|
1941 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
1942 pButton = (GUIButton *)pWindow->ptr_1C;
|
2524
|
1943 pRenderer->DrawTextureIndexedAlpha(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
|
2502
|
1944 viewparams->bRedrawGameUI = 1;
|
|
1945 pWindow->Release();
|
|
1946 continue;
|
|
1947 }
|
|
1948 case WINDOW_SaveLoadBtn:
|
|
1949 {
|
|
1950 if (pWindow->Hint != (char *)1)
|
2506
|
1951 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
1952 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1953 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
|
|
1954 pHint = pWindow->Hint;
|
|
1955 viewparams->bRedrawGameUI = 1;
|
|
1956 if ( pHint && pHint != (char *)1 )
|
|
1957 pButton->DrawLabel(pHint, pFontCreate, 0, 0);
|
|
1958 pWindow->Release();
|
2541
|
1959 if (current_screen_type == SCREEN_SAVEGAME)
|
2502
|
1960 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0);
|
|
1961 else
|
|
1962 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
|
|
1963 continue;
|
|
1964 }
|
|
1965 case WINDOW_LoadGame_CancelBtn:
|
|
1966 {
|
|
1967 if ( pWindow->Hint != (char *)1 )
|
2506
|
1968 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
1969 pButton = (GUIButton *)pWindow->ptr_1C;
|
2524
|
1970 pRenderer->DrawTextureIndexedAlpha(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
|
2502
|
1971 viewparams->bRedrawGameUI = 1;
|
|
1972 if ( pWindow->Hint && pWindow->Hint != (char *)1 )
|
|
1973 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1974 pWindow->Release();
|
|
1975 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
1976 continue;
|
|
1977 }
|
|
1978 case WINDOW_CloseRestWindowBtn:
|
|
1979 {
|
|
1980 if ( pWindow->Hint != (char *)1 )
|
2506
|
1981 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
1982 pGUIButton = (GUIButton *)pWindow->ptr_1C;
|
|
1983 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]);
|
|
1984 pHint = pWindow->Hint;
|
|
1985 viewparams->bRedrawGameUI = 1;
|
|
1986 if ( pHint && pHint != (char *)1 )
|
|
1987 pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0);
|
|
1988 pWindow->Release();
|
|
1989 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
1990 continue;
|
|
1991 }
|
|
1992 case WINDOW_ExitCharacterWindow:
|
|
1993 {
|
|
1994 if ( pWindow->Hint != (char *)1 )
|
2506
|
1995 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
1996 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1997 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
|
|
1998 pHint = pWindow->Hint;
|
|
1999 viewparams->bRedrawGameUI = 1;
|
|
2000 if ( pHint && pHint != (char *)1 )
|
|
2001 pButton->DrawLabel(pHint, pFontCreate, 0, 0);
|
|
2002 pWindow->Release();
|
|
2003 pNumMessages = pMessageQueue_50CBD0->uNumMessages;
|
|
2004 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
2005 continue;
|
|
2006 }
|
|
2007 case WINDOW_RestWindow:
|
|
2008 {
|
|
2009 memset(&GUIButton2, 0, 0xBCu);
|
|
2010 GUIButton2.uZ = 197;
|
|
2011 GUIButton2.uW = 197;
|
|
2012 GUIButton2.uX = 27;
|
|
2013 GUIButton2.uY = 161;
|
|
2014 GUIButton2.uWidth = 171;
|
|
2015 GUIButton2.uHeight = 37;
|
|
2016 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent;
|
2506
|
2017 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0);
|
2502
|
2018 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15));
|
|
2019 viewparams->bRedrawGameUI = 1;
|
|
2020 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Отдых и лечение 8 часов
|
|
2021 GUIButton2.pParent = 0;
|
|
2022 pGUIWindow2 = pWindow;
|
|
2023 pGUIWindow2->Release();
|
|
2024 continue;
|
|
2025 }
|
|
2026 case WINDOW_BooksWindow:
|
|
2027 {
|
|
2028 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
2029 pRenderer->DrawTextureIndexed(pWindow->uFrameY,
|
|
2030 pWindow->uFrameX, pButton->pTextures[0]);
|
|
2031 viewparams->bRedrawGameUI = true;
|
|
2032 continue;
|
|
2033 }
|
|
2034 case WINDOW_CharacterWindow_Inventory:
|
|
2035 {
|
|
2036 pWindow->DrawMessageBox(0);
|
|
2037 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
|
|
2038 pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
|
|
2039 if ( !pKeyActionMap->field_204 )
|
|
2040 {
|
|
2041 ItemGen2.Reset();
|
|
2042 pWindow->Release();
|
|
2043 pEventTimer->Resume();
|
2541
|
2044 current_screen_type = SCREEN_GAME;
|
2502
|
2045 viewparams->bRedrawGameUI = 1;
|
|
2046 v39 = atoi(pKeyActionMap->pPressedKeysBuffer);
|
|
2047 if ( v39 > 0 )
|
|
2048 {
|
|
2049 if ( v39 < 800 )
|
|
2050 SpawnActor(v39);
|
|
2051 }
|
|
2052 }
|
|
2053 continue;
|
|
2054 }
|
|
2055 case WINDOW_KeyMappingOptions:
|
|
2056 {
|
|
2057 GameMenuUI_DrawKeyBindings();
|
|
2058 continue;
|
|
2059 }
|
|
2060 case WINDOW_VideoOptions:
|
|
2061 {
|
|
2062 GameMenuUI_DrawVideoOptions();
|
|
2063 continue;
|
|
2064 }
|
|
2065 default:
|
|
2066 continue;
|
|
2067 }
|
|
2068 }
|
|
2069 if ( GetCurrentMenuID() == -1 )
|
|
2070 GameUI_DrawFoodAndGold();
|
|
2071 if ( sub_4637E0_is_there_popup_onscreen() )
|
|
2072 UI_OnMouseRightClick(0);
|
|
2073 }
|
|
2074 //void LoadFonts_and_DrawCopyrightWindow()
|
|
2075 //{
|
|
2076 //MainMenuUI_LoadFontsAndSomeStuff();
|
|
2077 // DrawCopyrightWindow();
|
|
2078 //}
|
|
2079 //----- (00415485) --------------------------------------------------------
|
|
2080 void DrawMM7CopyrightWindow()
|
|
2081 {
|
|
2082 GUIWindow Dst; // [sp+8h] [bp-54h]@1
|
|
2083
|
|
2084 memset(&Dst, 0, sizeof(Dst));
|
|
2085 Dst.uFrameWidth = 624;
|
|
2086 Dst.uFrameHeight = 256;
|
|
2087 Dst.uFrameX = 8;
|
|
2088 Dst.uFrameY = 30; // c 1999 The 3DO Company.
|
|
2089 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0)
|
|
2090 + 2 * LOBYTE(pFontSmallnum->uFontHeight)
|
|
2091 + 24;
|
|
2092 Dst.uFrameY = 470 - Dst.uFrameHeight;
|
|
2093 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
|
|
2094 Dst.uFrameW = 469;
|
|
2095 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef";
|
|
2096 Dst.DrawMessageBox(0);
|
|
2097
|
|
2098 Dst.uFrameWidth -= 24;
|
|
2099 Dst.uFrameX += 12;
|
|
2100 Dst.uFrameY += 12;
|
|
2101 Dst.uFrameHeight -= 12;
|
|
2102 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
|
|
2103 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
|
|
2104 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3);
|
|
2105 }
|
|
2106
|
2541
|
2107 enum CURRENT_SCREEN modal_window_prev_screen_type;
|
2502
|
2108
|
|
2109 //----- (004141CA) --------------------------------------------------------
|
|
2110 void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message)
|
|
2111 {
|
|
2112 pEventTimer->Pause();
|
2541
|
2113 modal_window_prev_screen_type = current_screen_type;
|
2502
|
2114 pModalWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_ModalWindow, OnRelease_message, pStrHint);
|
2541
|
2115 current_screen_type = SCREEN_MODAL_WINDOW;
|
2502
|
2116 }
|
|
2117
|
|
2118 //----- (0041420D) --------------------------------------------------------
|
|
2119 void ModalWindow_ShowHint()
|
|
2120 {
|
|
2121 GUIWindow pWindow; // [sp+4h] [bp-54h]@1
|
|
2122
|
|
2123 sprintf(pTmpBuf2.data(), "%s\n \n%s", pModalWindow->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape
|
|
2124 pWindow.Hint = pTmpBuf2.data();
|
|
2125 pWindow.uFrameWidth = 400;
|
|
2126 pWindow.uFrameHeight = 100;
|
|
2127 pWindow.uFrameX = 120;
|
|
2128 pWindow.uFrameY = 140;
|
|
2129 pWindow.uFrameZ = 519;
|
|
2130 pWindow.uFrameW = 239;
|
|
2131 pWindow.DrawMessageBox(0);
|
|
2132 }
|
|
2133
|
|
2134 //----- (0041426F) --------------------------------------------------------
|
|
2135 void ModalWindow_Release()
|
|
2136 {
|
|
2137 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pModalWindow->par1C, 0, 0);
|
|
2138
|
|
2139 pModalWindow->Release();
|
|
2140 pModalWindow = nullptr;
|
|
2141
|
2541
|
2142 current_screen_type = modal_window_prev_screen_type;
|
2502
|
2143 pEventTimer->Resume();
|
|
2144 }
|
|
2145
|
|
2146 //----- (00467FB6) --------------------------------------------------------
|
|
2147 void CreateScrollWindow()
|
|
2148 {
|
|
2149 unsigned int v0; // eax@1
|
|
2150 char *v1; // ST18_4@3
|
|
2151 GUIWindow a1; // [sp+Ch] [bp-54h]@1
|
|
2152
|
|
2153 memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1));
|
|
2154 a1.Hint = 0;
|
|
2155 a1.uFrameX = 1;
|
|
2156 a1.uFrameY = 1;
|
|
2157 a1.uFrameWidth = 468;
|
|
2158 v0 = pFontSmallnum->CalcTextHeight(pScrolls[pGUIWindow_ScrollWindow->par1C], &a1, 0, 0)
|
|
2159 + 2 * LOBYTE(pFontCreate->uFontHeight) + 24;
|
|
2160 a1.uFrameHeight = v0;
|
|
2161 if ( (signed int)(v0 + a1.uFrameY) > 479 )
|
|
2162 {
|
|
2163 v0 = 479 - a1.uFrameY;
|
|
2164 a1.uFrameHeight = 479 - a1.uFrameY;
|
|
2165 }
|
|
2166 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
|
|
2167 a1.uFrameW = v0 + a1.uFrameY - 1;
|
|
2168 a1.DrawMessageBox(0);
|
|
2169 a1.uFrameX += 12;
|
|
2170 a1.uFrameWidth -= 24;
|
|
2171 a1.uFrameY += 12;
|
|
2172 a1.uFrameHeight -= 12;
|
|
2173 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
|
|
2174 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
|
|
2175 v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName;
|
|
2176 sprintf(pTmpBuf.data(), format_4E2D80, Color16(0xFFu, 0xFFu, 0x9Bu), v1);
|
|
2177 a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3);
|
|
2178 a1.DrawText(pFontSmallnum, 1, LOBYTE(pFontCreate->uFontHeight) - 3, 0,
|
|
2179 pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], 0, 0, 0);
|
|
2180 }
|
|
2181 //----- (00467F48) --------------------------------------------------------
|
|
2182 void CreateMsgScrollWindow( signed int mscroll_id )
|
|
2183 {
|
|
2184 if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 )
|
|
2185 {
|
|
2186 if ( mscroll_id <= 782 )
|
|
2187 {
|
|
2188 uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE);
|
|
2189 pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Scroll, mscroll_id - 700, 0);
|
|
2190 }
|
|
2191 }
|
|
2192 }
|
|
2193 //----- (00467F9F) --------------------------------------------------------
|
|
2194 void free_book_subwindow()
|
|
2195 {
|
|
2196 if ( pGUIWindow_ScrollWindow )
|
|
2197 {
|
|
2198 pGUIWindow_ScrollWindow->Release();
|
|
2199 pGUIWindow_ScrollWindow = 0;
|
|
2200 }
|
|
2201 }
|
|
2202 //----- (004226EF) --------------------------------------------------------
|
|
2203 void SetUserInterface(PartyAlignment align, bool bReplace)
|
|
2204 {
|
|
2205 extern void set_default_ui_skin();
|
|
2206 set_default_ui_skin();
|
|
2207
|
|
2208 if (align == PartyAlignment_Evil)
|
|
2209 {
|
|
2210 if ( bReplace )
|
|
2211 {
|
|
2212 pTexture_RightFrame->Reload("ib-r-C.pcx");
|
|
2213 pTexture_BottomFrame->Reload("ib-b-C.pcx");
|
|
2214 pTexture_TopFrame->Reload("ib-t-C.pcx");
|
|
2215 pTexture_LeftFrame->Reload("ib-l-C.pcx");
|
|
2216 pTexture_StatusBar->Reload("IB-Foot-c.pcx");
|
|
2217 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2);
|
|
2218 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-c", 2);
|
|
2219 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-C", 2);
|
|
2220 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2);
|
|
2221 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2);
|
|
2222 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2);
|
|
2223 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-C", 2);
|
|
2224 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2);
|
|
2225 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2);
|
|
2226 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-C", 2);
|
|
2227 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-C", 2);
|
|
2228 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-c", 2);
|
|
2229 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2);
|
|
2230 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2);
|
|
2231 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-c", 2);
|
|
2232
|
|
2233 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2);
|
|
2234 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2);
|
|
2235 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2);
|
|
2236 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2);
|
|
2237
|
|
2238 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
|
|
2239 pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID);
|
|
2240 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
|
|
2241 pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID);
|
|
2242
|
|
2243 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2);
|
|
2244 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2);
|
|
2245 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-c", 2);
|
|
2246 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
|
|
2247 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2);
|
|
2248 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2);
|
|
2249 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2);
|
|
2250 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2);
|
|
2251 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2);
|
|
2252 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2);
|
|
2253 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2);
|
|
2254 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2);
|
|
2255 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2);
|
|
2256 }
|
|
2257 else
|
|
2258 {
|
|
2259 pTexture_RightFrame->Load("ib-r-C.pcx", 0);
|
|
2260 pTexture_BottomFrame->Load("ib-b-c.pcx", 0);
|
|
2261 pTexture_TopFrame->Load("ib-t-C.pcx", 0);
|
|
2262 pTexture_LeftFrame->Load("ib-l-C.pcx", 0);
|
|
2263 pTexture_StatusBar->Load("IB-Foot-c.pcx", 0);
|
|
2264 uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE);
|
|
2265 uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE);
|
|
2266 uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE);
|
|
2267 dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE);
|
|
2268 dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE);
|
|
2269 dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE);
|
|
2270 uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE);
|
|
2271 uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE);
|
|
2272 uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE);
|
|
2273 uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE);
|
|
2274 uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE);
|
|
2275 uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE);
|
|
2276 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE);
|
|
2277 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE);
|
|
2278 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE);
|
|
2279 uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE);
|
|
2280 uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE);
|
|
2281 uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE);
|
|
2282 uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE);
|
|
2283 uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE);
|
|
2284 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE);
|
|
2285 uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
|
|
2286 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
|
|
2287 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
|
|
2288 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
|
|
2289 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
|
|
2290 }
|
|
2291 uGameUIFontMain = Color16(0xC8u, 0, 0);
|
|
2292 uGameUIFontShadow = Color16(10, 0, 0);
|
|
2293 }
|
|
2294 else if (align == PartyAlignment_Neutral)
|
|
2295 {
|
|
2296 if ( bReplace )
|
|
2297 {
|
|
2298 pTexture_RightFrame->Reload("ib-r-a.pcx");
|
|
2299 pTexture_BottomFrame->Reload("ib-b-a.pcx");
|
|
2300 pTexture_TopFrame->Reload("ib-t-a.pcx");
|
|
2301 pTexture_LeftFrame->Reload("ib-l-a.pcx");
|
|
2302 pTexture_StatusBar->Reload("IB-Foot-a.pcx");
|
|
2303 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2);
|
|
2304 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-a", 2);
|
|
2305 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-a", 2);
|
|
2306 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2);
|
|
2307 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2);
|
|
2308 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2);
|
|
2309 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-a", 2);
|
|
2310 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2);
|
|
2311 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2);
|
|
2312 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-a", 2);
|
|
2313 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-a", 2);
|
|
2314 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-a", 2);
|
|
2315 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2);
|
|
2316 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2);
|
|
2317 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-a", 2);
|
|
2318 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2);
|
|
2319 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2);
|
|
2320 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2);
|
|
2321 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2);
|
|
2322 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
|
|
2323 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
|
|
2324 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
|
|
2325 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
|
|
2326 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2);
|
|
2327 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2);
|
|
2328 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven", 2);
|
|
2329 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
|
|
2330 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2);
|
|
2331 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2);
|
|
2332 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2);
|
|
2333 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2);
|
|
2334 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2);
|
|
2335 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2);
|
|
2336 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2);
|
|
2337 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2);
|
|
2338 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2);
|
|
2339 }
|
|
2340 else
|
|
2341 {
|
|
2342 pTexture_RightFrame->Load("ib-r-A.pcx", 0);
|
|
2343 pTexture_BottomFrame->Load("ib-b-A.pcx", 0);
|
|
2344 pTexture_TopFrame->Load("ib-t-A.pcx", 0);
|
|
2345 pTexture_LeftFrame->Load("ib-l-A.pcx", 0);
|
|
2346 pTexture_StatusBar->Load("IB-Foot-a.pcx", 0);
|
|
2347 uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE);
|
|
2348 uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE);
|
|
2349 uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE);
|
|
2350 dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE);
|
|
2351 dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE);
|
|
2352 dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE);
|
|
2353 uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE);
|
|
2354 uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE);
|
|
2355 uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE);
|
|
2356 uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE);
|
|
2357 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE);
|
|
2358 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE);
|
|
2359 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE);
|
|
2360 uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE);
|
|
2361 uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE);
|
|
2362 uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE);
|
|
2363 uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE);
|
|
2364 uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE);
|
|
2365 uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE);
|
|
2366 uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE);
|
|
2367 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE);
|
|
2368 uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
|
|
2369 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
|
|
2370 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
|
|
2371 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
|
|
2372 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
|
|
2373 uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE);
|
|
2374 uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE);
|
|
2375 uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE);
|
|
2376 uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE);
|
|
2377 uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE);
|
|
2378 uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE);
|
|
2379 uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE);
|
|
2380 uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE);
|
|
2381 uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE);
|
|
2382 pTexture_591428 = pIcons_LOD->LoadTexturePtr("endcap", TEXTURE_16BIT_PALETTE);
|
|
2383 }
|
|
2384 uGameUIFontMain = Color16(0xAu, 0, 0);
|
|
2385 uGameUIFontShadow = Color16(230, 214, 193);
|
|
2386 }
|
|
2387 else if (align == PartyAlignment_Good)
|
|
2388 {
|
|
2389 if ( bReplace )
|
|
2390 {
|
|
2391 pTexture_RightFrame->Reload("ib-r-B.pcx");
|
|
2392 pTexture_BottomFrame->Reload("ib-b-B.pcx");
|
|
2393 pTexture_TopFrame->Reload("ib-t-B.pcx");
|
|
2394 pTexture_LeftFrame->Reload("ib-l-B.pcx");
|
|
2395 pTexture_StatusBar->Reload("IB-Foot-b.pcx");
|
|
2396 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-B", 2);
|
|
2397 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-b", 2);
|
|
2398 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-B", 2);
|
|
2399 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-b", 2);
|
|
2400 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-b", 2);
|
|
2401 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-b", 2);
|
|
2402 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-B", 2);
|
|
2403 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-B", 2);
|
|
2404 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-B", 2);
|
|
2405 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-B", 2);
|
|
2406 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-B", 2);
|
|
2407 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-b", 2);
|
|
2408 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-b", 2);
|
|
2409 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-b", 2);
|
|
2410 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-b", 2);
|
|
2411 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-b", 2);
|
|
2412 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-b", 2);
|
|
2413 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-b", 2);
|
|
2414 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-b", 2);
|
|
2415 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB");
|
|
2416 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
|
|
2417 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB");
|
|
2418 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
|
|
2419 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-b", 2);
|
|
2420 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2);
|
|
2421 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-b", 2);
|
|
2422 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
|
|
2423 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2);
|
|
2424 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2);
|
|
2425 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-b", 2);
|
|
2426 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-b", 2);
|
|
2427 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-b", 2);
|
|
2428 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-b", 2);
|
|
2429 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-b", 2);
|
|
2430 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-b", 2);
|
|
2431 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-b", 2);
|
|
2432 }
|
|
2433 uGameUIFontMain = Color16(0, 0, 0xC8u);
|
|
2434 uGameUIFontShadow = Color16(255, 255, 255);
|
|
2435 }
|
|
2436 else Error("Invalid alignment type: %u", align);
|
|
2437 }
|
|
2438 //----- (0041D20D) --------------------------------------------------------
|
|
2439 void DrawBuff_remaining_time_string( int uY, struct GUIWindow *window, __int64 remaining_time, struct GUIFont *Font )
|
|
2440 {
|
|
2441 unsigned int full_time; // esi@1
|
|
2442 signed __int64 hours; // kr00_8@1
|
|
2443 const char *text; // eax@2
|
|
2444 signed __int64 minutes; // [sp+10h] [bp-10h]@1
|
|
2445 signed __int64 seconds; // [sp+18h] [bp-8h]@1
|
|
2446 unsigned int day; // [sp+24h] [bp+4h]@1
|
|
2447
|
|
2448 full_time = (signed __int64)((double)remaining_time * 0.234375);
|
|
2449 day = (unsigned int)((full_time / 60) / 60) / 24;
|
|
2450 hours = ((full_time / 60) / 60) % 24;
|
|
2451 minutes = (signed __int64)(full_time / 60) % 60;
|
|
2452 seconds = (signed __int64)full_time % 60;
|
|
2453 strcpy(pTmpBuf.data(), "\r020");
|
|
2454 if ( day )
|
|
2455 {
|
|
2456 text = pGlobalTXT_LocalizationStrings[57]; // Days
|
|
2457 if ( day <= 1 )
|
|
2458 text = pGlobalTXT_LocalizationStrings[56]; // Day
|
|
2459 sprintfex(pTmpBuf2.data(), "%d %s ", (int)day, text);
|
|
2460 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
2461 }
|
|
2462 if ( hours )
|
|
2463 {
|
|
2464 if ( hours <= 1 )
|
|
2465 text = pGlobalTXT_LocalizationStrings[109];// Hour
|
|
2466 else
|
|
2467 text = pGlobalTXT_LocalizationStrings[110];// Hours
|
|
2468 sprintfex(pTmpBuf2.data(), "%d %s ", (int)hours, text);
|
|
2469 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
2470 }
|
|
2471 if ( minutes && !day )
|
|
2472 {
|
|
2473 if ( minutes <= 1 )
|
|
2474 text = pGlobalTXT_LocalizationStrings[437];// Minute
|
|
2475 else
|
|
2476 text = pGlobalTXT_LocalizationStrings[436];// Minutes
|
|
2477 sprintfex(pTmpBuf2.data(), "%d %s ", (int)minutes, text);
|
|
2478 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
2479 }
|
|
2480 if ( seconds && !hours )
|
|
2481 {
|
|
2482 if ( seconds <= 1 )
|
|
2483 text = pGlobalTXT_LocalizationStrings[439];// Second
|
|
2484 else
|
|
2485 text = pGlobalTXT_LocalizationStrings[438];// Seconds
|
|
2486 sprintfex(pTmpBuf2.data(), "%d %s ", (int)seconds, text);
|
|
2487 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
2488 }
|
|
2489 window->DrawText(Font, 32, uY, 0, pTmpBuf.data(), 0, 0, 0);
|
|
2490 }
|
|
2491
|
|
2492
|
|
2493 //----- (0042EB8D) --------------------------------------------------------
|
|
2494 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line)
|
|
2495 {
|
|
2496 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line);
|
|
2497 if (uNumMessages < 40)
|
|
2498 {
|
|
2499 files[uNumMessages] = file;
|
|
2500 lines[uNumMessages] = line;
|
|
2501
|
|
2502 pMessages[uNumMessages].eType = msg;
|
|
2503 pMessages[uNumMessages].param = param;
|
|
2504 pMessages[uNumMessages++].field_8 = a4;
|
|
2505 }
|
|
2506 }
|
|
2507
|
|
2508 //----- (004637E0) --------------------------------------------------------
|
|
2509 char sub_4637E0_is_there_popup_onscreen()
|
|
2510 {
|
|
2511 return dword_507BF0_is_there_popup_onscreen == 1;
|
|
2512 }
|
|
2513 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen;
|
|
2514
|
|
2515 //----- (00417AD4) --------------------------------------------------------
|
|
2516 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level)
|
|
2517 {
|
|
2518 switch (uPlayerClass % 4)
|
|
2519 {
|
|
2520 case 0:
|
|
2521 {
|
|
2522 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level)
|
|
2523 return ui_character_skillinfo_can_learn;
|
|
2524 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level &&
|
|
2525 byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level)
|
|
2526 {
|
|
2527 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType] < skill_level)
|
|
2528 return ui_character_skillinfo_cant_learn;
|
|
2529 }
|
|
2530 return ui_character_skillinfo_can_learn_gm;
|
|
2531 }
|
|
2532 break;
|
|
2533
|
|
2534 case 1:
|
|
2535 {
|
|
2536 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level)
|
|
2537 return ui_character_skillinfo_can_learn;
|
|
2538 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level)
|
|
2539 {
|
|
2540 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level)
|
|
2541 return ui_character_skillinfo_cant_learn;
|
|
2542 }
|
|
2543 return ui_character_skillinfo_can_learn_gm;
|
|
2544 }
|
|
2545 break;
|
|
2546
|
|
2547 case 2:
|
|
2548 case 3:
|
|
2549 {
|
|
2550 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level)
|
|
2551 return ui_character_skillinfo_cant_learn;
|
|
2552 return ui_character_skillinfo_can_learn;
|
|
2553 }
|
|
2554 break;
|
|
2555 }
|
|
2556 Error("Invalid player class: %u", uPlayerClass);
|
|
2557 }
|
|
2558
|
|
2559 //----- (0040F92A) --------------------------------------------------------
|
|
2560 void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3)
|
|
2561 {//срабатывает в покупке в магазине
|
|
2562 void *v4; // eax@3
|
|
2563 //int *v5; // edi@5
|
|
2564 // int v6; // ecx@6
|
|
2565 // int v9; // [sp+18h] [bp-4h]@1
|
|
2566
|
|
2567 if (pIcons_LOD->dword_011BA4 && a2->uDecompressedSize)
|
|
2568 v4 = a2->UnzipPalette();
|
|
2569 else
|
|
2570 v4 = a2->pLevelOfDetail0_prolly_alpha_mask;
|
|
2571 //v5 = pZBuffer;
|
|
2572 for (uint i = 0; i < a2->uTextureHeight; i++)
|
|
2573 {
|
|
2574 for (uint j = 0; j < a2->uTextureWidth; j++)
|
|
2575 {
|
|
2576 *pZBuffer = a3;
|
|
2577 ++pZBuffer;
|
|
2578 }
|
|
2579 pZBuffer += window->GetWidth() - a2->uTextureWidth;
|
|
2580 }
|
|
2581 if (pIcons_LOD->dword_011BA4)
|
|
2582 {
|
|
2583 if (a2->uDecompressedSize)
|
|
2584 free(v4);
|
|
2585 }
|
|
2586 }
|
|
2587
|
|
2588
|
2541
|
2589 // 4E28F8: using guessed type int current_screen_type;
|
2502
|
2590
|
|
2591 //----- (0040F82D) --------------------------------------------------------
|
|
2592 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue)
|
|
2593 {
|
|
2594 assert(uTextureId != -1);
|
|
2595 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue);
|
|
2596 }
|
|
2597
|
|
2598 //----- (0040F89C) --------------------------------------------------------
|
|
2599 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue)
|
|
2600 {//срабатывает при продаже в магазине
|
|
2601 void *v3; // eax@3
|
|
2602 //void *v4; // esi@5
|
|
2603 //int *v5; // edi@5
|
|
2604 //int v6; // eax@5
|
|
2605 // int v7; // ecx@6
|
|
2606 // int v11; // [sp+18h] [bp-8h]@1
|
|
2607 //void *v12; // [sp+1Ch] [bp-4h]@5
|
|
2608
|
|
2609 if (pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize)
|
|
2610 v3 = pTex->UnzipPalette();
|
|
2611 else
|
|
2612 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask;
|
|
2613 //v12 = v3;
|
|
2614 //v4 = v3;
|
|
2615 //v5 = pZBuffer;
|
|
2616 //v6 = 0;
|
|
2617 for (uint i = 0; i < pTex->uTextureHeight; i++)
|
|
2618 {
|
|
2619 for (uint j = 0; j < pTex->uTextureWidth; j++)
|
|
2620 {
|
|
2621 //LOBYTE(v6) = *(char *)v4;
|
|
2622 //v4 = (char *)v4 + 1;
|
|
2623 //if ( v6 )
|
|
2624 *pZBuffer = uZValue;
|
|
2625 ++pZBuffer;
|
|
2626 }
|
|
2627 pZBuffer += window->GetWidth() - pTex->uTextureWidth;
|
|
2628 }
|
|
2629 if (pIcons_LOD->dword_011BA4)
|
|
2630 {
|
|
2631 if (pTex->uDecompressedSize)
|
|
2632 free(v3);
|
|
2633 }
|
|
2634 }
|
|
2635
|
|
2636 //----- (004BC49B) --------------------------------------------------------
|
|
2637 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
|
|
2638 {
|
|
2639 NPCData *speakingNPC; // ebp@1
|
|
2640 int npc_event_id; // ecx@10
|
|
2641 char *v13; // [sp-8h] [bp-18h]@60
|
|
2642
|
|
2643 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
|
|
2644 uDialogueType = newDialogueType;
|
|
2645 if (!speakingNPC->uFlags)
|
|
2646 speakingNPC->uFlags = 1;
|
|
2647 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS)
|
|
2648 dialogue_show_profession_details = ~dialogue_show_profession_details;
|
|
2649 else if (newDialogueType == DIALOGUE_76)
|
|
2650 {
|
|
2651 if (speakingNPC->Hired())
|
|
2652 {
|
|
2653 if ((signed int)pNPCStats->uNumNewNPCs > 0)
|
|
2654 {
|
|
2655 for (uint i = 0; i < (unsigned int)pNPCStats->uNumNewNPCs; ++i)
|
|
2656 {
|
|
2657 if (pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName))
|
|
2658 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu;
|
|
2659 }
|
|
2660 }
|
|
2661 if (pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName))
|
|
2662 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
|
|
2663 else if (pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName))
|
|
2664 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
|
|
2665 pParty->hirelingScrollPosition = 0;
|
|
2666 pParty->CountHirelings();
|
|
2667 dword_591084 = 0;
|
|
2668 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2669 dword_7241C8 = 0;
|
|
2670 return;
|
|
2671 }
|
|
2672 if (pParty->pHirelings[0].pName && pParty->pHirelings[1].pName)
|
|
2673 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
|
|
2674 else
|
|
2675 {
|
|
2676 if (speakingNPC->uProfession != 51) //burglars have no hiring price
|
|
2677 {
|
|
2678 if (pParty->uNumGold < pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice)
|
|
2679 {
|
|
2680 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
|
|
2681 dialogue_show_profession_details = false;
|
|
2682 uDialogueType = 13;
|
|
2683 if (uActiveCharacter)
|
|
2684 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
|
|
2685 if (!dword_7241C8)
|
2541
|
2686 pEngine->Draw();
|
2502
|
2687 dword_7241C8 = 0;
|
|
2688 return;
|
|
2689 }
|
|
2690 Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice);
|
|
2691 }
|
|
2692 LOBYTE(speakingNPC->uFlags) |= 0x80u;
|
|
2693 if (pParty->pHirelings[0].pName)
|
|
2694 {
|
|
2695 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1]));
|
|
2696 v13 = pParty->pHireling2Name;
|
|
2697 }
|
|
2698 else
|
|
2699 {
|
|
2700 memcpy(&pParty->pHirelings[0], speakingNPC, sizeof(pParty->pHirelings[0]));
|
|
2701 v13 = pParty->pHireling1Name;
|
|
2702 }
|
|
2703 strcpy(v13, speakingNPC->pName);
|
|
2704 pParty->hirelingScrollPosition = 0;
|
|
2705 pParty->CountHirelings();
|
|
2706 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2707 if (sDialogue_SpeakingActorNPC_ID >= 0)
|
|
2708 pDialogue_SpeakingActor->uAIState = Removed;
|
|
2709 if (uActiveCharacter)
|
|
2710 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
|
|
2711 }
|
|
2712 }
|
|
2713 else if ((signed int)newDialogueType > DIALOGUE_84 && (signed int)newDialogueType <= DIALOGUE_ARENA_SELECT_CHAMPION) //выбор уровня сложности боя
|
|
2714 {
|
|
2715 ArenaFight();
|
|
2716 return;
|
|
2717 }
|
|
2718 else if (newDialogueType == DIALOGUE_USE_NPC_ABILITY)
|
|
2719 {
|
|
2720 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0)
|
|
2721 {
|
|
2722 if (speakingNPC->uProfession != GateMaster)
|
|
2723 speakingNPC->bHasUsedTheAbility = 1;
|
|
2724 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2725 }
|
|
2726 else
|
|
2727 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!"
|
|
2728 }
|
|
2729 else if (newDialogueType == DIALOGUE_13)
|
|
2730 {
|
|
2731 if (!speakingNPC->Hired())
|
|
2732 {
|
|
2733 sub_4B3E1E();
|
|
2734 dialogue_show_profession_details = false;
|
|
2735 }
|
|
2736 else
|
|
2737 {
|
|
2738 for (uint i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i)
|
|
2739 {
|
|
2740 if (pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName))
|
|
2741 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu;
|
|
2742 }
|
|
2743 if (pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName))
|
|
2744 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
|
|
2745 else if (pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName))
|
|
2746 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
|
|
2747 pParty->hirelingScrollPosition = 0;
|
|
2748 pParty->CountHirelings();
|
|
2749 dword_591084 = 0;
|
|
2750 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2751 dword_7241C8 = 0;
|
|
2752 return;
|
|
2753 }
|
|
2754 }
|
|
2755 else if (newDialogueType >= DIALOGUE_EVT_A && newDialogueType <= DIALOGUE_EVT_F)
|
|
2756 {
|
|
2757 switch (newDialogueType)
|
|
2758 {
|
|
2759 case DIALOGUE_EVT_A: npc_event_id = speakingNPC->evt_A; break;
|
|
2760 case DIALOGUE_EVT_B: npc_event_id = speakingNPC->evt_B; break;
|
|
2761 case DIALOGUE_EVT_C: npc_event_id = speakingNPC->evt_C; break;
|
|
2762 case DIALOGUE_EVT_D: npc_event_id = speakingNPC->evt_D; break;
|
|
2763 case DIALOGUE_EVT_E: npc_event_id = speakingNPC->evt_E; break;
|
|
2764 case DIALOGUE_EVT_F: npc_event_id = speakingNPC->evt_F; break;
|
|
2765 }
|
|
2766 if ((npc_event_id >= 200) && (npc_event_id <= 310))
|
|
2767 _4B3FE5_training_dialogue(npc_event_id); //200-310
|
|
2768 else if ((npc_event_id >= 400) && (npc_event_id <= 410))
|
|
2769 { //400-410
|
|
2770 dword_F8B1D8 = newDialogueType;
|
|
2771 DrawJoinGuildWindow(npc_event_id - 400);
|
|
2772 }
|
|
2773 else
|
|
2774 {
|
|
2775 switch (npc_event_id)
|
|
2776 {
|
|
2777 case 139:
|
|
2778 OracleDialogue();
|
|
2779 break;
|
|
2780 case 311:
|
|
2781 CheckBountyRespawnAndAward();
|
|
2782 break;
|
|
2783 case 399:
|
|
2784 Arena_SelectionFightLevel();
|
|
2785 break;
|
|
2786 default:
|
|
2787 activeLevelDecoration = (LevelDecoration*)1;
|
|
2788 current_npc_text = 0;
|
|
2789 EventProcessor(npc_event_id, 0, 1);
|
|
2790 activeLevelDecoration = nullptr;
|
|
2791 break;
|
|
2792 }
|
|
2793 }
|
|
2794 }
|
|
2795 if (!dword_7241C8)
|
2541
|
2796 pEngine->Draw();
|
2502
|
2797 dword_7241C8 = 0;
|
|
2798 }
|
|
2799
|
|
2800 //----- (004B3E1E) --------------------------------------------------------
|
|
2801 void sub_4B3E1E()
|
|
2802 {
|
|
2803 NPCData *v0; // ST40_4@1
|
|
2804 signed int v1; // edi@1
|
|
2805 //GUIWindow *v2; // ecx@1
|
|
2806
|
|
2807 __debugbreak();
|
|
2808 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
|
|
2809 v1 = 0;
|
|
2810 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
2811 pDialogueWindow->Release();
|
|
2812 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 1, 0);
|
|
2813 if (pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) )
|
|
2814 {
|
|
2815 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее
|
|
2816 v1 = 1;
|
|
2817 }
|
|
2818 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять
|
|
2819 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1);
|
|
2820 }
|
|
2821
|
|
2822 //----- (004B2001) --------------------------------------------------------
|
|
2823 void __fastcall ClickNPCTopic(signed int uMessageParam)
|
|
2824 {
|
|
2825 //signed int v1; // eax@1
|
|
2826 NPCData *pCurrentNPCInfo; // ebp@1
|
|
2827 int pEventNumber; // ecx@8
|
|
2828 Player *v4; // esi@20
|
|
2829 //int v5; // eax@28
|
|
2830 //int v6; // eax@31
|
|
2831 //int v7; // eax@34
|
|
2832 //int v8; // eax@37
|
|
2833 //int v9; // eax@40
|
|
2834 //unsigned int v10; // eax@43
|
|
2835 char *v12; // eax@53
|
|
2836 char *v13; // eax@56
|
|
2837 char *v14; // eax@57
|
|
2838 char *v15; // eax@58
|
|
2839 //unsigned int v16; // ebp@62
|
|
2840 char *v17; // ecx@63
|
|
2841 char *v18; // eax@65
|
|
2842 // const char *v19; // ecx@68
|
|
2843 //unsigned int v20; // eax@69
|
|
2844 signed int pPrice; // ecx@70
|
|
2845 char *v22; // [sp-Ch] [bp-18h]@73
|
|
2846 //int v23; // [sp-8h] [bp-14h]@49
|
|
2847 char *v24; // [sp-8h] [bp-14h]@73
|
|
2848 //int v25; // [sp-4h] [bp-10h]@49
|
|
2849
|
|
2850 uDialogueType = uMessageParam + 1;
|
|
2851 pCurrentNPCInfo = HouseNPCData[pDialogueNPCCount - ((dword_591080 != 0) ? 1 : 0)];//- 1
|
|
2852 if (uMessageParam <= 24)
|
|
2853 {
|
|
2854 switch (uMessageParam)
|
|
2855 {
|
|
2856 case 13:
|
|
2857 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
|
|
2858 current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
|
|
2859 NPCHireableDialogPrepare();
|
|
2860 dialogue_show_profession_details = false;
|
|
2861 BackToHouseMenu();
|
|
2862 return;
|
|
2863 case 19:
|
|
2864 pEventNumber = pCurrentNPCInfo->evt_A;
|
|
2865 break;
|
|
2866 case 20:
|
|
2867 pEventNumber = pCurrentNPCInfo->evt_B;
|
|
2868 break;
|
|
2869 case 21:
|
|
2870 pEventNumber = pCurrentNPCInfo->evt_C;
|
|
2871 break;
|
|
2872 case 22:
|
|
2873 pEventNumber = pCurrentNPCInfo->evt_D;
|
|
2874 break;
|
|
2875 case 23:
|
|
2876 pEventNumber = pCurrentNPCInfo->evt_E;
|
|
2877 break;
|
|
2878 case 24:
|
|
2879 pEventNumber = pCurrentNPCInfo->evt_F;
|
|
2880 break;
|
|
2881 default:
|
|
2882 BackToHouseMenu();
|
|
2883 return;
|
|
2884 }
|
|
2885 /*switch ( pEventNumber )
|
|
2886 {
|
|
2887 case 139:
|
|
2888 OracleDialogue();
|
|
2889 goto _return;
|
|
2890 case 311:
|
|
2891 CheckBountyRespawnAndAward();
|
|
2892 goto _return;
|
|
2893 }*/
|
|
2894 if (pEventNumber < 200 || pEventNumber > 310)
|
|
2895 {
|
|
2896 if (pEventNumber < 400 || pEventNumber > 410)
|
|
2897 {
|
|
2898 if (pEventNumber == 139)
|
|
2899 {
|
|
2900 OracleDialogue();
|
|
2901 }
|
|
2902 else
|
|
2903 {
|
|
2904 if (pEventNumber == 311)
|
|
2905 {
|
|
2906 CheckBountyRespawnAndAward();
|
|
2907 }
|
|
2908 else
|
|
2909 {
|
|
2910 current_npc_text = 0;
|
|
2911 activeLevelDecoration = (LevelDecoration*)1;
|
|
2912 EventProcessor(pEventNumber, 0, 1);
|
|
2913 activeLevelDecoration = nullptr;
|
|
2914 }
|
|
2915 }
|
|
2916 }
|
|
2917 else
|
|
2918 {
|
|
2919 dword_F8B1D8 = uMessageParam;
|
|
2920 DrawJoinGuildWindow(pEventNumber - 400);
|
|
2921 }
|
|
2922 }
|
|
2923 else
|
|
2924 {
|
|
2925 _4B3FE5_training_dialogue(pEventNumber);
|
|
2926 }
|
|
2927 BackToHouseMenu();
|
|
2928 return;
|
|
2929 }
|
|
2930 if (uMessageParam != 76)
|
|
2931 {
|
|
2932 if (uMessageParam == 77)
|
|
2933 {
|
|
2934 //v16 = pCurrentNPCInfo->uProfession;
|
|
2935 __debugbreak(); // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok
|
|
2936 if (dialogue_show_profession_details)
|
|
2937 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;
|
|
2938 else
|
|
2939 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pBenefits;
|
|
2940 current_npc_text = v17;
|
|
2941 v18 = BuildDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
|
|
2942 dialogue_show_profession_details = ~dialogue_show_profession_details;
|
|
2943 current_npc_text = v18;
|
|
2944 }
|
|
2945 else
|
|
2946 {
|
|
2947 if (uMessageParam == 79)
|
|
2948 {
|
|
2949 if (contract_approved)
|
|
2950 {
|
|
2951 Party::TakeGold(gold_transaction_amount);
|
|
2952 if (uActiveCharacter)
|
|
2953 {
|
|
2954 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
|
|
2955 *(short *)v12 &= 0x3Fu;
|
|
2956 switch (dword_F8B1B0_MasteryBeingTaught)
|
|
2957 {
|
|
2958 case 2:
|
|
2959 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
|
|
2960 *v15 |= 0x40u;
|
|
2961 break;
|
|
2962 case 3:
|
|
2963 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
|
|
2964 *v14 |= 0x80u;
|
|
2965 break;
|
|
2966 case 4:
|
|
2967 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
|
|
2968 v13[1] |= 1u;
|
|
2969 break;
|
|
2970 }
|
|
2971 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0);
|
|
2972 }
|
|
2973 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2974 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
2975 {
|
|
2976 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
2977 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
2978 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
2979 ++pMessageQueue_50CBD0->uNumMessages;
|
|
2980 }*/
|
|
2981 }
|
|
2982 }
|
|
2983 else
|
|
2984 {
|
|
2985 if (uMessageParam == 82 && contract_approved) //join guild
|
|
2986 {
|
|
2987 Party::TakeGold(gold_transaction_amount);
|
|
2988 v4 = pParty->pPlayers.data();
|
|
2989 do
|
|
2990 {
|
|
2991 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number);
|
|
2992 ++v4;
|
|
2993 } while ((signed int)v4 < (signed int)pParty->pHirelings.data());
|
|
2994 switch (dword_F8B1D8)
|
|
2995 {
|
|
2996 case 19:
|
|
2997 pEventNumber = pCurrentNPCInfo->evt_A;
|
|
2998 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
2999 pCurrentNPCInfo->evt_A = 0;
|
|
3000 break;
|
|
3001 case 20:
|
|
3002 pEventNumber = pCurrentNPCInfo->evt_B;
|
|
3003 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3004 pCurrentNPCInfo->evt_B = 0;
|
|
3005 break;
|
|
3006 case 21:
|
|
3007 pEventNumber = pCurrentNPCInfo->evt_C;
|
|
3008 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3009 pCurrentNPCInfo->evt_C = 0;
|
|
3010 break;
|
|
3011 case 22:
|
|
3012 pEventNumber = pCurrentNPCInfo->evt_D;
|
|
3013 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3014 pCurrentNPCInfo->evt_D = 0;
|
|
3015 break;
|
|
3016 case 23:
|
|
3017 pEventNumber = pCurrentNPCInfo->evt_E;
|
|
3018 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3019 pCurrentNPCInfo->evt_E = 0;
|
|
3020 break;
|
|
3021 case 24:
|
|
3022 pEventNumber = pCurrentNPCInfo->evt_F;
|
|
3023 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3024 pCurrentNPCInfo->evt_F = 0;
|
|
3025 break;
|
|
3026 }
|
|
3027 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
3028 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3029 {
|
|
3030 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3031 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
3032 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3033 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3034 }*/
|
|
3035 //v11 = uActiveCharacter;
|
|
3036 if (uActiveCharacter)
|
|
3037 {
|
|
3038 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0);
|
|
3039 BackToHouseMenu();
|
|
3040 return;
|
|
3041 }
|
|
3042 }
|
|
3043 }
|
|
3044 }
|
|
3045 BackToHouseMenu();
|
|
3046 return;
|
|
3047 }
|
|
3048 if (pParty->pHirelings[0].pName && pParty->pHirelings[1].pName)
|
|
3049 {
|
|
3050 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
|
|
3051 BackToHouseMenu();
|
|
3052 return;
|
|
3053 }
|
|
3054
|
|
3055
|
|
3056 if (pCurrentNPCInfo->uProfession != 51) //burglars have no hiring price
|
|
3057 {
|
|
3058 __debugbreak(); // probably hirelings found in buildings, not present in MM7, changed "pCurrentNPCInfo->uProfession - 1" to "pCurrentNPCInfo->uProfession", have to check in other versions whether it's ok
|
|
3059 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].uHirePrice;
|
|
3060 if (pParty->uNumGold < (unsigned int)pPrice)
|
|
3061 {
|
|
3062 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
3063 dialogue_show_profession_details = false;
|
|
3064 uDialogueType = 13;
|
|
3065 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;
|
|
3066 current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
|
|
3067 if (uActiveCharacter)
|
|
3068 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
|
|
3069 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
3070 BackToHouseMenu();
|
|
3071 return;
|
|
3072 }
|
|
3073 else
|
|
3074 Party::TakeGold(pPrice);
|
|
3075 }
|
|
3076 //LOBYTE(v2->uFlags) |= 0x80u;
|
|
3077 pCurrentNPCInfo->uFlags |= 128;
|
|
3078 pParty->hirelingScrollPosition = 0;
|
|
3079 pParty->CountHirelings();
|
|
3080 if (pParty->pHirelings[0].pName)
|
|
3081 {
|
|
3082 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1]));
|
|
3083 v24 = pCurrentNPCInfo->pName;
|
|
3084 v22 = pParty->pHireling2Name;
|
|
3085 }
|
|
3086 else
|
|
3087 {
|
|
3088 memcpy(pParty->pHirelings.data(), pCurrentNPCInfo, 0x4Cu);
|
|
3089 v24 = pCurrentNPCInfo->pName;
|
|
3090 v22 = pParty->pHireling1Name;
|
|
3091 }
|
|
3092 strcpy(v22, v24);
|
|
3093 pParty->hirelingScrollPosition = 0;
|
|
3094 pParty->CountHirelings();
|
|
3095 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C);
|
|
3096 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
|
|
3097
|
|
3098 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
3099 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3100 {
|
|
3101 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3102 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
3103 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3104 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3105 }*/
|
|
3106 if (uActiveCharacter)
|
|
3107 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0);
|
|
3108
|
|
3109 _return:
|
|
3110 BackToHouseMenu();
|
|
3111 }
|
|
3112
|
|
3113 //----- (004B3FE5) --------------------------------------------------------
|
|
3114 //Originally called _4B254D_SkillMasteryTeacher to have contract_approved assigned, to be able to set some button name.
|
|
3115 //But it the name gets immediately overwritten
|
|
3116 void _4B3FE5_training_dialogue(int a4)
|
|
3117 {
|
|
3118 const char *v2; // edi@1
|
|
3119
|
|
3120 //__debugbreak();
|
|
3121 uDialogueType = DIALOGUE_SKILL_TRAINER;
|
|
3122 current_npc_text = (char *)pNPCTopics[a4 + 168].pText;
|
|
3123 _4B254D_SkillMasteryTeacher(a4); //might be needed because of contract_approved ?
|
|
3124 pDialogueWindow->Release();
|
|
3125 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, a4, 0);
|
|
3126 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0,
|
|
3127 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
3128 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
|
|
3129 v2 = "";
|
|
3130 if (contract_approved)
|
|
3131 v2 = pGlobalTXT_LocalizationStrings[535];
|
|
3132 pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0);
|
|
3133 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
|
|
3134 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
|
|
3135 }
|
2528
|
3136
|
2502
|
3137 //----- (004B1ECE) --------------------------------------------------------
|
|
3138 void OracleDialogue()
|
|
3139 {
|
|
3140 __int16 *v0; // edi@1
|
|
3141 signed int v4; // eax@9
|
|
3142 int v5; // ebx@11
|
|
3143 signed int v8; // edi@14
|
|
3144 ItemGen *v9; // [sp+Ch] [bp-Ch]@11
|
|
3145 signed int v10; // [sp+10h] [bp-8h]@13
|
|
3146 int v11; // [sp+14h] [bp-4h]@1
|
|
3147
|
|
3148 contract_approved = 0;
|
|
3149 v11 = 0;
|
|
3150 uDialogueType = 84;
|
|
3151 current_npc_text = (char *)pNPCTopics[667].pText;
|
|
3152 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data();
|
|
3153 //while ( 1 )
|
|
3154 for (uint i = 0; i <= 53; i++)
|
|
3155 {
|
|
3156 if ((unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0))
|
|
3157 {
|
|
3158 //v1 = 0;
|
|
3159 //v2 = pParty->pPlayers.data();
|
|
3160 for (uint pl = 0; pl < 4; pl++)
|
|
3161 {
|
|
3162 //LOBYTE(v3) = pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1));
|
|
3163 if (pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0 + 1)))
|
|
3164 break;
|
|
3165 //++v2;
|
|
3166 //++v1;
|
|
3167 }
|
|
3168 //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() );
|
|
3169 //if ( v1 == 4 )
|
|
3170 //break;
|
|
3171 }
|
|
3172 ++v11;
|
|
3173 //v0 += 2;
|
|
3174 //if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
|
|
3175 //break;
|
|
3176 }
|
|
3177 if (v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53])
|
|
3178 {
|
|
3179 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful
|
|
3180 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
|
|
3181 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
|
|
3182 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
|
|
3183 }
|
|
3184 if (contract_approved == 601)
|
|
3185 {
|
|
3186 v5 = 0;
|
|
3187 //v12 = pParty->pPlayers.data();//[0].uClass;
|
|
3188 v9 = 0;
|
|
3189 //while ( 1 )
|
|
3190 for (uint i = 0; i < 4; i++)
|
|
3191 {
|
|
3192 if (pParty->pPlayers[i].classType == PLAYER_CLASS_LICH)
|
|
3193 {
|
|
3194 v10 = 0;
|
|
3195 //v6 = pParty->pPlayers.data();//[0].pInventoryItems[0].field_1A;
|
|
3196 for (uint pl = 0; pl < 4; pl++)
|
|
3197 {
|
|
3198 for (v8 = 0; v8 < 126; v8++)//138
|
|
3199 {
|
|
3200 if (pParty->pPlayers[pl].pInventoryItemList[v8].uItemID == ITEM_LICH_JAR_FULL)
|
|
3201 {
|
|
3202 if (!pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer)
|
|
3203 v9 = &pParty->pPlayers[pl].pInventoryItemList[v8];
|
|
3204 if (pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer == v5)
|
|
3205 v10 = 1;
|
|
3206 }
|
|
3207 }
|
|
3208 }
|
|
3209 if (!v10)
|
|
3210 break;
|
|
3211 }
|
|
3212 // ++v12;
|
|
3213 ++v5;
|
|
3214 // if ( v12 > &pParty->pPlayers[3] )
|
|
3215 // return;
|
|
3216 }
|
|
3217 if (v9)
|
|
3218 v9->uHolderPlayer = v5;
|
|
3219 }
|
|
3220 }
|
|
3221
|
|
3222 //----- (004B46A5) --------------------------------------------------------
|
|
3223 void __fastcall DrawTextAtStatusBar(const char *Str, int a5)
|
|
3224 {
|
|
3225 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
|
|
3226 pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, Str) + 11, 357, a5, Str, 0, 0, 0);
|
|
3227 }
|
|
3228
|
|
3229 //----- (004BBA85) --------------------------------------------------------
|
|
3230 void CheckBountyRespawnAndAward()
|
|
3231 {
|
|
3232 int i; // eax@2
|
|
3233 int rand_monster_id; // edx@3
|
|
3234
|
|
3235 uDialogueType = 83;
|
|
3236 pDialogueWindow->Release();
|
|
3237 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, 0, 0);
|
|
3238 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
|
|
3239 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
3240 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
|
|
3241 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_0, 83, 0, "", 0);
|
|
3242 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
|
|
3243 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
|
|
3244 //get new monster for hunting
|
|
3245 if (pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed)
|
|
3246 {
|
|
3247 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false;
|
|
3248 pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335);
|
|
3249 for (i = rand();; i = rand())
|
|
3250 {
|
|
3251 rand_monster_id = i % 258 + 1;
|
|
3252 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand_monster_id;
|
|
3253 if ((unsigned __int16)rand_monster_id < 0x73u || (unsigned __int16)rand_monster_id > 0x84u)
|
|
3254 {
|
|
3255 if (((unsigned __int16)rand_monster_id < 0xEBu || (unsigned __int16)rand_monster_id > 0xFCu)
|
|
3256 && ((unsigned __int16)rand_monster_id < 0x85u || (unsigned __int16)rand_monster_id > 0x96u)
|
|
3257 && ((unsigned __int16)rand_monster_id < 0x97u || (unsigned __int16)rand_monster_id > 0xBAu)
|
|
3258 && ((unsigned __int16)rand_monster_id < 0xC4u || (unsigned __int16)rand_monster_id > 0xC6u))
|
|
3259 break;
|
|
3260 }
|
|
3261 }
|
|
3262 }
|
|
3263 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
|
|
3264 if (!pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)])
|
|
3265 {
|
|
3266 bountyHunting_text = pNPCTopics[351].pText;
|
|
3267 if (!pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)])
|
|
3268 bountyHunting_text = pNPCTopics[353].pText;
|
|
3269 }
|
|
3270 else//get prize
|
|
3271 {
|
|
3272 if (pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)])
|
|
3273 {
|
|
3274 pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0);
|
|
3275 for (uint i = 0; i < 4; ++i)
|
|
3276 pParty->pPlayers[i].SetVariable(VAR_Award, 86);
|
|
3277 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel;
|
|
3278 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0;
|
|
3279 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false;
|
|
3280 }
|
|
3281 bountyHunting_text = pNPCTopics[352].pText;
|
|
3282 }
|
|
3283 }
|
|
3284
|
|
3285 //----- (004B254D) --------------------------------------------------------
|
|
3286 const char * _4B254D_SkillMasteryTeacher(int trainerInfo)
|
|
3287 {
|
|
3288 int teacherLevel; // edx@1
|
|
3289 int skillBeingTaught; // ecx@1
|
|
3290 int pClassType; // eax@7
|
|
3291 int currClassMaxMastery; // eax@7
|
|
3292 int pointsInSkillWOutMastery; // ebx@7
|
|
3293 int classBaseId; // eax@8
|
|
3294 unsigned int skillMastery; // eax@29
|
|
3295 unsigned __int16 pointsInSkill; // [sp+1Ch] [bp-10h]@7
|
|
3296 int masteryLevelBeingTaught; // [sp+24h] [bp-8h]@7
|
|
3297
|
|
3298 contract_approved = 0;
|
|
3299 teacherLevel = (trainerInfo - 200) % 3;
|
|
3300 skillBeingTaught = (trainerInfo - 200) / 3;
|
|
3301 Player* activePlayer = pPlayers[uActiveCharacter];
|
|
3302 pClassType = activePlayer->classType;
|
|
3303 currClassMaxMastery = byte_4ED970_skill_learn_ability_by_class_table[pClassType][skillBeingTaught];
|
|
3304 masteryLevelBeingTaught = teacherLevel + 2;
|
|
3305 dword_F8B1B0_MasteryBeingTaught = masteryLevelBeingTaught;
|
|
3306 if (currClassMaxMastery < masteryLevelBeingTaught)
|
|
3307 {
|
|
3308 classBaseId = pClassType - pClassType % 4;
|
|
3309 if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 1][skillBeingTaught] >= masteryLevelBeingTaught)
|
|
3310 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 1]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level.
|
|
3311 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught
|
|
3312 && byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught)
|
|
3313 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[634], pClassNames[classBaseId + 2], pClassNames[classBaseId + 3]);//Вы должны достичь звания %s или %s для обучения этому уровню навыка. You have to be promoted to %s or %s to learn this skill level.
|
|
3314 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught)
|
|
3315 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 2]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level.
|
|
3316 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught)
|
|
3317 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 3]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level.
|
|
3318 else
|
|
3319 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Этот уровень навыка не может быть постигнут классом %s. This skill level can not be learned by the %s class.
|
|
3320 return pTmpBuf.data();
|
|
3321 }
|
|
3322 if (!activePlayer->CanAct())
|
|
3323 return pNPCTopics[122].pText; //Not in your condition!
|
|
3324 pointsInSkill = activePlayer->pActiveSkills[skillBeingTaught];
|
|
3325 pointsInSkillWOutMastery = pointsInSkill & 0x3F;
|
|
3326 if (!pointsInSkillWOutMastery)
|
|
3327 return pNPCTopics[131].pText; //You must know the skill before you can become an expert in it!
|
|
3328 skillMastery = SkillToMastery(pointsInSkill);
|
|
3329 if ((signed int)skillMastery > teacherLevel + 1)
|
|
3330 return pNPCTopics[teacherLevel + 128].pText; // You are already an SKILLLEVEL in this skill.
|
|
3331 dword_F8B1AC_award_bit_number = skillBeingTaught;
|
|
3332 if (masteryLevelBeingTaught == 2 && pointsInSkillWOutMastery < 4
|
|
3333 || masteryLevelBeingTaught == 3 && pointsInSkillWOutMastery < 7
|
|
3334 || masteryLevelBeingTaught == 4 && pointsInSkillWOutMastery < 10
|
|
3335 )
|
|
3336 return pNPCTopics[127].pText; //"You don't meet the requirements, and cannot be taught until you do."
|
|
3337 switch (dword_F8B1AC_award_bit_number)
|
|
3338 {
|
|
3339 case PLAYER_SKILL_STAFF:
|
|
3340 case PLAYER_SKILL_SWORD:
|
|
3341 case PLAYER_SKILL_DAGGER:
|
|
3342 case PLAYER_SKILL_AXE:
|
|
3343 case PLAYER_SKILL_SPEAR:
|
|
3344 case PLAYER_SKILL_BOW:
|
|
3345 case PLAYER_SKILL_MACE:
|
|
3346 case PLAYER_SKILL_ARMSMASTER:
|
|
3347 switch (masteryLevelBeingTaught)
|
|
3348 {
|
|
3349 case 2:
|
|
3350 gold_transaction_amount = 2000;
|
|
3351 break;
|
|
3352 case 3:
|
|
3353 gold_transaction_amount = 5000;
|
|
3354 break;
|
|
3355 case 4:
|
|
3356 gold_transaction_amount = 8000;
|
|
3357 break;
|
|
3358 }
|
|
3359 break;
|
|
3360 case PLAYER_SKILL_BLASTER:
|
|
3361 switch (masteryLevelBeingTaught)
|
|
3362 {
|
|
3363 case 2:
|
|
3364 gold_transaction_amount = 0;
|
|
3365 break;
|
|
3366 case 3:
|
|
3367 gold_transaction_amount = 0;
|
|
3368 break;
|
|
3369 case 4:
|
|
3370 gold_transaction_amount = 0;
|
|
3371 break;
|
|
3372 }
|
|
3373 break;
|
|
3374 case PLAYER_SKILL_SHIELD:
|
|
3375 case PLAYER_SKILL_LEATHER:
|
|
3376 case PLAYER_SKILL_CHAIN:
|
|
3377 case PLAYER_SKILL_PLATE:
|
|
3378 switch (masteryLevelBeingTaught)
|
|
3379 {
|
|
3380 case 2:
|
|
3381 gold_transaction_amount = 1000;
|
|
3382 break;
|
|
3383 case 3:
|
|
3384 gold_transaction_amount = 3000;
|
|
3385 break;
|
|
3386 case 4:
|
|
3387 gold_transaction_amount = 7000;
|
|
3388 break;
|
|
3389 }
|
|
3390 break;
|
|
3391 case PLAYER_SKILL_FIRE:
|
|
3392 case PLAYER_SKILL_AIR:
|
|
3393 case PLAYER_SKILL_WATER:
|
|
3394 case PLAYER_SKILL_EARTH:
|
|
3395 case PLAYER_SKILL_SPIRIT:
|
|
3396 case PLAYER_SKILL_MIND:
|
|
3397 case PLAYER_SKILL_BODY:
|
|
3398 switch (masteryLevelBeingTaught)
|
|
3399 {
|
|
3400 case 2:
|
|
3401 gold_transaction_amount = 1000;
|
|
3402 break;
|
|
3403 case 3:
|
|
3404 gold_transaction_amount = 4000;
|
|
3405 break;
|
|
3406 case 4:
|
|
3407 gold_transaction_amount = 8000;
|
|
3408 break;
|
|
3409 }
|
|
3410 break;
|
|
3411 case PLAYER_SKILL_LIGHT:
|
|
3412 switch (masteryLevelBeingTaught)
|
|
3413 {
|
|
3414 case 2:
|
|
3415 gold_transaction_amount = 2000;
|
|
3416 break;
|
|
3417 case 3:
|
|
3418 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 114))
|
|
3419 return pNPCTopics[127].pText;
|
|
3420 gold_transaction_amount = 5000;
|
|
3421 break;
|
|
3422 case 4:
|
|
3423 if (!activePlayer->ProfessionOrGuildFlagsCorrect(0x22u, 1) ||
|
|
3424 !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Au, 1))
|
|
3425 return pNPCTopics[127].pText;
|
|
3426 gold_transaction_amount = 8000;
|
|
3427 break;
|
|
3428 }
|
|
3429 break;
|
|
3430 case PLAYER_SKILL_DARK:
|
|
3431 switch (masteryLevelBeingTaught)
|
|
3432 {
|
|
3433 case 2:
|
|
3434 gold_transaction_amount = 2000;
|
|
3435 break;
|
|
3436 case 3:
|
|
3437 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 110))
|
|
3438 return pNPCTopics[127].pText;
|
|
3439 gold_transaction_amount = 5000;
|
|
3440 break;
|
|
3441 case 4:
|
|
3442 if (!activePlayer->ProfessionOrGuildFlagsCorrect(0x23u, 1)
|
|
3443 || !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Bu, 1))
|
|
3444 return pNPCTopics[127].pText;
|
|
3445 gold_transaction_amount = 8000;
|
|
3446 break;
|
|
3447 }
|
|
3448 break;
|
|
3449 case PLAYER_SKILL_ITEM_ID:
|
|
3450 case PLAYER_SKILL_REPAIR:
|
|
3451 case PLAYER_SKILL_MEDITATION:
|
|
3452 case PLAYER_SKILL_PERCEPTION:
|
|
3453 case PLAYER_SKILL_TRAP_DISARM:
|
|
3454 case PLAYER_SKILL_MONSTER_ID:
|
|
3455 case PLAYER_SKILL_STEALING:
|
|
3456 case PLAYER_SKILL_ALCHEMY:
|
|
3457 switch (masteryLevelBeingTaught)
|
|
3458 {
|
|
3459 case 2:
|
|
3460 gold_transaction_amount = 500;
|
|
3461 break;
|
|
3462 case 3:
|
|
3463 gold_transaction_amount = 2500;
|
|
3464 break;
|
|
3465 case 4:
|
|
3466 gold_transaction_amount = 6000;
|
|
3467 break;
|
|
3468 }
|
|
3469 break;
|
|
3470 case PLAYER_SKILL_MERCHANT:
|
|
3471 switch (masteryLevelBeingTaught)
|
|
3472 {
|
|
3473 case 2:
|
|
3474 gold_transaction_amount = 2000;
|
|
3475 break;
|
|
3476 case 3:
|
|
3477 if (activePlayer->GetBaseWillpower() < 50)
|
|
3478 return pNPCTopics[127].pText;
|
|
3479 gold_transaction_amount = 5000;
|
|
3480 break;
|
|
3481 case 4:
|
|
3482 gold_transaction_amount = 8000;
|
|
3483 break;
|
|
3484 }
|
|
3485 break;
|
|
3486 case PLAYER_SKILL_BODYBUILDING:
|
|
3487 switch (masteryLevelBeingTaught)
|
|
3488 {
|
|
3489 case 2:
|
|
3490 gold_transaction_amount = 500;
|
|
3491 break;
|
|
3492 case 3:
|
|
3493 if (activePlayer->GetBaseEndurance() < 50)
|
|
3494 return pNPCTopics[127].pText;
|
|
3495 gold_transaction_amount = 2500;
|
|
3496 break;
|
|
3497 case 4:
|
|
3498 gold_transaction_amount = 6000;
|
|
3499 break;
|
|
3500 }
|
|
3501 break;
|
|
3502 case PLAYER_SKILL_DIPLOMACY:
|
|
3503 Error("Diplomacy not used");
|
|
3504 break;
|
|
3505 case PLAYER_SKILL_TIEVERY:
|
|
3506 Error("Thievery not used");
|
|
3507 break;
|
|
3508 case PLAYER_SKILL_DODGE:
|
|
3509 switch (masteryLevelBeingTaught)
|
|
3510 {
|
|
3511 case 2:
|
|
3512 gold_transaction_amount = 2000;
|
|
3513 break;
|
|
3514 case 3:
|
|
3515 gold_transaction_amount = 5000;
|
|
3516 break;
|
|
3517 case 4:
|
|
3518 if ((activePlayer->pActiveSkills[PLAYER_SKILL_UNARMED] & 63) < 0xA)
|
|
3519 return pNPCTopics[127].pText;
|
|
3520 gold_transaction_amount = 8000;
|
|
3521 break;
|
|
3522 }
|
|
3523 break;
|
|
3524 case PLAYER_SKILL_UNARMED:
|
|
3525 switch (masteryLevelBeingTaught)
|
|
3526 {
|
|
3527 case 2:
|
|
3528 gold_transaction_amount = 2000;
|
|
3529 break;
|
|
3530 case 3:
|
|
3531 gold_transaction_amount = 5000;
|
|
3532 break;
|
|
3533 case 4:
|
|
3534 if ((activePlayer->pActiveSkills[PLAYER_SKILL_DODGE] & 63) < 0xA)
|
|
3535 return pNPCTopics[127].pText;
|
|
3536 gold_transaction_amount = 8000;
|
|
3537 break;
|
|
3538 }
|
|
3539 break;
|
|
3540 case PLAYER_SKILL_LEARNING:
|
|
3541 switch (masteryLevelBeingTaught)
|
|
3542 {
|
|
3543 case 2:
|
|
3544 gold_transaction_amount = 2000;
|
|
3545 break;
|
|
3546 case 3:
|
|
3547 if (activePlayer->GetBaseIntelligence() < 50)
|
|
3548 return pNPCTopics[127].pText;
|
|
3549 gold_transaction_amount = 5000;
|
|
3550 break;
|
|
3551 case 4:
|
|
3552 gold_transaction_amount = 8000;
|
|
3553 break;
|
|
3554 }
|
|
3555 break;
|
|
3556 default:
|
|
3557 Error("Unknown skill");
|
|
3558 }
|
|
3559 if (gold_transaction_amount > pParty->uNumGold)
|
|
3560 return pNPCTopics[124].pText; //You don't have enough gold!
|
|
3561 contract_approved = 1;
|
|
3562 if (masteryLevelBeingTaught == 2)
|
|
3563 {
|
|
3564 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Получить степень ^Pr[%s] в навыке ^Pr[%s] за ^I[%lu] золот^L[ой;ых;ых]
|
|
3565 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Эксперт
|
|
3566 }
|
|
3567 else if (masteryLevelBeingTaught == 3)
|
|
3568 {
|
|
3569 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
|
|
3570 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Мастер
|
|
3571 }
|
|
3572 else if (masteryLevelBeingTaught == 4)
|
|
3573 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
|
|
3574 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Великий Магистр
|
|
3575 return pTmpBuf2.data();
|
|
3576 }
|
|
3577
|
|
3578 //----- (00495461) --------------------------------------------------------
|
|
3579 char *BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6)
|
|
3580 {
|
|
3581 Player *pPlayer; // ebx@3
|
|
3582 const char *pText; // esi@7
|
|
3583 int v17; // eax@10
|
|
3584 signed __int64 v18; // qax@18
|
|
3585 unsigned __int8 *v20; // ebx@32
|
|
3586 int v21; // ecx@34
|
|
3587 int pReputation; // eax@45
|
|
3588 int v29; // eax@68
|
|
3589 __int16 v55[56]; // [sp+10h] [bp-128h]@34
|
|
3590 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
|
|
3591 char a1[100]; // [sp+B8h] [bp-80h]@3
|
|
3592 int v63; // [sp+12Ch] [bp-Ch]@32
|
|
3593
|
|
3594 if (IsBadStringPtrA(lpsz, 1))
|
|
3595 return "Invalid String Passed";
|
|
3596
|
|
3597 a1[0] = 0;
|
|
3598 pPlayer = &pParty->pPlayers[uPlayerID];
|
|
3599 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2));
|
|
3600
|
|
3601 NPCData *npc = nullptr;
|
|
3602 if (dword_5C35D4)
|
|
3603 npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1
|
|
3604 else
|
|
3605 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID);
|
|
3606
|
|
3607 //pText = a4;
|
|
3608 uint len = strlen(lpsz);
|
|
3609 for (int i = 0, dst = 0; i < len; ++i)
|
|
3610 {
|
|
3611 char c = lpsz[i];
|
|
3612 if (c != '%')
|
|
3613 pTmpBuf2[dst++] = c;
|
|
3614 else
|
|
3615 {
|
|
3616 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0';
|
|
3617
|
|
3618 switch (v17)
|
|
3619 {
|
|
3620 case 1://Подробнее
|
|
3621 strcat(pTmpBuf2.data(), npc->pName);
|
|
3622 dst = strlen(pTmpBuf2.data());
|
|
3623 i += 2;
|
|
3624 break;
|
|
3625 case 2:
|
|
3626 strcat(pTmpBuf2.data(), pPlayer->pName);
|
|
3627 dst = strlen(pTmpBuf2.data());
|
|
3628 i += 2;
|
|
3629 break;
|
|
3630 case 3:
|
|
3631 case 4:
|
|
3632 strcat(pTmpBuf2.data(), a1);
|
|
3633 dst = strlen(pTmpBuf2.data());
|
|
3634 i += 2;
|
|
3635 break;
|
|
3636 case 5:
|
|
3637 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24;
|
|
3638 pText = pGlobalTXT_LocalizationStrings[397];// "evening"
|
|
3639 if (SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0)
|
|
3640 {
|
|
3641 if (SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11)
|
|
3642 {
|
|
3643 if (v18 < 20)
|
|
3644 pText = pGlobalTXT_LocalizationStrings[396];// "day"
|
|
3645 }
|
|
3646 else
|
|
3647 {
|
|
3648 pText = pGlobalTXT_LocalizationStrings[395];// "morning"
|
|
3649 }
|
|
3650 }
|
|
3651 strcat(pTmpBuf2.data(), pText);
|
|
3652 dst = strlen(pTmpBuf2.data());
|
|
3653 i += 2;
|
|
3654 break;
|
|
3655 case 6:
|
|
3656 if (pPlayer->uSex)
|
|
3657 pText = pGlobalTXT_LocalizationStrings[387];// "lady"
|
|
3658 else
|
|
3659 pText = pGlobalTXT_LocalizationStrings[385];// "sir"
|
|
3660 strcat(pTmpBuf2.data(), pText);
|
|
3661 dst = strlen(pTmpBuf2.data());
|
|
3662 i += 2;
|
|
3663 break;
|
|
3664 case 7:
|
|
3665 if (pPlayer->uSex)
|
|
3666 pText = pGlobalTXT_LocalizationStrings[389];// "Lady"
|
|
3667 else
|
|
3668 pText = pGlobalTXT_LocalizationStrings[386];// "Sir"
|
|
3669 strcat(pTmpBuf2.data(), pText);
|
|
3670 dst = strlen(pTmpBuf2.data());
|
|
3671 i += 2;
|
|
3672 break;
|
|
3673 case 8:
|
|
3674 v63 = 0;
|
|
3675 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits;
|
|
3676 for (uint _i = 0; _i < 28; ++_i)
|
|
3677 {
|
|
3678 if ((unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]))
|
|
3679 {
|
|
3680 v21 = v63;
|
|
3681 ++v63;
|
|
3682 v55[v63] = word_4EE150[i];
|
|
3683 }
|
|
3684 }
|
|
3685 if (v63)
|
|
3686 {
|
|
3687 if (dword_A74CDC == -1)
|
|
3688 dword_A74CDC = rand() % v63;
|
|
3689 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
|
|
3690 }
|
|
3691 else
|
|
3692 pText = (char *)pNPCTopics[55].pText;
|
|
3693 strcat(pTmpBuf2.data(), pText);
|
|
3694 dst = strlen(pTmpBuf2.data());
|
|
3695 i += 2;
|
|
3696 break;
|
|
3697 case 9:
|
|
3698 if (npc->uSex)
|
|
3699 pText = pGlobalTXT_LocalizationStrings[384];// "her"
|
|
3700 else
|
|
3701 pText = pGlobalTXT_LocalizationStrings[383];// "his"
|
|
3702 strcat(pTmpBuf2.data(), pText);
|
|
3703 dst = strlen(pTmpBuf2.data());
|
|
3704 i += 2;
|
|
3705 break;
|
|
3706 case 10:
|
|
3707 if (pPlayer->uSex)
|
|
3708 pText = pGlobalTXT_LocalizationStrings[389];// "Lady"
|
|
3709 else
|
|
3710 pText = pGlobalTXT_LocalizationStrings[388];// "Lord"
|
|
3711 strcat(pTmpBuf2.data(), pText);
|
|
3712 dst = strlen(pTmpBuf2.data());
|
|
3713 i += 2;
|
|
3714 break;
|
|
3715 case 11:
|
|
3716 pReputation = pParty->GetPartyReputation();
|
|
3717 if (pReputation >= 25)
|
|
3718 pText = pGlobalTXT_LocalizationStrings[379];
|
|
3719 else//v25 < 25
|
|
3720 {
|
|
3721 if (pReputation < 6)
|
|
3722 {
|
|
3723 if (pReputation >= -5)//6 >= v25 >= -5
|
|
3724 pText = pGlobalTXT_LocalizationStrings[399];
|
|
3725 else// v25 < -5
|
|
3726 {
|
|
3727 if (pReputation < -24)//-24 > v25
|
|
3728 pText = pGlobalTXT_LocalizationStrings[434];
|
|
3729 else// -5 > v25 > -24
|
|
3730 pText = pGlobalTXT_LocalizationStrings[402];
|
|
3731 }
|
|
3732 }
|
|
3733 else//25 > v25 > 6
|
|
3734 pText = pGlobalTXT_LocalizationStrings[392];
|
|
3735 }
|
|
3736 strcat(pTmpBuf2.data(), pText);
|
|
3737 dst = strlen(pTmpBuf2.data());
|
|
3738 i += 2;
|
|
3739 break;
|
|
3740 case 12:
|
|
3741 pReputation = npc->rep;
|
|
3742 if (pReputation >= 25)
|
|
3743 pText = pGlobalTXT_LocalizationStrings[379];//Ненавистный
|
|
3744 else
|
|
3745 {
|
|
3746 if (pReputation < 6)
|
|
3747 {
|
|
3748 if (pReputation >= -5)
|
|
3749 pText = pGlobalTXT_LocalizationStrings[399];//Нейтральная
|
|
3750 else
|
|
3751 {
|
|
3752 if (pReputation < -24)
|
|
3753 pText = pGlobalTXT_LocalizationStrings[434];//Почтенная
|
|
3754 else
|
|
3755 pText = pGlobalTXT_LocalizationStrings[402];//Дружелюбный
|
|
3756 }
|
|
3757 }
|
|
3758 else
|
|
3759 pText = pGlobalTXT_LocalizationStrings[392];//Недружелюбный
|
|
3760 }
|
|
3761 strcat(pTmpBuf2.data(), pText);
|
|
3762 dst = strlen(pTmpBuf2.data());
|
|
3763 i += 2;
|
|
3764 break;
|
|
3765 case 13:
|
|
3766 strcat(pTmpBuf2.data(), pNPCStats->sub_495366_MispronounceName(pPlayer->pName[0], pPlayer->uSex));
|
|
3767 dst = strlen(pTmpBuf2.data());
|
|
3768 i += 2;
|
|
3769 break;
|
|
3770 case 14:
|
|
3771 if (npc->uSex)
|
|
3772 pText = pGlobalTXT_LocalizationStrings[391];// "sister"
|
|
3773 else
|
|
3774 pText = pGlobalTXT_LocalizationStrings[390];// "brother"
|
|
3775 strcat(pTmpBuf2.data(), pText);
|
|
3776 dst = strlen(pTmpBuf2.data());
|
|
3777 i += 2;
|
|
3778 break;
|
|
3779 case 15:
|
|
3780 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter"
|
|
3781 dst = strlen(pTmpBuf2.data());
|
|
3782 i += 2;
|
|
3783 break;
|
|
3784 case 16:
|
|
3785 if (npc->uSex)
|
|
3786 pText = pGlobalTXT_LocalizationStrings[391];// "sister"
|
|
3787 else
|
|
3788 pText = pGlobalTXT_LocalizationStrings[390];// "brother"
|
|
3789 strcat(pTmpBuf2.data(), pText);
|
|
3790 dst = strlen(pTmpBuf2.data());
|
|
3791 i += 2;
|
|
3792 break;
|
|
3793 case 17://текст наёмного НПС
|
|
3794 {
|
|
3795 uint pay_percentage = pNPCStats->pProfessions[npc->uProfession].uHirePrice / 100;
|
|
3796 if (!pay_percentage)
|
|
3797 pay_percentage = 1;
|
|
3798 sprintf(a1, "%lu", pay_percentage);
|
|
3799 strcat(pTmpBuf2.data(), a1);
|
|
3800 dst = strlen(pTmpBuf2.data());
|
|
3801 i += 2;
|
|
3802 break;
|
|
3803 }
|
|
3804 case 18:
|
|
3805 case 19:
|
|
3806 case 20:
|
|
3807 case 21:
|
|
3808 case 22:
|
|
3809 case 26:
|
|
3810 strncpy(a1, lpsz + i + 1, 2);
|
|
3811 sprintf(a1, "%lu", atoi(a1));
|
|
3812 strcat(pTmpBuf2.data(), a1);
|
|
3813 dst = strlen(pTmpBuf2.data());
|
|
3814 i += 2;
|
|
3815 break;
|
|
3816 case 23:
|
|
3817 if (pMapStats->GetMapInfo(pCurrentMapName))
|
|
3818 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName;
|
|
3819 else
|
|
3820 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown"
|
|
3821 strcat(pTmpBuf2.data(), pText);
|
|
3822 dst = strlen(pTmpBuf2.data());
|
|
3823 i += 2;
|
|
3824 break;
|
|
3825 case 24://название товара в продаже
|
|
3826 sprintfex(a1, format_4E2D80, Color16(255, 255, 155), a3->GetDisplayName());
|
|
3827 strcat(pTmpBuf2.data(), a1);
|
|
3828 dst = strlen(pTmpBuf2.data());
|
|
3829 i += 2;
|
|
3830 break;
|
|
3831 case 25:
|
|
3832 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3833 switch (a5)
|
|
3834 {
|
|
3835 case 3:
|
|
3836 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3837 break;
|
|
3838 case 4:
|
|
3839 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3840 break;
|
|
3841 case 5:
|
|
3842 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3843 break;
|
|
3844 case 6:
|
|
3845 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2;
|
|
3846 break;
|
|
3847 }
|
|
3848 sprintfex(a1, "%lu", v29);
|
|
3849 strcat(pTmpBuf2.data(), a1);
|
|
3850 dst = strlen(pTmpBuf2.data());
|
|
3851 i += 2;
|
|
3852 break;
|
|
3853 case 27://текст продажи
|
|
3854 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3855 if (a5 == 3)
|
|
3856 {
|
|
3857 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3858 if (a3->IsBroken())
|
|
3859 v29 = 1;
|
|
3860 sprintfex(a1, "%lu", v29);
|
|
3861 strcat(pTmpBuf2.data(), a1);
|
|
3862 dst = strlen(pTmpBuf2.data());
|
|
3863 i += 2;
|
|
3864 break;
|
|
3865 }
|
|
3866 if (a5 != 4)
|
|
3867 {
|
|
3868 if (a5 == 5)
|
|
3869 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3870 else
|
|
3871 {
|
|
3872 if (a5 == 6)
|
|
3873 {
|
|
3874 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2;
|
|
3875 if (a3->IsBroken())
|
|
3876 v29 = 1;
|
|
3877 if (!v29)
|
|
3878 v29 = 1;
|
|
3879 sprintfex(a1, "%lu", v29);
|
|
3880 strcat(pTmpBuf2.data(), a1);
|
|
3881 dst = strlen(pTmpBuf2.data());
|
|
3882 i += 2;
|
|
3883 break;
|
|
3884 }
|
|
3885 }
|
|
3886 sprintfex(a1, "%lu", v29);
|
|
3887 strcat(pTmpBuf2.data(), a1);
|
|
3888 dst = strlen(pTmpBuf2.data());
|
|
3889 i += 2;
|
|
3890 break;
|
|
3891 }
|
|
3892 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier));
|
|
3893 strcat(pTmpBuf2.data(), a1);
|
|
3894 dst = strlen(pTmpBuf2.data());
|
|
3895 i += 2;
|
|
3896 break;
|
|
3897 case 28://профессия
|
|
3898 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle);
|
|
3899 dst = strlen(pTmpBuf2.data());
|
|
3900 i += 2;
|
|
3901 break;
|
|
3902 case 29:
|
|
3903 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier));
|
|
3904 strcat(pTmpBuf2.data(), a1);
|
|
3905 dst = strlen(pTmpBuf2.data());
|
|
3906 i += 2;
|
|
3907 break;
|
|
3908 case 30:
|
|
3909 if (!a6)
|
|
3910 {
|
|
3911 strcat(pTmpBuf2.data(), a4);
|
|
3912 dst = strlen(pTmpBuf2.data());
|
|
3913 i += 2;
|
|
3914 break;
|
|
3915 }
|
|
3916 init_summoned_item(&v56, *a6);
|
|
3917 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
|
|
3918 strcat(pTmpBuf2.data(), a1);
|
|
3919 dst = strlen(pTmpBuf2.data());
|
|
3920 i += 2;
|
|
3921 break;
|
|
3922 case 31:
|
|
3923 case 32:
|
|
3924 case 33:
|
|
3925 case 34:
|
|
3926 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName);
|
|
3927 dst = strlen(pTmpBuf2.data());
|
|
3928 i += 2;
|
|
3929 break;
|
|
3930 default:
|
|
3931 if (v17 <= 50 || v17 > 70)
|
|
3932 {
|
|
3933 strncpy(a1, lpsz + i + 1, 2);
|
|
3934 sprintf(a1, "%lu", atoi(a1));
|
|
3935 strcat(pTmpBuf2.data(), a1);
|
|
3936 dst = strlen(pTmpBuf2.data());
|
|
3937 i += 2;
|
|
3938 break;
|
|
3939 }
|
|
3940 if (v17 - 51 >= 20)
|
|
3941 {
|
|
3942 strcat(pTmpBuf2.data(), a4);
|
|
3943 dst = strlen(pTmpBuf2.data());
|
|
3944 i += 2;
|
|
3945 break;
|
|
3946 }
|
|
3947 init_summoned_item(&v56, pParty->PartyTimes._s_times[v17 - 51]);
|
|
3948 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
|
|
3949 strcat(pTmpBuf2.data(), a1);
|
|
3950 dst = strlen(pTmpBuf2.data());
|
|
3951 i += 2;
|
|
3952 break;
|
|
3953 }
|
|
3954 }
|
|
3955 }
|
|
3956 return pTmpBuf2.data();
|
|
3957 }
|
|
3958
|
|
3959 //----- (0044C175) --------------------------------------------------------
|
|
3960 void ShowStatusBarString(const char *pString, unsigned int uNumSeconds)
|
|
3961 {
|
|
3962 strcpy(GameUI_Footer_TimedString.data(), pString);
|
|
3963 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount();
|
|
3964
|
|
3965 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450;
|
|
3966 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()))
|
|
3967 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0;
|
|
3968 }
|
|
3969
|
|
3970 //----- (0044C1D0) --------------------------------------------------------
|
|
3971 void ShowNothingHereStatus()
|
|
3972 {
|
|
3973 if (!GameUI_Footer_TimeLeft)
|
|
3974 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here
|
|
3975 }
|
|
3976
|
|
3977 //----- (0044C28B) --------------------------------------------------------
|
|
3978 int const_2()
|
|
3979 {
|
|
3980 return 2;
|
|
3981 }
|