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