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