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);
|
|
804 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]);
|
|
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) --------------------------------------------------------
|
|
1074 void GUIWindow::DrawText( GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, signed int uFontShadowColor )
|
|
1075 {
|
|
1076 GUIWindow *v9; // edi@1
|
|
1077 GUIFont *v10; // ebx@1
|
|
1078 int v11; // eax@2
|
|
1079 signed int v12; // esi@9
|
|
1080 signed int v13; // edi@9
|
|
1081 int v14; // edx@9
|
|
1082 int v15; // eax@25
|
|
1083 unsigned int v16; // ecx@25
|
|
1084 int v17; // eax@27
|
|
1085 int v18; // edi@32
|
|
1086 int v19; // esi@38
|
|
1087 std::string v21; // [sp-18h] [bp-50h]@2
|
|
1088 // const char *v22; // [sp-8h] [bp-40h]@2
|
|
1089 // int v23; // [sp-4h] [bp-3Ch]@2
|
|
1090 char Dest[6]; // [sp+Ch] [bp-2Ch]@32
|
|
1091 //char v25; // [sp+Fh] [bp-29h]@32
|
|
1092 //char v26; // [sp+11h] [bp-27h]@34
|
|
1093 const char *v27; // [sp+20h] [bp-18h]@25
|
|
1094 int v28; // [sp+24h] [bp-14h]@25
|
|
1095 int v29; // [sp+28h] [bp-10h]@1
|
|
1096 size_t v30; // [sp+2Ch] [bp-Ch]@4
|
|
1097 GUIWindow *v31; // [sp+30h] [bp-8h]@1
|
|
1098 const char *v32; // [sp+34h] [bp-4h]@7
|
|
1099 size_t pInString; // [sp+4Ch] [bp+14h]@11
|
|
1100
|
|
1101 GUIWindow* a1 = this;
|
|
1102 v29 = 0;
|
|
1103 v9 = a1;
|
|
1104 v10 = a2;
|
|
1105 v31 = a1;
|
|
1106 if ( !Str )
|
|
1107 {
|
|
1108 MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0);
|
|
1109 return;
|
|
1110 }
|
|
1111 v11 = strcmp(Str, "null");
|
|
1112 if ( v11 )
|
|
1113 {
|
|
1114 v30 = strlen(Str);
|
|
1115 LOBYTE(v11) = 0;
|
|
1116 if ( !uX )
|
|
1117 uX = 12;
|
|
1118 if ( a8 )
|
|
1119 v32 = Str;
|
|
1120 else
|
|
1121 {
|
|
1122 v11 = (int)FitTextInAWindow(Str, v10, v9, uX, 0);
|
|
1123 v32 = (const char *)v11;
|
|
1124 }
|
|
1125 v12 = uX + v9->uFrameX;
|
|
1126 v13 = uY + v9->uFrameY;
|
|
1127 v14 = 0;
|
|
1128 if ( !a8 || (v11 = v13 + LOBYTE(v10->uFontHeight), v11 <= a8) )
|
|
1129 {
|
|
1130 pInString = 0;
|
|
1131 if ( (signed int)v30 > 0 )
|
|
1132 {
|
|
1133 do
|
|
1134 {
|
|
1135 LOBYTE(v11) = v32[v14];
|
|
1136 if ( (unsigned __int8)v11 >= v10->cFirstChar && (unsigned __int8)v11 <= v10->cLastChar
|
|
1137 || (char)v11 == 12
|
|
1138 || (char)v11 == 13
|
|
1139 || (char)v11 == 9
|
|
1140 || (char)v11 == 10 )
|
|
1141 {
|
|
1142 switch ( (unsigned __int8)v11 )
|
|
1143 {
|
|
1144 case 9u:
|
|
1145 strncpy(Dest, &v32[v14 + 1], 3);
|
|
1146 Dest[3] = 0;
|
|
1147 pInString += 3;
|
|
1148 v29 = atoi(Dest);
|
|
1149 v19 = atoi(Dest);
|
|
1150 LOBYTE(v11) = (char)v31;
|
|
1151 v12 = uX + v31->uFrameX + v19;
|
|
1152 break;
|
|
1153 case 0xAu:
|
|
1154 v11 = LOBYTE(v10->uFontHeight);
|
|
1155 uY = uY + v11 - 3;
|
|
1156 v13 = uY + v31->uFrameY;
|
|
1157 v12 = uX + v29 + v31->uFrameX;
|
|
1158 if ( a8 )
|
|
1159 {
|
|
1160 v11 = v11 + v13 - 3;
|
|
1161 if ( v11 > a8 )
|
|
1162 return;
|
|
1163 }
|
|
1164 break;
|
|
1165 case 0xCu:
|
|
1166 strncpy(Dest, &v32[v14 + 1], 5);
|
|
1167 Dest[5] = 0;
|
|
1168 v11 = atoi(Dest);
|
|
1169 pInString += 5;
|
|
1170 uFontColor = v11;
|
|
1171 break;
|
|
1172 case 0xDu:
|
|
1173 strncpy(Dest, &v32[v14 + 1], 3);
|
|
1174 Dest[3] = 0;
|
|
1175 pInString += 3;
|
|
1176 v18 = atoi(Dest);
|
|
1177 v11 = v10->GetLineWidth(&v32[pInString]);
|
|
1178 v12 = v31->uFrameZ - v11 - v18;
|
|
1179 v13 = uY + v31->uFrameY;
|
|
1180 if ( a8 )
|
|
1181 {
|
|
1182 v11 = LOBYTE(v10->uFontHeight);
|
|
1183 v11 = v11 + v13 - 3;
|
|
1184 if ( v11 > a8 )
|
|
1185 return;
|
|
1186 break;
|
|
1187 }
|
|
1188 break;
|
|
1189 default:
|
|
1190 if ( (char)v11 == 34 && v32[v14 + 1] == 34 )
|
|
1191 {
|
|
1192 ++v14;
|
|
1193 pInString = v14;
|
|
1194 }
|
|
1195 v27 = &v32[v14];
|
|
1196 v15 = (unsigned __int8)v32[v14];
|
|
1197 v16 = *((int *)&v10->cFirstChar + 3 * v15 + 9);
|
|
1198 v28 = *((int *)&v10->cFirstChar + 3 * v15 + 9);
|
|
1199 if ( v14 > 0 )
|
|
1200 v12 += v10->pMetrics[v15].uLeftSpacing;
|
|
1201 v17 = (int)((char *)&v10[1] + v10->font_pixels_offset[v15]);
|
|
1202 if ( (short)uFontColor )
|
|
1203 pRenderer->DrawText(v12, v13, (unsigned __int8 *)v17, v16, LOBYTE(v10->uFontHeight),
|
|
1204 v10->pFontPalettes[0], uFontColor, uFontShadowColor);
|
|
1205 else
|
|
1206 pRenderer->DrawTextPalette(v12, v13, (unsigned char*)v17, v16, LOBYTE(v10->uFontHeight),
|
|
1207 v10->pFontPalettes[0], a7);
|
|
1208 LOBYTE(v11) = v30;
|
|
1209 v12 += v28;
|
|
1210 if ( (signed int)pInString < (signed int)v30 )
|
|
1211 {
|
|
1212 LOBYTE(v11) = 3 * *v27;
|
|
1213 v12 += v10->pMetrics[(unsigned __int8)*v27].uRightSpacing;
|
|
1214 }
|
|
1215 break;
|
|
1216 }
|
|
1217 }
|
|
1218 v14 = pInString++ + 1;
|
|
1219 }
|
|
1220 while ( (signed int)pInString < (signed int)v30 );
|
|
1221 }
|
|
1222 }
|
|
1223 }
|
|
1224 return;
|
|
1225 }
|
|
1226
|
|
1227
|
|
1228 //----- (0044CB4F) --------------------------------------------------------
|
|
1229 int GUIWindow::DrawTextInRect( GUIFont *pFont, unsigned int uX, unsigned int uY, unsigned int uColor, const char *text, int rect_width, int reverse_text )
|
|
1230 {
|
|
1231 int pLineWidth; // ebx@1
|
|
1232 int text_width; // esi@3
|
|
1233 unsigned __int8 v12; // cl@7
|
|
1234 signed int v13; // esi@19
|
|
1235 signed int v14; // ebx@19
|
|
1236 unsigned __int8 v15; // cl@21
|
|
1237 // int v16; // eax@22
|
|
1238 // int v17; // ecx@22
|
|
1239 // int v18; // ecx@23
|
|
1240 // int v19; // ecx@24
|
|
1241 unsigned int v20; // ecx@26
|
|
1242 unsigned char* v21; // eax@28
|
|
1243 // int v22; // ebx@34
|
|
1244 int v23; // eax@34
|
|
1245 int v24; // ebx@36
|
|
1246 char Str[6]; // [sp+Ch] [bp-20h]@34
|
|
1247 // char v26; // [sp+Fh] [bp-1Dh]@34
|
|
1248 // char v27; // [sp+11h] [bp-1Bh]@35
|
|
1249 int v28; // [sp+20h] [bp-Ch]@17
|
|
1250 GUIWindow *pWindow; // [sp+24h] [bp-8h]@1
|
|
1251 size_t pNumLen; // [sp+28h] [bp-4h]@1
|
|
1252 size_t Str1a; // [sp+40h] [bp+14h]@5
|
|
1253 // size_t Str1b; // [sp+40h] [bp+14h]@19
|
|
1254 // const char *Sourcea; // [sp+44h] [bp+18h]@20
|
|
1255 // int v34; // [sp+48h] [bp+1Ch]@26
|
|
1256 int i;
|
|
1257
|
|
1258
|
|
1259 pWindow = this;
|
|
1260 pNumLen = strlen(text);
|
|
1261 pLineWidth = pFont->GetLineWidth(text);
|
|
1262 if ( pLineWidth < rect_width )
|
|
1263 {
|
|
1264 pWindow->DrawText(pFont, uX, uY, uColor, text, 0, 0, 0);
|
|
1265 return pLineWidth;
|
|
1266 }
|
|
1267 strcpy(pTmpBuf2.data(), text);
|
|
1268 text_width = 0;
|
|
1269 if ( reverse_text )
|
|
1270 _strrev(pTmpBuf2.data());
|
|
1271 Str1a = 0;
|
|
1272 for ( i = 0; i < pNumLen; ++i )
|
|
1273 {
|
|
1274 if ( text_width >= rect_width )
|
|
1275 break;
|
|
1276 v12 = pTmpBuf2[i];
|
|
1277 if ( pFont->IsCharValid(v12) )
|
|
1278 {
|
|
1279 switch (v12)
|
|
1280 {
|
|
1281 case '\t':// Horizontal tab 09
|
|
1282 case '\n': //Line Feed 0A 10
|
|
1283 case '\r': //Form Feed, page eject 0C 12
|
|
1284 break;
|
|
1285 case '\f': //Carriage Return 0D 13
|
|
1286 i += 5;
|
|
1287 break;
|
|
1288 default:
|
|
1289 if ( i > 0 )
|
|
1290 text_width += pFont->pMetrics[v12].uLeftSpacing;
|
|
1291 text_width += pFont->pMetrics[v12].uWidth;
|
|
1292 if ( i < pNumLen )
|
|
1293 text_width += pFont->pMetrics[v12].uRightSpacing;
|
|
1294 }
|
|
1295 }
|
|
1296 }
|
|
1297 pTmpBuf2[i - 1] = 0;
|
|
1298
|
|
1299
|
|
1300 pNumLen = strlen(pTmpBuf2.data());
|
|
1301 v28 = pFont->GetLineWidth(pTmpBuf2.data());
|
|
1302 if ( reverse_text )
|
|
1303 _strrev(pTmpBuf2.data());
|
|
1304
|
|
1305 v13 = uX + pWindow->uFrameX;
|
|
1306 v14 = uY + pWindow->uFrameY;
|
|
1307 for (i=0; i<pNumLen; ++i)
|
|
1308 {
|
|
1309 v15 = pTmpBuf2[i];
|
|
1310 if ( pFont->IsCharValid(v15) )
|
|
1311 {
|
|
1312 switch (v12)
|
|
1313 {
|
|
1314 case '\t':// Horizontal tab 09
|
|
1315 {
|
|
1316 strncpy(Str, &pTmpBuf2[i+1], 3);
|
|
1317 Str[3] = 0;
|
|
1318 // atoi(Str);
|
|
1319 i += 3;
|
|
1320 break;
|
|
1321 }
|
|
1322 case '\n': //Line Feed 0A 10
|
|
1323 {
|
|
1324 v24 = pFont->uFontHeight;
|
|
1325 v13 = uX;
|
|
1326 uY = uY + pFont->uFontHeight - 3;
|
|
1327 v14 = uY+pFont->uFontHeight - 3;
|
|
1328 break;
|
|
1329 }
|
|
1330 case '\r': //Form Feed, page eject 0C 12
|
|
1331 {
|
|
1332 strncpy(Str, &pTmpBuf2[i+1], 5);
|
|
1333 Str[5] = 0;
|
|
1334 i += 5;
|
|
1335 uColor = atoi(Str);
|
|
1336 break;
|
|
1337 }
|
|
1338 case '\f': //Carriage Return 0D 13
|
|
1339 {
|
|
1340 strncpy(Str, &pTmpBuf2[i+1], 3);
|
|
1341 Str[3] = 0;
|
|
1342 i += 3;
|
|
1343 v23 = pFont->GetLineWidth(&pTmpBuf2[i]);
|
|
1344 v13 = pWindow->uFrameZ - v23 - atoi(Str);
|
|
1345 v14 = uY;
|
|
1346 break;
|
|
1347 }
|
|
1348 default:
|
|
1349 v20 = pFont->pMetrics[v15].uWidth;
|
|
1350 if ( i > 0 )
|
|
1351 v13 += pFont->pMetrics[v15].uLeftSpacing;
|
|
1352 v21 = &pFont->pFontData[pFont->font_pixels_offset[v15]];
|
|
1353 if ( uColor )
|
|
1354 pRenderer->DrawText(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], uColor, 0);
|
|
1355 else
|
|
1356 pRenderer->DrawTextPalette(v13, v14, v21, v20, pFont->uFontHeight, pFont->pFontPalettes[0], 0);
|
|
1357 v13 += v20;
|
|
1358 if ( i < (signed int)pNumLen )
|
|
1359 v13 += pFont->pMetrics[v15].uRightSpacing;
|
|
1360 }
|
|
1361 }
|
|
1362 }
|
|
1363 return v28;
|
|
1364 }
|
|
1365
|
|
1366 //----- (0041D12F) --------------------------------------------------------
|
|
1367 GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight,
|
|
1368 int a6, int a7, UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...)
|
|
1369 {
|
|
1370 GUIButton *pButton; // esi@1
|
|
1371 // unsigned int v13; // eax@1
|
|
1372 // unsigned int v14; // ebx@4
|
|
1373 // unsigned int v15; // eax@4
|
|
1374 unsigned int TextureNum=0; // ebx@4
|
|
1375 // unsigned int v17; // eax@4
|
|
1376 // Texture *v18; // eax@4
|
|
1377 // Texture **v19; // ecx@5
|
|
1378 // Texture **v20; // edx@5
|
|
1379 // GUIButton *v21; // eax@7
|
|
1380 va_list texturs_ptr;
|
|
1381
|
|
1382 pButton = (GUIButton *)malloc(0xBC);
|
|
1383 pButton->pParent = this;
|
|
1384 pButton->uWidth = uWidth;
|
|
1385 pButton->uHeight = uHeight;
|
|
1386
|
|
1387 if ( a6 == 2 && !uHeight )
|
|
1388 pButton->uHeight = uWidth;
|
|
1389
|
|
1390 pButton->uButtonType = a6;
|
|
1391 pButton->uX = uX + this->uFrameX;
|
|
1392 pButton->uY = uY + this->uFrameY;
|
|
1393 pButton->uZ = pButton->uX + uWidth - 1;
|
|
1394 pButton->uW = pButton->uY + uHeight - 1;
|
|
1395 pButton->field_2C_is_pushed = 0;
|
|
1396 pButton->field_1C = a7;
|
|
1397 pButton->msg = msg;
|
|
1398 pButton->msg_param = msg_param;
|
|
1399 pButton->uHotkey = uHotkey;
|
|
1400 //strlen(pName);
|
|
1401 strcpy(pButton->pButtonName, pName);
|
|
1402 va_start(texturs_ptr, pName);
|
|
1403 while (NULL!=(pTextures=va_arg(texturs_ptr, Texture *)))
|
|
1404 {
|
|
1405 pButton->pTextures[TextureNum]=pTextures;
|
|
1406 ++TextureNum;
|
|
1407 }
|
|
1408 va_end(texturs_ptr);
|
|
1409 pButton->uNumTextures = TextureNum;
|
|
1410 if ( this->pControlsTail )
|
|
1411 this->pControlsTail->pNext = pButton;
|
|
1412 else
|
|
1413 this->pControlsHead = pButton;
|
|
1414 pButton->pPrev = this->pControlsTail;
|
|
1415 this->pControlsTail = pButton;
|
|
1416 pButton->pNext = 0;
|
|
1417 ++this->uNumControls;
|
|
1418 return pButton;
|
|
1419 }
|
|
1420
|
|
1421 //----- (00459C2B) --------------------------------------------------------
|
|
1422 void GUIWindow::DrawFlashingInputCursor( signed int uX, int uY, struct GUIFont *a2 )
|
|
1423 {
|
|
1424 if ( GetTickCount() % 1000 > 500 )
|
|
1425 DrawText(a2, uX, uY, 0, "_", 0, 0, 0);
|
|
1426 }
|
|
1427
|
|
1428 //----- (0041C432) --------------------------------------------------------
|
|
1429 GUIWindow * GUIWindow::Create( unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eWindowType, int pButton, const char* hint )
|
|
1430 {
|
|
1431 unsigned int uNextFreeWindowID; // ebp@1
|
|
1432 //int *v8; // eax@1
|
|
1433 //GUIWindow *pWindow; // esi@4
|
|
1434 //int v10; // eax@4
|
|
1435 unsigned int v11; // ebx@15
|
|
1436 NPCData *speakingNPC; // ebp@15
|
|
1437 int v14; // eax@20
|
|
1438 int v16; // eax@25
|
|
1439 int v18; // eax@30
|
|
1440 int v20; // eax@35
|
|
1441 int v22; // eax@40
|
|
1442 int v24; // eax@45
|
|
1443 // int v25; // eax@65
|
|
1444 unsigned int v26; // ebx@65
|
|
1445 char *v27; // eax@71
|
|
1446 const char *v29; // [sp-8h] [bp-18h]@68
|
|
1447 char *v30; // [sp-4h] [bp-14h]@68
|
|
1448 // int uWidtha; // [sp+14h] [bp+4h]@66
|
|
1449 int num_menu_buttons; // [sp+20h] [bp+10h]@15
|
|
1450
|
|
1451 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID)
|
|
1452 {
|
|
1453 if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null)
|
|
1454 break;
|
|
1455 }
|
|
1456
|
|
1457 GUIWindow* pWindow = &pWindowList[uNextFreeWindowID];
|
|
1458 pWindow->uFrameWidth = uWidth;
|
|
1459 pWindow->uFrameHeight = uHeight;
|
|
1460
|
|
1461 pWindow->uFrameX = uX;
|
|
1462 pWindow->uFrameY = uY;
|
|
1463 pWindow->uFrameZ = uX + uWidth - 1;
|
|
1464 pWindow->uFrameW = uY + uHeight - 1;
|
|
1465
|
|
1466 pWindow->ptr_1C = (void *)pButton;
|
|
1467 pWindow->Hint = hint;
|
|
1468
|
|
1469 pWindow->eWindowType = eWindowType;
|
|
1470 pWindow->receives_keyboard_input = false;
|
|
1471 ++uNumVisibleWindows;
|
|
1472 pWindow->numVisibleWindows = uNumVisibleWindows;
|
|
1473 pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1;
|
|
1474 if ( (signed int)eWindowType <= 20 )
|
|
1475 {
|
|
1476 if (eWindowType != WINDOW_Chest)
|
|
1477 {
|
|
1478 switch (eWindowType)
|
|
1479 {
|
|
1480 case WINDOW_Book: {
|
|
1481 pWindow->InitializeBookView();
|
|
1482 break;
|
|
1483 }
|
|
1484 case WINDOW_Dialogue: {
|
|
1485 pMainScreenNum = pCurrentScreen;
|
|
1486 pCurrentScreen = SCREEN_NPC_DIALOGUE;
|
|
1487 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit"
|
|
1488 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
1489 if ( pWindow->par1C != 1 )
|
|
1490 {
|
|
1491 num_menu_buttons = 0;
|
|
1492 v11 = LOBYTE(pFontArrus->uFontHeight) - 3;
|
|
1493 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
|
|
1494 if ( GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1 )//QuestsNPC_greet
|
|
1495 {
|
|
1496 if ( speakingNPC->joins )
|
|
1497 {
|
|
1498 pWindow->CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0);
|
|
1499 num_menu_buttons = 1;
|
|
1500 }
|
|
1501 if ( speakingNPC->evt_A )
|
|
1502 {
|
|
1503 if ( num_menu_buttons < 4 )
|
|
1504 {
|
|
1505 v14 = NPC_EventProcessor(speakingNPC->evt_A);
|
|
1506 if ( v14 == 1 || v14 == 2 )
|
|
1507 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0);
|
|
1508 }
|
|
1509 }
|
|
1510 if ( speakingNPC->evt_B )
|
|
1511 {
|
|
1512 if ( num_menu_buttons < 4 )
|
|
1513 {
|
|
1514 v16 = NPC_EventProcessor(speakingNPC->evt_B);
|
|
1515 if ( v16 == 1 || v16 == 2 )
|
|
1516 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0);
|
|
1517 }
|
|
1518 }
|
|
1519 if ( speakingNPC->evt_C )
|
|
1520 {
|
|
1521 if ( num_menu_buttons < 4 )
|
|
1522 {
|
|
1523 v18 = NPC_EventProcessor(speakingNPC->evt_C);
|
|
1524 if ( v18 == 1 || v18 == 2 )
|
|
1525 pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0);
|
|
1526 }
|
|
1527 }
|
|
1528 if ( speakingNPC->evt_D )
|
|
1529 {
|
|
1530 if ( num_menu_buttons < 4 )
|
|
1531 {
|
|
1532 v20 = NPC_EventProcessor(speakingNPC->evt_D);
|
|
1533 if ( v20 == 1 || v20 == 2 )
|
|
1534 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0);
|
|
1535 }
|
|
1536 }
|
|
1537 if ( speakingNPC->evt_E )
|
|
1538 {
|
|
1539 if ( num_menu_buttons < 4 )
|
|
1540 {
|
|
1541 v22 = NPC_EventProcessor(speakingNPC->evt_E);
|
|
1542 if ( v22 == 1 || v22 == 2 )
|
|
1543 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0);
|
|
1544 }
|
|
1545 }
|
|
1546 if (speakingNPC->evt_F )
|
|
1547 {
|
|
1548 if ( num_menu_buttons < 4 )
|
|
1549 {
|
|
1550 v24 = NPC_EventProcessor(speakingNPC->evt_F);
|
|
1551 if ( v24 == 1 || v24 == 2 )
|
|
1552 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0);
|
|
1553 }
|
|
1554 }
|
|
1555 }
|
|
1556 else
|
|
1557 {
|
|
1558 if ( speakingNPC->joins )
|
|
1559 {
|
|
1560 pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее
|
|
1561 if (speakingNPC->Hired())
|
|
1562 {
|
|
1563 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить
|
|
1564 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0);
|
|
1565 }
|
|
1566 else
|
|
1567 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять
|
|
1568 num_menu_buttons = 2;
|
|
1569 }
|
|
1570 }
|
|
1571 pWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1);
|
|
1572 }
|
|
1573 break;
|
|
1574 }
|
|
1575 case WINDOW_ChangeLocation:
|
|
1576 {
|
|
1577 pMainScreenNum = pCurrentScreen;
|
|
1578 pCurrentScreen = SCREEN_CHANGE_LOCATION;
|
|
1579 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);//Остаться в этой области
|
|
1580 pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
|
|
1581 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0);
|
|
1582 pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0);
|
|
1583 break;
|
|
1584 }
|
|
1585 case WINDOW_SpellBook: {// окно книги заклов
|
|
1586 InitializeBookTextures();
|
|
1587 pWindow->OpenSpellBook();
|
|
1588 break;
|
|
1589 }
|
|
1590 case WINDOW_GreetingNPC: {// окно приветствия НПС
|
|
1591 pMainScreenNum = pCurrentScreen;
|
|
1592 pKeyActionMap->EnterText(0, 15, pWindow);
|
|
1593 pCurrentScreen = SCREEN_BRANCHLESS_NPC_DIALOG;
|
|
1594 break;
|
|
1595 }
|
|
1596
|
|
1597 }
|
|
1598 return pWindow;
|
|
1599 }
|
|
1600 //LABEL_62:
|
|
1601 pWindow->CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
|
|
1602 pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
|
|
1603 pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
|
|
1604 pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
|
|
1605 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9, "", 0);
|
|
1606 return pWindow;
|
|
1607 }
|
|
1608 if (eWindowType == WINDOW_HouseInterior)
|
|
1609 {
|
|
1610 pCurrentScreen = SCREEN_HOUSE;
|
|
1611 pBtn_ExitCancel = pWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания
|
|
1612 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
1613 for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 )
|
|
1614 {
|
|
1615 if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic )
|
|
1616 {
|
|
1617 v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
|
|
1618 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];
|
|
1619 }
|
|
1620 else
|
|
1621 {
|
|
1622 if ( v26 || !dword_591080 )
|
|
1623 v27 = HouseNPCData[v26 +1 - ((dword_591080 != 0)? 1:0)]->pName;
|
|
1624 else
|
|
1625 v27 = (char*)p2DEvents[pButton - 1].pProprieterName;
|
|
1626 v30 = v27;
|
|
1627 v29 = (char*)pGlobalTXT_LocalizationStrings[435];
|
|
1628 }
|
|
1629 sprintfex(byte_591180[v26].data(), v29, v30);
|
|
1630 HouseNPCPortraitsButtonsList[v26] = pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26],
|
|
1631 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26],
|
|
1632 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0);
|
|
1633 }
|
|
1634 if ( uNumDialogueNPCPortraits == 1 )
|
|
1635 {
|
|
1636 window_SpeakInHouse = &pWindowList[uNextFreeWindowID];
|
|
1637 _4B4224_UpdateNPCTopics(0);
|
|
1638 }
|
|
1639 }
|
|
1640 else
|
|
1641 {
|
|
1642 if (eWindowType == WINDOW_Transition)
|
|
1643 {
|
|
1644 pMainScreenNum = pCurrentScreen;
|
|
1645 pCurrentScreen = SCREEN_INPUT_BLV;
|
|
1646 pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Отмена
|
|
1647 pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
|
|
1648 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0);
|
|
1649 pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0);
|
|
1650 return pWindow;
|
|
1651 }
|
|
1652 if (eWindowType == WINDOW_CastSpell)
|
|
1653 {
|
|
1654 pEventTimer->Pause();
|
|
1655 pAudioPlayer->StopChannels(-1, -1);
|
|
1656 pMouse->SetCursorBitmap("MICON2");
|
|
1657 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u);//Выберите цель
|
|
1658 return pWindow;
|
|
1659 }
|
|
1660 if (eWindowType == WINDOW_Scroll)
|
|
1661 {
|
|
1662 pWindow->CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
|
|
1663 pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
|
|
1664 pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
|
|
1665 pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
|
|
1666 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0);
|
|
1667 return pWindow;
|
|
1668 }
|
|
1669 if (eWindowType == WINDOW_CastSpell_InInventory)
|
|
1670 {
|
|
1671 pMouse->SetCursorBitmap("MICON2");
|
|
1672 pBtn_ExitCancel = pWindow->CreateButton(392, 318, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена
|
|
1673 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);
|
|
1674 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Выбрать цель
|
|
1675 ++pIcons_LOD->uTexturePacksCount;
|
|
1676 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
|
|
1677 pCurrentScreen = SCREEN_CASTING;
|
|
1678 if ( !pIcons_LOD->uNumPrevLoadedFiles )
|
|
1679 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
|
|
1680 }
|
|
1681 }
|
|
1682 return pWindow;
|
|
1683 }
|
|
1684 //----- (004B3EF0) --------------------------------------------------------
|
|
1685 void DrawJoinGuildWindow( int pEventCode )
|
|
1686 {
|
|
1687 uDialogueType = 81;//enum JoinGuildDialog
|
|
1688 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText;
|
|
1689 ContractSelectText(pEventCode);
|
|
1690 pDialogueWindow->Release();
|
|
1691 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, pEventCode, 0);
|
|
1692 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel
|
|
1693 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
|
|
1694 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0);
|
|
1695 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
|
|
1696 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
|
|
1697 }
|
|
1698 //----- (0044603D) --------------------------------------------------------
|
|
1699 void DialogueEnding()
|
|
1700 {
|
|
1701 sDialogue_SpeakingActorNPC_ID = 0;
|
|
1702 pDialogueWindow->Release();
|
|
1703 pDialogueWindow = 0;
|
|
1704 pMiscTimer->Resume();
|
|
1705 pEventTimer->Resume();
|
|
1706 }
|
|
1707 //----- (004156F0) --------------------------------------------------------
|
|
1708 void GUI_UpdateWindows()
|
|
1709 {
|
|
1710 GUIWindow *pWindow; // esi@4
|
|
1711 //unsigned int pWindowType; // eax@4
|
|
1712 const char *pHint; // edx@66
|
|
1713 // GUIButton *pButtonPtr_1C; // ebp@79
|
|
1714 // char *pHint1; // edx@80
|
|
1715 int v26; // eax@98
|
|
1716 unsigned int v27; // ebp@106
|
|
1717 GUIWindow *pGUIWindow2; // ecx@109
|
|
1718 // GUIFont *pGUIFont; // ST1C_4@115
|
|
1719 int v31; // eax@115
|
|
1720 GUIButton *pButton; // ebp@118
|
|
1721 int v39; // eax@129
|
|
1722 unsigned int pNumMessages; // eax@142
|
|
1723 GUIButton *pGUIButton; // ebp@146
|
|
1724 //unsigned int pX; // [sp-1Ch] [bp-124h]@17
|
|
1725 //unsigned int pY; // [sp-18h] [bp-120h]@17
|
|
1726 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17
|
|
1727 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86
|
|
1728 int i; // [sp+0h] [bp-108h]@3
|
|
1729 // ItemGen pItemGen; // [sp+4h] [bp-104h]@98
|
|
1730 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133
|
|
1731 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129
|
|
1732
|
|
1733 if (GetCurrentMenuID() != MENU_CREATEPARTY)
|
|
1734 Mouse::UI_OnKeyDown(VK_NEXT);
|
|
1735
|
|
1736 for ( i = 1; i <= uNumVisibleWindows; ++i )
|
|
1737 {
|
|
1738 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
|
|
1739 switch (pWindow->eWindowType)
|
|
1740 {
|
|
1741 case WINDOW_OptionsButtons:
|
|
1742 {
|
|
1743 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y,
|
|
1744 pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options));
|
|
1745 viewparams->bRedrawGameUI = 1;
|
|
1746 continue;
|
|
1747 }
|
|
1748 case WINDOW_CharacterRecord:
|
|
1749 {
|
|
1750 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
|
|
1751 continue;
|
|
1752 }
|
|
1753 case WINDOW_Options:
|
|
1754 {
|
|
1755 GameMenuUI_Options_Draw();
|
|
1756 continue;
|
|
1757 }
|
|
1758 case WINDOW_Book:
|
|
1759 {
|
|
1760 BookUI_Draw((WindowType)(int)pWindow->ptr_1C);
|
|
1761 continue;
|
|
1762 }
|
|
1763 case WINDOW_Dialogue:
|
|
1764 {
|
|
1765 GameUI_DrawDialogue();
|
|
1766 continue;
|
|
1767 }
|
|
1768 case WINDOW_QuickReference:
|
|
1769 {
|
|
1770 GameUI_QuickRef_Draw();
|
|
1771 continue;
|
|
1772 }
|
|
1773 case WINDOW_Rest:
|
|
1774 {
|
|
1775 RestUI_Draw();
|
|
1776 continue;
|
|
1777 }
|
|
1778 case WINDOW_ChangeLocation:
|
|
1779 {
|
|
1780 TravelUI_Draw();
|
|
1781 continue;
|
|
1782 }
|
|
1783 case WINDOW_SpellBook:
|
|
1784 {
|
|
1785 DrawSpellBookContent(pPlayers[uActiveCharacter]);
|
|
1786 continue;
|
|
1787 }
|
|
1788 case WINDOW_GreetingNPC:
|
|
1789 {
|
|
1790 GameUI_DrawBranchlessDialogue();
|
|
1791 continue;
|
|
1792 }
|
|
1793 case WINDOW_Chest:
|
|
1794 {
|
|
1795 if ( pCurrentScreen == SCREEN_CHEST )
|
|
1796 {
|
|
1797 Chest::DrawChestUI(pWindow->par1C);
|
|
1798 }
|
|
1799 else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY )
|
|
1800 {
|
|
1801 pRenderer->ClearZBuffer(0, 479);
|
|
1802 draw_leather();
|
|
1803 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
1804 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId));
|
|
1805 }
|
|
1806 continue;
|
|
1807 }
|
|
1808 case WINDOW_SaveLoadButtons:
|
|
1809 {
|
|
1810 SaveUI_Draw();
|
|
1811 continue;
|
|
1812 }
|
|
1813 case WINDOW_MainMenu_Load:
|
|
1814 {
|
|
1815 LoadUI_Draw();
|
|
1816 continue;
|
|
1817 }
|
|
1818 case WINDOW_HouseInterior:
|
|
1819 {
|
|
1820 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager();
|
|
1821 if ( !window_SpeakInHouse )
|
|
1822 continue;
|
|
1823 if ( window_SpeakInHouse->par1C >= 53 )
|
|
1824 continue;
|
|
1825 if ( pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] <=pParty->uTimePlayed )
|
|
1826 {
|
|
1827 if ( window_SpeakInHouse->par1C < 53 )
|
|
1828 pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] = 0;
|
|
1829 continue;
|
|
1830 }
|
|
1831 pNumMessages = pMessageQueue_50CBD0->uNumMessages;
|
|
1832 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
1833 continue;
|
|
1834 }
|
|
1835 case WINDOW_Transition:
|
|
1836 {
|
|
1837 TransitionUI_Draw();
|
|
1838 continue;
|
|
1839 }
|
|
1840 case WINDOW_Scroll:
|
|
1841 {
|
|
1842 CreateScrollWindow();
|
|
1843 continue;
|
|
1844 }
|
|
1845 case WINDOW_CastSpell_InInventory:
|
|
1846 {
|
|
1847 pRenderer->ClearZBuffer(0, 479);
|
|
1848 draw_leather();
|
|
1849 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
|
|
1850 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]);
|
|
1851 pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u));
|
|
1852 continue;
|
|
1853 }
|
|
1854 case WINDOW_ModalWindow:
|
|
1855 {
|
|
1856 ModalWindow_ShowHint();
|
|
1857 continue;
|
|
1858 }
|
|
1859 case WINDOW_50:
|
|
1860 {
|
|
1861 v27 = Color16(255, 255, 255);
|
|
1862 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
|
|
1863 {
|
|
1864 ptr_507BD0->DrawMessageBox(0);
|
|
1865 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
|
|
1866 v31 = pFontCreate->GetLineWidth(pKeyActionMap->pPressedKeysBuffer);
|
|
1867 ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate);
|
|
1868 continue;
|
|
1869 }
|
|
1870 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
|
|
1871 {
|
|
1872 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
1873 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0);
|
|
1874 pEventTimer->Resume();
|
|
1875 ptr_507BD0->Release();
|
|
1876 pCurrentScreen = SCREEN_GAME;
|
|
1877 viewparams->bRedrawGameUI = true;
|
|
1878 continue;
|
|
1879 }
|
|
1880 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
|
|
1881 {
|
|
1882 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
|
|
1883 pEventTimer->Resume();
|
|
1884 ptr_507BD0->Release();
|
|
1885 continue;
|
|
1886 }
|
|
1887 }
|
|
1888 case WINDOW_59:
|
|
1889 {
|
|
1890 pWindow->DrawMessageBox(0);
|
|
1891 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
|
|
1892 pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
|
|
1893 if ( !pKeyActionMap->field_204 )
|
|
1894 {
|
|
1895 ItemGen2.Reset();
|
|
1896 pWindow->Release();
|
|
1897 pEventTimer->Resume();
|
|
1898 pCurrentScreen = 0;
|
|
1899 viewparams->bRedrawGameUI = true;
|
|
1900 v26 = atoi(pKeyActionMap->pPressedKeysBuffer);
|
|
1901 if ( v26 > 0 )
|
|
1902 {
|
|
1903 if ( v26 < 800 )
|
|
1904 {
|
|
1905 ItemGen2.uAttributes |= 1;
|
|
1906 ItemGen2.uItemID = v26;
|
|
1907 if ( pItemsTable->pItems[v26].uEquipType == 12 )
|
|
1908 {
|
|
1909 ItemGen2.uNumCharges = rand() % 6 + ItemGen2.GetDamageMod() + 1;
|
|
1910 ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges);
|
|
1911 }
|
|
1912 else
|
|
1913 {
|
|
1914 if ( v26 >= 221 && v26 < 271 )
|
|
1915 ItemGen2.uEnchantmentType = rand() % 10 + 1;
|
|
1916 }
|
|
1917 pItemsTable->SetSpecialBonus(&ItemGen2);
|
|
1918 pParty->SetHoldingItem(&ItemGen2);
|
|
1919 }
|
|
1920 }
|
|
1921 }
|
|
1922 continue;
|
|
1923 }
|
|
1924 case WINDOW_PressedButton2:
|
|
1925 {
|
|
1926 if ( pWindow->Hint != (char *)1 )
|
|
1927 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
|
|
1928 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1929 if ( pButton->uX >= 0 && pButton->uX <= window->GetWidth() )
|
|
1930 {
|
|
1931 if ( pButton->uY >= 0 && pButton->uY <= window->GetHeight() )
|
|
1932 {
|
|
1933 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
|
|
1934 viewparams->bRedrawGameUI = 1;
|
|
1935 if ( pWindow->Hint )
|
|
1936 {
|
|
1937 if ( pWindow->Hint != (char *)1 )
|
|
1938 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1939 }
|
|
1940 pWindow->Release();
|
|
1941 continue;
|
|
1942 }
|
|
1943 }
|
|
1944 viewparams->bRedrawGameUI = 1;
|
|
1945 if ( pWindow->Hint )
|
|
1946 {
|
|
1947 if ( pWindow->Hint != (char *)1 )
|
|
1948 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1949 }
|
|
1950 pWindow->Release();
|
|
1951 continue;
|
|
1952 }
|
|
1953 case WINDOW_CharactersPressedButton:
|
|
1954 {
|
|
1955 if ( pWindow->Hint != (char *)1 )
|
|
1956 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
|
|
1957 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1958 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
|
|
1959 viewparams->bRedrawGameUI = 1;
|
|
1960 if ( pWindow->Hint )
|
|
1961 {
|
|
1962 if ( pWindow->Hint != (char *)1 )
|
|
1963 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1964 }
|
|
1965 pWindow->Release();
|
|
1966 continue;
|
|
1967 }
|
|
1968 case WINDOW_PressedButton:
|
|
1969 {
|
|
1970 if ( pWindow->Hint != (char *)1 )
|
|
1971 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
|
|
1972 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1973 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
|
|
1974 viewparams->bRedrawGameUI = 1;
|
|
1975 if ( pWindow->Hint )
|
|
1976 {
|
|
1977 if ( pWindow->Hint != (char *)1 )
|
|
1978 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
1979 }
|
|
1980 pWindow->Release();
|
|
1981 continue;
|
|
1982 }
|
|
1983 case WINDOW_5D:
|
|
1984 {
|
|
1985 if ( pWindow->Hint != (char *)1 )
|
|
1986 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
|
|
1987 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1988 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
|
|
1989 viewparams->bRedrawGameUI = 1;
|
|
1990 pWindow->Release();
|
|
1991 continue;
|
|
1992 }
|
|
1993 case WINDOW_SaveLoadBtn:
|
|
1994 {
|
|
1995 if (pWindow->Hint != (char *)1)
|
|
1996 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
1997 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
1998 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
|
|
1999 pHint = pWindow->Hint;
|
|
2000 viewparams->bRedrawGameUI = 1;
|
|
2001 if ( pHint && pHint != (char *)1 )
|
|
2002 pButton->DrawLabel(pHint, pFontCreate, 0, 0);
|
|
2003 pWindow->Release();
|
|
2004 if (pCurrentScreen == SCREEN_SAVEGAME)
|
|
2005 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0);
|
|
2006 else
|
|
2007 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
|
|
2008 continue;
|
|
2009 }
|
|
2010 case WINDOW_LoadGame_CancelBtn:
|
|
2011 {
|
|
2012 if ( pWindow->Hint != (char *)1 )
|
|
2013 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
|
|
2014 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
2015 pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
|
|
2016 viewparams->bRedrawGameUI = 1;
|
|
2017 if ( pWindow->Hint && pWindow->Hint != (char *)1 )
|
|
2018 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
|
|
2019 pWindow->Release();
|
|
2020 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
2021 continue;
|
|
2022 }
|
|
2023 case WINDOW_CloseRestWindowBtn:
|
|
2024 {
|
|
2025 if ( pWindow->Hint != (char *)1 )
|
|
2026 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
2027 pGUIButton = (GUIButton *)pWindow->ptr_1C;
|
|
2028 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]);
|
|
2029 pHint = pWindow->Hint;
|
|
2030 viewparams->bRedrawGameUI = 1;
|
|
2031 if ( pHint && pHint != (char *)1 )
|
|
2032 pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0);
|
|
2033 pWindow->Release();
|
|
2034 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
2035 continue;
|
|
2036 }
|
|
2037 case WINDOW_ExitCharacterWindow:
|
|
2038 {
|
|
2039 if ( pWindow->Hint != (char *)1 )
|
|
2040 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
2041 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
2042 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
|
|
2043 pHint = pWindow->Hint;
|
|
2044 viewparams->bRedrawGameUI = 1;
|
|
2045 if ( pHint && pHint != (char *)1 )
|
|
2046 pButton->DrawLabel(pHint, pFontCreate, 0, 0);
|
|
2047 pWindow->Release();
|
|
2048 pNumMessages = pMessageQueue_50CBD0->uNumMessages;
|
|
2049 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0);
|
|
2050 continue;
|
|
2051 }
|
|
2052 case WINDOW_RestWindow:
|
|
2053 {
|
|
2054 memset(&GUIButton2, 0, 0xBCu);
|
|
2055 GUIButton2.uZ = 197;
|
|
2056 GUIButton2.uW = 197;
|
|
2057 GUIButton2.uX = 27;
|
|
2058 GUIButton2.uY = 161;
|
|
2059 GUIButton2.uWidth = 171;
|
|
2060 GUIButton2.uHeight = 37;
|
|
2061 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent;
|
|
2062 pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
|
|
2063 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15));
|
|
2064 viewparams->bRedrawGameUI = 1;
|
|
2065 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Отдых и лечение 8 часов
|
|
2066 GUIButton2.pParent = 0;
|
|
2067 pGUIWindow2 = pWindow;
|
|
2068 pGUIWindow2->Release();
|
|
2069 continue;
|
|
2070 }
|
|
2071 case WINDOW_BooksWindow:
|
|
2072 {
|
|
2073 pButton = (GUIButton *)pWindow->ptr_1C;
|
|
2074 pRenderer->DrawTextureIndexed(pWindow->uFrameY,
|
|
2075 pWindow->uFrameX, pButton->pTextures[0]);
|
|
2076 viewparams->bRedrawGameUI = true;
|
|
2077 continue;
|
|
2078 }
|
|
2079 case WINDOW_CharacterWindow_Inventory:
|
|
2080 {
|
|
2081 pWindow->DrawMessageBox(0);
|
|
2082 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
|
|
2083 pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
|
|
2084 if ( !pKeyActionMap->field_204 )
|
|
2085 {
|
|
2086 ItemGen2.Reset();
|
|
2087 pWindow->Release();
|
|
2088 pEventTimer->Resume();
|
|
2089 pCurrentScreen = SCREEN_GAME;
|
|
2090 viewparams->bRedrawGameUI = 1;
|
|
2091 v39 = atoi(pKeyActionMap->pPressedKeysBuffer);
|
|
2092 if ( v39 > 0 )
|
|
2093 {
|
|
2094 if ( v39 < 800 )
|
|
2095 SpawnActor(v39);
|
|
2096 }
|
|
2097 }
|
|
2098 continue;
|
|
2099 }
|
|
2100 case WINDOW_KeyMappingOptions:
|
|
2101 {
|
|
2102 GameMenuUI_DrawKeyBindings();
|
|
2103 continue;
|
|
2104 }
|
|
2105 case WINDOW_VideoOptions:
|
|
2106 {
|
|
2107 GameMenuUI_DrawVideoOptions();
|
|
2108 continue;
|
|
2109 }
|
|
2110 default:
|
|
2111 continue;
|
|
2112 }
|
|
2113 }
|
|
2114 if ( GetCurrentMenuID() == -1 )
|
|
2115 GameUI_DrawFoodAndGold();
|
|
2116 if ( sub_4637E0_is_there_popup_onscreen() )
|
|
2117 UI_OnMouseRightClick(0);
|
|
2118 }
|
|
2119 //void LoadFonts_and_DrawCopyrightWindow()
|
|
2120 //{
|
|
2121 //MainMenuUI_LoadFontsAndSomeStuff();
|
|
2122 // DrawCopyrightWindow();
|
|
2123 //}
|
|
2124 //----- (00415485) --------------------------------------------------------
|
|
2125 void DrawMM7CopyrightWindow()
|
|
2126 {
|
|
2127 GUIWindow Dst; // [sp+8h] [bp-54h]@1
|
|
2128
|
|
2129 memset(&Dst, 0, sizeof(Dst));
|
|
2130 Dst.uFrameWidth = 624;
|
|
2131 Dst.uFrameHeight = 256;
|
|
2132 Dst.uFrameX = 8;
|
|
2133 Dst.uFrameY = 30; // c 1999 The 3DO Company.
|
|
2134 Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0)
|
|
2135 + 2 * LOBYTE(pFontSmallnum->uFontHeight)
|
|
2136 + 24;
|
|
2137 Dst.uFrameY = 470 - Dst.uFrameHeight;
|
|
2138 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
|
|
2139 Dst.uFrameW = 469;
|
|
2140 //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef";
|
|
2141 Dst.DrawMessageBox(0);
|
|
2142
|
|
2143 Dst.uFrameWidth -= 24;
|
|
2144 Dst.uFrameX += 12;
|
|
2145 Dst.uFrameY += 12;
|
|
2146 Dst.uFrameHeight -= 12;
|
|
2147 Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
|
|
2148 Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
|
|
2149 Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3);
|
|
2150 }
|
|
2151
|
|
2152 int modal_window_prev_screen;
|
|
2153
|
|
2154 //----- (004141CA) --------------------------------------------------------
|
|
2155 void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message)
|
|
2156 {
|
|
2157 pEventTimer->Pause();
|
|
2158 modal_window_prev_screen = pCurrentScreen;
|
|
2159 pModalWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_ModalWindow, OnRelease_message, pStrHint);
|
|
2160 pCurrentScreen = SCREEN_MODAL_WINDOW;
|
|
2161 }
|
|
2162
|
|
2163 //----- (0041420D) --------------------------------------------------------
|
|
2164 void ModalWindow_ShowHint()
|
|
2165 {
|
|
2166 GUIWindow pWindow; // [sp+4h] [bp-54h]@1
|
|
2167
|
|
2168 sprintf(pTmpBuf2.data(), "%s\n \n%s", pModalWindow->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape
|
|
2169 pWindow.Hint = pTmpBuf2.data();
|
|
2170 pWindow.uFrameWidth = 400;
|
|
2171 pWindow.uFrameHeight = 100;
|
|
2172 pWindow.uFrameX = 120;
|
|
2173 pWindow.uFrameY = 140;
|
|
2174 pWindow.uFrameZ = 519;
|
|
2175 pWindow.uFrameW = 239;
|
|
2176 pWindow.DrawMessageBox(0);
|
|
2177 }
|
|
2178
|
|
2179 //----- (0041426F) --------------------------------------------------------
|
|
2180 void ModalWindow_Release()
|
|
2181 {
|
|
2182 pMessageQueue_50CBD0->AddGUIMessage((UIMessageType)pModalWindow->par1C, 0, 0);
|
|
2183
|
|
2184 pModalWindow->Release();
|
|
2185 pModalWindow = nullptr;
|
|
2186
|
|
2187 pCurrentScreen = modal_window_prev_screen;
|
|
2188 pEventTimer->Resume();
|
|
2189 }
|
|
2190
|
|
2191 //----- (00467FB6) --------------------------------------------------------
|
|
2192 void CreateScrollWindow()
|
|
2193 {
|
|
2194 unsigned int v0; // eax@1
|
|
2195 char *v1; // ST18_4@3
|
|
2196 GUIWindow a1; // [sp+Ch] [bp-54h]@1
|
|
2197
|
|
2198 memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1));
|
|
2199 a1.Hint = 0;
|
|
2200 a1.uFrameX = 1;
|
|
2201 a1.uFrameY = 1;
|
|
2202 a1.uFrameWidth = 468;
|
|
2203 v0 = pFontSmallnum->CalcTextHeight(pScrolls[pGUIWindow_ScrollWindow->par1C], &a1, 0, 0)
|
|
2204 + 2 * LOBYTE(pFontCreate->uFontHeight) + 24;
|
|
2205 a1.uFrameHeight = v0;
|
|
2206 if ( (signed int)(v0 + a1.uFrameY) > 479 )
|
|
2207 {
|
|
2208 v0 = 479 - a1.uFrameY;
|
|
2209 a1.uFrameHeight = 479 - a1.uFrameY;
|
|
2210 }
|
|
2211 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
|
|
2212 a1.uFrameW = v0 + a1.uFrameY - 1;
|
|
2213 a1.DrawMessageBox(0);
|
|
2214 a1.uFrameX += 12;
|
|
2215 a1.uFrameWidth -= 24;
|
|
2216 a1.uFrameY += 12;
|
|
2217 a1.uFrameHeight -= 12;
|
|
2218 a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
|
|
2219 a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
|
|
2220 v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName;
|
|
2221 sprintf(pTmpBuf.data(), format_4E2D80, Color16(0xFFu, 0xFFu, 0x9Bu), v1);
|
|
2222 a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3);
|
|
2223 a1.DrawText(pFontSmallnum, 1, LOBYTE(pFontCreate->uFontHeight) - 3, 0,
|
|
2224 pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], 0, 0, 0);
|
|
2225 }
|
|
2226 //----- (00467F48) --------------------------------------------------------
|
|
2227 void CreateMsgScrollWindow( signed int mscroll_id )
|
|
2228 {
|
|
2229 if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 )
|
|
2230 {
|
|
2231 if ( mscroll_id <= 782 )
|
|
2232 {
|
|
2233 uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE);
|
|
2234 pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Scroll, mscroll_id - 700, 0);
|
|
2235 }
|
|
2236 }
|
|
2237 }
|
|
2238 //----- (00467F9F) --------------------------------------------------------
|
|
2239 void free_book_subwindow()
|
|
2240 {
|
|
2241 if ( pGUIWindow_ScrollWindow )
|
|
2242 {
|
|
2243 pGUIWindow_ScrollWindow->Release();
|
|
2244 pGUIWindow_ScrollWindow = 0;
|
|
2245 }
|
|
2246 }
|
|
2247 //----- (004226EF) --------------------------------------------------------
|
|
2248 void SetUserInterface(PartyAlignment align, bool bReplace)
|
|
2249 {
|
|
2250 extern void set_default_ui_skin();
|
|
2251 set_default_ui_skin();
|
|
2252
|
|
2253 if (align == PartyAlignment_Evil)
|
|
2254 {
|
|
2255 if ( bReplace )
|
|
2256 {
|
|
2257 pTexture_RightFrame->Reload("ib-r-C.pcx");
|
|
2258 pTexture_BottomFrame->Reload("ib-b-C.pcx");
|
|
2259 pTexture_TopFrame->Reload("ib-t-C.pcx");
|
|
2260 pTexture_LeftFrame->Reload("ib-l-C.pcx");
|
|
2261 pTexture_StatusBar->Reload("IB-Foot-c.pcx");
|
|
2262 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2);
|
|
2263 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-c", 2);
|
|
2264 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-C", 2);
|
|
2265 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2);
|
|
2266 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2);
|
|
2267 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2);
|
|
2268 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-C", 2);
|
|
2269 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2);
|
|
2270 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2);
|
|
2271 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-C", 2);
|
|
2272 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-C", 2);
|
|
2273 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-c", 2);
|
|
2274 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2);
|
|
2275 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2);
|
|
2276 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-c", 2);
|
|
2277
|
|
2278 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2);
|
|
2279 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2);
|
|
2280 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2);
|
|
2281 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2);
|
|
2282
|
|
2283 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
|
|
2284 pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID);
|
|
2285 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
|
|
2286 pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID);
|
|
2287
|
|
2288 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2);
|
|
2289 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2);
|
|
2290 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-c", 2);
|
|
2291 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
|
|
2292 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2);
|
|
2293 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2);
|
|
2294 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2);
|
|
2295 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2);
|
|
2296 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2);
|
|
2297 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2);
|
|
2298 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2);
|
|
2299 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2);
|
|
2300 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2);
|
|
2301 }
|
|
2302 else
|
|
2303 {
|
|
2304 pTexture_RightFrame->Load("ib-r-C.pcx", 0);
|
|
2305 pTexture_BottomFrame->Load("ib-b-c.pcx", 0);
|
|
2306 pTexture_TopFrame->Load("ib-t-C.pcx", 0);
|
|
2307 pTexture_LeftFrame->Load("ib-l-C.pcx", 0);
|
|
2308 pTexture_StatusBar->Load("IB-Foot-c.pcx", 0);
|
|
2309 uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE);
|
|
2310 uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE);
|
|
2311 uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE);
|
|
2312 dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE);
|
|
2313 dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE);
|
|
2314 dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE);
|
|
2315 uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE);
|
|
2316 uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE);
|
|
2317 uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE);
|
|
2318 uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE);
|
|
2319 uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE);
|
|
2320 uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE);
|
|
2321 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE);
|
|
2322 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE);
|
|
2323 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE);
|
|
2324 uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE);
|
|
2325 uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE);
|
|
2326 uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE);
|
|
2327 uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE);
|
|
2328 uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE);
|
|
2329 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE);
|
|
2330 uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
|
|
2331 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
|
|
2332 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
|
|
2333 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
|
|
2334 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
|
|
2335 }
|
|
2336 uGameUIFontMain = Color16(0xC8u, 0, 0);
|
|
2337 uGameUIFontShadow = Color16(10, 0, 0);
|
|
2338 }
|
|
2339 else if (align == PartyAlignment_Neutral)
|
|
2340 {
|
|
2341 if ( bReplace )
|
|
2342 {
|
|
2343 pTexture_RightFrame->Reload("ib-r-a.pcx");
|
|
2344 pTexture_BottomFrame->Reload("ib-b-a.pcx");
|
|
2345 pTexture_TopFrame->Reload("ib-t-a.pcx");
|
|
2346 pTexture_LeftFrame->Reload("ib-l-a.pcx");
|
|
2347 pTexture_StatusBar->Reload("IB-Foot-a.pcx");
|
|
2348 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2);
|
|
2349 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-a", 2);
|
|
2350 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-a", 2);
|
|
2351 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2);
|
|
2352 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2);
|
|
2353 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2);
|
|
2354 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-a", 2);
|
|
2355 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2);
|
|
2356 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2);
|
|
2357 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-a", 2);
|
|
2358 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-a", 2);
|
|
2359 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-a", 2);
|
|
2360 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2);
|
|
2361 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2);
|
|
2362 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-a", 2);
|
|
2363 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2);
|
|
2364 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2);
|
|
2365 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2);
|
|
2366 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2);
|
|
2367 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
|
|
2368 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
|
|
2369 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
|
|
2370 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
|
|
2371 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2);
|
|
2372 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2);
|
|
2373 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven", 2);
|
|
2374 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
|
|
2375 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2);
|
|
2376 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2);
|
|
2377 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2);
|
|
2378 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2);
|
|
2379 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2);
|
|
2380 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2);
|
|
2381 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2);
|
|
2382 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2);
|
|
2383 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2);
|
|
2384 }
|
|
2385 else
|
|
2386 {
|
|
2387 pTexture_RightFrame->Load("ib-r-A.pcx", 0);
|
|
2388 pTexture_BottomFrame->Load("ib-b-A.pcx", 0);
|
|
2389 pTexture_TopFrame->Load("ib-t-A.pcx", 0);
|
|
2390 pTexture_LeftFrame->Load("ib-l-A.pcx", 0);
|
|
2391 pTexture_StatusBar->Load("IB-Foot-a.pcx", 0);
|
|
2392 uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE);
|
|
2393 uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE);
|
|
2394 uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE);
|
|
2395 dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE);
|
|
2396 dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE);
|
|
2397 dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE);
|
|
2398 uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE);
|
|
2399 uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE);
|
|
2400 uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE);
|
|
2401 uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE);
|
|
2402 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE);
|
|
2403 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE);
|
|
2404 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE);
|
|
2405 uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE);
|
|
2406 uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE);
|
|
2407 uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE);
|
|
2408 uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE);
|
|
2409 uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE);
|
|
2410 uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE);
|
|
2411 uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE);
|
|
2412 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE);
|
|
2413 uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
|
|
2414 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
|
|
2415 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
|
|
2416 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
|
|
2417 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
|
|
2418 uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE);
|
|
2419 uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE);
|
|
2420 uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE);
|
|
2421 uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE);
|
|
2422 uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE);
|
|
2423 uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE);
|
|
2424 uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE);
|
|
2425 uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE);
|
|
2426 uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE);
|
|
2427 pTexture_591428 = pIcons_LOD->LoadTexturePtr("endcap", TEXTURE_16BIT_PALETTE);
|
|
2428 }
|
|
2429 uGameUIFontMain = Color16(0xAu, 0, 0);
|
|
2430 uGameUIFontShadow = Color16(230, 214, 193);
|
|
2431 }
|
|
2432 else if (align == PartyAlignment_Good)
|
|
2433 {
|
|
2434 if ( bReplace )
|
|
2435 {
|
|
2436 pTexture_RightFrame->Reload("ib-r-B.pcx");
|
|
2437 pTexture_BottomFrame->Reload("ib-b-B.pcx");
|
|
2438 pTexture_TopFrame->Reload("ib-t-B.pcx");
|
|
2439 pTexture_LeftFrame->Reload("ib-l-B.pcx");
|
|
2440 pTexture_StatusBar->Reload("IB-Foot-b.pcx");
|
|
2441 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-B", 2);
|
|
2442 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-b", 2);
|
|
2443 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-B", 2);
|
|
2444 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-b", 2);
|
|
2445 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-b", 2);
|
|
2446 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-b", 2);
|
|
2447 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-B", 2);
|
|
2448 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-B", 2);
|
|
2449 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-B", 2);
|
|
2450 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-B", 2);
|
|
2451 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-B", 2);
|
|
2452 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-b", 2);
|
|
2453 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-b", 2);
|
|
2454 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-b", 2);
|
|
2455 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-b", 2);
|
|
2456 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-b", 2);
|
|
2457 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-b", 2);
|
|
2458 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-b", 2);
|
|
2459 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-b", 2);
|
|
2460 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB");
|
|
2461 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
|
|
2462 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB");
|
|
2463 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
|
|
2464 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-b", 2);
|
|
2465 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2);
|
|
2466 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-b", 2);
|
|
2467 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
|
|
2468 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2);
|
|
2469 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2);
|
|
2470 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-b", 2);
|
|
2471 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-b", 2);
|
|
2472 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-b", 2);
|
|
2473 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-b", 2);
|
|
2474 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-b", 2);
|
|
2475 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-b", 2);
|
|
2476 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-b", 2);
|
|
2477 }
|
|
2478 uGameUIFontMain = Color16(0, 0, 0xC8u);
|
|
2479 uGameUIFontShadow = Color16(255, 255, 255);
|
|
2480 }
|
|
2481 else Error("Invalid alignment type: %u", align);
|
|
2482 }
|
|
2483 //----- (0041D20D) --------------------------------------------------------
|
|
2484 void DrawBuff_remaining_time_string( int uY, struct GUIWindow *window, __int64 remaining_time, struct GUIFont *Font )
|
|
2485 {
|
|
2486 unsigned int full_time; // esi@1
|
|
2487 signed __int64 hours; // kr00_8@1
|
|
2488 const char *text; // eax@2
|
|
2489 signed __int64 minutes; // [sp+10h] [bp-10h]@1
|
|
2490 signed __int64 seconds; // [sp+18h] [bp-8h]@1
|
|
2491 unsigned int day; // [sp+24h] [bp+4h]@1
|
|
2492
|
|
2493 full_time = (signed __int64)((double)remaining_time * 0.234375);
|
|
2494 day = (unsigned int)((full_time / 60) / 60) / 24;
|
|
2495 hours = ((full_time / 60) / 60) % 24;
|
|
2496 minutes = (signed __int64)(full_time / 60) % 60;
|
|
2497 seconds = (signed __int64)full_time % 60;
|
|
2498 strcpy(pTmpBuf.data(), "\r020");
|
|
2499 if ( day )
|
|
2500 {
|
|
2501 text = pGlobalTXT_LocalizationStrings[57]; // Days
|
|
2502 if ( day <= 1 )
|
|
2503 text = pGlobalTXT_LocalizationStrings[56]; // Day
|
|
2504 sprintfex(pTmpBuf2.data(), "%d %s ", (int)day, text);
|
|
2505 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
2506 }
|
|
2507 if ( hours )
|
|
2508 {
|
|
2509 if ( hours <= 1 )
|
|
2510 text = pGlobalTXT_LocalizationStrings[109];// Hour
|
|
2511 else
|
|
2512 text = pGlobalTXT_LocalizationStrings[110];// Hours
|
|
2513 sprintfex(pTmpBuf2.data(), "%d %s ", (int)hours, text);
|
|
2514 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
2515 }
|
|
2516 if ( minutes && !day )
|
|
2517 {
|
|
2518 if ( minutes <= 1 )
|
|
2519 text = pGlobalTXT_LocalizationStrings[437];// Minute
|
|
2520 else
|
|
2521 text = pGlobalTXT_LocalizationStrings[436];// Minutes
|
|
2522 sprintfex(pTmpBuf2.data(), "%d %s ", (int)minutes, text);
|
|
2523 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
2524 }
|
|
2525 if ( seconds && !hours )
|
|
2526 {
|
|
2527 if ( seconds <= 1 )
|
|
2528 text = pGlobalTXT_LocalizationStrings[439];// Second
|
|
2529 else
|
|
2530 text = pGlobalTXT_LocalizationStrings[438];// Seconds
|
|
2531 sprintfex(pTmpBuf2.data(), "%d %s ", (int)seconds, text);
|
|
2532 strcat(pTmpBuf.data(), pTmpBuf2.data());
|
|
2533 }
|
|
2534 window->DrawText(Font, 32, uY, 0, pTmpBuf.data(), 0, 0, 0);
|
|
2535 }
|
|
2536
|
|
2537
|
|
2538 //----- (0042EB8D) --------------------------------------------------------
|
|
2539 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line)
|
|
2540 {
|
|
2541 //Log::Warning(L"%s @ (%S %u)", UIMessage2String(msg), file, line);
|
|
2542 if (uNumMessages < 40)
|
|
2543 {
|
|
2544 files[uNumMessages] = file;
|
|
2545 lines[uNumMessages] = line;
|
|
2546
|
|
2547 pMessages[uNumMessages].eType = msg;
|
|
2548 pMessages[uNumMessages].param = param;
|
|
2549 pMessages[uNumMessages++].field_8 = a4;
|
|
2550 }
|
|
2551 }
|
|
2552
|
|
2553 //----- (004637E0) --------------------------------------------------------
|
|
2554 char sub_4637E0_is_there_popup_onscreen()
|
|
2555 {
|
|
2556 return dword_507BF0_is_there_popup_onscreen == 1;
|
|
2557 }
|
|
2558 // 507BF0: using guessed type int dword_507BF0_is_there_popup_onscreen;
|
|
2559
|
|
2560 //----- (00417AD4) --------------------------------------------------------
|
|
2561 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level)
|
|
2562 {
|
|
2563 switch (uPlayerClass % 4)
|
|
2564 {
|
|
2565 case 0:
|
|
2566 {
|
|
2567 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level)
|
|
2568 return ui_character_skillinfo_can_learn;
|
|
2569 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level &&
|
|
2570 byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level)
|
|
2571 {
|
|
2572 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType] < skill_level)
|
|
2573 return ui_character_skillinfo_cant_learn;
|
|
2574 }
|
|
2575 return ui_character_skillinfo_can_learn_gm;
|
|
2576 }
|
|
2577 break;
|
|
2578
|
|
2579 case 1:
|
|
2580 {
|
|
2581 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level)
|
|
2582 return ui_character_skillinfo_can_learn;
|
|
2583 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level)
|
|
2584 {
|
|
2585 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level)
|
|
2586 return ui_character_skillinfo_cant_learn;
|
|
2587 }
|
|
2588 return ui_character_skillinfo_can_learn_gm;
|
|
2589 }
|
|
2590 break;
|
|
2591
|
|
2592 case 2:
|
|
2593 case 3:
|
|
2594 {
|
|
2595 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level)
|
|
2596 return ui_character_skillinfo_cant_learn;
|
|
2597 return ui_character_skillinfo_can_learn;
|
|
2598 }
|
|
2599 break;
|
|
2600 }
|
|
2601 Error("Invalid player class: %u", uPlayerClass);
|
|
2602 }
|
|
2603
|
|
2604 //----- (0040F92A) --------------------------------------------------------
|
|
2605 void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3)
|
|
2606 {//срабатывает в покупке в магазине
|
|
2607 void *v4; // eax@3
|
|
2608 //int *v5; // edi@5
|
|
2609 // int v6; // ecx@6
|
|
2610 // int v9; // [sp+18h] [bp-4h]@1
|
|
2611
|
|
2612 if (pIcons_LOD->dword_011BA4 && a2->uDecompressedSize)
|
|
2613 v4 = a2->UnzipPalette();
|
|
2614 else
|
|
2615 v4 = a2->pLevelOfDetail0_prolly_alpha_mask;
|
|
2616 //v5 = pZBuffer;
|
|
2617 for (uint i = 0; i < a2->uTextureHeight; i++)
|
|
2618 {
|
|
2619 for (uint j = 0; j < a2->uTextureWidth; j++)
|
|
2620 {
|
|
2621 *pZBuffer = a3;
|
|
2622 ++pZBuffer;
|
|
2623 }
|
|
2624 pZBuffer += window->GetWidth() - a2->uTextureWidth;
|
|
2625 }
|
|
2626 if (pIcons_LOD->dword_011BA4)
|
|
2627 {
|
|
2628 if (a2->uDecompressedSize)
|
|
2629 free(v4);
|
|
2630 }
|
|
2631 }
|
|
2632
|
|
2633
|
|
2634 // 4E28F8: using guessed type int pCurrentScreen;
|
|
2635
|
|
2636 //----- (0040F82D) --------------------------------------------------------
|
|
2637 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue)
|
|
2638 {
|
|
2639 assert(uTextureId != -1);
|
|
2640 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue);
|
|
2641 }
|
|
2642
|
|
2643 //----- (0040F89C) --------------------------------------------------------
|
|
2644 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue)
|
|
2645 {//срабатывает при продаже в магазине
|
|
2646 void *v3; // eax@3
|
|
2647 //void *v4; // esi@5
|
|
2648 //int *v5; // edi@5
|
|
2649 //int v6; // eax@5
|
|
2650 // int v7; // ecx@6
|
|
2651 // int v11; // [sp+18h] [bp-8h]@1
|
|
2652 //void *v12; // [sp+1Ch] [bp-4h]@5
|
|
2653
|
|
2654 if (pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize)
|
|
2655 v3 = pTex->UnzipPalette();
|
|
2656 else
|
|
2657 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask;
|
|
2658 //v12 = v3;
|
|
2659 //v4 = v3;
|
|
2660 //v5 = pZBuffer;
|
|
2661 //v6 = 0;
|
|
2662 for (uint i = 0; i < pTex->uTextureHeight; i++)
|
|
2663 {
|
|
2664 for (uint j = 0; j < pTex->uTextureWidth; j++)
|
|
2665 {
|
|
2666 //LOBYTE(v6) = *(char *)v4;
|
|
2667 //v4 = (char *)v4 + 1;
|
|
2668 //if ( v6 )
|
|
2669 *pZBuffer = uZValue;
|
|
2670 ++pZBuffer;
|
|
2671 }
|
|
2672 pZBuffer += window->GetWidth() - pTex->uTextureWidth;
|
|
2673 }
|
|
2674 if (pIcons_LOD->dword_011BA4)
|
|
2675 {
|
|
2676 if (pTex->uDecompressedSize)
|
|
2677 free(v3);
|
|
2678 }
|
|
2679 }
|
|
2680
|
|
2681 //----- (004BC49B) --------------------------------------------------------
|
|
2682 void OnSelectNPCDialogueOption(DIALOGUE_TYPE newDialogueType)
|
|
2683 {
|
|
2684 NPCData *speakingNPC; // ebp@1
|
|
2685 int npc_event_id; // ecx@10
|
|
2686 char *v13; // [sp-8h] [bp-18h]@60
|
|
2687
|
|
2688 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
|
|
2689 uDialogueType = newDialogueType;
|
|
2690 if (!speakingNPC->uFlags)
|
|
2691 speakingNPC->uFlags = 1;
|
|
2692 if (newDialogueType == DIALOGUE_PROFESSION_DETAILS)
|
|
2693 dialogue_show_profession_details = ~dialogue_show_profession_details;
|
|
2694 else if (newDialogueType == DIALOGUE_76)
|
|
2695 {
|
|
2696 if (speakingNPC->Hired())
|
|
2697 {
|
|
2698 if ((signed int)pNPCStats->uNumNewNPCs > 0)
|
|
2699 {
|
|
2700 for (uint i = 0; i < (unsigned int)pNPCStats->uNumNewNPCs; ++i)
|
|
2701 {
|
|
2702 if (pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName))
|
|
2703 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu;
|
|
2704 }
|
|
2705 }
|
|
2706 if (pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName))
|
|
2707 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
|
|
2708 else if (pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName))
|
|
2709 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
|
|
2710 pParty->hirelingScrollPosition = 0;
|
|
2711 pParty->CountHirelings();
|
|
2712 dword_591084 = 0;
|
|
2713 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2714 dword_7241C8 = 0;
|
|
2715 return;
|
|
2716 }
|
|
2717 if (pParty->pHirelings[0].pName && pParty->pHirelings[1].pName)
|
|
2718 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
|
|
2719 else
|
|
2720 {
|
|
2721 if (speakingNPC->uProfession != 51) //burglars have no hiring price
|
|
2722 {
|
|
2723 if (pParty->uNumGold < pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice)
|
|
2724 {
|
|
2725 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);// "You don't have enough gold"
|
|
2726 dialogue_show_profession_details = false;
|
|
2727 uDialogueType = 13;
|
|
2728 if (uActiveCharacter)
|
|
2729 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
|
|
2730 if (!dword_7241C8)
|
|
2731 pGame->Draw();
|
|
2732 dword_7241C8 = 0;
|
|
2733 return;
|
|
2734 }
|
|
2735 Party::TakeGold(pNPCStats->pProfessions[speakingNPC->uProfession].uHirePrice);
|
|
2736 }
|
|
2737 LOBYTE(speakingNPC->uFlags) |= 0x80u;
|
|
2738 if (pParty->pHirelings[0].pName)
|
|
2739 {
|
|
2740 memcpy(&pParty->pHirelings[1], speakingNPC, sizeof(pParty->pHirelings[1]));
|
|
2741 v13 = pParty->pHireling2Name;
|
|
2742 }
|
|
2743 else
|
|
2744 {
|
|
2745 memcpy(&pParty->pHirelings[0], speakingNPC, sizeof(pParty->pHirelings[0]));
|
|
2746 v13 = pParty->pHireling1Name;
|
|
2747 }
|
|
2748 strcpy(v13, speakingNPC->pName);
|
|
2749 pParty->hirelingScrollPosition = 0;
|
|
2750 pParty->CountHirelings();
|
|
2751 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2752 if (sDialogue_SpeakingActorNPC_ID >= 0)
|
|
2753 pDialogue_SpeakingActor->uAIState = Removed;
|
|
2754 if (uActiveCharacter)
|
|
2755 pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
|
|
2756 }
|
|
2757 }
|
|
2758 else if ((signed int)newDialogueType > DIALOGUE_84 && (signed int)newDialogueType <= DIALOGUE_ARENA_SELECT_CHAMPION) //выбор уровня сложности боя
|
|
2759 {
|
|
2760 ArenaFight();
|
|
2761 return;
|
|
2762 }
|
|
2763 else if (newDialogueType == DIALOGUE_USE_NPC_ABILITY)
|
|
2764 {
|
|
2765 if (UseNPCSkill((NPCProf)speakingNPC->uProfession) == 0)
|
|
2766 {
|
|
2767 if (speakingNPC->uProfession != GateMaster)
|
|
2768 speakingNPC->bHasUsedTheAbility = 1;
|
|
2769 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2770 }
|
|
2771 else
|
|
2772 ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2); //"Your packs are already full!"
|
|
2773 }
|
|
2774 else if (newDialogueType == DIALOGUE_13)
|
|
2775 {
|
|
2776 if (!speakingNPC->Hired())
|
|
2777 {
|
|
2778 sub_4B3E1E();
|
|
2779 dialogue_show_profession_details = false;
|
|
2780 }
|
|
2781 else
|
|
2782 {
|
|
2783 for (uint i = 0; i < (signed int)pNPCStats->uNumNewNPCs; ++i)
|
|
2784 {
|
|
2785 if (pNPCStats->pNewNPCData[i].uFlags & 0x80 && !strcmp(speakingNPC->pName, pNPCStats->pNewNPCData[i].pName))
|
|
2786 pNPCStats->pNewNPCData[i].uFlags &= 0x7Fu;
|
|
2787 }
|
|
2788 if (pParty->pHirelings[0].pName && !_stricmp(pParty->pHirelings[0].pName, speakingNPC->pName))
|
|
2789 memset(&pParty->pHirelings[0], 0, sizeof(NPCData));
|
|
2790 else if (pParty->pHirelings[1].pName && !_stricmp(pParty->pHirelings[1].pName, speakingNPC->pName))
|
|
2791 memset(&pParty->pHirelings[1], 0, sizeof(NPCData));
|
|
2792 pParty->hirelingScrollPosition = 0;
|
|
2793 pParty->CountHirelings();
|
|
2794 dword_591084 = 0;
|
|
2795 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
2796 dword_7241C8 = 0;
|
|
2797 return;
|
|
2798 }
|
|
2799 }
|
|
2800 else if (newDialogueType >= DIALOGUE_EVT_A && newDialogueType <= DIALOGUE_EVT_F)
|
|
2801 {
|
|
2802 switch (newDialogueType)
|
|
2803 {
|
|
2804 case DIALOGUE_EVT_A: npc_event_id = speakingNPC->evt_A; break;
|
|
2805 case DIALOGUE_EVT_B: npc_event_id = speakingNPC->evt_B; break;
|
|
2806 case DIALOGUE_EVT_C: npc_event_id = speakingNPC->evt_C; break;
|
|
2807 case DIALOGUE_EVT_D: npc_event_id = speakingNPC->evt_D; break;
|
|
2808 case DIALOGUE_EVT_E: npc_event_id = speakingNPC->evt_E; break;
|
|
2809 case DIALOGUE_EVT_F: npc_event_id = speakingNPC->evt_F; break;
|
|
2810 }
|
|
2811 if ((npc_event_id >= 200) && (npc_event_id <= 310))
|
|
2812 _4B3FE5_training_dialogue(npc_event_id); //200-310
|
|
2813 else if ((npc_event_id >= 400) && (npc_event_id <= 410))
|
|
2814 { //400-410
|
|
2815 dword_F8B1D8 = newDialogueType;
|
|
2816 DrawJoinGuildWindow(npc_event_id - 400);
|
|
2817 }
|
|
2818 else
|
|
2819 {
|
|
2820 switch (npc_event_id)
|
|
2821 {
|
|
2822 case 139:
|
|
2823 OracleDialogue();
|
|
2824 break;
|
|
2825 case 311:
|
|
2826 CheckBountyRespawnAndAward();
|
|
2827 break;
|
|
2828 case 399:
|
|
2829 Arena_SelectionFightLevel();
|
|
2830 break;
|
|
2831 default:
|
|
2832 activeLevelDecoration = (LevelDecoration*)1;
|
|
2833 current_npc_text = 0;
|
|
2834 EventProcessor(npc_event_id, 0, 1);
|
|
2835 activeLevelDecoration = nullptr;
|
|
2836 break;
|
|
2837 }
|
|
2838 }
|
|
2839 }
|
|
2840 if (!dword_7241C8)
|
|
2841 pGame->Draw();
|
|
2842 dword_7241C8 = 0;
|
|
2843 }
|
|
2844
|
|
2845 //----- (004B3E1E) --------------------------------------------------------
|
|
2846 void sub_4B3E1E()
|
|
2847 {
|
|
2848 NPCData *v0; // ST40_4@1
|
|
2849 signed int v1; // edi@1
|
|
2850 //GUIWindow *v2; // ecx@1
|
|
2851
|
|
2852 __debugbreak();
|
|
2853 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID);
|
|
2854 v1 = 0;
|
|
2855 pDialogueWindow->eWindowType = WINDOW_MainMenu;
|
|
2856 pDialogueWindow->Release();
|
|
2857 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 1, 0);
|
|
2858 if (pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) )
|
|
2859 {
|
|
2860 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее
|
|
2861 v1 = 1;
|
|
2862 }
|
|
2863 pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять
|
|
2864 pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1);
|
|
2865 }
|
|
2866
|
|
2867 //----- (004B2001) --------------------------------------------------------
|
|
2868 void __fastcall ClickNPCTopic(signed int uMessageParam)
|
|
2869 {
|
|
2870 //signed int v1; // eax@1
|
|
2871 NPCData *pCurrentNPCInfo; // ebp@1
|
|
2872 int pEventNumber; // ecx@8
|
|
2873 Player *v4; // esi@20
|
|
2874 //int v5; // eax@28
|
|
2875 //int v6; // eax@31
|
|
2876 //int v7; // eax@34
|
|
2877 //int v8; // eax@37
|
|
2878 //int v9; // eax@40
|
|
2879 //unsigned int v10; // eax@43
|
|
2880 char *v12; // eax@53
|
|
2881 char *v13; // eax@56
|
|
2882 char *v14; // eax@57
|
|
2883 char *v15; // eax@58
|
|
2884 //unsigned int v16; // ebp@62
|
|
2885 char *v17; // ecx@63
|
|
2886 char *v18; // eax@65
|
|
2887 // const char *v19; // ecx@68
|
|
2888 //unsigned int v20; // eax@69
|
|
2889 signed int pPrice; // ecx@70
|
|
2890 char *v22; // [sp-Ch] [bp-18h]@73
|
|
2891 //int v23; // [sp-8h] [bp-14h]@49
|
|
2892 char *v24; // [sp-8h] [bp-14h]@73
|
|
2893 //int v25; // [sp-4h] [bp-10h]@49
|
|
2894
|
|
2895 uDialogueType = uMessageParam + 1;
|
|
2896 pCurrentNPCInfo = HouseNPCData[pDialogueNPCCount - ((dword_591080 != 0) ? 1 : 0)];//- 1
|
|
2897 if (uMessageParam <= 24)
|
|
2898 {
|
|
2899 switch (uMessageParam)
|
|
2900 {
|
|
2901 case 13:
|
|
2902 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
|
|
2903 current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
|
|
2904 NPCHireableDialogPrepare();
|
|
2905 dialogue_show_profession_details = false;
|
|
2906 BackToHouseMenu();
|
|
2907 return;
|
|
2908 case 19:
|
|
2909 pEventNumber = pCurrentNPCInfo->evt_A;
|
|
2910 break;
|
|
2911 case 20:
|
|
2912 pEventNumber = pCurrentNPCInfo->evt_B;
|
|
2913 break;
|
|
2914 case 21:
|
|
2915 pEventNumber = pCurrentNPCInfo->evt_C;
|
|
2916 break;
|
|
2917 case 22:
|
|
2918 pEventNumber = pCurrentNPCInfo->evt_D;
|
|
2919 break;
|
|
2920 case 23:
|
|
2921 pEventNumber = pCurrentNPCInfo->evt_E;
|
|
2922 break;
|
|
2923 case 24:
|
|
2924 pEventNumber = pCurrentNPCInfo->evt_F;
|
|
2925 break;
|
|
2926 default:
|
|
2927 BackToHouseMenu();
|
|
2928 return;
|
|
2929 }
|
|
2930 /*switch ( pEventNumber )
|
|
2931 {
|
|
2932 case 139:
|
|
2933 OracleDialogue();
|
|
2934 goto _return;
|
|
2935 case 311:
|
|
2936 CheckBountyRespawnAndAward();
|
|
2937 goto _return;
|
|
2938 }*/
|
|
2939 if (pEventNumber < 200 || pEventNumber > 310)
|
|
2940 {
|
|
2941 if (pEventNumber < 400 || pEventNumber > 410)
|
|
2942 {
|
|
2943 if (pEventNumber == 139)
|
|
2944 {
|
|
2945 OracleDialogue();
|
|
2946 }
|
|
2947 else
|
|
2948 {
|
|
2949 if (pEventNumber == 311)
|
|
2950 {
|
|
2951 CheckBountyRespawnAndAward();
|
|
2952 }
|
|
2953 else
|
|
2954 {
|
|
2955 current_npc_text = 0;
|
|
2956 activeLevelDecoration = (LevelDecoration*)1;
|
|
2957 EventProcessor(pEventNumber, 0, 1);
|
|
2958 activeLevelDecoration = nullptr;
|
|
2959 }
|
|
2960 }
|
|
2961 }
|
|
2962 else
|
|
2963 {
|
|
2964 dword_F8B1D8 = uMessageParam;
|
|
2965 DrawJoinGuildWindow(pEventNumber - 400);
|
|
2966 }
|
|
2967 }
|
|
2968 else
|
|
2969 {
|
|
2970 _4B3FE5_training_dialogue(pEventNumber);
|
|
2971 }
|
|
2972 BackToHouseMenu();
|
|
2973 return;
|
|
2974 }
|
|
2975 if (uMessageParam != 76)
|
|
2976 {
|
|
2977 if (uMessageParam == 77)
|
|
2978 {
|
|
2979 //v16 = pCurrentNPCInfo->uProfession;
|
|
2980 __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
|
|
2981 if (dialogue_show_profession_details)
|
|
2982 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;
|
|
2983 else
|
|
2984 v17 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pBenefits;
|
|
2985 current_npc_text = v17;
|
|
2986 v18 = BuildDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
|
|
2987 dialogue_show_profession_details = ~dialogue_show_profession_details;
|
|
2988 current_npc_text = v18;
|
|
2989 }
|
|
2990 else
|
|
2991 {
|
|
2992 if (uMessageParam == 79)
|
|
2993 {
|
|
2994 if (contract_approved)
|
|
2995 {
|
|
2996 Party::TakeGold(gold_transaction_amount);
|
|
2997 if (uActiveCharacter)
|
|
2998 {
|
|
2999 v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
|
|
3000 *(short *)v12 &= 0x3Fu;
|
|
3001 switch (dword_F8B1B0_MasteryBeingTaught)
|
|
3002 {
|
|
3003 case 2:
|
|
3004 v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
|
|
3005 *v15 |= 0x40u;
|
|
3006 break;
|
|
3007 case 3:
|
|
3008 v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
|
|
3009 *v14 |= 0x80u;
|
|
3010 break;
|
|
3011 case 4:
|
|
3012 v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number];
|
|
3013 v13[1] |= 1u;
|
|
3014 break;
|
|
3015 }
|
|
3016 pPlayers[uActiveCharacter]->PlaySound(SPEECH_85, 0);
|
|
3017 }
|
|
3018 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
3019 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3020 {
|
|
3021 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3022 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
3023 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3024 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3025 }*/
|
|
3026 }
|
|
3027 }
|
|
3028 else
|
|
3029 {
|
|
3030 if (uMessageParam == 82 && contract_approved) //join guild
|
|
3031 {
|
|
3032 Party::TakeGold(gold_transaction_amount);
|
|
3033 v4 = pParty->pPlayers.data();
|
|
3034 do
|
|
3035 {
|
|
3036 v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number);
|
|
3037 ++v4;
|
|
3038 } while ((signed int)v4 < (signed int)pParty->pHirelings.data());
|
|
3039 switch (dword_F8B1D8)
|
|
3040 {
|
|
3041 case 19:
|
|
3042 pEventNumber = pCurrentNPCInfo->evt_A;
|
|
3043 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3044 pCurrentNPCInfo->evt_A = 0;
|
|
3045 break;
|
|
3046 case 20:
|
|
3047 pEventNumber = pCurrentNPCInfo->evt_B;
|
|
3048 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3049 pCurrentNPCInfo->evt_B = 0;
|
|
3050 break;
|
|
3051 case 21:
|
|
3052 pEventNumber = pCurrentNPCInfo->evt_C;
|
|
3053 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3054 pCurrentNPCInfo->evt_C = 0;
|
|
3055 break;
|
|
3056 case 22:
|
|
3057 pEventNumber = pCurrentNPCInfo->evt_D;
|
|
3058 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3059 pCurrentNPCInfo->evt_D = 0;
|
|
3060 break;
|
|
3061 case 23:
|
|
3062 pEventNumber = pCurrentNPCInfo->evt_E;
|
|
3063 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3064 pCurrentNPCInfo->evt_E = 0;
|
|
3065 break;
|
|
3066 case 24:
|
|
3067 pEventNumber = pCurrentNPCInfo->evt_F;
|
|
3068 if (pEventNumber >= 400 && pEventNumber <= 416)
|
|
3069 pCurrentNPCInfo->evt_F = 0;
|
|
3070 break;
|
|
3071 }
|
|
3072 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
3073 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3074 {
|
|
3075 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3076 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
3077 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3078 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3079 }*/
|
|
3080 //v11 = uActiveCharacter;
|
|
3081 if (uActiveCharacter)
|
|
3082 {
|
|
3083 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_86, 0);
|
|
3084 BackToHouseMenu();
|
|
3085 return;
|
|
3086 }
|
|
3087 }
|
|
3088 }
|
|
3089 }
|
|
3090 BackToHouseMenu();
|
|
3091 return;
|
|
3092 }
|
|
3093 if (pParty->pHirelings[0].pName && pParty->pHirelings[1].pName)
|
|
3094 {
|
|
3095 ShowStatusBarString(pGlobalTXT_LocalizationStrings[533], 2);// ""I cannot join you, you're party is full""
|
|
3096 BackToHouseMenu();
|
|
3097 return;
|
|
3098 }
|
|
3099
|
|
3100
|
|
3101 if (pCurrentNPCInfo->uProfession != 51) //burglars have no hiring price
|
|
3102 {
|
|
3103 __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
|
|
3104 pPrice = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].uHirePrice;
|
|
3105 if (pParty->uNumGold < (unsigned int)pPrice)
|
|
3106 {
|
|
3107 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
3108 dialogue_show_profession_details = false;
|
|
3109 uDialogueType = 13;
|
|
3110 current_npc_text = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;
|
|
3111 current_npc_text = BuildDialogueString(current_npc_text, uActiveCharacter - 1, 0, 0, 0, 0);
|
|
3112 if (uActiveCharacter)
|
|
3113 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
|
|
3114 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2);
|
|
3115 BackToHouseMenu();
|
|
3116 return;
|
|
3117 }
|
|
3118 else
|
|
3119 Party::TakeGold(pPrice);
|
|
3120 }
|
|
3121 //LOBYTE(v2->uFlags) |= 0x80u;
|
|
3122 pCurrentNPCInfo->uFlags |= 128;
|
|
3123 pParty->hirelingScrollPosition = 0;
|
|
3124 pParty->CountHirelings();
|
|
3125 if (pParty->pHirelings[0].pName)
|
|
3126 {
|
|
3127 memcpy(&pParty->pHirelings[1], pCurrentNPCInfo, sizeof(pParty->pHirelings[1]));
|
|
3128 v24 = pCurrentNPCInfo->pName;
|
|
3129 v22 = pParty->pHireling2Name;
|
|
3130 }
|
|
3131 else
|
|
3132 {
|
|
3133 memcpy(pParty->pHirelings.data(), pCurrentNPCInfo, 0x4Cu);
|
|
3134 v24 = pCurrentNPCInfo->pName;
|
|
3135 v22 = pParty->pHireling1Name;
|
|
3136 }
|
|
3137 strcpy(v22, v24);
|
|
3138 pParty->hirelingScrollPosition = 0;
|
|
3139 pParty->CountHirelings();
|
|
3140 PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C);
|
|
3141 dialog_menu_id = HOUSE_DIALOGUE_MAIN;
|
|
3142
|
|
3143 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 1, 0);
|
|
3144 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
|
|
3145 {
|
|
3146 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
|
|
3147 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
|
|
3148 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
|
|
3149 ++pMessageQueue_50CBD0->uNumMessages;
|
|
3150 }*/
|
|
3151 if (uActiveCharacter)
|
|
3152 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)61, 0);
|
|
3153
|
|
3154 _return:
|
|
3155 BackToHouseMenu();
|
|
3156 }
|
|
3157
|
|
3158 //----- (004B3FE5) --------------------------------------------------------
|
|
3159 //Originally called _4B254D_SkillMasteryTeacher to have contract_approved assigned, to be able to set some button name.
|
|
3160 //But it the name gets immediately overwritten
|
|
3161 void _4B3FE5_training_dialogue(int a4)
|
|
3162 {
|
|
3163 const char *v2; // edi@1
|
|
3164
|
|
3165 //__debugbreak();
|
|
3166 uDialogueType = DIALOGUE_SKILL_TRAINER;
|
|
3167 current_npc_text = (char *)pNPCTopics[a4 + 168].pText;
|
|
3168 _4B254D_SkillMasteryTeacher(a4); //might be needed because of contract_approved ?
|
|
3169 pDialogueWindow->Release();
|
|
3170 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, a4, 0);
|
|
3171 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0,
|
|
3172 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
3173 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
|
|
3174 v2 = "";
|
|
3175 if (contract_approved)
|
|
3176 v2 = pGlobalTXT_LocalizationStrings[535];
|
|
3177 pDialogueWindow->CreateButton(480, 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0);
|
|
3178 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
|
|
3179 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
|
|
3180 }
|
|
3181 // F8B19C: using guessed type int dword_F8B19C;
|
|
3182 // F8B1A8: using guessed type int dword_F8B1A8;
|
|
3183 //----- (004B1ECE) --------------------------------------------------------
|
|
3184 void OracleDialogue()
|
|
3185 {
|
|
3186 __int16 *v0; // edi@1
|
|
3187 signed int v4; // eax@9
|
|
3188 int v5; // ebx@11
|
|
3189 signed int v8; // edi@14
|
|
3190 ItemGen *v9; // [sp+Ch] [bp-Ch]@11
|
|
3191 signed int v10; // [sp+10h] [bp-8h]@13
|
|
3192 int v11; // [sp+14h] [bp-4h]@1
|
|
3193
|
|
3194 contract_approved = 0;
|
|
3195 v11 = 0;
|
|
3196 uDialogueType = 84;
|
|
3197 current_npc_text = (char *)pNPCTopics[667].pText;
|
|
3198 v0 = _4F0882_evt_VAR_PlayerItemInHands_vals.data();
|
|
3199 //while ( 1 )
|
|
3200 for (uint i = 0; i <= 53; i++)
|
|
3201 {
|
|
3202 if ((unsigned __int16)_449B57_test_bit(pParty->_quest_bits, *v0))
|
|
3203 {
|
|
3204 //v1 = 0;
|
|
3205 //v2 = pParty->pPlayers.data();
|
|
3206 for (uint pl = 0; pl < 4; pl++)
|
|
3207 {
|
|
3208 //LOBYTE(v3) = pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0+1));
|
|
3209 if (pParty->pPlayers[pl].CompareVariable(VAR_PlayerItemInHands, *(v0 + 1)))
|
|
3210 break;
|
|
3211 //++v2;
|
|
3212 //++v1;
|
|
3213 }
|
|
3214 //while ( (signed int)v2 < (signed int)pParty->pHirelings.data() );
|
|
3215 //if ( v1 == 4 )
|
|
3216 //break;
|
|
3217 }
|
|
3218 ++v11;
|
|
3219 //v0 += 2;
|
|
3220 //if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
|
|
3221 //break;
|
|
3222 }
|
|
3223 if (v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53])
|
|
3224 {
|
|
3225 current_npc_text = (char *)pNPCTopics[666].pText; // Here's %s that you lost. Be careful
|
|
3226 v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
|
|
3227 contract_approved = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
|
|
3228 pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
|
|
3229 }
|
|
3230 if (contract_approved == 601)
|
|
3231 {
|
|
3232 v5 = 0;
|
|
3233 //v12 = pParty->pPlayers.data();//[0].uClass;
|
|
3234 v9 = 0;
|
|
3235 //while ( 1 )
|
|
3236 for (uint i = 0; i < 4; i++)
|
|
3237 {
|
|
3238 if (pParty->pPlayers[i].classType == PLAYER_CLASS_LICH)
|
|
3239 {
|
|
3240 v10 = 0;
|
|
3241 //v6 = pParty->pPlayers.data();//[0].pInventoryItems[0].field_1A;
|
|
3242 for (uint pl = 0; pl < 4; pl++)
|
|
3243 {
|
|
3244 for (v8 = 0; v8 < 126; v8++)//138
|
|
3245 {
|
|
3246 if (pParty->pPlayers[pl].pInventoryItemList[v8].uItemID == ITEM_LICH_JAR_FULL)
|
|
3247 {
|
|
3248 if (!pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer)
|
|
3249 v9 = &pParty->pPlayers[pl].pInventoryItemList[v8];
|
|
3250 if (pParty->pPlayers[pl].pInventoryItemList[v8].uHolderPlayer == v5)
|
|
3251 v10 = 1;
|
|
3252 }
|
|
3253 }
|
|
3254 }
|
|
3255 if (!v10)
|
|
3256 break;
|
|
3257 }
|
|
3258 // ++v12;
|
|
3259 ++v5;
|
|
3260 // if ( v12 > &pParty->pPlayers[3] )
|
|
3261 // return;
|
|
3262 }
|
|
3263 if (v9)
|
|
3264 v9->uHolderPlayer = v5;
|
|
3265 }
|
|
3266 }
|
|
3267
|
|
3268 //----- (004B46A5) --------------------------------------------------------
|
|
3269 void __fastcall DrawTextAtStatusBar(const char *Str, int a5)
|
|
3270 {
|
|
3271 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
|
|
3272 pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, Str) + 11, 357, a5, Str, 0, 0, 0);
|
|
3273 }
|
|
3274
|
|
3275 //----- (004BBA85) --------------------------------------------------------
|
|
3276 void CheckBountyRespawnAndAward()
|
|
3277 {
|
|
3278 int i; // eax@2
|
|
3279 int rand_monster_id; // edx@3
|
|
3280
|
|
3281 uDialogueType = 83;
|
|
3282 pDialogueWindow->Release();
|
|
3283 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, 0, 0);
|
|
3284 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
|
|
3285 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
|
|
3286 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
|
|
3287 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_0, 83, 0, "", 0);
|
|
3288 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2);
|
|
3289 dialog_menu_id = HOUSE_DIALOGUE_OTHER;
|
|
3290 //get new monster for hunting
|
|
3291 if (pParty->PartyTimes.bountyHunting_next_generation_time[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] < (signed __int64)pParty->uTimePlayed)
|
|
3292 {
|
|
3293 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false;
|
|
3294 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);
|
|
3295 for (i = rand();; i = rand())
|
|
3296 {
|
|
3297 rand_monster_id = i % 258 + 1;
|
|
3298 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = rand_monster_id;
|
|
3299 if ((unsigned __int16)rand_monster_id < 0x73u || (unsigned __int16)rand_monster_id > 0x84u)
|
|
3300 {
|
|
3301 if (((unsigned __int16)rand_monster_id < 0xEBu || (unsigned __int16)rand_monster_id > 0xFCu)
|
|
3302 && ((unsigned __int16)rand_monster_id < 0x85u || (unsigned __int16)rand_monster_id > 0x96u)
|
|
3303 && ((unsigned __int16)rand_monster_id < 0x97u || (unsigned __int16)rand_monster_id > 0xBAu)
|
|
3304 && ((unsigned __int16)rand_monster_id < 0xC4u || (unsigned __int16)rand_monster_id > 0xC6u))
|
|
3305 break;
|
|
3306 }
|
|
3307 }
|
|
3308 }
|
|
3309 bountyHunting_monster_id_for_hunting = pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)];
|
|
3310 if (!pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)])
|
|
3311 {
|
|
3312 bountyHunting_text = pNPCTopics[351].pText;
|
|
3313 if (!pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)])
|
|
3314 bountyHunting_text = pNPCTopics[353].pText;
|
|
3315 }
|
|
3316 else//get prize
|
|
3317 {
|
|
3318 if (pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)])
|
|
3319 {
|
|
3320 pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0);
|
|
3321 for (uint i = 0; i < 4; ++i)
|
|
3322 pParty->pPlayers[i].SetVariable(VAR_Award, 86);
|
|
3323 pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel;
|
|
3324 pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = 0;
|
|
3325 pParty->monster_for_hunting_killed[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] = false;
|
|
3326 }
|
|
3327 bountyHunting_text = pNPCTopics[352].pText;
|
|
3328 }
|
|
3329 }
|
|
3330
|
|
3331 //----- (004B254D) --------------------------------------------------------
|
|
3332 const char * _4B254D_SkillMasteryTeacher(int trainerInfo)
|
|
3333 {
|
|
3334 int teacherLevel; // edx@1
|
|
3335 int skillBeingTaught; // ecx@1
|
|
3336 int pClassType; // eax@7
|
|
3337 int currClassMaxMastery; // eax@7
|
|
3338 int pointsInSkillWOutMastery; // ebx@7
|
|
3339 int classBaseId; // eax@8
|
|
3340 unsigned int skillMastery; // eax@29
|
|
3341 unsigned __int16 pointsInSkill; // [sp+1Ch] [bp-10h]@7
|
|
3342 int masteryLevelBeingTaught; // [sp+24h] [bp-8h]@7
|
|
3343
|
|
3344 contract_approved = 0;
|
|
3345 teacherLevel = (trainerInfo - 200) % 3;
|
|
3346 skillBeingTaught = (trainerInfo - 200) / 3;
|
|
3347 Player* activePlayer = pPlayers[uActiveCharacter];
|
|
3348 pClassType = activePlayer->classType;
|
|
3349 currClassMaxMastery = byte_4ED970_skill_learn_ability_by_class_table[pClassType][skillBeingTaught];
|
|
3350 masteryLevelBeingTaught = teacherLevel + 2;
|
|
3351 dword_F8B1B0_MasteryBeingTaught = masteryLevelBeingTaught;
|
|
3352 if (currClassMaxMastery < masteryLevelBeingTaught)
|
|
3353 {
|
|
3354 classBaseId = pClassType - pClassType % 4;
|
|
3355 if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 1][skillBeingTaught] >= masteryLevelBeingTaught)
|
|
3356 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 1]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level.
|
|
3357 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught
|
|
3358 && byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught)
|
|
3359 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.
|
|
3360 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 2][skillBeingTaught] >= masteryLevelBeingTaught)
|
|
3361 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 2]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level.
|
|
3362 else if (byte_4ED970_skill_learn_ability_by_class_table[classBaseId + 3][skillBeingTaught] >= masteryLevelBeingTaught)
|
|
3363 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[633], pClassNames[classBaseId + 3]);//Вы должны достичь звания %s для обучения этому уровню навыка. You have to be promoted to %s to learn this skill level.
|
|
3364 else
|
|
3365 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[632], pClassNames[pClassType]);//Этот уровень навыка не может быть постигнут классом %s. This skill level can not be learned by the %s class.
|
|
3366 return pTmpBuf.data();
|
|
3367 }
|
|
3368 if (!activePlayer->CanAct())
|
|
3369 return pNPCTopics[122].pText; //Not in your condition!
|
|
3370 pointsInSkill = activePlayer->pActiveSkills[skillBeingTaught];
|
|
3371 pointsInSkillWOutMastery = pointsInSkill & 0x3F;
|
|
3372 if (!pointsInSkillWOutMastery)
|
|
3373 return pNPCTopics[131].pText; //You must know the skill before you can become an expert in it!
|
|
3374 skillMastery = SkillToMastery(pointsInSkill);
|
|
3375 if ((signed int)skillMastery > teacherLevel + 1)
|
|
3376 return pNPCTopics[teacherLevel + 128].pText; // You are already an SKILLLEVEL in this skill.
|
|
3377 dword_F8B1AC_award_bit_number = skillBeingTaught;
|
|
3378 if (masteryLevelBeingTaught == 2 && pointsInSkillWOutMastery < 4
|
|
3379 || masteryLevelBeingTaught == 3 && pointsInSkillWOutMastery < 7
|
|
3380 || masteryLevelBeingTaught == 4 && pointsInSkillWOutMastery < 10
|
|
3381 )
|
|
3382 return pNPCTopics[127].pText; //"You don't meet the requirements, and cannot be taught until you do."
|
|
3383 switch (dword_F8B1AC_award_bit_number)
|
|
3384 {
|
|
3385 case PLAYER_SKILL_STAFF:
|
|
3386 case PLAYER_SKILL_SWORD:
|
|
3387 case PLAYER_SKILL_DAGGER:
|
|
3388 case PLAYER_SKILL_AXE:
|
|
3389 case PLAYER_SKILL_SPEAR:
|
|
3390 case PLAYER_SKILL_BOW:
|
|
3391 case PLAYER_SKILL_MACE:
|
|
3392 case PLAYER_SKILL_ARMSMASTER:
|
|
3393 switch (masteryLevelBeingTaught)
|
|
3394 {
|
|
3395 case 2:
|
|
3396 gold_transaction_amount = 2000;
|
|
3397 break;
|
|
3398 case 3:
|
|
3399 gold_transaction_amount = 5000;
|
|
3400 break;
|
|
3401 case 4:
|
|
3402 gold_transaction_amount = 8000;
|
|
3403 break;
|
|
3404 }
|
|
3405 break;
|
|
3406 case PLAYER_SKILL_BLASTER:
|
|
3407 switch (masteryLevelBeingTaught)
|
|
3408 {
|
|
3409 case 2:
|
|
3410 gold_transaction_amount = 0;
|
|
3411 break;
|
|
3412 case 3:
|
|
3413 gold_transaction_amount = 0;
|
|
3414 break;
|
|
3415 case 4:
|
|
3416 gold_transaction_amount = 0;
|
|
3417 break;
|
|
3418 }
|
|
3419 break;
|
|
3420 case PLAYER_SKILL_SHIELD:
|
|
3421 case PLAYER_SKILL_LEATHER:
|
|
3422 case PLAYER_SKILL_CHAIN:
|
|
3423 case PLAYER_SKILL_PLATE:
|
|
3424 switch (masteryLevelBeingTaught)
|
|
3425 {
|
|
3426 case 2:
|
|
3427 gold_transaction_amount = 1000;
|
|
3428 break;
|
|
3429 case 3:
|
|
3430 gold_transaction_amount = 3000;
|
|
3431 break;
|
|
3432 case 4:
|
|
3433 gold_transaction_amount = 7000;
|
|
3434 break;
|
|
3435 }
|
|
3436 break;
|
|
3437 case PLAYER_SKILL_FIRE:
|
|
3438 case PLAYER_SKILL_AIR:
|
|
3439 case PLAYER_SKILL_WATER:
|
|
3440 case PLAYER_SKILL_EARTH:
|
|
3441 case PLAYER_SKILL_SPIRIT:
|
|
3442 case PLAYER_SKILL_MIND:
|
|
3443 case PLAYER_SKILL_BODY:
|
|
3444 switch (masteryLevelBeingTaught)
|
|
3445 {
|
|
3446 case 2:
|
|
3447 gold_transaction_amount = 1000;
|
|
3448 break;
|
|
3449 case 3:
|
|
3450 gold_transaction_amount = 4000;
|
|
3451 break;
|
|
3452 case 4:
|
|
3453 gold_transaction_amount = 8000;
|
|
3454 break;
|
|
3455 }
|
|
3456 break;
|
|
3457 case PLAYER_SKILL_LIGHT:
|
|
3458 switch (masteryLevelBeingTaught)
|
|
3459 {
|
|
3460 case 2:
|
|
3461 gold_transaction_amount = 2000;
|
|
3462 break;
|
|
3463 case 3:
|
|
3464 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 114))
|
|
3465 return pNPCTopics[127].pText;
|
|
3466 gold_transaction_amount = 5000;
|
|
3467 break;
|
|
3468 case 4:
|
|
3469 if (!activePlayer->ProfessionOrGuildFlagsCorrect(0x22u, 1) ||
|
|
3470 !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Au, 1))
|
|
3471 return pNPCTopics[127].pText;
|
|
3472 gold_transaction_amount = 8000;
|
|
3473 break;
|
|
3474 }
|
|
3475 break;
|
|
3476 case PLAYER_SKILL_DARK:
|
|
3477 switch (masteryLevelBeingTaught)
|
|
3478 {
|
|
3479 case 2:
|
|
3480 gold_transaction_amount = 2000;
|
|
3481 break;
|
|
3482 case 3:
|
|
3483 if (!(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 110))
|
|
3484 return pNPCTopics[127].pText;
|
|
3485 gold_transaction_amount = 5000;
|
|
3486 break;
|
|
3487 case 4:
|
|
3488 if (!activePlayer->ProfessionOrGuildFlagsCorrect(0x23u, 1)
|
|
3489 || !activePlayer->ProfessionOrGuildFlagsCorrect(0x1Bu, 1))
|
|
3490 return pNPCTopics[127].pText;
|
|
3491 gold_transaction_amount = 8000;
|
|
3492 break;
|
|
3493 }
|
|
3494 break;
|
|
3495 case PLAYER_SKILL_ITEM_ID:
|
|
3496 case PLAYER_SKILL_REPAIR:
|
|
3497 case PLAYER_SKILL_MEDITATION:
|
|
3498 case PLAYER_SKILL_PERCEPTION:
|
|
3499 case PLAYER_SKILL_TRAP_DISARM:
|
|
3500 case PLAYER_SKILL_MONSTER_ID:
|
|
3501 case PLAYER_SKILL_STEALING:
|
|
3502 case PLAYER_SKILL_ALCHEMY:
|
|
3503 switch (masteryLevelBeingTaught)
|
|
3504 {
|
|
3505 case 2:
|
|
3506 gold_transaction_amount = 500;
|
|
3507 break;
|
|
3508 case 3:
|
|
3509 gold_transaction_amount = 2500;
|
|
3510 break;
|
|
3511 case 4:
|
|
3512 gold_transaction_amount = 6000;
|
|
3513 break;
|
|
3514 }
|
|
3515 break;
|
|
3516 case PLAYER_SKILL_MERCHANT:
|
|
3517 switch (masteryLevelBeingTaught)
|
|
3518 {
|
|
3519 case 2:
|
|
3520 gold_transaction_amount = 2000;
|
|
3521 break;
|
|
3522 case 3:
|
|
3523 if (activePlayer->GetBaseWillpower() < 50)
|
|
3524 return pNPCTopics[127].pText;
|
|
3525 gold_transaction_amount = 5000;
|
|
3526 break;
|
|
3527 case 4:
|
|
3528 gold_transaction_amount = 8000;
|
|
3529 break;
|
|
3530 }
|
|
3531 break;
|
|
3532 case PLAYER_SKILL_BODYBUILDING:
|
|
3533 switch (masteryLevelBeingTaught)
|
|
3534 {
|
|
3535 case 2:
|
|
3536 gold_transaction_amount = 500;
|
|
3537 break;
|
|
3538 case 3:
|
|
3539 if (activePlayer->GetBaseEndurance() < 50)
|
|
3540 return pNPCTopics[127].pText;
|
|
3541 gold_transaction_amount = 2500;
|
|
3542 break;
|
|
3543 case 4:
|
|
3544 gold_transaction_amount = 6000;
|
|
3545 break;
|
|
3546 }
|
|
3547 break;
|
|
3548 case PLAYER_SKILL_DIPLOMACY:
|
|
3549 Error("Diplomacy not used");
|
|
3550 break;
|
|
3551 case PLAYER_SKILL_TIEVERY:
|
|
3552 Error("Thievery not used");
|
|
3553 break;
|
|
3554 case PLAYER_SKILL_DODGE:
|
|
3555 switch (masteryLevelBeingTaught)
|
|
3556 {
|
|
3557 case 2:
|
|
3558 gold_transaction_amount = 2000;
|
|
3559 break;
|
|
3560 case 3:
|
|
3561 gold_transaction_amount = 5000;
|
|
3562 break;
|
|
3563 case 4:
|
|
3564 if ((activePlayer->pActiveSkills[PLAYER_SKILL_UNARMED] & 63) < 0xA)
|
|
3565 return pNPCTopics[127].pText;
|
|
3566 gold_transaction_amount = 8000;
|
|
3567 break;
|
|
3568 }
|
|
3569 break;
|
|
3570 case PLAYER_SKILL_UNARMED:
|
|
3571 switch (masteryLevelBeingTaught)
|
|
3572 {
|
|
3573 case 2:
|
|
3574 gold_transaction_amount = 2000;
|
|
3575 break;
|
|
3576 case 3:
|
|
3577 gold_transaction_amount = 5000;
|
|
3578 break;
|
|
3579 case 4:
|
|
3580 if ((activePlayer->pActiveSkills[PLAYER_SKILL_DODGE] & 63) < 0xA)
|
|
3581 return pNPCTopics[127].pText;
|
|
3582 gold_transaction_amount = 8000;
|
|
3583 break;
|
|
3584 }
|
|
3585 break;
|
|
3586 case PLAYER_SKILL_LEARNING:
|
|
3587 switch (masteryLevelBeingTaught)
|
|
3588 {
|
|
3589 case 2:
|
|
3590 gold_transaction_amount = 2000;
|
|
3591 break;
|
|
3592 case 3:
|
|
3593 if (activePlayer->GetBaseIntelligence() < 50)
|
|
3594 return pNPCTopics[127].pText;
|
|
3595 gold_transaction_amount = 5000;
|
|
3596 break;
|
|
3597 case 4:
|
|
3598 gold_transaction_amount = 8000;
|
|
3599 break;
|
|
3600 }
|
|
3601 break;
|
|
3602 default:
|
|
3603 Error("Unknown skill");
|
|
3604 }
|
|
3605 if (gold_transaction_amount > pParty->uNumGold)
|
|
3606 return pNPCTopics[124].pText; //You don't have enough gold!
|
|
3607 contract_approved = 1;
|
|
3608 if (masteryLevelBeingTaught == 2)
|
|
3609 {
|
|
3610 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],//Получить степень ^Pr[%s] в навыке ^Pr[%s] за ^I[%lu] золот^L[ой;ых;ых]
|
|
3611 pGlobalTXT_LocalizationStrings[433], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Эксперт
|
|
3612 }
|
|
3613 else if (masteryLevelBeingTaught == 3)
|
|
3614 {
|
|
3615 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
|
|
3616 pGlobalTXT_LocalizationStrings[432], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Мастер
|
|
3617 }
|
|
3618 else if (masteryLevelBeingTaught == 4)
|
|
3619 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[534],
|
|
3620 pGlobalTXT_LocalizationStrings[225], pSkillNames[dword_F8B1AC_award_bit_number], gold_transaction_amount);//Великий Магистр
|
|
3621 return pTmpBuf2.data();
|
|
3622 }
|
|
3623
|
|
3624 //----- (00495461) --------------------------------------------------------
|
|
3625 char *BuildDialogueString(const char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6)
|
|
3626 {
|
|
3627 Player *pPlayer; // ebx@3
|
|
3628 const char *pText; // esi@7
|
|
3629 int v17; // eax@10
|
|
3630 signed __int64 v18; // qax@18
|
|
3631 unsigned __int8 *v20; // ebx@32
|
|
3632 int v21; // ecx@34
|
|
3633 int pReputation; // eax@45
|
|
3634 int v29; // eax@68
|
|
3635 __int16 v55[56]; // [sp+10h] [bp-128h]@34
|
|
3636 stru351_summoned_item v56; // [sp+80h] [bp-B8h]@107
|
|
3637 char a1[100]; // [sp+B8h] [bp-80h]@3
|
|
3638 int v63; // [sp+12Ch] [bp-Ch]@32
|
|
3639
|
|
3640 if (IsBadStringPtrA(lpsz, 1))
|
|
3641 return "Invalid String Passed";
|
|
3642
|
|
3643 a1[0] = 0;
|
|
3644 pPlayer = &pParty->pPlayers[uPlayerID];
|
|
3645 memset(pTmpBuf2.data(), 0, sizeof(pTmpBuf2));
|
|
3646
|
|
3647 NPCData *npc = nullptr;
|
|
3648 if (dword_5C35D4)
|
|
3649 npc = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0))]; //- 1
|
|
3650 else
|
|
3651 npc = GetNPCData(sDialogue_SpeakingActorNPC_ID);
|
|
3652
|
|
3653 //pText = a4;
|
|
3654 uint len = strlen(lpsz);
|
|
3655 for (int i = 0, dst = 0; i < len; ++i)
|
|
3656 {
|
|
3657 char c = lpsz[i];
|
|
3658 if (c != '%')
|
|
3659 pTmpBuf2[dst++] = c;
|
|
3660 else
|
|
3661 {
|
|
3662 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0';
|
|
3663
|
|
3664 switch (v17)
|
|
3665 {
|
|
3666 case 1://Подробнее
|
|
3667 strcat(pTmpBuf2.data(), npc->pName);
|
|
3668 dst = strlen(pTmpBuf2.data());
|
|
3669 i += 2;
|
|
3670 break;
|
|
3671 case 2:
|
|
3672 strcat(pTmpBuf2.data(), pPlayer->pName);
|
|
3673 dst = strlen(pTmpBuf2.data());
|
|
3674 i += 2;
|
|
3675 break;
|
|
3676 case 3:
|
|
3677 case 4:
|
|
3678 strcat(pTmpBuf2.data(), a1);
|
|
3679 dst = strlen(pTmpBuf2.data());
|
|
3680 i += 2;
|
|
3681 break;
|
|
3682 case 5:
|
|
3683 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24;
|
|
3684 pText = pGlobalTXT_LocalizationStrings[397];// "evening"
|
|
3685 if (SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0)
|
|
3686 {
|
|
3687 if (SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 11)
|
|
3688 {
|
|
3689 if (v18 < 20)
|
|
3690 pText = pGlobalTXT_LocalizationStrings[396];// "day"
|
|
3691 }
|
|
3692 else
|
|
3693 {
|
|
3694 pText = pGlobalTXT_LocalizationStrings[395];// "morning"
|
|
3695 }
|
|
3696 }
|
|
3697 strcat(pTmpBuf2.data(), pText);
|
|
3698 dst = strlen(pTmpBuf2.data());
|
|
3699 i += 2;
|
|
3700 break;
|
|
3701 case 6:
|
|
3702 if (pPlayer->uSex)
|
|
3703 pText = pGlobalTXT_LocalizationStrings[387];// "lady"
|
|
3704 else
|
|
3705 pText = pGlobalTXT_LocalizationStrings[385];// "sir"
|
|
3706 strcat(pTmpBuf2.data(), pText);
|
|
3707 dst = strlen(pTmpBuf2.data());
|
|
3708 i += 2;
|
|
3709 break;
|
|
3710 case 7:
|
|
3711 if (pPlayer->uSex)
|
|
3712 pText = pGlobalTXT_LocalizationStrings[389];// "Lady"
|
|
3713 else
|
|
3714 pText = pGlobalTXT_LocalizationStrings[386];// "Sir"
|
|
3715 strcat(pTmpBuf2.data(), pText);
|
|
3716 dst = strlen(pTmpBuf2.data());
|
|
3717 i += 2;
|
|
3718 break;
|
|
3719 case 8:
|
|
3720 v63 = 0;
|
|
3721 v20 = (unsigned __int8 *)pPlayer->_achieved_awards_bits;
|
|
3722 for (uint _i = 0; _i < 28; ++_i)
|
|
3723 {
|
|
3724 if ((unsigned __int16)_449B57_test_bit(v20, word_4EE150[i]))
|
|
3725 {
|
|
3726 v21 = v63;
|
|
3727 ++v63;
|
|
3728 v55[v63] = word_4EE150[i];
|
|
3729 }
|
|
3730 }
|
|
3731 if (v63)
|
|
3732 {
|
|
3733 if (dword_A74CDC == -1)
|
|
3734 dword_A74CDC = rand() % v63;
|
|
3735 pText = (char *)pAwards[v55[dword_A74CDC]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]];
|
|
3736 }
|
|
3737 else
|
|
3738 pText = (char *)pNPCTopics[55].pText;
|
|
3739 strcat(pTmpBuf2.data(), pText);
|
|
3740 dst = strlen(pTmpBuf2.data());
|
|
3741 i += 2;
|
|
3742 break;
|
|
3743 case 9:
|
|
3744 if (npc->uSex)
|
|
3745 pText = pGlobalTXT_LocalizationStrings[384];// "her"
|
|
3746 else
|
|
3747 pText = pGlobalTXT_LocalizationStrings[383];// "his"
|
|
3748 strcat(pTmpBuf2.data(), pText);
|
|
3749 dst = strlen(pTmpBuf2.data());
|
|
3750 i += 2;
|
|
3751 break;
|
|
3752 case 10:
|
|
3753 if (pPlayer->uSex)
|
|
3754 pText = pGlobalTXT_LocalizationStrings[389];// "Lady"
|
|
3755 else
|
|
3756 pText = pGlobalTXT_LocalizationStrings[388];// "Lord"
|
|
3757 strcat(pTmpBuf2.data(), pText);
|
|
3758 dst = strlen(pTmpBuf2.data());
|
|
3759 i += 2;
|
|
3760 break;
|
|
3761 case 11:
|
|
3762 pReputation = pParty->GetPartyReputation();
|
|
3763 if (pReputation >= 25)
|
|
3764 pText = pGlobalTXT_LocalizationStrings[379];
|
|
3765 else//v25 < 25
|
|
3766 {
|
|
3767 if (pReputation < 6)
|
|
3768 {
|
|
3769 if (pReputation >= -5)//6 >= v25 >= -5
|
|
3770 pText = pGlobalTXT_LocalizationStrings[399];
|
|
3771 else// v25 < -5
|
|
3772 {
|
|
3773 if (pReputation < -24)//-24 > v25
|
|
3774 pText = pGlobalTXT_LocalizationStrings[434];
|
|
3775 else// -5 > v25 > -24
|
|
3776 pText = pGlobalTXT_LocalizationStrings[402];
|
|
3777 }
|
|
3778 }
|
|
3779 else//25 > v25 > 6
|
|
3780 pText = pGlobalTXT_LocalizationStrings[392];
|
|
3781 }
|
|
3782 strcat(pTmpBuf2.data(), pText);
|
|
3783 dst = strlen(pTmpBuf2.data());
|
|
3784 i += 2;
|
|
3785 break;
|
|
3786 case 12:
|
|
3787 pReputation = npc->rep;
|
|
3788 if (pReputation >= 25)
|
|
3789 pText = pGlobalTXT_LocalizationStrings[379];//Ненавистный
|
|
3790 else
|
|
3791 {
|
|
3792 if (pReputation < 6)
|
|
3793 {
|
|
3794 if (pReputation >= -5)
|
|
3795 pText = pGlobalTXT_LocalizationStrings[399];//Нейтральная
|
|
3796 else
|
|
3797 {
|
|
3798 if (pReputation < -24)
|
|
3799 pText = pGlobalTXT_LocalizationStrings[434];//Почтенная
|
|
3800 else
|
|
3801 pText = pGlobalTXT_LocalizationStrings[402];//Дружелюбный
|
|
3802 }
|
|
3803 }
|
|
3804 else
|
|
3805 pText = pGlobalTXT_LocalizationStrings[392];//Недружелюбный
|
|
3806 }
|
|
3807 strcat(pTmpBuf2.data(), pText);
|
|
3808 dst = strlen(pTmpBuf2.data());
|
|
3809 i += 2;
|
|
3810 break;
|
|
3811 case 13:
|
|
3812 strcat(pTmpBuf2.data(), pNPCStats->sub_495366_MispronounceName(pPlayer->pName[0], pPlayer->uSex));
|
|
3813 dst = strlen(pTmpBuf2.data());
|
|
3814 i += 2;
|
|
3815 break;
|
|
3816 case 14:
|
|
3817 if (npc->uSex)
|
|
3818 pText = pGlobalTXT_LocalizationStrings[391];// "sister"
|
|
3819 else
|
|
3820 pText = pGlobalTXT_LocalizationStrings[390];// "brother"
|
|
3821 strcat(pTmpBuf2.data(), pText);
|
|
3822 dst = strlen(pTmpBuf2.data());
|
|
3823 i += 2;
|
|
3824 break;
|
|
3825 case 15:
|
|
3826 strcat(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[393]);// "daughter"
|
|
3827 dst = strlen(pTmpBuf2.data());
|
|
3828 i += 2;
|
|
3829 break;
|
|
3830 case 16:
|
|
3831 if (npc->uSex)
|
|
3832 pText = pGlobalTXT_LocalizationStrings[391];// "sister"
|
|
3833 else
|
|
3834 pText = pGlobalTXT_LocalizationStrings[390];// "brother"
|
|
3835 strcat(pTmpBuf2.data(), pText);
|
|
3836 dst = strlen(pTmpBuf2.data());
|
|
3837 i += 2;
|
|
3838 break;
|
|
3839 case 17://текст наёмного НПС
|
|
3840 {
|
|
3841 uint pay_percentage = pNPCStats->pProfessions[npc->uProfession].uHirePrice / 100;
|
|
3842 if (!pay_percentage)
|
|
3843 pay_percentage = 1;
|
|
3844 sprintf(a1, "%lu", pay_percentage);
|
|
3845 strcat(pTmpBuf2.data(), a1);
|
|
3846 dst = strlen(pTmpBuf2.data());
|
|
3847 i += 2;
|
|
3848 break;
|
|
3849 }
|
|
3850 case 18:
|
|
3851 case 19:
|
|
3852 case 20:
|
|
3853 case 21:
|
|
3854 case 22:
|
|
3855 case 26:
|
|
3856 strncpy(a1, lpsz + i + 1, 2);
|
|
3857 sprintf(a1, "%lu", atoi(a1));
|
|
3858 strcat(pTmpBuf2.data(), a1);
|
|
3859 dst = strlen(pTmpBuf2.data());
|
|
3860 i += 2;
|
|
3861 break;
|
|
3862 case 23:
|
|
3863 if (pMapStats->GetMapInfo(pCurrentMapName))
|
|
3864 pText = pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName;
|
|
3865 else
|
|
3866 pText = pGlobalTXT_LocalizationStrings[394];// "Unknown"
|
|
3867 strcat(pTmpBuf2.data(), pText);
|
|
3868 dst = strlen(pTmpBuf2.data());
|
|
3869 i += 2;
|
|
3870 break;
|
|
3871 case 24://название товара в продаже
|
|
3872 sprintfex(a1, format_4E2D80, Color16(255, 255, 155), a3->GetDisplayName());
|
|
3873 strcat(pTmpBuf2.data(), a1);
|
|
3874 dst = strlen(pTmpBuf2.data());
|
|
3875 i += 2;
|
|
3876 break;
|
|
3877 case 25:
|
|
3878 v29 = pPlayer->GetBaseBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3879 switch (a5)
|
|
3880 {
|
|
3881 case 3:
|
|
3882 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3883 break;
|
|
3884 case 4:
|
|
3885 v29 = pPlayer->GetBaseIdentifyPrice(p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3886 break;
|
|
3887 case 5:
|
|
3888 v29 = pPlayer->GetBaseRepairPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3889 break;
|
|
3890 case 6:
|
|
3891 v29 = pPlayer->GetBaseSellingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2;
|
|
3892 break;
|
|
3893 }
|
|
3894 sprintfex(a1, "%lu", v29);
|
|
3895 strcat(pTmpBuf2.data(), a1);
|
|
3896 dst = strlen(pTmpBuf2.data());
|
|
3897 i += 2;
|
|
3898 break;
|
|
3899 case 27://текст продажи
|
|
3900 v29 = pPlayer->GetBuyingPrice(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3901 if (a5 == 3)
|
|
3902 {
|
|
3903 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3904 if (a3->IsBroken())
|
|
3905 v29 = 1;
|
|
3906 sprintfex(a1, "%lu", v29);
|
|
3907 strcat(pTmpBuf2.data(), a1);
|
|
3908 dst = strlen(pTmpBuf2.data());
|
|
3909 i += 2;
|
|
3910 break;
|
|
3911 }
|
|
3912 if (a5 != 4)
|
|
3913 {
|
|
3914 if (a5 == 5)
|
|
3915 v29 = pPlayer->GetPriceRepair(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier);
|
|
3916 else
|
|
3917 {
|
|
3918 if (a5 == 6)
|
|
3919 {
|
|
3920 v29 = pPlayer->GetPriceSell(a3->GetValue(), p2DEvents[(signed int)a4 - 1].fPriceMultiplier) / 2;
|
|
3921 if (a3->IsBroken())
|
|
3922 v29 = 1;
|
|
3923 if (!v29)
|
|
3924 v29 = 1;
|
|
3925 sprintfex(a1, "%lu", v29);
|
|
3926 strcat(pTmpBuf2.data(), a1);
|
|
3927 dst = strlen(pTmpBuf2.data());
|
|
3928 i += 2;
|
|
3929 break;
|
|
3930 }
|
|
3931 }
|
|
3932 sprintfex(a1, "%lu", v29);
|
|
3933 strcat(pTmpBuf2.data(), a1);
|
|
3934 dst = strlen(pTmpBuf2.data());
|
|
3935 i += 2;
|
|
3936 break;
|
|
3937 }
|
|
3938 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier));
|
|
3939 strcat(pTmpBuf2.data(), a1);
|
|
3940 dst = strlen(pTmpBuf2.data());
|
|
3941 i += 2;
|
|
3942 break;
|
|
3943 case 28://профессия
|
|
3944 strcat(pTmpBuf2.data(), (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle);
|
|
3945 dst = strlen(pTmpBuf2.data());
|
|
3946 i += 2;
|
|
3947 break;
|
|
3948 case 29:
|
|
3949 sprintfex(a1, "%lu", pPlayer->GetPriceIdentification(p2DEvents[(signed int)a4 - 1].fPriceMultiplier));
|
|
3950 strcat(pTmpBuf2.data(), a1);
|
|
3951 dst = strlen(pTmpBuf2.data());
|
|
3952 i += 2;
|
|
3953 break;
|
|
3954 case 30:
|
|
3955 if (!a6)
|
|
3956 {
|
|
3957 strcat(pTmpBuf2.data(), a4);
|
|
3958 dst = strlen(pTmpBuf2.data());
|
|
3959 i += 2;
|
|
3960 break;
|
|
3961 }
|
|
3962 init_summoned_item(&v56, *a6);
|
|
3963 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
|
|
3964 strcat(pTmpBuf2.data(), a1);
|
|
3965 dst = strlen(pTmpBuf2.data());
|
|
3966 i += 2;
|
|
3967 break;
|
|
3968 case 31:
|
|
3969 case 32:
|
|
3970 case 33:
|
|
3971 case 34:
|
|
3972 strcat(pTmpBuf2.data(), pParty->pPlayers[v17 - 31].pName);
|
|
3973 dst = strlen(pTmpBuf2.data());
|
|
3974 i += 2;
|
|
3975 break;
|
|
3976 default:
|
|
3977 if (v17 <= 50 || v17 > 70)
|
|
3978 {
|
|
3979 strncpy(a1, lpsz + i + 1, 2);
|
|
3980 sprintf(a1, "%lu", atoi(a1));
|
|
3981 strcat(pTmpBuf2.data(), a1);
|
|
3982 dst = strlen(pTmpBuf2.data());
|
|
3983 i += 2;
|
|
3984 break;
|
|
3985 }
|
|
3986 if (v17 - 51 >= 20)
|
|
3987 {
|
|
3988 strcat(pTmpBuf2.data(), a4);
|
|
3989 dst = strlen(pTmpBuf2.data());
|
|
3990 i += 2;
|
|
3991 break;
|
|
3992 }
|
|
3993 init_summoned_item(&v56, pParty->PartyTimes._s_times[v17 - 51]);
|
|
3994 sprintfex(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v56.field_14_exprie_month], v56.field_C_expire_day + 1, v56.field_18_expire_year);
|
|
3995 strcat(pTmpBuf2.data(), a1);
|
|
3996 dst = strlen(pTmpBuf2.data());
|
|
3997 i += 2;
|
|
3998 break;
|
|
3999 }
|
|
4000 }
|
|
4001 }
|
|
4002 return pTmpBuf2.data();
|
|
4003 }
|
|
4004
|
|
4005 //----- (0044C175) --------------------------------------------------------
|
|
4006 void ShowStatusBarString(const char *pString, unsigned int uNumSeconds)
|
|
4007 {
|
|
4008 strcpy(GameUI_Footer_TimedString.data(), pString);
|
|
4009 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount();
|
|
4010
|
|
4011 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450;
|
|
4012 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()))
|
|
4013 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0;
|
|
4014 }
|
|
4015
|
|
4016 //----- (0044C1D0) --------------------------------------------------------
|
|
4017 void ShowNothingHereStatus()
|
|
4018 {
|
|
4019 if (!GameUI_Footer_TimeLeft)
|
|
4020 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here
|
|
4021 }
|
|
4022
|
|
4023 //----- (0044C28B) --------------------------------------------------------
|
|
4024 int const_2()
|
|
4025 {
|
|
4026 return 2;
|
|
4027 }
|